/* ==========================================================================
   "One studio. Every format." — a pinned stage. The section is tall; the pin
   inside it sticks for the whole scroll. Its height sets how long each device
   stays (js/formats.js reads it), so change the 4.71 / 4.3 to retime it.
   ========================================================================== */
.fmt { position: relative; z-index: 2; background: var(--bg); color: var(--fg); height: calc(100vh * 4.71); height: calc(100svh * 4.71); }
.fmt-pin { position: sticky; top: 0; height: 100vh; height: 100svh; min-height: 33.75rem; overflow: hidden; overflow: clip; }
.fmt-gl { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; pointer-events: none; opacity: 0; transition: opacity 0.9s var(--ease); }
.fmt-pin.is-3d .fmt-gl { opacity: 1; }

/* behind the device: its ratio in giant outline numerals, and a pool of accent light */
.fmt-ghost {
  position: absolute; z-index: 0; white-space: nowrap; opacity: 0; pointer-events: none; will-change: transform, opacity;
  transform: translate(-50%, -50%); line-height: 0.8; font-weight: 900; font-stretch: 125%; letter-spacing: -0.03em;
  color: transparent; -webkit-text-stroke: 1.5px var(--line-2);
}
.fmt-glow {
  position: absolute; z-index: 1; transform: translate(-50%, -46%); pointer-events: none; opacity: 0; border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 20%, transparent), color-mix(in srgb, var(--accent) 6%, transparent) 55%, transparent);
}
.fmt-flash { position: absolute; inset: 0; z-index: 4; background: #fff; opacity: 0; pointer-events: none; }
.fmt-flash.is-on { animation: fmt-flash 0.5s ease-out; }
@keyframes fmt-flash { 0% { opacity: 0; } 12% { opacity: 0.5; } 100% { opacity: 0; } }

.fmt-ui {
  position: relative; z-index: 2; height: 100%; display: grid; column-gap: var(--gutter);
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); grid-template-rows: auto minmax(0, 1fr);
  padding-top: 6.5rem; padding-bottom: clamp(1.125rem, 3.6vh, 2.75rem);
}
.fmt-head { grid-column: 1 / -1; }
.fmt-left { display: flex; flex-direction: column; min-height: 0; padding-top: clamp(0.875rem, 3.6vh, 3rem); }
.fmt-title { font-size: clamp(2rem, min(5vw, 8.4vh), 5.4rem); }
.fmt-lead { margin-top: clamp(0.625rem, 2.2vh, 1.5rem); max-width: 42ch; color: var(--dim); font-size: clamp(0.98rem, 1.2vw, 1.15rem); line-height: 1.45; }
.fmt-copy { display: grid; margin-top: auto; padding-top: 2vh; }
.fmt-item { grid-area: 1 / 1; visibility: hidden; display: grid; justify-items: start; align-content: end; will-change: transform; pointer-events: none; }
.fmt-item.is-active { pointer-events: auto; }
.fmt-item > * { will-change: transform, opacity; }
.fmt-shot { display: none; }
.fmt-meta { display: flex; gap: 1.125rem; align-items: baseline; color: var(--dim); }
.fmt-meta b { color: var(--accent-text); font-weight: 600; }
.fmt-name { margin-top: 0.75rem; font-size: clamp(1.7rem, min(3.5vw, 6.2vh), 3.5rem); font-stretch: 112%; line-height: 0.96; }
.fmt-desc { margin-top: clamp(0.625rem, 1.8vh, 1rem); max-width: 44ch; color: var(--dim); font-size: clamp(1rem, 1.22vw, 1.18rem); line-height: 1.5; }
.fmt-tags { display: flex; flex-wrap: wrap; gap: 0.375rem; margin-top: clamp(0.625rem, 2vh, 1.125rem); }
.fmt-tags li { border: 1px solid var(--line-2); padding: 0.375rem 0.625rem; font-size: 0.66rem; color: var(--fg); }
.fmt-item .btn { margin-top: clamp(0.75rem, 2.2vh, 1.375rem); }
.fmt-nav { display: flex; gap: 0.5rem; list-style: none; padding: 0; margin-top: clamp(1rem, 3.2vh, 2.25rem); }
.fmt-nav li { flex: 1; }
.fmt-nav button {
  position: relative; width: 100%; min-height: 2.75rem; text-align: left; padding: 0.75rem 0 0; border-top: 1px solid var(--line-2);
  font-family: var(--f-mono); font-size: 0.7rem; font-weight: 500; color: var(--faint); text-transform: uppercase; transition: color 0.3s;
}
.fmt-nav button b { font-weight: 600; margin-right: 0.375rem; }
.fmt-nav button::before { content: ""; position: absolute; left: 0; top: -1px; width: 100%; height: 2px; background: var(--accent); transform: scaleX(var(--p, 0)); transform-origin: 0 50%; }
.fmt-nav button:hover, .fmt-nav button[aria-current="true"] { color: var(--fg); }
.fmt-nav button[aria-current="true"] b { color: var(--accent-text); }
.fmt-stage { min-height: 0; margin-block: 1vh 5vh; }
.fmt-note { position: absolute; z-index: 2; right: var(--gutter); bottom: clamp(1.125rem, 3.6vh, 2.75rem); color: var(--faint); text-align: right; max-width: 46ch; }

/* short laptops: drop the lead so the copy keeps its room */
@media (max-height: 760px) and (min-width: 861px) { .fmt-lead { display: none; } .fmt-ui { padding-top: 5.75rem; } }

/* phones and tablets: title, then the device, then the words */
@media (max-width: 860px) {
  .fmt { height: calc(100vh * 4.3); height: calc(100svh * 4.3); }
  .fmt-pin { min-height: 0; }
  .fmt-ui { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) auto auto; padding-top: 5.25rem; padding-bottom: 0.875rem; }
  .fmt-left { display: contents; }
  .fmt-head .sec-label span:last-child { display: none; }
  .fmt-title { grid-row: 2; margin-top: 0.875rem; font-size: clamp(1.6rem, 8.2vw, 3rem); }
  .fmt-lead, .fmt-tags, .fmt-item .btn, .fmt-note { display: none; }
  .fmt-stage { grid-row: 3; margin-block: 0.375rem 0.5rem; }
  .fmt-copy { grid-row: 4; margin-top: 0; padding-top: 0; }
  .fmt-name { font-size: clamp(1.5rem, 7.4vw, 2.4rem); margin-top: 0.5rem; }
  .fmt-desc { font-size: 0.98rem; line-height: 1.42; margin-top: 0.5rem; }
  .fmt-nav { grid-row: 5; margin-top: 0.875rem; }
  .fmt-nav button { font-size: 0.62rem; }
  .fmt-ghost { -webkit-text-stroke-width: 1px; }
}

/* no WebGL, or reduced motion: the same four formats as plain cards */
.fmt.is-static { height: auto; padding-block: var(--sec-pad); }
.fmt.is-static .fmt-pin { position: static; height: auto; min-height: 0; overflow: visible; }
.fmt.is-static :is(.fmt-gl, .fmt-ghosts, .fmt-glow, .fmt-flash, .fmt-stage, .fmt-nav, .fmt-note) { display: none; }
.fmt.is-static .fmt-ui { display: block; padding-block: 0; }
.fmt.is-static .fmt-left { display: block; padding-top: clamp(1.75rem, 4vw, 3.5rem); }
.fmt.is-static .fmt-lead { display: block; }
.fmt.is-static .fmt-copy { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(2.25rem, 5vw, 4rem) var(--gutter); margin-top: clamp(2.25rem, 5vw, 4.5rem); }
.fmt.is-static .fmt-item { grid-area: auto; visibility: visible; pointer-events: auto; align-content: start; }
.fmt.is-static .fmt-shot { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; margin-bottom: 1.25rem; }
.fmt.is-static :is(.fmt-tags, .fmt-item .btn) { display: flex; }
@media (max-width: 700px) { .fmt.is-static .fmt-copy { grid-template-columns: minmax(0, 1fr); } }

/* light appearance: a touch more accent in the pool, since it sits on white */
@media (prefers-color-scheme: light) {
  .fmt-glow { background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 34%, transparent), color-mix(in srgb, var(--accent) 10%, transparent) 55%, transparent); }
  .fmt-flash { background: var(--accent); }
}
