/* ===========================================================================
   components.css — pills, ruled rows, bare media, press table, video embed.
   Depends on tokens.css.

   NO CARDS. The first pass used bordered, shadowed, rounded cards — the most
   generic pattern available, and the main reason the site read as templated.
   Work is presented as bare media with micro captions, and lists are hairline-
   ruled rows. Structure comes from rules and alignment, not from boxes.
   =========================================================================== */

/* ===========================================================================
   PILL — tiny outlined link with an arrow. 10px caps.
   =========================================================================== */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.42em 0.85em;
  font-size: var(--step-micro);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-micro);
  text-transform: uppercase;
  text-decoration: none;
  color: var(--c-plum-ink);
  border: 1.5px solid var(--c-plum-ink);
  border-radius: var(--radius-pill);
  background: transparent;
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
}

.pill:hover {
  background: var(--c-plum-ink);
  color: var(--c-paper);
}

/* On the mulberry hero the outline has to be cream to be visible at all. */
.pill--on-hero {
  color: var(--block-hero-fg);
  border-color: var(--block-hero-fg);
}

.pill--on-hero:hover {
  background: var(--block-hero-fg);
  color: var(--c-plum);
}

/* The old optical nudge (translateY 0.04em) lived here. It is gone because the
   arrow is now a masked .icon whose vertical-align does that job — and because
   a bare translate here would have silently dropped the north-east rotation on
   the external-link pills. Its hover motion lives in motion.css layer 4. */

/* ===========================================================================
   WORK NOTE

   The rest of the .work family — .work, .work__media, .work--portrait,
   .work--square, .work__caption, .work__title, .work__action and the media
   hover — was removed on 2026-07-28. It described a bare-media card that the
   page stopped using when the work sections became video embeds plus the two
   interactive components; a grep of index.html found zero uses of any of them
   (git 51c73f9 and earlier if it is ever wanted back).

   .work__note survives because it is genuinely live — 5 uses, carrying the
   published-imagery notes and the character-select gap copy.
   =========================================================================== */

.work__note { font-size: var(--step-small); color: var(--color-text-muted); }

/* ===========================================================================
   MEDIA GRID — a plain responsive grid of stills. Added 2026-07-28 for the
   3D Projects section.

   WHY IT IS NOT .carousel__track. That class renders as exactly this grid
   until js/carousel.js runs — but carousel.css scopes the wheel as
   `.js-carousel .carousel__track`, a DESCENDANT selector on <html>. Reusing
   the class here would have absolutely-positioned this grid and collapsed it
   the moment the unrelated Melancholy Love wheel initialised. Its own name
   costs a few lines and removes the coupling entirely.
   =========================================================================== */

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr));
  gap: var(--space-m) var(--space-s);
  margin: 0;
  padding: 0;
  list-style: none;
}

.media-grid__item { margin: 0; }

.media-grid__figure {
  display: block;
  margin: 0;
  overflow: hidden;
  border-radius: var(--radius-media);
  background: color-mix(in srgb, var(--color-text) 6%, transparent);
}

.media-grid__img { display: block; width: 100%; height: auto; }

.media-grid__cap {
  margin-top: var(--space-3xs);
  color: var(--color-text-muted);
}

/* TURNAROUND STRIP — four views of one model. Added 2026-09-07.

   The base .media-grid is auto-fit, which is the right default when the item
   count is unknown. Here it is exactly four, and they are one object rendered
   four ways rather than four separate works, so the count is fixed and the row
   must never reflow into an orphan. It did: five items in the auto-fit grid
   gave four columns and stranded the fifth beside 860px of empty track at
   1280px wide, and the 16:9 design sheet sitting among 1:1 renders pushed its
   caption 121px out of line with its neighbours'.

   Explicit tracks fix both. Two columns rather than one on small screens
   because a turnaround reads as pairs — front/back, then the two sides — and a
   single column turns four views into four unrelated pictures. The gap is
   tighter than the base grid's on purpose: these belong to each other. */
.media-grid--turnaround {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-s) var(--space-2xs);
}

@media (min-width: 56rem) {
  .media-grid--turnaround { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* NO TILE BACKGROUND on the turnaround. The base .media-grid__figure carries a
   6% ink tint, which is right for artwork that brings its own opaque ground —
   it gives the image a box to sit in while it loads. These four renders had
   their grey studio ground knocked out on 2026-09-07, so a tint here would put
   the bot back on a faint plum panel and undo the knockout. On paper, they now
   read as objects on the page rather than as screenshots. */
.media-grid--turnaround .media-grid__figure {
  background: none;
  border-radius: 0;
}

/* The label that names the strip as one piece of work. Sits above the tiles,
   in the same register as .eyebrow but without claiming a section of its own. */
.media-grid__group-label {
  color: var(--color-text-muted);
  margin: 0 0 var(--space-2xs);
}

/* MEDIA STACK — a media column holding more than one item. Added 2026-09-08
   for #elemental-heroes, where the key art was stranded at the bottom of the
   text column beneath a button.

   align-content:start matters. The stack is a grid ITEM of .panel-split, which
   stretches its items to the row height; without this the gap between the
   video and the poster would grow to absorb the leftover height and the pair
   would drift apart rather than reading as a stack. */
.media-stack {
  display: grid;
  gap: var(--space-l);
  align-content: start;
}

/* ===========================================================================
   RULED LIST — services / expertise. Hairline rows, no bullets, no boxes.
   =========================================================================== */

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

.ruled > li {
  border-bottom: 1.5px solid var(--color-rule);
  padding-block: var(--space-xs);
  font-size: var(--step-body);
  font-weight: var(--fw-medium);
}

.ruled > li:first-child { border-top: 1.5px solid var(--color-rule); }

/* A trailing qualifier on a ruled row — used by the Software list, where
   each package carries what it is used for. The row becomes a two-part line: name in ink at full weight, use in muted micro
   caps pushed to the far edge, so the names stay in one readable column.
   Scoped by :has() so the "What's in the work" list above, which carries no
   .ruled__meta, is untouched. Wraps under the name on narrow screens rather
   than crushing either half. */
.ruled > li:has(.ruled__meta) {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3xs) var(--space-s);
}

.ruled__meta {
  font-size: var(--step-micro);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-micro);
  text-transform: uppercase;
  color: var(--color-text-muted);
}

/* ===========================================================================
   PRESS / INDEX TABLE — two columns of micro type on hairline rules.
   =========================================================================== */

.index-table { width: 100%; border-collapse: collapse; }

.index-table tr { border-bottom: 1.5px solid var(--color-rule); }
.index-table tr:first-child { border-top: 1.5px solid var(--color-rule); }

.index-table th,
.index-table td {
  text-align: left;
  vertical-align: top;
  padding-block: var(--space-xs);
  padding-right: var(--space-m);
  font-size: var(--step-small);
  font-weight: var(--fw-regular);
}

.index-table th {
  font-weight: var(--fw-bold);
  white-space: nowrap;
  width: 1%;
}

.index-table td:last-child { padding-right: 0; }

/* WCAG 2.2 SC 2.5.8 needs a 24x24 target. The cell already carries 12px of
   block padding — but that padding is on the <td>, so it was never part of the
   anchor's hit area: the link was just its 12px text line box, measured 15px
   tall. These are standalone row links, not links inside a sentence, so the
   inline exception does not apply.

   The negative margin is what makes this free: the anchor grows to a ~26px
   target and then pulls the same distance back out of flow, so the padded row
   keeps exactly the height it had. */
.index-table a {
  display: block;
  padding-block: 0.34rem;
  margin-block: -0.34rem;
}

/* ===========================================================================
   VIDEO — click-to-load YouTube facade.
   ---------------------------------------------------------------------------
   Aspect ratio is pure CSS via data-ratio on .video. No JS measurement.
   The 9:16 cap matters: without max-width a vertical clip becomes a full-width
   skyscraper on desktop that pushes everything below the fold.

   Source ratios, measured:
     16x9  1920x1080 — showreel, both films, both animatics
     1x1   1080x1080
     9x16  1080x1920
     4x3   1024x768
   =========================================================================== */

.video { margin: 0; }

/* ---------------------------------------------------------------------------
   THE BOX — shared by the poster button AND the iframe that replaces it.

   js/video-embed.js calls frame.replaceWith(iframe), so the iframe takes the
   button's PLACE in the DOM — it does not go inside it. Any selector scoped to
   .video__frame therefore stops matching the moment playback starts.

   The original rule was `.video__frame iframe`, which required the iframe to be
   a descendant of the button. It never matched, so the player had no styling at
   all and collapsed to the browser's intrinsic iframe size. Measured: the
   button was 1135x668, the iframe that replaced it 299x160.

   Both states must be styled together. The iframe is a direct child of .video,
   which is what `:is(.video__frame, iframe)` keys off.
   --------------------------------------------------------------------------- */
.video > :is(.video__frame, iframe) {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  overflow: hidden;
  border-radius: var(--radius-media);
  background: var(--c-plum-ink);
  aspect-ratio: 16 / 9;
}

.video[data-ratio="1x1"]  > :is(.video__frame, iframe) { aspect-ratio: 1 / 1;  max-width: 640px; }
.video[data-ratio="9x16"] > :is(.video__frame, iframe) { aspect-ratio: 9 / 16; max-width: 420px; }
.video[data-ratio="4x3"]  > :is(.video__frame, iframe) { aspect-ratio: 4 / 3;  max-width: 860px; }

.video__poster,
.video__poster img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}

.video__play { position: absolute; inset: 0; display: grid; place-items: center; }

.video__play::before {
  content: "";
  width: 4rem; height: 4rem;
  border-radius: 50%;
  background: var(--c-cream);
  transition: transform var(--dur-base) var(--ease-out);
}

/* Triangle drawn with borders — no icon font, no SVG. */
.video__play::after {
  content: "";
  position: absolute;
  width: 0; height: 0;
  border-style: solid;
  border-width: 0.75rem 0 0.75rem 1.25rem;
  border-color: transparent transparent transparent var(--c-plum);
  margin-left: 0.3rem;
}

.video__frame:hover .video__play::before { transform: scale(1.09); }

/* (The old `.video__frame iframe` rule lived here. It was dead code — the
   iframe replaces the button rather than nesting inside it, so it never
   matched. Its job is now done by the shared box rule above.) */

/* --- Blocked state: a video with no usable ID ----------------------------
   Every video on the page currently has one, so this does not render today.
   It is the fail-safe for video-embed.js, which disables the control rather
   than showing a play button over a video that cannot play. Keep it. */
.video__frame[disabled] {
  cursor: not-allowed;
  background:
    repeating-linear-gradient(45deg,
      #33122C, #33122C 12px, #280D24 12px, #280D24 24px);
}

.video__frame[disabled] .video__play { display: none; }

.video__blocked {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: var(--space-2xs);
  padding: var(--space-m);
  text-align: center;
}

.video__caption {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2xs) var(--space-s);
  margin-top: var(--space-2xs);
}

.video__title {
  font-size: var(--step-small);
  font-weight: var(--fw-bold);
  letter-spacing: 0.01em;
}

.video__dur {
  font-family: var(--font-body);
  font-size: var(--step-micro);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-micro);
  font-variant-numeric: tabular-nums;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.video__note {
  margin-top: var(--space-2xs);
  font-size: var(--step-small);
  color: var(--color-text-muted);
  max-width: var(--measure);
}

/* On dark blocks the muted grey drops below AA — lift it. */
.block--dark .video__dur,
.block--dark .video__note,
.block--hero .video__dur,
.block--hero .video__note { color: var(--c-peach); }

/* ===========================================================================
   CONTACT
   =========================================================================== */

.contact-email {
  font-size: var(--step-statement);
  font-weight: var(--fw-medium);
  letter-spacing: var(--tracking-statement);
  word-break: break-word;
}

.contact-email a { text-decoration: none; }

.social {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs) var(--space-m);
  margin: 0; padding: 0;
  list-style: none;
}

/* --underline-inset keeps the hover rule hugging the TEXT rather than the
   bottom of the padded box. motion.css draws that rule as a ::after and reads
   this value; without it the 10px caps would carry an underline floating 9px
   beneath them. */
.social a {
  display: inline-block;
  /* 13px tall, measured — under the 24x24 that WCAG 2.2 SC 2.5.8 asks for, and
     these are standalone list items rather than links inside a sentence, so
     the inline exception does not apply. 0.45rem each side takes them to 27px
     without changing the type or the look. */
  padding-block: 0.45rem;
  --underline-inset: 0.45rem;
  font-size: var(--step-micro);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-micro);
  text-transform: uppercase;
  text-decoration: none;
  border-bottom: 1.5px solid transparent;
  transition: border-color var(--dur-fast) var(--ease-out);
}

.social a:hover { border-bottom-color: currentColor; }

/* ===========================================================================
   BIO — About page
   =========================================================================== */

.bio {
  font-size: var(--step-body);
  line-height: var(--lh-body);
  max-width: var(--measure);
  display: grid;
  gap: var(--space-m);
}
