/* ==========================================================================
   A World of Bits — Christopher Rose
   css/site.css

   PALETTE: "Petrol & Coral"
   -------------------------
   Deep sea-blue-green ground with coral and gold on top. Cool ground, warm
   accents. Dark enough to read easily for a long stretch, light enough not
   to feel like a void.

   NO PATTERN. Depth comes from two very large, very soft colour blooms —
   non-repeating, nothing for the eye to catch on. There is no dot field and
   no rail running down the page. Sections are separated by space and by a
   short accent bar above the heading; link rows are separated by a single
   hairline BETWEEN items, never above and below every row. (Rules at even
   intervals down a page read as a ledger, and fight the text.)

   TYPE: Fraunces (display) / Newsreader (body) / JetBrains Mono (labels).

   CHANGING THE PALETTE: every colour comes from the block below.
   ========================================================================== */

:root {
  /* ground */
  --ground:     #102428;   /* petrol */
  --panel:      #16323A;   /* cards, callouts */
  --panel-2:    #1B3C45;   /* panel hover */
  --bloom-a:    rgba(255,111,97,.06);
  --bloom-b:    rgba(242,193,78,.05);

  /* rules — used sparingly */
  --rule:       #25454E;
  --rule-soft:  #1B333A;

  /* text */
  --ink:        #E9F2F2;
  --body:       #A9C0C4;
  --faint:      #7B9299;

  /* accents */
  --accent:     #FF7F6E;   /* coral — links, live things, actions */
  --accent-soft:rgba(255,127,110,.17);
  --second:     #F2C14E;   /* gold — category labels */
  --highlight:  #F2C14E;

  --font-display: "Fraunces", "Hoefler Text", Georgia, serif;
  --font-body:    "Newsreader", "Iowan Old Style", Georgia, serif;
  --font-mono:    "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  --wonk: "SOFT" 0, "WONK" 1;

  --measure: 40rem;
  --wrap: 70rem;
}

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

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration:.001ms !important; animation-iteration-count:1 !important;
    transition-duration:.001ms !important;
  }
}

body {
  margin: 0;
  color: var(--body);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.66;
  -webkit-font-smoothing: antialiased;
  background-color: var(--ground);
  background-image:
    radial-gradient(60rem 40rem at 12% -8%,  var(--bloom-a), transparent 70%),
    radial-gradient(52rem 36rem at 92% 105%, var(--bloom-b), transparent 70%);
  background-repeat: no-repeat;
  background-attachment: fixed;
}

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

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color .18s ease, color .18s ease;
}
a:hover { border-bottom-color: var(--accent); }
a:focus-visible { outline: 2px solid var(--second); outline-offset: 3px; border-radius: 2px; }

/* -------------------------------------------------------------- helpers */
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 1.6rem; }
.measure { max-width: var(--measure); }

/* the section mark: a short bar, not a ruled line down the page */
.mark { display:block; width:2.6rem; height:3px; background:var(--second);
        border-radius:2px; margin:0 0 1.1rem; }
.mark.hot { background: var(--accent); }

.eyebrow {
  font-family: var(--font-mono); font-size:.66rem; letter-spacing:.18em;
  text-transform: uppercase; color: var(--faint); margin: 0 0 .7rem;
}
.tag {
  font-family: var(--font-mono); font-size:.63rem; letter-spacing:.15em;
  text-transform: uppercase; color: var(--second); font-weight: 500;
}
.dim { color: var(--faint); }
.smiley { display:inline; width:1em; height:1em; vertical-align:-.1em; border:0; }
a.plain { border-bottom: 0; }
mark { background: transparent; color: var(--highlight); font-style: normal; }

/* the rail is gone — .rail is kept as a harmless positioning context so
   existing markup doesn't need rewriting */
.rail { position: relative; }

/* --------------------------------------------------------------- header */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(16,36,40,.9);
  backdrop-filter: blur(9px);
  border-bottom: 1px solid var(--rule-soft);
}
.topbar-inner {
  max-width: var(--wrap); margin: 0 auto; padding: .7rem 1.6rem;
  display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
}
.brand {
  font-family: var(--font-mono); font-size:.72rem; letter-spacing:.2em;
  text-transform: uppercase; color: var(--ink); border-bottom: 0;
  white-space: nowrap; font-weight: 500;
}
.brand span { color: var(--accent); }
.topnav { display:flex; gap:1.15rem; flex-wrap:wrap; margin-left:auto; }
.topnav a {
  font-family: var(--font-mono); font-size:.72rem; letter-spacing:.1em;
  text-transform: uppercase; color: var(--faint); border-bottom: 1px solid transparent;
}
.topnav a:hover, .topnav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

/* ----------------------------------------------------------------- hero */
.hero { padding: 4.4rem 0 2.4rem; }
.hero h1 {
  font-family: var(--font-display); font-optical-sizing: auto;
  font-variation-settings: var(--wonk); font-weight: 700;
  font-size: clamp(2.6rem, 7vw, 4.8rem); line-height: .98;
  letter-spacing: -.022em; color: var(--ink); margin: 0 0 .35rem;
}
.hero .sub {
  font-family: var(--font-mono); font-size:.76rem; letter-spacing:.24em;
  text-transform: uppercase; color: var(--second); font-weight:500; margin: 0 0 1.9rem;
}
.hero .role { font-size: 1.03rem; margin: 0 0 2rem; max-width: 34rem; }

.thesis { margin: 0 0 2.6rem; max-width: 41rem; padding: 0; border: 0; font-size: 1.06rem; }
.thesis strong, .thesis em { color: var(--ink); font-style: italic; font-weight: 400; }
.thesis .punch {
  display: block; margin-top: .9rem;
  font-family: var(--font-display); font-variation-settings: var(--wonk);
  font-style: italic; font-size: 1.46rem; line-height: 1.3; color: var(--ink);
}

/* ------------------------------------------ the banner as a tessellation */
/* Two rows, packed flush to both margins, tight gaps, no matting. Each tile's
   width follows its own picture's aspect ratio, so nothing floats in a pool
   of background colour. js/strip.js measures the loaded images and sets the
   sizes; the rules here are the no-JS fallback (a tight equal-height row).

   Row heights may differ a little between the two rows. That is the cost of
   flush margins with fixed pictures, and it looks better than the
   alternative. Tune the row count in strip.js, not here. */
.strip {
  display: flex; flex-wrap: wrap;
  gap: 6px;                                /* must match GAP in strip.js */
  list-style: none; margin: 0 0 2.6rem; padding: 0;
}
.strip li {
  position: relative;
  flex: 0 0 auto;
  height: 132px;                           /* no-JS fallback; JS overrides */
  overflow: hidden;
  background: var(--panel);
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}
.strip a { display: block; width: 100%; height: 100%; border-bottom: 0; }
.strip .frame { display: block; width: 100%; height: 100%; }
.strip .frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.strip:not(.is-justified) .frame img { width: auto; height: 100%; }

/* Caption sits inside the tile so the packing stays flush. Bumped up in
   size, weight and contrast — at .52rem it was unreadable. */
.strip .label {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 1.5rem .5rem .45rem;
  font-family: var(--font-mono);
  font-size: .64rem; font-weight: 500;
  letter-spacing: .07em; line-height: 1.35;
  text-transform: uppercase; text-align: center;
  overflow-wrap: anywhere;
  color: #FFFFFF;
  text-shadow: 0 1px 3px rgba(0,0,0,.85);
  background: linear-gradient(to top, rgba(6,16,19,.94) 0%,
                                      rgba(6,16,19,.72) 42%,
                                      rgba(6,16,19,.28) 72%, transparent 100%);
  transition: color .2s ease;
  pointer-events: none;
}
.strip li:hover, .strip li:focus-within {
  transform: translateY(-3px);
  box-shadow: 0 12px 26px -12px rgba(0,0,0,.7);
  filter: saturate(1.06);
}
.strip li:hover .label, .strip li:focus-within .label { color: var(--second); }

@media (max-width: 40rem) {
  .strip li { height: 96px; }
  .strip .label { font-size: .56rem; letter-spacing: .04em;
                  padding: 1.2rem .25rem .38rem; }
}

/* -------------------------------------------------------------- section */
.section { padding: 3rem 0 3.2rem; }
.section h2 {
  font-family: var(--font-display); font-variation-settings: var(--wonk);
  font-weight: 700; font-size: clamp(1.6rem, 3.4vw, 2.3rem); line-height: 1.12;
  letter-spacing: -.018em; color: var(--ink); margin: 0 0 1.3rem;
}
.section h3 {
  font-family: var(--font-display); font-variation-settings: var(--wonk);
  font-weight: 700; font-size: 1.2rem; line-height: 1.25;
  color: var(--ink); margin: 0 0 .5rem;
}
.section p { margin: 0 0 1.05rem; }
.lede { font-size: 1.1rem; max-width: 44rem; }

/* ------------------------------------------------------------ now cards */
.now { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem,1fr)); gap: 1.1rem; }
.now-item {
  background: var(--panel); border: 1px solid var(--rule-soft); border-radius: 5px;
  padding: 1.4rem 1.35rem 1.5rem; transition: background .2s ease, transform .2s ease;
}
.now-item:hover { background: var(--panel-2); transform: translateY(-2px); }
.now-item .when {
  font-family: var(--font-mono); font-size:.63rem; letter-spacing:.14em; font-weight:500;
  color: var(--second); text-transform: uppercase; display: block; margin-bottom: .6rem;
}
.now-item h3 { margin-bottom: .4rem; }
.now-item p { font-size: .95rem; margin: 0; }

/* ------------------------------------------------------------------ bio */
.bio { display: grid; grid-template-columns: 1fr; gap: 2.4rem; }
@media (min-width: 62rem) { .bio { grid-template-columns: minmax(0,1fr) 15rem; gap: 3.2rem; } }
.bio-body p { max-width: var(--measure); }
.portrait { position: sticky; top: 5rem; align-self: start; }
.portrait img { border: 1px solid var(--rule); border-radius: 4px; }
.portrait figcaption {
  font-family: var(--font-mono); font-size:.62rem; letter-spacing:.1em;
  text-transform: uppercase; color: var(--faint); margin-top:.7rem; line-height:1.6;
}

/* --------------------------------------------------------- thread cards */
.threads { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem,1fr)); gap: 1.2rem; }
.thread {
  border: 1px solid var(--rule-soft); border-radius: 5px; background: var(--panel);
  padding: 1.4rem 1.35rem 1.5rem; display: flex; flex-direction: column;
  transition: background .22s ease, transform .22s ease;
}
.thread:hover { background: var(--panel-2); transform: translateY(-2px); }
.thread .tag { display: block; margin-bottom: .7rem; }
.thread p { font-size: .95rem; }
.thread .more {
  margin-top: auto; padding-top: .9rem;
  font-family: var(--font-mono); font-size:.65rem; letter-spacing:.12em; text-transform: uppercase;
}

/* ------------------------------------------------------------- timeline */
.timeline { list-style: none; margin: 0; padding: 0; max-width: 46rem; }
.timeline li { position: relative; padding: 0 0 1.6rem 5.4rem; }
.timeline li:last-child { padding-bottom: 0; }
.timeline .yr {
  position: absolute; left: 0; top: -.1rem;
  font-family: var(--font-mono); font-size:.72rem; letter-spacing:.08em;
  color: var(--second); font-weight: 500;
}
.timeline li.qed .yr { color: var(--accent); }
.timeline p { margin: 0 0 .6rem; font-size: .98rem; }

.theorem {
  background: var(--panel); border: 1px solid var(--rule-soft); border-radius: 5px;
  padding: 1.2rem 1.35rem; margin: 1.6rem 0; max-width: 46rem;
}
.theorem .name {
  font-family: var(--font-mono); font-size:.62rem; letter-spacing:.15em;
  text-transform: uppercase; color: var(--second); font-weight: 500;
  display: block; margin-bottom: .45rem;
}
.theorem .statement {
  font-family: var(--font-display); font-variation-settings: var(--wonk);
  font-weight: 700; font-size: 1.24rem; color: var(--ink); margin: 0 0 .3rem;
}
.theorem .statement em, .theorem .statement strong,
.theorem .statement mark { color: var(--highlight); font-style: normal; background: transparent; }
.theorem .proof { font-size: .91rem; color: var(--faint); margin: 0; }

/* ----------------------------------------------------------- link lists */
/* One hairline BETWEEN rows only. No rule above the first or below the
   last — that was the ledger. */
.links { list-style: none; margin: 0 0 1.4rem; padding: 0; max-width: 44rem; }
.links li {
  padding: .9rem 0 .95rem; display: flex; gap: 1rem;
  align-items: baseline; flex-wrap: wrap;
}
.links li + li { border-top: 1px solid var(--rule-soft); }
.links .kind {
  font-family: var(--font-mono); font-size:.58rem; letter-spacing:.12em;
  text-transform: uppercase; color: var(--faint); flex: 0 0 4.8rem;
}
.links .what { flex: 1 1 15rem; color: var(--ink); }
.links .note { color: var(--faint); font-size: .91rem; flex: 1 1 100%; }

/* --------------------------------------------------------------- people */
.people { display: grid; grid-template-columns: repeat(auto-fit, minmax(19rem,1fr)); gap: 1.8rem 2.6rem; }
.person { max-width: 34rem; }
.person h3 { margin-bottom: .35rem; }
.person .rel {
  font-family: var(--font-mono); font-size:.62rem; letter-spacing:.14em;
  text-transform: uppercase; color: var(--second); font-weight: 500;
  display: block; margin-bottom: .55rem;
}
.person p { font-size: .96rem; }

/* --------------------------------------------------------------- figure */
.fig { margin: 2rem 0; max-width: 46rem; }
.fig img { border: 1px solid var(--rule); border-radius: 4px; }
.fig figcaption {
  font-family: var(--font-mono); font-size:.63rem; letter-spacing:.08em;
  color: var(--faint); margin-top: .7rem; line-height: 1.7;
}

/* An animated figure. Deliberately left at its native 560px rather than
   stretched to fill the 46rem figure column: the speech bubbles carry 13px
   text, and upscaling a GIF softens exactly the thing you are meant to read.
   Slightly more air above and below than a still, since it moves. */
.fig.anim { max-width: 560px; margin: 2.2rem 0 2.6rem; }
.fig.anim img { border-radius: 5px; }

/* -------------------------------------------------------------- details */
details { padding: .9rem 0; max-width: 46rem; }
details + details { border-top: 1px solid var(--rule-soft); }
details > summary {
  cursor: pointer; font-family: var(--font-mono); font-size:.72rem;
  letter-spacing:.12em; text-transform: uppercase; color: var(--body); list-style: none;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "+ "; color: var(--accent); }
details[open] > summary::before { content: "– "; }
details > summary:hover { color: var(--ink); }
details .body { padding-top: 1rem; }

/* --------------------------------------------------------------- footer */
.foot { margin-top: 2.4rem; padding: 2.6rem 0 4rem; font-size: .93rem; }
.foot .contact { font-family: var(--font-mono); font-size:.82rem; letter-spacing:.04em; color: var(--ink); }
.foot .fine {
  font-family: var(--font-mono); font-size:.61rem; letter-spacing:.1em;
  text-transform: uppercase; color: var(--faint); margin-top: 1.6rem;
}

/* ---------------------------------------------------------- small print */
@media (max-width: 46rem) {
  .hero { padding-top: 2.8rem; }
  .portrait { position: static; }
  .links .kind { flex: 0 0 100%; }
  .timeline li { padding-left: 0; padding-top: 1.4rem; }
  .timeline .yr { position: static; display: block; margin-bottom: .3rem; }
}
