/* ============================================================================
   WORK — §04 the selected-work index, §05 contact, and the full-screen project
   view. Prefixes are namespaced (.w-, .pv-, .c-) so this file never collides
   with the hero/about chunks. Tokens come from editorial.css only.
   ========================================================================= */

/* ---------- §04 head ------------------------------------------------------ */
.w-head-body .sec-lead {
  margin-top: clamp(10px, 1.7vh, 20px);
}

/* ---------- §04 the index ------------------------------------------------
   A printed list: hairline above every row, one after the last, nothing else
   in the flow. The thumbnails live in a single fixed element (below).
   ------------------------------------------------------------------------ */
.w-list {
  --ink-dim: rgba(244, 244, 242, 0.7); /* --ink, held back to read as print */
  --row-pad: clamp(15px, 2.4vh, 30px);
  border-bottom: 1px solid var(--line);
}

.w-row {
  display: grid;
  grid-template-columns: 2.4ch minmax(0, 1fr) minmax(0, 0.92fr) auto;
  align-items: baseline;
  column-gap: clamp(14px, 2.6vw, 46px);
  padding: var(--row-pad) 0;
  border-top: 1px solid var(--line);
  cursor: pointer;
  transition: border-color 0.35s var(--ease), box-shadow 0.35s var(--ease);
}

.w-idx {
  font-family: var(--mono);
  font-size: var(--t-label);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.14em;
  color: var(--faint);
  transition: color 0.3s var(--ease);
}

.w-title {
  font-size: var(--t-l);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.015em;
  color: var(--ink-dim);
  transition: color 0.3s var(--ease), transform 0.5s var(--ease);
  transform-origin: left center;
}

.w-kind {
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--muted);
  text-align: right;
}

.w-year {
  font-family: var(--mono);
  font-size: var(--t-label);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.18em;
  color: var(--faint);
  white-space: nowrap;
  text-align: right;
}

/* the only row state there is: the rule gets stronger, the number goes accent,
   the title comes up to full ink and steps 6px right */
.w-row:hover,
.w-row:focus-visible {
  border-top-color: var(--line-strong);
  box-shadow: inset 0 1px 0 0 var(--line-strong);
}

.w-row:hover .w-idx,
.w-row:focus-visible .w-idx {
  color: var(--accent);
}

.w-row:hover .w-title,
.w-row:focus-visible .w-title {
  color: var(--ink);
  transform: translate3d(6px, 0, 0);
}

.w-row:focus-visible {
  outline-offset: 2px;
}

@media (max-width: 900px) {
  .w-row {
    grid-template-columns: 2.4ch minmax(0, 1fr) auto;
    row-gap: 5px;
  }

  .w-idx {
    grid-column: 1;
    grid-row: 1;
  }

  .w-title {
    grid-column: 2;
    grid-row: 1;
  }

  .w-kind {
    grid-column: 2 / -1;
    grid-row: 2;
    text-align: left;
    font-size: 0.82rem;
  }

  .w-year {
    grid-column: 3;
    grid-row: 1;
  }
}

/* ---------- §04 the pointer preview -------------------------------------
   One element for the whole list. Hover-capable pointers only — no touch, no
   reduced motion (the module does not even create it then). z-index sits
   under the topbar (50) and under the grain (60).
   ---------------------------------------------------------------------- */
.w-preview {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  width: clamp(260px, 26vw, 420px);
  aspect-ratio: 16 / 10;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(-60vw, -60vh, 0) translate(-50%, -50%);
  transition: opacity 0.32s var(--ease);
  background: #0a0a0a;
  border: 1px solid rgba(244, 244, 242, 0.34); /* --faint: an edge, not a frame */
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.6);
  will-change: transform, opacity;
}

.w-preview.is-on {
  opacity: 1;
}

.w-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ============================================================================
   PROJECT VIEW — full screen, opaque, above everything but the skip link.
   ========================================================================= */
#project-root[data-open="true"] {
  position: relative;
}

.pv {
  position: fixed;
  inset: 0;
  z-index: 70;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg);
  padding: clamp(14px, 2.2vh, 26px) var(--gutter) clamp(46px, 8vh, 96px);
  /* closed by default: the node is built once and then parked, not rebuilt */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* the entrance runs each time the root flips to open */
#project-root[data-open="true"] .pv {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  animation: pv-in 0.42s var(--ease) both;
}

@keyframes pv-in {
  from {
    opacity: 0;
    transform: translate3d(0, 10px, 0);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.pv-top {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 0 clamp(12px, 2vh, 20px);
  background: var(--bg);
  font-family: var(--mono);
  font-size: var(--t-label);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.pv-close,
.pv-step {
  appearance: none;
  border: 0;
  background: none;
  padding: 6px 0;
  margin: 0;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: var(--ink);
  cursor: pointer;
  transition: color 0.3s var(--ease);
}

.pv-close:hover,
.pv-step:hover {
  color: var(--accent);
}

.pv-nav {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 26px);
}

/* coarse pointers get a real tap target, not a 22px hairline */
@media (hover: none) {
  .pv-close,
  .pv-step {
    padding: 13px 0;
  }
}

.pv-count {
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.pv-nav-sep {
  color: var(--faint);
}

.pv-shot {
  /* the plate is one fixed 16:10 block; the rule above it is exactly as wide */
  width: min(100%, calc(62vh * 1.6));
  margin: 0;
  border-top: 1px solid var(--line);
}

.pv-img {
  display: block;
  width: 100%;
  /* a true 16:10 box that never runs past the fold */
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #0b0b0b;
}

.pv-body {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(22px, 4vw, 76px);
  align-items: start;
  margin-top: clamp(20px, 3vh, 40px);
  border-top: 1px solid var(--line);
  padding-top: clamp(16px, 2.6vh, 32px);
}

.pv-no {
  font-family: var(--mono);
  font-size: var(--t-label);
  letter-spacing: 0.28em;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.pv-title {
  margin-top: 12px;
  font-size: var(--t-xl);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.02;
  text-wrap: balance;
}

.pv-kind {
  margin-top: 16px;
  font-family: var(--mono);
  font-size: var(--t-label);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.pv-copy {
  max-width: 62ch;
}

.pv-blurb {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--muted);
}

.pv-detail {
  margin-top: 18px;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--muted);
}

.pv-stack {
  display: flex;
  flex-wrap: wrap;
  margin-top: clamp(20px, 3vh, 34px);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.pv-stack li {
  padding: 10px 0;
  font-family: var(--mono);
  font-size: var(--t-label);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.pv-stack li + li {
  margin-left: 14px;
  padding-left: 14px;
  border-left: 1px solid var(--line);
}

.pv-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  margin-top: clamp(20px, 3vh, 34px);
  font-family: var(--mono);
  font-size: var(--t-label);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.pv-links a {
  color: var(--ink);
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 3px;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}

.pv-links a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.pv-none {
  color: var(--faint);
}

@media (max-width: 900px) {
  .pv-body {
    grid-template-columns: 1fr;
    gap: 26px;
  }

  .pv-top {
    font-size: 0.6rem;
    letter-spacing: 0.16em;
  }

  .pv-nav {
    gap: 12px;
  }
}

/* ============================================================================
   §05 CONTACT
   ========================================================================= */
.c-mail {
  display: inline-block;
  font-size: var(--t-xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.04;
  color: var(--ink);
  overflow-wrap: anywhere;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-strong);
  transition: color 0.35s var(--ease), border-color 0.35s var(--ease);
}

.c-mail:hover,
.c-mail:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
}

/* below ~560px the address would break mid-domain at t-xl's floor: give it the
   6.4vw it needs to stay on one line instead */
@media (max-width: 560px) {
  .c-mail {
    font-size: min(1.9rem, 6.4vw);
  }
}

.c-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px clamp(20px, 3vw, 44px);
  margin-top: clamp(26px, 4.5vh, 52px);
  font-family: var(--mono);
  font-size: var(--t-label);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.c-gh {
  color: var(--ink);
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 3px;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}

.c-gh:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.c-loc {
  color: var(--muted);
}

.c-note {
  margin-top: 18px;
  max-width: 44ch;
  font-size: 0.9rem;
  color: var(--faint);
}

/* full-bleed band, type only: negative gutters take it to the section edge,
   which is the viewport edge below --maxw. No 100vw maths, so no scrollbar
   overflow. One hairline above, one below; the word is set in outline and
   cropped by the edges. */
.c-band {
  position: relative;
  display: grid;
  place-items: center;
  margin-inline: calc(var(--gutter) * -1);
  margin-top: clamp(40px, 7vh, 92px);
  margin-bottom: calc(var(--rhythm) * -1);
  height: clamp(170px, 26vh, 280px);
  padding-bottom: 16px; /* the bottom strip belongs to the coordinate label */
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.c-band-word {
  display: block;
  white-space: nowrap;
  /* briefed as ~9vw; in this sans the phrase measures 7.41em of width per 1em
     of type, so 9vw would leave a third of the band empty. Pitched at 14.4vw
     (capped by --maxw) the word actually runs through both section edges. */
  font-size: clamp(3.4rem, 14.4vw, 15rem);
  font-weight: 600;
  letter-spacing: 0.14em;
  line-height: 1;
  /* solid fallback; the @supports block below turns it into outline type */
  color: var(--ink);
  /* letter-spacing trails the last glyph — pull it back so the word optically
     centres on its inked edges */
  margin-right: -0.14em;
  user-select: none;
}

@supports ((-webkit-text-stroke: 1px #000) or (text-stroke: 1px #000)) {
  .c-band-word {
    color: transparent;
    -webkit-text-stroke: 1px var(--ink);
  }
}

.c-band-coord {
  position: absolute;
  right: var(--gutter);
  bottom: 13px;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--faint);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .pv {
    animation: none;
  }

  .w-row,
  .w-title,
  .w-idx,
  .w-preview,
  .c-mail,
  .c-gh,
  .pv-close,
  .pv-step {
    transition: none;
  }
}
