/* Plan View components.
 *
 * Hand-written HTML patterns over the vendored design tokens, reproducing the
 * components in design/ that the site actually uses. The React bundle there is
 * the reference implementation; this is the shipped one. See
 * docs/publishing-plan.md section 1.
 *
 * Every colour, length and face here comes from a token. The plan-view/*
 * stylelint rules enforce that. */

/* ------------------------------------------------------------------ *
 * Sheet and container
 * ------------------------------------------------------------------ */

.sheet {
  position: relative;
  min-height: 100vh;
  padding: 0 var(--space-5) var(--space-8);
  background: var(--bg-page);
  color: var(--text-primary);
}

.container {
  max-width: var(--container);
  margin: 0 auto;
}

/* The 24px grid, hidden until the konami sequence reveals it. */
.grid-overlay {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: none;
  pointer-events: none;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 24px 24px;
}

.grid-overlay[data-visible] {
  display: block;
}

/* ------------------------------------------------------------------ *
 * The mono dimension layer
 * ------------------------------------------------------------------ */

.mono {
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  letter-spacing: var(--tracking-mono);
  line-height: var(--leading-mono);
  color: var(--text-tertiary);
}

.measure {
  max-width: var(--measure);
}

/* ------------------------------------------------------------------ *
 * Nav — strong hairline, three parts, never sticky
 * ------------------------------------------------------------------ */

.nav {
  display: flex;
  gap: var(--space-5);
  align-items: baseline;
  justify-content: space-between;
  padding: var(--space-5) 0;
  border-bottom: 1px solid var(--border-strong);
}

.nav__brand {
  font-family: var(--font-display);
  font-size: var(--text-h3);
  font-weight: var(--weight-regular);
  letter-spacing: var(--tracking-heading);
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
}

.nav__brand:hover {
  color: var(--text-accent);
}

.nav__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
}

.nav__link {
  font-size: var(--text-small);
  color: var(--text-tertiary);
  text-decoration: none;
  text-transform: lowercase;
  transition: var(--transition-color);
}

.nav__link:hover,
.nav__link[aria-current='page'] {
  color: var(--text-primary);
}

.nav__meta {
  display: flex;
  gap: var(--space-3);
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  letter-spacing: var(--tracking-mono);
  color: var(--text-tertiary);
  white-space: nowrap;
}

/* Reserve the clock's width so writing it in does not shift the header. */
.nav__clock {
  display: inline-block;
  min-width: 8ch;
}

/* Below this the three parts stop fitting on one line and the links wrap into
 * a column, which turns the header into a menu. The plan's resolution: the
 * wordmark and links stay, the meta and clock drop. */
@media (width <= 560px) {
  .nav {
    flex-wrap: wrap;
    gap: var(--space-3);
    padding: var(--space-4) 0;
  }

  .nav__meta {
    display: none;
  }

  .nav__links {
    width: 100%;
    gap: var(--space-4);
  }
}

/* ------------------------------------------------------------------ *
 * Footer — soft hairline
 * ------------------------------------------------------------------ */

.footer {
  margin-top: var(--space-8);
  padding: var(--space-6) 0 var(--space-5);
  border-top: 1px solid var(--border-default);
}

.footer__row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
  align-items: baseline;
  justify-content: space-between;
}

.footer__name {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-h3);
  color: var(--text-primary);
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
}

.footer__link {
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  letter-spacing: var(--tracking-mono);
  color: var(--text-tertiary);
  text-decoration: none;
  text-transform: lowercase;
  transition: var(--transition-color);
}

.footer__link:hover {
  color: var(--text-accent);
}

.footer__colophon {
  max-width: var(--measure);
  margin: var(--space-5) 0 0;
  font-size: var(--text-caption);
  line-height: var(--leading-body);
  color: var(--text-tertiary);
  text-wrap: pretty;
}

/* ------------------------------------------------------------------ *
 * Section — the 160px mono label column and its content
 * ------------------------------------------------------------------ */

.section {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-7);
  padding: var(--space-8) 0;
  border-top: 1px solid var(--border-default);
}

.section--open {
  border-top-color: var(--border-strong);
}

.section__label {
  display: flex;
  flex: 0 1 var(--label-column);
  flex-direction: column;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  letter-spacing: var(--tracking-mono);
  color: var(--text-tertiary);
}

.section__mark {
  color: var(--text-primary);
}

.section__body {
  flex: 1 1 520px;
  min-width: 0;
}

/* Below the point where a 160px column and 520px of content stop fitting side
 * by side, the label becomes a line above the content rather than a squeezed
 * column. Plan section 3.0. */
@media (width <= 720px) {
  .section {
    flex-direction: column;
    gap: var(--space-4);
    padding: var(--space-7) 0;
  }

  .section__label {
    flex-flow: row wrap;
    gap: var(--space-4);
  }
}

/* ------------------------------------------------------------------ *
 * Headings
 * ------------------------------------------------------------------ */

.display {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.75rem, 8.5vw, 6.5rem);
  font-weight: var(--weight-regular);
  line-height: var(--leading-display);
  letter-spacing: var(--tracking-display);
  text-wrap: balance;
}

.display--page {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
}

/* Italic is a serif privilege, and it takes the accent. */
.display em {
  font-style: italic;
  color: var(--text-accent);
}

.lead {
  max-width: 52ch;
  margin: 0;
  font-size: var(--text-lead);
  line-height: var(--leading-body);
  color: var(--text-secondary);
  text-wrap: pretty;
}

/* ------------------------------------------------------------------ *
 * Button — ink, going blueprint on hover. No scale, no shrink on press.
 * ------------------------------------------------------------------ */

.button {
  display: inline-flex;
  gap: var(--space-2);
  align-items: center;
  height: var(--control-h-md);
  padding: 0 var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-small);
  font-weight: var(--weight-medium);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  transition: var(--transition-color);
}

.button--primary {
  color: var(--text-inverse);
  background: var(--bg-inverse);
}

.button--primary:hover {
  color: var(--text-inverse);
  background: var(--accent);
}

.button--secondary {
  color: var(--text-primary);
  background: transparent;
  border-color: var(--border-default);
}

.button--secondary:hover {
  color: var(--text-inverse);
  background: var(--bg-inverse);
  border-color: var(--border-strong);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding-top: var(--space-2);
}

/* ------------------------------------------------------------------ *
 * Elevation — the hero drawing, in a hairline frame with section marks
 * ------------------------------------------------------------------ */

.elevation {
  position: relative;
  margin: 0;
  padding: var(--space-4);
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
}

.elevation__mark {
  position: absolute;
  font-family: var(--font-mono);
  font-size: var(--text-mono-sm);
  letter-spacing: var(--tracking-mono);
  color: var(--text-tertiary);
}

.elevation__mark--a {
  top: var(--space-1);
  left: var(--space-2);
}

.elevation__mark--b {
  right: var(--space-2);
  bottom: var(--space-1);
}

/* Only the named plate is shown. The others stay in the document so the swap
 * is an attribute change rather than a fetch. */
.elevation__plate {
  display: none;
}

.elevation[data-elevation='prairie'] .elevation__plate[data-name='prairie'],
.elevation[data-elevation='usonian'] .elevation__plate[data-name='usonian'],
.elevation[data-elevation='tower'] .elevation__plate[data-name='tower'],
.elevation[data-elevation='hemicycle'] .elevation__plate[data-name='hemicycle'] {
  display: block;
}

.elevation__svg {
  display: block;
  width: 100%;
  height: auto;
}

/* ------------------------------------------------------------------ *
 * Toast — the dry one-line message for a hidden moment
 * ------------------------------------------------------------------ */

.toast {
  position: fixed;
  bottom: var(--space-5);
  left: var(--space-5);
  z-index: 6;
  margin: 0;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  letter-spacing: var(--tracking-mono);
  color: var(--text-primary);
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-popover);
}

/* ------------------------------------------------------------------ *
 * Hero
 * ------------------------------------------------------------------ */

.hero {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-7);
  align-items: flex-end;
  padding: var(--space-9) 0 var(--space-8);
}

.hero__body {
  display: flex;
  flex: 1 1 420px;
  flex-direction: column;
  gap: var(--space-5);
  min-width: 0;
}

.hero__figure {
  flex: 1 1 420px;
  min-width: 0;
}

@media (width <= 720px) {
  .hero {
    padding: var(--space-7) 0 var(--space-6);
  }
}

/* ------------------------------------------------------------------ *
 * Drawing — the hatched placeholder and the frame real imagery sits in
 *
 * Ported from Drawing in the reference bundle. The hatch is what stands in
 * until a real line drawing is inked; the mono caption says what belongs there.
 * ------------------------------------------------------------------ */

.drawing {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  aspect-ratio: 4 / 3;
  padding: var(--space-4);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: var(--text-mono-sm);
  letter-spacing: var(--tracking-mono);
  color: var(--text-tertiary);
  text-align: center;
  background: repeating-linear-gradient(135deg, transparent 0 7px, var(--hatch) 7px 8px);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
}

.drawing--wide {
  aspect-ratio: 16 / 10;
}

.drawing--tall {
  aspect-ratio: 3 / 4;
}

/* With real imagery the hatch gives way to the raised sheet. */
.drawing--plate {
  background: var(--bg-raised);
}

.drawing__mark {
  position: absolute;
  font-size: var(--text-mono-sm);
}

.drawing__mark--a {
  top: var(--space-1);
  left: var(--space-2);
}

.drawing__mark--b {
  right: var(--space-2);
  bottom: var(--space-1);
}

/* ------------------------------------------------------------------ *
 * Card — raised white, hairline going ink on hover, title going blueprint
 * ------------------------------------------------------------------ */

.card {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-4);
  font-family: var(--font-sans);
  color: var(--text-primary);
  text-decoration: none;
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  transition: var(--transition-color);
}

.card:hover {
  border-color: var(--border-strong);
}

.card__head {
  display: flex;
  gap: var(--space-3);
  align-items: baseline;
  justify-content: space-between;
}

.card__title {
  margin: 0;
  font-size: var(--text-h3);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-heading);
  transition: var(--transition-color);
}

.card:hover .card__title {
  color: var(--text-accent);
}

.card__index {
  font-family: var(--font-mono);
  font-size: var(--text-mono-sm);
  letter-spacing: var(--tracking-mono);
  color: var(--text-tertiary);
  white-space: nowrap;
}

.card__description {
  margin: 0;
  font-size: var(--text-small);
  color: var(--text-secondary);
  text-wrap: pretty;
}

.card__foot {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-1);
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  letter-spacing: var(--tracking-mono);
  color: var(--text-tertiary);
}

/* The stack list may wrap; the status must not break across two lines. */
.card__open {
  color: var(--text-accent);
  white-space: nowrap;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-5);
}

/* ------------------------------------------------------------------ *
 * ListRow — the index row: CV entries, recent links, the work index
 * ------------------------------------------------------------------ */

.list-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: var(--space-5);
  align-items: baseline;
  padding: var(--space-4) 0;
  font-family: var(--font-sans);
  color: var(--text-primary);
  text-decoration: none;
  border-bottom: 1px solid var(--border-default);
  transition: var(--transition-color);
}

a.list-row:hover {
  color: var(--text-accent);
}

.list-row__index {
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  letter-spacing: var(--tracking-mono);
  color: var(--text-tertiary);
}

.list-row__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.list-row__title {
  font-size: var(--text-h3);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-heading);
}

.list-row__description {
  font-size: var(--text-small);
  color: var(--text-secondary);
  text-wrap: pretty;
}

.list-row__meta {
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  letter-spacing: var(--tracking-mono);
  color: var(--text-tertiary);
  white-space: nowrap;
}

/* The 48px index gutter and a nowrap meta column stop fitting together on a
 * phone. The index folds into the body and the meta drops to its own line. */
@media (width <= 560px) {
  .list-row {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-2);
  }

  .list-row__meta {
    white-space: normal;
  }
}

/* ------------------------------------------------------------------ *
 * Badge
 * ------------------------------------------------------------------ */

.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-mono-sm);
  letter-spacing: var(--tracking-mono);
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
}

.badge--neutral {
  color: var(--text-tertiary);
  background: transparent;
  border-color: var(--border-default);
}

.badge--ink {
  color: var(--text-inverse);
  background: var(--bg-inverse);
  border-color: var(--bg-inverse);
}

.badge--accent {
  color: var(--text-accent);
  background: var(--accent-soft);
  border-color: var(--accent-soft);
}

/* ------------------------------------------------------------------ *
 * Spec table — mono key on the left, mono value on the right
 * ------------------------------------------------------------------ */

.spec {
  display: flex;
  flex-direction: column;
  margin: 0;
}

.spec__row {
  display: flex;
  gap: var(--space-5);
  justify-content: space-between;
  padding: var(--space-3) 0;
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  letter-spacing: var(--tracking-mono);
  border-bottom: 1px solid var(--border-default);
}

.spec__key {
  color: var(--text-tertiary);
}

.spec__value {
  color: var(--text-primary);
  text-align: right;
}

/* ------------------------------------------------------------------ *
 * A mono link that closes a section — "all 42 links →"
 * ------------------------------------------------------------------ */

.more {
  display: inline-block;
  padding-top: var(--space-5);
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  letter-spacing: var(--tracking-mono);
  color: var(--text-secondary);
  text-decoration: none;
}

.more:hover {
  color: var(--text-accent);
}

/* ------------------------------------------------------------------ *
 * Prose — rendered markdown bodies, held to the 62ch measure
 * ------------------------------------------------------------------ */

.prose {
  max-width: var(--measure);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  color: var(--text-secondary);
  text-wrap: pretty;
}

.prose > :first-child {
  margin-top: 0;
}

.prose > :last-child {
  margin-bottom: 0;
}

.prose p {
  margin: 0 0 var(--space-5);
}

.prose h2 {
  margin: var(--space-7) 0 var(--space-3);
  font-size: var(--text-h2);
  font-weight: var(--weight-medium);
  line-height: var(--leading-heading);
  letter-spacing: var(--tracking-heading);
  color: var(--text-primary);
}

.prose h3 {
  margin: var(--space-6) 0 var(--space-2);
  font-size: var(--text-h3);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-heading);
  color: var(--text-primary);
}

.prose strong {
  font-weight: var(--weight-medium);
  color: var(--text-primary);
}

.prose em {
  font-style: italic;
}

.prose a {
  color: var(--text-primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.prose a:hover {
  color: var(--text-accent);
}

/* Inline code sits in the mono layer, at the size the surrounding text can
 * carry rather than the 12px the dimension layer uses. */
.prose code {
  padding: 0 var(--space-1);
  font-family: var(--font-mono);
  font-size: var(--text-small);
  color: var(--text-primary);
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
}

.prose ul,
.prose ol {
  margin: 0 0 var(--space-5);
  padding-left: var(--space-5);
}

.prose li {
  margin-bottom: var(--space-2);
}

.prose blockquote {
  margin: var(--space-5) 0;
  padding-left: var(--space-4);
  border-left: 1px solid var(--border-default);
}

/* ------------------------------------------------------------------ *
 * Page header — the shared shape of every page below the home page
 * ------------------------------------------------------------------ */

.page-header {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-7);
  align-items: flex-end;
  padding: var(--space-7) 0;
}

.page-header__body {
  display: flex;
  flex: 1 1 420px;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

.page-header__figure {
  flex: 1 1 340px;
  min-width: 0;
}

.page-header__aside {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.backlink {
  display: inline-block;
  padding: var(--space-6) 0 0;
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  letter-spacing: var(--tracking-mono);
  color: var(--text-secondary);
  text-decoration: none;
}

.backlink:hover {
  color: var(--text-accent);
}

/* ------------------------------------------------------------------ *
 * Year groups on the work index
 * ------------------------------------------------------------------ */

.group {
  padding: var(--space-6) 0 var(--space-7);
  border-top: 1px solid var(--border-strong);
}

.group__head {
  display: flex;
  gap: var(--space-4);
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  letter-spacing: var(--tracking-mono);
  color: var(--text-tertiary);
}

.group__label {
  color: var(--text-primary);
}

/* ------------------------------------------------------------------ *
 * Screens grid
 * ------------------------------------------------------------------ */

.screens {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-5);
}

/* The "nothing here yet" plate. Left at full section width it reads as a
 * missing image rather than a note about one, so it is held to the width of a
 * single screen in the grid above. */
.screens__empty {
  max-width: 420px;
}

.screens__item {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.screens__caption {
  font-family: var(--font-mono);
  font-size: var(--text-mono-sm);
  letter-spacing: var(--tracking-mono);
  color: var(--text-tertiary);
}

/* ------------------------------------------------------------------ *
 * CV
 * ------------------------------------------------------------------ */

/* A standing note in the mono layer — not a banner, and not announced twice. */
.notice {
  margin: 0 0 var(--space-6);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--border-default);
  border-bottom: 1px solid var(--border-default);
}

.practice {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-6);
}

.practice__column {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.practice__body {
  margin: 0;
  font-size: var(--text-body);
  line-height: var(--leading-body);
  color: var(--text-primary);
  text-wrap: pretty;
}

.education__title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-h3);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-heading);
}

/* ------------------------------------------------------------------ *
 * Link row — the linkblog's three columns: day, title and note, source
 * ------------------------------------------------------------------ */

.link-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: var(--space-5);
  align-items: baseline;
  padding: var(--space-4) 0;
  color: var(--text-primary);
  text-decoration: none;
  border-bottom: 1px solid var(--border-default);
  transition: var(--transition-color);
}

.link-row:hover {
  color: var(--text-accent);
}

.link-row__day {
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  letter-spacing: var(--tracking-mono);
  color: var(--text-tertiary);
}

.link-row__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.link-row__title {
  font-size: var(--text-h3);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-heading);
}

.link-row__mark {
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  color: var(--text-tertiary);
}

.link-row__note {
  font-size: var(--text-small);
  color: var(--text-secondary);
  text-wrap: pretty;
}

.link-row__source {
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  letter-spacing: var(--tracking-mono);
  color: var(--text-tertiary);
  white-space: nowrap;
}

@media (width <= 560px) {
  .link-row {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-2);
  }

  .link-row__source {
    white-space: normal;
  }
}

/* ------------------------------------------------------------------ *
 * Plate — a real screenshot in the Drawing's hairline frame
 *
 * Desaturated by default and full colour on hover. A screenshot is the only
 * saturated thing on this sheet, and desaturating keeps the page quiet; the
 * transition is the same 120ms colour fade everything else uses, so it reads
 * as instrumentation rather than motion.
 * ------------------------------------------------------------------ */

.plate {
  position: relative;
  margin: 0;
  padding: var(--space-2);
  overflow: hidden;
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
}

.plate__img {
  display: block;
  width: 100%;
  height: auto;
  filter: saturate(0.15) contrast(0.95);
  transition: filter var(--dur-fast) var(--ease-out);
}

.plate:hover .plate__img {
  filter: none;
}

.plate__mark {
  position: absolute;
  z-index: 1;
  font-family: var(--font-mono);
  font-size: var(--text-mono-sm);
  letter-spacing: var(--tracking-mono);
  color: var(--text-tertiary);
}

.plate__mark--a {
  top: var(--space-1);
  left: var(--space-2);
}

.plate__mark--b {
  right: var(--space-2);
  bottom: var(--space-1);
}

/* There is no hover on a touch screen, so a permanently desaturated screenshot
 * on a phone is simply a worse screenshot. */
@media (hover: none) {
  .plate__img {
    filter: none;
  }
}

/* prefers-reduced-motion asks for no animation, not for a different design.
 * The desaturation stays and only the fade goes, so hovering swaps instantly.
 * Dropping the treatment as well would over-apply the preference — and it would
 * also mean the visual baselines, which run with the preference set, never
 * covered the treatment at all. */
@media (prefers-reduced-motion: reduce) {
  .plate__img {
    transition: none;
  }
}

/* ------------------------------------------------------------------ *
 * The screenshot lightbox
 *
 * The plate link exists whether or not the script runs, so it is styled as a
 * block rather than as a link: no underline, no colour, nothing between the
 * frame and the image.
 * ------------------------------------------------------------------ */

.plate__link {
  display: block;
  color: inherit;
  text-decoration: none;
}

/* The dialog is built by src/js/enhance.js on first use and is display: none
 * until it is opened, so a page that never opens one carries only these rules. */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 7;
  display: none;
  flex-direction: column;
  gap: var(--space-4);
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background: var(--scrim);
  backdrop-filter: blur(2px);
}

.lightbox[data-open] {
  display: flex;
}

/* Nothing behind the dialog should scroll while it is open. */
[data-lightbox-open] {
  overflow: hidden;
}

.lightbox__figure {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 100%;
  margin: 0;
}

.lightbox__stage {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2);
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-dialog);
}

/* Full colour here. The desaturation on the sheet is there to keep the page
 * quiet; a reader who has opened an image wants to see the image. */
.lightbox__img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 76vh;
  height: auto;
}

.lightbox__meta {
  display: flex;
  gap: var(--space-4);
  align-items: baseline;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: var(--text-mono-sm);
  letter-spacing: var(--tracking-mono);
  color: var(--text-secondary);
}

.lightbox__count {
  flex: none;
  color: var(--text-tertiary);
}

.lightbox__controls {
  display: flex;
  gap: var(--space-2);
}

.lightbox__button {
  min-width: var(--control-h-md);
  height: var(--control-h-md);
  padding: 0 var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-mono-sm);
  letter-spacing: var(--tracking-mono);
  color: var(--text-secondary);
  cursor: pointer;
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  transition: var(--transition-color);
}

.lightbox__button:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

/* The plan view: a line drawing derived from the project's own first
 * screenshot (tools/build-plans.mjs). It is ink on transparency, so the sheet
 * shows through it — and the dark theme inverts the ink rather than needing a
 * second asset for every project. */
.drawing__plan {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

[data-theme='dark'] .drawing__plan {
  filter: invert(1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .drawing__plan {
    filter: invert(1);
  }
}
