/* BIRAJ — complete pear.no experience system, built fresh:
   living-film canvas hero, draw-on emblem, fullscreen menu, pinned scroll
   film, horizontal field manual, blueprint overlay, chapter rail, masked +
   per-character reveals, ink type, chromatic glitch, paper finale. */

:root {
  --noir: #060a12;
  --press: #0b0a09;
  --paper: #f2f1ed;
  --ink: #1d1c19;
  --ice: #8fdcff;
  --ice-deep: #2ea8de;
  --ember: #ff4a33;
  --ember-deep: #b3122e;
  --sky: #015186;
  --rule-d: rgba(242,241,237,.13);
  --rule-l: rgba(29,28,25,.16);
  --ease-press: cubic-bezier(.22,1,.36,1);
  --serif: "Playfair Display", Georgia, serif;
  --cond: "Anton", "Arial Narrow", sans-serif;
  --mono: "Space Mono", ui-monospace, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scrollbar-width: none; }
::-webkit-scrollbar { display: none; }
::selection { background: var(--sky); color: var(--paper); }

body {
  background: var(--noir); color: var(--paper);
  font-family: var(--serif); overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body.menu-open { overflow: hidden; }

/* ---------- film grain ---------- */
.grain {
  position: fixed; inset: 0; z-index: 90; pointer-events: none; opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  animation: grainShift 1.1s steps(4) infinite;
}
@keyframes grainShift {
  0% { background-position: 0 0; } 25% { background-position: -70px 40px; }
  50% { background-position: 50px -60px; } 75% { background-position: -40px -50px; }
  100% { background-position: 0 0; }
}

#smooth { will-change: transform; }

/* ---------- blueprint overlay ---------- */
.blueprint { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
.rule { position: absolute; background: var(--rule-d); transition: background .8s var(--ease-press); }
.rule.v1 { left: 5.3%; top: 0; bottom: 0; width: 1px; }
.rule.v2 { left: 85.6%; top: 0; bottom: 0; width: 1px; }
.rule.h1 { left: 0; right: 0; top: 5.3vw; height: 1px; }
body.on-paper .rule { background: var(--rule-l); }
body.on-paper .blueprint { color: var(--ink); }

.spark { position: absolute; width: 11px; height: 11px; color: var(--paper); opacity: .85; animation: twinkle 3.2s ease-in-out infinite; }
body.on-paper .spark { color: var(--ink); }
.spark.s1 { left: calc(5.3% - 5px); top: 5.3vw; }
.spark.s2 { left: calc(85.6% - 5px); top: 5.3vw; animation-delay: .8s; }
.spark.s3 { left: calc(5.3% - 5px); top: 32%; animation-delay: 1.6s; }
.spark.s4 { left: calc(85.6% - 5px); top: 58%; animation-delay: 2.2s; }
.spark.s5 { left: calc(5.3% - 5px); top: 82%; animation-delay: 1.1s; }
.spark.s6 { left: calc(85.6% - 5px); top: 12%; animation-delay: 2.7s; }
@keyframes twinkle { 0%,100% { transform: scale(.55) rotate(0deg); opacity: .35; } 50% { transform: scale(1) rotate(90deg); opacity: .9; } }

/* ---------- micro labels ---------- */
.micro {
  position: fixed; z-index: 41; pointer-events: none;
  font-family: var(--mono); font-size: 10px; letter-spacing: .22em;
  color: rgba(242,241,237,.62); text-transform: uppercase;
  transition: color .8s var(--ease-press), opacity .5s var(--ease-press);
}
.micro i { font-style: normal; opacity: .4; margin: 0 .5em; }
.micro.tl { top: calc(5.3vw + 14px); left: calc(5.3% + 14px); }
.micro.bl { bottom: 26px; left: calc(5.3% + 14px); }
.micro.br { bottom: 26px; right: calc(14.4% + 14px); }
.micro.center { position: static; text-align: center; }
body.on-paper .micro { color: rgba(29,28,25,.6); }
body.menu-open .micro { opacity: 0; }

/* ---------- chapter rail ---------- */
.rail {
  position: fixed; z-index: 42; top: 50%; transform: translateY(-50%);
  width: 196px; right: max(16px, calc(14.4% - 212px));
  display: flex; flex-direction: column; gap: 2px;
  transition: opacity .5s var(--ease-press);
}
.rail button {
  background: none; border: 0; cursor: pointer; text-align: right; width: 100%;
  font-family: var(--mono); font-size: 10px; letter-spacing: .18em; white-space: nowrap;
  color: rgba(242,241,237,.34); text-transform: uppercase;
  padding: 7px 0; display: flex; gap: 10px; align-items: baseline; justify-content: flex-end;
  transition: color .45s var(--ease-press), transform .45s var(--ease-press);
}
.rail button b { font-weight: 400; opacity: .7; }
.rail button:hover { color: rgba(242,241,237,.85); }
.rail button.on { color: var(--paper); transform: translateX(-8px); }
body.on-paper .rail button { color: rgba(29,28,25,.38); }
body.on-paper .rail button.on, body.on-paper .rail button:hover { color: var(--ink); }
body.menu-open .rail { opacity: 0; pointer-events: none; }

/* ---------- header ---------- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px calc(5.3% + 14px);
  pointer-events: none; transition: opacity .5s var(--ease-press);
}
.brand {
  display: flex; align-items: center; gap: 12px; text-decoration: none;
  font-family: var(--cond); font-size: 1rem; letter-spacing: .4em; color: #fff;
  pointer-events: auto; mix-blend-mode: difference;
}
.mark { width: 34px; height: 34px; overflow: visible; }
.mark-draw {
  fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 100; stroke-dashoffset: 100;
  animation: drawMark 1.6s var(--ease-press) .3s forwards;
}
.mark-draw.d2 { animation-delay: .9s; animation-duration: 1s; }
@keyframes drawMark { to { stroke-dashoffset: 0; } }
.menu-btn {
  pointer-events: auto; background: none; border: 0; cursor: pointer;
  display: flex; align-items: center; gap: 12px; mix-blend-mode: difference; color: #fff;
  font-family: var(--mono); font-size: 10px; letter-spacing: .3em;
}
.dots { display: grid; grid-template-columns: repeat(2, 5px); gap: 4px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: #fff; transition: transform .4s var(--ease-press); }
.menu-btn:hover .dots i:nth-child(1) { transform: translate(-2px,-2px); }
.menu-btn:hover .dots i:nth-child(2) { transform: translate(2px,-2px); }
.menu-btn:hover .dots i:nth-child(3) { transform: translate(-2px,2px); }
.menu-btn:hover .dots i:nth-child(4) { transform: translate(2px,2px); }
body.menu-open .site-header { opacity: 0; pointer-events: none; }

/* ---------- fullscreen menu ---------- */
.menu {
  position: fixed; inset: 0; z-index: 70;
  visibility: hidden; opacity: 0;
  transition: opacity .6s var(--ease-press), visibility 0s .6s;
}
.menu.open { visibility: visible; opacity: 1; transition: opacity .6s var(--ease-press); }
.menu-bg { position: absolute; inset: 0; background: rgba(4,7,13,.94); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.menu-close {
  position: absolute; top: 26px; right: calc(5.3% + 14px); z-index: 2;
  background: none; border: 1px solid rgba(242,241,237,.25); border-radius: 999px;
  color: var(--paper); font-family: var(--mono); font-size: 10px; letter-spacing: .3em;
  padding: 12px 22px 12px 26px; cursor: pointer;
  transition: background .4s var(--ease-press), color .4s var(--ease-press);
}
.menu-close:hover { background: var(--paper); color: var(--ink); }
.menu-kicker { position: absolute; top: 30px; left: calc(5.3% + 14px); z-index: 2; }
.menu-links {
  position: absolute; inset: 0; z-index: 1; overflow-y: auto;
  display: flex; flex-direction: column; justify-content: center;
  padding: 12vh clamp(1.5rem, 9vw, 10rem);
}
.menu-links a {
  display: flex; align-items: baseline; gap: 22px; text-decoration: none;
  font-weight: 900; font-size: clamp(2rem, 6.5vh, 4.2rem); line-height: 1.25;
  color: var(--paper); border-bottom: 1px solid rgba(242,241,237,.1);
  padding: .35em 0;
  opacity: 0; transform: translateY(40px);
  transition: opacity .7s var(--ease-press), transform .7s var(--ease-press), color .3s;
}
.menu.open .menu-links a { opacity: 1; transform: none; }
.menu.open .menu-links a:nth-child(1) { transition-delay: .08s; }
.menu.open .menu-links a:nth-child(2) { transition-delay: .13s; }
.menu.open .menu-links a:nth-child(3) { transition-delay: .18s; }
.menu.open .menu-links a:nth-child(4) { transition-delay: .23s; }
.menu.open .menu-links a:nth-child(5) { transition-delay: .28s; }
.menu.open .menu-links a:nth-child(6) { transition-delay: .33s; }
.menu.open .menu-links a:nth-child(7) { transition-delay: .38s; }
.menu.open .menu-links a:nth-child(8) { transition-delay: .43s; }
.menu-links a b { font-family: var(--mono); font-weight: 400; font-size: 12px; letter-spacing: .25em; color: var(--ice); }
.menu-links a span { font-style: italic; font-weight: 700; }
.menu-links:hover a { color: rgba(242,241,237,.25); }
.menu-links a:hover { color: var(--paper); padding-left: 18px; }
.menu-foot { position: absolute; bottom: 26px; left: calc(5.3% + 14px); z-index: 2; }

/* ---------- hero: living film ---------- */
.hero { position: relative; height: 100svh; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.film-poster, .film-canvas, .film-src { position: absolute; inset: 0; width: 100%; height: 100%; }
.film-poster { object-fit: cover; object-position: center; }
.film-canvas { object-fit: cover; }
.film-src { display: none; }
.shade {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(6,10,18,.6), rgba(6,10,18,.12) 38%, rgba(6,10,18,.28) 66%, rgba(6,10,18,.94));
}
.scene.paper .shade {
  background: linear-gradient(to bottom, rgba(242,241,237,.42), rgba(242,241,237,.06) 40%, rgba(242,241,237,.1) 70%, rgba(242,241,237,.9));
}

.hero-copy { position: relative; z-index: 2; text-align: center; padding: 0 1.5rem; }
.kicker {
  font-family: var(--mono); font-size: 11px; letter-spacing: .3em; text-indent: .3em;
  color: var(--ice); margin-bottom: 1.4rem; text-transform: uppercase;
}
.giant {
  font-family: var(--cond); font-size: clamp(4.5rem, 19vw, 17rem); line-height: .88;
  letter-spacing: .05em; color: var(--paper);
}
.inked { filter: url(#inkf); }
.tagline { margin-top: 1.5rem; font-size: clamp(1.15rem, 2.6vw, 1.8rem); font-style: italic; line-height: 1.5; color: rgba(242,241,237,.92); }
.tagline em { color: var(--ice); }
.tagline.sm { font-size: clamp(1rem, 2vw, 1.35rem); margin-top: 1rem; }
.tagline span { display: block; }

.reveal { overflow: hidden; }
.reveal > span { display: inline-block; transform: translateY(130%); animation: riseIn 1.1s var(--ease-press) forwards; }
.tagline.reveal > span:nth-child(2) { animation-delay: .15s; }
@keyframes riseIn { to { transform: translateY(0); } }

.scroll-hint {
  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 9px; letter-spacing: .4em; text-indent: .4em; color: rgba(255,255,255,.55);
}
.scroll-hint span { width: 1px; height: 42px; background: linear-gradient(var(--ice), transparent); animation: drop 1.8s var(--ease-press) infinite; }
@keyframes drop { 0% { transform: scaleY(0); transform-origin: top; } 55% { transform: scaleY(1); transform-origin: top; } 56% { transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }

/* ---------- scroll film ---------- */
.track { position: relative; height: 800vh; }
.pin { position: sticky; top: 0; height: 100svh; overflow: hidden; }

.scene { position: absolute; inset: 0; opacity: 0; visibility: hidden; }
.scene .bg-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.scene .copy { position: absolute; z-index: 2; inset: 0; display: flex; flex-direction: column; justify-content: center; padding: 0 clamp(1.5rem, 9vw, 10rem); }

.ch-no {
  font-family: var(--mono); font-size: 11px; letter-spacing: .28em;
  margin-bottom: 1.3rem; color: var(--ice); text-transform: uppercase;
}
.scene.ember .ch-no { color: var(--ember); }
.scene.clash .ch-no {
  background: linear-gradient(90deg, var(--ice), var(--ember));
  -webkit-background-clip: text; background-clip: text; color: transparent; width: fit-content;
}
.scene.paper .ch-no { color: var(--ember-deep); }

.copy h2, .hpanel h2 {
  font-weight: 900; font-size: clamp(2.4rem, 6.4vw, 6rem); line-height: 1.0;
  max-width: 15ch; text-wrap: balance; color: var(--paper);
  text-shadow: 0 4px 70px rgba(0,0,0,.5);
}
.scene.paper .copy h2 { color: var(--ink); text-shadow: none; }
.copy h2 .it, .hpanel h2 .it { font-style: italic; font-weight: 700; }
.scene.ice .it, .hpanel .it { color: var(--ice); }
.scene.ember .it { color: var(--ember); }
.scene.clash .it {
  background: linear-gradient(100deg, var(--ice) 15%, var(--ember) 85%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.scene.paper .it { color: var(--ember-deep); }

.standfirst {
  margin-top: 1.5rem; font-family: var(--mono); font-size: 12px; letter-spacing: .06em;
  line-height: 1.9; color: rgba(242,241,237,.66); max-width: 52ch;
}
.scene.paper .standfirst { color: rgba(29,28,25,.62); }

.mask { display: block; overflow: hidden; padding-bottom: .08em; margin-bottom: -.08em; }
.mask > span { display: block; transform: translateY(135%); transition: transform 1.05s var(--ease-press); }
.scene.lit .mask > span, .hpanel.lit .mask > span { transform: translateY(0); }
.scene.lit .ch-no .mask > span, .hpanel.lit .ch-no .mask > span { transition-delay: .05s; }
.scene.lit h2 .mask:nth-child(2) > span, .hpanel.lit h2 .mask:nth-child(2) > span { transition-delay: .14s; }
.scene.lit .standfirst .mask > span, .hpanel.lit .standfirst .mask > span { transition-delay: .3s; }

.standfirst .ch {
  display: inline-block; opacity: 0; transform: translateY(.55em);
  transition: opacity .45s var(--ease-press), transform .45s var(--ease-press);
}
.scene.lit .standfirst .ch, .hpanel.lit .standfirst .ch { opacity: 1; transform: none; }

@keyframes glitch {
  0% { text-shadow: -4px 0 0 rgba(255,74,51,.85), 4px 0 0 rgba(143,220,255,.85); transform: translateX(0); }
  30% { transform: translateX(-5px); }
  60% { text-shadow: 4px 0 0 rgba(255,74,51,.85), -4px 0 0 rgba(143,220,255,.85); transform: translateX(5px); }
  100% { text-shadow: 0 4px 70px rgba(0,0,0,.5); transform: none; }
}
.scene.glitch h2, .hpanel.glitch h2 { animation: glitch .45s steps(3) 1; }

.halftone {
  position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: .14;
  background-image: radial-gradient(rgba(29,28,25,.9) 1px, transparent 1.7px);
  background-size: 9px 9px;
  mask-image: linear-gradient(to bottom, transparent 42%, black 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 42%, black 100%);
}

/* ---------- horizontal field manual ---------- */
.hwrap { position: relative; height: 430vh; background: var(--noir); }
.hpin { position: sticky; top: 0; height: 100svh; overflow: hidden; }
.htrack { display: flex; height: 100%; width: 400vw; will-change: transform; }
.hpanel {
  position: relative; flex: 0 0 100vw; width: 100vw; height: 100%;
  overflow: hidden; display: flex; align-items: center;
  border-right: 1px solid rgba(242,241,237,.08);
}
.hpanel .art { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: .42; }
.hpanel .hnum {
  position: absolute; right: 2vw; bottom: -3vh; z-index: 1;
  font-family: var(--cond); font-size: 30vw; line-height: 1;
  color: transparent; -webkit-text-stroke: 2px rgba(143,220,255,.1);
  pointer-events: none; user-select: none;
}
.hpanel:nth-child(3) .hnum { -webkit-text-stroke-color: rgba(255,74,51,.13); }
.hpanel .hcopy { position: relative; z-index: 2; padding: 0 clamp(1.5rem, 9vw, 10rem); max-width: 1000px; }
.hpanel h2 { font-size: clamp(2.6rem, 7vw, 6.4rem); }
.hpanel h2 .it { color: var(--ice); }
.hpanel:nth-child(3) h2 .it { color: var(--ember); }
.hpanel .ch-no { color: var(--ice); }
.hpanel:nth-child(3) .ch-no { color: var(--ember); }
.hbar { position: absolute; z-index: 3; left: 9vw; right: 9vw; bottom: 7vh; height: 1px; background: rgba(242,241,237,.14); }
.hbar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--ice-deep), var(--ice)); }
.hhint { position: absolute; z-index: 3; bottom: calc(7vh + 14px); left: 9vw; }

/* ---------- footer finale ---------- */
.finale {
  position: relative; background: var(--press); color: var(--paper);
  padding: clamp(5rem, 12vh, 8rem) 1.5rem 2.6rem; text-align: center; overflow: hidden;
}
.drawframe { position: absolute; inset: 26px; width: calc(100% - 52px); height: calc(100% - 52px); pointer-events: none; }
.drawframe rect {
  fill: none; stroke: rgba(242,241,237,.4); stroke-width: 1; vector-effect: non-scaling-stroke;
  stroke-dasharray: 400; stroke-dashoffset: 400;
  transition: stroke-dashoffset 1.8s var(--ease-press);
}
.finale.draw .drawframe rect { stroke-dashoffset: 0; }
.frame-sparks .spark {
  position: absolute; width: 13px; height: 13px; color: var(--paper);
  transform: scale(0); transition: transform .7s var(--ease-press);
}
.finale.draw .frame-sparks .spark { transform: scale(1); }
.finale.draw .frame-sparks .f2 { transition-delay: .5s; }
.finale.draw .frame-sparks .f3 { transition-delay: 1s; }
.finale.draw .frame-sparks .f4 { transition-delay: 1.5s; }
.frame-sparks .f1 { top: 19px; left: 19px; } .frame-sparks .f2 { top: 19px; right: 19px; }
.frame-sparks .f3 { bottom: 19px; left: 19px; } .frame-sparks .f4 { bottom: 19px; right: 19px; }
.giant.low {
  font-family: var(--cond); font-size: clamp(4rem, 17vw, 15rem); line-height: 1;
  color: var(--paper); margin: 1.2rem 0 .6rem; letter-spacing: .02em;
}
.finale .meta {
  margin-top: 3rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  font-family: var(--mono); font-size: 10px; letter-spacing: .22em; color: rgba(242,241,237,.42);
  border-top: 1px solid rgba(242,241,237,.12); padding-top: 1.4rem; text-align: left;
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .rail { display: none; }
  .micro.br { right: 18px; }
  .copy h2, .hpanel h2 { font-size: clamp(2.1rem, 10.5vw, 3.4rem); }
  .rule.v2 { left: 94%; }
  .spark.s2, .spark.s4, .spark.s6 { left: calc(94% - 5px); }
  .menu-links a { font-size: clamp(1.6rem, 7vw, 2.4rem); }
}

@media (prefers-reduced-motion: reduce) {
  .grain, .scroll-hint span, .spark, .mark-draw { animation: none; }
  .film-canvas { display: none; }
  .film-poster { display: block; }
  .mask > span, .reveal > span, .standfirst .ch { transform: none !important; opacity: 1 !important; animation: none; }
  .mark-draw { stroke-dashoffset: 0; }
  .scene { position: relative; height: 100svh; opacity: 1 !important; visibility: visible !important; }
  .track { height: auto; } .pin { position: static; height: auto; }
  .hwrap { height: auto; }
  .hpin { position: static; height: auto; }
  .htrack { width: auto; flex-direction: column; transform: none !important; }
  .hpanel { flex: none; width: 100%; height: 82svh; border-right: 0; border-bottom: 1px solid rgba(242,241,237,.08); }
  .hbar, .hhint { display: none; }
  .finale .drawframe rect { stroke-dashoffset: 0; }
  .frame-sparks .spark { transform: scale(1); }
}
