/* =============================================================
   TRTN - composed site · base, invariants, components
   The tokens below are the baked (no-JS) theme. The engine rewrites
   them on :root for every composition; nothing else is hard-coded.

   Invariants - the parts that never move, so variety reads as
   authored rather than broken:
     · the TRTN mark geometry
     · section order, numbering 01–05 and their eyebrows
     · the copy
     · the composer and the colophon
   ============================================================= */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body, h1, h2, h3, p, ol, ul, figure, dl, dd { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }

:root {
  /* colour - overwritten by the engine */
  --bg: #f3f0e8;
  --surface: #e8e3d8;
  --fg: #1a1813;
  --mute: #5c584f;
  --accent: #a8361f;
  --on-accent: #fffaf5;
  --duo-dark: #1e1b15;
  --duo-light: #f1d9cc;
  --scheme: light;

  /* type - overwritten by the engine */
  --f-display: ui-serif, "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --f-text: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  --d-weight: 500;
  --d-stretch: 100%;
  --d-style: normal;
  --d-case: none;
  --d-track: -0.02em;
  --d-lead: 1;
  --d-scale: 1;
  --d-axes: normal;
  --t-adj: 1;
  --m-adj: 1;

  /* space & texture - overwritten by the engine */
  --density: 1;
  --grain: 0;
  --radius: 0px;
  --rule-w: 1px;
  --rule-style: solid;

  /* constants */
  --gutter: clamp(16px, 4vw, 56px);
  --gap: clamp(14px, 2.2vw, 32px);
  --ease: cubic-bezier(.2, .7, .15, 1);
  --topbar-h: 3.5rem;
}

/* Derived tokens are recomputed on every scope (header, sections, interludes, colophon), so a
   scope can carry its own composition - drift mode does exactly that. In normal mode every scope
   inherits the same base tokens and computes the same values. */
:root,
[data-scope] {
  --sec-pad: calc(clamp(4rem, 10vw, 9rem) * var(--density));
  --t-display: calc(clamp(2rem, 5.4vw, 5rem) * var(--d-scale));
  --t-mega: calc(clamp(2.6rem, 10.5vw, 10.5rem) * var(--d-scale));
  --t-big: calc(clamp(1.6rem, 3.2vw, 2.8rem) * var(--d-scale));
  --t-body: calc(1.0625rem * var(--t-adj));
  --t-lede: calc(clamp(1.1rem, 1.5vw, 1.35rem) * var(--t-adj));
  --t-mono: calc(0.75rem * var(--m-adj));
  --radius-panel: min(var(--radius), 28px);
  --radius-chip: var(--radius);
  --rule-color: color-mix(in srgb, var(--fg) var(--rule-mix, 22%), transparent);
}
[data-scope] { color: var(--fg); font-family: var(--f-text); font-size: var(--t-body); }

/* rules - one stroke vocabulary for the whole page */
[data-rules="none"]   { --rule-w: 0px; }
[data-rules="hair"]   { --rule-w: 1px; }
[data-rules="heavy"]  { --rule-w: 3px; --rule-mix: 100%; }
[data-rules="dashed"] { --rule-w: 1.5px; --rule-style: dashed; --rule-mix: 45%; }
[data-rules="double"] { --rule-w: 4px; --rule-style: double; --rule-mix: 55%; }

/* surfaces - what a "panel" is in this composition (recomputed per scope, like the tokens) */
[data-surface="flat"], [data-surface="flat"] [data-scope] { --panel-bg: var(--surface); --panel-border: 0 solid transparent; --panel-shadow: none; --panel-blur: none; }
[data-surface="outline"], [data-surface="outline"] [data-scope] { --panel-bg: transparent; --panel-border: 1.5px solid var(--fg); --panel-shadow: none; --panel-blur: none; }
[data-surface="hard"], [data-surface="hard"] [data-scope]    { --panel-bg: var(--surface); --panel-border: 2px solid var(--fg); --panel-shadow: 6px 6px 0 var(--fg); --panel-blur: none; }
[data-surface="soft"], [data-surface="soft"] [data-scope]    { --panel-bg: var(--surface); --panel-border: 0 solid transparent; --panel-shadow: 0 1px 2px rgb(0 0 0 / .06), 0 18px 40px -14px rgb(0 0 0 / .28); --panel-blur: none; }
[data-surface="glass"], [data-surface="glass"] [data-scope]   { --panel-bg: color-mix(in srgb, var(--surface) 55%, transparent); --panel-border: 1px solid color-mix(in srgb, var(--fg) 14%, transparent); --panel-shadow: 0 12px 34px -14px rgb(0 0 0 / .25); --panel-blur: blur(16px) saturate(1.4); }

html {
  background: var(--bg);
  color: var(--fg);
  color-scheme: var(--scheme);
  scroll-behavior: smooth;
  scroll-padding-top: var(--topbar-h);
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--f-text);
  font-size: var(--t-body);
  line-height: 1.55;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding-bottom: 8rem; /* room under the composer */
  overflow-x: clip;
  transition: opacity .5s var(--ease);
}

/* Hold first paint until the first composition lands (fonts + tokens), never longer than ~2.4s. */
.composing body { opacity: 0; animation: failsafe 0s 2.4s forwards; }
@keyframes failsafe { to { opacity: 1; } }

::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.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;
}
.skip {
  position: absolute; left: var(--gutter); top: -100px; z-index: 200;
  background: var(--fg); color: var(--bg); padding: .6rem 1rem; font: 500 var(--t-mono)/1 var(--f-mono);
}
.skip:focus { top: 12px; }

/* ---------- grain + frame (texture, viewport-fixed) ---------- */

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 120;
  pointer-events: none;
  opacity: var(--grain);
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='.33 .33 .33 0 0 .33 .33 .33 0 0 .33 .33 .33 0 0 0 0 0 0 1'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
[data-tone="dark"] body::after { mix-blend-mode: soft-light; opacity: calc(var(--grain) * 1.6); }

[data-frame="on"] body::before {
  content: "";
  position: fixed;
  inset: 6px;
  z-index: 110;
  pointer-events: none;
  border: max(1px, var(--rule-w)) var(--rule-style) var(--fg);
  border-radius: min(var(--radius), 24px);
}

/* ---------- topbar (invariant) ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 var(--gutter);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  border-bottom: var(--rule-w) var(--rule-style) var(--rule-color);
}
[data-frame="on"] .topbar { top: 6px; margin: 6px 6px 0; }
.topbar-mark svg { height: 16px; width: auto; fill: var(--fg); }
.topbar-nav { display: flex; gap: clamp(.75rem, 2vw, 1.75rem); }
.topbar-nav a {
  font-family: var(--f-mono);
  font-size: var(--t-mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--mute);
  white-space: nowrap;
}
.topbar-nav a:hover { color: var(--fg); }
.topbar-nav .num { color: var(--accent); }
@media (max-width: 720px) {
  .topbar-nav .lbl { display: none; }
  .topbar-nav { gap: .9rem; }
}

/* ---------- type roles ---------- */

.display,
.criterion-title,
.specialty-name,
.brand-name,
.col-title {
  font-family: var(--f-display);
  font-weight: var(--d-weight);
  font-stretch: var(--d-stretch);
  font-style: var(--d-style);
  font-variation-settings: var(--d-axes);
  text-transform: var(--d-case);
  letter-spacing: var(--d-track);
  line-height: var(--d-lead);
  font-optical-sizing: auto;
}
.display {
  font-size: var(--t-display);
  text-wrap: balance;
  overflow-wrap: break-word;
  hyphens: manual;
}

.lede {
  font-size: var(--t-lede);
  line-height: 1.5;
  max-width: 44ch;
  text-wrap: pretty;
}

.sec-head,
.col-readout,
.fig-cap,
.criterion-num,
.specialty-mark,
.specialty-detail,
.industries-label,
.industries-list li,
.brand-id,
.brand-tag,
.bridge,
.colophon dt,
.col-small,
.foot-row {
  font-family: var(--f-mono);
  font-size: var(--t-mono);
  letter-spacing: .04em;
  line-height: 1.45;
}

/* <em> treatments in display type */
[data-em="italic"] :is(.display, .col-title) em { font-style: italic; }
[data-em="accent"] :is(.display, .col-title) em { font-style: inherit; color: var(--accent); }
/* Decorations don't reach into inline-blocks, so the words split by motion.js need their own
   underline; the em's own one still runs under the spaces between them. */
[data-em="underline"] :is(.display, .col-title) :is(em, em .w > span) {
  font-style: inherit;
  text-decoration: underline;
  text-decoration-thickness: max(2px, .07em);
  text-underline-offset: .14em;
  text-decoration-color: var(--accent);
  text-decoration-skip-ink: none;
}
[data-em="highlight"] :is(.display, .col-title) em {
  font-style: inherit;
  background: var(--accent);
  color: var(--on-accent);
  padding: 0 .12em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
/* Inline backgrounds paint line by line, so each highlighted row would cover the descenders
   of the row above it. Positioned words (split by motion.js) paint after every background. */
[data-em="highlight"] .display { isolation: isolate; }
[data-em="highlight"] .display .w { position: relative; }

/* ink - print effects on display type */
[data-ink="offset"] .display { text-shadow: .045em .035em 0 color-mix(in srgb, var(--accent) 65%, transparent); }
[data-ink="glow"] .display { text-shadow: 0 0 .4em color-mix(in srgb, var(--accent) 50%, transparent); }

/* ---------- sections (invariant frame) ---------- */

.sec {
  padding: var(--sec-pad) var(--gutter);
  border-top: var(--rule-w) var(--rule-style) var(--rule-color);
}
.sec-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: clamp(1.5rem, 4vw, 3rem);
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--mute);
}
.sec-num { color: var(--accent); }
.sec-body { position: relative; }

/* ---------- header (arrangements live in css/variants.css, HEADER) ---------- */

.hero {
  position: relative;
  overflow-x: clip; /* primitives fly in and out of their box */
  padding: clamp(1.25rem, 4vw, 3rem) var(--gutter) clamp(2.5rem, 6vw, 5rem);
}
@media (max-width: 700px) {
  /* clear the composer, and fit the first screen exactly */
  .hero { padding-bottom: 6.5rem; }
  .hero .hero-stage { min-height: calc(100svh - var(--topbar-h) - 8.25rem); }
}
.hero-stage {
  position: relative;
  z-index: 1;
  display: grid;
  gap: clamp(1.25rem, 3vw, 2.5rem);
  align-content: end;
  min-height: calc(100svh - var(--topbar-h) - clamp(3.75rem, 10vw, 8rem));
}
.hero-mark { position: relative; }
.hero-mark .mark { width: 100%; height: auto; fill: var(--fg); }
.hero[data-layout="block"] .hero-mark .mark { width: min(100%, calc(66svh * var(--mark-ar, .79))); }
.hero-tag { font-size: var(--t-big); line-height: calc(var(--d-lead) * 1.08); max-width: 24ch; }
.hero-guides, .hero-field, .fig--hero { display: none; }

.mark { fill: currentColor; }

/* ---------- figures ---------- */

.fig { position: relative; min-width: 0; }
html:not(.js) .fig { display: none; }
.fig-media {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  aspect-ratio: 4 / 3;
  background: var(--ph, var(--surface));
  border-radius: var(--fig-radius, 0);
}
.fig-ph,
.fig-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.fig-ph { background-size: cover; background-position: center; transform: scale(1.06); transition: opacity .7s var(--ease); }
/* Once the photo is in, the placeholder must go: blend modes would otherwise mix against it. */
.fig-media:has(img.is-loaded) .fig-ph { opacity: 0; }
.fig-media img { object-fit: cover; opacity: 0; transition: opacity .7s var(--ease); }
.fig-media img.is-loaded { opacity: 1; }
.fig.is-empty .fig-media {
  background:
    repeating-linear-gradient(-45deg, transparent 0 10px, color-mix(in srgb, var(--fg) 8%, transparent) 10px 11px),
    var(--surface);
}
.fig-cap {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  margin-top: .6rem;
  color: var(--mute);
}
.fig-n { color: var(--accent); text-decoration: none; text-underline-offset: .2em; }
a.fig-n[href]:hover { text-decoration: underline; }
/* The note only speaks up when a photograph couldn't be placed; credits live in the colophon. */
.fig-note:empty { display: none; }

/* treatments */
:is([data-treatment="mono"], [data-treatment="duotone"], [data-treatment="tint"]) :is(.fig-media img, .fig-ph) {
  filter: grayscale(1) contrast(1.1);
}
[data-treatment="duotone"] .fig-media { background: var(--duo-light); }
[data-treatment="duotone"] .fig-media img { mix-blend-mode: multiply; filter: grayscale(1) contrast(1.15) brightness(1.06); }
[data-treatment="duotone"] .fig-media::after {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: var(--duo-dark); mix-blend-mode: lighten;
}
[data-treatment="tint"] .fig-media::after {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: var(--accent); mix-blend-mode: color; opacity: .9;
}
[data-treatment="duotone"] .fig-media:has(img:not(.is-loaded))::after { opacity: 0; }

/* ---------- bridge (thesis) ---------- */

.bridge {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  margin-top: clamp(2rem, 5vw, 3.5rem);
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--mute);
}
.bridge-end { white-space: nowrap; padding-bottom: .1rem; }
.bridge-end:last-child { color: var(--fg); }
.bridge-track { position: relative; flex: 1; height: 44px; }
.bridge-deck {
  position: absolute; left: 0; right: 0; top: 16px;
  border-top: max(2px, var(--rule-w)) solid var(--fg);
}
.bridge-pillars { position: absolute; left: 6%; right: 6%; top: 16px; bottom: 0; display: flex; justify-content: space-between; }
.bridge-pillars i { width: max(1px, calc(var(--rule-w) * .7)); background: var(--rule-color); }
[data-rules="none"] .bridge-pillars i { width: 1px; background: color-mix(in srgb, var(--fg) 25%, transparent); }
.bridge-marker {
  position: absolute; left: 62%; top: 16px; bottom: 0;
  border-left: 2px solid var(--accent);
}
.bridge-tag {
  position: absolute; bottom: calc(100% + 34px); left: 0; transform: translateX(-50%);
  white-space: nowrap; color: var(--accent);
}
.bridge-marker::before {
  content: ""; position: absolute; top: -5px; left: -6px; width: 10px; height: 10px;
  background: var(--accent); border-radius: var(--radius-chip);
}
@media (max-width: 560px) {
  .bridge { flex-wrap: wrap; }
  .bridge-track { flex-basis: 100%; order: 2; margin-top: 2.4rem; }
  .bridge-end:last-child { order: 3; margin-left: auto; }
}

/* ---------- vetting / specialties / work / contact - shared bits ---------- */

.criterion-num { color: var(--accent); }
.criterion-title { font-size: calc(clamp(1.35rem, 2.2vw, 1.9rem) * var(--d-scale)); }
.criterion-body { color: var(--fg); max-width: 40ch; }

.specialty-mark { color: var(--accent); }
.specialty-name { font-size: calc(clamp(1.4rem, 2.4vw, 2.2rem) * var(--d-scale)); }
.specialty-detail { color: var(--mute); }

.industries { margin-top: clamp(2rem, 5vw, 3.5rem); display: grid; gap: .9rem; }
.industries-label { text-transform: uppercase; letter-spacing: .1em; color: var(--mute); }
.industries-list { display: flex; flex-wrap: wrap; gap: .5rem; }
.industries-list li {
  padding: .45em .9em;
  border: max(1px, min(var(--rule-w), 2px)) var(--rule-style) color-mix(in srgb, var(--fg) 40%, transparent);
  border-radius: var(--radius-chip);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.brand-id, .brand-tag { color: var(--mute); }
.brand-id { color: var(--accent); }
.brand-name { font-size: calc(clamp(1.2rem, 2vw, 1.7rem) * var(--d-scale)); }

.contact-cta { margin-top: clamp(1.5rem, 4vw, 2.5rem); min-width: 0; }
.contact-link {
  display: inline-flex;
  align-items: center;
  gap: .35em;
  font-family: var(--f-display);
  font-weight: var(--d-weight);
  font-stretch: var(--d-stretch);
  font-style: var(--d-style);
  font-variation-settings: var(--d-axes);
  letter-spacing: var(--d-track);
  font-size: var(--t-big);
  line-height: 1.1;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: max(2px, .06em) solid currentColor;
  padding-bottom: .08em;
}
.contact-link svg { width: .9em; height: auto; flex: none; transition: transform .3s var(--ease); }
.contact-link:hover svg { transform: translateX(.15em); }

/* ---------- partners: every company carries its own words ---------- */

.brand[data-partner] { cursor: pointer; }
.brand.is-partner .brand-name { color: var(--accent); }
.brand-word {
  display: inline-flex;
  align-items: center;
  gap: .5em;
  justify-self: start;
  align-self: start;
  width: max-content;
  padding: .32em .7em .32em .45em;
  border: 1px solid color-mix(in srgb, var(--fg) 30%, transparent);
  border-radius: var(--radius-chip);
  background: transparent;
  color: var(--fg);
  font-family: var(--f-mono);
  font-size: var(--t-mono);
  font-style: normal;
  letter-spacing: .04em;
  text-transform: lowercase;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s;
}
.brand-word[hidden] { display: none; }
.brand-word::before {
  content: "";
  flex: none;
  width: 1em;
  height: 1em;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sw-a) 50%, var(--sw-b) 50%);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--fg) 28%, transparent);
}
.brand:hover .brand-word,
.brand-word[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.s-work[data-variant="roll"] .brand-word { justify-self: center; margin-top: .35rem; }
.s-work[data-variant="runon"] .brand-word { vertical-align: .45em; margin-inline: .45em .1em; }
.s-work[data-variant="grid"] .brand { grid-template-rows: auto 1fr auto auto; }

/* ---------- drift: which word each section is right now ---------- */

.drift-tag {
  position: absolute;
  top: .75rem;
  right: var(--gutter);
  z-index: 6;
  padding: .35rem .55rem;
  border-radius: min(var(--radius-chip), 8px);
  background: var(--fg);
  color: var(--bg);
  font: 500 var(--t-mono)/1 var(--f-mono);
  letter-spacing: .08em;
  text-transform: lowercase;
  pointer-events: none;
}
html.drifting main [data-scope] { position: relative; background-color: var(--bg); }
.c-drift[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

/* ---------- colophon (invariant) ---------- */

.colophon {
  padding: var(--sec-pad) var(--gutter) clamp(2rem, 5vw, 3rem);
  border-top: var(--rule-w) var(--rule-style) var(--rule-color);
  background: var(--surface);
}
.col-readout {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem 1.6rem;
  padding-bottom: 1.1rem;
  margin-bottom: clamp(1.75rem, 4vw, 2.75rem);
  border-bottom: var(--rule-w) var(--rule-style) var(--rule-color);
  color: var(--mute);
  text-transform: lowercase;
}
.col-readout .ro span::after { content: " /"; }
.col-readout b { font-weight: 500; color: var(--fg); }
.col-title { font-size: var(--t-big); margin-bottom: clamp(1.5rem, 4vw, 2.5rem); }
.col-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: clamp(1.25rem, 3vw, 2.25rem) var(--gap);
}
.col-item { min-width: 0; display: grid; gap: .45rem; align-content: start; }
.col-item--wide { grid-column: span 2; }
.col-item--full { grid-column: 1 / -1; }
@media (max-width: 720px) { .col-item--wide { grid-column: 1 / -1; } }
.colophon dt { text-transform: uppercase; letter-spacing: .1em; color: var(--mute); }
.colophon dd { min-width: 0; overflow-wrap: anywhere; }
.col-face { font-size: 1.35rem; line-height: 1.2; }
.col-face--display {
  font-family: var(--f-display); font-weight: var(--d-weight); font-stretch: var(--d-stretch);
  font-style: var(--d-style); font-variation-settings: var(--d-axes); letter-spacing: var(--d-track);
}
.col-face--text { font-family: var(--f-text); }
.col-face--mono { font-family: var(--f-mono); font-size: calc(1.1rem * var(--m-adj)); }
.col-small { color: var(--fg); }
#col-seed { display: grid; gap: .35rem; }
.col-word { display: grid; grid-template-columns: 7.5rem 1fr 2.5rem; align-items: center; gap: .6rem; font-family: var(--f-mono); font-size: var(--t-mono); }
.col-word b { font-weight: 500; font-size: 1.1em; }
.col-bar { height: 6px; background: color-mix(in srgb, var(--fg) 12%, transparent); position: relative; border-radius: var(--radius-chip); overflow: hidden; }
.col-bar::after { content: ""; position: absolute; inset: 0 auto 0 0; width: calc(var(--w) * 100%); background: var(--accent); }
.col-pct { text-align: right; color: var(--mute); }
.col-note { font-family: var(--f-mono); font-size: var(--t-mono); color: var(--mute); }
.col-swatches { display: flex; flex-wrap: wrap; gap: .5rem 1.1rem; margin-bottom: .4rem; }
.col-swatches li { display: flex; align-items: center; gap: .45rem; font-family: var(--f-mono); font-size: var(--t-mono); }
.col-swatches .sw { width: 1.4rem; height: 1.4rem; border: 1px solid color-mix(in srgb, var(--fg) 30%, transparent); border-radius: min(var(--radius-chip), 6px); }
.col-swatches code { color: var(--mute); font-family: inherit; }
.col-photos { display: grid; gap: .45rem; font-family: var(--f-mono); font-size: var(--t-mono); }
.col-photos a { text-decoration: underline; text-underline-offset: .2em; }
/* Arrived from a caption's fig.0n: mark the line it points to. */
.col-photos li:target {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  box-shadow: 0 0 0 .35rem color-mix(in srgb, var(--accent) 16%, transparent);
}
.col-fig { color: var(--accent); }
.col-alt { color: var(--mute); }
.col-link { font-family: var(--f-mono); font-size: var(--t-mono); color: var(--accent); overflow-wrap: anywhere; }
.foot-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .5rem 1.5rem;
  margin-top: clamp(2.5rem, 6vw, 4rem);
  padding-top: 1rem;
  border-top: var(--rule-w) var(--rule-style) var(--rule-color);
  color: var(--mute);
  text-transform: uppercase;
  letter-spacing: .1em;
}
.foot-mark { color: var(--fg); font-weight: 600; }

/* ---------- composer (invariant) ---------- */

.composer {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  /* On rounder bars the field chips sit further in, so their corners run parallel to the bar's:
     the bar's radius, less a chip's (half its 2.5em height), less the bar's 5px padding.
     The bar widens by the same, so the fields keep their room. */
  --fields-inset: max(0px, min(var(--radius-chip), 30px) - min(var(--radius-chip), 1.25em) - 5px);
  width: min(640px + 2 * var(--fields-inset), 100vw - 32px);
  transform: translateX(-50%);
  font-family: var(--f-mono);
  font-size: calc(.8125rem * var(--m-adj));
  transition: width .45s var(--ease);
}
.composer-bar {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 2px;
  padding: 5px;
  background: var(--fg);
  color: var(--bg);
  border-radius: min(var(--radius-chip), 30px);
  box-shadow: 0 10px 30px -10px rgb(0 0 0 / .45);
  transition: gap .45s var(--ease);
}
/* Fields sit on top of the bar, always visible; collapsing folds the row away (1fr → 0fr). */
.composer-fields {
  grid-column: 1 / -1;
  display: grid;
  grid-template-rows: 1fr;
  margin: var(--fields-inset) var(--fields-inset) 0;
  container-type: inline-size;
  transition: grid-template-rows .45s var(--ease), margin .45s var(--ease), opacity .3s;
}
.c-chips--bar { min-height: 0; overflow: hidden; }
/* Every row of fields spans the bar: chips share the leftover width. */
.c-chips--bar > li { flex: auto; display: flex; }
.c-chips--bar .chip { flex: 1; --chip-ink: var(--bg); }
/* The six fields need 36.6-38.5rem on one row across every composer font; narrower, they split
   evenly three to a row instead of stranding one chip on a row of its own. */
@container (width < 38.75rem) {
  .c-chips--bar > li { flex-basis: 30%; }
}
.c-chips--bar .chip:focus-visible { outline-color: var(--bg); outline-offset: -3px; }
.composer-tools {
  position: relative;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  overflow: hidden;
  transition: opacity .3s;
}
/* Collapsed, the bar tucks into its fold button: 42px + the bar's 5px padding either side. */
.composer.is-collapsed { width: 52px; }
.composer.is-collapsed .composer-bar { gap: 0; }
.composer.is-collapsed .composer-tools { opacity: 0; }
.composer.is-collapsed .composer-fields { grid-template-rows: 0fr; margin: 0; opacity: 0; }
.composer.is-collapsed .c-chips--bar { flex-wrap: nowrap; }
.composer.is-collapsed .composer-status { display: none; }
.c-title {
  flex: none;
  align-self: stretch;
  display: flex;
  align-items: center;
  padding: 0 .9rem 0 .7rem;
  margin-right: 2px;
  border-right: 1px solid color-mix(in srgb, var(--bg) 22%, transparent);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: calc(.75rem * var(--m-adj));
  white-space: nowrap;
  cursor: text;
}
/* On narrow screens the title becomes a tab sitting on the bar's top-left edge. */
@media (max-width: 560px) {
  .c-title {
    position: absolute;
    left: 12px;
    bottom: calc(100% - 1px);
    padding: .4rem .7rem .3rem;
    margin: 0;
    border: 0;
    background: var(--fg);
    color: var(--bg);
    border-radius: min(var(--radius-chip), 10px) min(var(--radius-chip), 10px) 0 0;
    font-size: calc(.625rem * var(--m-adj));
  }
  .composer-status { bottom: calc(100% + 34px); }
  .composer-panel { bottom: calc(100% + 30px); }
}
.c-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-width: 42px;
  height: 42px;
  padding: 0 .65rem;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: min(var(--radius-chip), 24px);
  text-transform: lowercase;
  letter-spacing: .04em;
}
.c-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.c-btn:hover, .c-words[aria-expanded="true"] { background: color-mix(in srgb, var(--bg) 16%, transparent); }
.c-words { flex: 1; justify-content: flex-start; text-transform: none; }
.c-btn:focus-visible { outline-color: var(--bg); outline-offset: -3px; }
.c-go { background: var(--accent); color: var(--on-accent); }
.c-go:hover { background: color-mix(in srgb, var(--accent) 85%, var(--bg)); }
/* fold: inward chevrons collapse the bar; collapsed, they turn outward to expand it */
.c-fold { position: relative; width: 42px; min-width: 42px; padding: 0; }
.c-fold::before {
  content: "";
  position: absolute;
  left: -2px;
  top: 11px;
  bottom: 11px;
  width: 1px;
  background: color-mix(in srgb, var(--bg) 22%, transparent);
  transition: opacity .3s;
}
.c-fold path { transform-box: fill-box; transform-origin: center; transition: rotate .45s var(--ease); }
.composer.is-collapsed .c-fold::before { opacity: 0; }
.composer.is-collapsed .c-fold path { rotate: 180deg; }
.c-input {
  flex: 1;
  min-width: 0;
  padding: .4em .8em; /* a .chip's text box */
  border: 0;
  background: transparent;
  color: var(--fg);
  letter-spacing: .02em;
}
.c-input::placeholder { color: var(--mute); }
.c-input:focus { outline: none; }

.composer-status {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translate(-50%, 6px);
  max-width: 100%;
  width: max-content;
  padding: .45rem .8rem;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid color-mix(in srgb, var(--fg) 25%, transparent);
  border-radius: min(var(--radius-chip), 18px);
  font-size: calc(.75rem * var(--m-adj));
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s var(--ease);
  overflow-wrap: anywhere;
}
.composer-status.is-on { opacity: 1; transform: translate(-50%, 0); }
.composer.is-open .composer-status { display: none; }

/* The tip: a callout over the folded bar, its caret on the fold, in the bar's own colours (some
   sections are painted in the accent, so an accent tip can vanish). js/composer.js unhides it;
   css/motion.css bounces it with `transform` and `scale`, so the centring here uses `translate`. */
.composer-tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 14px);
  translate: -50% 0;
  transform-origin: 50% 100%;
  width: max-content;
  padding: .55rem .9rem;
  background: var(--fg);
  color: var(--bg);
  border-radius: min(var(--radius-chip), 18px);
  box-shadow: 0 10px 30px -10px rgb(0 0 0 / .45);
  font-size: calc(.75rem * var(--m-adj));
  font-weight: 700;
  letter-spacing: .04em;
  cursor: pointer;
}
.composer-tip::after {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(100% - 1px);
  width: 14px;
  height: 8px;
  translate: -50% 0;
  background: inherit;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.composer-tip:hover { background: color-mix(in srgb, var(--bg) 16%, var(--fg)); }

.composer-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 10px);
  display: flex;
  flex-direction: column;
  max-height: min(62vh, 560px);
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  border: 1.5px solid var(--fg);
  border-radius: min(var(--radius-chip), 22px);
  box-shadow: 0 18px 50px -18px rgb(0 0 0 / .45);
}
.composer-panel[hidden] { display: none; }
/* The word list scrolls; the input stays pinned to the bottom of the menu. */
.composer-scroll { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 1rem 1rem .9rem; }
.composer-type { flex: none; padding: .75rem 1rem .9rem; border-top: 1px solid color-mix(in srgb, var(--fg) 18%, transparent); }
/* Sized like a word chip; the go button fills the right end. */
.c-field {
  display: flex;
  border: 1px solid var(--fg);
  border-radius: min(var(--radius-chip), 999px);
  overflow: hidden;
}
.c-field .c-go { height: auto; min-width: 0; padding: 0 .8em; border-radius: 0; }
.c-field .c-go svg { width: 1.2em; height: 1.2em; }
.c-field:focus-within { box-shadow: 0 0 0 2px var(--accent); }
.c-field .c-go:focus-visible { outline-color: var(--on-accent); }
.composer-said { display: none; margin-top: .55rem; color: var(--mute); font-size: calc(.6875rem * var(--m-adj)); overflow-wrap: anywhere; }
.composer-said.is-on { display: block; }
.composer-panel-head { color: var(--mute); margin-bottom: .8rem; }
.composer-groups { display: grid; gap: .85rem; }
.c-group { display: grid; grid-template-columns: 8.5rem 1fr; gap: .5rem; align-items: start; }
@media (max-width: 560px) { .c-group { grid-template-columns: 1fr; gap: .35rem; } }
.c-group-label { font: inherit; font-size: calc(.6875rem * var(--m-adj)); text-transform: uppercase; letter-spacing: .1em; color: var(--mute); padding-top: .45rem; }
.c-chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip {
  padding: .4em .8em;
  border: 1px solid color-mix(in srgb, var(--chip-ink, var(--fg)) 30%, transparent);
  background: transparent;
  border-radius: min(var(--radius-chip), 999px);
  cursor: pointer;
  letter-spacing: .02em;
}
.chip:hover { border-color: var(--chip-ink, var(--fg)); }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

@media (max-width: 480px) {
  .c-btn:not(.c-fold, .c-words) { min-width: 33px; padding: 0; }
  .composer-scroll, .composer-type { padding-inline: .8rem; }
}

/* Motion (entrances, transitions, scroll effects) lives in css/motion.css. */
