:root {
  --n: 0; /* 0 = day, 1 = night — driven from js */
  --paper-day: #f1ecdf;
  --paper-night: #0b1030;
  --ink-day: #23301a;
  --ink-night: #e8ecff;
  --accent-day: #2b55e6;   /* the electric blue from her face paint */
  --accent-night: #9fb4ff;
  --paper: color-mix(in oklab, var(--paper-day), var(--paper-night) calc(var(--n) * 100%));
  --ink: color-mix(in oklab, var(--ink-day), var(--ink-night) calc(var(--n) * 100%));
  --accent: color-mix(in oklab, var(--accent-day), var(--accent-night) calc(var(--n) * 100%));
  --brush: 'Nanum Brush Script', cursive;
  --serif: 'EB Garamond', Georgia, serif;
  --gutter: clamp(10px, 1.6vw, 18px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; color: inherit; }

/* ------------------------------------------------------------ the storybook frame */
.frame {
  position: fixed;
  inset: var(--gutter);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--ink) 18%, transparent), 0 20px 60px -30px rgb(0 0 0 / .5);
}
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: pan-y; cursor: crosshair; }


/* ------------------------------------------------------------ masthead */
.masthead {
  position: absolute; top: clamp(14px, 3.2vh, 34px); left: 0; right: 0;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  pointer-events: none;
}
.masthead > * { pointer-events: auto; }
.logo {
  font-family: var(--brush);
  font-size: clamp(56px, 8.6vw, 128px);
  line-height: .8;
  text-decoration: none;
  letter-spacing: .01em;
  color: var(--ink);
  text-shadow: 0 1px 18px color-mix(in oklab, var(--paper) 55%, transparent);
  transform: rotate(-1.5deg);
}
.tagline {
  margin: .5em 0 0;
  font-size: 13px; letter-spacing: .28em; text-transform: uppercase; opacity: .75;
}
.nav { display: flex; flex-wrap: wrap; justify-content: center; gap: .3em 1.4em; margin-top: 14px; font-size: 19px; font-style: italic; }
.nav a { text-decoration: none; position: relative; padding: 2px 0; }
.nav a::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1.5px; background: currentColor;
  transform: scaleX(0); transform-origin: left; transition: transform .35s cubic-bezier(.2,.8,.2,1);
}
.nav a:hover::after, .nav a[aria-current]::after { transform: scaleX(1); }


/* ------------------------------------------------------------ footer */
.foot {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 16px;
  padding: 18px 22px; pointer-events: none;
}
.foot > * { pointer-events: auto; }
.socials {
  justify-self: start;
  list-style: none; display: flex; align-items: center; gap: 14px; margin: 0; padding: 9px 16px; border-radius: 999px;
  background: color-mix(in oklab, var(--paper) 78%, transparent);
  border: 1px solid color-mix(in oklab, var(--ink) 18%, transparent);
}
.socials a, .page-socials a { display: grid; place-items: center; opacity: .8; transition: opacity .2s, transform .2s; }
.socials a:hover, .page-socials a:hover { opacity: 1; transform: translateY(-1px); }
.socials svg { width: 18px; height: 18px; fill: currentColor; display: block; }
.page-socials { list-style: none; display: flex; gap: 18px; padding: 0; margin: 0; }
.page-socials a { color: var(--pi) !important; }
.page-socials svg { width: 22px; height: 22px; fill: currentColor; }

/* ------------------------------------------------------------ mailing list pill (lives in the footer row) */
.list-pill {
  justify-self: center; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  font-size: 15px; font-style: italic; text-decoration: none; color: var(--ink);
  padding: 8px 16px; border-radius: 999px;
  background: color-mix(in oklab, var(--paper) 78%, transparent);
  border: 1px solid color-mix(in oklab, var(--ink) 18%, transparent);
  transition: background .25s;
}
.list-pill:hover { background: color-mix(in oklab, var(--paper) 85%, transparent); }
.list-pill svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }

.foot-right { justify-self: end; display: flex; gap: 10px; align-items: center; flex-wrap: nowrap; justify-content: flex-end; }
@media (max-width: 1050px) and (min-width: 701px) { .foot-right { flex-wrap: wrap; } .list-pill span { display: none; } }
.player, .clock {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  background: color-mix(in oklab, var(--paper) 78%, transparent);
  border: 1px solid color-mix(in oklab, var(--ink) 18%, transparent);
}
.now { display: flex; align-items: center; gap: 7px; font-size: 15px; font-style: italic; min-width: 7.5em; white-space: nowrap; }
.eq { display: none; gap: 2px; align-items: flex-end; height: 12px; }
.eq i { width: 3px; background: var(--accent); border-radius: 1px; animation: eq 0.9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.3s; } .eq i:nth-child(3) { animation-delay: -.6s; }
@keyframes eq { 0%, 100% { height: 3px; } 50% { height: 12px; } }
.player.playing .eq { display: flex; }
#sound .icon-on { display: none; }
#sound[aria-pressed="true"] .icon-on { display: block; }
#sound[aria-pressed="true"] .icon-off { display: none; }
.clock-btn { background: none; border: 0; padding: 2px; cursor: pointer; display: grid; place-items: center; border-radius: 50%; }
.clock-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.clock-btn:hover { background: color-mix(in oklab, var(--ink) 10%, transparent); }
.clock-label { font-size: 14px; min-width: 5.2em; text-align: right; font-variant-numeric: tabular-nums; opacity: .8; }
#time { -webkit-appearance: none; appearance: none; width: clamp(70px, 7vw, 120px); height: 2px; background: color-mix(in oklab, var(--ink) 40%, transparent); border-radius: 2px; cursor: pointer; }
#time::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 2px solid var(--paper); }
#time::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid var(--paper); }

.capture .foot { display: none; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* ------------------------------------------------------------ storybook pages */
.page-wrap { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: calc(var(--gutter) + 12px); }
.page-wrap[hidden] { display: none; }
.page-scrim { position: absolute; inset: 0; background: color-mix(in oklab, var(--paper-night) 35%, transparent); opacity: 0; transition: opacity .5s; }
.page-shell {
  position: relative; width: min(820px, 100%);
  transform-origin: left center;
  transform: perspective(1400px) rotateY(-24deg) translateX(40px);
  opacity: 0;
  transition: transform .7s cubic-bezier(.2,.8,.2,1), opacity .5s;
}
.page-wrap.open .page-shell { transform: none; opacity: 1; }
.page {
  --pi: #2a2419;
  position: relative; width: 100%; max-height: min(86vh, 900px); overflow: auto;
  text-align: center;
  background:
    radial-gradient(120% 80% at 0% 0%, #fffaf0 0%, transparent 60%),
    #f6efdf;
  color: var(--pi);
  border-radius: 6px 18px 18px 6px;
  padding: clamp(28px, 5vw, 56px) clamp(22px, 5vw, 64px) 48px;
  box-shadow: inset 14px 0 18px -14px rgb(60 40 10 / .35), 0 30px 80px -20px rgb(0 0 0 / .55);
  scrollbar-width: thin;
}
.page-wrap.open .page-scrim { opacity: 1; }
.page-close {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; font-size: 30px; line-height: 1; cursor: pointer; color: #2a2419;
}
.page-close:hover { background: rgb(0 0 0 / .06); }

.page h1 { font-family: var(--brush); font-weight: 400; font-size: clamp(54px, 8vw, 84px); line-height: .9; margin: 0 0 .4em; }
.page h2 {
  font-weight: 500; font-style: italic; font-size: 22px; margin: 2.4em auto 1em;
  display: flex; align-items: center; gap: 16px; max-width: 560px;
}
.page h2::before, .page h2::after { content: ''; flex: 1; height: 1px; background: rgb(42 36 25 / .22); }
.page h3 { font-size: 26px; font-weight: 500; margin: 0 0 .5em; }
.page p { font-size: 18px; line-height: 1.6; margin: 0 auto 1em; max-width: 580px; }
.page .lede { font-size: 20px; font-style: italic; }
.page .kicker { font-size: 14px; letter-spacing: .2em; text-transform: uppercase; opacity: .6; margin-bottom: .6em; }
.page .credits { font-size: 13px; letter-spacing: .12em; opacity: .65; }
.page .links { font-size: 17px; }
.page a { color: #2447c9; }
.rule { border: 0; height: 1px; width: 80px; margin: 44px auto; background: rgb(42 36 25 / .25); }

.cover { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 3px; box-shadow: 0 10px 24px -12px rgb(0 0 0 / .5); display: block; }
.release .cover { width: min(260px, 70%); margin: 0 auto 22px; }
.release .note { font-size: 17px; }
.embed { width: 100%; max-width: 560px; border: 0; border-radius: 10px; display: block; margin: 16px auto 0; background: rgb(0 0 0 / .04); }
.embed.bc { height: 120px; }
.embed.sp { height: 152px; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 240px)); justify-content: center; gap: 28px; }

.video button { all: unset; cursor: pointer; display: block; position: relative; width: 100%; aspect-ratio: 16/9; border-radius: 6px; overflow: hidden; background: #111; }
.video button img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s, filter .6s; filter: saturate(.85); }
.video button:hover img { transform: scale(1.04); filter: none; }
.video button::after { content: ''; position: absolute; inset: 50% auto auto 50%; width: 0; height: 0; border-style: solid; border-width: 12px 0 12px 20px; border-color: transparent transparent transparent #fff; transform: translate(-40%, -50%); filter: drop-shadow(0 2px 6px rgb(0 0 0 / .5)); }
.video iframe { width: 100%; aspect-ratio: 16/9; border: 0; border-radius: 6px; display: block; }
.video h3 { font-size: 18px; margin: .7em 0 .3em; }
.video p { font-size: 14.5px; line-height: 1.5; opacity: .8; }

.masonry { columns: 3 180px; column-gap: 12px; margin-bottom: 1em; }
.masonry button { all: unset; cursor: zoom-in; display: block; margin-bottom: 12px; break-inside: avoid; border-radius: 4px; overflow: hidden; }
.masonry img { width: 100%; display: block; transition: transform .5s; }
.masonry button:hover img { transform: scale(1.03); }

.portrait { width: min(420px, 100%); display: block; margin: 0 auto 28px; border-radius: 4px; filter: grayscale(1) contrast(1.05); }
.prose p { margin-bottom: 1.1em; }

.shop-item { display: block; text-decoration: none; color: var(--pi) !important; }
.shop-item h3 { margin: .7em 0 .4em; }
.shop-item:hover .btn { background: #2b55e6; }
.page-socials { justify-content: center; }

.btn { display: inline-block; padding: 10px 22px; border-radius: 999px; background: #2a2419; color: #f6efdf !important; text-decoration: none; font-size: 16px; }
.btn:hover { background: #2b55e6; }

.substack { display: block; width: 100%; max-width: 480px; height: 320px; margin: 0 auto 1em; border: 0; border-radius: 12px; background: #fff; }

.lightbox { position: fixed; inset: 0; z-index: 20; background: rgb(8 10 24 / .92); display: grid; place-items: center; cursor: zoom-out; padding: 24px; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 4px; }

@media (max-width: 700px) {
  .nav { font-size: 18px; gap: .2em 1.2em; margin-top: 10px; }
  .tagline { font-size: 11px; }

  /* one slim bar: sound · day/night · socials */
  .foot {
    left: 10px; right: 10px; bottom: 10px; padding: 6px 12px; gap: 6px; flex-direction: row-reverse; align-items: center;
    border-radius: 999px; pointer-events: auto;
    background: color-mix(in oklab, var(--paper) 80%, transparent);
    border: 1px solid color-mix(in oklab, var(--ink) 18%, transparent);
  }
  .foot-right { flex-wrap: nowrap; gap: 2px; }
  .player, .clock, .socials { background: none; border: 0; padding: 0 4px; gap: 4px; }
  .now #now, #time, .clock-label { display: none; }
  .now { min-width: 0; }
  .socials { gap: 10px; }
  .socials svg { width: 17px; height: 17px; }

  .foot { display: flex; justify-content: space-between; }
  .list-pill { order: 0; padding: 0 4px; background: none; border: 0; }
  .list-pill span { display: none; }
  .list-pill svg { width: 19px; height: 19px; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: minmax(0, 260px); }
  .field-row,   .page-wrap { padding: 8px; }
  .page { max-height: 94vh; }
}

@media (prefers-reduced-motion: reduce) {
  .page-shell, .page-scrim { transition: none; }
}
