/* Rohan Singh — 3D portfolio. Render-viewport look. */
:root {
  --bg: #0a0a09;
  --bg-2: #121210;
  --ink: #ecebe6;
  --dim: #8f8d86;
  --faint: #55534e;
  --line: rgba(236, 235, 230, .14);
  --accent: #ff5a2a;
  --ok: #9be07a;
  --serif: "Instrument Serif", "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --sans: "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  --pad: clamp(20px, 4.2vw, 64px);
  --hud: 14px;
  --ease: cubic-bezier(.2, .7, .1, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.55 var(--sans); -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
::selection { background: var(--accent); color: #000; }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; }

.mono { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.dim { color: var(--dim); }
.dot { display: inline-block; width: 6px; height: 6px; background: currentColor; margin-right: 8px; vertical-align: 1px; }
.dot.rec { background: var(--accent); border-radius: 50%; animation: blink 1.6s steps(2, start) infinite; }
@keyframes blink { 50% { opacity: .15; } }

/* ---------- HUD (fixed viewport overlay) ---------- */
.hud { position: fixed; inset: 0; pointer-events: none; z-index: 40; }
.hud .corner { position: absolute; width: 18px; height: 18px; border-color: rgba(236,235,230,.55); border-style: solid; border-width: 0; }
.hud .tl { top: var(--hud); left: var(--hud); border-top-width: 1px; border-left-width: 1px; }
.hud .tr { top: var(--hud); right: var(--hud); border-top-width: 1px; border-right-width: 1px; }
.hud .bl { bottom: var(--hud); left: var(--hud); border-bottom-width: 1px; border-left-width: 1px; }
.hud .br { bottom: var(--hud); right: var(--hud); border-bottom-width: 1px; border-right-width: 1px; }
.hud .ruler { position: absolute; top: 18vh; bottom: 18vh; width: 44px; overflow: hidden;
  -webkit-mask-image: linear-gradient(transparent, #000 15%, #000 85%, transparent);
          mask-image: linear-gradient(transparent, #000 15%, #000 85%, transparent); }
.hud .ruler.l { left: calc(var(--hud) + 4px); }
.hud .ruler.r { right: calc(var(--hud) + 4px); text-align: right; }
.hud .ruler-inner { will-change: transform; }
.hud .ruler span { display: block; height: 36px; font: 9px/1 var(--mono); color: rgba(236,235,230,.35); }
.hud .ruler.l span::before { content: "—"; margin-right: 6px; }
.hud .ruler.r span::after { content: "—"; margin-left: 6px; }
.hud .bar { position: absolute; left: 40px; right: 40px; bottom: calc(var(--hud) + 4px);
  display: flex; justify-content: space-between; gap: 24px; color: rgba(236,235,230,.7); }
.hud .bar > * { white-space: nowrap; }
.hud .reticle { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; opacity: 0; transition: opacity .4s; }
.hud .reticle::before, .hud .reticle::after { content: ""; position: absolute; background: rgba(236,235,230,.5); }
.hud .reticle::before { left: 50%; top: 0; bottom: 0; width: 1px; }
.hud .reticle::after { top: 50%; left: 0; right: 0; height: 1px; }
.at-top .hud .reticle { opacity: .6; }

.topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--hud) + 12px) 42px 0; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.topbar::before { content: ""; position: absolute; inset: 0 0 -40px; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, rgba(10,10,9,.92), rgba(10,10,9,.6) 55%, transparent); opacity: 0; transition: opacity .4s; }
body:not(.at-top) .topbar::before { opacity: 1; }
.logo { font: 400 26px/1 var(--serif); letter-spacing: .02em; display: flex; align-items: center; gap: 10px; }
.logo i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink); display: inline-block; }
.topbar .mid { position: absolute; left: 50%; transform: translateX(-50%); color: rgba(236,235,230,.6); }
.menu-btn { display: none; align-items: center; gap: 8px; padding: 8px 0; }
/* Computers: links in the top bar. Tablets and phones: the Menu fold-out. */
.top-nav { position: absolute; left: 50%; transform: translateX(-50%); display: flex; gap: clamp(18px, 2.4vw, 40px); }
.top-nav a { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: rgba(236,235,230,.72); padding: 8px 0; position: relative; transition: color .2s; }
.top-nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 2px; height: 1px; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .35s var(--ease); }
.top-nav a:hover { color: var(--ink); }
.top-nav a:hover::after { transform: scaleX(1); }
.top-cta { padding: 11px 14px; background: rgba(10,10,9,.35); }
@media (max-width: 1024px) {
  .topbar .top-nav, .topbar .top-cta { display: none; }
  .menu-btn { display: flex; }
}

/* Menu overlay */
.menu { position: fixed; inset: 0; z-index: 45; background: rgba(10,10,9,.96); backdrop-filter: blur(6px);
  display: grid; place-items: center; opacity: 0; visibility: hidden; transition: opacity .35s, visibility .35s; }
.menu.open { opacity: 1; visibility: visible; }
.menu nav { display: grid; gap: 4px; text-align: center; }
.menu nav a { font: 400 clamp(44px, 8vw, 96px)/1 var(--serif); text-transform: uppercase; letter-spacing: -.01em; transition: color .2s; }
.menu nav a:hover { color: var(--accent); }
.menu nav a small { font: 11px var(--mono); vertical-align: top; margin-right: 12px; color: var(--dim); }
.menu .menu-foot { position: absolute; bottom: 60px; left: 0; right: 0; display: flex; justify-content: center; gap: 28px; }

/* ---------- Type ---------- */
.display { font: 400 clamp(52px, 8.2vw, 132px)/.88 var(--serif); text-transform: uppercase; letter-spacing: -.015em; margin: 0; }
.h2 { font: 400 clamp(40px, 6.4vw, 96px)/.9 var(--serif); text-transform: uppercase; letter-spacing: -.01em; margin: 0; }
.h3 { font: 400 clamp(30px, 3.4vw, 48px)/.95 var(--serif); text-transform: uppercase; margin: 0; }
.lede { font-size: clamp(16px, 1.35vw, 19px); color: #c9c7c0; max-width: 46ch; }
em.it { font-style: italic; text-transform: none; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 14px; padding: 14px 18px; border: 1px solid var(--line);
  font: 11px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; transition: border-color .25s, background .25s, color .25s; }
.btn:hover { border-color: var(--ink); }
.btn.solid { background: var(--ink); color: #0a0a09; border-color: var(--ink); }
.btn.solid:hover { background: var(--accent); border-color: var(--accent); }
.btn .arr { transition: transform .25s var(--ease); }
.btn:hover .arr { transform: translateX(4px); }

/* ---------- Layout ---------- */
.wrap { padding: 0 calc(var(--pad) + 30px); }
section { position: relative; }
.sec { padding: clamp(90px, 14vh, 160px) 0; border-top: 1px solid var(--line); }
.sec-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; color: var(--dim); }
.sec-title { display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; align-items: end; margin-bottom: clamp(48px, 7vh, 80px); }
.sec-title p { margin: 0; justify-self: end; }

/* ---------- Hero ---------- */
.hero { position: relative; aspect-ratio: 16 / 9; width: 100%; overflow: hidden; } /* full reel frame, never cropped */
.hero .display { font-size: clamp(40px, 6.6vw, 116px); }
.hero .lede { font-size: clamp(14px, 1.25vw, 19px); margin: clamp(12px, 1.8vw, 26px) 0 clamp(14px, 2vw, 30px); }
.hero .kicker { margin-bottom: clamp(10px, 1.5vw, 22px); }
.hero video, .hero .hero-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(10,10,9,.82) 0%, rgba(10,10,9,.45) 38%, rgba(10,10,9,0) 65%),
              linear-gradient(180deg, rgba(10,10,9,.55) 0%, rgba(10,10,9,.1) 30%, rgba(10,10,9,.25) 60%, rgba(10,10,9,.92) 100%); }
.hero-content { position: absolute; z-index: 2; left: 0; right: 0; bottom: clamp(28px, 5vw, 70px); padding: 0 calc(var(--pad) + 30px);
  display: grid; grid-template-columns: 1fr auto; gap: 40px; align-items: end; }
.hero .kicker { margin-bottom: 22px; color: rgba(236,235,230,.75); }
.hero .lede { margin: 26px 0 30px; }
.hero .ctas { display: flex; gap: 12px; flex-wrap: wrap; }
.hero .side { text-align: right; display: grid; gap: 10px; color: rgba(236,235,230,.7); }
.play-reel { display: inline-flex; align-items: center; gap: 12px; justify-self: end; }
.play-reel .ring { width: 54px; height: 54px; border: 1px solid rgba(236,235,230,.5); border-radius: 50%; display: grid; place-items: center; transition: background .25s, border-color .25s; }
.play-reel:hover .ring { background: var(--ink); color: #000; border-color: var(--ink); }
.reveal-line { display: block; overflow: hidden; }
.reveal-line > span { display: block; transform: translateY(105%); transition: transform 1.1s var(--ease); }
.loaded .reveal-line > span { transform: none; }
.loaded .reveal-line:nth-child(2) > span { transition-delay: .08s; }
.loaded .reveal-line:nth-child(3) > span { transition-delay: .16s; }

/* ---------- Frame (bracketed media box) ---------- */
.frame { position: relative; overflow: hidden; background: var(--bg-2); }
.frame::before { content: ""; position: absolute; inset: 14px; z-index: 3; pointer-events: none;
  background:
    linear-gradient(var(--ink), var(--ink)) top left / 16px 1px, linear-gradient(var(--ink), var(--ink)) top left / 1px 16px,
    linear-gradient(var(--ink), var(--ink)) top right / 16px 1px, linear-gradient(var(--ink), var(--ink)) top right / 1px 16px,
    linear-gradient(var(--ink), var(--ink)) bottom left / 16px 1px, linear-gradient(var(--ink), var(--ink)) bottom left / 1px 16px,
    linear-gradient(var(--ink), var(--ink)) bottom right / 16px 1px, linear-gradient(var(--ink), var(--ink)) bottom right / 1px 16px;
  background-repeat: no-repeat; opacity: .8; }
.frame img, .frame video { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease), opacity .5s; }
.frame .tag { position: absolute; z-index: 4; color: rgba(236,235,230,.9); text-shadow: 0 1px 8px rgba(0,0,0,.6); }
.frame .tag.tl { top: 24px; left: 26px; } .frame .tag.tr { top: 24px; right: 26px; }
.frame .tag.bl { bottom: 24px; left: 26px; } .frame .tag.br { bottom: 24px; right: 26px; }
.frame .shade { position: absolute; inset: 0; z-index: 2; background: linear-gradient(180deg, rgba(0,0,0,.35), transparent 30%, transparent 70%, rgba(0,0,0,.45)); pointer-events: none; }

/* Bucket render reveal: tiles that clear when the frame scrolls into view */
.buckets { position: absolute; inset: 0; z-index: 2; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(5, 1fr); pointer-events: none; }
.buckets i { background: var(--bg-2); transition: opacity .25s linear; border: 1px solid rgba(255,255,255,.03); }
.buckets i.active { background: var(--bg-2); box-shadow: inset 0 0 0 1px rgba(255,90,42,.8); }
.rendered .buckets i { opacity: 0; }
.status { position: absolute; z-index: 4; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 7px 10px;
  border: 1px solid rgba(236,235,230,.5); background: rgba(10,10,9,.55); color: var(--ink); transition: opacity .5s .3s; white-space: nowrap; }
.status .ok { display: none; color: var(--ok); }
.rendered .status .ok { display: inline; }
.rendered .status .run { display: none; }
.rendered .status { opacity: 0; transition-delay: .9s; }

/* ---------- Work grid ---------- */
.work-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 3.4vw, 56px) clamp(20px, 2.4vw, 40px); }
.card { display: block; }
.card .frame { aspect-ratio: 16 / 9; }
.card.wide { grid-column: span 2; }
.card.wide .frame { aspect-ratio: 16 / 9; }
.card .frame video { position: absolute; inset: 0; opacity: 0; }
.card.playing .frame video { opacity: 1; }
.card .frame .tag { transition: opacity .3s; }
.card.playing .frame .tag, .card.playing .frame .shade { opacity: 0; }
.card:hover .frame img { transform: scale(1.035); }
.card .meta { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; margin-top: 18px; }
.card .meta .h3 { transition: color .25s; }
.card:hover .meta .h3 { color: var(--accent); }
.card .meta .mono { margin-top: 8px; display: block; }
.card .arr-up { font: 18px var(--mono); transition: transform .3s var(--ease); }
.card:hover .arr-up { transform: translate(3px, -3px); }

/* ---------- Simulations ---------- */
.sim-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.sim .frame { aspect-ratio: 1; }
.sim .frame::before { inset: 10px; }
.sim .cap { display: flex; justify-content: space-between; margin-top: 12px; gap: 10px; }
.sim .frame video { position: absolute; inset: 0; }

/* ---------- Stills masonry ---------- */
.stills { columns: 3; column-gap: 14px; }
.stills a { display: block; margin-bottom: 14px; break-inside: avoid; position: relative; }
.stills a .frame::before { inset: 10px; }
.stills a .cap { position: absolute; z-index: 4; left: 22px; bottom: 18px; opacity: 0; transform: translateY(6px); transition: .3s var(--ease); }
.stills a:hover .cap { opacity: 1; transform: none; }
.stills a:hover img { transform: scale(1.03); }

/* ---------- Services ---------- */
.services { border-top: 1px solid var(--line); }
.svc { display: grid; grid-template-columns: 90px 1.1fr 1fr 40px; gap: 30px; align-items: center; padding: 34px 0; border-bottom: 1px solid var(--line); transition: padding .4s var(--ease); }
.svc:hover { padding-left: 14px; }
.svc p { margin: 0; color: #bdbbb4; }
.svc .num { color: var(--dim); }

/* ---------- Explorations strip ---------- */
.strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.strip .frame { aspect-ratio: 1; }
.strip .frame::before { inset: 10px; }
.strip figure { margin: 0; }
.strip figcaption { margin-top: 10px; }

/* ---------- Numbers + clients ---------- */
.facts { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); }
.facts > div { padding: 30px 24px 10px 0; border-right: 1px solid var(--line); }
.facts > div:last-child { border-right: 0; }
.facts .big { font: 400 clamp(48px, 6vw, 92px)/1 var(--serif); margin-top: 18px; display: block; }
.logos { display: flex; flex-wrap: wrap; gap: 14px 60px; align-items: center; margin-top: 50px; }
.logos span { font: 400 clamp(34px, 4vw, 60px)/1 var(--serif); text-transform: uppercase; color: #cfcdc6; }
.tools { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.tools span { border: 1px solid var(--line); padding: 8px 12px; }

/* ---------- About ---------- */
.about { display: grid; grid-template-columns: .8fr 1fr; gap: clamp(30px, 6vw, 100px); align-items: start; }
.about .frame { aspect-ratio: 4 / 5; }
.about .frame img { filter: grayscale(1) contrast(1.05); }
.about p { color: #c9c7c0; font-size: 18px; max-width: 52ch; }

/* ---------- Contact ---------- */
.contact { text-align: center; padding: clamp(120px, 20vh, 220px) 0; border-top: 1px solid var(--line); }
.contact .display { font-size: clamp(52px, 9vw, 150px); }
.contact .lede { margin: 30px auto 40px; }
.contact .ctas { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

footer { border-top: 1px solid var(--line); padding: 60px 0 90px; }
.foot { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; }
.foot h4 { margin: 0 0 16px; color: var(--dim); font-weight: 400; }
.foot a { display: block; padding: 3px 0; color: #cfcdc6; }
.foot a:hover { color: var(--accent); }
.foot .logo { font-size: 44px; }
.foot-bottom { display: flex; justify-content: space-between; margin-top: 60px; color: var(--faint); }

/* ---------- Project page ---------- */
.p-hero { padding-top: 120px; }
.p-head { display: grid; grid-template-columns: 1fr auto; gap: 30px; align-items: end; margin-bottom: 36px; }
.player { position: relative; background: #000; }
.player video { width: 100%; max-height: 82vh; background: #000; }
.player.square video { max-width: min(100%, 82vh); margin: 0 auto; }
.p-info { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; padding: 60px 0; border-bottom: 1px solid var(--line); }
.p-specs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border-top: 1px solid var(--line); }
.p-specs div { padding: 18px 18px 18px 0; border-bottom: 1px solid var(--line); }
.p-specs b { display: block; font: 400 15px var(--sans); margin-top: 8px; text-transform: none; letter-spacing: 0; color: var(--ink); }
.gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 60px 0; }
.gallery a:first-child { grid-column: span 2; }
.gallery a .frame::before { inset: 12px; }
.next { display: block; padding: 90px 0 120px; border-top: 1px solid var(--line); text-align: center; }
.next .display { transition: color .25s; }
.next:hover .display { color: var(--accent); }

/* ---------- Lightbox ---------- */
.lb { position: fixed; inset: 0; z-index: 60; background: rgba(5,5,5,.96); display: none; align-items: center; justify-content: center; padding: 70px 70px; }
.lb.open { display: flex; }
.lb .lb-body { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.lb img, .lb video { max-width: 100%; max-height: 100%; object-fit: contain; }
.lb .lb-close { position: absolute; top: 26px; right: 32px; }
.lb .lb-count { position: absolute; top: 30px; left: 34px; }
.lb .lb-prev, .lb .lb-next { position: absolute; top: 50%; transform: translateY(-50%); font: 22px var(--mono); padding: 20px; }
.lb .lb-prev { left: 10px; } .lb .lb-next { right: 10px; }

/* ---------- Scroll reveal ---------- */
.rv { opacity: 0; transform: translateY(26px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.rv.in { opacity: 1; transform: none; }

/* Blurred text entrance (words are wrapped by app.js) */
.bt .w { display: inline-block; opacity: 0; filter: blur(14px); transform: translateY(.28em);
  transition: opacity .9s var(--ease), filter 1.1s var(--ease), transform 1.1s var(--ease); will-change: filter, opacity; }
.bt.bt-in .w { opacity: 1; filter: blur(0); transform: none; }
.bt .reveal-line { overflow: visible; }
.bt .reveal-line > span { transform: none; transition: none; }

/* Parallax: stills sit slightly larger than their frame and move inside it */
.frame img.par-in { scale: 1.08; }
.work-grid .card { will-change: translate; }

/* Phones only: reel on top at full 16:9, text underneath */
@media (max-width: 760px) {
  .hero { aspect-ratio: auto; overflow: visible; padding-top: 70px; }
  .hero .hero-media { position: relative !important; inset: auto !important; aspect-ratio: 16 / 9; }
  .hero::after { display: none; }
  .hero-content { position: relative; bottom: auto; padding-top: 40px; padding-bottom: 20px; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .sim-grid { grid-template-columns: repeat(3, 1fr); }
  .hud .bar .mid, .topbar .mid { display: none; }
}
@media (max-width: 760px) {
  :root { --hud: 8px; }
  .wrap { padding: 0 22px; }
  .topbar { padding: 20px 22px 0; }
  .hud .ruler { display: none; }
  .hud .bar { left: 22px; right: 22px; bottom: 14px; font-size: 9px; }
  .hud .bar .hide-sm { display: none; }
  .hero-content { grid-template-columns: 1fr; bottom: auto; padding: 34px 22px 10px; }
  .hero .side { display: none; }
  .sec-title, .about, .p-info, .p-head { grid-template-columns: 1fr; }
  .sec-title p { justify-self: start; }
  .work-grid { grid-template-columns: 1fr; }
  .card.wide { grid-column: auto; }
  .sim-grid { grid-template-columns: 1fr 1fr; }
  .stills { columns: 2; column-gap: 10px; }
  .stills a { margin-bottom: 10px; }
  .strip { grid-template-columns: 1fr 1fr; }
  .svc { grid-template-columns: 40px 1fr; gap: 8px 16px; }
  .svc p { grid-column: 2; }
  .svc .arr-up { display: none; }
  .facts { grid-template-columns: 1fr 1fr; }
  .facts > div:nth-child(2) { border-right: 0; }
  .foot { grid-template-columns: 1fr 1fr; }
  .foot > div:first-child { grid-column: span 2; }
  .foot-bottom { flex-direction: column; gap: 8px; }
  .gallery { grid-template-columns: 1fr; }
  .gallery a:first-child { grid-column: auto; }
  .p-specs { grid-template-columns: 1fr 1fr; }
  .lb { padding: 60px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .rv { opacity: 1; transform: none; }
  .reveal-line > span { transform: none; }
  .buckets { display: none; }
}
