/* =====================================================================
   Sound Money Records — base.css
   Design tokens, reset, shell (topbar / footer / mini player / sheets).
   Mobile first. Vanilla. No framework.
   ===================================================================== */

:root {
  --black: #0a0a0a;
  --near-black: #141414;
  --dark-grey: #1e1e1e;
  --mid-grey: #2a2a2a;
  --border-grey: #2e2e2e;
  --border-hi: #3a3a3a;
  --text-dim: #5a5a5a;
  --text-grey: #888;
  --light-grey: #cccccc;
  --off-white: #e8e8e8;
  --pure-white: #ffffff;
  --accent: #ff9b00;
  --accent-dim: #5c3608;
  --green: #6ab04c;
  --red: #d63031;

  --font-display: 'Bebas Neue', 'Oswald', Impact, sans-serif;
  --font-head: 'Oswald', 'Source Sans 3', sans-serif;
  --font-body: 'Source Sans 3', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  --topbar-h: 52px;
  --mini-h: 64px;
  --page-max: 960px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  font-family: var(--font-body);
  background: var(--black);
  color: var(--off-white);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}
body {
  display: flex;
  flex-direction: column;
  padding-top: calc(var(--topbar-h) + var(--safe-top));
}
body.has-mini { padding-bottom: calc(var(--mini-h) + var(--safe-bottom)); }

/* subtle grain, same as the old site */
body::before {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none; z-index: 9999;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; color: inherit; background: none; border: 0; }
input { font-family: inherit; color: inherit; }
img { display: block; max-width: 100%; }
svg { fill: currentColor; }
.mono { font-family: var(--font-mono); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Top bar ----------------------------------------------------------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  height: calc(var(--topbar-h) + var(--safe-top));
  padding: var(--safe-top) calc(16px + var(--safe-right)) 0 calc(16px + var(--safe-left));
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(10, 10, 10, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-grey);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 50%; overflow: hidden;
  background: var(--dark-grey); flex-shrink: 0;
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.brand-text {
  font-family: var(--font-display);
  font-size: 0.95rem; letter-spacing: 3px; text-transform: uppercase;
  color: var(--pure-white);
}
.topnav { display: flex; gap: 4px; }
.topnav a {
  font-family: var(--font-head);
  font-size: 0.72rem; letter-spacing: 2.5px; text-transform: uppercase;
  color: var(--text-grey);
  padding: 8px 10px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s;
  display: inline-flex; align-items: center; gap: 6px;
}
.topnav a:hover { color: var(--off-white); }
.topnav a.active { color: var(--pure-white); border-bottom-color: var(--accent); }
.cart-count {
  font-family: var(--font-mono); font-size: 0.6rem; line-height: 1;
  background: var(--accent); color: var(--black);
  min-width: 17px; height: 17px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 5px; font-weight: 700;
  align-self: center; transform: translateY(-1px);
}

/* ---- Main view container (store/cart/success) -------------------------- */
.view {
  width: 100%; max-width: var(--page-max);
  margin: 0 auto; padding: 16px 16px 40px;
  flex: 1;
}
.view-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.eyebrow {
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 2px;
  text-transform: uppercase; color: var(--accent);
}
.h-display {
  font-family: var(--font-display); font-size: 2rem; line-height: 1;
  letter-spacing: 1px; color: var(--pure-white);
}
.muted { color: var(--text-grey); }
.small { font-size: 0.85rem; }

/* ---- Buttons ----------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-head); font-size: 0.82rem; letter-spacing: 2.5px;
  text-transform: uppercase; font-weight: 600;
  padding: 14px 20px; min-height: 48px;
  border: 1px solid var(--border-hi); border-radius: 4px;
  color: var(--off-white); background: var(--near-black);
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.05s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:hover { border-color: var(--light-grey); }
.btn:active { transform: scale(0.985); }
.btn.primary { background: var(--accent); color: var(--black); border-color: var(--accent); }
.btn.primary:hover { background: #ffb43a; border-color: #ffb43a; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn.ghost { background: transparent; }
.link-accent { color: var(--accent); }
.link-accent:hover { text-decoration: underline; }

/* ---- Messages / states ------------------------------------------------- */
.notice {
  border: 1px solid var(--border-grey); border-left: 3px solid var(--accent);
  background: var(--near-black); padding: 14px 16px; border-radius: 4px;
  font-size: 0.95rem;
}
.notice.error { border-left-color: var(--red); }
.notice.ok { border-left-color: var(--green); }
.empty {
  text-align: center; color: var(--text-grey); padding: 48px 16px;
  font-family: var(--font-head); letter-spacing: 1px;
}
.spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid var(--border-hi); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton {
  background: linear-gradient(90deg, var(--near-black) 25%, var(--dark-grey) 50%, var(--near-black) 75%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---- Bottom sheets ----------------------------------------------------- */
.sheet { position: fixed; inset: 0; z-index: 60; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.7); }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: 88vh; max-height: 88dvh;
  display: flex; flex-direction: column;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: var(--near-black);
  border-top: 1px solid var(--border-hi);
  border-radius: 16px 16px 0 0;
  padding: 8px 16px calc(20px + var(--safe-bottom));
  animation: sheet-up 0.22s ease-out;
}
@keyframes sheet-up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-handle { width: 36px; height: 4px; border-radius: 2px; background: var(--border-hi); margin: 4px auto 12px; }
.sheet-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.sheet-eyebrow { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 2px; color: var(--accent); text-transform: uppercase; }
.sheet-title {
  font-family: var(--font-display); font-size: 1.5rem; line-height: 1.05; letter-spacing: 1px;
  color: var(--pure-white); overflow-wrap: anywhere;
}
.sheet-close {
  font-size: 1.6rem; line-height: 1; color: var(--text-grey);
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.sheet-close:hover { color: var(--pure-white); background: var(--dark-grey); }
.sheet-sub { color: var(--text-grey); font-size: 0.9rem; margin-bottom: 14px; }
@media (min-width: 640px) {
  .sheet-panel {
    left: 50%; right: auto; bottom: 50%;
    transform: translate(-50%, 50%);
    width: 460px; max-height: 85vh;
    border-radius: 12px; border: 1px solid var(--border-hi);
    padding-bottom: 20px;
  }
  @keyframes sheet-up { from { transform: translate(-50%, calc(50% + 16px)); opacity: 0; } to { transform: translate(-50%, 50%); opacity: 1; } }
  .sheet-handle { display: none; }
}

/* ---- Mini player ------------------------------------------------------- */
.mini {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  height: calc(var(--mini-h) + var(--safe-bottom));
  padding: 0 calc(12px + var(--safe-right)) var(--safe-bottom) calc(12px + var(--safe-left));
  display: flex; align-items: center; gap: 10px;
  background: rgba(20, 20, 20, 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-hi);
}
.mini-link { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.mini-art { width: 44px; height: 44px; border-radius: 3px; object-fit: cover; background: var(--dark-grey); flex-shrink: 0; }
.mini-meta { display: flex; flex-direction: column; min-width: 0; }
.mini-title {
  font-family: var(--font-head); font-weight: 500; font-size: 0.95rem;
  color: var(--pure-white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mini-sub { font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 1.5px; color: var(--text-grey); text-transform: uppercase; }
.mini-play {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent); color: var(--black);
  display: inline-flex; align-items: center; justify-content: center;
}
.mini-play svg { width: 20px; height: 20px; }
.mini-play .ico-pause, .mini-play.playing .ico-play { display: none; }
.mini-play.playing .ico-pause { display: block; }

/* ---- Footer ------------------------------------------------------------ */
.footer {
  width: 100%; max-width: var(--page-max); margin: 0 auto;
  padding: 16px 16px calc(20px + var(--safe-bottom));
  border-top: 1px solid var(--border-grey);
}
.foot-links { display: flex; justify-content: center; gap: 22px; flex-wrap: wrap; }
.foot-links a {
  font-family: var(--font-head); font-size: 0.7rem; letter-spacing: 2.5px;
  text-transform: uppercase; color: var(--text-grey);
}
.foot-links a:hover { color: var(--off-white); }
