/* ==========================================================================
   Design tokens — dark only, by design
   ========================================================================== */
:root {
  --page: #15191E;           /* base bands */
  --paper: #1A1F25;          /* alternate band */
  --white: #1E242B;          /* raised surfaces: cards, panels */
  --header-bg: #12161B;
  --footer-bg: #101317;
  --navy: #14294A;           /* hero */
  --navy-deep: #0F1F37;
  --tile: #1A2E4A;           /* tiles sitting on the hero */
  --platinum-100: #262C33;
  --platinum: #6F7780;       /* rules, accents only */
  --ink: #E8EBEE;
  --ink-2: #B9C0C7;          /* 9.6:1 on page */
  --ink-3: #9AA2AB;          /* 6.9:1 on page */
  --mark: #9AA2AB;           /* wordmark top row */
  --line: #2D343C;
  --line-strong: #3E464F;
  --on-navy-line: rgba(188, 199, 211, .22);
  --tint: #242A31;
  --action: #A9C1DC;         /* light navy actions on dark */
  --action-ink: #0F1A26;
  --action-hover: #C2D4E7;
  --shadow-1: 0 0 0 1px rgba(255, 255, 255, .03);
  --shadow-2: 0 8px 24px rgba(0, 0, 0, .35);

  --font: "Hanken Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --radius: 10px;
  --radius-sm: 6px;
  --page-max: 1240px;
  --gutter: clamp(20px, 4vw, 48px);
  --header-h: 104px;
  --wm-w: 196px;

  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
html { scroll-padding-top: calc(env(safe-area-inset-top, 0px) + 88px); -webkit-text-size-adjust: 100%; background: var(--page); }
*, *::before, *::after { box-sizing: inherit; }
body { margin: 0; background: var(--page); color: var(--ink); font-family: var(--font); font-size: 1rem; line-height: 1.55; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img, svg { max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -0.01em; line-height: 1.2; }
p { margin: 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--action); outline-offset: 3px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 16px; top: -60px; z-index: 100; background: var(--action); color: var(--action-ink); padding: 10px 16px; border-radius: var(--radius-sm); text-decoration: none; }
.skip-link:focus { top: calc(env(safe-area-inset-top, 0px) + 12px); }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 16px; height: 16px; }
.wrap { max-width: var(--page-max); margin: 0 auto; padding: 0 var(--gutter); }

/* ==========================================================================
   Wordmark
   ========================================================================== */
.wordmark { display: inline-flex; text-decoration: none; color: var(--ink); border-radius: 4px; }
.wordmark svg { display: block; width: var(--wm-w); height: auto; overflow: visible; }
.wordmark .wm-top { fill: var(--mark); font-family: var(--font); font-weight: 500; font-size: 22px; }
.wordmark .wm-rule { stroke: var(--platinum); stroke-width: 1; vector-effect: non-scaling-stroke; }
.wordmark .wm-main { fill: currentColor; font-family: var(--font); font-weight: 400; font-size: 86px; }

/* ==========================================================================
   Header — a masthead that condenses once you scroll
   ========================================================================== */
.site-header { position: sticky; top: 0; z-index: 40; background: var(--header-bg); border-bottom: 1px solid var(--line); }
.header-inner { height: var(--header-h); display: flex; align-items: center; gap: 48px; }
.site-header.is-condensed { --header-h: 72px; --wm-w: 132px; box-shadow: var(--shadow-1); }
.primary-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; }
.primary-nav a { display: block; padding: 8px 12px; border-radius: var(--radius-sm); text-decoration: none; color: var(--ink-2); font-size: 1rem; font-weight: 500; }
.primary-nav a:hover { color: var(--ink); background: var(--tint); }
.primary-nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--action); border-radius: 0; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; position: relative; }
.apps-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 18px; background: var(--action); color: var(--action-ink); border: 0; border-radius: var(--radius-sm); font-weight: 500; font-size: .9375rem; cursor: pointer; }
.apps-btn:hover { background: var(--action-hover); }
.menu-btn { display: none; align-items: center; justify-content: center; width: 44px; height: 44px; background: transparent; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); cursor: pointer; }

.apps-panel { position: absolute; right: 0; top: calc(100% + 12px); width: min(360px, calc(100vw - 32px)); background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-2); padding: 8px; }
.apps-panel[hidden] { display: none; }
.apps-panel h2 { font-size: .8125rem; color: var(--ink-3); font-weight: 500; padding: 10px 12px 6px; letter-spacing: 0; }
.apps-panel ul { list-style: none; margin: 0; padding: 0; }
.apps-panel .row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); text-decoration: none; min-height: 48px; }
.apps-panel a.row:hover { background: var(--tint); }
.apps-panel .row-label { font-weight: 500; flex: 1; }
.apps-panel .row.is-unavailable { color: var(--ink-3); }
.apps-panel .row-status { font-size: .8125rem; color: var(--ink-3); }

.mobile-nav { border-top: 1px solid var(--line); background: var(--header-bg); }
.mobile-nav[hidden] { display: none; }
.mobile-nav ul { list-style: none; margin: 0; padding: 8px 0 16px; }
.mobile-nav a { display: flex; align-items: center; min-height: 48px; padding: 0 4px; text-decoration: none; font-size: 1.0625rem; font-weight: 500; border-bottom: 1px solid var(--line); }
.mobile-nav a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--action); padding-left: 14px; }

/* ==========================================================================
   Hero — purpose, search, and the systems you launch from
   ========================================================================== */
.hero { background: linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%); border-bottom: 1px solid var(--navy-deep); padding: clamp(36px, 5vw, 60px) 0 clamp(32px, 4vw, 48px); }
.hero-grid { display: grid; grid-template-columns: 7fr 5fr; gap: clamp(24px, 5vw, 72px); align-items: end; }
.hero h1 { font-size: clamp(2.25rem, 4.4vw, 3.5rem); font-weight: 500; letter-spacing: -0.028em; line-height: 1.06; }
.h1-line { display: block; }
.hero-lede { margin-top: 16px; color: var(--ink-2); font-size: 1.125rem; max-width: 42ch; }
.search-label { display: block; font-weight: 500; margin-bottom: 10px; }
.search-box { position: relative; }
.search-box .icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--ink-2); pointer-events: none; }
.search-input { width: 100%; height: 60px; padding: 0 56px 0 52px; font: inherit; font-size: 1.0625rem; color: var(--ink); background: var(--tile); border: 1px solid var(--on-navy-line); border-radius: var(--radius); -webkit-appearance: none; appearance: none; }
.search-input::placeholder { color: var(--ink-3); }
.search-input:hover { border-color: rgba(188, 199, 211, .38); }
.search-input:focus { outline: 2px solid var(--action); outline-offset: 3px; }
.search-input::-webkit-search-cancel-button { display: none; }
.search-clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; background: none; border: 0; border-radius: var(--radius-sm); cursor: pointer; color: var(--ink-2); }
.search-clear[hidden] { display: none; }
.search-clear:hover { background: rgba(188, 199, 211, .12); }
.search-help { margin-top: 10px; color: var(--ink-3); font-size: .875rem; }
kbd { font-family: var(--font); font-size: .8125rem; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 6px; color: var(--ink); background: transparent; border-color: var(--on-navy-line); }

.results { margin-top: 28px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 20px 4px; box-shadow: var(--shadow-1); }
.results[hidden] { display: none; }
.results-head { padding-top: 12px; display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.results-head h2 { font-size: 1.0625rem; }
.results-count { color: var(--ink-3); font-size: .875rem; }
.results ul { list-style: none; margin: 0; padding: 0; }
.results li { border-bottom: 1px solid var(--line); }
.results li:last-child { border-bottom: 0; }
.empty { padding: 28px 0; color: var(--ink-2); max-width: 60ch; }
.empty strong { color: var(--ink); font-weight: 600; }
.empty p + p { margin-top: 8px; }

/* System tiles */
.systems-block { margin-top: clamp(32px, 4vw, 44px); }
.systems-block h2 { font-size: 1rem; color: var(--ink-2); font-weight: 500; margin-bottom: 12px; letter-spacing: 0; }
.systems { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; list-style: none; margin: 0; padding: 0; }
.sys { height: 100%; display: flex; align-items: center; gap: 14px; padding: 16px 18px; min-height: 76px; background: var(--tile); border: 1px solid var(--on-navy-line); border-radius: var(--radius); box-shadow: var(--shadow-1); text-decoration: none; }
a.sys:hover { border-color: var(--a); box-shadow: var(--shadow-2); }
.sys-icon { width: 44px; height: 44px; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; color: var(--a); background: var(--a-bg); }
.sys-text { flex: 1; min-width: 0; }
.sys-name { display: block; font-weight: 600; font-size: 1.0625rem; letter-spacing: -0.005em; }
.sys-desc { display: block; color: var(--ink-3); font-size: .875rem; line-height: 1.4; margin-top: 2px; }
.sys-go { color: var(--ink-3); }
a.sys:hover .sys-go { color: var(--a); }
.sys.is-unavailable { background: transparent; box-shadow: none; border: 1px dashed var(--on-navy-line); }
.sys.is-unavailable .sys-icon { color: var(--ink-3); background: rgba(188, 199, 211, .08); }
.sys.is-unavailable .sys-name { color: var(--ink-2); font-weight: 500; }
.accented { --a0: var(--accent, #6F7780); --a: color-mix(in srgb, var(--a0) 62%, #E8EBEE); --a-bg: color-mix(in srgb, var(--a0) 34%, var(--white)); }

/* ==========================================================================
   Bands
   ========================================================================== */
.band { padding: clamp(48px, 6vw, 80px) 0; }
.band-white { background: var(--page); }
.band-paper { background: var(--paper); }
.section-grid { display: grid; grid-template-columns: 3fr 9fr; gap: clamp(20px, 4vw, 56px); }
.section-head h2 { font-size: 1.375rem; }
.section-head h2::before { content: ""; display: block; width: 28px; height: 2px; background: var(--action); margin-bottom: 16px; }
.section-head p { margin-top: 10px; color: var(--ink-2); font-size: .9375rem; max-width: 32ch; }

/* Family — the headquarters moment */
.family-head { display: grid; grid-template-columns: 5fr 7fr; gap: clamp(20px, 5vw, 72px); align-items: end; margin-bottom: clamp(28px, 4vw, 40px); }
.parent-mark { display: inline-block; font-size: .8125rem; font-weight: 500; letter-spacing: .42em; color: var(--mark); padding-bottom: 10px; margin-bottom: 18px; border-bottom: 1px solid var(--platinum); }
.family-head h2 { font-size: clamp(1.875rem, 3.2vw, 2.625rem); letter-spacing: -0.022em; line-height: 1.08; }
.family-head p { color: var(--ink-2); font-size: 1.0625rem; max-width: 52ch; }
.products { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.product { position: relative; display: flex; flex-direction: column; gap: 20px; padding: 28px 26px 24px; height: 100%; min-height: 200px; text-decoration: none; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.product::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--top, var(--a)); }
a.product:hover { box-shadow: var(--shadow-2); border-color: var(--line-strong); }
.product-icon { display: block; width: auto; flex: none; object-fit: contain; }
.product-initials { width: 56px; height: 56px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; color: var(--a); background: var(--a-bg); font-weight: 600; font-size: 1.0625rem; letter-spacing: .02em; flex: none; }
.product h3 { font-size: 1.25rem; letter-spacing: -0.012em; }
.product p { color: var(--ink-3); font-size: .9375rem; margin-top: 6px; }
.product-foot { margin-top: auto; display: flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: .8125rem; }

/* Link rows */
.link-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 32px; }
.link-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.link-grid li { border-bottom: 1px solid var(--line); }
.link-row { display: flex; align-items: flex-start; gap: 14px; padding: 16px 4px; min-height: 64px; text-decoration: none; border-radius: var(--radius-sm); }
a.link-row:hover .link-label { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--platinum); }
.link-row > .icon { margin-top: 2px; color: var(--ink-2); }
.work .link-row:not(.is-unavailable) > .icon { color: var(--action); }
.link-text { flex: 1; min-width: 0; }
.link-label { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 500; }
.link-label .icon-sm { color: var(--ink-3); }
.link-desc { display: block; color: var(--ink-3); font-size: .875rem; margin-top: 2px; }
.link-row.is-unavailable { color: var(--ink-3); cursor: default; }
.link-row.is-unavailable .link-label { color: var(--ink-2); }
.link-cat { color: var(--ink-3); font-size: .8125rem; white-space: nowrap; margin-top: 3px; }
.tag { display: inline-flex; align-items: center; font-size: .75rem; font-weight: 500; line-height: 1; padding: 5px 7px; border-radius: 4px; white-space: nowrap; color: var(--ink-2); background: var(--tint); }

/* Placeholder pages */
.page-head { padding: clamp(40px, 6vw, 72px) 0 32px; }
.page-head h1 { font-size: clamp(2rem, 4vw, 2.75rem); letter-spacing: -0.02em; }
.page-head p { margin-top: 12px; color: var(--ink-2); max-width: 60ch; }
.page-note { margin: 32px 0 56px; padding: 20px; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--ink-2); max-width: 70ch; }

/* Footer */
.site-footer { background: var(--footer-bg); border-top: 1px solid var(--line); padding: 48px 0 56px; color: var(--ink-2); font-size: .9375rem; }
.footer-inner { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.site-footer .wordmark svg { width: 180px; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1100px) {
  .header-inner { gap: 28px; }
  :root { --wm-w: 168px; }
  .primary-nav a { padding: 8px 9px; font-size: .9375rem; }
  .systems { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .link-grid, .products { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  :root { --header-h: 84px; --wm-w: 156px; }
  .primary-nav { display: none; }
  .menu-btn { display: inline-flex; }
  .hero-grid, .section-grid, .family-head { grid-template-columns: 1fr; }
  .hero-grid { align-items: start; }
  .section-head p { max-width: 60ch; }
}
@media (max-width: 600px) {
  :root { --header-h: 72px; --wm-w: 136px; }
  .site-header.is-condensed { --header-h: 64px; --wm-w: 120px; }
  .apps-btn { padding: 0 14px; }
  .systems, .link-grid, .link-grid.two, .products { grid-template-columns: 1fr; }
  .product { min-height: 0; flex-direction: row; align-items: flex-start; gap: 16px; padding: 22px 20px; }
  .product-foot { display: none; }
  .hero-lede { font-size: 1.0625rem; }
  .link-cat, .kbd-hint { display: none; }
  .parent-mark { letter-spacing: .32em; }
}
@media (prefers-reduced-motion: no-preference) {
  .header-inner, .wordmark svg { transition: height .2s ease, width .2s ease; }
  .apps-panel:not([hidden]) { animation: panel-in .14s ease-out; }
  @keyframes panel-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
}

/* ==========================================================================
   Watermark — the Platinum Age bird, fixed behind the page
   ========================================================================== */
:root { --watermark: #3B5F92; --watermark-opacity: .08; }
.watermark {
  position: fixed; z-index: 0; pointer-events: none;
  top: 50%; left: 50%; width: min(118vh, 108vw); aspect-ratio: 820 / 775;
  transform: translate(-50%, -48%);
  background: var(--watermark); opacity: var(--watermark-opacity);
  -webkit-mask: url("../img/nexus-bird-watermark-mask.png") center / contain no-repeat;
          mask: url("../img/nexus-bird-watermark-mask.png") center / contain no-repeat;
}
#main, .site-footer { position: relative; z-index: 1; }
/* bands let the watermark show through; cards stay solid */
.hero { background: linear-gradient(180deg, rgba(20, 41, 74, .72) 0%, rgba(15, 31, 55, .74) 100%) !important; }
.band-white { background: transparent; }
.band-paper { background: rgba(255, 255, 255, .025); }
.site-footer { background: rgba(8, 10, 13, .55); }
.sys { background: rgba(26, 46, 74, .88); }
.product { background: rgba(30, 36, 43, .86); }
.site-header { background: rgba(18, 22, 27, .97); }
@media (max-width: 600px) { .watermark { width: 150vw; transform: translate(-50%, -46%); } }
