/* =========================================================
   MORGANA DARKNESS — styles
   Colors and fonts live in :root below. Change them there.
   ========================================================= */

:root {
  --bg: #060509;          /* near-black page background */
  --text: #ece7f3;        /* main text */
  --muted: #a39cb2;       /* small text, still readable */
  --faint: #5d576a;       /* decorative only */
  --violet: #a78bff;      /* hover / focus / hierarchy */
  --cyan: #6cf0ff;        /* "live" signals */

  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;

  --slow: cubic-bezier(.22, .61, .36, 1);
  --gutter: clamp(20px, 5vw, 64px);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); color-scheme: dark; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, video, canvas, svg { display: block; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 1px solid var(--violet); outline-offset: 4px; border-radius: 2px; }

/* ---------- Atmosphere overlays: film grain + rain ---------- */
.grain {
  position: fixed; inset: -50%; width: 200%; height: 200%;
  pointer-events: none; z-index: 50; opacity: .06;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 1s steps(4) infinite;
}
@keyframes grain {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-3%, 2%); }
  50%  { transform: translate(2%, -3%); }
  75%  { transform: translate(-1%, 3%); }
}
.rain {
  position: fixed; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 40; opacity: .55;
}

/* ---------- Transmission HUD (fixed, tiny) ---------- */
.hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  display: flex; justify-content: space-between; align-items: center;
  padding: max(6px, env(safe-area-inset-top)) var(--gutter) 0;
  font: 400 10.5px/1 var(--mono); letter-spacing: .2em; text-transform: uppercase;
  color: var(--muted);
  text-shadow: 0 1px 8px rgba(0, 0, 0, .8);
}
.status { display: flex; align-items: center; gap: .7em; min-height: 44px; }
.status__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--cyan); box-shadow: 0 0 8px var(--cyan);
  animation: pulse 2.6s ease-in-out infinite;
}
.status.is-glitch .status__dot { background: var(--violet); box-shadow: 0 0 8px var(--violet); }
.status.is-glitch .status__text { animation: flicker .6s steps(2) 3; }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes flicker { 50% { opacity: .15; } }

.hud__right { display: flex; align-items: center; gap: clamp(14px, 3vw, 28px); }
.clock { font-variant-numeric: tabular-nums; }
.clock__label { color: var(--faint); margin-right: .5em; }

.sound {
  display: flex; align-items: center; gap: .7em; min-height: 44px;
  background: none; border: 0; cursor: pointer;
  color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit;
  transition: color .4s;
}
.sound:hover { color: var(--text); }
.sound[aria-pressed="true"] { color: var(--cyan); }
.sound__bars { display: flex; align-items: flex-end; gap: 2px; height: 10px; }
.sound__bars i { width: 2px; height: 3px; background: currentColor; }
.sound[aria-pressed="true"] .sound__bars i { animation: eq 1.1s ease-in-out infinite; }
.sound__bars i:nth-child(2) { animation-delay: -.4s !important; }
.sound__bars i:nth-child(3) { animation-delay: -.8s !important; }
@keyframes eq { 50% { height: 10px; } }

.counter {
  position: fixed; left: var(--gutter); bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 60; font: 400 10px/1 var(--mono); letter-spacing: .24em;
  color: var(--faint); opacity: 0; transition: opacity 1.2s;
}
.counter.is-on { opacity: 1; }
.counter.is-on.is-hidden { opacity: 0; }
.counter b { color: var(--muted); font-weight: 400; }

/* ---------- Hero ---------- */
.hero {
  position: relative; height: 100vh; height: 100svh; min-height: 560px;
  overflow: hidden; display: flex; align-items: flex-end;
}
.hero__video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: 52% 30%;
  background: var(--bg) url("../assets/video/hero-poster.webp") 52% 30% / cover no-repeat;
}
/* Phones held upright: the video is wide and small, so instead of zooming it
   to fill the whole screen, it fills the top part and fades into the dark,
   over a blurred glow of itself. */
@media (max-aspect-ratio: 1/1) {
  .hero::before {
    content: ""; position: absolute; inset: 0;
    background: url("../assets/video/hero-poster.webp") 52% 30% / cover no-repeat;
    filter: blur(40px) saturate(1.2); opacity: .35; transform: scale(1.2);
  }
  .hero__video {
    height: 76%;
    -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent 100%);
            mask-image: linear-gradient(to bottom, #000 70%, transparent 100%);
  }
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(6,5,9,.6) 0%, rgba(6,5,9,0) 18%, rgba(6,5,9,0) 48%, rgba(6,5,9,.88) 82%, var(--bg) 100%),
    radial-gradient(ellipse at 50% 38%, transparent 35%, rgba(6,5,9,.55) 100%);
}
.hero__content {
  position: relative; z-index: 2; width: 100%;
  padding: 0 var(--gutter) calc(64px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center;
}
.hero__whisper {
  font-style: italic; font-weight: 300; color: var(--muted);
  font-size: clamp(1.15rem, 3.6vw, 1.55rem); letter-spacing: .02em;
}
.hero__name {
  font-weight: 300; text-transform: uppercase;
  font-size: clamp(2.1rem, 9.5vw, 5.4rem); line-height: .95; letter-spacing: .14em;
  margin-right: -.14em; /* balances the letter-spacing on the last letter */
}
.hero__name span { display: block; }
.js .hero__whisper, .js .hero__name, .js .hero__content .socials {
  opacity: 0; transform: translateY(14px);
  transition: opacity 2.4s var(--slow), transform 2.8s var(--slow);
}
.js .hero__name { transition-delay: .5s; }
.js .hero__content .socials { transition-delay: 1.1s; }
.is-ready .hero__whisper, .is-ready .hero__name, .is-ready .hero__content .socials {
  opacity: 1; transform: none;
}

.scroll-cue {
  position: absolute; z-index: 2; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: 1px; height: 36px; overflow: hidden; background: rgba(255, 255, 255, .08);
}
.scroll-cue::after {
  content: ""; position: absolute; left: 0; top: -40%; width: 1px; height: 40%;
  background: var(--muted); animation: cue 3.2s var(--slow) infinite;
}
@keyframes cue { to { top: 100%; } }

/* ---------- Social icons ---------- */
.socials { display: flex; gap: 4px; list-style: none; }
.socials a {
  display: flex; align-items: center; justify-content: center; gap: .6em;
  min-width: 48px; min-height: 48px; padding: 0 6px;
  color: var(--text); opacity: .82; transition: color .5s, opacity .5s;
}
.socials a:hover, .socials a:focus-visible { color: var(--violet); opacity: 1; }
.socials svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.socials__label { font: 400 10.5px/1 var(--mono); letter-spacing: .2em; text-transform: uppercase; }

/* ---------- Scroll sections ("frames") ---------- */
.frame {
  position: relative; height: 100vh; height: 100svh; min-height: 520px;
  overflow: hidden; display: flex; align-items: flex-end;
}
.frame--detail { height: 82vh; height: 82svh; }
.frame__media {
  position: absolute; inset: -6% 0; /* extra room for the slow drift */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 18%, #000 76%, transparent 100%);
          mask-image: linear-gradient(to bottom, transparent 0, #000 18%, #000 76%, transparent 100%);
}
.frame__media img {
  width: 100%; height: 100%; object-fit: cover; object-position: var(--focus, 50% 30%);
}
.js .frame__media img {
  opacity: 0; transform: scale(1.1);
  transition: opacity 2.8s var(--slow), transform 6s var(--slow);
}
.frame.is-in .frame__media img { opacity: 1; transform: scale(1.02); }

.frame::after, .duality__stage::after {  /* soft shade behind the line, for contrast */
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(to bottom, transparent 45%, rgba(6, 5, 9, .5) 78%, rgba(6, 5, 9, .2) 100%);
}
.frame__text {
  position: relative; z-index: 2; width: 100%;
  padding: 0 var(--gutter) 17svh;
}
.frame__line {
  max-width: 22ch;
  font-weight: 300; font-style: italic;
  font-size: clamp(1.75rem, 6.6vw, 3.5rem); line-height: 1.12;
  text-wrap: balance;
  text-shadow: 0 2px 24px rgba(0, 0, 0, .85), 0 0 2px rgba(0, 0, 0, .6);
}
.frame--right .frame__line { margin-left: auto; text-align: right; }
/* Every phrase sits inside quotation marks */
.frame__line::before { content: "\201C"; }
.frame__line::after  { content: "\201D"; }
.js .frame__line {
  opacity: 0; transform: translateY(26px); filter: blur(8px);
  transition: opacity 2.4s var(--slow) .8s, transform 2.8s var(--slow) .8s, filter 2.4s var(--slow) .8s;
}
.frame.is-in .frame__line { opacity: 1; transform: none; filter: none; }

/* ---------- The signature mark between sections ---------- */
.sigil {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  padding: 7svh 0;
  font: 400 10px/1 var(--mono); letter-spacing: .26em; text-transform: uppercase;
  color: var(--faint);
}
.sigil__line { width: 1px; height: 9svh; background: linear-gradient(transparent, var(--faint)); }
.sigil img { width: 52px; height: 52px; }
.js .sigil { opacity: 0; transition: opacity 2.4s var(--slow); }
.js .sigil.is-in { opacity: 1; }

/* ---------- Section 7: Heaven dissolves into Hell ---------- */
.duality { position: relative; height: 200vh; height: 200svh; }  /* taller = slower dissolve */
.duality__stage {
  position: sticky; top: 0; height: 100vh; height: 100svh;
  overflow: hidden; display: flex; align-items: flex-end;
}
.duality__img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: var(--focus, 50% 30%);
  -webkit-mask-image: linear-gradient(to bottom, #000 80%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 80%, transparent 100%);
}
/* Soft top edge only while the pair scrolls in; gone once it fills the screen */
.duality__stage::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 18%; z-index: 1;
  background: linear-gradient(to bottom, var(--bg), transparent);
  opacity: var(--enter, 1); pointer-events: none;
}
/* Both images share the exact same focus point and zoom, so her face stays locked in place */
.duality__img { object-position: 63% 25%; transform: scale(calc(1.05 - var(--p, 0) * .05)); transform-origin: 63% 25%; }
.duality__img--hell { opacity: var(--p, 0); }
/* Two phrases in the same spot: the Heaven phrase over Heaven, then the Hell phrase over Hell */
.duality .frame__line { display: grid; opacity: 1; filter: none; transform: none; transition: none; }
.duality .frame__line::before, .duality .frame__line::after { content: none; }
.duality__heaven-text, .duality__hell-text { grid-area: 1 / 1; align-self: end; }
.duality__heaven-text::before, .duality__hell-text::before { content: "\201C"; }
.duality__heaven-text::after, .duality__hell-text::after { content: "\201D"; }
.duality__heaven-text {
  opacity: var(--t1, 0);
  transform: translateY(calc((1 - var(--t1, 0)) * 20px));
}
.duality__hell-text {
  opacity: var(--t2, 0);
  transform: translateY(calc((1 - var(--t2, 0)) * 20px));
}

/* ---------- Footer ---------- */
.footer { position: relative; margin-top: 10svh; }
.frame--closing .frame__text { padding-bottom: 3svh; }
.frame--closing .frame__line { margin: 0 auto; text-align: center; max-width: 20ch; }
.footer__credits {
  position: relative; z-index: 45; /* above the rain */
  padding: 2svh var(--gutter) calc(48px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 30px; text-align: center;
}
.footer .socials { flex-wrap: wrap; justify-content: center; gap: 6px 22px; }
.footer__end {
  font: 400 10px/1 var(--mono); letter-spacing: .3em; text-transform: uppercase; color: var(--muted);
  animation: pulse 3.6s ease-in-out infinite;
}
.footer__logo-link { display: block; border-radius: 50%; margin-top: 4px; }
.footer__logo { width: 112px; height: auto; opacity: .85; transition: opacity .5s; }
.footer__logo-link:hover .footer__logo, .footer__logo-link:focus-visible .footer__logo { opacity: 1; }
.footer__credit { text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 3px; transition: color .5s; }
.footer__credit:hover, .footer__credit:focus-visible { color: var(--violet); }
.footer__note {
  max-width: 44ch; font: 400 11px/1.7 var(--mono); letter-spacing: .04em; color: var(--muted);
}

/* ---------- Larger screens ---------- */
@media (min-width: 900px) {
  .frame__text { padding-bottom: 16vh; }
  .frame__line { max-width: 18ch; }
}
@media (min-width: 900px) and (min-aspect-ratio: 1/1) {
  .hero__content { align-items: flex-start; text-align: left; gap: 18px; padding-bottom: 9vh; }
  .hero__name { font-size: clamp(2.6rem, 4.6vw, 4.6rem); margin-right: 0; }
  .hero__content .socials { margin-left: -10px; }
}

/* ---------- Reduced motion: no drifting, zooming, grain or rain ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
  .rain { display: none; }
  .js .frame__media img, .js .frame__line,
  .js .hero__whisper, .js .hero__name, .js .hero__content .socials,
  .duality__img, .duality__heaven-text, .duality__hell-text {
    transform: none !important; filter: none !important;
  }
  .frame__media { inset: 0; }
}
