/* ==========================================================================
   Darkroom Editorial — components
   Every value comes from tokens.css. Sections follow DESIGN-SYSTEM.md.
   ========================================================================== */

/* 1. Base ------------------------------------------------------------------ */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: var(--step-0);
  font-weight: var(--weight-regular);
  line-height: var(--leading-ui);
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, p, figure, blockquote, dl, dd { margin: 0; }
h1, h2, h3 { font-size: inherit; font-weight: inherit; }

img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--placeholder);
}

a {
  color: inherit;
  text-decoration: none;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
a:hover,
a[aria-current] { text-decoration-line: underline; }
.brand[aria-current]:not(:hover) { text-decoration-line: none; }
.prose a, .info dd a, a.is-underlined { text-decoration-line: underline; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 3px;
}

::selection { background: var(--ink); color: var(--paper); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 50;
  background: var(--paper);
  padding: var(--space-2) 0;
}
.skip-link:focus { top: var(--space-2); }

.muted { color: var(--ink-muted); }

/* 2. Header: name · navigation · utility ----------------------------------- */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  height: var(--header-h);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 var(--gutter);
  background: var(--paper);
}
.brand { justify-self: start; }
.nav { display: flex; gap: 0.85em; }
.util { justify-self: end; }

main { padding-top: var(--header-h); }

@media (max-width: 700px) {
  .site-header {
    grid-template-columns: 1fr auto;
    grid-template-rows: 22px 22px;
    grid-template-areas: "brand util" "nav nav";
    row-gap: var(--space-1);
    align-content: start;
    padding-top: 10px;
  }
  .brand { grid-area: brand; }
  .util { grid-area: util; }
  .nav { grid-area: nav; }
}

/* 3. Strip: the horizontal sequence of photographs ------------------------- */

.strip-wrap {
  height: calc(100svh - var(--header-h));
  display: flex;
  flex-direction: column;
}

.strip {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: flex-start;
  gap: var(--gap);
  padding: var(--space-1) var(--gutter) 0;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  scroll-padding-inline: var(--gutter);
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  /* Photographs that scroll past disappear at the margin, not the screen edge. */
  clip-path: inset(0 0 0 var(--gutter));
}
.strip::-webkit-scrollbar { display: none; }
/* Room after the last frame so every photograph can reach the left edge. */
.strip::after {
  content: "";
  flex: 0 0 calc(100vw - var(--tile-w) - 2 * var(--gutter) - var(--gap));
  height: 1px;
}

.frame {
  flex: 0 0 auto;
  width: var(--tile-w);
  scroll-snap-align: start;
}
.frame a { display: block; }
.frame[data-advance] img { cursor: e-resize; }
.frame .cap { display: none; }
/* Sequence (project pages): landscape frames span two tiles, capped so
   they never grow taller than the strip. --ar is set per frame (w / h). */
.strip--sequence .frame--wide {
  width: min(var(--tile-w-wide), calc(var(--strip-h) * var(--ar, 1.5)));
}

.strip-bar {
  min-height: var(--bar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-2) max(var(--gutter), var(--badge-clear-x)) var(--space-2) var(--gutter);
}
.strip-status {
  display: flex;
  gap: var(--space-4);
  min-width: 0;
}
.count {
  flex: 0 0 auto;
  min-width: 3.2em;
  font-variant-numeric: tabular-nums lining-nums;
}
.strip-caption {
  max-width: 78ch;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.strip-tools {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.arrow {
  font-size: var(--step-2);
  line-height: 1;
  padding: var(--space-1) 2px;
}
.arrow[aria-disabled="true"] { color: var(--rule); cursor: default; }

/* On phones the strip becomes a simple vertical sequence with captions. */
@media (max-width: 700px) {
  .strip-wrap { height: auto; }
  .strip {
    flex-direction: column;
    gap: var(--space-4);
    padding: var(--space-3) var(--gutter) var(--space-4);
    overflow: visible;
    scroll-snap-type: none;
  }
  .strip::after { display: none; }
  .frame, .strip--sequence .frame--wide { width: 100%; }
  .frame[data-advance] img { cursor: auto; }
  .frame .cap {
    display: block;
    margin-top: var(--space-2);
    color: var(--ink-muted);
  }
  .frame .cap:empty { display: none; }
  .strip-bar { display: none; }
}

/* 3b. Reel: the showreel as the first frame of the home strip ---------------
   Paired with the first photograph: both the same height, together exactly
   the page width (--pair-ar is that photograph's width ÷ height). Muted and
   slowed down; the still shows until the film is really playing, and again
   when paused or scrolled away. */

.frame--reel,
.frame--pair {
  --pair-h: min(
    var(--strip-h),
    calc((100vw - 2 * var(--gutter) - var(--gap)) / (16 / 9 + var(--pair-ar, 1.5)))
  );
}
.frame--reel { width: calc(var(--pair-h) * 16 / 9); }
.frame--pair { width: calc(var(--pair-h) * var(--pair-ar, 1.5)); }
.reel-screen {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--film);
  container-type: size;
}
.reel-still,
.reel-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;
}
.reel-media {
  opacity: 0;
  transition: opacity calc(var(--dur) * 4) var(--ease);
}
.reel-screen.is-playing .reel-media { opacity: 1; }
/* A YouTube player can't crop itself: size it to cover the screen at 16:9. */
.reel-media iframe {
  position: absolute;
  top: 50%;
  left: 50%;
  width: max(100cqw, 100cqh * 16 / 9);
  height: max(100cqh, 100cqw * 9 / 16);
  transform: translate(-50%, -50%);
  border: 0;
}
/* The whole screen opens the full film (the bar link is the accessible one). */
.reel-link { position: absolute; inset: 0; z-index: 1; }
.reel-toggle {
  margin-left: var(--space-4);
  color: var(--ink-muted);
}
.reel-toggle:hover { color: var(--ink); }

@media (max-width: 700px) {
  .frame--reel, .frame--pair { width: 100%; }
  .frame .cap a { display: inline; }
}

/* 4. Grid: every photograph, top-aligned rows -------------------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--gap);
  align-items: start;
  padding: var(--space-1) var(--gutter) 0;
}
.grid a { display: block; }
@media (max-width: 1100px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px)  { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* 5. Index: projects and films with a title underneath ---------------------- */

.page-intro {
  padding: var(--space-3) var(--gutter) var(--space-4);
  max-width: calc(var(--measure) + 2 * var(--gutter));
}

.index {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-5) var(--space-3);
  align-items: start;
  padding: 0 var(--gutter);
  list-style: none;
  margin: 0;
}
.index a { display: block; }
.index a:hover { text-decoration: none; }
.index a:hover .tile-title { text-decoration: underline; }
.tile-text { display: block; margin-top: var(--space-2); }
.tile-title { display: block; }
.tile-meta { display: block; color: var(--ink-muted); }

.index--films .thumb {
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

@media (max-width: 1100px) { .index { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px)  { .index { grid-template-columns: minmax(0, 1fr); gap: var(--space-4); } }

/* 6. Information list: label column + content column ----------------------- */

.info {
  display: grid;
  grid-template-columns: var(--label-col) minmax(0, var(--measure));
  column-gap: var(--space-4);
  row-gap: var(--space-4);
  padding: var(--space-5) var(--gutter);
  margin: 0;
}
.info .row { display: contents; }
.info dt { color: var(--ink-muted); }
.info dd { margin: 0; }
.info .title { font-size: var(--step-1); line-height: var(--leading-text); }
@media (max-width: 700px) {
  .info { grid-template-columns: minmax(0, 1fr); row-gap: var(--space-1); }
  .info dd { margin-bottom: var(--space-3); }
  /* Phones: a project's title and story come before its photographs. */
  .page-project main { display: flex; flex-direction: column; }
  .page-project .info { order: -1; padding-top: var(--space-3); padding-bottom: 0; }
}

.lines { list-style: none; margin: 0; padding: 0; }

/* 7. Prose: project stories ------------------------------------------------- */

.prose {
  font-size: var(--step-1);
  line-height: var(--leading-text);
  max-width: var(--measure);
  hanging-punctuation: first;
}
.prose > * + * { margin-top: 0.85em; }
.prose h3 { font-style: italic; }
.prose blockquote {
  font-size: var(--step-2);
  line-height: 1.3;
  margin: 1.1em 0;
}
.prose blockquote:first-child { margin-top: 0; }

/* 8. Lead statement (About) -------------------------------------------------- */

.lead {
  font-size: var(--step-3);
  line-height: var(--leading-display);
  max-width: 34em;
  padding: var(--space-4) var(--gutter) 0;
  text-wrap: pretty;
}

.about {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 30vw);
  gap: var(--space-4);
  align-items: start;
  padding-right: var(--gutter);
}
.about .info { padding-right: 0; }
.portrait {
  margin-top: var(--space-5);
  position: sticky;
  top: calc(var(--header-h) + var(--space-3));
}
@media (max-width: 900px) {
  .about { grid-template-columns: minmax(0, 1fr); padding-right: 0; }
  .portrait { position: static; margin: 0 var(--gutter); max-width: 420px; }
}

/* 8b. CV list (Contact): dates in their own muted column -------------------- */

.cv {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-3);
}
.cv li {
  display: grid;
  grid-template-columns: 7em minmax(0, 1fr);
  column-gap: var(--space-3);
}
.cv-when {
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums lining-nums;
}
.cv-where,
.cv-note { display: block; }
.cv-note { color: var(--ink-muted); }
/* The dates get their own column, so the text beside them keeps a full measure. */
.page-contact .info {
  grid-template-columns: var(--label-col) minmax(0, calc(var(--measure) + 7em + var(--space-3)));
}
@media (max-width: 700px) {
  .page-contact .info { grid-template-columns: minmax(0, 1fr); }
  .cv li { grid-template-columns: 6em minmax(0, 1fr); column-gap: var(--space-2); }
}

/* 8c. Writing: sections (Poetry, Editing) of works. Each work: title as a lead,
   the opening lines (poem) or a one-line description (editing), then the
   information list. -------------------------------------------------------- */

.section-label {
  padding: var(--space-4) var(--gutter) 0;
  color: var(--ink-muted);
}
.writing-section + .writing-section {
  margin-top: var(--space-6);
  border-top: 1px solid var(--rule);
}
.poem + .poem {
  margin-top: var(--space-5);
  border-top: 1px solid var(--rule);
}
.work-about {
  max-width: var(--measure);
  padding: var(--space-3) var(--gutter) 0;
  font-size: var(--step-1);
  line-height: var(--leading-text);
}
.poem-excerpt {
  max-width: 34em;
  padding: var(--space-4) var(--gutter) 0;
  font-size: var(--step-2);
  line-height: 1.3;
  font-style: italic;
}
/* One line of verse per span; if a line has to wrap, the rest is indented so
   it isn't mistaken for the poet's own line break. */
.verse {
  display: block;
  padding-left: 1.2em;
  text-indent: -1.2em;
}
@media (max-width: 700px) {
  .poem-excerpt { font-size: var(--step-1); line-height: var(--leading-text); }
}

/* 9. Film player ------------------------------------------------------------- */

.player-wrap { padding: var(--space-1) var(--gutter) 0; }
.player {
  position: relative;
  width: min(100%, calc((100svh - var(--header-h) - 120px) * 16 / 9));
  aspect-ratio: 16 / 9;
  background: var(--film);
  overflow: hidden;
}
.player img, .player iframe, .player video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: cover;
  background: var(--film);
}
.player .play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: var(--space-3) var(--space-3);
  color: var(--on-film);
  font-size: var(--step-1);
  background: linear-gradient(to top, rgb(0 0 0 / 0.45), rgb(0 0 0 / 0) 40%);
  text-decoration: none;
}
.player .play span { transition: transform var(--dur) var(--ease); }
.player .play:hover span { transform: translateX(4px); }
@media (max-width: 700px) {
  .player { width: 100%; }
}

/* 10. Footer ----------------------------------------------------------------- */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-6) var(--gutter) max(var(--space-4), var(--badge-clear-y));
  font-size: var(--step--1);
  color: var(--ink-muted);
}

/* 11. Not found ------------------------------------------------------------- */

.not-found { padding: var(--space-5) var(--gutter); }

/* 12. Style guide page only -------------------------------------------------- */

.prose strong, .sg strong { font-weight: var(--weight-medium); }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.82em; }

.sg-intro, .sg-section { padding: var(--space-5) var(--gutter) 0; }
.sg-bleed { padding-left: 0; padding-right: 0; }
.sg-pad { padding-left: var(--gutter); padding-right: var(--gutter); }
.sg-h { color: var(--ink-muted); margin-bottom: var(--space-3); }
.sg-note { max-width: var(--measure); margin-bottom: var(--space-3); }
.sg-list { padding-left: 1.2em; }
.sg-list li + li { margin-top: var(--space-2); }

.sg-swatches, .sg-types, .sg-spaces { list-style: none; margin: 0; padding: 0; }
.sg-swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-4);
}
.sg-swatch { display: flex; gap: var(--space-3); align-items: flex-start; }
.sg-chip {
  flex: 0 0 52px;
  height: 52px;
  box-shadow: inset 0 0 0 1px var(--rule);
}
.sg-type {
  display: grid;
  grid-template-columns: var(--label-col) minmax(0, 1fr);
  column-gap: var(--space-4);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--rule);
  align-items: baseline;
}
.sg-space {
  display: grid;
  grid-template-columns: 110px 50px 1fr;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-1) 0;
}
.sg-bar { display: block; height: 13px; background: var(--ink); }
.sg-strip .strip-wrap { height: min(70svh, 640px); }
.sg-strip .strip::after { flex-basis: 0; }
@media (max-width: 700px) {
  .sg-type { grid-template-columns: minmax(0, 1fr); row-gap: var(--space-1); }
  .sg-strip .strip-wrap { height: auto; }
}
