/* ─────────────────────────────────────────────────────────────
   TAPES — design tokens
   Palette: warm dark room, amber VU-meter glow, tape-red indicator.
   Type: Fraunces (display, liner-notes feel) / Inter (body) /
         IBM Plex Mono (counters, timestamps — like a tape counter).
   ───────────────────────────────────────────────────────────── */

:root {
  --bg: #1c1a17;
  --surface: #26221d;
  --surface-2: #2f2a23;
  --border: #3a342b;
  --text: #f2ece0;
  --text-dim: #a89a82;
  --text-faint: #786c58;
  --amber: #e8a33d;
  --amber-dim: #8a662b;
  --red: #c1443b;
  --green: #6b8f5e;

  --display: "Fraunces", Georgia, serif;
  --body: "Inter", -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --handwriting: "Caveat", cursive;

  --radius: 14px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  min-height: 100vh;
}

.boot {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  font-family: var(--display);
  font-size: 2rem;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

#app { min-height: 100vh; }

a { color: inherit; }

button {
  font-family: var(--body);
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

/* ── Shell layout ────────────────────────────────────────────── */

.shell {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 20px 100px;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 28px 0 20px;
  border-bottom: 1px solid var(--border);
}

.topbar .wordmark {
  font-family: var(--display);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.topbar .wordmark .dot {
  color: var(--amber);
}

.topbar .user {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* Deck-style bottom nav — literal control buttons */
.deck-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  z-index: 20;
}

.deck-nav-inner {
  display: flex;
  gap: 8px;
  max-width: 780px;
  width: 100%;
  justify-content: space-between;
}

.deck-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  color: var(--text-faint);
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.deck-btn.active {
  color: var(--amber);
  background: rgba(232, 163, 61, 0.08);
}

.deck-btn .glyph {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
}

.deck-btn.active .glyph { background: currentColor; }

/* ── Section headers ─────────────────────────────────────────── */

.view-header {
  padding: 28px 0 18px;
}

.view-header h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.7rem;
  margin: 0 0 6px;
}

.view-header p {
  color: var(--text-dim);
  font-size: 0.92rem;
  margin: 0;
  max-width: 46ch;
}

/* ── Cards / lists ───────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.track-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.track-row:last-child { border-bottom: none; }

.track-row img {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--surface-2);
  flex-shrink: 0;
}

.track-meta { min-width: 0; flex: 1; }

.track-title {
  font-size: 0.92rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-artist {
  font-size: 0.8rem;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--amber);
  flex-shrink: 0;
}

/* ── Nudge cards (album completion / remember when) ─────────── */

.nudge {
  background: linear-gradient(135deg, rgba(232,163,61,0.09), rgba(232,163,61,0.02));
  border: 1px solid var(--amber-dim);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.nudge-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 6px;
}

.nudge-body {
  font-family: var(--display);
  font-size: 1.05rem;
  line-height: 1.4;
}

.nudge-sub {
  margin-top: 6px;
  font-size: 0.82rem;
  color: var(--text-dim);
  font-family: var(--mono);
}

/* ── Cassette card (Tapes) — signature element ──────────────── */

.cassette {
  background: linear-gradient(160deg, #2b261f, #201c17);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}

.cassette::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg, rgba(255,255,255,0.015) 0px, rgba(255,255,255,0.015) 1px,
    transparent 1px, transparent 3px
  );
  pointer-events: none;
}

.cassette-reels {
  display: flex;
  gap: 18px;
  margin-bottom: 14px;
}

.reel {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--text-faint);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reel::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--text-faint);
}

.cassette:hover .reel {
  animation: spin 3s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.cassette-title {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 2px;
}

.cassette-meta {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--text-dim);
}

.cassette-note {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-family: var(--handwriting);
  font-size: 1.15rem;
  color: var(--text-dim);
}

/* ── Buttons ─────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
}

.btn-primary {
  background: var(--amber);
  color: #1c1a17;
}

.btn-primary:hover { background: #f0b45c; }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-block { width: 100%; }

/* ── Login view ──────────────────────────────────────────────── */

.login-view {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
  gap: 22px;
}

.login-view .wordmark {
  font-family: var(--display);
  font-size: 2.6rem;
  font-weight: 600;
}

.login-view .tagline {
  color: var(--text-dim);
  max-width: 34ch;
  line-height: 1.5;
}

/* ── Forms ───────────────────────────────────────────────────── */

input[type="text"], textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 12px 14px;
  font-family: var(--body);
  font-size: 0.92rem;
  margin-bottom: 10px;
}

textarea { resize: vertical; min-height: 70px; }

.search-bar {
  position: sticky;
  top: 0;
  background: var(--bg);
  padding: 14px 0;
  z-index: 10;
}

/* ── Musical Life narrative ──────────────────────────────────── */

.life-line {
  font-family: var(--display);
  font-size: 1.1rem;
  line-height: 1.55;
  margin-bottom: 14px;
  padding-left: 16px;
  border-left: 2px solid var(--amber-dim);
}

.genre-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.genre-pill {
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
}

/* ── Record store view ───────────────────────────────────────── */

.store-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.store-row:last-child { border-bottom: none; }

.store-name { font-weight: 500; }

.store-dist {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* ── Empty / loading states ──────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
}

.empty-state .glyph {
  font-size: 1.6rem;
  margin-bottom: 10px;
  opacity: 0.6;
}

.loading-line {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text-dim);
}

.error-banner {
  background: rgba(193, 68, 59, 0.12);
  border: 1px solid var(--red);
  color: var(--text);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 14px;
}

.share-link-box {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 0.78rem;
  word-break: break-all;
  margin: 12px 0;
}

.tab-toggle {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.tab-toggle button {
  flex: 1;
  padding: 8px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.tab-toggle button.active {
  border-color: var(--amber);
  color: var(--amber);
}

.section-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 24px 0 10px;
}
