/* Long-form pages. Every value here comes from the portfolio source:
   tokens.jsx (T), the TopNav and Footer in app.jsx, and the About page
   typography in about.jsx. Weight 400 throughout, white headings at body
   size, grey secondary text, no accent colours. */

:root {
  --bg: #000000;
  --footer-bg: #171717;
  --fg: #ffffff;
  --fg-muted: rgba(255, 255, 255, 0.82);   /* T.fgMuted */
  --fg-dim: #c4c4c4;                        /* T.fgDim */
  --fg-subtle: #737373;                     /* T.fgSubtle */
  --fg-low: #555555;                        /* T.fgLow */
  --line: rgba(255, 255, 255, 0.08);        /* T.line */
  --line-strong: rgba(255, 255, 255, 0.18); /* T.lineStrong */
  --panel: #0a0a0a;                         /* T.panel */
  --glass-bg: rgba(18, 18, 18, 0.55);
  --glass-border: rgba(255, 255, 255, 0.14);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
::selection { background: #ffffff; color: #000000; }
a { color: inherit; text-decoration: none; }
a:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.7); outline-offset: 3px; border-radius: 4px; }

/* ---------- TopNav (app.jsx) ---------- */
.topnav {
  position: fixed; top: 22px; left: 50%; transform: translateX(-50%);
  z-index: 30; width: max-content; max-width: 100vw;
}
.topnav .pill {
  display: flex; align-items: center; gap: 0;
  padding: 7px;
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.topnav .links { display: flex; gap: 2px; }
.topnav .links a {
  font-size: 15px; font-weight: 400; letter-spacing: -0.005em;
  color: rgba(255, 255, 255, 0.82);
  padding: 7px 12px; border-radius: 999px; white-space: nowrap;
  transition: color 200ms ease, background 220ms ease;
}
/* Active tab: same as linkStyle(true) in src/app.jsx */
.topnav .links a.active { font-weight: 500; color: #000000; background: #ffffff; }
.topnav .links a:not(.active):hover { color: #ffffff; }
.topnav .icons {
  display: flex; align-items: center; gap: 3px;
  margin-left: 5px; padding-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
}
.topnav .icons a {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  color: rgba(255, 255, 255, 0.62);
  transition: color 200ms ease;
}
.topnav .icons a:hover { color: #ffffff; }
@media (max-width: 639px) {
  .topnav { top: 6px; max-width: calc(100vw - 8px); }
  .topnav .resume { display: none; }
}

/* ---------- Article ---------- */
/* Same frame as the About section (about.jsx): padded full-width section that clips its
   dot clouds, with a 1200px content column inside. Mobile values apply below 1400px there. */
.page { position: relative; width: 100%; overflow: clip; padding: 120px 64px; }
.wrap { position: relative; max-width: 1200px; margin: 0 auto; width: 100%; }
@media (max-width: 1399px) { .page { padding: 80px 20px; } }

.head { max-width: 640px; }
.kicker { font-size: 17.5px; line-height: 25px; color: var(--fg-subtle); }
.head h1 { margin-top: 18px; font-size: 31px; line-height: 35.58px; font-weight: 400; color: var(--fg); text-wrap: balance; }
.head .dek { margin-top: 18px; font-size: 19.74px; line-height: 25.66px; color: var(--fg-subtle); text-wrap: pretty; }
@media (max-width: 639px) {
  .head h1 { font-size: 26px; line-height: 30px; }
  .head .dek { font-size: 17px; line-height: 23px; }
}

.body { position: relative; z-index: 1; display: grid; grid-template-columns: 220px minmax(0, 640px); gap: 0 96px; margin-top: 72px; }
.toc nav { position: sticky; top: 110px; display: flex; flex-direction: column; gap: 10px; }
.toc a { font-size: 15px; line-height: 19px; color: var(--fg-low); transition: color 180ms ease; }
.toc a:hover, .toc a.active { color: var(--fg); }
@media (max-width: 1099px) {
  .body { grid-template-columns: minmax(0, 640px); margin-top: 64px; }
  .toc { display: none; }
}

article { min-width: 0; }
article h2 {
  font-size: 19.74px; line-height: 25.66px; font-weight: 400; color: var(--fg);
  margin: 64px 0 0; scroll-margin-top: 110px;
}
article h2:first-child { margin-top: 0; }
article p, article li {
  font-size: 17.5px; line-height: 27px; font-weight: 400; color: var(--fg-dim);
  text-wrap: pretty;
}
article h2 + p, article h2 + ul, article h2 + ol, article h2 + .quote, article h2 + figure, article h2 + .rows, article h2 + .table { margin-top: 14px; }
article p + p, article p + ul, article ul + p, article p + ol, article ol + p { margin-top: 16px; }
article ul, article ol { padding-left: 20px; }
article li + li { margin-top: 8px; }
article li::marker { color: var(--fg-low); }
article .w { color: var(--fg); }
article a.inline { color: var(--fg); border-bottom: 1px solid var(--line-strong); transition: border-color 180ms ease; }
article a.inline:hover { border-color: var(--fg); }
article code { font-family: var(--mono); font-size: 0.86em; color: var(--fg-dim); }
@media (max-width: 639px) { article p, article li { font-size: 16px; line-height: 24px; } }

/* Quotes from the ledger */
.quote { margin-top: 24px; padding-left: 18px; border-left: 1px solid var(--line-strong); }
.quote .src { font-size: 14px; line-height: 19px; color: var(--fg-subtle); }
.quote p { margin-top: 8px; font-size: 17.5px; line-height: 27px; color: var(--fg); }
.quote p + p { margin-top: 10px; }
* + .quote, .quote + p, .quote + .quote { margin-top: 24px; }

/* Figures */
figure { margin-top: 32px; }
* + figure, figure + p { margin-top: 32px; }
figure .frame { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel); }
figure img { display: block; width: 100%; height: auto; }
figcaption { margin-top: 12px; font-size: 14px; line-height: 20px; color: var(--fg-subtle); }
.slot { aspect-ratio: 16 / 10; display: grid; place-items: center; padding: 24px; text-align: center; font-size: 14px; line-height: 20px; color: var(--fg-low); }

/* Timeline (monochrome) */
.timeline { padding: 22px 20px 16px; overflow-x: auto; }
.timeline svg { display: block; width: 100%; min-width: 600px; height: auto; }

/* Key/value rows: dates and events */
.rows { margin-top: 24px; border-top: 1px solid var(--line); }
.rows .r { display: grid; grid-template-columns: 132px 1fr; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.rows .k { font-size: 15px; line-height: 24px; color: var(--fg-subtle); font-variant-numeric: tabular-nums; }
.rows .v { font-size: 16px; line-height: 24px; color: var(--fg-dim); }
@media (max-width: 639px) { .rows .r { grid-template-columns: 1fr; gap: 2px; } }

/* Table */
.table { margin-top: 24px; overflow-x: auto; }
.table table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; vertical-align: top; padding: 12px 16px 12px 0; border-bottom: 1px solid var(--line); font-size: 15px; line-height: 22px; font-weight: 400; }
.table th { color: var(--fg-subtle); }
.table td { color: var(--fg-dim); }
.table td:first-child { color: var(--fg); white-space: nowrap; }

/* Hero: text block and dot cloud placed as on the About page */
.hero { position: relative; max-width: none; }
.hero-text { position: relative; z-index: 1; max-width: 560px; padding-top: 50px; }
.head .dek + .dek { margin-top: 14px; }
.sub { margin-top: 14px; font-size: 19.74px; line-height: 25.66px; color: var(--fg-dim); text-wrap: pretty; }
.sub + .dek { margin-top: 22px; }
.hero-art { position: absolute; top: 20px; right: -180px; width: 1100px; height: 619px; pointer-events: none; z-index: 0; opacity: 0.9; }
@media (max-width: 1399px) {
  .hero-text { min-height: 0; padding-top: 8px; }
  .hero-art { top: -40px; right: -100px; width: 640px; height: 360px; opacity: 0.55; }
  .hero-text .dek, .hero-text .sub { text-shadow: 0 0 4px #000, 0 0 8px #000, 0 0 12px #000; }
}
@media (max-width: 639px) {
  .sub { font-size: 17px; line-height: 23px; }
  .hero-text { padding-top: 150px; }
  .hero-art { right: -220px; }
}

/* Model comparison (Nov 4) */
.models { margin-top: 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.model { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 18px 18px 20px; }
.model.wide { grid-column: 1 / -1; border-color: var(--line-strong); }
.model .mh { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.model .mn { font-size: 17.5px; line-height: 22px; color: var(--fg); }
.model .ms { font-size: 13px; line-height: 18px; color: var(--fg-low); }
.model .mv { margin-top: 8px; font-size: 13px; line-height: 18px; color: var(--fg-subtle); }
.model .mv.on { color: var(--fg); }
article .model p { margin-top: 12px; font-size: 15px; line-height: 23px; color: var(--fg-subtle); }
.model .two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.model .lbl { display: block; font-size: 13px; color: var(--fg-low); margin-bottom: 4px; }
article .fignote { margin-top: 12px; font-size: 14px; line-height: 20px; color: var(--fg-subtle); }
@media (max-width: 639px) { .models, .model .two { grid-template-columns: 1fr; } }

/* Full context, collapsed */
.ctx { margin-top: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
article h2 + p + .ctx, article p + .ctx { margin-top: 20px; }
.ctx summary { list-style: none; cursor: pointer; padding: 14px 18px; font-size: 16px; line-height: 22px; color: var(--fg); display: flex; justify-content: space-between; gap: 16px; }
.ctx summary::-webkit-details-marker { display: none; }
.ctx summary span { color: var(--fg-subtle); font-size: 14px; text-align: right; }
.ctx summary::after { content: "+"; color: var(--fg-subtle); flex: none; }
.ctx[open] summary::after { content: "−"; }
.ctx summary span { margin-left: auto; }
.ctx pre { margin: 0; padding: 0 18px 18px; max-height: 520px; overflow: auto; white-space: pre-wrap; word-break: break-word; font-family: var(--mono); font-size: 12.5px; line-height: 19px; color: var(--fg-dim); }
.slot b { color: var(--fg-subtle); font-weight: 400; }

/* ---------- Footer (app.jsx) ---------- */
footer.site { width: 100%; padding: 32px 64px 72px; background: var(--footer-bg); }
footer.site .in { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 64px; align-items: start; }
footer.site img { display: block; height: 36px; width: auto; margin-bottom: 14px; }
footer.site .about { font-size: 17.5px; line-height: 25px; color: var(--fg-subtle); max-width: 420px; }
footer.site .label { font-size: 17.5px; line-height: 21px; color: #ffffff; margin-bottom: 24px; }
footer.site .col { display: flex; flex-direction: column; gap: 16px; }
footer.site .col a { font-size: 17.5px; line-height: 21px; color: var(--fg-subtle); transition: color 180ms ease; }
footer.site .col a:hover { color: #ffffff; }
@media (max-width: 1399px) {
  footer.site { padding: 28px 18px 32px; }
  footer.site .in { grid-template-columns: 1fr 1fr; gap: 22px 18px; }
  footer.site .in > :first-child { grid-column: 1 / -1; }
  footer.site img { height: 30px; margin-bottom: 12px; }
  footer.site .about { font-size: 15.5px; line-height: 22px; }
  footer.site .label { font-size: 15.5px; line-height: 19px; margin-bottom: 14px; }
  footer.site .col { gap: 12px; }
  footer.site .col a { font-size: 15.5px; line-height: 19px; }
}

/* ---------- Blog index ---------- */
.list { margin-top: 72px; max-width: 760px; border-top: 1px solid var(--line); }
.list a { display: grid; grid-template-columns: 160px 1fr; gap: 24px; padding: 24px 0; border-bottom: 1px solid var(--line); }
.list .d { font-size: 15px; line-height: 25.66px; color: var(--fg-subtle); }
.list .t { font-size: 19.74px; line-height: 25.66px; color: var(--fg); transition: color 180ms ease; }
.list .s { margin-top: 6px; font-size: 17.5px; line-height: 25px; color: var(--fg-subtle); }
.list a:hover .t { color: var(--fg-dim); }
@media (max-width: 639px) { .list a { grid-template-columns: 1fr; gap: 4px; } }

/* Featured post on the blog index: the report's hero, linked */
.feature.hero { display: block; margin-top: 72px; min-height: 560px; }
.feature .ft { margin-top: 18px; font-size: 31px; line-height: 35.58px; color: var(--fg); text-wrap: balance; transition: color 180ms ease; }
.feature:hover .ft { color: var(--fg-dim); }
.feature .more { display: inline-block; margin-top: 28px; font-size: 15px; line-height: 20px; color: var(--fg); border-bottom: 1px solid var(--line-strong); transition: border-color 180ms ease; }
.feature:hover .more { border-color: var(--fg); }
@media (max-width: 639px) { .feature .ft { font-size: 26px; line-height: 30px; } }

/* Blog index: every post, newest first */
.posts { margin-top: 96px; }
.posts h2 { font-size: 15px; line-height: 20px; font-weight: 400; color: var(--fg-subtle); padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.post { display: grid; grid-template-columns: 140px 220px 1fr; gap: 24px; align-items: baseline; padding: 22px 0; border-bottom: 1px solid var(--line); }
.post .date, .post .kind { font-size: 15px; line-height: 20px; color: var(--fg-subtle); }
.post .pt { font-size: 19.74px; line-height: 25.66px; color: var(--fg); transition: color 180ms ease; }
.post:hover .pt { color: var(--fg-dim); }
@media (max-width: 639px) {
  .posts { margin-top: 64px; }
  .post { grid-template-columns: 1fr; gap: 6px; padding: 18px 0; }
  .post .pt { font-size: 17px; line-height: 23px; }
}

/* Arrival: the same fade as a tab switch on the site (TabFade in src/app.jsx). The nav stays
   still, because the site's nav is at the same spot when the page changes. */
@keyframes tab-in { from { opacity: 0; filter: blur(6px); transform: translateY(12px); } to { opacity: 1; filter: blur(0); transform: none; } }
main.page, footer.site { animation: tab-in 720ms cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@media (prefers-reduced-motion: reduce) { main.page, footer.site { animation: none; } }
