/* Midnight Shlice — artist page. Concept: a midnight jazz LP.
   Front cover = hero. Scroll flips the record. Back cover = tracklist of links. */

@font-face {
  font-family: "Fraunces";
  src: url("../assets/fonts/fraunces.woff2") format("woff2");
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("../assets/fonts/fraunces-italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 300 700;
  font-display: swap;
}

:root {
  --gold: #e8c778;
  --gold-dim: #b99a52;
  --ink: #f4f1e9;
  --muted: #9aa3ad;
  --bg0: #0a0e17;
  --bg1: #111a2b;
  --line: rgba(232, 199, 120, .18);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --hero-grade: saturate(.72) sepia(.28) hue-rotate(-14deg) contrast(1.06) brightness(.9);
  /* film grain: inline SVG turbulence, tiled */
  --grain: 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='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .6 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.16'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg0);
  color: var(--ink);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------- FRONT COVER ---------- */

.hero {
  position: sticky;
  top: 0;
  height: 100vh;
  /* svh, not dvh: iOS toolbar collapse changes dvh mid-scroll, which would
     shift the sticky region and the dissolve's progress denominator */
  height: 100svh;
  overflow: hidden;
  z-index: 1;
}

.hero-media { position: absolute; inset: 0; background: var(--bg0); }

/* poster paints instantly (39KB) while the full hero jpeg streams in.
   It lives on ::before (below img/canvas) and MUST disappear once a live
   layer owns the hero — dissolved shader cells are transparent, and
   anything behind them shows through the flip effect. */
.hero-media::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("../assets/poster.jpg") 50% 28% / cover no-repeat;
  filter: var(--hero-grade);
}
/* html.static keeps the poster: its img is always fully opaque (no fade
   loop), so nothing can bleed through, and slow reduced-motion loads get
   the 39KB fast paint instead of flat navy */
html.webgl-on .hero-media::before,
html.no-webgl.hero-loaded .hero-media::before { display: none; }
/* (no-webgl WITHOUT hero-loaded keeps the poster: if the big image is slow
   or broken, the 39KB poster is the hero — never a blank gradient) */

.hero-media :is(img, video),
.hero-media canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  filter: var(--hero-grade);
}

.hero-media :is(img, video) { object-fit: cover; object-position: 50% 28%; }
/* canvas is always laid out (never display:none before init — it must have
   a measurable size when WebGL sizes its buffer); transparent until drawn */
html.webgl-on .hero-media :is(img, video) { visibility: hidden; }
html.no-webgl .hero-media canvas { display: none; }

/* grade + atmosphere above image AND canvas */
.hero-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    var(--grain) repeat,
    radial-gradient(120% 90% at 50% 20%, transparent 40%, rgba(10, 14, 23, .55) 100%),
    linear-gradient(180deg, rgba(10, 14, 23, .35) 0%, transparent 30%, transparent 55%, rgba(10, 14, 23, .92) 100%),
    linear-gradient(200deg, rgba(232, 199, 120, .10), transparent 45%);
  background-blend-mode: overlay, normal, normal, normal;
  pointer-events: none;
}

.hero-text {
  position: absolute;
  left: clamp(20px, 6vw, 84px);
  bottom: clamp(72px, 14vh, 128px);
  max-width: min(88vw, 720px);
  will-change: transform, opacity;
}

.eyebrow {
  font-size: clamp(11px, 1.2vw, 13px);
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 14px;
  animation: rise .9s cubic-bezier(.2, .7, .2, 1) both .15s;
}

h1 {
  font-weight: 340;
  font-size: clamp(46px, 10.5vw, 118px);
  line-height: .98;
  letter-spacing: .01em;
  font-variation-settings: "opsz" 144;
  animation: rise 1s cubic-bezier(.2, .7, .2, 1) both .3s;
}

h1 i {
  color: var(--gold);
  font-style: italic;
  font-weight: 420;
}

.tagline {
  margin-top: 16px;
  font-size: clamp(14px, 1.6vw, 17px);
  font-style: italic;
  color: var(--muted);
  letter-spacing: .04em;
  animation: rise 1s cubic-bezier(.2, .7, .2, 1) both .5s;
}

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--gold-dim);
  animation: rise 1s ease both 1.1s;
}

.cue-line {
  width: 1px;
  height: 34px;
  background: linear-gradient(180deg, var(--gold), transparent);
  animation: drip 2.2s ease-in-out infinite;
  transform-origin: top;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(26px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes drip {
  0%, 100% { transform: scaleY(.35); opacity: .5; }
  50% { transform: scaleY(1); opacity: 1; }
}

/* touch devices: no cursor, so the cover breathes on its own */
html.touch .hero-media :is(img, video),
html.touch .hero-media canvas {
  animation: breathe 26s ease-in-out infinite alternate;
}

@keyframes breathe {
  from { transform: scale(1.04) translateY(0); }
  to { transform: scale(1.12) translateY(-1.6%); }
}

/* ---------- BACK COVER ---------- */

.links {
  position: relative;
  z-index: 2;
  background:
    var(--grain) repeat,
    radial-gradient(130% 80% at 78% -8%, #17223a 0%, transparent 55%),
    linear-gradient(180deg, var(--bg1) 0%, var(--bg0) 55%, #06080e 100%);
  border-top: 1px solid var(--line);
  padding: clamp(56px, 9vh, 96px) 20px clamp(48px, 8vh, 80px);
}

.sleeve { max-width: 620px; margin: 0 auto; }

.side-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: .32em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 44px 0 18px;
}

.side-head:first-child { margin-top: 0; }
.side-head span { color: var(--gold); }

.side-head::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid var(--line);
  transform: translateY(-4px);
}

.card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 12px;
  margin: 0 -12px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--ink);
  transition:
    opacity .7s cubic-bezier(.2, .7, .2, 1),
    transform .45s cubic-bezier(.2, .7, .2, 1),
    background-color .25s ease;
  will-change: transform;
}

/* pre-entrance state exists ONLY when JS is running (html.js) — with JS
   off/blocked/crashed the links must simply be visible; :not(.is-in) keeps
   this above later class toggles without ordering games */
html.js .card:not(.is-in) { opacity: 0; transform: translateY(18px); }

/* stagger the entrance like needle-drop */
.card:nth-of-type(1) { transition-delay: .05s; }
.card:nth-of-type(2) { transition-delay: .12s; }
.card:nth-of-type(3) { transition-delay: .19s; }
.card:nth-of-type(4) { transition-delay: .26s; }
.card:nth-of-type(5) { transition-delay: .1s; }
.card:nth-of-type(6) { transition-delay: .17s; }

.card:hover, .card:focus-visible { background: rgba(232, 199, 120, .06); }
.card:focus-visible { outline: 1px solid var(--gold-dim); outline-offset: 2px; }

.card.is-in:hover { transition-delay: 0s; }

.tno {
  font-size: 12px;
  font-style: italic;
  color: var(--gold-dim);
  min-width: 22px;
}

.ic {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: var(--accent, var(--gold));
  flex: 0 0 auto;
}

.ic svg { width: 21px; height: 21px; fill: currentColor; }

.lbl { display: flex; flex-direction: column; min-width: 0; }
.lbl .p { font-size: 17px; font-weight: 460; letter-spacing: .01em; }
.lbl .s { font-size: 12px; color: var(--muted); margin-top: 2px; font-style: italic; }

/* narrow screens: drop the dotted leaders, let labels breathe */
@media (max-width: 540px) {
  .leader { display: none; }
  .lbl { flex: 1; }
  .lbl .s { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

.leader {
  flex: 1;
  min-width: 24px;
  border-bottom: 1px dotted rgba(154, 163, 173, .4);
  transform: translateY(3px);
  transition: border-color .3s ease;
}

.card:hover .leader { border-bottom-color: var(--gold); }

.arw {
  color: var(--muted);
  font-size: 19px;
  transition: transform .3s cubic-bezier(.2, .7, .2, 1), color .3s ease;
}

.card:hover .arw { transform: translateX(5px); color: var(--gold); }

footer {
  margin-top: 64px;
  text-align: center;
}

.moon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  margin: 0 auto 18px;
  background: radial-gradient(circle at 34% 32%, #fdf6e3 0%, #f0d68a 34%, #caa24e 66%, #7c5f27 100%);
  box-shadow: 0 0 34px rgba(232, 199, 120, .4), inset -4px -5px 10px rgba(90, 64, 20, .6);
}

.liner {
  font-style: italic;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.7;
}

.colophon {
  margin-top: 18px;
  font-size: 10.5px;
  letter-spacing: .32em;
  color: var(--gold-dim);
}

/* ---------- MOTION OFF ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .card { opacity: 1; transform: none; }
  /* must out-rank the html.js entrance-hide if the OS toggles mid-session */
  html.js .card:not(.is-in) { opacity: 1; transform: none; }
  .hero { position: relative; height: 100svh; }
  html.webgl-on .hero-media canvas { display: none; }
  html.webgl-on .hero-media :is(img, video) { visibility: visible; }
}

/* JS sets html.static for the same treatment (reduced-motion or explicit) */
html.static { scroll-behavior: auto; }
html.static .hero { position: relative; }
html.static .card { opacity: 1; transform: none; transition: none; }
html.static .hero-media canvas { display: none; }
html.static .hero-media :is(img, video) { visibility: visible; animation: none; }
html.static .eyebrow, html.static h1, html.static .tagline,
html.static .scroll-cue, html.static .cue-line { animation: none; }
