/* ============================================================
   Qwerty — Teenage Engineering direction
   Cream/slate/safety-orange palette, no serifs, hairlines + part numbers.
   ============================================================ */

:root {
  /* Type — clean grotesque + mono, no serifs */
  --sans: "Inter Tight", "Inter", -apple-system, "Helvetica Neue", system-ui, sans-serif;
  --display: "Inter Tight", "Inter", -apple-system, system-ui, sans-serif;
  --mono: "JetBrains Mono", "IBM Plex Mono", "SF Mono", ui-monospace, monospace;

  /* Container */
  --max-w: 1320px;
  --pad-x: clamp(20px, 3.5vw, 48px);

  /* Accents (shared) */
  --orange: #ff5b1a;
  --orange-soft: #ffb189;
  --green: #4d7c2f;
  --blue: #2b4abf;
}

/* ── Dark theme (default) ────────────────────────────────── */
:root, [data-theme="dark"] {
  --bg: #0e0d0c;
  --bg-1: #161514;
  --bg-2: #1e1d1b;
  --bg-card: #141312;
  --bg-dark: #0a0908;
  --bg-dark-1: #111010;

  --fg: #f1ede4;
  --fg-1: #d9d4c8;
  --fg-2: #9e9888;
  --fg-3: #6b665c;
  --fg-4: #4a463e;

  --line: rgba(241,237,228,0.18);
  --line-soft: rgba(241,237,228,0.10);
  --line-hair: rgba(241,237,228,0.06);
}

/* ── Light theme ─────────────────────────────────────────── */
[data-theme="light"] {
  --bg: #f1ede4;
  --bg-1: #ebe6da;
  --bg-2: #e2dccc;
  --bg-card: #f6f2e8;
  --bg-dark: #1a1816;
  --bg-dark-1: #221f1c;

  --fg: #1a1816;
  --fg-1: #2c2924;
  --fg-2: #5e5a51;
  --fg-3: #8b867b;
  --fg-4: #b3ad9f;

  --line: #1a1816;
  --line-soft: rgba(26,24,22,0.18);
  --line-hair: rgba(26,24,22,0.10);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--fg); -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.005em;
  font-feature-settings: "ss01", "cv11";
  overflow-x: hidden;
}

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

::selection { background: var(--orange); color: #fff; }

/* paper grain */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 1000;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence baseFrequency='0.9' numOctaves='2' seed='5'/><feColorMatrix values='0 0 0 0 0.1 0 0 0 0 0.09 0 0 0 0 0.08 0 0 0 0.07 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: multiply;
  opacity: 0.5;
}
[data-theme="dark"] body::before,
:root:not([data-theme="light"]) body::before {
  mix-blend-mode: screen;
  opacity: 0.3;
}

.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding-left: var(--pad-x);
  padding-right: var(--pad-x);
}

/* ── Type system ───────────────────────────────────────── */
.eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--fg);
  font-weight: 500;
}
.partnum {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--fg-2);
  text-transform: uppercase;
}
.partnum strong { color: var(--fg); font-weight: 500; }

/* utility block titles like "01 / engine" */
.numlabel {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--fg-2);
}
.numlabel b { color: var(--fg); font-weight: 500; }

/* Display headlines — tight, large */
.display {
  font-family: var(--display);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 0.94;
}

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  font-size: 12.5px;
  font-weight: 500;
  font-family: var(--sans);
  letter-spacing: -0.005em;
  transition: all 0.16s ease;
  white-space: nowrap;
  border: 1px solid var(--fg);
  border-radius: 0;
  position: relative;
}
.btn-primary { background: var(--fg); color: var(--bg); }
.btn-primary:hover { background: var(--orange); border-color: var(--orange); color: #fff; }

.btn-ghost { background: transparent; color: var(--fg); }
.btn-ghost:hover { background: var(--fg); color: var(--bg); }

.btn-orange { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn-orange:hover { background: var(--fg); border-color: var(--fg); color: var(--bg); }

.btn-link {
  border: 0;
  padding: 0 0 1px;
  border-bottom: 1px solid var(--fg);
  border-radius: 0;
}

.btn .arrow { display: inline-block; transition: transform 0.16s ease; }
.btn:hover .arrow { transform: translateX(2px); }

/* ── Beta signup modal ─────────────────────────────────── */
body.beta-modal-open { overflow: hidden; }

.beta-modal-shell {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0,0,0,0.68);
  backdrop-filter: blur(8px);
}

.beta-modal {
  position: relative;
  width: min(100%, 640px);
  max-height: calc(100dvh - 32px);
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--fg);
  box-shadow: 10px 10px 0 var(--orange);
  padding: clamp(20px, 3.5vw, 28px);
}

.beta-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--fg);
  background: transparent;
  color: var(--fg);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.beta-modal-close:hover {
  background: var(--fg);
  color: var(--bg);
}

.beta-modal-kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0;
  color: var(--orange);
  margin-bottom: 8px;
}

.beta-modal h2 {
  font-family: var(--display);
  font-size: clamp(34px, 6vw, 48px);
  font-weight: 500;
  line-height: 0.96;
  letter-spacing: 0;
  margin-bottom: 10px;
}

.beta-modal > p {
  max-width: 56ch;
  color: var(--fg-2);
  font-size: 15px;
  line-height: 1.45;
  margin-bottom: 16px;
}

.beta-form {
  display: grid;
  gap: 10px;
}

.beta-field {
  display: grid;
  gap: 5px;
}

.beta-field-row {
  grid-template-columns: 1fr 1fr;
}

.beta-field label,
.beta-hp {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--fg-2);
}

.beta-field input,
.beta-field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--fg);
  background: transparent;
  color: var(--fg);
  font: 500 15px/1.3 var(--sans);
  padding: 9px 11px;
  border-radius: 0;
  outline: 0;
}

.beta-field textarea {
  resize: none;
  min-height: 62px;
}

.beta-field input:focus,
.beta-field textarea:focus {
  border-color: var(--orange);
  box-shadow: inset 3px 0 0 var(--orange);
}

.beta-submit {
  justify-content: center;
  min-height: 42px;
  margin-top: 2px;
}

.beta-submit:disabled {
  cursor: wait;
  opacity: 0.72;
}

.beta-note,
.beta-error {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
}

.beta-note { color: var(--fg-3); }
.beta-error { color: var(--orange); }

.beta-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.beta-success {
  display: grid;
  gap: 14px;
  padding-top: 6px;
}

.beta-success-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--green, #28d17c);
  color: var(--green, #28d17c);
  font-family: var(--mono);
  font-size: 22px;
}

.beta-success h3 {
  font-family: var(--display);
  font-size: 30px;
  font-weight: 500;
  letter-spacing: 0;
}

.beta-success p {
  color: var(--fg-2);
  margin-bottom: 4px;
}

@media (max-width: 560px) {
  .beta-field-row { grid-template-columns: 1fr; }
  .beta-modal { box-shadow: 6px 6px 0 var(--orange); }
}

@media (max-height: 720px) {
  .beta-modal {
    padding: 18px 20px;
    width: min(100%, 680px);
  }
  .beta-modal h2 { font-size: 36px; }
  .beta-modal > p {
    font-size: 14px;
    margin-bottom: 12px;
  }
  .beta-form { gap: 8px; }
  .beta-field textarea { min-height: 54px; }
  .beta-submit { min-height: 40px; }
}

/* ── Live dot ──────────────────────────────────────────── */
.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--orange);
  display: inline-block;
  box-shadow: 0 0 0 0 rgba(255,91,26,0.6);
  animation: tePulse 2s ease-out infinite;
}
@keyframes tePulse {
  0% { box-shadow: 0 0 0 0 rgba(255,91,26,0.55); }
  100% { box-shadow: 0 0 0 7px rgba(255,91,26,0); }
}

/* ── Reveal on scroll ──────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(.2,.7,.2,1);
}
.reveal.is-in { opacity: 1; transform: none; }
.reveal-delay-1 { transition-delay: 0.05s; }
.reveal-delay-2 { transition-delay: 0.10s; }
.reveal-delay-3 { transition-delay: 0.15s; }
.reveal-delay-4 { transition-delay: 0.20s; }
.reveal-delay-5 { transition-delay: 0.25s; }
.reveal-delay-6 { transition-delay: 0.30s; }

/* ── Top bar ───────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--fg);
}
.topbar-inner {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  height: 56px;
}
.brand {
  --brand-wordmark-size: clamp(24px, 2.35vw, 34px);
  --brand-knot-size: calc(var(--brand-wordmark-size) * 1.25);
  display: flex; align-items: center; gap: 8px;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0;
  padding-right: 28px;
}
.brand-knot {
  width: var(--brand-knot-size);
  height: var(--brand-knot-size);
  object-fit: contain;
  flex: 0 0 var(--brand-knot-size);
}
.brand-mark {
  width: 22px; height: 22px;
  object-fit: contain;
  filter: invert(1);  /* logo is cream → flip to dark on cream bg */
}
.brand-wordmark {
  height: clamp(25px, 2.3vw, 32px);
  width: auto;
  display: block;
}
.brand-wordmark-text {
  height: auto;
  display: inline-flex;
  align-items: center;
  color: currentColor;
  font-family: var(--display);
  font-size: var(--brand-wordmark-size);
  font-weight: 700;
  line-height: 0.88;
  letter-spacing: 0;
  text-transform: uppercase;
  filter: none !important;
}
.brand-wordmark--footer {
  height: 32px;
}
.brand-wordmark--footer.brand-wordmark-text {
  height: auto;
  font-size: 32px;
}
.nav-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--fg-2);
  text-transform: uppercase;
  padding-left: 20px;
}
.nav-meta .live-pip {
  width: 6px; height: 6px;
  background: var(--orange);
  border-radius: 50%;
  animation: tePulse 2s infinite;
}
.nav {
  display: flex; align-items: center; gap: 22px;
}
.nav a,
.nav-dropdown-toggle {
  font-size: 12.5px;
  color: var(--fg);
  letter-spacing: -0.005em;
}
.nav a:hover,
.nav-dropdown-toggle:hover { text-decoration: underline; text-underline-offset: 4px; }

.nav-dropdown {
  position: relative;
  height: 100%;
  display: inline-flex;
  align-items: center;
}

.nav-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.nav-dropdown-caret {
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1;
  color: var(--orange);
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: -14px;
  min-width: 244px;
  display: none;
  flex-direction: column;
  gap: 0;
  background: var(--bg);
  border: 1px solid var(--fg);
  box-shadow: 5px 5px 0 var(--orange);
  z-index: 80;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  display: flex;
}

.nav-dropdown-menu a {
  display: grid;
  gap: 2px;
  align-items: center;
  min-height: 58px;
  padding: 10px 14px 11px;
  border-bottom: 1px solid var(--line-soft);
  white-space: normal;
}

.nav-dropdown-menu a:last-child {
  border-bottom: 0;
}

.nav-dropdown-menu a:hover {
  background: var(--fg);
  color: var(--bg);
  text-decoration: none;
}

.nav-dropdown-title {
  display: block;
  font-size: 12.5px;
  line-height: 1.15;
}

.nav-dropdown-desc {
  display: block;
  font-size: 11px;
  line-height: 1.25;
  color: var(--fg-2);
  letter-spacing: 0;
}

.nav-dropdown-menu a:hover .nav-dropdown-desc {
  color: var(--bg);
  opacity: 0.7;
}

.topbar-left, .topbar-right { display: flex; align-items: center; }

.nav-cta { display: flex; align-items: stretch; height: 100%; }
.nav-cta a {
  display: inline-flex;
  align-items: center;
  padding: 0 18px;
  font-size: 12.5px;
  font-weight: 500;
  border-right: 1px solid var(--line-soft);
}
.nav-cta a:last-child { border-right: 0; background: var(--fg); color: var(--bg); }
.nav-cta a:last-child:hover { background: var(--orange); }

@media (max-width: 980px) { .nav-meta, .nav-links { display: none; } }

/* ── Section frames ────────────────────────────────────── */
.section {
  position: relative;
  padding: 96px 0;
  border-top: 1px solid var(--fg);
}
.section-label {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 32px;
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--fg);
}
.section-label::before {
  content: "";
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--orange);
}
.section-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(40px, 5.5vw, 76px);
  line-height: 0.95;
  letter-spacing: -0.035em;
  margin: 4px 0 18px;
  text-wrap: balance;
}
.section-sub {
  color: var(--fg-2);
  font-size: 16px;
  max-width: 56ch;
  text-wrap: pretty;
}

/* ── Hairline corner brackets (decoration) ─────────────── */
.crop {
  position: absolute;
  width: 12px; height: 12px;
  border: 1px solid var(--fg);
}
.crop.tl { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.crop.tr { top: -1px; right: -1px; border-left: 0; border-bottom: 0; }
.crop.bl { bottom: -1px; left: -1px; border-right: 0; border-top: 0; }
.crop.br { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

/* ── Footer ────────────────────────────────────────────── */
.footer {
  background: var(--fg);
  color: var(--bg);
  padding: 64px 0 28px;
}
[data-theme="dark"] .footer,
:root:not([data-theme="light"]) .footer {
  background: #0a0908;
  color: #d9d4c8;
}
[data-theme="dark"] .footer a,
:root:not([data-theme="light"]) .footer a { color: #d9d4c8; }
[data-theme="dark"] .footer h5,
:root:not([data-theme="light"]) .footer h5 { color: #6b665c; }
.footer .container > .footer-grid {
  display: grid;
  grid-template-columns: 1.3fr repeat(4, 1fr);
  gap: 36px;
}
.footer .brand-mark { filter: none; }
.footer h5 {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--fg-3);
  font-weight: 500;
  margin-bottom: 14px;
}
.footer-tagline {
  margin-top: 14px;
  color: var(--fg-3);
  font-size: 13px;
  line-height: 1.35;
  max-width: 32ch;
  font-weight: 400;
  letter-spacing: 0;
}
.footer ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer a { color: var(--bg); font-size: 13px; }
.footer a:hover { color: var(--orange); }
.footer-bottom {
  margin-top: 56px;
  padding-top: 22px;
  border-top: 1px solid rgba(255,255,255,0.12);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--fg-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
@media (max-width: 820px) {
  .footer .container > .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-bottom { flex-direction: column; align-items: flex-start; gap: 10px; }
}
@media (max-width: 560px) {
  .footer .container > .footer-grid { grid-template-columns: 1fr; }
}

/* ── Theme toggle button ─────────────────────────────────── */
.theme-toggle {
  width: 32px; height: 32px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  align-self: center;
  cursor: pointer;
  color: var(--fg-2);
  transition: color 0.2s, background 0.2s;
}
.theme-toggle:hover { color: var(--fg); background: var(--bg-2); }
.theme-toggle .icon-sun,
.theme-toggle .icon-moon { width: 16px; height: 16px; }
[data-theme="dark"] .theme-toggle .icon-sun,
:root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon,
:root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* Dark mode: invert brand images */
[data-theme="dark"] .brand-wordmark,
:root:not([data-theme="light"]) .brand-wordmark { filter: invert(1); }
[data-theme="dark"] .brand-wordmark--footer,
:root:not([data-theme="light"]) .brand-wordmark--footer { filter: none; }

/* ── Knot logo theme swap ────────────────────────────────── */
.knot-dark { display: none; }
.knot-light { display: block; }
[data-theme="dark"] .knot-dark,
:root:not([data-theme="light"]) .knot-dark { display: block; }
[data-theme="dark"] .knot-light,
:root:not([data-theme="light"]) .knot-light { display: none; }

/* Unified fleet site: keep the existing visual system and expose mobile navigation. */
.fleet-audience { margin-top: 18px; font: 10px/1.8 var(--mono); letter-spacing: .075em; color: var(--fg-2); }
.mobile-menu-toggle { display: none; font: 11px var(--mono); color: var(--fg); background: transparent; border: 1px solid var(--border, #555); padding: 8px; }
.field select { width: 100%; border: 1px solid var(--fg-3); padding: 14px; font: inherit; background: var(--bg); color: var(--fg); border-radius: 0; }
@media (max-width: 980px) {
 .topbar-inner { position: relative; }
 .mobile-menu-toggle { display: block; }
 .nav-links.is-open { display: flex; position: absolute; top: 100%; left: 0; right: 0; z-index: 40; background: var(--bg); border: 1px solid var(--fg-3); flex-direction: column; align-items: stretch; padding: 16px; }
 .nav-links.is-open a { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }
