/* Shared stylesheet for Liam Kozma whitepaper sub-pages.
   Continues the index aesthetic: dark, monochrome, Inter + JetBrains Mono.
   No syntax-highlight color; equations/code/diagrams in shades of slate. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-var.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("/fonts/jetbrains-mono-var.woff2") format("woff2");
}

:root {
  --bg: #161618;
  --fg: #e8e8ea;
  --muted: #a1a1aa;
  --faint: #6b6b73;
  --hairline: #343438;
  --accent: #7ea6c9;
  --panel: #262628;
  --panel-line: #3a3a3e;
  --slate: #c9ccd1;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --serif: Georgia, "Times New Roman", serif;
}

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

html {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scrollbar-width: thin;
  scrollbar-color: #2a2a2a transparent;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
}

::selection { background: #2a3a4a; color: #fff; }
::-moz-selection { background: #2a3a4a; color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #2a2a2a;
  border: 3px solid var(--bg);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover { background: #3a3a3a; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 1px;
}

/* Narrow, readable single column. */
main {
  max-width: 44rem;
  margin: 0 auto;
  padding: 4rem 1.5rem 7rem;
}
@media (min-width: 640px) {
  main { padding: 5rem 1.5rem 8rem; }
}

/* ---- Back link: muted underline that expands on hover ---- */
.backlink {
  position: relative;
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 200ms ease-in-out;
}
.backlink::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
  transition: width 200ms ease-in-out;
}
.backlink:hover { color: var(--fg); }
.backlink:hover::after { width: 100%; }

/* ---- Inline link, matches index expanding underline ---- */
.link {
  position: relative;
  display: inline;
  color: var(--accent);
  text-decoration: none;
  transition: color 200ms ease-in-out;
}
.link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: 1px;
  background: currentColor;
  opacity: 0.3;
  transition: opacity 200ms ease-in-out;
}
.link:hover::after { opacity: 1; }

/* ---- Masthead ---- */
.masthead { margin-top: 3rem; }
.kicker {
  font-family: var(--mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--faint);
  margin: 0;
}
h1.title {
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.015em;
  text-wrap: balance;
  margin: 0.75rem 0 0;
}
@media (min-width: 640px) {
  h1.title { font-size: 2.125rem; }
}
.byline {
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--muted);
  margin: 1.25rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
}
.byline .sep { color: var(--hairline); user-select: none; }

/* ---- Abstract ---- */
.abstract {
  margin: 2.5rem 0 0;
  padding: 1.5rem 0 0;
  border-top: 1px solid var(--hairline);
}
.abstract .label {
  font-family: var(--mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--faint);
  margin: 0 0 0.75rem;
}
.abstract p {
  color: var(--slate);
  line-height: 1.7;
  text-wrap: pretty;
  margin: 0;
}
.keywords {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  margin: 1rem 0 0;
}
.keywords .k { color: var(--faint); }

/* ---- Section structure (## label, index style) ---- */
.body { margin-top: 3.5rem; }
section.sec { scroll-margin-top: 2rem; }
section.sec + section.sec { margin-top: 3.25rem; }
h2.sec-title {
  font-family: var(--mono);
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--fg);
  margin: 0 0 1.25rem;
}
h2.sec-title .n { color: var(--hairline); user-select: none; }
h3.sub {
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg);
  margin: 2rem 0 0.5rem;
  text-wrap: pretty;
}

/* ---- Prose ---- */
.body p {
  color: var(--muted);
  line-height: 1.72;
  text-wrap: pretty;
  margin: 1rem 0 0;
}
.body p:first-of-type { margin-top: 0; }
.body strong { color: var(--fg); font-weight: 600; }
.body em { color: var(--slate); font-style: italic; }

ul.notes, ol.notes {
  color: var(--muted);
  line-height: 1.72;
  margin: 1rem 0 0;
  padding-left: 1.25rem;
}
ul.notes li, ol.notes li { margin: 0.35rem 0; }
ul.notes li::marker { color: var(--hairline); }
ol.notes li::marker { color: var(--faint); font-family: var(--mono); font-size: 0.85em; }

/* ---- Equations: serif italic, centered, muted right-aligned number ---- */
.eq {
  position: relative;
  margin: 1.75rem 0;
  padding: 0.25rem 3.25rem 0.25rem 0;
  font-family: var(--serif);
  font-size: 1.0625rem;
  color: var(--slate);
  text-align: center;
}
.eq .num {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--faint);
}
.var { font-family: var(--serif); font-style: italic; }
.op { color: var(--muted); font-style: normal; }
sub, sup { font-family: var(--mono); font-size: 0.7em; }

/* ---- Code / config blocks: monochrome, slate on panel ---- */
pre {
  margin: 1.5rem 0;
  padding: 1.125rem 1.25rem;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 2px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.65;
  color: var(--slate);
}
pre .c { color: var(--faint); }   /* comment */
pre .d { color: var(--muted); }   /* dim / keyword */
code {
  font-family: var(--mono);
  font-size: 0.85em;
  color: var(--slate);
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 2px;
  padding: 0.05rem 0.3rem;
}
pre code { background: none; border: none; padding: 0; font-size: inherit; color: inherit; }

/* ---- Figure / architecture diagram ---- */
figure {
  margin: 1.75rem 0;
}
figure .diagram {
  padding: 1.5rem 1.25rem;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 2px;
  overflow-x: auto;
}
figure pre.ascii {
  margin: 0;
  padding: 0;
  background: none;
  border: none;
  color: var(--slate);
  font-size: 0.8125rem;
  line-height: 1.5;
  white-space: pre;
}
figcaption {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--faint);
  margin-top: 0.75rem;
  text-wrap: pretty;
}
figcaption .fn { color: var(--muted); }

/* ---- Embedded SVG animation (protein embedding loop) ---- */
iframe.anim {
  display: block;
  width: 100%;
  aspect-ratio: 1280 / 1000;
  margin: 1.5rem 0 0;
  border: 1px solid var(--panel-line);
  border-radius: 2px;
  background: var(--bg);
}

/* ---- Data table ---- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.8125rem;
}
th, td {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--hairline);
  color: var(--muted);
}
th {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--faint);
}
td.num { font-family: var(--mono); color: var(--slate); }

/* ---- Pull blockquote ---- */
blockquote {
  margin: 1.75rem 0;
  padding-left: 1.25rem;
  border-left: 2px solid var(--panel-line);
  color: var(--slate);
  font-style: italic;
  line-height: 1.7;
}

/* ---- Colophon ---- */
.colophon {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--hairline);
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--faint);
  line-height: 1.8;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
