/* Crown Videos — shared base for all three prototype directions.
   Mechanics only (reset, lightbox, reveal, marquee, media). Look lives in each direction's style.css. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; min-height: 100vh; overflow-x: clip; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
h1, h2, h3, h4, p, ul, ol, figure, blockquote, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg, iframe, video { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
[hidden] { display: none !important; }
body.menu-open, body.lb-open { overflow: hidden; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 500;
  padding: .75rem 1.1rem; background: #fff; color: #000; font-size: .85rem;
}
.skip-link:focus { top: 1rem; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

/* ── Media boxes ── */
.ratio { position: relative; display: block; overflow: hidden; }
.ratio > img, .ratio > iframe { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border: 0; }

/* Background (cover) video: a 16:9 iframe scaled to always fill its box */
.bg-video { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.bg-video > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.bg-video > iframe {
  position: absolute; top: 50%; left: 50%; border: 0;
  width: max(100%, calc(100cqh * 16 / 9)); height: max(100%, calc(100cqw * 9 / 16));
  transform: translate(-50%, -50%); opacity: 0; transition: opacity 1.2s ease;
  max-width: none; max-height: none;   /* the global iframe max-width:100% would undo the cover crop and letterbox the video */
}
.bg-video { container-type: size; }
.bg-video.is-playing > iframe { opacity: 1; }

/* Hover preview on cards */
[data-preview-target] iframe {
  position: absolute; top: 50%; left: 50%; width: 100%; height: 100%; aspect-ratio: 16 / 9;
  transform: translate(-50%, -50%) scale(1.02); border: 0; pointer-events: none;
  opacity: 0; transition: opacity .4s ease;
}
.is-previewing [data-preview-target] iframe { opacity: 1; }

/* ── Lightbox ── */
.lightbox {
  position: fixed; inset: 0; z-index: 400; display: grid; place-items: center;
  padding: clamp(1rem, 4vw, 3rem); background: rgba(0, 0, 0, .94);
  opacity: 0; transition: opacity .3s ease;
}
.lightbox.is-open { opacity: 1; }
.lightbox__inner { width: min(1200px, 100%, calc((100vh - 9rem) * 16 / 9)); }
.lightbox__bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; color: #fff; }
.lightbox__title { font-size: .8rem; letter-spacing: .08em; opacity: .75; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox__close {
  flex: none; display: inline-flex; align-items: center; gap: .6rem; color: #fff;
  font-size: .72rem; letter-spacing: .2em; text-transform: uppercase; padding: .5rem 0;
}
.lightbox__close svg { width: 14px; height: 14px; }
.lightbox__frame { position: relative; aspect-ratio: 16 / 9; background: #000; }
.lightbox__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ── Reveal ── */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .8s cubic-bezier(.2,.7,.2,1), transform .8s cubic-bezier(.2,.7,.2,1); transition-delay: var(--d, 0s); }
.js .reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .js .reveal { opacity: 1; transform: none; transition: none; } }

/* ── Marquee ── */
.marquee { overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.marquee__track { display: flex; width: max-content; animation: cv-marquee var(--marquee-time, 70s) linear infinite; }
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee__set { display: flex; align-items: center; flex: none; }
@keyframes cv-marquee { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .marquee { -webkit-mask-image: none; mask-image: none; }
  .marquee__track { animation: none; width: auto; }
  .marquee__set { flex-wrap: wrap; justify-content: center; }
  .marquee__set[aria-hidden] { display: none; }
}

/* ── Scroll-snap track ── */
[data-track] { display: grid; grid-auto-flow: column; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
[data-track]::-webkit-scrollbar { display: none; }
[data-track] > * { scroll-snap-align: start; }

/* ── Fade slider ── */
[data-slider] [data-slide] { grid-area: 1 / 1; opacity: 0; visibility: hidden; transition: opacity .6s ease, visibility 0s linear .6s; }
[data-slider] [data-slide].is-active { opacity: 1; visibility: visible; transition: opacity .6s ease, visibility 0s; }
.slider-stack { display: grid; }

/* ── Forms ── */
.field-error:empty { display: none; }

/* ── Portfolio filter transitions ── */
.portfolio__grid { transition: opacity .22s ease; }
.portfolio__grid.is-fading { opacity: 0; }
.is-entering { animation: cv-enter .55s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--i, 0) * 40ms); }
@keyframes cv-enter { from { opacity: 0; transform: translateY(14px); } }
@media (prefers-reduced-motion: reduce) { .portfolio__grid { transition: none; } .is-entering { animation: none; } }
