/* ==========================================================
   Nfilms v3 — cinema interactions
   slider / grid / list / lightbox / radial wheel / sound gate
   ========================================================== */

/* ---------- Film ruler (shared) ---------- */
.ruler { position: relative; height: 56px; }
.ruler__ticks { position: absolute; inset: 0; display: flex; justify-content: space-between; align-items: flex-end; }
.ruler__ticks i { width: 1px; height: 9px; background: rgba(238,244,241,.22); }
.ruler__ticks i.is-major { height: 22px; background: rgba(238,244,241,.5); }
.ruler__head { position: absolute; left: 0; bottom: 0; width: 1px; height: 100%; background: var(--accent); will-change: transform; }
.ruler__head::before { content: ""; position: absolute; top: -2px; left: -4px; border: 4.5px solid transparent; border-top: 6px solid var(--accent); }
.ruler__tc { position: absolute; bottom: calc(100% - 14px); left: 8px; white-space: nowrap; color: var(--accent); font-size: 10px; }

/* ---------- Preloader gate ---------- */
.preloader__ruler { position: absolute; left: var(--gutter); right: var(--gutter); bottom: 0; }
.preloader__count { bottom: 72px; }
.preloader__label { bottom: 84px; }
.gate { position: absolute; left: 50%; top: 63%; transform: translateX(-50%); display: grid; justify-items: center; gap: 16px; opacity: 0; visibility: hidden; text-align: center; }
.gate__note { color: var(--muted); font-size: 11px; }
.gate__btn--main { position: relative; padding: 6px 2px; font-size: clamp(22px, 2.6vw, 36px); color: var(--ink); }
.gate__btn--main::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--accent); transform: scaleX(.18); transition: transform .7s var(--ease); }
.gate__btn--main:hover::after, .gate__btn--main:focus-visible::after { transform: scaleX(1); }
.gate__btn--alt { color: var(--muted); transition: color .3s; }
.gate__btn--alt:hover, .gate__btn--alt:focus-visible { color: var(--ink); }

/* ---------- Sound toggle ---------- */
.sound { display: flex; align-items: center; gap: 10px; padding: 8px 4px; }
.sound b { font-weight: 500; color: var(--muted); transition: color .3s; }
.sound.is-on b { color: var(--accent); }
.sound__bars { display: flex; align-items: flex-end; gap: 2px; height: 14px; }
.sound__bars i { width: 2px; height: 3px; background: var(--accent); border-radius: 1px; transition: height .4s var(--ease); }
.sound.is-on .sound__bars i { animation: eq .9s ease-in-out infinite alternate; }
.sound.is-on .sound__bars i:nth-child(2) { animation-delay: -.3s; }
.sound.is-on .sound__bars i:nth-child(3) { animation-delay: -.6s; }
.sound.is-on .sound__bars i:nth-child(4) { animation-delay: -.15s; }
.sound.is-on .sound__bars i:nth-child(5) { animation-delay: -.45s; }
@keyframes eq { 0% { height: 3px; } 100% { height: 14px; } }

/* ---------- Work head + view switch ---------- */
.work { padding: clamp(96px, 12vw, 160px) 0; overflow: hidden; }
.work__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 32px; margin-bottom: clamp(32px, 4vw, 56px); }
.views { position: relative; display: flex; padding: 4px; border: 1px solid var(--line); border-radius: 999px; flex: none; }
.views button { position: relative; z-index: 1; padding: 10px 18px; color: var(--muted); transition: color .4s var(--ease); }
.views button[aria-selected="true"] { color: var(--bg); }
.views button:not([aria-selected="true"]):hover { color: var(--ink); }
.views__pill { position: absolute; top: 4px; bottom: 4px; left: 0; width: 0; border-radius: 999px; background: var(--accent); }
.pane { display: none; }
.pane.is-active { display: block; }

/* ---------- Slider: curved cinema ---------- */
.rs { position: relative; height: clamp(340px, 60vh, 620px); perspective: 1700px; cursor: grab; touch-action: pan-y; outline: none; user-select: none; -webkit-user-select: none; }
.rs.is-dragging { cursor: grabbing; }
.rs:focus-visible { box-shadow: inset 0 0 0 1px var(--accent); }
.rs__stage { position: absolute; inset: 0; transform-style: preserve-3d; }
.rs__slide {
  position: absolute; left: 50%; top: 50%; width: clamp(280px, 44vw, 740px); aspect-ratio: 16 / 10;
  border-radius: 6px; overflow: hidden; background: var(--surface); will-change: transform, opacity;
  backface-visibility: hidden;
}
.rs__slide img, .rs__slide video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; }
.rs__slide video { opacity: 0; transition: opacity .9s var(--ease); }
.rs__slide.is-playing video, .rs__slide.is-video-only video { opacity: 1; }
.rs__shade { position: absolute; inset: 0; background: var(--bg); pointer-events: none; }
.rs__badge { position: absolute; top: 16px; left: 16px; padding: 6px 11px; border-radius: 999px; background: rgba(6,19,18,.55); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,.1); font-size: 10px; opacity: 0; transition: opacity .5s; }
.rs__slide.is-active .rs__badge { opacity: 1; }
.rs__hud { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-top: clamp(24px, 3vw, 40px); }
.rs__cat { color: var(--muted); margin-bottom: 14px; }
.rs__title { font-size: clamp(30px, 4.6vw, 72px); line-height: 1; overflow: hidden; padding-bottom: .06em; }
.rs__title-in { display: inline-block; will-change: transform; }
.rs__right { display: grid; justify-items: end; gap: 16px; }
.rs__arrows { display: flex; gap: 12px; }
.rs__btn { width: 56px; height: 56px; border-radius: 50%; border: 1px solid var(--line); font-size: 18px; transition: background .4s var(--ease), color .4s, border-color .4s; }
.rs__btn:hover { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.rs__btn:active { transform: scale(.95); }
.rs__ruler { margin-top: clamp(28px, 3vw, 44px); cursor: pointer; }

/* Odometer */
.odo, .radial__counter { display: flex; align-items: flex-start; font-size: clamp(40px, 5vw, 76px); line-height: 1; }
.odo__digits { display: flex; align-items: flex-start; height: 1em; overflow: hidden; }
.odo__col { display: flex; flex-direction: column; will-change: transform; }
.odo__col span { display: block; height: 1em; line-height: 1em; }
.odo__sep { color: var(--accent); font-size: .42em; margin: .1em .18em 0; }
.odo__total, .radial__counter > span:last-child { color: var(--muted); font-size: .42em; margin-top: .1em; }

/* ---------- Grid: tile wall ---------- */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); }
.tile { position: relative; overflow: hidden; aspect-ratio: 4 / 5; cursor: pointer; background: var(--surface); }
.tile:nth-child(1) { grid-column: span 2; grid-row: span 2; aspect-ratio: auto; }
.tile:nth-child(6), .tile:nth-child(7) { grid-column: span 2; aspect-ratio: 16 / 9; }
.tile img, .tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 1.4s var(--ease), filter .7s var(--ease), opacity .7s; filter: saturate(.7) brightness(.62); }
.tile video { opacity: 0; }
.tiles:hover .tile img, .tiles:hover .tile video { filter: grayscale(1) brightness(.22); }
.tiles .tile:hover img, .tiles .tile:hover video { filter: none; transform: scale(1.04); }
.tiles .tile:hover video, .tile.is-video-only video { opacity: 1; }
.tile__info { position: absolute; left: 20px; right: 20px; bottom: 18px; display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; pointer-events: none; }
.tile__info h3 { font-size: clamp(18px, 1.9vw, 30px); }
.tile__tags { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.tile__tags span { padding: 5px 10px; border-radius: 999px; font-size: 10px; border: 1px solid rgba(255,255,255,.18); background: rgba(6,19,18,.45); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); opacity: 0; transform: translateY(10px); transition: opacity .5s, transform .7s var(--ease); }
.tile:hover .tile__tags span { opacity: 1; transform: none; }
.tile:hover .tile__tags span:nth-child(2) { transition-delay: .06s; }
.tile:hover .tile__tags span:nth-child(3) { transition-delay: .12s; }
.tile__idx { position: absolute; top: 18px; left: 20px; font-size: 10px; color: var(--accent); }

/* ---------- List ---------- */
.plist { border-top: 1px solid var(--line); }
.plist li { display: grid; grid-template-columns: 56px minmax(0, 1.5fr) 1fr 1fr 64px; align-items: center; gap: 16px; padding: 26px 0; border-bottom: 1px solid var(--line); cursor: pointer; transition: color .4s, padding .6s var(--ease); }
.plist li h3 { font-size: clamp(22px, 3vw, 46px); }
.plist li .mono { color: var(--muted); }
.plist:hover li { color: var(--muted); }
.plist li:hover { color: var(--ink); padding-left: 18px; }
.plist li:hover .mono.acc { color: var(--accent); }
.plist__go { justify-self: end; font-size: 22px; transition: transform .6s var(--ease), color .3s; }
.plist li:hover .plist__go { transform: rotate(45deg); color: var(--accent); }
.plist__preview { position: fixed; top: 0; left: 0; z-index: 40; width: 340px; aspect-ratio: 16 / 10; margin: -106px 0 0 -170px; border-radius: 6px; overflow: hidden; pointer-events: none; clip-path: inset(50% 50% 50% 50%); }
.plist__preview img, .plist__preview video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.plist__preview .is-active { opacity: 1; }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 96; display: grid; place-items: center; background: rgba(6,19,18,.96); visibility: hidden; opacity: 0; }
.lightbox__frame { position: relative; width: min(1280px, 92vw); aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; background: #020807; }
.lightbox__frame video { width: 100%; height: 100%; object-fit: contain; }
.lightbox__close { position: absolute; top: 28px; right: var(--gutter); display: flex; align-items: center; gap: 10px; color: var(--ink); }
.lightbox__close i { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); font-style: normal; transition: background .3s, color .3s, transform .5s var(--ease); }
.lightbox__close:hover i { background: var(--accent); color: var(--bg); transform: rotate(90deg); }
.lightbox__meta { position: absolute; left: var(--gutter); bottom: 28px; display: flex; gap: 24px; align-items: baseline; }
.lightbox__meta h4 { font-size: clamp(22px, 2.4vw, 36px); }

/* ---------- Radial destinations ---------- */
.radial { position: relative; height: 100dvh; min-height: 700px; overflow: hidden; touch-action: pan-y; cursor: grab; }
.radial.is-dragging { cursor: grabbing; }
.radial__head { position: absolute; top: 112px; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; z-index: 3; }
.radial__head .eyebrow { margin: 0; }
.radial__title { position: absolute; top: 17%; left: var(--gutter); right: var(--gutter); text-align: center; z-index: 3; pointer-events: none; }
.radial__region { color: var(--accent); margin-bottom: 10px; }
.radial__name { font-size: clamp(42px, 7.4vw, 120px); line-height: 1.02; overflow: hidden; padding-bottom: .08em; }
.radial__name span { display: inline-block; will-change: transform; }
.radial__track { position: absolute; left: 50%; width: 0; height: 0; will-change: transform; z-index: 1; }
.radial__card { position: absolute; width: clamp(190px, 19vw, 300px); aspect-ratio: 3 / 4; border-radius: 6px; overflow: hidden; background: var(--surface); cursor: pointer; will-change: transform; }
.radial__card img, .radial__card video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; transition: transform 1.2s var(--ease); }
.radial__card:hover img, .radial__card:hover video { transform: scale(1.06); }
.radial__card .rs__shade { transition: opacity .6s var(--ease); }
.radial__card .mono { position: absolute; top: 14px; left: 14px; font-size: 10px; color: var(--accent); z-index: 1; }
.radial::before, .radial::after { content: ""; position: absolute; top: 0; bottom: 0; width: 18vw; z-index: 2; pointer-events: none; }
.radial::before { left: 0; background: linear-gradient(90deg, var(--bg), transparent); }
.radial::after { right: 0; background: linear-gradient(-90deg, var(--bg), transparent); }
.radial__foot { position: absolute; left: 0; right: 0; bottom: 32px; display: flex; justify-content: space-between; align-items: center; gap: 24px; z-index: 3; }
.radial__dots { display: flex; gap: 8px; }
.radial__dots i { width: 6px; height: 6px; border-radius: 3px; background: var(--line); transition: width .6s var(--ease), background .4s; }
.radial__dots i.is-active { width: 26px; background: var(--accent); }

@media (max-width: 1024px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .tile:nth-child(1), .tile:nth-child(6), .tile:nth-child(7) { grid-column: span 2; grid-row: auto; aspect-ratio: 16 / 10; }
  .plist li { grid-template-columns: 40px 1fr 48px; }
  .plist li .plist__cat, .plist li .plist__year { display: none; }
}
@media (max-width: 720px) {
  .work__head { flex-direction: column; align-items: flex-start; }
  .sound__label { display: none; }
  .rs__slide { width: 76vw; }
  .rs__hud { flex-direction: column; align-items: flex-start; }
  .rs__right { justify-items: start; grid-auto-flow: column; align-items: center; gap: 20px; }
  .tile__tags { display: none; }
  .radial__head { top: 88px; }
  .radial__title { top: 20%; }
  .radial__foot p { display: none; }
  .gate { top: 60%; width: 90vw; }
}
@media (hover: none) {
  .plist__preview { display: none; }
  .tile img, .tile video { filter: none; }
}

/* Gate auto-enter countdown */
.gate__auto { display: grid; justify-items: center; gap: 8px; margin-top: 6px; color: var(--muted); font-size: 10px; }
.gate__auto b { color: var(--accent); font-weight: 500; }
.gate__bar { display: block; width: 120px; height: 1px; background: var(--line); overflow: hidden; }
.gate__bar i { display: block; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; }
