/* ============================================================================
   CHROME — the interface that almost disappears: wordmark, sound, index menu,
   and the living cursor.
   ============================================================================ */

/* ── Header ───────────────────────────────────────────────────────────────── */
.chrome {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: var(--z-chrome);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(1.1rem, 0.6rem + 1.6vw, 2rem) var(--gutter);
  mix-blend-mode: difference;   /* stays legible over black or paper */
  color: #fff;
  pointer-events: none;
}
.chrome > * { pointer-events: auto; }
/* Reveal after the loader. */
.chrome { opacity: 0; transform: translateY(-0.5rem); transition: opacity var(--d-3) var(--e-out) 0.2s, transform var(--d-3) var(--e-out) 0.2s; }
body.is-ready .chrome { opacity: 1; transform: none; }

.chrome__mark {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
}
.chrome__mark-glyph { display: inline-flex; color: #fff; transition: transform var(--d-2) var(--e-out); }
.chrome__mark:hover .chrome__mark-glyph { transform: rotate(90deg); }
.chrome__mark-name {
  font-size: var(--fs-nano);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: #fff;
}
@media (max-width: 30rem) { .chrome__mark-name { display: none; } }

.chrome__right { display: flex; align-items: center; gap: clamp(1rem, 2vw, 2rem); }

/* ── Sound toggle — five bars that stand still until you switch them on ─────── */
.sound { display: inline-flex; align-items: center; gap: 0.6rem; color: #fff; }
.sound__bars { display: flex; align-items: center; gap: 2px; height: 12px; }
.sound__bars i {
  width: 2px; height: 3px; background: currentColor; opacity: 0.55;
  transform-origin: center bottom;
}
.sound[aria-pressed="true"] .sound__bars i { animation: sound-eq 1.1s ease-in-out infinite; opacity: 1; }
.sound__bars i:nth-child(2) { animation-delay: 0.15s; }
.sound__bars i:nth-child(3) { animation-delay: 0.3s; }
.sound__bars i:nth-child(4) { animation-delay: 0.1s; }
.sound__bars i:nth-child(5) { animation-delay: 0.25s; }
@keyframes sound-eq { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(3.4); } }
.sound__label { color: #fff; }
@media (max-width: 40rem) { .sound__label { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .sound[aria-pressed="true"] .sound__bars i { animation: none; height: 8px; }
}

/* ── Menu button ─────────────────────────────────────────────────────────── */
.menu-btn { position: relative; display: inline-flex; align-items: center; gap: 0.6rem; color: #fff; }
.menu-btn__label { color: #fff; transition: opacity var(--d-1) var(--e-out), transform var(--d-1) var(--e-out); }
.menu-btn__label[data-menu-close] { position: absolute; right: 2rem; opacity: 0; transform: translateY(0.5rem); }
.menu-btn__label[data-menu-open]  { opacity: 1; }
.menu-btn__glyph { display: inline-grid; gap: 4px; width: 18px; }
.menu-btn__glyph i { height: 1px; width: 100%; background: #fff; transition: transform var(--d-1) var(--e-inout); }
.menu-btn[aria-expanded="true"] .menu-btn__label[data-menu-open]  { opacity: 0; transform: translateY(-0.5rem); }
.menu-btn[aria-expanded="true"] .menu-btn__label[data-menu-close] { opacity: 1; transform: translateY(0); }
.menu-btn[aria-expanded="true"] .menu-btn__glyph i:first-child { transform: translateY(2.5px) rotate(45deg); }
.menu-btn[aria-expanded="true"] .menu-btn__glyph i:last-child  { transform: translateY(-2.5px) rotate(-45deg); }

/* ── Full-screen index ──────────────────────────────────────────────────────── */
.index {
  position: fixed;
  inset: 0;
  z-index: var(--z-index-menu);
  background: var(--c-void);
  display: grid;
  align-items: center;
  clip-path: inset(0 0 100% 0);
  transition: clip-path var(--d-3) var(--e-inout);
}
/* [hidden] genuinely removes it from layout + tab order when closed; JS sets
   hidden=false, forces reflow, then adds .is-open so the clip still animates. */
.index.is-open { clip-path: inset(0 0 0 0); }

.index__inner {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding: var(--sp-8) var(--gutter) var(--sp-6);
}
.index__list { display: grid; gap: clamp(0.25rem, 1vw, 0.75rem); }
.index__item a {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: clamp(1rem, 4vw, 3rem);
  padding: clamp(0.6rem, 1.4vw, 1.1rem) 0;
  border-top: 1px solid var(--c-line);
  color: var(--c-ink);
  overflow: hidden;
}
.index__item:last-child a { border-bottom: 1px solid var(--c-line); }
.index__no { color: var(--c-ink-mute); }
.index__name {
  font-family: var(--f-display);
  font-weight: var(--w-thin);
  font-size: clamp(2.4rem, 1rem + 8vw, 6.5rem);
  line-height: 1;
  letter-spacing: -0.02em;
  transform: translateY(0);
  transition: transform var(--d-2) var(--e-out), color var(--d-2) var(--e-out);
}
.index__sub { color: var(--c-ink-mute); text-align: right; }
@media (max-width: 40rem) { .index__sub { display: none; } .index__item a { grid-template-columns: auto 1fr; } }
.index__item a:hover .index__name { transform: translateX(clamp(0.5rem, 2vw, 1.5rem)); color: var(--c-accent); }

/* Staggered entrance of the list items (driven by JS var --i). */
.index__item { opacity: 0; transform: translateY(1.4rem); }
.index.is-open .index__item {
  opacity: 1; transform: none;
  transition: opacity var(--d-2) var(--e-out) calc(0.12s + var(--i, 0) * 0.06s),
              transform var(--d-2) var(--e-out) calc(0.12s + var(--i, 0) * 0.06s);
}
.index__foot {
  display: flex; justify-content: space-between; gap: 1rem;
  margin-top: var(--sp-7);
  color: var(--c-ink-mute);
  font-family: var(--f-mono); font-size: var(--fs-nano); letter-spacing: 0.2em; text-transform: uppercase;
}

/* ── The living cursor ───────────────────────────────────────────────────────
   A dot that leads, a ring that follows on a soft delay, a label on demand.
   Hidden entirely unless the device has a fine pointer. */
.cursor { display: none; }
@media (hover: hover) and (pointer: fine) {
  .cursor {
    position: fixed;
    top: 0; left: 0;
    z-index: var(--z-cursor);
    pointer-events: none;
    mix-blend-mode: difference;
    display: block;
    opacity: 0;
    transition: opacity var(--d-2) var(--e-out);
  }
  body.is-ready .cursor { opacity: 1; }

  .cursor__dot {
    position: absolute;
    top: 0; left: 0;
    width: 6px; height: 6px;
    margin: -3px 0 0 -3px;
    border-radius: 50%;
    background: #fff;
    transition: transform var(--d-1) var(--e-out), opacity var(--d-1) ease;
  }
  .cursor__ring {
    position: absolute;
    top: 0; left: 0;
    width: 42px; height: 42px;
    margin: -21px 0 0 -21px;
    border: 1px solid rgba(255,255,255,0.6);
    border-radius: 50%;
    transition: width var(--d-1) var(--e-out), height var(--d-1) var(--e-out),
                margin var(--d-1) var(--e-out), border-color var(--d-1) var(--e-out),
                opacity var(--d-1) ease, background var(--d-1) ease;
  }
  .cursor__label {
    position: absolute;
    top: 0; left: 0;
    transform: translate(-50%, -50%);
    font-family: var(--f-mono);
    font-size: 0.6rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #fff;
    white-space: nowrap;
    opacity: 0;
    transition: opacity var(--d-1) ease;
  }

  /* States, set by JS as data attributes on <body>. */
  body[data-cursor-state="hover"]  .cursor__ring { width: 64px; height: 64px; margin: -32px 0 0 -32px; }
  body[data-cursor-state="play"]   .cursor__ring { width: 92px; height: 92px; margin: -46px 0 0 -46px; background: rgba(255,255,255,0.06); }
  body[data-cursor-state="play"]   .cursor__dot,
  body[data-cursor-state="close"]  .cursor__dot,
  body[data-cursor-state="zoom"]   .cursor__dot { opacity: 0; }
  body[data-cursor-state="play"]   .cursor__label,
  body[data-cursor-state="close"]  .cursor__label,
  body[data-cursor-state="zoom"]   .cursor__label,
  body[data-cursor-state="down"]   .cursor__label,
  body[data-cursor-state="next"]   .cursor__label,
  body[data-cursor-state="prev"]   .cursor__label { opacity: 1; }
  body[data-cursor-state="close"]  .cursor__ring { width: 80px; height: 80px; margin: -40px 0 0 -40px; border-color: rgba(255,255,255,0.9); }
  body[data-cursor-state="zoom"]   .cursor__ring { width: 80px; height: 80px; margin: -40px 0 0 -40px; }
  body[data-cursor-state="hide"]   .cursor { opacity: 0; }
  body[data-cursor-state="down"]   .cursor__ring { width: 72px; height: 72px; margin: -36px 0 0 -36px; }

  /* Pressed feedback. */
  body.is-pressing .cursor__ring { transform: scale(0.82); }
}

/* No living cursor if motion is unwelcome. */
@media (prefers-reduced-motion: reduce) {
  .cursor { display: none !important; }
  * { cursor: auto !important; }
}
