/* DIGITHRONEX · The Cut · Work: what stayed.
   - 01 What stayed: the title window (scenes.css), pinned while the scroll flies into its letters (opening.js); then
     the film fills the screen and a glass slate names each piece as it cuts on.
   - 02–05 four chapters, each opened by a caption beat (story.css), each laid out its own way: a double feature under
     a running clock, three phones, a walk-through flown by the scroll (flight.js), and our own two.
   - Every piece keeps its own shape (16:9 wide, 9:16 tall); a silent preview plays on hover, and a press opens the
     screening overlay with sound (work-page.js).
   - 06 The archive: our portfolio drive behind one glass link, over an endless film strip; the glass bends the strip
     passing behind it (archive-lens.js). Load after home.css, story.css and scenes.css. */

/* ---------- 01 What stayed ---------- */
.opening-track { position: relative; height: 280vh; }
.opening-stage { position: sticky; top: 0; height: 100vh; overflow: hidden; }
/* until the script has the title in hand, the line under it waits for its entrance. Arriving from the home page's
   post-credits scene, it's already on screen. Without the script, it shows after a moment. */
.rise-run:not([data-arrival="same"]) .opening:not(.is-in) .tw-lead { opacity: 0; animation: dx-failsafe 1ms linear 2.5s forwards; }

/* the slate: which piece is on screen, a way into it with sound, and the seven in their running order. The film under
   it changes every frame, so its glass is smoked rather than frosted (a live blur of it would cost more than a frame). */
.tw-slate {
  position: absolute; left: var(--margin); bottom: clamp(24px, 6.5vh, 76px); z-index: 3;
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 14px 16px;
  width: min(430px, calc(100% - 2 * var(--margin))); padding: 16px 22px 16px 16px;
  font: inherit; text-align: left; color: #F1F2F4; border: 0; cursor: pointer;
  -webkit-backdrop-filter: none; backdrop-filter: none; --glass-fill: color-mix(in srgb, var(--spill) 7%, rgba(14, 16, 20, .72));
  opacity: 0; visibility: hidden; transform: translateY(18px);
  transition: opacity calc(8 * var(--f)) linear, transform calc(14 * var(--f)) var(--ease-focus), visibility 0s linear calc(14 * var(--f));
}
.opening.is-through .tw-slate { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.tw-slate:focus-visible { outline: 2px solid var(--d-signal); outline-offset: 3px; }
.tw-slate-play { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; --glass-fill: rgba(241, 242, 244, .08); transition: transform calc(10 * var(--f)) var(--ease-focus); }
.tw-slate-play .lp-icon { margin-left: 3px; border-width: 7px 0 7px 11px; }
.tw-slate:hover .tw-slate-play { transform: scale(1.06); }
.tw-slate-text { display: grid; gap: 3px; min-width: 0; }
.tw-slate-kicker { color: rgba(241, 242, 244, .62); }
.tw-slate-title { font-stretch: 112.5%; font-weight: 560; font-size: clamp(19px, 1.6vw, 23px); line-height: 1.15; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tw-slate-meta { color: rgba(241, 242, 244, .7); }
/* the running order, drawn like the top bar's track: what's been on, and how far into the one on now */
.tw-slate-run { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; height: 2px; }
.tw-slate-run i { position: relative; overflow: hidden; background: rgba(241, 242, 244, .2); }
.tw-slate-run b { position: absolute; inset: 0; transform-origin: 0 50%; transform: scaleX(0); background: var(--brand-azure); }
.tw-slate-run .is-past b { transform: none; opacity: .5; }
.tw-slate-run .is-now b { transform: scaleX(var(--p, 0)); }
/* a word to say the title can be gone into, once it has stood a moment */
.tw-hint {
  position: absolute; left: 50%; bottom: clamp(22px, 4.5vh, 52px); z-index: 2; margin: 0; transform: translateX(-50%);
  color: rgba(241, 242, 244, .6); opacity: 0; transition: opacity calc(10 * var(--f)) linear;
}
.opening.is-in:not(.is-moved) .tw-hint { opacity: 1; transition-delay: 1.4s; }
@media (max-width: 700px) {
  .tw-slate { right: var(--margin); width: auto; padding: 14px 18px 14px 14px; gap: 12px 14px; }
  .tw-slate-play { width: 40px; height: 40px; }
}
/* reduced motion: the title stands still, with its slate under it */
.opening.is-static .opening-track { height: auto; }
.opening.is-static .opening-stage { position: relative; }
.opening.is-static .tw-hint { display: none; }

/* ---------- The chapters ---------- */
.chapter-body { position: relative; padding-block: clamp(80px, 9vw, 150px) clamp(96px, 11vw, 180px); }
.ch-head { display: grid; gap: 14px; margin-bottom: clamp(32px, 4vw, 60px); max-width: 56rem; }
.ch-head .eyebrow { color: rgba(241, 242, 244, .7); }
.ch-title { font-size: clamp(38px, 5vw, 86px); color: #F1F2F4; text-wrap: balance; }
.ch-slot { min-width: 0; }

/* 02 The first minute: a double feature under a clock that runs toward a minute as you pass */
.ch-first { overflow: clip; }
.ch-first .wrap { position: relative; z-index: 1; }
.ch-clock {
  position: absolute; right: var(--margin); top: clamp(36px, 5vw, 90px); z-index: 0; margin: 0; pointer-events: none; white-space: nowrap;
  font-size: clamp(54px, 10.5vw, 188px); line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums;
  color: rgba(241, 242, 244, .08); transition: color calc(12 * var(--f)) linear;
}
.ch-clock.is-late { color: rgba(1, 128, 255, .34); }
.double { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gutter); }

/* 03 Svenska. Suomi.: three phones */
.phones { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gutter); max-width: 1060px; }

/* 04 The walk-through: the drone shot, flown by the scroll */
.flight-track { position: relative; height: 320vh; }
.flight-stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; background: #050607; }
.flight-poster, .flight-canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.flight-canvas { opacity: 0; }
.flight.is-live .flight-canvas { opacity: 1; }
.flight-nd { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(11, 12, 14, .74), rgba(11, 12, 14, .18) 52%, rgba(11, 12, 14, 0)), linear-gradient(0deg, rgba(11, 12, 14, .56), rgba(11, 12, 14, 0) 34%); }
.flight-card {
  position: absolute; left: var(--margin); bottom: clamp(28px, 7vh, 84px); z-index: 2; width: min(540px, calc(100% - 2 * var(--margin)));
  display: grid; gap: 14px; justify-items: start; padding: clamp(24px, 2.6vw, 40px);
}
/* The picture under these two changes every frame (the flight, the running strip): a live blur of it would cost more
   than a frame on an ordinary laptop, so their glass is smoked rather than frosted, with the same rim and cut.
   The flight darkens its left side for the card anyway. In lens mode the archive card has no glass of its own. */
.flight.is-live .flight-card, .archive-card { -webkit-backdrop-filter: none; backdrop-filter: none; --glass-fill: color-mix(in srgb, var(--spill) 7%, rgba(14, 16, 20, .7)); }
.flight-card .label { color: rgba(241, 242, 244, .76); }
.flight-card .ch-title { font-size: clamp(30px, 3.5vw, 56px); }
.flight-play { margin-top: 6px; }
.flight-tc { position: absolute; right: var(--margin); top: clamp(76px, 11vh, 118px); z-index: 2; display: flex; align-items: center; gap: 10px; margin: 0; color: rgba(241, 242, 244, .88); font-variant-numeric: tabular-nums; }
.flight-rec { width: 7px; height: 7px; border-radius: 50%; background: var(--brand-azure); box-shadow: 0 0 0 3px rgba(1, 128, 255, .22); }
.flight-hint { position: absolute; right: var(--margin); bottom: clamp(28px, 7vh, 84px); z-index: 2; margin: 0; color: rgba(241, 242, 244, .62); transition: opacity calc(10 * var(--f)) linear; }
.flight.is-moved .flight-hint { opacity: 0; }

/* 05 Our own: the ad and the site, one height */
.pair { display: grid; grid-template-columns: minmax(0, .5625fr) minmax(0, 1.7778fr); gap: var(--gutter); align-items: start; max-width: 1200px; }

/* A chapter laid out as a row (one the team added in the admin): the films side by side at one height, a wide one
   taking the room of a 16:9 frame beside an upright one's 9:16, wrapping onto the next line when they run out of room */
.ch-row { display: flex; flex-wrap: wrap; gap: var(--gutter); align-items: start; }
.ch-row .ch-slot--tall { flex: .5625 1 220px; max-width: 420px; }
.ch-row .ch-slot--wide { flex: 1.7778 1 440px; max-width: 980px; }

/* ---------- A piece of work ---------- */
.pc-frame {
  --c: 18px;
  position: relative; display: block; width: 100%; padding: 0; border: 0; overflow: hidden; cursor: pointer; color: #fff;
  aspect-ratio: 16 / 9; background: #050607; text-decoration: none;
  clip-path: polygon(0 0, calc(100% - var(--c)) 0, 100% var(--c), 100% 100%, 0 100%);
}
.piece--tall .pc-frame { aspect-ratio: 9 / 16; }
.pc-poster, .pc-preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform calc(18 * var(--f)) var(--ease-focus); }
.pc-preview { opacity: 0; transition: opacity calc(6 * var(--f)) linear, transform calc(18 * var(--f)) var(--ease-focus); }
.pc-frame.is-playing .pc-preview { opacity: 1; }
.pc-frame:hover .pc-poster, .pc-frame:hover .pc-preview, .pc-frame:focus-visible .pc-poster, .pc-frame:focus-visible .pc-preview { transform: scale(1.035); }
/* the brand cut's polished edge on each frame */
.pc-frame::after {
  content: ""; position: absolute; top: 0; right: 0; width: var(--c); height: var(--c); z-index: 2; pointer-events: none;
  background: linear-gradient(to top right, transparent calc(50% - .75px), rgba(255, 255, 255, .75) calc(50% - .75px), rgba(255, 255, 255, .75) calc(50% + .75px), transparent calc(50% + .75px));
}
.pc-tag { position: absolute; left: 10px; top: 10px; z-index: 2; display: inline-flex; gap: 10px; padding: 6px 9px; font-size: 10.5px; color: rgba(241, 242, 244, .9); --glass-fill: rgba(14, 16, 20, .3); }
/* the film's own timecode, running while its preview plays */
.pc-tc { font-variant-numeric: tabular-nums; color: rgba(241, 242, 244, .72); }
.pc-tc:empty { display: none; }
.pc-play {
  position: absolute; left: 12px; bottom: 12px; z-index: 2; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%;
  opacity: 0; transform: translateY(6px) scale(.94); transition: opacity calc(6 * var(--f)) linear, transform calc(10 * var(--f)) var(--ease-focus);
  --glass-fill: rgba(14, 16, 20, .28);
}
.pc-play .lp-icon { margin-left: 3px; border-width: 7px 0 7px 11px; }
.pc-frame:hover .pc-play, .pc-frame:focus-visible .pc-play { opacity: 1; transform: none; }
.pc-frame:focus-visible { outline: 2px solid var(--d-signal); outline-offset: 3px; }
.pc-cap { padding: 12px 2px 6px; display: grid; gap: 4px; }
.pc-title { font-size: 16.5px; font-weight: 560; line-height: 1.25; letter-spacing: -.005em; color: #F1F2F4; }
/* kind and runtime, then the role: a separator that falls at the start of a line is clipped off */
.pc-meta, .pc-role { font-family: var(--font-mono); font-stretch: 87.5%; font-size: 11.5px; line-height: 1.5; letter-spacing: .02em; }
.pc-meta { display: flex; flex-wrap: wrap; margin-left: -1.6em; clip-path: inset(0 0 0 1.6em); color: rgba(241, 242, 244, .7); }
.pc-meta > span::before { content: "·"; display: inline-block; width: 1.6em; text-align: center; opacity: .6; }
.pc-role { color: rgba(241, 242, 244, .52); }
/* a small original is never shown larger than it can stay sharp */
.piece--small { max-width: 360px; }

/* Case 00: this site, drawn from its own plan */
.pc-case {
  display: block; background:
    linear-gradient(135deg, rgba(1, 128, 255, .1), rgba(1, 128, 255, 0) 50%),
    radial-gradient(120% 90% at 20% 110%, #16181c, #0b0c0e 60%);
  container-type: size;
}
.pc-case-plan {
  position: absolute; inset: 8% 6%; z-index: 0;
  background: repeating-linear-gradient(90deg, rgba(1, 128, 255, .16) 0 1px, transparent 1px calc(100% / 12));
  -webkit-mask-image: linear-gradient(90deg, #000, rgba(0, 0, 0, .35)); mask-image: linear-gradient(90deg, #000, rgba(0, 0, 0, .35));
  transition: opacity calc(10 * var(--f)) linear; opacity: .7;
}
.pc-case::before { /* the cut, at the brand angle, from the plan to the page */
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(135deg, transparent calc(58% - .6px), rgba(1, 128, 255, .8) calc(58% - .6px), rgba(1, 128, 255, .8) calc(58% + .6px), transparent calc(58% + .6px));
}
.pc-case-line {
  position: absolute; left: 7%; bottom: 12%; z-index: 1; display: grid;
  font-stretch: 75%; font-weight: 680; font-size: min(15cqh, 9cqw); line-height: .88; letter-spacing: -.012em; color: #F1F2F4;
}
.pc-case-go { position: absolute; right: 16px; bottom: 14px; z-index: 2; color: rgba(241, 242, 244, .82); transition: transform calc(8 * var(--f)) var(--ease-focus); }
.pc-case:hover .pc-case-plan { opacity: 1; }
.pc-case:hover .pc-case-go { transform: translateX(4px); color: #fff; }

/* ---------- 06 The archive ---------- */
.archive { background: radial-gradient(70% 60% at 50% 70%, rgba(1, 128, 255, .07), transparent 70%), var(--d-ground); }
.archive-beat-bg { background-size: cover; background-position: center; }
.archive-stage {
  --sh: clamp(190px, 23vw, 330px); position: relative; overflow: clip; display: grid; place-items: center;
  min-height: clamp(520px, 56vw, 740px); margin-block: clamp(40px, 5vw, 80px) clamp(96px, 12vw, 180px);
}
/* the film strip: frames on film base, with sprocket holes above and below; it fades out at both edges */
.archive-strip {
  position: absolute; left: 0; top: 50%; height: var(--sh); margin-top: calc(var(--sh) / -2); z-index: 0;
  display: flex; width: max-content; will-change: transform;
}
.archive-run {
  display: flex; gap: 10px; height: 100%; padding: 16px 5px; box-sizing: border-box; background-color: #08090a;
  background-image:
    repeating-linear-gradient(90deg, transparent 0 9px, rgba(241, 242, 244, .16) 9px 19px, transparent 19px 28px),
    repeating-linear-gradient(90deg, transparent 0 9px, rgba(241, 242, 244, .16) 9px 19px, transparent 19px 28px);
  background-size: 100% 6px, 100% 6px; background-position: 0 5px, 0 calc(100% - 5px); background-repeat: repeat-x;
}
.archive-run img { height: 100%; width: auto; display: block; flex: none; filter: saturate(1.05); }
.archive-stage::before, .archive-stage::after { content: ""; position: absolute; top: 0; bottom: 0; width: clamp(60px, 12vw, 220px); z-index: 1; pointer-events: none; }
/* the glass lies over the strip and its edge fades (it draws the fades into what it bends), under the card's type */
.archive-stage::before { left: 0; background: linear-gradient(90deg, var(--d-ground), transparent); }
.archive-stage::after { right: 0; background: linear-gradient(270deg, var(--d-ground), transparent); }

/* the glass link */
.archive-card {
  position: relative; z-index: 3; width: min(660px, calc(100% - 2 * var(--margin))); display: grid; gap: 14px; justify-items: start;
  padding: clamp(28px, 3.2vw, 46px) clamp(26px, 3.4vw, 50px) clamp(28px, 3vw, 42px); color: #fff; text-decoration: none; cursor: pointer;
}
.archive-kicker { color: rgba(241, 242, 244, .74); }
.archive-title { font-size: clamp(30px, 3.6vw, 54px); color: #F1F2F4; text-wrap: balance; }
.archive-lead { color: rgba(241, 242, 244, .86); font-size: clamp(15.5px, 1.2vw, 18px); line-height: 1.5; max-width: 34em; text-wrap: pretty; }
.archive-go {
  margin-top: 10px; display: inline-flex; align-items: center; gap: 14px; padding: 15px 20px 15px 22px;
  font-stretch: 125%; font-weight: 620; font-size: 12px; letter-spacing: .09em; text-transform: uppercase;
  color: #0B0C0E; background: linear-gradient(180deg, #fff, #e6e8ec); box-shadow: 0 10px 30px -12px rgba(1, 128, 255, .55), inset 0 -1px 0 rgba(11, 12, 14, .14);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
}
.archive-arrow { display: inline-block; transition: transform calc(8 * var(--f)) var(--ease-focus); }
.archive-card:hover .archive-arrow, .archive-card:focus-visible .archive-arrow { transform: translate(3px, -3px); }
.archive-note { color: rgba(241, 242, 244, .6); }
.archive-card:focus-visible { outline: 2px solid var(--d-signal); outline-offset: 4px; }

/* in lens mode the slab is drawn behind the card, so the card keeps only its type */
.archive-lens { position: absolute; left: 0; top: 0; z-index: 2; display: block; pointer-events: none; }
/* never squeezed to the screen: the card plus its shadow's room is wider than a phone (as .hero-lens, 12 November 2026) */
.archive-lens { max-width: none; max-height: none; }
.lens-archive .archive-card { background: none; -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; clip-path: none; }
.lens-archive .archive-card::before, .lens-archive .archive-card::after { content: none; }

/* the piece's still, holding in the player until the film has its first frame */
.ov-still { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; z-index: 2; pointer-events: none; background: #000; }

@media (max-width: 900px) {
  .double { grid-template-columns: minmax(0, 1fr); }
  .ch-clock { top: 24px; right: auto; left: var(--margin); font-size: clamp(44px, 15vw, 88px); }
  /* the phones become a feed you swipe through */
  .phones { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 14px; margin-inline: calc(-1 * var(--margin)); padding-inline: var(--margin); scrollbar-width: none; }
  .phones .ch-slot { flex: none; width: min(64vw, 300px); scroll-snap-align: center; }
  /* a phone-width tall frame has room for the tag or the running timecode, not both: while it plays, the timecode */
  .pc-tag { white-space: nowrap; }
  .piece--tall .pc-frame.is-playing .pc-tag > span:first-child { display: none; }
  .flight-track { height: 280vh; }
  .flight-card { bottom: 92px; }
  .flight-hint { display: none; }
  .pair { grid-template-columns: minmax(0, 1fr); }
  .pair .ch-slot:first-child { width: min(66%, 320px); }
  .ch-row .ch-slot--wide { flex-basis: 100%; }
  .ch-row .ch-slot--tall { flex: none; width: min(66%, 320px); }
  .archive-stage { min-height: 560px; }
  .archive-card { gap: 12px; }
  .archive-go { padding: 14px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .pc-poster, .pc-preview, .pc-play, .archive-arrow, .ch-clock, .flight-hint { transition: none; }
}
