/* Flatbed · the site · a case study page (work/*.html, written by tools/case-page.py).
   The prompt beside the film it produced, then the notes that steered it, drawn in the studio's own marks
   (how.css: corners). Motion is CSS only; none with reduced motion. */

.case { --box: rgba(14, 14, 14, 0.82); --soft: rgba(237, 237, 237, 0.72); }
.foot .mark-logo { width: 20px; height: 20px; fill: var(--bone); }

.case-hero { padding-top: 112px; }
.case-hero h1 { font-size: clamp(3rem, 7vw, 6.5rem); }
.case-hero .lede { margin-top: 16px; max-width: 32em; color: var(--grey); text-wrap: pretty; }
.case .section__head .lede { text-wrap: balance; }

/* ---------- the prompt beside the film, tops and captions on one line ---------- */
.pair { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: stretch; gap: clamp(24px, 3.4vw, 52px); margin-top: clamp(32px, 5vh, 52px); }
.pair__film { scroll-margin-top: 24px; }
.pair__ask, .pair__film { display: flex; flex-direction: column; margin: 0; }
.pair__head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; color: var(--ink); font-weight: 600; font-size: 0.9375rem; }
.pair__head span { color: var(--quiet); font-weight: 400; }
/* the prompt, as the box it was typed into: the text, a caret where typing stopped, and the send button */
.promptbox { flex: 1; display: flex; flex-direction: column; border-radius: 18px; background: #141414; box-shadow: inset 0 0 0 1px rgba(237, 237, 237, 0.07); }
.promptbox__text { padding: 22px 24px 0; color: var(--ink); font-size: 1.0625rem; line-height: 1.45; letter-spacing: -0.005em; }
.promptbox__text p { text-wrap: pretty; }
.promptbox__text p + p { margin-top: 0.7em; }
.caret { display: inline-block; width: 2px; height: 1.1em; margin-left: 3px; border-radius: 1px; background: var(--bone); vertical-align: -0.2em; }
.promptbox__bar { display: flex; justify-content: flex-end; margin-top: auto; padding: 8px 10px 10px; }
.promptbox__send { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--bone); }
.promptbox__send svg { width: 17px; height: 17px; fill: none; stroke: var(--on-bone); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.film__pic { position: relative; border-radius: 18px; overflow: hidden; background: #000; aspect-ratio: 16 / 9; }
.film__pic video { width: 100%; height: 100%; object-fit: cover; }

/* ---------- a frame: grain, and a chip in the corner as the studio labels a cut ---------- */
.shot { position: relative; margin: 0; border-radius: 12px; overflow: hidden; background: #000; aspect-ratio: 16 / 9; container-type: inline-size; }
.shot img { width: 100%; height: 100%; object-fit: cover; transition: transform 600ms var(--out); }
.shot::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: url("../media/grain.png") 0 0 / 160px 160px; opacity: 0.1; pointer-events: none; }
/* a faint edge on the grain layer, so a dark frame never reads as a hole in the page */
.shot { outline: 1px solid rgba(230, 214, 180, 0.1); outline-offset: -1px; }
.pickopt:not(.is-picked) img { filter: saturate(0.7) brightness(0.8); }
.chip { position: absolute; z-index: 3; left: clamp(8px, 3cqw, 18px); top: clamp(8px, 3cqw, 18px); display: inline-flex; align-items: center; gap: 5px; height: clamp(22px, 6cqw, 30px); padding: 0 clamp(9px, 2.6cqw, 13px); border-radius: 999px; background: var(--box); color: var(--ink); font-size: clamp(11px, 3cqw, 13.5px); white-space: nowrap; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.shot.is-final .chip { background: var(--bone); color: var(--on-bone); }
.chip .ico { width: 1.15em; height: 1.15em; stroke: var(--bone); stroke-width: 2.4; }


/* the soundtrack along the foot of a frame: bars, or a flat line where there was none */
.wave { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; display: flex; align-items: flex-end; gap: 2.4cqw; padding: 10cqw 4cqw 4cqw; background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.72)); }
.wave svg { display: block; width: 100%; height: 8cqw; fill: var(--bone); opacity: 0.9; }
.audio { display: flex; align-items: center; gap: 14px; width: 100%; padding: 10px 16px 10px 10px; border: 0; border-radius: 999px; background: var(--fill); color: var(--grey); font: inherit; font-size: 0.875rem; cursor: pointer; text-align: left; }
.audio[hidden], .audio-still[hidden] { display: none; }
.audio-still { display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-radius: 999px; background: var(--fill); }
.audio svg, .audio-still svg { display: block; width: 100%; height: 24px; fill: var(--bone); }
.audio__label { flex: none; white-space: nowrap; }
.wave__btn { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--bone); transition: transform 200ms var(--ui); }
.wave__btn svg { width: 16px; height: 16px; margin-left: 2px; fill: var(--on-bone); }
.wave__bars { position: relative; flex: 1; }
.wave__bars > svg { opacity: 0.38; }
.wave__fill { position: absolute; inset: 0; clip-path: inset(0 calc(100% - var(--p, 0%)) 0 0); }
.wave__fill svg { opacity: 1; }
.audio:active .wave__btn { transform: scale(0.94); }
@media (hover: hover) and (pointer: fine) { .audio:hover .wave__btn { transform: scale(1.06); } .audio:hover { color: var(--ink); } }
.audio.is-on .wave__btn svg { margin-left: 0; }
.wave--silent i { flex: 1; height: 1px; margin-bottom: 1.6cqw; background: rgba(237, 237, 237, 0.4); }
.wave--silent span { color: var(--grey); font-size: clamp(10px, 3.2cqw, 13px); line-height: 1; white-space: nowrap; }

/* the spot the note was about: four corners, as the studio marks a frame (how.css's .how__region) */
.mark { position: absolute; z-index: 2; left: var(--l); top: var(--t); width: var(--w); height: var(--h); }
.mark i { position: absolute; width: clamp(8px, 3.4cqw, 18px); aspect-ratio: 1; border: 0 solid var(--bone); --s: clamp(1.5px, 0.55cqw, 2.5px); }
.mark i:nth-child(1) { left: 0; top: 0; border-top-width: var(--s); border-left-width: var(--s); }
.mark i:nth-child(2) { right: 0; top: 0; border-top-width: var(--s); border-right-width: var(--s); }
.mark i:nth-child(3) { left: 0; bottom: 0; border-bottom-width: var(--s); border-left-width: var(--s); }
.mark i:nth-child(4) { right: 0; bottom: 0; border-bottom-width: var(--s); border-right-width: var(--s); }

/* ---------- the notes: the words across the top, then the two cuts ---------- */
.steers { display: grid; margin: 28px 0 0; padding: 0; list-style: none; }
.steer { display: grid; gap: 28px; padding: clamp(44px, 7vh, 72px) 0; box-shadow: inset 0 1px rgba(237, 237, 237, 0.08); }
.steer--pick { gap: 28px; padding-top: 0; box-shadow: none; }
.steer__words { display: grid; grid-template-columns: minmax(0, 5fr) 40px minmax(0, 7fr); align-items: start; }
.steer__words > :not(:first-child) { grid-column: 3; }
.steer--pick .steer__words { grid-template-columns: minmax(0, 1fr); max-width: 46em; }
.steer--pick .steer__words > * { grid-column: 1; }
/* before and after at one size, an arrow between them */
.pair2 { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); column-gap: 40px; align-items: start; }
.pair2__b { position: relative; }
.pair2__arrow { position: absolute; left: calc(100% + 9px); top: 50%; margin-top: -11px; width: 22px; height: 22px; background: var(--bone); opacity: 0.75; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12h15M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12h15M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat; }
.steer .audio, .steer .audio-still { width: calc((100% - 40px) * 7 / 12); margin-left: auto; margin-top: -16px; }
.shot--before.shot { overflow: hidden; }
.steer blockquote { margin: 0; }
/* the note in his words; the opening quote hangs outside the text so every line starts on one edge */
.steer blockquote p { position: relative; max-width: 34em; color: var(--bone); font-size: clamp(1.0625rem, 1.3vw, 1.1875rem); line-height: 1.45; text-wrap: pretty; }
.steer blockquote p::before { content: "\201C"; position: absolute; right: 100%; padding-right: 0.06em; }
.steer blockquote p::after { content: "\201D"; }
.steer__lead { color: var(--ink); font-size: clamp(1.125rem, 1.45vw, 1.3125rem); line-height: 1.45; text-wrap: pretty; }
.steer__result { max-width: 52ch; padding-top: 3px; color: var(--soft); font-size: 1rem; line-height: 1.5; }
.steer__aside > :first-child { margin-top: 0; }
.steer--pick .steer__aside { margin-top: 18px; }
.steer__when { margin-top: 10px; color: var(--quiet); font-size: 0.875rem; }
.steer__when.is-final { color: var(--bone); }
.shot--before { border-radius: 12px; }
.shot--before img { filter: saturate(0.65) brightness(0.82); }
/* the edge sits above the dimmed picture, so a dark before frame keeps its outline */
.pair2__b::after { content: ""; position: absolute; inset: 0; z-index: 5; border-radius: 12px; box-shadow: inset 0 0 0 1px rgba(230, 214, 180, 0.14); pointer-events: none; }
/* the three pitches; the one that became the film carries the check */
.picks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.pickopt p { margin-top: 12px; color: var(--quiet); font-size: 0.875rem; line-height: 1.45; }
.pickopt.is-picked p { color: var(--soft); }
.shot--pick { border-radius: 10px; }
.pickopt:not(.is-picked) .shot--pick { opacity: 0.6; }
.shot--pick.is-picked::before { content: ""; position: absolute; inset: 0; z-index: 4; border-radius: inherit; box-shadow: inset 0 0 0 2px var(--bone); pointer-events: none; }

.total { margin-top: clamp(40px, 6vh, 64px); padding-top: 28px; box-shadow: inset 0 1px rgba(237, 237, 237, 0.08); color: var(--ink); font-size: clamp(1.125rem, 1.45vw, 1.3125rem); line-height: 1.45; text-wrap: pretty; }
.case .cta { padding-top: clamp(96px, 13vh, 140px); }
.cta .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; }

/* ---------- motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .caret { animation: blink 1.1s steps(1) infinite; }
  @keyframes blink { 50% { opacity: 0; } }
  @supports (animation-timeline: view()) {
    .steer { animation: rise linear both; animation-timeline: view(); animation-range: entry 0% entry 60%; }
    @keyframes rise { from { opacity: 0; transform: translateY(18px); } }
    .mark i { animation: snap linear both; animation-timeline: view(); animation-range: entry 35% entry 80%; }
    .mark i:nth-child(1) { --dx: -6px; --dy: -6px; } .mark i:nth-child(2) { --dx: 6px; --dy: -6px; }
    .mark i:nth-child(3) { --dx: -6px; --dy: 6px; } .mark i:nth-child(4) { --dx: 6px; --dy: 6px; }
    @keyframes snap { from { opacity: 0; transform: translate(var(--dx), var(--dy)); } }
    .shot--after { animation: wipe linear both; animation-timeline: view(); animation-range: entry 45% entry 100%; }
    @keyframes wipe { from { clip-path: inset(0 100% 0 0 round 12px); } to { clip-path: inset(0 0 0 0 round 12px); } }
  }
}

@media (max-width: 860px) {
  .pair { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .steer__words { grid-template-columns: minmax(0, 1fr); }
  .steer__words > :first-child { margin-bottom: 14px; }
  .steer__words > :not(:first-child) { grid-column: 1; }
}
/* on a phone: his words, then the two cuts stacked, the earlier one smaller */
@media (max-width: 600px) {
  .pair2 { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .pair2 { row-gap: 30px; }
  .pair2__arrow { left: 50%; top: calc(100% + 6px); margin: 0 0 0 -9px; transform: rotate(90deg); width: 18px; height: 18px; }
  .steer .audio, .steer .audio-still { width: 100%; margin-top: -12px; }
  .picks { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; grid-auto-flow: row !important; grid-auto-columns: auto !important; overflow: visible !important; margin: 0 !important; padding: 0 !important; }
  .pickopt.is-picked { grid-column: 1 / -1; order: -1; }
  .pickopt p { font-size: 0.8125rem; }
}
@media (max-width: 720px) {
  .case-hero { padding-top: 104px; }
  .pair { gap: 28px; }
  .promptbox { border-radius: 16px; }
  .promptbox__text { padding: 18px 18px 0; font-size: 0.9375rem; }
  .film__pic { border-radius: 12px; }
  .section { padding-top: 96px; }
  .steer { gap: 18px; padding: 36px 0; }
  .steer blockquote p { font-size: 1.0625rem; }
  .steer blockquote p::before { position: static; padding-right: 0; }
  .case .section__head + .steers { margin-top: 12px; }
  .picks { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 74%; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: var(--m); margin: 0 calc(-1 * var(--m)); padding: 0 var(--m); scrollbar-width: none; }
  .picks::-webkit-scrollbar { display: none; }
  .pickopt { scroll-snap-align: start; }
}

/* ---------- the background (js/case-bg.js): the film's notebook drawings, lit by the pointer ---------- */
.bgx { position: relative; isolation: isolate; }
.bgx-ink, .bgx-glow { pointer-events: none; z-index: -1; }
/* the notebook's drawings: faint everywhere, lit where the lamp (the pointer) is */
.bgx-ink { position: absolute; left: 0; right: 0; top: 0; overflow: hidden; opacity: 0.05; }
.bgx-ink img { position: absolute; width: auto; }
.bgx-ink--lit { opacity: 0.62; -webkit-mask-image: radial-gradient(circle 250px at var(--lx, 50%) var(--ly, 40%), #000 0%, rgba(0, 0, 0, 0.55) 45%, transparent 100%); mask-image: radial-gradient(circle 250px at var(--lx, 50%) var(--ly, 40%), #000 0%, rgba(0, 0, 0, 0.55) 45%, transparent 100%); }
.bgx-glow { position: fixed; inset: 0; background: radial-gradient(circle 360px at var(--gx, 50%) var(--gy, 40%), rgba(255, 208, 150, 0.075), transparent 70%); }
