/*
 * In The Liners, the record of it.
 *
 * Built from DESIGN.md: four colors (paper, ink, muted, accent), two faces (a
 * serif for anything a person wrote, a sans for everything else), and the scale
 * 0.75 / 0.875 / 1 / 1.25 / 1.75 / 2.5rem. The one exception is the display size,
 * which grows past 2.5rem on wide screens because this page is about scale
 * contrast: one thing enormous, everything else small and letterspaced.
 *
 * The accent appears once per screen at most, on the single action in a demo.
 * Photographs are pre-printed into ink and paper by the same ImageMagick
 * treatment the product used (scripts/treat-images.ts), so no image here is a
 * colour photograph sitting on cream.
 */

@font-face {
  font-family: "Instrument Serif";
  src: url("/fonts/InstrumentSerif-normal-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("/fonts/InstrumentSerif-italic-400.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Geist";
  src: url("/fonts/Geist-normal-400.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f4f1ea;
  --ink: #0e0e0c;
  --muted: #6b665c;
  --accent: #a8431f;
  --rule: rgba(14, 14, 12, 0.14);
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Geist", ui-sans-serif, -apple-system, "Segoe UI", system-ui, sans-serif;
  --gutter: clamp(1.25rem, 5vw, 4rem);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: light; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; height: auto; }
figure { margin: 0; }
p { margin: 0 0 1.25rem; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.wrap { width: 100%; max-width: 76rem; margin-inline: auto; padding-inline: var(--gutter); }
.measure { max-width: 34rem; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; line-height: 1.55; }

.eyebrow {
  font-size: 0.75rem;
  line-height: 1.4;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
}

.display {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.5rem, 7.2vw, 5.75rem);
  line-height: 1.02;
  letter-spacing: -0.01em;
  margin: 0 0 1.75rem;
  text-wrap: balance;
}
.display--quiet { font-size: clamp(2.5rem, 5.2vw, 4rem); line-height: 1.08; }

.headline {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.75rem, 3.4vw, 2.5rem);
  line-height: 1.12;
  margin: 0 0 1.5rem;
  text-wrap: balance;
}

.lede { font-size: 1.25rem; line-height: 1.5; max-width: 32rem; }

/* ---------- top ---------- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 1.5rem;
}
.top__mark { width: 6.5rem; }
.top__meta { margin: 0; }

/* ---------- hero ---------- */
.hero {
  display: grid;
  gap: 2.5rem;
  padding-block: 2rem 5rem;
  align-items: end;
}
.hero__plate { max-width: 24rem; justify-self: end; width: 72%; }
@media (min-width: 52rem) {
  .hero { grid-template-columns: 1.35fr 1fr; gap: 4rem; padding-block: 3rem 8rem; min-height: min(52rem, 88vh); }
  .hero__plate { width: 100%; max-width: 26rem; align-self: center; }
}

/* ---------- split ---------- */
.split {
  display: grid;
  gap: 2.5rem;
  padding-block: 4rem;
  align-items: center;
}
.split__plate { max-width: 30rem; }
@media (min-width: 52rem) {
  .split { grid-template-columns: 1fr 1fr; gap: 5rem; padding-block: 7rem; }
  .split--flip .measure { order: 0; }
}

/* ---------- attachment ---------- */
.attach { padding-block: 4rem; }
.pair { display: grid; gap: 1.25rem; margin-top: 3rem; }
@media (min-width: 52rem) {
  .attach { padding-block: 7rem; }
  .pair { grid-template-columns: 1.2fr 1fr; gap: 2rem; margin-top: 4.5rem; align-items: start; }
  .pair__low { margin-top: 6rem; }
}

/* ---------- how it worked ---------- */
.how { padding-block: 4rem; }
@media (min-width: 52rem) { .how { padding-block: 7rem; } }

.rules { list-style: none; margin: 2.5rem 0; padding: 0; max-width: 40rem; }
.how__row { display: grid; gap: 0; }
@media (min-width: 60rem) {
  .how__row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 4.5rem; align-items: start; margin-top: 2.5rem; }
  .how__row .rules { margin: 0; }
  .how__row .demo { margin: 0; }
}
.rule {
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  gap: 0.75rem;
  padding-block: 1.5rem;
  border-top: 1px solid var(--rule);
}
.rule__n { font-size: 0.875rem; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 0.2rem; }
.rule__title { font-family: var(--sans); font-weight: 500; font-size: 1.25rem; line-height: 1.35; margin: 0 0 0.5rem; }
.rule p { margin-bottom: 0.75rem; }
.aside { font-family: var(--serif); font-style: italic; font-size: 1.25rem; }

/* ---------- demos ---------- */
.demo {
  max-width: 40rem;
  margin: 1rem 0 3rem;
  padding: clamp(1.25rem, 4vw, 2.5rem);
  background: #efebe2;
  border: 1px solid var(--rule);
}
.demo__head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 1.5rem; }
.demo__sub { margin-top: 1.75rem; }
.demo__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; margin-top: 1.75rem; }
.demo__hint { margin: 0; }

.note {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 4.4vw, 2.5rem);
  line-height: 1.15;
  margin: 1rem 0 1.5rem;
  min-height: 3.5em;
}
.track { margin: 0; }
.track__title { font-weight: 500; }

.chain { list-style: none; margin: 0; padding: 0; }
.chain li {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding-block: 0.7rem;
  border-top: 1px solid var(--rule);
}
.chain__n { font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; width: 1.5rem; }
.chain__who { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.875rem; min-width: 5rem; }

.btn {
  appearance: none;
  border: 0;
  border-radius: 0;
  background: var(--accent);
  color: var(--paper);
  font: inherit;
  font-size: 1rem;
  padding: 0.85rem 1.75rem;
  cursor: pointer;
  transition: background-color 180ms var(--ease), transform 180ms var(--ease);
}
.btn:hover { background: #8f3819; }
.btn:active { transform: translateY(1px); }
.btn--quiet { background: transparent; color: var(--ink); border: 1px solid var(--ink); }
.btn--quiet:hover { background: var(--ink); color: var(--paper); }

/* The relay list. Rows are rebuilt by site.js on every turn. */
.relay { list-style: none; margin: 1.25rem 0 0; padding: 0; }
.relay li {
  display: grid;
  grid-template-columns: 1.75rem 1fr;
  gap: 0 0.75rem;
  padding-block: 0.8rem;
  border-top: 1px solid var(--rule);
}
.relay__n { font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 0.2rem; }
.relay__who { font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.relay__who--known { color: var(--ink); }
.relay__song { font-size: 0.875rem; }
.relay__song b { font-weight: 500; }
.relay__note { font-family: var(--serif); font-size: 1.25rem; line-height: 1.25; margin: 0.35rem 0 0; }
.relay__empty { color: var(--rule); letter-spacing: 0.3em; }
.relay li.is-empty { padding-block: 0.45rem; }
.relay__you .relay__who { color: var(--accent); }
.relay li.is-new { animation: settle 520ms var(--ease) both; }

@keyframes settle {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---------- how it looked ---------- */
.looked {
  padding-block: 5rem;
  background: var(--paper) url("/img/ghost.jpg") center / cover no-repeat;
  border-block: 1px solid var(--rule);
}
.prints {
  display: grid;
  gap: 2.5rem;
  margin-top: 3rem;
  justify-items: center;
}
.print { width: 100%; max-width: 20rem; }
.print img {
  background: var(--paper);
  box-shadow: 0 1px 0 var(--rule), 0 18px 40px -24px rgba(14, 14, 12, 0.35);
  transition: transform 320ms var(--ease);
}
.print figcaption { font-size: 0.875rem; color: var(--muted); margin-top: 1rem; }
@media (min-width: 52rem) {
  .looked { padding-block: 8rem; }
  .prints { grid-template-columns: repeat(3, 1fr); gap: 2.5rem; margin-top: 4.5rem; align-items: start; }
  .print:nth-child(1) img { transform: rotate(-1.2deg); }
  .print:nth-child(2) { margin-top: 3.5rem; }
  .print:nth-child(2) img { transform: rotate(0.8deg); }
  .print:nth-child(3) img { transform: rotate(-0.5deg); }
  .print:hover img { transform: none; }
}

/* ---------- full bleed ---------- */
.bleed { position: relative; margin-block: 0; background: var(--ink); }
.bleed img { width: 100%; height: min(78vh, 46rem); object-fit: cover; }
.bleed__line {
  position: absolute;
  inset: auto var(--gutter) clamp(1.5rem, 6vw, 4.5rem);
  max-width: 44rem;
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.75rem, 4.6vw, 3.5rem);
  line-height: 1.08;
  color: var(--paper);
  text-wrap: balance;
}
@media (min-width: 76rem) { .bleed__line { left: calc((100vw - 76rem) / 2 + var(--gutter)); } }

.stack { display: grid; gap: 1.25rem; position: relative; }
.stack__small { width: 55%; justify-self: end; margin-top: -3rem; }
@media (min-width: 52rem) { .stack__small { width: 45%; margin-top: -6rem; margin-right: -1.5rem; } }

/* ---------- what it taught ---------- */
.taught { padding-block: 5rem 6rem; }
.taught .measure { max-width: 44rem; }
.taught p { max-width: 34rem; }
@media (min-width: 52rem) { .taught { padding-block: 9rem; } }

/* ---------- footer ---------- */
.foot { padding-block: 0 3rem; }
.foot__cols { border-top: 1px solid var(--rule); padding-top: 3.5rem; }
.foot__cols { display: grid; gap: 2rem; }
@media (min-width: 52rem) { .foot__cols { grid-template-columns: 1.2fr 1fr; gap: 5rem; } }
.foot__mark { width: min(22rem, 70%); margin-top: 3.5rem; opacity: 0.9; }

/* ---------- motion: only ever caused by the reader ---------- */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 700ms var(--ease), transform 700ms var(--ease);
}
.js [data-reveal].is-in { opacity: 1; transform: none; }

/* A print developing: it arrives as a ghost and comes up to full ink. */
.js [data-develop] {
  opacity: 0.12;
  filter: contrast(0.7);
  transition: opacity 1400ms var(--ease), filter 1400ms var(--ease);
}
.js [data-develop].is-in { opacity: 1; filter: none; }
.bleed img[data-develop] { opacity: 0.35; }
.bleed img[data-develop].is-in { opacity: 0.82; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js [data-reveal], .js [data-develop] { opacity: 1; transform: none; filter: none; }
  .bleed img[data-develop] { opacity: 0.82; }
  .print img { transform: none !important; }
}
