/* ==========================================================================
   GreyAI Solutions — "Technical Report" theme
   The site is typeset like a university-press preprint: Fraunces for display,
   Newsreader for prose, Spline Sans Mono for the apparatus (labels, marginalia,
   references). Warm paper, carmine ink, hairline rules, one figure.
   Fonts are self-hosted from /fonts/ — no third-party requests.
   ========================================================================== */

@font-face { font-family: 'Fraunces'; src: url('/fonts/Fraunces-400.ttf') format('truetype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Fraunces'; src: url('/fonts/Fraunces-600.ttf') format('truetype'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Fraunces'; src: url('/fonts/Fraunces-Italic-400.ttf') format('truetype'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Fraunces'; src: url('/fonts/Fraunces-Italic-600.ttf') format('truetype'); font-weight: 600; font-style: italic; font-display: swap; }
@font-face { font-family: 'Newsreader'; src: url('/fonts/Newsreader-400.ttf') format('truetype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Newsreader'; src: url('/fonts/Newsreader-600.ttf') format('truetype'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Newsreader'; src: url('/fonts/Newsreader-Italic-400.ttf') format('truetype'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Spline Sans Mono'; src: url('/fonts/SplineSansMono-400.ttf') format('truetype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Spline Sans Mono'; src: url('/fonts/SplineSansMono-500.ttf') format('truetype'); font-weight: 500; font-style: normal; font-display: swap; }

:root {
  --paper: #F6F1E6;
  --paper-2: #EFE8D7;
  --ink: #221D14;
  --soft: #6B6352;
  --rule: rgba(34, 29, 20, 0.18);
  --rule-strong: #221D14;
  --accent: #8E2A1C;
  --accent-soft: rgba(142, 42, 28, 0.08);
  --mark: #F3DE8A;
  --shadow: 0 1px 2px rgba(34, 29, 20, 0.08), 0 12px 32px -16px rgba(34, 29, 20, 0.25);
  --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --font-body: 'Newsreader', Georgia, serif;
  --font-mono: 'Spline Sans Mono', 'Courier New', monospace;
  --measure: 64ch;
  --gutter: clamp(1.25rem, 4vw, 3rem);
}

[data-theme="dark"] {
  --paper: #171310;
  --paper-2: #12100C;
  --ink: #ECE3CF;
  --soft: #A79C85;
  --rule: rgba(236, 227, 207, 0.17);
  --rule-strong: #ECE3CF;
  --accent: #E0715A;
  --accent-soft: rgba(224, 113, 90, 0.10);
  --mark: rgba(243, 222, 138, 0.30);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 36px -16px rgba(0, 0, 0, 0.6);
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.075rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Paper grain: a fixed SVG-noise veil, blended into the page. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.055;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
[data-theme="dark"] body::before { mix-blend-mode: screen; opacity: 0.045; }

::selection { background: var(--mark); color: #221D14; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-style: solid; }

img { max-width: 100%; display: block; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: var(--paper);
  padding: 0.6rem 1rem; z-index: 100;
  font-family: var(--font-mono); font-size: 0.75rem;
}
.skip-link:focus { left: 0; }

.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;
}

/* Document grid: main column + margin for notes on wide screens. */
.sheet {
  display: grid;
  grid-template-columns:
    1fr
    minmax(0, 72rem)  /* sheet bounds */
    1fr;
  padding-inline: var(--gutter);
}
.sheet > * { grid-column: 2; }

.doc {
  display: grid;
  grid-template-columns: minmax(0, var(--measure)) minmax(9rem, 1fr);
  column-gap: clamp(1.5rem, 4vw, 3.5rem);
}
.doc > * { grid-column: 1; }
.doc > .margin-note { grid-column: 2; }

/* ---------- apparatus (mono) ---------- */

.mono {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--soft);
}

.margin-note {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--soft);
  line-height: 1.6;
  padding-top: 0.9rem; /* align with the line it annotates */
  border-top: 1px solid var(--rule);
}
.margin-note::before { content: "※ "; color: var(--accent); }

/* ---------- masthead ---------- */

.site-header {
  border-top: 4px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: relative;
  z-index: 3;
}

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.4rem 1rem;
}
.masthead .brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.35rem, 2.6vw, 1.7rem);
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  margin: 0;
}
.masthead .brand img { display: none; }
.masthead .brand .amp { color: var(--accent); font-style: italic; }
.masthead-meta {
  display: flex;
  align-items: baseline;
  gap: 1.4rem;
  white-space: nowrap;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--rule);
  color: var(--ink);
  width: 2rem; height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  border-radius: 0;
}
.theme-toggle:hover { border-color: var(--ink); }
.theme-toggle svg { width: 14px; height: 14px; }
[data-theme="dark"] .theme-toggle .sun-icon { display: none; }
:root .theme-toggle .moon-icon, [data-theme="light"] .theme-toggle .moon-icon { display: none; }
[data-theme="dark"] .theme-toggle .moon-icon { display: block; }

/* Journal nav row */
.plate-nav {
  border-top: 1px solid var(--rule);
  padding-block: 0.65rem;
}
.plate-nav .nav-list {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.8rem;
  align-items: baseline;
}
.plate-nav a {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  position: relative;
  padding-block: 0.15rem;
}
.plate-nav a::after {
  content: "";
  position: absolute;
  left: 0; right: 100%; bottom: 0;
  border-bottom: 1px solid var(--accent);
  transition: right 0.25s ease;
}
.plate-nav a:hover::after { right: 0; }
.plate-nav .nav-sec { color: var(--accent); margin-right: 0.45em; }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--rule);
  padding: 0.5rem 0.6rem;
  cursor: pointer;
}
.nav-toggle .bar {
  width: 16px; height: 1px;
  background: var(--ink);
  margin-block: 3px;
}

/* ---------- hero / front matter ---------- */

.front-matter { padding-block: clamp(3rem, 8vh, 5.5rem) 0; }

.lede-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.6rem;
  margin-bottom: 2.2rem;
}

.lede-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.9rem, 8.2vw, 5.6rem);
  line-height: 0.98;
  letter-spacing: -0.025em;
  margin: 0 0 2.4rem;
  max-width: 14ch;
}
.lede-title em {
  font-style: italic;
  color: var(--accent);
  letter-spacing: -0.015em;
}

.abstract {
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule);
  padding-block: 1.4rem 1.6rem;
  margin: 0;
}
.abstract .mono { margin-right: 0.6em; }
.abstract p {
  margin: 0;
  font-size: 1.22rem;
  line-height: 1.55;
  max-width: 52ch;
  display: inline;
}

.keywords {
  margin-top: 1.3rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--soft);
}
.keywords .kw-label { color: var(--accent); }

/* ---------- figure ---------- */

.figure-wrap { padding-block: clamp(3rem, 9vh, 5.5rem); }
figure.figure { margin: 0 auto; max-width: 40rem; }
figure.figure .plate {
  border: 1px solid var(--rule-strong);
  padding: 0.5rem;
  background: var(--paper-2);
  box-shadow: var(--shadow);
}
figure.figure img { width: 100%; }
figure.figure figcaption {
  margin-top: 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.02em;
  color: var(--soft);
  line-height: 1.6;
}
figure.figure figcaption .fig-no { color: var(--accent); font-weight: 500; }

/* ---------- sections ---------- */

.sec {
  border-top: 1px solid var(--rule-strong);
  padding-block: clamp(2.2rem, 6vh, 3.6rem);
}
.sec-head {
  display: flex;
  align-items: baseline;
  gap: 1.1rem;
  margin-bottom: clamp(1.6rem, 4vh, 2.6rem);
}
.sec-head .sec-no {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.1em;
}
.sec-head h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: 0;
}
.sec-head h2 em { font-style: italic; color: var(--accent); }
.sec-alt { background: var(--paper-2); }

/* Findings: an index of capabilities, not a card grid. */
.findings { list-style: none; margin: 0; padding: 0; }
.finding {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr);
  column-gap: 1.4rem;
  padding-block: 1.35rem;
  border-top: 1px solid var(--rule);
}
.finding:first-child { border-top: 0; padding-top: 0; }
.finding .f-no {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--soft);
  padding-top: 0.5rem;
  transition: color 0.2s ease;
}
.finding h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  margin: 0 0 0.35rem;
  transition: color 0.2s ease;
}
.finding p { margin: 0; color: var(--soft); max-width: 56ch; font-size: 1.02rem; }
.finding:hover .f-no, .finding:hover h3 { color: var(--accent); }
.finding:hover h3 { font-style: italic; }

/* Audience: the roll call. */
.rollcall-lede {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.5rem, 3.4vw, 2.1rem);
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0 0 2rem;
  max-width: 30ch;
}
.rollcall {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 0;
}
.rollcall li {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  color: var(--ink);
  padding-right: 0.9rem;
  margin-right: 0.9rem;
  border-right: 1px solid var(--rule);
}
.rollcall li:last-child { border-right: 0; margin-right: 0; padding-right: 0; }
.rollcall li::before { content: "[ "; color: var(--accent); }
.rollcall li::after { content: " ]"; color: var(--accent); }

/* Method: numbered procedure. */
.method {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.5rem, 3.5vw, 3rem);
}
.method li { border-top: 2px solid var(--rule-strong); padding-top: 1rem; }
.method .m-no {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 2.6rem;
  line-height: 1;
  color: var(--accent);
  display: block;
  margin-bottom: 0.7rem;
}
.method h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  margin: 0 0 0.4rem;
  letter-spacing: -0.01em;
}
.method p { margin: 0; color: var(--soft); font-size: 0.98rem; }

/* About: declaration of principles. */
.pullquote {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.8rem, 4.6vw, 2.9rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 2.4rem;
  max-width: 24ch;
  text-indent: -0.45em;
}
.pullquote::before { content: "“"; color: var(--accent); }
.pullquote::after { content: "”"; color: var(--accent); }

.declarations { list-style: none; margin: 0; padding: 0; counter-reset: dec; }
.declarations li {
  counter-increment: dec;
  display: grid;
  grid-template-columns: 2.6rem minmax(0, 1fr);
  column-gap: 1rem;
  padding-block: 0.9rem;
  border-top: 1px solid var(--rule);
  font-size: 1.05rem;
}
.declarations li::before {
  content: "(" counter(dec) ")";
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  padding-top: 0.35rem;
}

/* ---------- footer: references & colophon ---------- */

.site-footer {
  border-top: 4px solid var(--rule-strong);
  margin-top: clamp(2rem, 6vh, 4rem);
  padding-block: 2.4rem 3rem;
}
.refs { list-style: none; margin: 0 0 2.2rem; padding: 0; }
.refs li {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.7;
  color: var(--soft);
  padding-left: 2.2rem;
  text-indent: -2.2rem;
}
.refs .ref-no { color: var(--accent); }
.refs a { color: inherit; text-decoration-color: var(--rule); }
.refs a:hover { color: var(--ink); }

.colophon {
  border-top: 1px solid var(--rule);
  padding-top: 1.2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 2rem;
  justify-content: space-between;
}

/* ---------- motion ---------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
.rise { animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.d1 { animation-delay: 0.08s; }
.d2 { animation-delay: 0.18s; }
.d3 { animation-delay: 0.30s; }
.d4 { animation-delay: 0.44s; }

/* main.js IntersectionObserver adds .visible to these */
.fade-in { opacity: 0; transform: translateY(16px); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1); }
.fade-in.visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rise { animation: none; }
  .fade-in { opacity: 1; transform: none; transition: none; }
}

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

@media (max-width: 1080px) {
  .doc { grid-template-columns: minmax(0, 1fr); }
  .doc > .margin-note { display: none; }
}

@media (max-width: 860px) {
  .masthead { flex-wrap: wrap; }
  .nav-toggle { display: block; }
  .plate-nav .nav-list {
    display: none;
    flex-direction: column;
    gap: 0.9rem;
    padding-block: 1.2rem;
  }
  .plate-nav .nav-list.show { display: flex; }
  .method { grid-template-columns: minmax(0, 1fr); }
  .lede-title { max-width: none; }
}
