/* =========================================================================
   GSDI clone — shared structural stylesheet
   Tokens defined here are overridable per theme via [data-theme] on <html>.
   ========================================================================= */

/* ---------- Design tokens (default = Atelier) ---------- */
:root {
  /* Palette */
  --bg:          oklch(97.2% 0.008 80);
  --bg-2:        oklch(94.0% 0.010 80);
  --bg-3:        oklch(91.0% 0.012 80);
  --fg:          oklch(18.0% 0.010 60);
  --fg-muted:    oklch(42.0% 0.012 60);
  --fg-subtle:   oklch(58.0% 0.010 60);
  --rule:        oklch(86.0% 0.012 70);
  --accent:      oklch(58.0% 0.190 28);
  --accent-ink:  oklch(20.0% 0.030 30);
  --accent-tint: oklch(94.0% 0.060 30);
  --on-accent:   oklch(99.0% 0.005 80);
  --inverse-bg:  oklch(14.0% 0.012 60);
  --inverse-fg:  oklch(96.0% 0.008 80);

  /* Type */
  --font-display: "Newsreader", "Source Serif 4", "Times New Roman", Georgia, serif;
  --font-body:    "Archivo", "Inter Tight", "Helvetica Neue", system-ui, sans-serif;
  --font-mono:    "DM Mono", "JetBrains Mono", ui-monospace, "SF Mono", monospace;

  --step--1: clamp(0.78rem, 0.76rem + 0.10vw, 0.84rem);
  --step-0:  clamp(0.95rem, 0.92rem + 0.18vw, 1.04rem);
  --step-1:  clamp(1.18rem, 1.10rem + 0.40vw, 1.34rem);
  --step-2:  clamp(1.45rem, 1.30rem + 0.78vw, 1.78rem);
  --step-3:  clamp(1.85rem, 1.55rem + 1.55vw, 2.55rem);
  --step-4:  clamp(2.40rem, 1.80rem + 3.10vw, 3.85rem);
  --step-5:  clamp(3.20rem, 2.00rem + 6.10vw, 6.40rem);
  --step-6:  clamp(4.20rem, 2.40rem + 9.20vw, 9.40rem);

  /* Spacing (4pt scale) */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px;  --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px;  --s-8: 64px;
  --s-9: 96px;  --s-10: 128px;

  --radius-1: 2px;
  --radius-2: 4px;

  --measure: 62ch;
  --container: 1320px;
  --gutter: clamp(20px, 4vw, 48px);

  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-out-expo:  cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- Reset (lean) ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body, h1, h2, h3, h4, p, ul, ol, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, picture, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; padding: 0; }
a { color: inherit; text-decoration: none; }

html { background: var(--bg); }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.55;
  font-feature-settings: "ss01", "ss02", "kern";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent); color: var(--on-accent); }

/* ---------- Type ---------- */
.display, h1.display, .h-display {
  font-family: var(--font-display);
  font-weight: 460;
  font-size: var(--step-6);
  line-height: 0.96;
  letter-spacing: -0.022em;
  font-variation-settings: "opsz" 144, "wght" 460;
}
h1, .h1 {
  font-family: var(--font-display);
  font-weight: 480;
  font-size: var(--step-4);
  line-height: 1.02;
  letter-spacing: -0.018em;
  font-variation-settings: "opsz" 60, "wght" 480;
}
h2, .h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--step-3);
  line-height: 1.08;
  letter-spacing: -0.014em;
  font-variation-settings: "opsz" 36, "wght" 500;
}
h3, .h3 {
  font-family: var(--font-display);
  font-weight: 540;
  font-size: var(--step-2);
  line-height: 1.15;
  letter-spacing: -0.010em;
}
h4, .h4 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--step-1);
  line-height: 1.25;
  letter-spacing: -0.004em;
}
.eyebrow, .kicker {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--fg-muted);
  font-weight: 500;
}
.lead {
  font-size: var(--step-2);
  line-height: 1.32;
  letter-spacing: -0.008em;
  color: var(--fg);
  max-width: 56ch;
  font-family: var(--font-display);
  font-weight: 380;
  font-variation-settings: "opsz" 36, "wght" 380;
}
em.italic { font-style: italic; color: var(--accent); }
.muted { color: var(--fg-muted); }
.tight { line-height: 1.1; }
p { max-width: var(--measure); }
p + p { margin-top: var(--s-4); }

a.link {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--rule);
  transition: text-decoration-color 200ms var(--ease-out-quart);
}
a.link:hover { text-decoration-color: var(--accent); }

/* ---------- Layout ---------- */
.wrap { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: var(--s-9); }
.section--tight { padding-block: var(--s-7); }
.section--wide { padding-block: var(--s-10); }
.stack > * + * { margin-top: var(--stack, var(--s-4)); }
.stack-sm > * + * { margin-top: var(--s-3); }
.stack-lg > * + * { margin-top: var(--s-6); }
.stack-xl > * + * { margin-top: var(--s-8); }

.grid-2 { display: grid; gap: var(--s-7); grid-template-columns: 1fr; }
.grid-3 { display: grid; gap: var(--s-6); grid-template-columns: 1fr; }
.grid-4 { display: grid; gap: var(--s-5); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-12 { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--gutter); }

@media (min-width: 720px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}
@media (min-width: 980px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in oklch, var(--bg) 86%, transparent);
  backdrop-filter: saturate(120%) blur(12px);
  -webkit-backdrop-filter: saturate(120%) blur(12px);
  border-bottom: 1px solid var(--rule);
}
.header-row { display: flex; align-items: center; gap: var(--s-5); min-height: 72px; }
.brand { display: inline-flex; align-items: baseline; gap: 10px; }
.brand-mark {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  background: var(--fg); color: var(--bg);
  font-family: var(--font-display);
  font-weight: 700; font-size: 16px;
  letter-spacing: -0.04em;
  border-radius: 2px;
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: -0.01em;
}
.brand-tag { font-family: var(--font-mono); font-size: 11px; color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.16em; }

.nav { margin-left: auto; display: flex; gap: clamp(14px, 1.6vw, 28px); align-items: center; }
.nav a {
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 10px 4px;
  position: relative;
  color: var(--fg-muted);
  transition: color 200ms var(--ease-out-quart);
}
.nav a[aria-current="page"], .nav a:hover { color: var(--fg); }
.nav a[aria-current="page"]::after {
  content: ""; position: absolute; left: 4px; right: 4px; bottom: 4px;
  height: 2px; background: var(--accent);
}

.lang {
  display: inline-flex; align-items: center;
  font-family: var(--font-mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.16em;
  border-left: 1px solid var(--rule);
  padding-left: var(--s-4);
  gap: 6px; color: var(--fg-muted);
}
.lang a[aria-current="true"] { color: var(--fg); font-weight: 600; }

.nav-toggle { display: none; }
@media (max-width: 720px) {
  .nav-toggle { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--rule); border-radius: 2px; }
  .nav, .lang { display: none; }
  body.nav-open .nav, body.nav-open .lang { display: flex; }
  body.nav-open .nav { flex-direction: column; align-items: flex-start; gap: 0; padding-block: var(--s-3); width: 100%; }
  body.nav-open .header-row { flex-wrap: wrap; }
  body.nav-open .nav a { padding: 12px 0; width: 100%; border-top: 1px solid var(--rule); }
  body.nav-open .lang { border-left: 0; padding-left: 0; margin-top: var(--s-3); }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 14px 22px;
  background: var(--fg); color: var(--bg);
  font-weight: 500; font-size: var(--step--1);
  letter-spacing: 0.02em;
  border-radius: var(--radius-2);
  transition: transform 180ms var(--ease-out-quart), background 180ms var(--ease-out-quart);
  border: 1px solid var(--fg);
}
.btn:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn .arrow { transition: transform 220ms var(--ease-out-quart); }
.btn:hover .arrow { transform: translateX(4px); }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 0;
  font-weight: 500; font-size: var(--step--1);
  border-bottom: 1px solid var(--fg);
  transition: color 200ms var(--ease-out-quart);
}
.btn-ghost:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Cards (theme-overridden) ---------- */
.card {
  display: flex; flex-direction: column;
  background: transparent;
  position: relative;
}
.card .media {
  position: relative;
  overflow: hidden;
  background: var(--bg-2);
  aspect-ratio: 2 / 1;
  isolation: isolate;
}
.card .media img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 600ms var(--ease-out-quart), filter 600ms var(--ease-out-quart);
}
.card:hover .media img { transform: scale(1.03); }
.card .meta {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-top: var(--s-4);
  font-family: var(--font-mono); font-size: var(--step--1);
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--fg-muted);
}
.card .title {
  font-family: var(--font-display);
  font-size: var(--step-2);
  line-height: 1.15;
  letter-spacing: -0.01em;
  padding-top: var(--s-2);
  font-weight: 460;
  font-variation-settings: "opsz" 36, "wght" 460;
}
.card .excerpt {
  padding-top: var(--s-3);
  color: var(--fg-muted);
  font-size: var(--step-0);
  line-height: 1.55;
  max-width: none;
}
.card .more {
  margin-top: var(--s-4);
  font-size: var(--step--1);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
  display: inline-flex; gap: 8px; align-items: center;
}

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--fg-muted);
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 14px 14px;
  border: 1px solid var(--rule);
  background: transparent;
  border-radius: var(--radius-2);
  font-size: var(--step-0);
  transition: border-color 180ms var(--ease-out-quart);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 0; border-color: var(--accent);
}
.field textarea { min-height: 140px; resize: vertical; }

/* ---------- Tables / Specs ---------- */
.spec {
  display: grid; grid-template-columns: 120px 1fr; gap: 4px var(--s-5);
  font-size: var(--step--1);
  border-top: 1px solid var(--rule);
  padding-top: var(--s-4);
}
.spec dt { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.14em; color: var(--fg-muted); padding-top: 6px; }
.spec dd { padding-top: 6px; }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: var(--s-10);
  border-top: 1px solid var(--rule);
  padding-block: var(--s-8);
  font-size: var(--step--1);
  color: var(--fg-muted);
}
.footer-grid { display: grid; gap: var(--s-6); grid-template-columns: 1fr; }
@media (min-width: 720px) { .footer-grid { grid-template-columns: 1.4fr 1fr 1fr 1fr; } }
.footer-grid h5 {
  font-family: var(--font-mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--fg); margin-bottom: var(--s-3);
}
.footer-grid ul li { margin-bottom: 8px; }
.footer-grid a:hover { color: var(--accent); }
.footer-meta {
  margin-top: var(--s-7); padding-top: var(--s-4); border-top: 1px solid var(--rule);
  display: flex; flex-wrap: wrap; gap: var(--s-5);
  justify-content: space-between;
  font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em;
}

/* ---------- Theme switcher ---------- */
.theme-switch {
  display: inline-flex; gap: 2px; padding: 4px;
  background: var(--bg-2); border: 1px solid var(--rule); border-radius: 999px;
}
.theme-switch button {
  font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em;
  padding: 6px 12px; border-radius: 999px; color: var(--fg-muted);
  transition: background 180ms var(--ease-out-quart), color 180ms var(--ease-out-quart);
}
.theme-switch button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }

/* ---------- Reveal (IntersectionObserver) ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 700ms var(--ease-out-quart), transform 700ms var(--ease-out-quart); }
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---------- Utility ---------- */
.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;
}
.divider { height: 1px; background: var(--rule); border: 0; margin: 0; }
.tag {
  display: inline-flex; align-items: center;
  padding: 5px 10px;
  font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em;
  border: 1px solid var(--rule); border-radius: 999px;
  color: var(--fg-muted);
}
.rule-text { border-top: 1px solid var(--rule); padding-top: var(--s-4); }
.numbered { font-family: var(--font-mono); font-size: var(--step--1); color: var(--fg-subtle); }
