/* =============================================================
   /music: The Album Atlas
   Loads after css/site.css. The chrome (nav, title, tabs, panel,
   tooltips) is set like the rest of the site. The three views draw
   their own type and paint their own background, so the Atlas keeps
   the exact near-black they were drawn on.
   ============================================================= */

:root {
  --bg: #07080c;
  --bg-elev: #0c0e14;
  --fg: #f2f4f8;
  --ink: #f2f4f8;
  --ink-soft: #a9b0c0;
  --ink-mute: #6b7282;
  --mute: var(--ink-soft);
  --faint: var(--ink-mute);
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .16);
  --hover: rgba(255, 255, 255, .06);
  --accent: #f2f4f8;
  --accent-ink: #f2f4f8;
  --tone: #f2f4f8;
  --gutter: clamp(1.25rem, 5vw, 3rem);
  --nav-h: 76px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --font-view: 'Inter', system-ui, sans-serif; /* unclassed SVG text in the views was drawn in Inter */
  color-scheme: dark;
}
html { scroll-padding-top: calc(var(--nav-h) + 24px); }
:where(body.music) :where(*) { margin: 0; padding: 0; }
:where(body.music) p { color: var(--ink-soft); }
:where(body.music) svg, :where(body.music) canvas { display: block; max-width: 100%; }
body.music { overflow-x: hidden; background: var(--bg); color: var(--ink); font-size: 16.5px; line-height: 1.6; }
body.music .cursor, body.music .cursor-ring { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cx-svg, .tr-svg, .hr-map svg { font-family: var(--font-view); }

/* ---------- head ---------- */
.atlas-head {
  position: relative; z-index: 2;
  padding: calc(var(--nav-h) + 30px) var(--gutter) 16px;
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px 48px;
}
.atlas-title h1 {
  font-size: clamp(2.6rem, 5.4vw, 4.6rem); font-weight: 720; line-height: .92; letter-spacing: -.045em;
  margin: 0 0 .7rem;
}
.atlas-stats { font-size: .98rem; color: var(--ink-soft); }
.atlas-switch { display: grid; gap: .6rem; justify-items: end; max-width: 720px; }
.atlas-tabs { display: inline-flex; gap: 26px; }
.atlas-tabs button {
  position: relative; padding: 6px 0; font-size: 1.02rem; font-weight: 600; letter-spacing: -.01em;
  color: var(--ink-mute); white-space: nowrap; transition: color .2s var(--ease);
}
.atlas-tabs button:hover { color: var(--ink); }
.atlas-tabs button[aria-selected="true"] { color: var(--ink); }
.atlas-tabs button[aria-selected="true"]::after { content: ''; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px; background: var(--ink); }
.atlas-desc { font-size: .92rem; line-height: 1.45; color: var(--ink-soft); text-align: right; min-height: 1.5em; }

/* ---------- stage ---------- */
.stage { position: relative; z-index: 1; }
.view { display: none; position: relative; }
.view.on { display: block; animation: viewIn .6s var(--ease-out) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } }

/* shared controls */
.atlas-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .45rem;
  padding: 0 var(--gutter) .9rem;
}
.atlas-bar .lbl { font-size: .86rem; color: var(--ink-mute); margin-right: .35rem; }
.atlas-bar .zoom { display: inline-flex; gap: .45rem; }
.chip-btn, .ctl {
  font-size: .86rem; font-weight: 500; line-height: 1.2;
  border: 1px solid var(--line-strong); border-radius: 8px;
  padding: .42rem .75rem; color: var(--ink-soft); background: transparent;
  transition: color .2s var(--ease), border-color .2s var(--ease), background-color .2s var(--ease); white-space: nowrap;
  display: inline-flex; align-items: center; gap: .45rem;
}
.chip-btn:hover, .ctl:hover { color: var(--ink); border-color: rgba(255, 255, 255, .34); }
.chip-btn[aria-pressed="true"] { color: var(--bg); background: var(--ink); border-color: var(--ink); }
.chip-btn i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.ctl svg { width: 14px; height: 14px; }
.ctl[hidden], .chip-btn[hidden] { display: none; }
.ctl[aria-pressed="true"] { color: var(--ink); border-color: rgba(255, 255, 255, .34); }
.spacer { flex: 1; }

/* ---------- Heavy Rotation ---------- */
.view-rotation { height: max(620px, calc(100svh - var(--nav-h) - 4px)); scroll-margin-top: var(--nav-h); overflow-x: clip; }
.hr-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hr-read { position: absolute; left: var(--gutter); top: 10px; pointer-events: none; z-index: 2; }
.hr-year { font-size: clamp(3.4rem, 7vw, 6.2rem); font-weight: 720; line-height: .85; letter-spacing: -.05em; color: var(--ink); font-variant-numeric: tabular-nums; }
.hr-season { font-size: 1rem; font-weight: 500; color: var(--ink-soft); margin-top: .6rem; }
.hr-season::first-letter { text-transform: uppercase; }
.hr-phase { font-size: 1.15rem; font-weight: 600; letter-spacing: -.01em; color: var(--ink); margin-top: .15rem; }
.hr-count { font-size: .9rem; color: var(--ink-mute); margin-top: .7rem; }
.hr-count b { color: var(--ink); font-weight: 600; }
.hr-map { position: absolute; right: var(--gutter); top: 8px; width: min(300px, 32vw); z-index: 2; pointer-events: none; }
.hr-map svg { width: 100%; height: auto; overflow: visible; }
.hr-notes {
  position: absolute; left: 50%; bottom: 128px; transform: translateX(-50%);
  width: min(720px, 92vw); text-align: center; pointer-events: none; z-index: 2; min-height: 64px;
}
.hr-note { position: absolute; inset: 0 0 auto; opacity: 0; transition: opacity .9s var(--ease), transform .9s var(--ease); transform: translateY(8px); }
.hr-note.show { opacity: 1; transform: none; }
.hr-note q { display: block; font-size: clamp(1.1rem, 1.9vw, 1.45rem); font-weight: 500; line-height: 1.3; letter-spacing: -.01em; color: var(--ink); quotes: "“" "”"; }
.hr-note span { display: block; margin-top: .45rem; font-size: .86rem; color: var(--ink-mute); }
.hr-note em { display: block; font-style: normal; font-size: clamp(1.05rem, 1.8vw, 1.35rem); line-height: 1.3; color: var(--ink-soft); }
.hr-dock { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; padding: 0 var(--gutter) 14px; }
.hr-strip { position: relative; height: 78px; cursor: pointer; touch-action: none; }
.hr-strip canvas { width: 100%; height: 100%; display: block; }
.hr-ctls { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin-top: .55rem; }
.hr-ctls .hint { display: inline-flex; gap: 4px; color: var(--ink-mute); }
.hr-ctls .hint kbd { min-width: 26px; height: 24px; font-size: 11.5px; color: var(--ink-mute); border-color: var(--line-strong); }
.hr-start {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 4;
  display: grid; justify-items: center; gap: .6rem; text-align: center;
  transition: opacity .6s var(--ease), transform .6s var(--ease);
}
.hr-start::before {
  content: ''; position: absolute; inset: -70px -110px; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, rgba(7, 8, 12, .88), rgba(7, 8, 12, .55) 55%, rgba(7, 8, 12, 0));
}
.hr-start.gone { opacity: 0; pointer-events: none; transform: translate(-50%, -46%); }
.hr-play {
  width: 96px; height: 96px; border-radius: 50%; margin-bottom: .3rem;
  background: var(--ink); color: var(--bg); display: grid; place-items: center;
  transition: transform .35s var(--ease-out);
}
.hr-play:hover { transform: scale(1.06); }
.hr-play svg { width: 32px; height: 32px; margin-left: 5px; }
.hr-start b { font-size: 1.6rem; font-weight: 700; letter-spacing: -.03em; color: var(--ink); }
.hr-start small { font-size: .92rem; color: var(--ink-soft); }
.hr-start .quiet { font-size: .92rem; color: var(--ink-soft); text-decoration: underline; text-decoration-color: var(--line-strong); text-decoration-thickness: 1.5px; text-underline-offset: 5px; }
.hr-start .quiet:hover { color: var(--ink); text-decoration-color: var(--ink); }
.hr-legend {
  position: absolute; left: var(--gutter); bottom: 138px; z-index: 2; pointer-events: none;
  font-size: .84rem; line-height: 1.6; color: var(--ink-mute); max-width: 300px;
}
.hr-legend b { color: var(--ink-soft); font-weight: 600; }
.hr-end {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 3; text-align: center; pointer-events: none;
  opacity: 0; transition: opacity 1.4s var(--ease);
}
.hr-end.show { opacity: 1; }
.hr-end::before {
  content: ''; position: absolute; inset: -60px -90px; z-index: -1;
  background: radial-gradient(closest-side, rgba(7, 8, 12, .85), rgba(7, 8, 12, .5) 60%, rgba(7, 8, 12, 0));
}
.hr-end b { display: block; font-size: clamp(1.6rem, 3vw, 2.3rem); font-weight: 700; letter-spacing: -.035em; color: var(--ink); }
.hr-end span { display: block; margin-top: .5rem; font-size: .95rem; color: var(--ink-soft); }

/* ---------- The Crossing ---------- */
.cx-scroll { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.cx-scroll svg { display: block; width: 100%; min-width: 1180px; height: auto; }
.cx-hint { display: none; font-size: .88rem; color: var(--ink-mute); padding: 0 var(--gutter) .6rem; }
.cx-read {
  position: absolute; pointer-events: none; z-index: 3; transform: translateX(-50%);
  font-size: .84rem; color: var(--ink-soft); background: var(--bg-elev); border: 1px solid var(--line-strong);
  border-radius: 8px; padding: .35rem .6rem; white-space: nowrap; opacity: 0; transition: opacity .15s;
}
.cx-read b { color: var(--ink); font-weight: 600; }

/* ---------- The Listening Tree ---------- */
.tr-wrap { position: relative; }
.tr-wrap svg { display: block; width: 100%; height: auto; cursor: grab; touch-action: none; }
.tr-wrap svg:active { cursor: grabbing; }
.tr-year { display: inline-flex; align-items: center; gap: .6rem; }
.tr-year input[type=range] { width: min(320px, 44vw); accent-color: #f2f4f8; }
.tr-year output { font-size: 1.3rem; font-weight: 700; letter-spacing: -.02em; color: var(--ink); min-width: 3.2ch; font-variant-numeric: tabular-nums; }

/* ---------- album panel ---------- */
.mem {
  position: fixed; top: calc(var(--nav-h) + 12px); right: 12px; bottom: 12px; z-index: 160;
  width: min(430px, calc(100vw - 24px));
  background: var(--bg-elev); border: 1px solid var(--line-strong); border-radius: 14px;
  transform: translateX(calc(100% + 30px)); transition: transform .5s var(--ease-out);
  overflow: hidden; display: flex; flex-direction: column;
}
.mem.open { transform: none; }
.mem-inner { overflow-y: auto; padding: 1.4rem 1.5rem 1.6rem; scrollbar-width: thin; }
.mem-scrim { position: fixed; inset: 0; z-index: 150; background: rgba(3, 4, 8, .45); opacity: 0; pointer-events: none; transition: opacity .4s; }
.mem-scrim.show { opacity: 1; pointer-events: auto; }
.mem-close { position: absolute; top: 14px; right: 14px; z-index: 2; width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line-strong); color: var(--ink-soft); background: var(--bg-elev); }
.mem-close:hover { color: var(--ink); border-color: rgba(255, 255, 255, .34); }
.mem-cover { width: 176px; aspect-ratio: 1; border-radius: 3px; overflow: hidden; margin-bottom: 1.2rem; }
.mem-cover img { width: 100%; height: 100%; object-fit: cover; }
.mem-cover.none { display: grid; place-items: center; font-size: 3rem; font-weight: 700; color: rgba(255, 255, 255, .55); }
.mem-kicker { font-size: .88rem; color: var(--ink-soft); }
.mem-kicker span { display: block; color: var(--ink-mute); }
.mem h2 { font-size: 2rem; font-weight: 720; line-height: 1.02; letter-spacing: -.04em; margin: .6rem 0 .3rem; color: var(--ink); }
.mem-artist { font-size: 1rem; color: var(--ink-soft); }
.mem-where { margin-top: .9rem; font-size: .9rem; color: var(--ink-soft); line-height: 1.55; }
.mem-where b { color: var(--ink); font-weight: 600; }
.mem-tags { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem; margin: 1rem 0 1.2rem; }
.mem-tags li { font-size: .8rem; font-weight: 500; line-height: 1.2; padding: .3rem .55rem; border-radius: 6px; border: 1px solid var(--line-strong); color: var(--ink-soft); }
.mem-tags li.hot { border-color: transparent; color: #07080c; font-weight: 600; }
.mem-mems { list-style: none; display: grid; gap: .8rem; border-top: 1px solid var(--line); padding-top: 1.1rem; }
.mem-mems li { font-size: 1.06rem; line-height: 1.45; color: var(--ink); }
.mem-empty { border-top: 1px solid var(--line); padding-top: 1.1rem; font-size: .98rem; color: var(--ink-mute); }
.mem-setting { margin-top: 1.1rem; font-size: .88rem; line-height: 1.6; color: var(--ink-mute); }
.mem details { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .8rem; }
.mem summary { cursor: pointer; font-size: .9rem; font-weight: 600; color: var(--ink-soft); }
.mem summary:hover { color: var(--ink); }
.mem details p { margin-top: .6rem; font-size: .9rem; line-height: 1.6; }
.mem-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1.3rem; }
.mem-flag { margin-top: .8rem; font-size: .84rem; color: #f3c98b; }

/* ---------- private memories: lock ---------- */
.atlas-lock { position: relative; margin-top: .9rem; }
.lock-btn {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .86rem; font-weight: 500; color: var(--ink-soft);
  border: 1px solid var(--line-strong); border-radius: 8px; padding: .42rem .75rem .42rem .6rem;
  background: transparent; transition: color .2s, border-color .2s;
}
.lock-btn:hover { color: var(--ink); border-color: rgba(255, 255, 255, .34); }
.lock-btn svg { width: 14px; height: 14px; overflow: visible; }
.lock-btn .shackle { transition: transform .5s var(--ease-out); transform-box: view-box; transform-origin: 15.5px 11px; }
.atlas-open .lock-btn { color: #f3c98b; border-color: rgba(243, 201, 139, .4); }
.atlas-open .lock-btn .shackle { transform: translateY(-2.5px) rotate(28deg); }
.lock-pop {
  position: absolute; left: 0; top: calc(100% + 8px); z-index: 30; width: min(330px, calc(100vw - 2 * var(--gutter)));
  padding: 1rem 1.05rem 1.05rem; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--bg-elev);
}
.lock-pop p:first-child { font-size: .9rem; line-height: 1.55; color: var(--ink-soft); }
.lock-pop .when-open { display: none; }
.atlas-open .lock-pop .when-open { display: grid; gap: .8rem; justify-items: start; }
.atlas-open .lock-pop .when-locked { display: none; }
.lock-form { display: flex; gap: .4rem; margin-top: .8rem; }
.lock-form input {
  flex: 1; min-width: 0; font: inherit; font-size: .92rem; color: var(--ink);
  padding: .45rem .7rem; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--bg);
}
.lock-form input:focus { outline: none; border-color: var(--ink-soft); }
.lock-form button:disabled { opacity: .5; }
.lock-msg { margin-top: .5rem; min-height: 1.1em; font-size: .84rem; color: #f3c98b; }
.mem-lock { border-top: 1px solid var(--line); padding-top: 1.1rem; }
.mem-lock > p:first-child { font-size: .98rem; line-height: 1.45; color: var(--ink-soft); }
.mem-lock > p:first-child b { font-weight: 600; color: var(--ink); }
.pk-bar { fill: rgba(255, 255, 255, .075); }
.atlas-open .pk-bar { display: none; }

/* ---------- tooltip ---------- */
.atlas-tip {
  position: fixed; left: 0; top: 0; z-index: 170; pointer-events: none;
  display: flex; gap: .7rem; align-items: center;
  background: var(--bg-elev); border: 1px solid var(--line-strong);
  border-radius: 10px; padding: .5rem .75rem .5rem .5rem; max-width: 320px;
  opacity: 0; transform: translateY(4px); transition: opacity .15s, transform .15s;
}
.atlas-tip.show { opacity: 1; transform: none; }
.atlas-tip img, .atlas-tip .sw { width: 44px; height: 44px; border-radius: 3px; object-fit: cover; flex-shrink: 0; }
.atlas-tip b { display: block; font-size: .9rem; font-weight: 600; line-height: 1.25; color: var(--ink); }
.atlas-tip small { display: block; font-size: .8rem; color: var(--ink-soft); }
.atlas-tip em { display: block; font-style: normal; font-size: .76rem; color: var(--ink-mute); margin-top: .15rem; }

/* ---------- footer ---------- */
.atlas-foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: .6rem 2rem;
  padding: 1.6rem var(--gutter) 2rem; margin-top: 1.4rem; border-top: 1px solid var(--line);
  font-size: .86rem; color: var(--ink-mute);
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .atlas-switch { justify-items: start; }
  .atlas-desc { text-align: left; }
  .hr-map { width: 42vw; top: auto; bottom: 150px; right: var(--gutter); }
  .hr-legend { display: none; }
  .cx-hint { display: block; }
}
@media (max-width: 860px) {
  :root { --nav-h: 64px; }
}
@media (max-width: 640px) {
  .atlas-switch { width: 100%; }
  .atlas-tabs { width: 100%; justify-content: space-between; gap: 12px; }
  .atlas-tabs button { font-size: .95rem; white-space: normal; line-height: 1.2; text-align: left; }
  .view-rotation { height: max(720px, calc(100svh - var(--nav-h) - 170px)); }
  .hr-year { font-size: 3rem; }
  .hr-phase { font-size: 1.05rem; }
  .hr-notes { bottom: 150px; }
  .hr-map { display: none; }
  .mem { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 78svh; transform: translateY(calc(100% + 20px)); }
  .mem.open { transform: none; }
  .mem-cover { width: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  .view.on { animation: none; }
}
