/* vko.media /projects/workflow/: how photo, video, AI and 3D combine. Builds on site.css tokens; page-workflow.js fills the slots.
   Phone: one column. Desktop (≥1024px): title column on the left, the work on the right, max ~1320px wide. */
.wf { display: block; }
.wf section { scroll-margin-top: calc(var(--top) + 80px); }
.wf h2 { margin: 0; font-size: clamp(36px, 5.2vw, 72px); line-height: .92; font-weight: 500; letter-spacing: -.045em; text-wrap: balance; }

/* hero */
.wf-hero { padding: calc(var(--top) + 120px) var(--gutter) 24px; max-width: 1320px; margin: 0 auto; }
.wf-hero h1 { margin: 0; font-size: clamp(56px, 11vw, 168px); line-height: .86; font-weight: 500; letter-spacing: -.06em; text-wrap: balance; }
.wf-kicker { margin: 20px 0 0; font-size: clamp(20px, 2.2vw, 28px); line-height: 1.2; font-weight: 500; letter-spacing: -.02em; }

/* sections */
.wf-sec { display: grid; gap: 28px; padding: 96px var(--gutter) 0; max-width: 1320px; margin: 0 auto; }
.wf-head { display: grid; gap: 14px; align-content: start; }
.wf-credit { margin: 0; max-width: 340px; font-size: 16px; line-height: 1.45; }
.wf-body { min-width: 0; }

/* shared corner tag */
.wf-tag, .wf-cmp-tag { position: absolute; z-index: 3; top: 12px; padding: 4px 10px; border-radius: 999px; background: rgb(13 13 13 / .6); color: #FAFAFA; font-size: 12px; line-height: 16px; font-weight: 600; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); pointer-events: none; }
.wf-tag { left: 12px; }

/* 5. photo → 3D. Desktop: a carousel stage. Phone: one scene, full screen, pinned while the track scrolls */
.wf-stage { position: relative; aspect-ratio: 3 / 2; border-radius: 24px; overflow: hidden; background: var(--surface); touch-action: pan-y; outline: none; }
.wf-stage-poster, .wf-stage-gl { position: absolute; inset: 0; width: 100%; height: 100%; }
.wf-stage-poster { object-fit: cover; transition: opacity 500ms var(--ease); }
/* the live layer brings its own poster, so the outer one steps aside */
.wf-stage:has(.wf-stage-gl) .wf-stage-poster { opacity: 0; }
.wf-stage-gl canvas { touch-action: pan-y; }
.wf-stage:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.wf-arrow { position: absolute; z-index: 4; top: 50%; width: 48px; height: 48px; translate: 0 -50%; border: 0; border-radius: 50%; background: rgb(250 250 250 / .82); box-shadow: 0 6px 20px rgb(0 0 0 / .18); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); cursor: pointer; transition: scale 200ms var(--ease), background 200ms; }
.wf-arrow::before { content: ""; position: absolute; top: 50%; left: 50%; width: 10px; height: 10px; border: solid #0d0d0d; border-width: 2px 2px 0 0; translate: -65% -50%; rotate: 45deg; }
.wf-arrow.prev { left: 16px; }
.wf-arrow.prev::before { translate: -35% -50%; rotate: -135deg; }
.wf-arrow.next { right: 16px; }
.wf-arrow:hover { scale: 1.08; background: #fff; }
.wf-arrow:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.wf-dots { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }
.wf-dots button { width: 34px; height: 6px; padding: 0; border: 0; border-radius: 999px; background: var(--line, rgb(13 13 13 / .15)); cursor: pointer; transition: background 200ms, width 300ms var(--ease); }
.wf-dots button[aria-pressed="true"] { width: 56px; background: var(--ink); }
.wf-dots button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.wf-full-track { display: none; position: relative; height: 260svh; margin-top: 20px; }
.wf-full-stage { position: sticky; top: 0; height: 100svh; overflow: hidden; background: var(--surface); }

/* 3. scan: transparent stage, soft contact shadow under the model */
.wf-scan { position: relative; aspect-ratio: 16 / 9; touch-action: pan-y; cursor: grab; }
.wf-scan:active { cursor: grabbing; }
.wf-scan::after { content: ""; position: absolute; z-index: 0; left: 26%; right: 26%; bottom: 23%; height: 9%; border-radius: 50%; background: radial-gradient(closest-side, rgb(0 0 0 / .22), rgb(0 0 0 / 0)); pointer-events: none; }
:root[data-theme="dark"] .wf-scan::after { background: radial-gradient(closest-side, rgb(0 0 0 / .6), rgb(0 0 0 / 0)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .wf-scan::after { background: radial-gradient(closest-side, rgb(0 0 0 / .6), rgb(0 0 0 / 0)); } }
.wf-scan-poster, .wf-scan-gl { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; }
.wf-scan-poster { object-fit: contain; transition: opacity 500ms var(--ease); }
.wf-scan-gl canvas { touch-action: pan-y; }
.wf-scan:has(.wf-scan-gl.gl) .wf-scan-poster { opacity: 0; }

/* pairs at equal height (each item grows by its aspect ratio); a second pair sits right under the first */
.wf-pair { display: flex; gap: 16px; align-items: flex-start; }
.wf-pair > .wf-cmp-wrap { flex: calc(var(--ar)) 1 0px; min-width: 0; }
.wf-pair + .wf-pair { margin-top: 32px; }
.wf-brand { top: auto; bottom: 12px; left: auto; right: 12px; }

/* rows of media */
.wf-row { display: grid; gap: 14px; align-items: start; }
.wf-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* clip cards */
.wf-clip { position: relative; margin: 0; border-radius: 20px; overflow: hidden; background: var(--surface); transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform 300ms var(--ease); }
.wf-clip video { display: block; width: 100%; height: auto; object-fit: cover; }
.wf-clip.wide { max-width: 100%; }
.wf-splat9 { position: relative; aspect-ratio: 9 / 16; border-radius: 20px; overflow: hidden; background: var(--surface); }

/* compare: page scrolls normally; a horizontal drag or a tap moves the divider */
.wf-cmp { position: relative; margin: 0; aspect-ratio: var(--ar, 4 / 5); border-radius: 20px; overflow: hidden; background: var(--surface); touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: ew-resize; }
.wf-cmp img, .wf-cmp video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.wf-cmp .before { clip-path: inset(0 calc(100% - var(--pos, 50%)) 0 0); }
.wf-cmp-tag.l { left: 12px; }
.wf-cmp-tag.r { right: 12px; }
.wf-cmp-handle { position: absolute; z-index: 4; top: 0; bottom: 0; left: var(--pos, 50%); width: 44px; translate: -50% 0; outline: none; }
.wf-cmp-handle::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; translate: -50% 0; background: #fff; box-shadow: 0 0 16px rgb(0 0 0 / .35); }
.wf-cmp-handle i { position: absolute; top: 50%; left: 50%; width: 36px; height: 36px; translate: -50% -50%; border-radius: 50%; background: #fff; box-shadow: 0 4px 16px rgb(0 0 0 / .3); }
.wf-cmp-handle i::before, .wf-cmp-handle i::after { content: ""; position: absolute; top: 50%; width: 0; height: 0; border: 5px solid transparent; translate: 0 -50%; }
.wf-cmp-handle i::before { left: 6px; border-right-color: #0d0d0d; }
.wf-cmp-handle i::after { right: 6px; border-left-color: #0d0d0d; }
.wf-cmp-handle:focus-visible i { outline: 2px solid var(--accent); outline-offset: 3px; }
.wf-step { outline: none; }
.wf-step .wf-layer { opacity: 0; transition: opacity 250ms var(--ease, ease); }
.wf-step .wf-layer.on { opacity: 1; }
.wf-step:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
@media (hover: hover) and (pointer: fine) { .wf-step { cursor: grab; } .wf-step:active { cursor: grabbing; } }
@media (prefers-reduced-motion: reduce) { .wf-step .wf-layer { transition: none; } }
.wf-under { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-top: 12px; }
.wf-seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--surface); }
.wf-seg button { border: 0; padding: 6px 14px; border-radius: 999px; background: none; color: var(--ink-2); font: inherit; font-size: 14px; line-height: 20px; font-weight: 600; cursor: pointer; }
.wf-seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.wf-full { font-size: 15px; }
.wf-more { margin: 20px 0 0; }

/* end */
.wf-end { padding: 140px var(--gutter) 120px; max-width: 1320px; margin: 0 auto; }
.wf-end-btns { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

/* desktop: title column + work column */
@media (min-width: 1024px) {
  .wf-sec { grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 48px; padding-top: 120px; }
  .wf-head { position: sticky; top: calc(var(--top) + 96px); }
  .wf-stage { max-height: 72svh; }
  .wf-row.three { gap: 16px; }
  .wf-clip.wide { max-width: 980px; }
}

/* phone + tablet */
@media (max-width: 1023px) {
  .wf-car { display: none; }
  .wf-full-track { display: block; }
  .wf-sec { padding-top: 80px; gap: 20px; }
  .wf-pair { display: grid; gap: 28px; }
  .wf-pair + .wf-pair { margin-top: 28px; }
  .wf-scan { aspect-ratio: 4 / 5; }
  .wf-scan::after { bottom: 33%; left: 20%; right: 20%; }
}
@media (max-width: 760px) {
  .wf-hero { padding-top: calc(var(--top) + 120px); }
  /* tall items stay narrower than the column so the page never turns into one endless image */
  .wf-pair > .wf-cmp-wrap[style*="9 / 16"], .wf-pair > .wf-cmp-wrap[style*="1000 / 1792"] { width: 82%; margin: 0 auto; }
  /* 2D → 3D: a native horizontal swipe row, nothing to drag inside it */
  #flat .wf-row.three { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 calc(var(--gutter) * -1); padding: 0 var(--gutter) 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  #flat .wf-row.three::-webkit-scrollbar { display: none; }
  #flat .wf-row.three > * { flex: 0 0 72%; scroll-snap-align: center; }
}

/* reduced motion: no tilt */
@media (prefers-reduced-motion: reduce) {
  .wf-clip { transform: none; transition: none; }
}

/* loading: blur-up placeholder, skeleton shimmer until the poster is in, progress ring for 3D downloads (media-loader.js) */
.ld { position: absolute; inset: 0; pointer-events: none; transition: opacity 500ms var(--ease); }
.ld.out { opacity: 0; }
.ld-lq { position: absolute; inset: -8%; z-index: 0; background: center / cover no-repeat; filter: blur(18px) saturate(1.1); transform: scale(1.04); transition: opacity 500ms var(--ease); }
.has-poster > .ld .ld-lq { opacity: 0; }
/* no stacking context on .ld: the placeholder layers sit at z 0 (under a 3D poster/canvas at z 1-2), the ring at z 6 above everything */
.ld-host { overflow: hidden; }
.ld-sk { position: absolute; inset: 0; z-index: 0; background: linear-gradient(100deg, rgb(255 255 255 / 0) 30%, rgb(255 255 255 / .28) 50%, rgb(255 255 255 / 0) 70%) 0 0 / 220% 100%; animation: ld-shimmer 1.4s linear infinite; transition: opacity 400ms var(--ease); }
.has-poster > .ld .ld-sk { opacity: 0; animation: none; }
@keyframes ld-shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.ld-ring { position: absolute; z-index: 6; right: 14px; bottom: 14px; width: 44px; height: 44px; border-radius: 50%; background: rgb(13 13 13 / .55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: #FAFAFA; opacity: 0; scale: .85; transition: opacity 300ms var(--ease), scale 300ms var(--ease); }
.ld-ring.on { opacity: 1; scale: 1; }
.ld-ring svg { position: absolute; inset: 2px; width: 40px; height: 40px; rotate: -90deg; }
.ld-ring circle { fill: none; stroke-width: 3; }
.ld-ring .t { stroke: rgb(255 255 255 / .22); }
.ld-ring .v { stroke: #FAFAFA; stroke-linecap: round; transition: stroke-dashoffset 200ms linear; }
.ld-ring.indet svg { animation: ld-spin 1s linear infinite; }
@keyframes ld-spin { to { rotate: 270deg; } }
.ld-ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.ld-retry { position: absolute; z-index: 7; right: 14px; bottom: 14px; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgb(13 13 13 / .6); color: #FAFAFA; cursor: pointer; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.ld-retry svg { width: 22px; height: 22px; }
.ld-retry:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
/* the phone full-screen stage keeps its ring clear of the home indicator */
.wf-full-stage .ld-ring, .wf-full-stage .ld-retry { bottom: calc(18px + env(safe-area-inset-bottom)); }
@media (prefers-reduced-motion: reduce) { .ld-sk { animation: none; } .ld-ring.indet svg { animation: none; } }
/* full-screen phone stage: the brand tag sits bottom-left, clear of the fixed nav pills */
.wf-full-stage .wf-tag { z-index: 6; top: auto; bottom: calc(18px + env(safe-area-inset-bottom)); left: 16px; }

/* Photo | 3D toggle: the original flat frame over the living splat (scaled 1/0.9: the splat frames 10% tighter) */
.wf-flat { position: absolute; z-index: 3; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scale(1.1111); opacity: 0; pointer-events: none; transition: opacity 450ms var(--ease, ease); }
.is-flat > .wf-flat { opacity: 1; }
.wf-stage > .wf-tag, .wf-flip > .wf-tag { z-index: 4; }
.wf-flip { touch-action: pan-y; }
.wf-car-under { justify-content: center; gap: 12px 24px; }
.wf-car-under { margin-top: 16px; }

@media (prefers-reduced-motion: reduce) { .wf-flat { transition: none; } }

/* rails (components/rail.js) replace the segmented buttons; .over = glass rail on the media's bottom-left corner */
.wf-rail { display: inline-flex; max-width: 100%; }
.wf-rail.over { position: absolute; z-index: 5; left: 12px; bottom: 12px; max-width: calc(100% - 24px); }
.wf-scenes { display: flex; justify-content: center; max-width: 100%; }
.wf-rail.tight .rail { --seg: 6px; }
.wf-rail.tight .rail-node { padding: 0 9px; }
@media (max-width: 380px) {
  .wf-rail.tight .rail { --seg: 4px; }
  .wf-rail.tight .rail-node { padding: 0 8px; }
  .wf-pair > .wf-cmp-wrap[style*="9 / 16"], .wf-pair > .wf-cmp-wrap[style*="1000 / 1792"] { width: 92%; }
}

/* ---------- phone (≤760px): each section is a card; one content width, one radius; several works = one swipe row ---------- */
.wf-carousel { display: none; }
@media (max-width: 760px) {
  .wf { --wf-r: 18px; --wf-pad: 14px; }
  .wf-sec { margin: 20px var(--gutter) 0; padding: 18px var(--wf-pad) var(--wf-pad); gap: 16px; max-width: none; border-radius: 28px; background: color-mix(in oklab, var(--surface) 55%, var(--bg)); box-shadow: inset 0 0 0 1px var(--faint); }
  .wf h2 { font-size: clamp(30px, 8.6vw, 38px); line-height: 1; letter-spacing: -.04em; }
  .wf-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
  .wf-head h2 { flex: 1 1 auto; min-width: 0; }
  .wf-head .wf-credit, .wf-full { display: none; }

  /* every frame: full content width, same radius */
  .wf-cmp, .wf-clip, .wf-stage, .wf-splat9, .wf-full-track .wf-full-stage { border-radius: var(--wf-r); }
  .wf-pair > .wf-cmp-wrap[style*="9 / 16"], .wf-pair > .wf-cmp-wrap[style*="1000 / 1792"] { width: 100%; margin: 0; }
  .wf-under { margin-top: 10px; }
  .wf-more { margin: 14px 0 0; }
  .wf-scan { margin: 0 calc(var(--wf-pad) * -1); }

  /* the swipe row: native scroll-snap, the next card peeks ~12% at the right edge */
  .wf-carousel { display: grid; gap: 12px; min-width: 0; }
  .wf-track { display: grid; grid-auto-flow: column; grid-auto-columns: 88%; gap: 10px; align-items: start; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .wf-track::-webkit-scrollbar { display: none; }
  .wf-card { min-width: 0; scroll-snap-align: start; scroll-snap-stop: always; }
  .wf-card .wf-cmp-wrap { width: 100%; margin: 0; }
  .wf-card .wf-under { justify-content: flex-start; }
  /* one shape per row, so every card's media is the same height */
  .wf-carousel .wf-cmp, .wf-carousel .wf-flip { aspect-ratio: 4 / 5; }
  .wf-carousel [data-slot="tree"] img { object-position: 50% 38%; }
  /* the row owns horizontal swipes; only the divider handle keeps them (a drag from the handle moves it) */
  .wf-carousel .wf-cmp, .wf-carousel .wf-flip, .wf-carousel canvas { touch-action: pan-x pan-y; cursor: auto; }
  .wf-carousel .wf-cmp-handle { width: 64px; touch-action: pan-y; }
  /* dots: the active one follows the scroll */
  .wf-cdots { display: flex; justify-content: center; gap: 6px; }
  .wf-cdots button { width: 6px; height: 6px; padding: 0; border: 0; border-radius: 999px; background: var(--faint); cursor: pointer; transition: width 300ms var(--ease), background 200ms; }
  .wf-cdots button[aria-current="true"] { width: 20px; background: var(--ink); }

  /* the phone finale: Twinwarm full screen right after its card */
  #photo { padding-bottom: 18px; }
  #photo .wf-body:empty, #photo .wf-car { display: none; }
  .wf-full-track { margin-top: 16px; }
  .wf-end { padding: 96px var(--gutter) 96px; }
}
@media (max-width: 760px) and (prefers-reduced-motion: reduce) { .wf-track { scroll-behavior: auto; } .wf-cdots button { transition: none; } }
