/* Ivan Bryzgalov — portfolio
   Layout: a title-card opener (portrait behind a letterbox that opens), then the work as one
   column, with an editing-timeline strip that tracks scroll like a playhead.
   Black ground, violet light used sparingly: glows, glass, frame marks, the playhead. */
@font-face { font-family: "Lora"; src: url("fonts/lora.woff") format("woff"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/inter-Regular.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/inter-Medium.woff") format("woff"); font-weight: 500; font-display: swap; }

:root {
  --bg: #08070b;
  --bg-2: #0e0c13;
  --glass: rgba(30, 24, 48, .42);
  --glass-line: rgba(170, 140, 255, .15);
  --line: #1f1b28;
  --text: #ece9f2;
  --muted: #8f89a0;
  --violet: #9d7dff;
  --violet-hot: #b9a2ff;
  --serif: "Lora", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Consolas, "Liberation Mono", monospace;
  --max: 1120px;
  --ease: cubic-bezier(.2, .7, .1, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: clip; }
body { background: var(--bg); color: var(--text); font: 400 16px/1.6 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: clip; position: relative; }
img, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
em { font-style: normal; color: var(--violet); }
::selection { background: var(--violet); color: #fff; }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 3px; border-radius: 4px; }

/* background: faint column lines + film grain */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background-image: linear-gradient(to right, rgba(157,125,255,.04) 1px, transparent 1px);
  background-size: calc(min(100vw, var(--max)) / 4) 100%; background-position: center top;
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: 100; pointer-events: none; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* cursor light (desktop only) */
.light-layer { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: -1; }
.cursor-light { position: fixed; left: 0; top: 0; width: 520px; height: 520px; margin: -260px 0 0 -260px; border-radius: 50%; pointer-events: none; z-index: -1;
  background: radial-gradient(circle, rgba(124,88,255,.13), transparent 62%); opacity: 0; transition: opacity .6s; will-change: transform; }
@media (pointer: fine) { .cursor-light.on { opacity: 1; } }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); position: relative; }
.label { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: .06em; color: var(--muted); font-variant-numeric: tabular-nums; }
.glow { position: absolute; z-index: -1; pointer-events: none; border-radius: 50%; filter: blur(80px); background: radial-gradient(circle, rgba(124,88,255,.26), transparent 65%); }
.glass { background: var(--glass); border: 1px solid var(--glass-line); border-radius: 14px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.rec { display: inline-flex; align-items: center; gap: 8px; }
.rec::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--violet); box-shadow: 0 0 10px var(--violet); animation: blink 1.6s infinite; flex: none; }
@keyframes blink { 50% { opacity: .25; } }

/* ---------- nav + timeline ---------- */
.nav { position: fixed; top: 0; left: 0; right: 0; z-index: 50; padding-top: env(safe-area-inset-top, 0px); transition: background .3s, border-color .3s; border-bottom: 1px solid transparent; }
.nav.scrolled { background: rgba(8,7,11,.8); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-color: var(--line); }
.nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { font-family: var(--serif); font-size: 19px; }
.logo span { color: var(--violet); }
.nav ul { display: flex; gap: 26px; list-style: none; }
.nav ul a { font-size: 14px; color: rgba(236,233,242,.68); transition: color .2s; }
.nav ul a:hover, .nav ul a.active { color: var(--text); }

.timeline { height: 0; overflow: hidden; transition: height .35s var(--ease); }
.nav .timeline .wrap { display: block; height: auto; }
.nav.scrolled .timeline { height: 26px; }
.tl { position: relative; height: 26px; display: flex; gap: 3px; align-items: center; }
.tl a { position: relative; height: 12px; border-radius: 3px; background: rgba(157,125,255,.12); border: 1px solid rgba(157,125,255,.18); font: 10px/10px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 0 6px; overflow: hidden; white-space: nowrap; display: flex; align-items: center; min-width: 0; transition: background .2s, color .2s; }
.tl a:hover, .tl a.active { background: rgba(157,125,255,.3); color: var(--text); }
.playhead { position: absolute; top: 2px; bottom: 2px; width: 1px; background: var(--violet-hot); box-shadow: 0 0 8px var(--violet); left: 0; pointer-events: none; }
.playhead::before { content: ""; position: absolute; top: -3px; left: -4px; border: 4px solid transparent; border-top-color: var(--violet-hot); }

/* ---------- hero: title card ---------- */
.hero { position: relative; height: clamp(560px, 90svh, 880px); overflow: hidden; display: flex; align-items: flex-end; justify-content: center; text-align: center; }
.hero-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 28%; transform: scale(1.06); animation: settle 2.4s var(--ease) forwards; }
@keyframes settle { to { transform: scale(1); } }
.hero .shade { position: absolute; inset: 0; background:
  linear-gradient(to top, var(--bg) 0%, rgba(8,7,11,.72) 24%, rgba(8,7,11,.18) 55%, rgba(8,7,11,.5) 100%),
  radial-gradient(70% 80% at 50% 40%, transparent 30%, rgba(8,7,11,.75) 100%),
  linear-gradient(to bottom, rgba(70,40,170,.18), rgba(70,40,170,.08)); }
.letterbox { position: absolute; left: 0; right: 0; height: 50%; background: #000; z-index: 3; pointer-events: none; animation: open 1.5s .15s var(--ease) forwards; }
.letterbox.top { top: 0; } .letterbox.bottom { bottom: 0; }
@keyframes open { to { height: 0; } }
.hero .frame { position: absolute; inset: 84px 28px 28px; pointer-events: none; z-index: 2; }
.hero .frame i { position: absolute; width: 24px; height: 24px; border: 0 solid rgba(236,233,242,.4); }
.hero .frame i:nth-child(1) { top: 0; left: 0; border-width: 1px 0 0 1px; }
.hero .frame i:nth-child(2) { top: 0; right: 0; border-width: 1px 1px 0 0; }
.hero .frame i:nth-child(3) { bottom: 0; left: 0; border-width: 0 0 1px 1px; }
.hero .frame i:nth-child(4) { bottom: 0; right: 0; border-width: 0 1px 1px 0; }
.hero .hud { position: absolute; z-index: 2; left: 46px; right: 46px; top: 96px; display: flex; justify-content: space-between; }
.hero .title { position: relative; z-index: 2; padding-bottom: clamp(48px, 8vh, 84px); animation: rise 1.2s .9s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
.hero h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(52px, 9vw, 124px); line-height: .95; letter-spacing: -.02em; }
.hero .role { margin-top: 18px; font-size: 13px; letter-spacing: .32em; text-transform: uppercase; color: rgba(236,233,242,.85); }
.hero .role b { color: var(--violet); font-weight: 400; }
.scroll-cue { display: inline-block; margin-top: 28px; width: 1px; height: 40px; background: linear-gradient(var(--violet), transparent); animation: cue 2s infinite; }
@keyframes cue { 0% { transform: scaleY(0); transform-origin: top; } 50% { transform: scaleY(1); transform-origin: top; } 51% { transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }

/* ---------- sections ---------- */
section.work { position: relative; padding: 72px 0; overflow-x: clip; }
.sec-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.sec-head h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(32px, 4.2vw, 48px); line-height: 1.05; }
.sec-head .label { margin-left: auto; }
.idx { font-family: var(--mono); font-size: 12px; color: var(--violet); letter-spacing: .1em; }

/* showreel */
.reel { position: relative; padding: 8px 0 0; }
.reel-box { position: relative; border-radius: 10px; overflow: hidden; box-shadow: 0 40px 90px -40px rgba(124,88,255,.5); }
.reel-box video { width: 100%; aspect-ratio: 2.39/1; object-fit: cover; filter: saturate(.85); }
.reel-box::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(8,7,11,.6), transparent 45%); pointer-events: none; }
.reel-meta { position: absolute; z-index: 1; left: 20px; right: 20px; bottom: 16px; display: flex; justify-content: space-between; align-items: center; }
.reel-meta .label { color: rgba(236,233,242,.85); }

/* ---------- films ---------- */
.film-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.film-tab { display: flex; gap: 14px; align-items: center; padding: 10px; text-align: left; border-radius: 12px; border: 1px solid var(--line); background: transparent; cursor: pointer; transition: border-color .25s, background .25s; min-width: 0; }
.film-tab img { width: 92px; aspect-ratio: 16/10; object-fit: cover; border-radius: 6px; flex: none; opacity: .7; transition: opacity .25s; }
.film-tab b { display: block; font-family: var(--serif); font-weight: 400; font-size: 19px; line-height: 1.2; }
.film-tab span { font-size: 12px; color: var(--muted); }
.film-tab:hover { border-color: rgba(157,125,255,.35); }
.film-tab[aria-selected="true"] { border-color: rgba(157,125,255,.55); background: var(--glass); }
.film-tab[aria-selected="true"] img { opacity: 1; }
.film-panel { animation: fade .5s var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }

.player { position: relative; border-radius: 10px; overflow: hidden; background: #000; box-shadow: 0 30px 80px -34px rgba(124,88,255,.4); }
.player.wide { aspect-ratio: 1280/536; }
.player.classic { aspect-ratio: 3/2; max-height: 72vh; margin: 0 auto; }
.player > img, .player video { width: 100%; height: 100%; object-fit: cover; }
.player video { object-fit: contain; background: #000; }
.play { position: absolute; inset: 0; border: 0; background: linear-gradient(to top, rgba(8,7,11,.55), rgba(8,7,11,.1) 60%); cursor: pointer; display: grid; place-items: center; }
.play .btn { width: 78px; height: 78px; border-radius: 50%; display: grid; place-items: center; background: rgba(157,125,255,.22); border: 1px solid rgba(185,162,255,.6); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: transform .35s var(--ease), background .3s; }
.play .btn::after { content: ""; margin-left: 5px; border-left: 18px solid #fff; border-top: 11px solid transparent; border-bottom: 11px solid transparent; }
.play:hover .btn { transform: scale(1.08); background: rgba(157,125,255,.45); }
.play .dur { position: absolute; right: 18px; bottom: 14px; }
.strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 6px; }
.strip img { width: 100%; object-fit: cover; border-radius: 5px; cursor: zoom-in; opacity: .78; transition: opacity .25s; }
.strip.wide img { aspect-ratio: 2.39/1; }
.strip.classic img { aspect-ratio: 3/2; }
.strip img:hover { opacity: 1; }
.credits { display: flex; gap: 10px 32px; flex-wrap: wrap; margin-top: 18px; font-size: 14px; color: var(--muted); }
.credits b { color: var(--text); font-weight: 500; }

/* ---------- youtube ---------- */
.case { display: grid; grid-template-columns: 1fr 1.55fr; gap: 28px; align-items: stretch; }
.channel { padding: 28px; display: flex; flex-direction: column; min-width: 0; }
.ch-head { display: flex; align-items: center; gap: 16px; }
.avatar { width: 66px; height: 66px; border-radius: 50%; flex: none; object-fit: cover; box-shadow: 0 0 0 3px rgba(157,125,255,.28), 0 0 28px rgba(124,88,255,.35); }
.ch-head h3 { font-family: var(--serif); font-weight: 400; font-size: 30px; line-height: 1.1; }
.ch-head .mono { display: block; margin-top: 2px; }
.ch-role { color: var(--muted); margin: 20px 0 22px; font-size: 15px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 24px; }
.stat { border-top: 1px solid var(--glass-line); padding-top: 14px; min-width: 0; }
.stat b { display: block; font-family: var(--serif); font-weight: 400; font-size: clamp(24px, 2.2vw, 30px); line-height: 1; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--muted); }
.textlink { margin-top: auto; align-self: flex-start; font-size: 14px; border-bottom: 1px solid rgba(157,125,255,.5); padding-bottom: 2px; transition: color .2s; }
.textlink:hover { color: var(--violet); }

.carousel { min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.car-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.car-stage { position: relative; border-radius: 10px; overflow: hidden; box-shadow: 0 30px 70px -35px rgba(124,88,255,.45); }
.track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.track::-webkit-scrollbar { display: none; }
.track img { flex: 0 0 100%; width: 100%; aspect-ratio: 16/9; object-fit: cover; scroll-snap-align: start; user-select: none; }
.car-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255,255,255,.18); background: rgba(8,7,11,.45); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: #fff; cursor: pointer; display: grid; place-items: center; opacity: 0; transition: opacity .25s, background .2s, border-color .2s; }
.car-btn svg { width: 16px; height: 16px; }
.car-btn.prev { left: 14px; } .car-btn.next { right: 14px; }
.car-stage:hover .car-btn, .car-btn:focus-visible { opacity: 1; }
.car-btn:hover { background: rgba(124,88,255,.55); border-color: var(--violet); }
@media (hover: none) { .car-btn { opacity: .85; width: 38px; height: 38px; } }
.car-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: rgba(255,255,255,.08); }
.car-progress i { display: block; height: 100%; width: 0; background: var(--violet); }
.thumbs-rail { display: flex; gap: 6px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.thumbs-rail::-webkit-scrollbar { display: none; }
.thumbs-rail button { flex: 0 0 64px; height: 36px; padding: 0; border: 1px solid transparent; border-radius: 4px; overflow: hidden; cursor: pointer; opacity: .45; background: none; transition: opacity .2s, border-color .2s; }
.thumbs-rail button img { width: 100%; height: 100%; object-fit: cover; }
.thumbs-rail button.on { opacity: 1; border-color: var(--violet); }
.thumbs-rail button:hover { opacity: .85; }

/* ---------- motion ---------- */
.mrow { display: flex; gap: 8px; margin-bottom: 8px; }
.mitem { position: relative; overflow: hidden; border-radius: 8px; background: #120f19; min-width: 0; }
.mitem video, .mitem img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease), filter .5s; filter: saturate(.92); }
.mitem:hover video, .mitem:hover img { transform: scale(1.04); filter: saturate(1.05); }
.mitem::after { content: ""; position: absolute; inset: auto 0 0; height: 64px; background: linear-gradient(to top, rgba(8,7,11,.85), transparent); pointer-events: none; }
.mitem span { position: absolute; z-index: 1; left: 14px; bottom: 11px; font-family: var(--serif); font-size: 16px; color: #fff; transition: transform .4s var(--ease); }
.mitem:hover span { transform: translateY(-3px); }
.mitem span small { font-family: var(--sans); font-size: 11px; color: rgba(255,255,255,.6); margin-left: 6px; }

/* ---------- contact ---------- */
.contact-card { padding: 34px; display: grid; grid-template-columns: 1fr auto; gap: 24px 40px; align-items: end; }
.contact-card h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(30px, 4vw, 44px); line-height: 1.05; margin-top: 6px; }
.contact-card p { color: var(--muted); margin: 8px 0 22px; }
.socials { display: flex; gap: 10px; flex-wrap: wrap; }
.social { display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px 10px 12px; border: 1px solid var(--glass-line); border-radius: 999px; font: 400 14px var(--sans); background: rgba(8,7,11,.35); color: var(--text); cursor: pointer; transition: border-color .2s, background .2s; }
.social:hover { border-color: var(--violet); background: rgba(124,88,255,.1); }
.social svg { width: 18px; height: 18px; fill: var(--violet); flex: none; }
.localtime { text-align: right; display: grid; gap: 4px; }
.localtime b { font-family: var(--serif); font-weight: 400; font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; }

footer { border-top: 1px solid var(--line); padding: 22px 0; margin-top: 20px; }
footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
footer a { margin-left: 18px; transition: color .2s; }
footer a:hover { color: var(--text); }

/* reveal: elements below the fold rise in once */
.pre { opacity: 0; transform: translateY(22px); }
.shown { opacity: 1; transform: none; transition: opacity .9s var(--ease), transform .9s var(--ease); }

/* lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(5,4,8,.94); z-index: 200; display: none; place-items: center; padding: 24px; cursor: zoom-out; }
.lightbox.open { display: grid; }
.lightbox img { max-height: 90vh; max-width: 92vw; border-radius: 6px; }

/* legal pages */
.legal { padding-top: 130px; padding-bottom: 90px; max-width: 760px; }
.legal h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(38px, 6vw, 60px); line-height: 1.05; margin-bottom: 32px; }
.legal h2 { font-size: 18px; font-weight: 500; margin: 32px 0 8px; }
.legal p, .legal li { color: #c9c5d2; margin-bottom: 12px; }
.legal a { color: var(--violet); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rec::before, .scroll-cue { animation: none; }
  .hero-photo, .letterbox, .hero .title { animation: none; transform: none; }
  .letterbox { height: 0; }
  .pre { opacity: 1; transform: none; }
}

@media (max-width: 860px) {
  .timeline { display: none; }
  .case { grid-template-columns: 1fr; }
  .mgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .mrow { display: contents; }
  .mrow .mitem { aspect-ratio: 1/1 !important; }
  .mgrid .mrow:first-child .mitem:first-child { grid-column: span 2; }
  .nav ul { gap: 18px; }
  .nav ul .hide-sm { display: none; }
  section.work { padding: 70px 0; }
  .hero-photo { object-position: 50% 22%; }
  .contact-card { grid-template-columns: 1fr; }
  .localtime { text-align: left; }
}
@media (max-width: 560px) {
  .wrap { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .hero .frame { inset: 74px 10px 10px; }
  .hero .hud { left: 24px; right: 24px; top: 86px; }
  .film-tabs { grid-template-columns: 1fr; }
  .film-tab img { width: 72px; }
  .sec-head .label { margin-left: 0; width: 100%; }
  .channel, .contact-card { padding: 22px; }
  .reel-meta .mono { display: none; }
  footer a { margin: 0 14px 0 0; }
}
