/* Fonts are self-hosted so no visitor data goes to a font CDN. */
@font-face { font-family: "Space Grotesk"; font-weight: 300 700; font-display: swap; src: url("/fonts/space-grotesk.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 100 900; font-display: swap; src: url("/fonts/inter.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 100 800; font-display: swap; src: url("/fonts/jetbrains-mono.woff2") format("woff2"); }

:root {
  --bg: #0C0D11;
  --surface: #121419;
  --text: #ECEAE4;
  --muted: #8F949C;
  --rule: #23262D;
  --rule-strong: #3A3E47;
  --gold: #C8A84A;
  --gold-text: #D4B865;
  --gold-hover: #D4B865;
  --accent-line: #C8A84A;
  --on-gold: #0C0D11;

  --f-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --f-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --gutter: clamp(16px, 4vw, 40px);
  --col-gap: clamp(16px, 2.2vw, 32px);
  --ease: cubic-bezier(.2, .7, .1, 1);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #F4F2ED; --surface: #ECE9E2; --text: #15171B; --muted: #5B6069;
    --rule: #DCD8CF; --rule-strong: #BDB8AD; --gold-text: #7A6220; --gold-hover: #B8973C; --accent-line: #7A6220; color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #F4F2ED; --surface: #ECE9E2; --text: #15171B; --muted: #5B6069;
  --rule: #DCD8CF; --rule-strong: #BDB8AD; --gold-text: #7A6220; --gold-hover: #B8973C; --accent-line: #7A6220; color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 24px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 17px/1.65 var(--f-body);
  -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column; min-height: 100vh;
}
img { display: block; max-width: 100%; height: auto; }
::selection { background: var(--gold); color: var(--on-gold); }
:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 3px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: var(--gutter); top: 12px; background: var(--gold); color: var(--on-gold); padding: 8px 12px; z-index: 10; }

/* Links: thin rule that thickens on hover */
a { color: inherit; text-decoration: none; }
.link, .prose a {
  color: var(--text);
  background: linear-gradient(var(--accent-line), var(--accent-line)) 0 100% / 100% 1px no-repeat;
  padding-bottom: 2px; transition: background-size .25s var(--ease), color .25s var(--ease);
}
.link:hover, .prose a:hover { background-size: 100% 2px; color: var(--gold-text); }
.arrow::after { content: "\2192"; display: inline-block; margin-left: .4em; transition: transform .25s var(--ease); }
.arrow:hover::after { transform: translateX(3px); }

/* Grid */
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding-inline: var(--gutter); }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--col-gap); }

/* Type roles */
.label {
  font: 500 12px/1.4 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
.label .num, .num { color: var(--gold-text); font-variant-numeric: tabular-nums; }
.display {
  font: 600 clamp(42px, 6.4vw, 88px)/0.98 var(--f-display); letter-spacing: -0.035em; margin: 0;
}
.title { font: 600 clamp(30px, 3.6vw, 48px)/1.05 var(--f-display); letter-spacing: -0.025em; margin: 0; }
.h3 { font: 600 22px/1.25 var(--f-display); letter-spacing: -0.01em; margin: 0; }
.lead { font-size: clamp(18px, 1.5vw, 20px); line-height: 1.6; color: var(--muted); max-width: 58ch; margin: 0; }
.muted { color: var(--muted); }
p { margin: 0 0 1em; }

/* Header */
.site-header { border-bottom: 1px solid var(--rule); }
.bar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 24px; min-height: 76px; }
.brand { display: inline-flex; align-items: center; gap: 12px; }
.mark { width: 36px; height: 28px; flex: none; object-fit: contain; }
.brand-name { font: 600 14px/1 var(--f-display); letter-spacing: .24em; }
.nav { display: flex; justify-content: flex-end; gap: clamp(16px, 2.6vw, 40px); }
.nav a {
  font: 500 15px/1 var(--f-display); color: var(--muted); padding: 10px 0; position: relative;
  transition: color .2s var(--ease);
}
.nav a .num { font: 500 11px/1 var(--f-mono); margin-right: 8px; }
.nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 2px; height: 1px; background: var(--gold);
  transform: scaleX(0); transform-origin: left; transition: transform .3s var(--ease);
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); }
.nav a:hover::after, .nav a[aria-current="page"]::after { transform: scaleX(1); }
.theme-toggle {
  width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer;
  background: transparent; color: var(--muted); border: 1px solid var(--rule-strong); border-radius: 2px;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.theme-toggle:hover { color: var(--text); border-color: var(--text); }
.theme-toggle svg { transition: transform .4s var(--ease); }
:root[data-theme="light"] .theme-toggle svg { transform: rotate(180deg); }

/* Buttons */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; }
.btn {
  display: inline-flex; align-items: center; gap: 10px; height: 48px; padding: 0 22px;
  font: 600 15px/1 var(--f-display); letter-spacing: .01em;
  background: var(--gold); color: var(--on-gold); border-radius: 2px;
  transition: background-color .2s var(--ease), transform .1s var(--ease);
}
.btn:hover { background: var(--gold-hover); }
.btn:active { transform: translateY(1px); }

/* Sections */
main { flex: 1; }
.page-head { padding-block: clamp(56px, 9vw, 120px) clamp(40px, 6vw, 72px); }
.page-head .label { margin-bottom: 20px; }
.page-head .lead { margin-top: 24px; }
/* Rules sit on the inner grid so they align with the content, not the gutter */
.section { padding-bottom: clamp(48px, 7vw, 96px); }
.section > .grid { border-top: 1px solid var(--rule-strong); padding-top: clamp(48px, 7vw, 96px); }
.section-head { grid-column: 1 / span 3; }
.section-head .label { position: sticky; top: 24px; }
.section-body { grid-column: 4 / span 9; }

/* Hero */
.hero { padding-block: clamp(56px, 8vw, 112px) clamp(48px, 7vw, 96px); align-items: end; row-gap: 48px; }
.hero-text { grid-column: 1 / span 7; }
.hero-text .label { margin-bottom: 28px; }
.hero-text .lead { margin: 28px 0 40px; }
.plate { grid-column: 9 / span 4; margin: 0; }

/* Brand plate: a square on a 6x6 grid */
.plate-field {
  position: relative; aspect-ratio: 1; border: 1px solid var(--rule-strong);
  background-image:
    linear-gradient(to right, var(--rule) 1px, transparent 1px),
    linear-gradient(to bottom, var(--rule) 1px, transparent 1px);
  background-size: calc(100% / 6) calc(100% / 6);
}
.plate-symbol { position: absolute; left: calc(100% / 6); top: calc(100% / 6); width: calc(100% / 6 * 4); height: calc(100% / 6 * 4); object-fit: contain; }

/* Facts band */
.facts-band dl { margin: 0; row-gap: 0; border-top: 1px solid var(--rule-strong); }
.fact { grid-column: span 3; padding: 24px 0 28px; border-right: 1px solid var(--rule); padding-right: var(--col-gap); }
.fact:last-child { border-right: 0; }
.fact dt { margin-bottom: 10px; }
.fact dd { margin: 0; font: 500 16px/1.45 var(--f-display); }

/* Project entry */
.project-media { position: relative; border: 1px solid var(--rule); overflow: hidden; background: #F7D44C; }
.project-media img { width: 100%; aspect-ratio: 1024 / 500; object-fit: cover; transition: transform .8s var(--ease); }
a.project-media:hover img { transform: scale(1.02); }
.project-meta { display: flex; align-items: center; gap: 16px; margin: 28px 0 14px; }
.project-meta img { width: 56px; height: 56px; border-radius: 13px; }
.project-cols { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--col-gap); margin-top: 8px; }
.project-cols .actions { margin-top: 24px; }

/* Spec table */
.spec { margin: 0; border-top: 1px solid var(--rule-strong); }
.spec > div { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.spec dt { padding-top: 3px; }
.spec dd { margin: 0; font-variant-numeric: tabular-nums; }
address { font-style: normal; }

.big-link { font: 600 clamp(26px, 3.6vw, 44px)/1.15 var(--f-display); letter-spacing: -0.02em; word-break: break-word; }

/* Legal pages */
.toc { grid-column: 1 / span 3; }
.toc nav { position: sticky; top: 24px; display: grid; gap: 2px; }
.toc a { display: block; padding: 6px 0 6px 12px; border-left: 1px solid var(--rule); color: var(--muted); font-size: 14px; transition: color .2s, border-color .2s; }
.toc a:hover { color: var(--text); border-color: var(--gold); }
.prose { grid-column: 4 / span 7; max-width: 68ch; }
.prose h2 { font: 600 22px/1.3 var(--f-display); margin: 48px 0 12px; scroll-margin-top: 24px; }
.prose h2:first-child { margin-top: 0; }
.prose h2 .num { font: 500 13px/1 var(--f-mono); margin-right: 12px; vertical-align: 3px; }
.prose ul { padding-left: 1.1em; }
.prose li { margin-bottom: 8px; }
.placeholder { color: var(--gold-text); font-family: var(--f-mono); font-size: 14px; }
.doc-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--rule-strong); }
.doc-list li { border-bottom: 1px solid var(--rule); }
.doc-list a { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px 0; font: 500 18px/1.3 var(--f-display); transition: color .2s; }
.doc-list a:hover { color: var(--gold-text); }

/* Reading progress on long pages (Chromium; other browsers simply show nothing) */
.progress { position: fixed; inset: 0 0 auto 0; height: 2px; background: var(--gold); transform-origin: left; transform: scaleX(0); z-index: 5; }
@supports (animation-timeline: scroll()) {
  .progress { animation: grow linear both; animation-timeline: scroll(root); }
  @keyframes grow { to { transform: scaleX(1); } }
}

/* Footer */
.site-footer { border-top: 1px solid var(--rule); padding-block: 48px 40px; font-size: 14px; color: var(--muted); }
.site-footer .grid { row-gap: 32px; }
.foot-brand { grid-column: 1 / span 5; }
.foot-brand .brand { color: var(--text); margin-bottom: 16px; }
.foot-nav { grid-column: 7 / span 3; display: grid; gap: 8px; align-content: start; }
.foot-nav a:hover { color: var(--text); }
.foot-meta { grid-column: 10 / span 3; text-align: right; align-self: end; }

/* Motion: only when JS is on and the visitor allows it */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
  .js .reveal.in { opacity: 1; transform: none; }
  .js .plate.in .plate-field { animation: wipe 1.1s var(--ease) both .15s; }
  .js .plate.in .plate-symbol { animation: settle .9s var(--ease) both .55s; }
  @keyframes wipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0); } }
  @keyframes settle { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
}

/* Tablet */
@media (max-width: 960px) {
  .hero-text { grid-column: 1 / -1; }
  .plate { grid-column: 1 / span 6; }
  .fact { grid-column: span 6; border-right: 0; border-bottom: 1px solid var(--rule); }
  .section-head { grid-column: 1 / -1; margin-bottom: 28px; }
  .section-body { grid-column: 1 / -1; }
  .toc { display: none; }
  .prose { grid-column: 1 / -1; }
  .foot-brand { grid-column: 1 / span 7; }
  .foot-nav { grid-column: 8 / span 5; }
  .foot-meta { grid-column: 1 / -1; text-align: left; }
}

/* Phone: the nav becomes its own rail under the brand */
@media (max-width: 640px) {
  body { font-size: 16px; }
  .bar { grid-template-columns: 1fr auto; grid-template-areas: "brand toggle" "nav nav"; row-gap: 0; min-height: 0; padding-top: 14px; }
  .brand { grid-area: brand; }
  .theme-toggle { grid-area: toggle; }
  .nav { grid-area: nav; justify-content: space-between; border-top: 1px solid var(--rule); margin-top: 14px; }
  .nav a { padding: 15px 0; }
  .theme-toggle { width: 44px; height: 44px; }
  .plate { grid-column: 1 / -1; max-width: 320px; }
  .fact { grid-column: 1 / -1; padding-block: 18px 20px; }
  .project-cols { grid-template-columns: 1fr; gap: 32px; }
  .spec > div { grid-template-columns: 1fr; gap: 4px; }
  .foot-brand, .foot-nav { grid-column: 1 / -1; }
}

/* Draft pages and long policy text */
.prose-wide { grid-column: 1 / span 8; }
.prose ol { padding-left: 1.2em; }
.prose h3 { font: 600 18px/1.3 var(--f-display); margin: 32px 0 8px; }
.draft-note { border: 1px solid var(--rule-strong); border-left: 3px solid var(--accent-line); background: var(--surface); padding: 14px 18px; margin: 0 0 40px; font-size: 15px; line-height: 1.55; }
@media (max-width: 960px) { .prose-wide { grid-column: 1 / -1; } }
