/* Styles for /reels/ — the video showreel page. Design tokens kept in sync
   with _cases.css and the React homepage (src/index.css). */
:root {
  --ink: #0A0A0A;
  --bone: #F5F1E8;
  --signal: #FFB020;
  --signal-700: #C97F0F;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--ink);
  color: var(--bone);
  font-family: 'Manrope', system-ui, sans-serif;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
body.theatre-open { overflow: hidden; }
.wrap { max-width: 1440px; margin: 0 auto; padding: 0 24px; }
.mono { font-family: 'JetBrains Mono', monospace; }

/* NAV / FOOTER — same shell as /cases/ */
nav.top { position: sticky; top: 0; z-index: 50; background: rgba(10,10,10,.85); backdrop-filter: blur(12px); border-bottom: 1px solid rgba(245,241,232,.08); }
nav.top .row { display: flex; align-items: center; justify-content: space-between; height: 64px; }
nav.top a.brand { display: flex; align-items: center; gap: 10px; color: var(--bone); text-decoration: none; }
nav.top a.brand img { width: 36px; height: 36px; object-fit: contain; border-radius: 6px; }
nav.top a.brand span.name { font-family: 'Archivo Black', sans-serif; font-size: 15px; letter-spacing: -0.02em; }
nav.top .nav-actions { display: flex; gap: 8px; align-items: center; }
nav.top a.ghost { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border: 1px solid rgba(245,241,232,.2); color: rgba(245,241,232,.85); border-radius: 999px; text-decoration: none; font-family: 'Archivo Black', sans-serif; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; transition: all .2s; }
nav.top a.ghost:hover { border-color: var(--signal); color: var(--signal); }
nav.top .cta { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; background: var(--signal); color: var(--ink); border-radius: 999px; text-decoration: none; font-family: 'Archivo Black', sans-serif; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; transition: background .2s; }
nav.top .cta:hover { background: var(--signal-700); color: var(--bone); }
@media (max-width: 560px) { nav.top a.ghost { display: none; } }

.crumbs { display: flex; gap: 8px; font-family: 'JetBrains Mono', monospace; font-size: 12px; color: rgba(245,241,232,.55); margin-bottom: 28px; }
.crumbs a { color: rgba(245,241,232,.55); text-decoration: none; }
.crumbs a:hover { color: var(--signal); }
.crumbs span.now { color: var(--bone); }

footer.site { padding: 48px 0 64px; border-top: 1px solid rgba(245,241,232,.08); background: var(--ink); margin-top: 96px; }
footer.site .row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
footer.site .brand { display: flex; align-items: center; gap: 10px; color: var(--bone); text-decoration: none; }
footer.site .brand .badge { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; background: rgba(245,241,232,.05); color: var(--signal); border: 1px solid rgba(245,241,232,.12); border-radius: 6px; font-family: 'Archivo Black', sans-serif; font-size: 13px; }
footer.site .brand .name { font-family: 'Archivo Black', sans-serif; font-size: 14px; }
footer.site .right { color: rgba(245,241,232,.5); font-size: 13px; }
footer.site .right a { color: rgba(245,241,232,.78); text-decoration: underline; text-underline-offset: 3px; margin-left: 16px; }
footer.site .right a:hover { color: var(--signal); }

/* HERO */
/* Hero stays deliberately short: on a laptop the first row of tiles has to be
   visible without scrolling — the work is the argument, not the headline. */
header.hero-reels { padding: 54px 0 34px; position: relative; overflow: hidden; }
header.hero-reels::after {
  content: "REELS"; position: absolute; right: -3vw; top: 26%;
  font-family: 'Archivo Black', sans-serif; font-size: clamp(9rem, 21vw, 24rem); line-height: .8;
  color: rgba(245,241,232,.028); letter-spacing: -0.06em; pointer-events: none; user-select: none;
}
header.hero-reels h1 { font-family: 'Archivo Black', sans-serif; font-size: clamp(2.1rem, 5.2vw, 4.4rem); line-height: .92; letter-spacing: -0.045em; text-transform: uppercase; max-width: 17ch; position: relative; z-index: 1; }
header.hero-reels h1 em { font-style: normal; color: var(--signal); }
header.hero-reels p.lede { font-family: 'Instrument Serif', Georgia, serif; font-size: clamp(1.1rem, 1.4vw, 1.35rem); line-height: 1.45; color: rgba(245,241,232,.75); max-width: 68ch; margin-top: 20px; font-style: italic; position: relative; z-index: 1; }
.hero-facts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; position: relative; z-index: 1; }
.hero-facts span { display: inline-flex; align-items: center; gap: 8px; padding: 9px 15px; border: 1px solid rgba(245,241,232,.16); border-radius: 999px; font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(245,241,232,.75); }
.hero-facts span::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--signal); flex: none; }

/* GRID */
section.reels-grid { padding: 20px 0 40px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
@media (max-width: 640px) { .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; } }

.tile {
  position: relative; display: block; width: 100%; padding: 0; border: 0;
  aspect-ratio: 9 / 16; border-radius: 16px; overflow: hidden; cursor: pointer;
  background: #101011; color: inherit; text-align: left; isolation: isolate;
  box-shadow: 0 0 0 1px rgba(255,255,255,.06), 0 20px 44px -22px rgba(0,0,0,.9);
  transition: transform .4s cubic-bezier(.22,.61,.36,1), box-shadow .4s;
}
.tile:hover, .tile:focus-visible {
  transform: translateY(-5px);
  box-shadow:
    0 0 0 1px rgba(255,255,255,.12),
    0 30px 60px -22px rgba(0,0,0,.95),
    0 18px 80px -18px color-mix(in srgb, var(--glow, #FFB020) 65%, transparent);
}
.tile:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }
/* Флагманские бренды: тонкая акцентная рамка в цвете ролика + чуть более
   плотное свечение. Разница считывается, но плитка остаётся той же плиткой. */
.tile.flagship {
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--glow, #FFB020) 55%, transparent),
    0 20px 44px -22px rgba(0,0,0,.9),
    0 14px 60px -26px color-mix(in srgb, var(--glow, #FFB020) 60%, transparent);
}
.tile.flagship:hover, .tile.flagship:focus-visible {
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--glow, #FFB020) 80%, transparent),
    0 30px 60px -22px rgba(0,0,0,.95),
    0 18px 80px -14px color-mix(in srgb, var(--glow, #FFB020) 85%, transparent);
}
.tile .media { position: absolute; inset: 0; }
.tile img.poster, .tile video.prev {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block;
}
.tile video.prev { opacity: 0; transition: opacity .45s ease; }
.tile.playing video.prev { opacity: 1; }
.tile.playing img.poster { opacity: 0; transition: opacity .45s ease .05s; }
.tile .scrim {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(6,6,7,.92) 0%, rgba(6,6,7,.45) 34%, rgba(6,6,7,0) 62%);
  transition: opacity .35s;
}
.tile:hover .scrim { background: linear-gradient(to top, rgba(6,6,7,.95) 0%, rgba(6,6,7,.5) 42%, rgba(6,6,7,.05) 72%); }

/* logo chip — wordmark plate until real logos land */
.tile .chip {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  /* block, not inline-flex: text-overflow:ellipsis needs a block container,
     otherwise a long brand is sliced mid-letter */
  display: block; width: fit-content; max-width: calc(100% - 78px);
  padding: 7px 11px; border-radius: 8px;
  background: var(--logo-bg, #FFFFFF); color: var(--logo-fg, #0A0A0A);
  font-family: 'Archivo Black', sans-serif; font-size: 12px; letter-spacing: -0.02em;
  text-transform: uppercase; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 6px 18px -8px rgba(0,0,0,.9);
}
.tile .chip img { max-height: 18px; max-width: 92px; object-fit: contain; display: block; }
.tile .dur {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  padding: 5px 9px; border-radius: 999px; background: rgba(6,6,7,.62); backdrop-filter: blur(6px);
  font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: .06em; color: rgba(245,241,232,.9);
}
.tile .info { position: absolute; left: 14px; right: 14px; bottom: 13px; z-index: 2; display: flex; flex-direction: column; gap: 5px; }
.tile .info .name { font-family: 'Archivo Black', sans-serif; font-size: clamp(.95rem, 1.3vw, 1.15rem); letter-spacing: -0.025em; text-transform: uppercase; line-height: 1.05; }
/* Бейдж флагмана. Третье место на плитке: чип бренда занят левым верхом,
   хронометраж — правым, поэтому подпись живёт над именем клиента. */
.tile .info .flag {
  align-self: start; max-width: 100%;
  padding: 4px 7px; border-radius: 6px;
  border: 1px solid rgba(245,241,232,.16); background: rgba(6,6,7,.55); backdrop-filter: blur(6px);
  font-family: 'JetBrains Mono', monospace; font-size: 9px; letter-spacing: .16em;
  text-transform: uppercase; line-height: 1; color: rgba(245,241,232,.72);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tile .info .niche { font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: rgba(245,241,232,.6); }
.tile .info .go { font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--signal); opacity: 0; transform: translateY(6px); transition: all .3s; }
.tile:hover .info .go, .tile:focus-visible .info .go { opacity: 1; transform: translateY(0); }
.tile .play {
  position: absolute; z-index: 2; left: 50%; top: 50%; translate: -50% -50%;
  width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(10,10,10,.42); border: 1px solid rgba(245,241,232,.35); backdrop-filter: blur(4px);
  opacity: .85; transition: all .35s;
}
.tile:hover .play { opacity: 1; background: var(--signal); border-color: var(--signal); color: var(--ink); scale: 1.06; }
@media (max-width: 640px) {
  .tile { border-radius: 12px; }
  .tile .play { width: 40px; height: 40px; }
  /* On a ~165px tile the duration pill squeezes the brand into an ellipsis.
     The client's name is the whole point of the chip — the runtime is not. */
  .tile .chip { font-size: 10px; padding: 5px 8px; top: 8px; left: 8px; max-width: calc(100% - 16px); }
  .tile .dur { display: none; }
  .tile .info { left: 10px; right: 10px; bottom: 10px; gap: 4px; }
  .tile .info .go { display: none; }
  /* На ~150px плитке бейдж съедает строку — ужимаем, но не прячем:
     он и есть сигнал «это крупный бренд». */
  .tile .info .flag { font-size: 8px; letter-spacing: .1em; padding: 3px 5px; }
}

/* OFFER BAND — the marketing close under the grid */
section.offer { padding: 84px 0 24px; border-top: 1px solid rgba(245,241,232,.08); margin-top: 64px; }
section.offer h2 { font-family: 'Archivo Black', sans-serif; font-size: clamp(1.8rem, 3.6vw, 3rem); line-height: .95; letter-spacing: -0.04em; text-transform: uppercase; max-width: 20ch; }
section.offer h2 em { font-style: normal; color: var(--signal); }
section.offer p.sub { color: rgba(245,241,232,.72); margin-top: 20px; max-width: 62ch; font-size: 1.05rem; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-top: 44px; counter-reset: st; }
.step { counter-increment: st; padding: 26px 24px; border: 1px solid rgba(245,241,232,.09); border-radius: 16px; background: linear-gradient(150deg, rgba(255,176,32,.05), rgba(245,241,232,.02)); display: flex; flex-direction: column; gap: 10px; transition: border-color .25s, transform .25s; }
.step:hover { border-color: rgba(255,176,32,.4); transform: translateY(-3px); }
.step::before { content: counter(st, decimal-leading-zero); font-family: 'Archivo Black', sans-serif; font-size: 1.9rem; color: var(--signal); line-height: 1; letter-spacing: -0.03em; }
.step strong { font-family: 'Archivo Black', sans-serif; font-size: 1rem; letter-spacing: -0.02em; text-transform: uppercase; }
.step span { color: rgba(245,241,232,.72); font-size: .96rem; line-height: 1.5; }

.final-cta { margin-top: 56px; padding: 44px 40px; border-radius: 22px; border: 1px solid rgba(255,176,32,.22); background: radial-gradient(120% 160% at 12% 0%, rgba(255,176,32,.14), rgba(245,241,232,.02) 58%); display: flex; align-items: center; justify-content: space-between; gap: 28px; flex-wrap: wrap; }
.final-cta .t { font-family: 'Archivo Black', sans-serif; font-size: clamp(1.3rem, 2.4vw, 2rem); line-height: 1.05; letter-spacing: -0.035em; text-transform: uppercase; max-width: 22ch; }
.final-cta .t em { font-style: normal; color: var(--signal); }
.final-cta .acts { display: flex; gap: 12px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 10px; padding: 15px 26px; background: var(--signal); color: var(--ink); border-radius: 999px; text-decoration: none; font-family: 'Archivo Black', sans-serif; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; transition: background .2s, transform .2s; }
.btn:hover { background: var(--signal-700); color: var(--bone); transform: translateY(-2px); }
.btn.ghost { background: transparent; color: rgba(245,241,232,.9); border: 1px solid rgba(245,241,232,.22); }
.btn.ghost:hover { background: transparent; border-color: var(--signal); color: var(--signal); }
@media (max-width: 640px) { .final-cta { padding: 30px 22px; } }

/* THEATRE — full-screen player */
.theatre { position: fixed; inset: 0; z-index: 100; display: none; }
.theatre[open], .theatre.on { display: block; }
.theatre .backdrop { position: absolute; inset: 0; background: rgba(5,5,6,.9); backdrop-filter: blur(18px); animation: fade .28s ease; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.theatre .shell {
  position: relative; height: 100%; width: 100%;
  display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 32px;
  align-items: center; padding: 64px 44px 32px; max-width: 1500px; margin: 0 auto;
  animation: rise .34s cubic-bezier(.22,.61,.36,1);
}
@keyframes rise { from { opacity: 0; transform: translateY(18px) } to { opacity: 1; transform: none } }
/* The STAGE owns the 9:16 frame, not the video. A video with preload="none"
   reports no intrinsic size until it is opened, so anything that has to
   measure the element — grid rows, flex centring — collapses it to 0×0 for the
   first frames. A definite height plus aspect-ratio needs no measurement. */
.theatre .stage {
  position: relative; height: min(82vh, 100%); aspect-ratio: 9 / 16;
  width: auto; max-width: 100%; margin: 0 auto; min-height: 0;
}
.theatre video.main {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  border-radius: 18px; background: #000; display: block;
  box-shadow: 0 40px 90px -30px rgba(0,0,0,.95), 0 0 90px -20px color-mix(in srgb, var(--glow, #FFB020) 45%, transparent);
}
.theatre .panel { align-self: center; max-height: 82vh; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; padding-right: 4px; }
.theatre .panel .plate {
  display: inline-flex; align-items: center; align-self: flex-start; padding: 10px 16px; border-radius: 10px;
  background: var(--logo-bg, #FFFFFF); color: var(--logo-fg, #0A0A0A);
  font-family: 'Archivo Black', sans-serif; font-size: 17px; letter-spacing: -0.025em; text-transform: uppercase; line-height: 1;
}
.theatre .panel .plate img { max-height: 26px; max-width: 150px; object-fit: contain; display: block; }
.theatre .panel .niche { font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: rgba(245,241,232,.55); }
.theatre .panel h2 { font-family: 'Archivo Black', sans-serif; font-size: clamp(1.35rem, 2vw, 1.85rem); line-height: 1.02; letter-spacing: -0.035em; text-transform: uppercase; }
.theatre .panel p.desc { color: rgba(245,241,232,.76); font-size: 1rem; line-height: 1.6; }
.theatre .panel .craft-label { font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: rgba(245,241,232,.45); }
.theatre .panel .craft { display: flex; flex-wrap: wrap; gap: 7px; }
.theatre .panel .craft b { font-weight: 500; font-size: 12px; padding: 7px 12px; border-radius: 999px; border: 1px solid rgba(245,241,232,.14); color: rgba(245,241,232,.82); background: rgba(245,241,232,.03); }
.theatre .panel .metric { display: flex; align-items: baseline; gap: 10px; padding-top: 16px; border-top: 1px solid rgba(245,241,232,.1); }
.theatre .panel .metric .num { font-family: 'Archivo Black', sans-serif; font-size: 2rem; color: var(--signal); letter-spacing: -0.04em; line-height: 1; }
.theatre .panel .metric .lbl { font-size: .9rem; color: rgba(245,241,232,.68); line-height: 1.3; }
.theatre .panel .acts { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.theatre .panel .acts .btn { justify-content: center; }

.theatre .x, .theatre .arrow {
  position: absolute; z-index: 3; display: grid; place-items: center;
  width: 46px; height: 46px; border-radius: 50%; cursor: pointer;
  background: rgba(245,241,232,.07); border: 1px solid rgba(245,241,232,.18); color: var(--bone);
  transition: all .22s;
}
.theatre .x:hover, .theatre .arrow:hover { background: var(--signal); border-color: var(--signal); color: var(--ink); }
.theatre .x { top: 18px; right: 22px; }
.theatre .arrow.prev { left: 10px; top: 50%; translate: 0 -50%; }
.theatre .arrow.next { right: 10px; top: 50%; translate: 0 -50%; }
.theatre .counter { position: absolute; top: 26px; left: 26px; z-index: 3; font-family: 'JetBrains Mono', monospace; font-size: 12px; letter-spacing: .1em; color: rgba(245,241,232,.5); }

@media (max-width: 1024px) {
  /* Drop the grid entirely when stacked — block flow sizes the stage from its
     own height/ratio and lets the panel follow underneath, with the shell as
     the scroll container. */
  .theatre .shell { display: block; padding: 56px 16px 16px; overflow-y: auto; }
  .theatre .stage { height: min(56vh, 460px); margin: 0 auto 18px; }
  .theatre .panel { max-height: none; overflow: visible; }
  .theatre .arrow { top: auto; bottom: 14px; translate: none; }
  .theatre .arrow.prev { left: 16px; }
  .theatre .arrow.next { right: 16px; }
  .theatre .panel .acts { padding-bottom: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}
