/* ------------------------------------------------------------------
   WebSmith — brutalist raw, dark base, electric-lime accent
------------------------------------------------------------------ */

/* font-display: optional prevents font-swap layout shift —
   if the font isn't loaded within ~100ms, the system fallback is used
   for the entire page life and no swap (hence no CLS) occurs.
   Combined with size-adjust fallbacks below, the visual delta is minimal. */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter+Tight:wght@400;500;600&family=JetBrains+Mono:wght@400;500;600&display=optional');

/* Fallback fonts with size-adjust to closely match the metrics of the web fonts.
   These render instantly using system fonts but at adjusted x-height/width
   so the box dimensions don't shift when the real font loads (or doesn't). */
@font-face {
  font-family: "Space Grotesk Fallback";
  src: local("Arial");
  size-adjust: 97%;
  ascent-override: 95%;
  descent-override: 25%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "Inter Tight Fallback";
  src: local("Arial");
  size-adjust: 100%;
  ascent-override: 90%;
  descent-override: 22%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "JetBrains Mono Fallback";
  src: local("Courier New"), local("Courier");
  size-adjust: 96%;
  ascent-override: 90%;
  descent-override: 22%;
  line-gap-override: 0%;
}

:root {
  --bg:        #0B0B0B;
  --bg-2:      #111111;
  --panel:     #161616;
  --line:      #262626;
  --line-2:    #1c1c1c;
  --ink:       #F2F1ED;
  --ink-dim:   #A6A39B;
  --ink-mute:  #8E8B82;  /* bumped from #6E6B63 (3.7:1) to 5.78:1 vs --bg for WCAG AA */
  --accent:    oklch(0.92 0.22 130);   /* electric lime */
  --accent-d:  oklch(0.78 0.22 130);
  --warn:      oklch(0.78 0.18 50);    /* amber */
  --bad:       oklch(0.68 0.22 25);    /* red */

  --f-display: "Space Grotesk", "Space Grotesk Fallback", ui-sans-serif, system-ui, sans-serif;
  --f-body:    "Inter Tight", "Inter Tight Fallback", ui-sans-serif, system-ui, sans-serif;
  --f-mono:    "JetBrains Mono", "JetBrains Mono Fallback", ui-monospace, "SFMono-Regular", monospace;

  --maxw: 1440px;
  --pad:  32px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img, svg { display: block; max-width: 100%; }

/* ---------- shared layout primitives ---------- */

.shell {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--pad);
}

.rule { border-top: 1px solid var(--line); }
.rule-b { border-bottom: 1px solid var(--line); }
.rule-l { border-left: 1px solid var(--line); }
.rule-r { border-right: 1px solid var(--line); }

.mono {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.eyebrow {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.tag-accent {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.tag-accent::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--accent);
  display: inline-block;
}

/* ---------- nav ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.nav__inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  height: 64px;
  gap: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.brand__mark {
  width: 22px;
  height: 22px;
  position: relative;
  transform: rotate(45deg);
  border: 2px solid var(--accent);
  background: transparent;
}
.brand__mark::after {
  content: "";
  position: absolute;
  inset: 4px;
  background: var(--accent);
}

.brand__slash {
  color: var(--ink-mute);
  margin: 0 4px;
  font-weight: 400;
}

.nav__links {
  display: flex;
  gap: 28px;
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav__links a {
  position: relative;
  color: var(--ink-dim);
  transition: color 0.15s;
}
.nav__links a:hover, .nav__links a.is-active { color: var(--ink); }
.nav__links a.is-active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -22px;
  height: 2px; background: var(--accent);
}

.nav__cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--accent);
  color: #0a0a0a;
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  transition: background 0.15s;
}
.nav__cta:hover { background: var(--ink); }

/* ---------- nav dropdowns (Industries / Locations) ---------- */
/* Phase 3 addition. Desktop = hover/focus-within reveal of an absolutely-positioned
   panel. Mobile (<900px) = tap-to-toggle accordion via nav.js. All tokens reused;
   no new colors introduced. */

/* Make .nav__links a positioning context for dropdown panels. */
.nav__links { position: relative; align-items: center; }

/* Treat plain text-link nav items as inline so they line up with the buttons. */
.nav__link {
  display: inline-flex;
  align-items: center;
  height: 64px;
}

/* The dropdown container — wraps the trigger button and the hidden panel. */
.nav__dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 64px;
}

/* The dropdown trigger — looks like a nav__links anchor but is a <button>. */
.nav__dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 64px;
  padding: 0;
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-dim);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: color 0.15s;
}
.nav__dropdown-trigger:hover,
.nav__dropdown-trigger:focus-visible,
.nav__dropdown-trigger.is-active {
  color: var(--ink);
  outline: none;
}
.nav__dropdown-trigger.is-active {
  position: relative;
}
.nav__dropdown-trigger.is-active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px; background: var(--accent);
}

.nav__caret {
  display: inline-block;
  font-size: 10px;
  line-height: 1;
  transform: translateY(1px);
  transition: transform 0.15s ease-out;
}

/* The panel that drops below the trigger. Hidden by default but kept in
   the DOM for screen readers + keyboard nav. */
.nav__dropdown-panel {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 6px;
  min-width: 220px;
  padding: 8px 0;
  background: var(--bg-2);
  border: 1px solid var(--line);
  z-index: 100;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.15s ease-out, transform 0.15s ease-out, visibility 0s linear 0.15s;
}

/* Desktop reveal — hover OR keyboard focus-within OR explicit .is-open (JS). */
@media (hover: hover) and (min-width: 901px) {
  .nav__dropdown:hover .nav__dropdown-panel,
  .nav__dropdown:focus-within .nav__dropdown-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity 0.15s ease-out, transform 0.15s ease-out, visibility 0s linear 0s;
  }
  .nav__dropdown:hover .nav__caret,
  .nav__dropdown:focus-within .nav__caret {
    transform: translateY(1px) rotate(180deg);
  }
  .nav__dropdown:hover .nav__dropdown-trigger,
  .nav__dropdown:focus-within .nav__dropdown-trigger {
    color: var(--ink);
  }
}

/* Mobile + JS-controlled open state (works on both desktop and mobile). */
.nav__dropdown.is-open .nav__dropdown-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 0.15s ease-out, transform 0.15s ease-out, visibility 0s linear 0s;
}
.nav__dropdown.is-open .nav__caret {
  transform: translateY(1px) rotate(180deg);
}
.nav__dropdown.is-open .nav__dropdown-trigger {
  color: var(--ink);
}

/* Items inside the panel. */
.nav__dropdown-item {
  display: block;
  padding: 10px 18px;
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-dim);
  transition: color 0.12s, background 0.12s;
  white-space: nowrap;
}
.nav__dropdown-item:hover,
.nav__dropdown-item:focus-visible {
  color: var(--accent);
  background: var(--bg);
  outline: none;
}

/* The "All industries →" / "All locations →" hub link gets a separator. */
.nav__dropdown-item--hub {
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 6px;
}
.nav__dropdown-item--hub:hover,
.nav__dropdown-item--hub:focus-visible {
  color: var(--accent);
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px;
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  border: 1px solid var(--line);
  transition: all 0.15s;
}
.btn:hover { border-color: var(--ink); }

.btn--accent {
  background: var(--accent);
  color: #0a0a0a;
  border-color: var(--accent);
}
.btn--accent:hover {
  background: var(--ink);
  border-color: var(--ink);
}

.btn--ghost { color: var(--ink); }

.btn__arrow {
  display: inline-block;
  transition: transform 0.15s;
}
.btn:hover .btn__arrow { transform: translateX(4px); }

/* ---------- footer ---------- */

.footer {
  border-top: 1px solid var(--line);
  margin-top: 0;
}

.footer__col h3 {
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 16px;
}

.footer__col a {
  display: block;
  padding: 6px 0;
  color: var(--ink);
  font-size: 14px;
}
.footer__col a:hover { color: var(--accent); }

.footer__bottom {
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 20px 0;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

/* ---------- utility ---------- */

.accent { color: var(--accent); }
.dim { color: var(--ink-dim); }
.mute { color: var(--ink-mute); }

.h-display {
  font-family: var(--f-display);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 0.95;
}

.section-num {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--ink-mute);
}

/* ---------- grid ticker ---------- */

@keyframes ticker {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

.ticker {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  overflow: hidden;
}

.ticker__track {
  display: flex;
  white-space: nowrap;
  animation: ticker 40s linear infinite;
  padding: 14px 0;
  gap: 48px;
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.ticker__item { display: inline-flex; align-items: center; gap: 12px; }
.ticker__dot {
  width: 6px; height: 6px; background: var(--accent);
  display: inline-block;
}

/* ---------- form status (Resend submission feedback) ---------- */

.form__status {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  line-height: 1.4;
  min-height: 18px;
  margin-top: 8px;
  color: var(--ink-dim);
}
.form__status--ok { color: var(--accent); }
.form__status--err { color: var(--bad); }

/* ---------- responsive cap ---------- */

/* ---------- footer (5-cell grid: brand + 4 content cols) ---------- */

.footer__top {
  display: grid;
  grid-template-columns: 1.2fr repeat(4, 1fr);
  gap: 32px;
  padding: 56px 0;
}

/* ---------- responsive cap ---------- */

@media (max-width: 1100px) {
  /* At narrower desktops, drop the brand column slightly so the 4 link
     columns get more breathing room. */
  .footer__top { grid-template-columns: 1fr repeat(4, 1fr); gap: 24px; }
}

@media (max-width: 900px) {
  :root { --pad: 20px; }

  /* Single-row top bar: brand | toggle | cta. The toggle is injected
     by nav.js so no HTML edits are required. The .nav__links element
     is hidden by default and revealed as a full-width drawer overlay
     when .nav.is-menu-open is set (see drawer rules below). */
  .nav__inner {
    grid-template-columns: 1fr auto auto;
    grid-template-areas: "brand toggle cta";
    height: 56px;
    gap: 12px;
    align-items: center;
  }
  .nav__inner > .brand { grid-area: brand; }
  .nav__inner > .nav__menu-toggle { grid-area: toggle; }
  .nav__inner > .nav__cta { grid-area: cta; }

  /* Drawer overlay — hidden until .is-menu-open is toggled by nav.js.
     Mounts below the 56px top bar so the brand + toggle stay visible. */
  .nav__links {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    width: 100vw;
    padding: 12px var(--pad) 32px;
    background: var(--bg);
    border-top: 1px solid var(--line);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0;
    z-index: 60;
  }
  .nav.is-menu-open .nav__links { display: flex; }

  /* Each top-level nav row sits on its own line with a 1px divider
     and a 44px tap target. */
  .nav__link,
  .nav__dropdown,
  .nav__dropdown-trigger {
    height: auto;
    padding: 14px 0;
    min-height: 44px;
  }
  .nav__link {
    display: flex;
    align-items: center;
    width: 100%;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
    letter-spacing: 0.08em;
    color: var(--ink);
  }
  .nav__link.is-active { color: var(--accent); }
  .nav__link.is-active::after { display: none; }

  /* Dropdown wrapper becomes a vertical stack: trigger row + accordion
     panel beneath. display:block tied to the panel's width:100% used to
     bleed the dropdown's intrinsic width when the panel was inside a
     wrapping flex row — irrelevant now that .nav__links is a column. */
  .nav__dropdown {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    border-bottom: 1px solid var(--line);
  }
  .nav__dropdown-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    font-size: 14px;
    letter-spacing: 0.08em;
    color: var(--ink);
  }
  .nav__dropdown-trigger.is-active::after { display: none; }
  .nav__caret { font-size: 12px; }

  /* Mobile dropdown panel: inline accordion, not floating. */
  .nav__dropdown-panel {
    position: static;
    margin: 0;
    min-width: 0;
    width: 100%;
    transform: none;
    transition: opacity 0.15s ease-out, visibility 0s linear 0.15s, max-height 0.2s ease-out;
    max-height: 0;
    overflow: hidden;
    padding: 0;
    border-width: 0;
    background: transparent;
  }
  .nav__dropdown.is-open .nav__dropdown-panel {
    transform: none;
    transition: opacity 0.15s ease-out, visibility 0s linear 0s, max-height 0.3s ease-out;
    max-height: 800px;
    padding: 0 0 8px 0;
    border-width: 0 0 0 2px;
    border-left-color: var(--accent);
    border-left-style: solid;
    margin: 0 0 8px 4px;
  }
  .nav__dropdown-item {
    padding: 12px 16px;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .brand { font-size: 16px; min-width: 0; }
  /* Hide the wordmark on mobile — the lime mark alone is iconic and
     leaves room for the hamburger + CTA in the 56px top bar. */
  .brand > span:nth-of-type(2) { display: none; }
  .brand__slash, .brand .mono { display: none; }
  .nav__cta { padding: 10px 14px; font-size: 11px; letter-spacing: 0.06em; white-space: nowrap; }

  /* ---------- hamburger toggle button (mobile only) ---------- */
  .nav__menu-toggle {
    width: 44px;
    height: 44px;
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    background: transparent;
    border: 1px solid var(--line);
    cursor: pointer;
    transition: border-color 0.15s;
  }
  .nav__menu-toggle:hover,
  .nav__menu-toggle:focus-visible { border-color: var(--accent); outline: none; }
  .nav__menu-toggle-bar {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--ink);
    transition: transform 0.18s ease-out, opacity 0.12s ease-out;
  }
  /* Animate two bars into an ✕ when the drawer is open. */
  .nav.is-menu-open .nav__menu-toggle-bar:first-child {
    transform: translateY(3px) rotate(45deg);
    background: var(--accent);
  }
  .nav.is-menu-open .nav__menu-toggle-bar:last-child {
    transform: translateY(-4px) rotate(-45deg);
    background: var(--accent);
  }

  /* Footer collapses 5 cells → 2 cols on tablet. */
  .footer__top { grid-template-columns: 1fr 1fr; gap: 24px; }
  .footer__bottom { flex-direction: column; gap: 6px; align-items: flex-start; }
}

/* Hide the toggle on desktop — nav__links renders inline as usual. */
@media (min-width: 901px) {
  .nav__menu-toggle { display: none; }
}

@media (max-width: 480px) {
  :root { --pad: 16px; }
  /* Single column at phone widths. */
  .footer__top { grid-template-columns: 1fr; }
}

/* ============================================================
   Mobile polish layer — adds tablet-band scaledowns and
   thumb-friendly tap targets without disturbing the existing
   responsive rules above. Source order matters: keep this last.
   ============================================================ */

/* Tap-target floor: 44px minimum hit area on touch viewports.
   Nav-specific tap targets are handled inside the drawer rules above
   so they don't conflict with the drawer's full-width row layout. */
@media (max-width: 900px) {
  .footer__col a,
  .footer__col li > a {
    display: inline-block;
    padding: 6px 0;
    min-height: 32px;
  }
  /* Base .btn min-height keeps any CTA reachable. */
  .btn { min-height: 44px; }
}

/* iPad portrait (~768) and shrinking tablets: existing 900px rules
   already stack columns, but vertical padding stays desktop-scale
   and creates dead whitespace. Tighten it. */
@media (max-width: 768px) {
  .nav__cta { font-size: 11px; }
}

/* Phone refinement: stretch primary CTA rows to full width so
   thumbs reach the target, and reduce gap on wrapped nav. */
@media (max-width: 480px) {
  .nav__cta { width: auto; }
  .footer__top { gap: 20px; }
  /* Decorative dividers can crowd 16px gutters — pull them in. */
  .footer__col { min-width: 0; }
}
