/* ===========================================================
   ZOGPHONK — EP page
   =========================================================== */
:root {
  --paper: #ddd7c9;
  --paper-2: #cfc8b7;
  --ink: #0b0b0d;
  --ink-2: #141417;
  --bone: #ece6d8;
  --muted: #9a958b;
  --accent: #ece6d8;
  --bg: var(--ink);
  --amp: 0;

  --f-display: "IM Fell English", "Iowan Old Style", Georgia, serif;
  --f-body: "EB Garamond", Georgia, serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;

  --ease: cubic-bezier(.2, .7, .1, 1);
  --player-h: 84px;
}

/* per-track themes (applied to <body data-theme>) */
body[data-theme="hero"]       { --bg: var(--paper); --accent: #1a1a1a; }
body[data-theme="ink"]        { --bg: #0b0b0d;      --accent: #ece6d8; }
body[data-theme="cuttlefish"] { --bg: #04060a;      --accent: #d6e0ec; }
body[data-theme="server"]     { --bg: #0b100f;      --accent: #d1925a; }
body[data-theme="claw"]       { --bg: #0a0812;      --accent: #a77bff; }
body[data-theme="mittens"]    { --bg: #0d0c0b;      --accent: #f0b85c; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--bone);
  font-family: var(--f-body);
  font-size: 19px;
  line-height: 1.55;
  transition: background-color 1.2s var(--ease);
  overflow-x: hidden;
  padding-bottom: var(--player-h);
}
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; }
.mono { font-family: var(--f-mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
::selection { background: var(--accent); color: #000; }
:focus-visible { outline: 1px dashed var(--accent); outline-offset: 4px; }

/* ---------- ambient layers ---------- */
#fx {
  position: fixed; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 2;
  mix-blend-mode: screen;
}
.grain {
  position: fixed; inset: -50%; z-index: 50; pointer-events: none;
  opacity: .11;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 1.1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 1s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); }
  40% { transform: translate(2%, -4%); } 60% { transform: translate(-4%, -1%); }
  80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .7em;
  font-family: var(--f-mono); font-size: 12px; letter-spacing: .16em; text-transform: uppercase;
  padding: 15px 22px; border-radius: 999px; text-decoration: none;
  transition: transform .3s var(--ease), background .3s, color .3s, border-color .3s;
}
.btn:hover { transform: translateY(-2px); }
.btn-solid { background: #111; color: var(--paper); }
.btn-solid:hover { background: #000; }
.btn-ghost { border: 1px solid currentColor; }
.i-play { width: 0; height: 0; border-left: 9px solid currentColor; border-top: 6px solid transparent; border-bottom: 6px solid transparent; }

/* ===========================================================
   HERO
   =========================================================== */
.hero {
  position: relative; min-height: 100svh;
  background:
    radial-gradient(120% 90% at 70% 40%, transparent 40%, rgba(60, 50, 30, .28) 100%),
    var(--paper);
  color: #141414;
  display: grid; place-items: center;
  overflow: hidden;
  padding: 80px 24px 110px;
}
.crack {
  position: absolute; left: 30%; top: 0; width: 200px; height: 100%;
  fill: none; stroke: #2b2925; stroke-width: 1.3; vector-effect: non-scaling-stroke; opacity: .55;
}
.crack path { stroke-dasharray: 1600; stroke-dashoffset: 1600; animation: crack 3.2s .4s var(--ease) forwards; }
.crack .branch { stroke-width: .9; animation-delay: 1.8s; animation-duration: 1.8s; }
@keyframes crack { to { stroke-dashoffset: 0; } }

.hero-inner {
  position: relative; z-index: 3;
  width: min(1240px, 100%);
  display: grid; grid-template-columns: 1.05fr 1fr; gap: clamp(32px, 6vw, 96px); align-items: center;
}
.kicker { display: flex; flex-wrap: wrap; gap: .6em; color: #5b564c; margin: 0 0 28px; opacity: 0; animation: up 1s .3s var(--ease) forwards; }
.kicker .dot { opacity: .5; }
.title {
  font-family: var(--f-display); font-weight: 400;
  font-size: clamp(64px, 11.5vw, 176px); line-height: .86; letter-spacing: -.01em;
  margin: 0 0 32px;
  overflow: hidden; padding-bottom: .12em;
}
.title .t-in { display: inline-block; transform: translateY(105%); animation: rise 1.4s .5s var(--ease) forwards; }
@keyframes rise { to { transform: none; } }
@keyframes up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.lede { font-size: clamp(20px, 1.8vw, 26px); line-height: 1.35; max-width: 30ch; margin: 0 0 6px; opacity: 0; animation: up 1s 1.1s var(--ease) forwards; }
.lede-small { font-style: italic; color: #6a655b; animation-delay: 1.5s; margin-bottom: 40px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; opacity: 0; animation: up 1s 1.8s var(--ease) forwards; }

.cover-wrap { margin: 0; perspective: 1400px; opacity: 0; animation: up 1.4s .7s var(--ease) forwards; }
.cover-tilt {
  position: relative; transform-style: preserve-3d;
  transition: transform .6s var(--ease);
  box-shadow:
    0 calc(30px + var(--amp) * 30px) calc(60px + var(--amp) * 50px) rgba(0, 0, 0, .35),
    0 6px 14px rgba(0, 0, 0, .25);
}
.cover-tilt img { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; }
.cover-shine {
  position: absolute; inset: 0; pointer-events: none; mix-blend-mode: soft-light;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 30%), rgba(255, 255, 255, .55), transparent 55%);
}
.scroll-cue {
  position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 3;
  text-decoration: none; color: #5b564c; opacity: 0; animation: up 1s 2.4s var(--ease) forwards;
}
.scroll-cue span { display: inline-block; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(5px); } }

/* ===========================================================
   ABOUT + TRACKLIST
   =========================================================== */
.about { position: relative; z-index: 3; padding: clamp(90px, 14vw, 180px) 24px; }
.about-grid { width: min(1240px, 100%); margin: 0 auto; display: grid; grid-template-columns: 1fr 1.1fr; gap: clamp(40px, 7vw, 110px); }
.eyebrow { color: var(--muted); margin: 0 0 22px; }
.about-body { font-size: clamp(20px, 1.6vw, 24px); line-height: 1.5; margin: 0 0 1em; color: #d9d3c5; max-width: 34ch; }
.about-body em { color: var(--bone); }

.tracklist { list-style: none; margin: 0; padding: 0; border-top: 1px solid rgba(236, 230, 216, .16); }
.tl-item {
  position: relative; display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 18px;
  padding: 22px 8px; border-bottom: 1px solid rgba(236, 230, 216, .16);
  cursor: pointer; transition: padding .4s var(--ease), background .4s;
}
.tl-item:hover { padding-left: 20px; background: rgba(255, 255, 255, .025); }
.tl-num { font-family: var(--f-mono); font-size: 12px; color: var(--muted); }
.tl-title { font-family: var(--f-display); font-size: clamp(28px, 3.2vw, 44px); line-height: 1; }
.tl-sub { display: block; font-family: var(--f-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-top: 8px; }
.tl-dur { font-family: var(--f-mono); font-size: 12px; color: var(--muted); }
.tl-thumb {
  position: absolute; right: 90px; top: 50%; width: 120px; aspect-ratio: 1; object-fit: cover;
  transform: translateY(-50%) scale(.85) rotate(-4deg); opacity: 0; pointer-events: none;
  transition: opacity .35s, transform .5s var(--ease); box-shadow: 0 20px 40px rgba(0, 0, 0, .6);
}
.tl-item:hover .tl-thumb { opacity: 1; transform: translateY(-50%) scale(1) rotate(-2deg); }
.tl-item.is-playing .tl-num { color: var(--accent); }
.tl-item.is-playing .tl-title { color: var(--accent); }
.tl-item.is-playing .tl-num::before { content: "▶ "; }

/* ===========================================================
   CHAPTERS
   =========================================================== */
.chapter { position: relative; z-index: 3; padding: clamp(80px, 12vw, 160px) 24px; overflow: clip; }
.ch-backdrop {
  position: absolute; inset: -10%; z-index: -1;
  background-size: cover; background-position: center;
  filter: blur(60px) saturate(1.2) brightness(.35);
  opacity: calc(.45 + var(--amp) * .25);
  transform: scale(1.1);
}
.chapter::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, var(--bg) 0%, transparent 18%, transparent 82%, var(--bg) 100%);
  transition: background 1.2s;
}
.ch-grid { width: min(1240px, 100%); margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: clamp(36px, 6vw, 96px); align-items: start; }
.ch-art { position: sticky; top: 48px; margin: 0; }
.ch-art-frame { position: relative; overflow: hidden; background: #000; box-shadow: 0 40px 90px rgba(0, 0, 0, .6); }
.ch-art img {
  width: 100%; height: auto; max-height: calc(100svh - var(--player-h) - 96px); object-fit: cover;
  transform: scale(calc(1.04 + var(--local-amp, 0) * .035));
  transition: transform .12s linear;
}
.ch-art[data-portrait] img { object-fit: contain; background: #000; }
.ch-art-glow {
  position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06), inset 0 0 calc(var(--local-amp, 0) * 120px) rgba(255, 255, 255, calc(var(--local-amp, 0) * .18));
}
.ch-art figcaption { margin-top: 14px; color: var(--muted); }

.ch-num { color: var(--accent); margin: 0 0 18px; }
.ch-title {
  font-family: var(--f-display); font-weight: 400;
  font-size: clamp(54px, 7.4vw, 112px); line-height: .9; margin: 0 0 26px;
  color: var(--bone);
}
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 30px; padding: 0; list-style: none; }
.tags li {
  font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .08em; text-transform: lowercase;
  padding: 5px 10px; border: 1px solid rgba(236, 230, 216, .18); border-radius: 999px; color: #bdb7aa;
}
.ch-desc { font-size: clamp(20px, 1.55vw, 23px); line-height: 1.5; margin: 0 0 30px; color: #ddd7c9; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1px; margin: 0 0 34px; background: rgba(236, 230, 216, .12); border: 1px solid rgba(236, 230, 216, .12); }
.stat { background: var(--bg); padding: 14px 16px; transition: background 1.2s; }
.stat dt { font-family: var(--f-mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.stat dd { margin: 0; font-family: var(--f-body); font-size: 28px; line-height: 1; color: var(--bone); font-variant-numeric: lining-nums tabular-nums; }

.ch-play { display: flex; align-items: center; gap: 18px; margin: 0 0 18px; }
.big-play {
  flex: none; width: 74px; height: 74px; border-radius: 50%;
  background: var(--accent); color: #000; display: grid; place-items: center;
  box-shadow: 0 0 0 calc(var(--local-amp, 0) * 14px) color-mix(in srgb, var(--accent) 25%, transparent);
  transition: transform .3s var(--ease), box-shadow .1s linear;
}
.big-play:hover { transform: scale(1.06); }
.big-play svg { width: 26px; height: 26px; fill: currentColor; }
.big-play .ic-pause { display: none; }
.chapter.is-playing .big-play .ic-play { display: none; }
.chapter.is-playing .big-play .ic-pause { display: block; }
.ch-wave-wrap { flex: 1; min-width: 0; }
.ch-wave-wrap .wave { width: 100%; height: 54px; }
.ch-time { display: flex; justify-content: space-between; color: var(--muted); margin-top: 6px; font-size: 11px; }

/* lyrics */
.lyrics-toggle {
  display: inline-flex; align-items: center; gap: 10px; margin: 26px 0 0;
  font-family: var(--f-mono); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--bone);
  padding: 10px 0; border-bottom: 1px solid rgba(236, 230, 216, .3);
}
.lyrics-toggle .chev { transition: transform .4s var(--ease); }
.lyrics-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }
.lyrics {
  display: grid; grid-template-rows: 0fr; transition: grid-template-rows .8s var(--ease);
}
.lyrics.open { grid-template-rows: 1fr; }
.lyrics > div { overflow: hidden; }
.lyrics-body { padding: 30px 0 10px; font-size: 20px; line-height: 1.6; color: #e4dece; }
.lyrics-body .stanza { margin: 0 0 1.3em; }
.lyrics-body .ln { display: block; }
.lyrics-body .cue { display: block; font-family: var(--f-mono); font-size: 11px; letter-spacing: .1em; color: var(--muted); margin: .7em 0 .2em; text-transform: lowercase; }
.lyrics-body .section { display: block; font-family: var(--f-mono); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--accent); margin: 1em 0 .4em; }
.lyrics-body .echo { font-style: italic; color: color-mix(in srgb, var(--accent) 70%, #777); }
.lyrics-body .shout { font-family: var(--f-mono); font-size: 16px; letter-spacing: .12em; }
.gloss {
  position: relative; border-bottom: 1px dotted var(--accent); cursor: help; font-style: italic; color: var(--accent);
}
.gloss::after {
  content: attr(data-gloss); position: absolute; left: 0; bottom: calc(100% + 8px); white-space: nowrap;
  font-family: var(--f-mono); font-style: normal; font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  background: var(--bone); color: #000; padding: 6px 10px; pointer-events: none;
  opacity: 0; transform: translateY(4px); transition: opacity .25s, transform .25s var(--ease);
}
.gloss:hover::after, .gloss:focus::after { opacity: 1; transform: none; }
.credit {
  margin: 18px 0 0; padding: 14px 0 0; border-top: 1px solid rgba(236, 230, 216, .14);
  font-size: 16px; color: var(--muted); line-height: 1.45;
}
.credit em { color: #cfc9bb; }
.gloss-table { width: 100%; border-collapse: collapse; margin: 22px 0 0; font-size: 16px; }
.gloss-table caption { text-align: left; color: var(--muted); padding-bottom: 8px; }
.gloss-table td { padding: 8px 0; border-top: 1px solid rgba(236, 230, 216, .12); }
.gloss-table td:first-child { font-style: italic; color: var(--accent); width: 50%; }

/* claw glitch on spikes */
body.glitch .chapter[data-id="claw"] .ch-title {
  text-shadow: -3px 0 #ff2fd0, 3px 0 #2ff3ff;
  transform: translateX(calc((var(--amp) - .5) * 6px)) skewX(-4deg);
}
.ch-title { transition: text-shadow .08s, transform .08s; }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(40px); transition: opacity 1.1s var(--ease), transform 1.1s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ===========================================================
   FOOTER
   =========================================================== */
.foot { position: relative; z-index: 3; padding: 140px 24px 110px; text-align: center; border-top: 1px solid rgba(236, 230, 216, .1); }
.foot-inner { display: grid; justify-items: center; gap: 20px; }
.foot-title { font-family: var(--f-display); font-size: clamp(60px, 10vw, 140px); line-height: .9; margin: 0; }
.foot-meta { color: var(--muted); margin: 0 0 12px; line-height: 1.8; }
.disclaimer { font-style: italic; color: #bdb7aa; margin: 30px 0 0; }
.foot-tiny { color: #5d5a54; margin: 0; }

/* ===========================================================
   PLAYER BAR
   =========================================================== */
.player {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 60;
  height: calc(var(--player-h) - 12px);
  display: grid; grid-template-columns: minmax(200px, 1fr) minmax(280px, 1.6fr) minmax(120px, .6fr); align-items: center; gap: 24px;
  padding: 0 18px 0 10px; border-radius: 14px;
  background: rgba(14, 14, 16, .72);
  -webkit-backdrop-filter: blur(22px) saturate(1.4); backdrop-filter: blur(22px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .45);
  color: var(--bone);
  transform: translateY(140%); animation: slideup 1s 2.2s var(--ease) forwards;
}
@keyframes slideup { to { transform: none; } }
.p-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.p-thumb { width: 52px; height: 52px; object-fit: cover; border-radius: 6px; flex: none; }
.p-meta { min-width: 0; }
.p-title { margin: 0; font-family: var(--f-display); font-size: 21px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-sub { margin: 4px 0 0; font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .1em; }
.p-center { display: grid; gap: 4px; }
.p-controls { display: flex; justify-content: center; gap: 10px; }
.p-btn { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; opacity: .8; transition: opacity .2s, transform .2s; }
.p-btn:hover { opacity: 1; transform: scale(1.08); }
.p-btn svg { width: 16px; height: 16px; fill: currentColor; }
.p-main { background: var(--bone); color: #000; opacity: 1; }
.p-main .ic-pause { display: none; }
.player.is-playing .p-main .ic-play { display: none; }
.player.is-playing .p-main .ic-pause { display: block; }
.p-seek { display: grid; grid-template-columns: 38px 1fr 38px; align-items: center; gap: 10px; }
.p-time { font-size: 10px; letter-spacing: .06em; color: var(--muted); text-align: center; }
.wave { display: block; width: 100%; height: 26px; cursor: pointer; touch-action: none; }
.p-right { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.meter { display: flex; align-items: flex-end; gap: 3px; height: 22px; }
.meter i { width: 3px; background: var(--accent); height: 3px; border-radius: 1px; transition: height .08s linear, background 1.2s; }
#pVol { width: 90px; accent-color: var(--bone); }

/* ===========================================================
   RESPONSIVE
   =========================================================== */
@media (max-width: 960px) {
  body { font-size: 18px; }
  .hero-inner { grid-template-columns: 1fr; }
  .cover-wrap { order: -1; width: min(460px, 82vw); justify-self: center; }
  .hero-copy { text-align: left; }
  .crack { left: 8%; }
  .about-grid, .ch-grid { grid-template-columns: 1fr; }
  .ch-art { position: relative; top: 0; }
  .ch-art img { max-height: 70svh; }
  .tl-thumb { display: none; }
  .player { grid-template-columns: 1fr auto; gap: 10px; padding-right: 10px; }
  .p-center { display: contents; }
  .p-controls { grid-column: 2; grid-row: 1; }
  .p-seek { grid-column: 1 / -1; grid-row: 2; }
  .p-right { display: none; }
  :root { --player-h: 112px; }
  .player { height: auto; padding: 10px 12px; row-gap: 6px; }
  .p-controls .p-btn:not(.p-main) { display: none; }
}
@media (max-width: 520px) {
  .title { font-size: 22vw; }
  .p-sub { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
  .grain { animation: none; }
  .title .t-in { transform: none; }
  .crack path { stroke-dashoffset: 0; }
}
