/* ============================================================
   projects/nyc-soundhood — NYC Soundhood
   Connect Spotify → your top 3 NYC neighborhoods on a live map.
   Single-frame, full-bleed. Layers a tool token ramp on top of
   the global cloonk.com system (css/style.css).
   ============================================================ */

@import url("../../css/style.css");

:root {
  --surface:        #161614;
  --surface-raised: #20201d;
  --surface-card:   #252521;
  --border:         #343430;
  --border-hover:   #4a4a44;
  --text:           var(--fg);
  --text-muted:     #989890;
  --text-dim:       #707069;
  --accent-hover:   #5cff44;
  --accent-fg:      #0a0a0a;
  --accent-dim:     rgba(57, 255, 20, 0.10);
  --spotify:        #1db954;
  --radius:    14px;
  --radius-sm: 9px;
  --radius-xs: 5px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --font-mono:  'DM Mono', 'Courier New', monospace;
  --header-h:   54px;
  --drawer-w:   390px;
}
[data-theme="light"] {
  --surface:        #ede9e1;
  --surface-raised: #e4dfd4;
  --surface-card:   #eae6dc;
  --border:         #d0ccc4;
  --border-hover:   #b6b2aa;
  --text-muted:     #5a5a54;
  --text-dim:       #8a8a82;
  --accent-hover:   #2e1cd6;
  --accent-fg:      #f5f2ec;
  --accent-dim:     rgba(27, 9, 188, 0.08);
}

html, body { height: 100%; }
html { font-size: 15px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;                 /* single frame, no page scroll */
}
button, input, select, textarea { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
code, .mono { font-family: var(--font-mono); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* ── Header (floats over the map) ────────────────────────── */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 60;
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 0 var(--page-pad);   /* mimic cloonk.com nav padding/logo position */
  background: color-mix(in oklab, var(--bg) 72%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px);
}
.header-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.header-project {
  font-size: 0.66rem; font-weight: 600; letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--text-muted); white-space: nowrap;
  padding-left: 14px; border-left: 1px solid var(--border);
}
.header-actions { display: flex; align-items: center; gap: 14px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); background: var(--surface-raised); color: var(--text);
  border-radius: var(--radius-sm); padding: 0.6rem 1rem;
  font-weight: 600; font-size: 0.84rem; cursor: pointer;
  transition: border-color var(--transition), background var(--transition), color var(--transition), opacity var(--transition), transform var(--transition);
}
.btn:hover { border-color: var(--border-hover); }
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 0.42rem 0.78rem; font-size: 0.78rem; }
.btn-ghost { background: transparent; }
.btn-accent { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn-accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-spotify { background: var(--spotify); border-color: var(--spotify); color: #fff; }
.btn-spotify:hover { opacity: 0.9; }
.btn-lg { padding: 0.92rem 1.5rem; font-size: 0.95rem; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* logo + theme toggle inherit the global cloonk.com styles
   (.nav__logo, .nav__theme-toggle, .icon-sun/.icon-moon from css/style.css) */

/* how-it-works tooltip lives in the nav bar — borderless icon */
.how-tip { position: relative; display: flex; }
.how-tip-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); transition: color var(--transition);
}
.how-tip-toggle:hover { color: var(--text); }
.how-tip-toggle svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.how-tip-pop {
  display: none; position: absolute; top: calc(100% + 12px); right: 0; z-index: 70;
  width: 320px; max-width: 78vw; padding: 1rem 1.1rem;
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); background: var(--surface);
  font-size: 0.82rem; color: var(--text-muted); line-height: 1.6;
  box-shadow: 0 12px 36px rgba(0,0,0,0.4);
}
.how-tip-pop.show { display: block; }
.how-tip-pop p { margin: 0; }
.how-tip-cta {
  display: inline-block; margin-top: 0.85rem; font-weight: 700; font-size: 0.82rem;
  color: var(--accent); transition: opacity var(--transition);
}
.how-tip-cta:hover { opacity: 0.75; }

.only-mobile { display: none; }
.only-desktop { display: block; }

/* ── Views ───────────────────────────────────────────────── */
.view { position: fixed; inset: 0; display: none; }
.view.active { display: block; }

/* ── Connect view — intro left, card right ───────────────── */
#view-connect { display: none; overflow-y: auto; }
#view-connect.active { display: flex; align-items: center; }
.connect-grid {
  width: 100%; max-width: 1140px; margin: 0 auto;
  padding: calc(var(--header-h) + 4vh) var(--page-pad) 6vh;
  display: grid; grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(2rem, 5vw, 5.5rem); align-items: center;
}
@media (max-width: 880px) {
  .connect-grid { grid-template-columns: 1fr; gap: 2rem; align-items: start; }
}
.eyebrow {
  font-family: var(--font-display); font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--accent); margin-bottom: 0.9rem;
}
.display {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(2.1rem, 5.2vw, 3.8rem); line-height: 1.0; letter-spacing: -0.025em;
}
.display em { font-style: italic; font-weight: 400; color: var(--accent); }
.lede {
  margin-top: 1.3rem; max-width: 60ch; color: var(--text-muted);
  font-size: 1rem; line-height: 1.7;
}

.connect-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); padding: clamp(1.3rem, 3vw, 2rem); width: 100%;
}
.field-label {
  font-family: var(--font-display); font-size: 0.62rem; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 0.6rem;
}
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; flex-wrap: wrap; }
.seg button {
  padding: 0.5rem 0.9rem; font-size: 0.8rem; font-weight: 600; background: transparent;
  color: var(--text-muted); cursor: pointer; border-right: 1px solid var(--border);
  transition: background var(--transition), color var(--transition);
}
.seg button:last-child { border-right: none; }
.seg button.active { background: var(--accent); color: var(--accent-fg); }

.cta-row { display: flex; flex-wrap: wrap; gap: 0.7rem; align-items: stretch; margin-top: 1.5rem; }
.cta-row .btn { flex: 1 1 220px; justify-content: center; }
.privacy-mini { margin-top: 1.3rem; font-size: 0.76rem; color: var(--text-dim); display: flex; align-items: center; gap: 0.5rem; }
.privacy-mini .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }

.notice {
  margin-top: 1.2rem; border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); background: var(--surface-raised); padding: 0.9rem 1.1rem;
  font-size: 0.83rem; color: var(--text-muted); line-height: 1.6;
}
.notice.error { border-left-color: #ff5b4a; }
.notice code { font-size: 0.78rem; color: var(--text); background: var(--surface-card); padding: 0.1rem 0.35rem; border-radius: 4px; }
.notice strong { color: var(--text); }

/* ── Loading view ────────────────────────────────────────── */
#view-loading.active { display: flex; align-items: center; justify-content: center; }
.loading { text-align: center; }
.eq { display: inline-flex; gap: 6px; height: 46px; align-items: flex-end; }
.eq span { width: 7px; background: var(--accent); border-radius: 3px; animation: eq 1s ease-in-out infinite; }
.eq span:nth-child(2) { animation-delay: 0.15s; }
.eq span:nth-child(3) { animation-delay: 0.3s; }
.eq span:nth-child(4) { animation-delay: 0.45s; }
.eq span:nth-child(5) { animation-delay: 0.6s; }
@keyframes eq { 0%, 100% { height: 12px; } 50% { height: 46px; } }
.loading p { margin-top: 1.4rem; color: var(--text-muted); font-size: 0.9rem; }

/* ── Map view ────────────────────────────────────────────── */
#map { position: absolute; inset: 0; }
.mapboxgl-ctrl-logo { opacity: 0.5; }

.map-tl {
  position: absolute; top: calc(var(--header-h) + 12px); left: var(--page-pad); z-index: 30;
}
/* engaging accent CTA that draws the eye to the stats drawer */
.seemore {
  border-radius: 100px; font-weight: 700;
  box-shadow: 0 6px 22px rgba(0,0,0,0.35);
  animation: seemorePulse 2.8s ease-in-out infinite;
}
.seemore:hover { transform: translateY(-1px); }
.seemore-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent-fg); opacity: 0.85;
  animation: seemoreBlink 2.8s ease-in-out infinite;
}
@keyframes seemorePulse {
  0%   { box-shadow: 0 6px 22px rgba(0,0,0,0.35), 0 0 0 0 color-mix(in oklab, var(--accent) 55%, transparent); }
  60%  { box-shadow: 0 6px 22px rgba(0,0,0,0.35), 0 0 0 12px transparent; }
  100% { box-shadow: 0 6px 22px rgba(0,0,0,0.35), 0 0 0 0 transparent; }
}
@keyframes seemoreBlink { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .seemore, .seemore-dot { animation: none; } }

/* reveal dock — the pill is the button itself, bottom center */
.reveal-dock {
  position: absolute; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 30;
}
#reveal-btn { border-radius: 100px; box-shadow: 0 8px 30px rgba(0,0,0,0.42); }
.reveal-dock.done #reveal-btn { background: var(--surface-raised); color: var(--text); border-color: var(--border); animation: none; }

/* heatmap legend */
.heat-legend {
  position: absolute; right: var(--page-pad); bottom: max(24px, env(safe-area-inset-bottom)); z-index: 30;
  display: none; align-items: center; gap: 0.5rem;
  background: color-mix(in oklab, var(--bg) 80%, transparent);
  border: 1px solid var(--border); border-radius: 100px; padding: 0.4rem 0.9rem;
  font-size: 0.7rem; color: var(--text-muted); backdrop-filter: blur(14px);
}
.heat-legend.show { display: flex; }
.heat-legend .ramp {
  width: 90px; height: 8px; border-radius: 4px;
  background: linear-gradient(90deg, rgba(120,120,120,0.4), var(--accent));
}

/* revealed neighborhood markers */
.hood-marker {
  display: flex; align-items: center; gap: 8px; cursor: default;
  background: var(--bg); border: 1px solid var(--accent); border-radius: 100px;
  padding: 5px 12px 5px 6px; box-shadow: 0 6px 22px rgba(0,0,0,0.45);
  transform: translateY(-6px); animation: pop 0.45s cubic-bezier(0.2,1.2,0.4,1);
}
.hood-marker.is-top { border-width: 2px; box-shadow: 0 0 0 4px var(--accent-dim), 0 8px 26px rgba(0,0,0,0.5); }
.hm-rank {
  width: 24px; height: 24px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--accent-fg); border-radius: 50%;
  font-family: var(--font-display); font-weight: 800; font-size: 0.85rem;
}
.hm-body { display: flex; flex-direction: column; line-height: 1.15; }
.hm-body b { font-family: var(--font-display); font-size: 0.86rem; }
.hm-body i { font-style: normal; font-size: 0.68rem; color: var(--text-muted); }
@keyframes pop { from { opacity: 0; transform: translateY(4px) scale(0.85); } to { opacity: 1; transform: translateY(-6px) scale(1); } }

/* ── Stats drawer ────────────────────────────────────────── */
.stats-drawer {
  position: absolute; top: var(--header-h); bottom: 0; left: 0; width: var(--drawer-w); max-width: 92vw;
  z-index: 50; background: var(--surface); border-right: 1px solid var(--border);
  transform: translateX(-101%); transition: transform 0.4s cubic-bezier(0.4,0,0.2,1);
  display: flex; flex-direction: column; box-shadow: 12px 0 40px rgba(0,0,0,0.35);
}
.stats-drawer.open { transform: none; }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 1.3rem; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.drawer-head h2 { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; }
.drawer-close {
  width: 30px; height: 30px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-raised); cursor: pointer; font-size: 0.9rem; color: var(--text-muted);
}
.drawer-close:hover { color: var(--text); border-color: var(--border-hover); }
.drawer-body { overflow-y: auto; padding: 1.2rem 1.3rem 1.6rem; }
.d-section { padding-bottom: 1.5rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.d-section:last-of-type { border-bottom: none; }
.subhead {
  font-family: var(--font-display); font-size: 0.6rem; font-weight: 700; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--text-dim); margin-bottom: 0.85rem;
}

.d-match { display: flex; gap: 0.8rem; margin-bottom: 1.2rem; }
.d-match:last-child { margin-bottom: 0; }
.d-rank {
  font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; color: var(--accent);
  line-height: 1; flex-shrink: 0; width: 1.2em; text-align: center;
}
.d-match-body { flex: 1; min-width: 0; }
.d-match-top { display: flex; justify-content: space-between; align-items: baseline; }
.d-match-top b { font-family: var(--font-display); font-size: 1.02rem; font-weight: 700; }
.d-match-top span { font-family: var(--font-display); font-weight: 700; color: var(--accent); }
.d-meter { height: 5px; border-radius: 3px; background: var(--surface-card); margin: 0.45rem 0 0.6rem; overflow: hidden; }
.d-meter i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.d-match-body p { font-size: 0.82rem; color: var(--text-muted); line-height: 1.55; }
.d-match-body dl { display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 0.6rem; margin-top: 0.6rem; }
.d-match-body dt { font-family: var(--font-display); font-size: 0.56rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim); padding-top: 0.15rem; }
.d-match-body dd { font-size: 0.78rem; color: var(--text-muted); line-height: 1.45; }

/* drawer time-frame regenerate control */
.d-range .seg { display: flex; width: 100%; }
.seg-sm button { flex: 1; padding: 0.42rem 0.4rem; font-size: 0.72rem; }
.d-range-note { margin-top: 0.6rem; font-size: 0.72rem; color: var(--text-dim); min-height: 1em; line-height: 1.4; }

.bars { display: flex; flex-direction: column; gap: 0.5rem; }
.bar-row { display: grid; grid-template-columns: 96px 1fr 36px; align-items: center; gap: 0.6rem; }
.bar-row .lbl { font-size: 0.74rem; color: var(--text-muted); text-transform: capitalize; }
.bar-track { height: 8px; background: var(--surface-card); border-radius: 5px; overflow: hidden; }
.bar-track i { display: block; height: 100%; background: var(--accent); border-radius: 5px; transition: width 0.8s cubic-bezier(0.4,0,0.2,1); }
.bar-row .pct { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-dim); text-align: right; }

.axis { margin-top: 1.1rem; }
.axis-label { display: flex; justify-content: space-between; font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 0.45rem; }
.axis-track { position: relative; height: 8px; border-radius: 5px; background: var(--surface-card); }
.axis-track i { position: absolute; top: 50%; width: 15px; height: 15px; border-radius: 50%; background: var(--accent); transform: translate(-50%, -50%); box-shadow: 0 0 0 4px var(--accent-dim); }

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.72rem; border: 1px solid var(--border); border-radius: 100px;
  padding: 0.28rem 0.7rem; color: var(--text-muted);
  background: color-mix(in oklab, var(--accent) 8%, var(--surface-raised));
}
.chip b { color: var(--text); font-weight: 600; }
.chip i { font-style: normal; font-size: 0.62rem; color: var(--text-dim); }
.chip-top {
  border-color: var(--accent);
  background: color-mix(in oklab, var(--accent) 18%, var(--surface-raised));
}
.chip-top b { color: var(--accent); }
.chip-top i { color: var(--accent); opacity: 0.8; }

.artist-list { display: flex; flex-direction: column; gap: 0.5rem; }
.artist-list .row { display: flex; align-items: center; gap: 0.6rem; font-size: 0.83rem; }
.artist-list .row .i { font-family: var(--font-mono); font-size: 0.68rem; color: var(--text-dim); width: 18px; }
.artist-list .row .nm { color: var(--text); }
.artist-list .row .gn { color: var(--text-dim); font-size: 0.72rem; margin-left: auto; text-align: right; max-width: 48%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d-sub { margin-top: 0.9rem; font-size: 0.74rem; color: var(--text-dim); line-height: 1.5; }

.drawer-foot { display: flex; gap: 0.6rem; padding-top: 0.4rem; }

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 720px) {
  .only-mobile { display: inline-flex; }
  .only-desktop { display: none; }
  .label-hide { display: none; }
  .header-project { display: none; }
  .header-actions { gap: 11px; }

  /* tooltip drops as a full-width sheet under the nav bar */
  .how-tip-pop {
    position: fixed; top: calc(var(--header-h) + 8px); left: 12px; right: 12px;
    width: auto; max-width: none;
  }

  .display { font-size: clamp(1.9rem, 8vw, 2.6rem); }

  /* drawer becomes a near-full-screen sheet from the left */
  .stats-drawer { width: 100%; max-width: 100%; border-right: none; }

  .heat-legend { left: var(--page-pad); right: var(--page-pad); bottom: calc(74px + env(safe-area-inset-bottom)); justify-content: center; }
}
