/* ============================================================
   HEADGATE — shared design system
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&family=Instrument+Serif:ital@0;1&display=swap');

:root {
  /* Dark (default) — cosmic indigo, steel whites, electric signal */
  --bg-0: #05070D;
  --bg-1: #0A0D18;
  --bg-2: #11152A;
  --bg-3: #1A2042;
  --fg-0: #EEF2FA;
  --fg-1: #C8CFDD;
  --fg-2: #8891A4;
  --fg-3: #555C6E;
  --line: rgba(238, 242, 250, 0.09);
  --line-strong: rgba(238, 242, 250, 0.22);
  --amber: #6FE3C5;          /* signal: cool mint-cyan replacing amber */
  --amber-soft: #9BF0D8;
  --indigo: #3D5BA9;
  --indigo-glow: #5A78C9;
  --violet: #8B5CF6;
  --violet-deep: #6D28D9;
  --violet-bright: #A78BFA;
  --magenta: #C026D3;
  --rust: #C4623A;
  --grain: 0.04;
  --globe-stroke: rgba(238, 242, 250, 0.18);
  --globe-stroke-strong: rgba(238, 242, 250, 0.36);
}

[data-theme="light"] {
  --bg-0: #F2EEE2;
  --bg-1: #F4F0E6;
  --bg-2: #ECE6D5;
  --bg-3: #E0D8C2;
  --fg-0: #0A0E1F;
  --fg-1: #1A1F35;
  --fg-2: #4A4E62;
  --fg-3: #7A7C8A;
  --line: rgba(10, 14, 31, 0.12);
  --line-strong: rgba(10, 14, 31, 0.28);
  --amber: #B5832E;
  --amber-soft: #D4A046;
  --indigo: #2C3E7A;
  --indigo-glow: #4A5FA0;
  --violet: #6D28D9;
  --violet-deep: #4C1D95;
  --violet-bright: #8B5CF6;
  --magenta: #A21CAF;
  --rust: #A04A28;
  --grain: 0.025;
  --globe-stroke: rgba(10, 14, 31, 0.22);
  --globe-stroke-strong: rgba(10, 14, 31, 0.42);
}

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

html, body {
  background: var(--bg-1);
  color: var(--fg-0);
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background 0.6s ease, color 0.6s ease;
}

body {
  min-height: 100vh;
  position: relative;
}

/* ─── Type scale ─────────────────────────────────── */

.display {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1.02;
}

/* Global anti-clip for tight-leading display headings */
h1, h2, h3, h4, h5, h6, .display, .display-xl, .display-l, .display-m, .display-s,
.hero__title, .page-hero h1, .footer__display, .ital {
  padding-bottom: 0.08em;
}
.serif-italic, .ital {
  padding-right: 0.05em;
}
.display-xl { font-size: clamp(64px, 11vw, 200px); }
.display-l  { font-size: clamp(48px, 7.5vw, 124px); }
.display-m  { font-size: clamp(36px, 5.2vw, 84px); }
.display-s  { font-size: clamp(28px, 3.6vw, 56px); }

.serif-italic {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.mono {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.mono-sm { font-size: 10px; letter-spacing: 0.1em; }
.mono-md { font-size: 13px; letter-spacing: 0.04em; text-transform: none; }

.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-2);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: "";
  display: inline-block;
  width: 28px;
  height: 1px;
  background: var(--amber);
}

.body-lg { font-size: 19px; line-height: 1.55; color: var(--fg-1); font-weight: 300; }
.body-md { font-size: 16px; line-height: 1.6; color: var(--fg-1); }
.body-sm { font-size: 14px; line-height: 1.55; color: var(--fg-2); }

p { text-wrap: pretty; }

/* ─── Layout primitives ─────────────────────────── */

.shell {
  position: relative;
  min-height: 100vh;
  z-index: 1;
}

.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 48px;
}
@media (max-width: 900px) {
  .container { padding: 0 24px; }
}

.section {
  padding: 140px 0;
  position: relative;
}
.section--tight { padding: 80px 0; }
@media (max-width: 900px) {
  .section { padding: 80px 0; }
}

.divider {
  height: 1px;
  background: var(--line);
  width: 100%;
}

/* Grid lines overlay — adds the "engineered" feel */
.grid-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 48px;
  left: 0; right: 0;
  opacity: 0;
  transition: opacity 0.4s;
}
.grid-overlay.visible { opacity: 1; }
.grid-overlay > div {
  border-left: 1px solid var(--line);
}
.grid-overlay > div:last-child { border-right: 1px solid var(--line); }

/* ─── Nav ───────────────────────────────────────── */

.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  padding: 22px 48px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  background: linear-gradient(to bottom, color-mix(in oklab, var(--bg-0) 88%, transparent) 0%, color-mix(in oklab, var(--bg-0) 70%, transparent) 100%);
  border-bottom: 1px solid var(--line);
  transition: background 0.5s ease, border-color 0.5s ease, padding 0.4s ease;
}
.nav::after {
  content: "";
  position: absolute;
  left: 48px; right: 48px;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(to right, transparent 0%, var(--line-strong) 20%, var(--line-strong) 80%, transparent 100%);
  opacity: 0.6;
}
@media (max-width: 900px) {
  .nav { padding: 16px 20px; grid-template-columns: 1fr auto; }
  .nav::after { left: 20px; right: 20px; }
}

.nav__logo {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--fg-0);
  justify-self: start;
}
.nav__logo img {
  height: 32px;
  width: auto;
  display: block;
}

.nav__menu {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-self: center;
}
.nav__link {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-2);
  text-decoration: none;
  padding: 10px 18px;
  border-radius: 0;
  transition: color 0.3s;
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}
.nav__link::before {
  content: attr(data-idx);
  font-size: 9px;
  color: var(--fg-3);
  letter-spacing: 0.1em;
  transition: color 0.3s;
}
.nav__link::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 4px;
  height: 1px;
  background: var(--amber);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.nav__link:hover { color: var(--fg-0); }
.nav__link:hover::before { color: var(--amber); }
.nav__link:hover::after { transform: scaleX(1); }
.nav__link.is-active {
  color: var(--fg-0);
  background: transparent;
}
.nav__link.is-active::before { color: var(--amber); }
.nav__link.is-active::after { transform: scaleX(1); }
@media (max-width: 900px) {
  .nav__menu { display: none; }
}

.nav__right {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-self: end;
}

.theme-toggle {
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 8px 14px;
  color: var(--fg-1);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s;
}
.theme-toggle:hover { border-color: var(--amber); color: var(--amber); }
.theme-toggle .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--fg-0);
  box-shadow: 0 0 8px var(--fg-0);
}
[data-theme="light"] .theme-toggle .dot {
  background: var(--amber);
  box-shadow: 0 0 8px var(--amber);
}

/* ─── Buttons ───────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 28px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--fg-0);
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--amber);
  transform: translateY(101%);
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: -1;
}
.btn:hover { color: var(--bg-1); border-color: var(--amber); }
.btn:hover::before { transform: translateY(0); }
.btn .arrow {
  width: 14px; height: 1px;
  background: currentColor;
  position: relative;
}
.btn .arrow::after {
  content: "";
  position: absolute;
  right: 0; top: -3px;
  width: 7px; height: 7px;
  border-top: 1px solid currentColor;
  border-right: 1px solid currentColor;
  transform: rotate(45deg);
}
.btn--primary {
  background: var(--fg-0);
  color: var(--bg-1);
  border-color: var(--fg-0);
}
.btn--primary:hover { background: var(--amber); border-color: var(--amber); color: var(--bg-1); }

/* ─── Footer ────────────────────────────────────── */

.footer {
  position: relative;
  border-top: 1px solid var(--line);
  padding: 0 0 32px;
  margin-top: 100px;
}
.footer__display {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0;
  padding: 140px 0 120px;
  user-select: none;
  position: relative;
  isolation: isolate;
  /* Break out of .container width to span full viewport */
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  overflow: hidden;
}
.footer__display img {
  width: min(40%, 480px);
  height: auto;
  display: block;
  position: relative;
  z-index: 3;
}
/* ─── Stargazing event behind footer logo ─── */
.footer__display::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 35% 70% at 50% 50%, color-mix(in oklab, var(--amber) 16%, transparent) 0%, transparent 65%),
    radial-gradient(ellipse 55% 95% at 50% 50%, color-mix(in oklab, oklch(0.55 0.22 280) 22%, transparent) 0%, transparent 75%);
  pointer-events: none;
}
/* Top + bottom feathered fade so it blends into the global page background */
.footer__display::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  background:
    linear-gradient(to bottom,
      transparent 0%,
      transparent 100%);
  pointer-events: none;
}
.footer__cosmos {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}
.footer__cosmos::before,
.footer__cosmos::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  border: 1px solid color-mix(in oklab, var(--amber) 14%, transparent);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: cosmosRing 60s linear infinite;
}
.footer__cosmos::before {
  width: 1100px;
  height: 280px;
  border-color: color-mix(in oklab, var(--amber) 14%, transparent);
}
.footer__cosmos::after {
  width: 1700px;
  height: 440px;
  border-color: color-mix(in oklab, var(--fg-0) 7%, transparent);
  animation-duration: 90s;
  animation-direction: reverse;
}
@keyframes cosmosRing {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to   { transform: translate(-50%, -50%) rotate(360deg); }
}
.footer__stars {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
.footer__stars i {
  position: absolute;
  width: 2px; height: 2px;
  background: var(--fg-0);
  border-radius: 50%;
  box-shadow: 0 0 6px color-mix(in oklab, var(--fg-0) 60%, transparent);
  animation: cosmosTwinkle 3.4s ease-in-out infinite;
  opacity: 0.85;
}
.footer__stars i.amber {
  background: var(--amber);
  box-shadow: 0 0 8px var(--amber);
}
.footer__stars i.tiny { width: 1px; height: 1px; box-shadow: 0 0 3px var(--fg-0); }
@keyframes cosmosTwinkle {
  0%, 100% { opacity: 0.2; transform: scale(0.8); }
  50%      { opacity: 1;   transform: scale(1.15); }
}
.footer__shoot {
  position: absolute;
  top: 30%;
  left: -10%;
  width: 160px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--amber), transparent);
  z-index: 2;
  opacity: 0;
  animation: cosmosShoot 11s ease-in infinite;
}
@keyframes cosmosShoot {
  0%   { transform: translate(0, 0); opacity: 0; }
  4%   { opacity: 1; }
  10%  { transform: translate(900px, 80px); opacity: 0; }
  100% { transform: translate(900px, 80px); opacity: 0; }
}
[data-theme="light"] .footer__display::before {
  background:
    radial-gradient(ellipse 60% 65% at 50% 55%, color-mix(in oklab, var(--amber) 10%, transparent) 0%, transparent 60%),
    radial-gradient(ellipse 80% 90% at 50% 50%, color-mix(in oklab, oklch(0.55 0.22 280) 8%, transparent) 0%, transparent 70%);
}
[data-theme="light"] .footer__stars i {
  background: var(--fg-0);
  box-shadow: 0 0 4px color-mix(in oklab, var(--fg-0) 40%, transparent);
}
.footer__grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 48px;
  padding: 48px 0;
  border-top: 1px solid var(--line);
}
@media (max-width: 900px) {
  .footer__grid { grid-template-columns: 1fr 1fr; gap: 32px; }
}
.footer__col h6 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 16px;
}
.footer__col a {
  display: block;
  color: var(--fg-1);
  text-decoration: none;
  padding: 4px 0;
  font-size: 14px;
  transition: color 0.2s, transform 0.2s;
}
.footer__col a:hover { color: var(--amber); transform: translateX(4px); }
.footer__col p { font-size: 14px; color: var(--fg-2); line-height: 1.6; }

.footer__bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 32px;
  border-top: 1px solid var(--line);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.footer__bottom .left { display: flex; gap: 24px; }
.footer__legal {
  display: flex;
  gap: 22px;
}
.footer__legal a {
  color: var(--fg-3);
  text-decoration: none;
  transition: color 0.3s;
}
.footer__legal a:hover { color: var(--fg-0); }

/* ─── Cursor ────────────────────────────────────── */

/* ─── Cursor ────────────────────────────────────── */
/* (custom cursor removed — system cursor only) */


/* ─── Page transition curtain ──────────────────── */

.curtain {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
  display: grid;
  grid-template-rows: repeat(8, 1fr);
}
.curtain__row {
  background: var(--bg-0);
  transform: scaleY(0);
  transform-origin: top;
}
.curtain.is-out .curtain__row {
  animation: curtainOut 0.8s cubic-bezier(0.7, 0, 0.3, 1) forwards;
}
.curtain.is-in .curtain__row {
  transform: scaleY(1);
  transform-origin: bottom;
  animation: curtainIn 0.8s cubic-bezier(0.7, 0, 0.3, 1) forwards;
}
.curtain__row:nth-child(1) { animation-delay: 0.00s; }
.curtain__row:nth-child(2) { animation-delay: 0.04s; }
.curtain__row:nth-child(3) { animation-delay: 0.08s; }
.curtain__row:nth-child(4) { animation-delay: 0.12s; }
.curtain__row:nth-child(5) { animation-delay: 0.16s; }
.curtain__row:nth-child(6) { animation-delay: 0.20s; }
.curtain__row:nth-child(7) { animation-delay: 0.24s; }
.curtain__row:nth-child(8) { animation-delay: 0.28s; }
@keyframes curtainOut { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes curtainIn  { from { transform: scaleY(1); } to { transform: scaleY(0); } }

/* ─── Reveal-on-scroll ─────────────────────────── */

.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 1s cubic-bezier(0.2, 0.8, 0.2, 1),
              transform 1s cubic-bezier(0.2, 0.8, 0.2, 1);
  transition-delay: var(--reveal-delay, 0ms);
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }

.reveal-mask {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  padding-bottom: 0.18em;
  margin-bottom: -0.18em;
  line-height: 1;
}
.reveal-mask > span {
  display: inline-block;
  transform: translateY(140%);
  transition: transform 1.1s cubic-bezier(0.2, 0.8, 0.2, 1);
  transition-delay: var(--reveal-delay, 0ms);
}
.reveal-mask.is-visible > span { transform: translateY(0); }

/* ─── Marquee ──────────────────────────────────── */

.marquee {
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
  background: var(--bg-2);
  white-space: nowrap;
}
.marquee__track {
  display: inline-flex;
  gap: 56px;
  animation: marquee 60s linear infinite;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 32px;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--fg-0);
}
.marquee__track .ital {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  color: var(--amber);
}
.marquee__track .star {
  color: var(--amber);
  font-size: 14px;
  vertical-align: middle;
}
@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ─── Coordinate label utility ────────────────── */

.coord {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--fg-2);
  display: inline-flex;
  gap: 12px;
  align-items: center;
}
.coord .tick {
  width: 6px; height: 6px;
  border: 1px solid var(--amber);
  transform: rotate(45deg);
}

/* ─── Grain ───────────────────────────────────── */

.grain {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: var(--grain);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* ─── Starfield canvas ────────────────────────── */

.starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ─── Section header pattern ──────────────────── */

.sec-head {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 80px;
  margin-bottom: 80px;
  align-items: end;
}
.sec-head__num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--fg-3);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sec-head__num .label { color: var(--amber); }
.sec-head h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 400;
  font-size: clamp(40px, 5vw, 84px);
  line-height: 0.95;
  letter-spacing: -0.04em;
}
.sec-head h2 .ital {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-weight: 400;
  color: var(--amber);
}
@media (max-width: 900px) {
  .sec-head { grid-template-columns: 1fr; gap: 24px; margin-bottom: 48px; }
}

/* utility */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-sm { gap: 16px; }
.gap-md { gap: 32px; }
.gap-lg { gap: 64px; }
.text-amber { color: var(--amber); }
.text-fg2 { color: var(--fg-2); }
.text-fg3 { color: var(--fg-3); }

::selection { background: var(--amber); color: var(--bg-0); }

/* hide horizontal scroll bars on marquees */
.marquee::-webkit-scrollbar { display: none; }

/* ─── Legal pages — additional shared rules (tables, sub-h3, code) ─── */
.legal-article .sub-h3 {
  margin: 28px 0 8px;
  font-size: 16px;
  color: var(--fg-0);
  letter-spacing: 0;
}
.legal-article .sub-h3 strong { color: var(--amber); font-weight: 500; }

.legal-article table.legal-table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 14px;
}
.legal-article table.legal-table th,
.legal-article table.legal-table td {
  text-align: left;
  vertical-align: top;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.legal-article table.legal-table th {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--fg-3);
  text-transform: uppercase;
  font-weight: 500;
  border-bottom: 1px solid var(--line-strong);
}
.legal-article table.legal-table td {
  color: var(--fg-1);
  line-height: 1.55;
}
.legal-article table.legal-table tr:last-child td { border-bottom: none; }

.legal-article code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88em;
  background: color-mix(in oklab, var(--fg-0) 5%, transparent);
  padding: 1px 6px;
  border-radius: 3px;
  color: var(--fg-0);
}

/* Responsive legal-nav grid that handles up to 7 tiles. */
.legal-nav__grid--wide {
  grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
}
@media (max-width: 1280px) {
  .legal-nav__grid--wide { grid-template-columns: repeat(4, 1fr) !important; }
}
@media (max-width: 800px) {
  .legal-nav__grid--wide { grid-template-columns: 1fr 1fr !important; }
}

/* ─── Mobile nav (hamburger + overlay) ─── */
.nav__burger {
  display: none;
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--fg-0);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.3s, color 0.3s;
}
.nav__burger:hover { border-color: var(--amber); color: var(--amber); }
.nav__burger span {
  display: block;
  width: 16px;
  height: 1px;
  background: currentColor;
  transition: transform 0.3s, opacity 0.2s;
}
.nav__burger.is-open span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.nav__burger.is-open span:nth-child(2) { opacity: 0; }
.nav__burger.is-open span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

.nav__mobile {
  position: fixed;
  inset: 0;
  z-index: 49;
  background: color-mix(in oklab, var(--bg-0) 96%, transparent);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  padding: 96px 24px 40px;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  display: none;
}
.nav__mobile.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.nav__mobile-inner {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
}
.nav__mobile-link {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(28px, 7vw, 40px);
  letter-spacing: -0.02em;
  color: var(--fg-0);
  text-decoration: none;
  transition: color 0.2s, padding 0.3s;
}
.nav__mobile-link:hover,
.nav__mobile-link:focus-visible { padding-left: 8px; color: var(--amber); }
.nav__mobile-link.is-active { color: var(--amber); }
.nav__mobile-link .num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--fg-3);
}
.nav__mobile-link.is-active .num { color: var(--amber); }
body.is-nav-open { overflow: hidden; }

@media (max-width: 900px) {
  .nav__burger { display: inline-flex; }
  .nav__mobile { display: block; }
}

/* ─── Mobile layout fixes ─── */
@media (max-width: 900px) {
  /* Hero bottom row: stack the sub card and CTA, override inline grid-column.
     Span 1/-1 so it works whether the parent collapses to 1 or 2 columns
     (index.html has a page-level @media rule pinning .hero__bottom to 2 cols
     under 900px, which would otherwise leave the sub at half-width). */
  .hero__bottom {
    grid-template-columns: 1fr !important;
    gap: 24px;
  }
  .hero__sub,
  .hero__cta {
    grid-column: 1 / -1 !important;
    justify-self: stretch !important;
    width: 100%;
  }
  .hero__sub {
    max-width: none;
    margin-left: 0;
    font-size: 16px;
    padding: 22px 22px 22px 24px;
  }
  .hero__sub::before { left: 18px; }
  .hero__cta { gap: 12px; }
  .hero__cta .btn {
    flex: 1 1 0;
    min-width: 0;
    justify-content: center;
  }

  /* Hero meta top row: hide the right-side "§ 01 · HOME" block to keep meta clean */
  .hero__top-row .meta + .meta { display: none; }

  /* Hide the desktop clock in nav (clock is still visible in footer) */
  .nav__right [data-hk-time] { display: none; }

  /* Footer: bigger logo, tighter rings, comfortable spacing */
  .footer__display { padding: 96px 0 80px; }
  .footer__display img { width: min(78%, 360px); }
  .footer__cosmos::before { width: 700px; height: 200px; }
  .footer__cosmos::after  { width: 1100px; height: 320px; }

  /* Footer bottom row: stack copyright + clock + legal links */
  .footer__bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
    padding-top: 24px;
  }
  .footer__bottom .left {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .footer__legal {
    flex-wrap: wrap;
    gap: 14px 18px;
    row-gap: 10px;
  }
}

@media (max-width: 600px) {
  .footer__grid { grid-template-columns: 1fr; gap: 28px; padding: 36px 0; }
  .footer__display img { width: min(82%, 320px); }
  .nav { padding: 14px 16px; }
  .container { padding: 0 20px; }
}
