/* ==========================================================================
   Take A Beat — public design system
   Black + white, mobile-first, luxury minimal.
   ========================================================================== */

:root {
  --bg:           #000;
  --bg-surface:   #0a0a0a;
  --bg-elevated:  #111;
  --text:         #f0f0f0;
  --text-muted:   #888;
  --text-dim:     #555;
  --border:       rgba(255, 255, 255, 0.12);
  --border-active:rgba(255, 255, 255, 0.45);
  --accent:       #ffffff;
  --warn:         #ffba49;
  --error:        #ff5b5b;
  --success:      #6dffa5;

  --font-sans:  'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono:  'JetBrains Mono', 'SF Mono', Menlo, Consolas, 'Courier New', monospace;
  --radius-sm:  2px;
  --radius:     4px;
  --radius-lg:  8px;
  --shadow-sm:  0 0 0 1px var(--border);
  --shadow-active: 0 0 0 1px var(--border-active);
  --transition: 200ms ease;

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

  --type-xs:    clamp(0.65rem, 1.5vw, 0.75rem);
  --type-sm:    clamp(0.75rem, 2vw, 0.875rem);
  --type-base:  clamp(0.9rem, 2.4vw, 1rem);
  --type-lg:    clamp(1.125rem, 4vw, 1.5rem);
  --type-xl:    clamp(1.5rem, 6vw, 2.5rem);
  --type-2xl:   clamp(2rem, 8vw, 4rem);
  --type-3xl:   clamp(2.5rem, 12vw, 6rem);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { background: var(--bg); color: var(--text); margin: 0; }
body {
  font-family: var(--font-sans);
  font-size: var(--type-base);
  line-height: 1.5;
  letter-spacing: 0.01em;
  min-height: 100vh;
  min-height: 100dvh;
  padding-top:    var(--safe-top);
  padding-left:   var(--safe-left);
  padding-right:  var(--safe-right);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, video, audio { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }

/* Typography */
h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.01em; margin: 0 0 0.5em; line-height: 1.1; }
h1 { font-size: var(--type-2xl); }
h2 { font-size: var(--type-xl); }
h3 { font-size: var(--type-lg); }
p  { margin: 0 0 1em; }
.muted { color: var(--text-muted); }
.muted.small, .small { font-size: var(--type-sm); }
code { font-family: var(--font-mono); font-size: 0.92em; color: var(--text-muted); }

/* Layout */
.site-header,
.site-footer,
.site-main { padding-left: 1.25rem; padding-right: 1.25rem; }
@media (min-width: 720px) {
  .site-header, .site-footer, .site-main { padding-left: 2rem; padding-right: 2rem; }
}
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 1.25rem; padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.site-brand {
  display: inline-flex; align-items: baseline; gap: 0.4em;
  font-family: var(--font-mono);
  letter-spacing: 0.18em;
  font-size: var(--type-sm);
  text-transform: uppercase;
}
.brand-mark { color: var(--accent); }
.brand-mark.muted { color: var(--text-muted); }
.site-nav { display: flex; gap: 1.5rem; font-size: var(--type-sm); text-transform: uppercase; letter-spacing: 0.12em; }
.site-nav a { color: var(--text-muted); transition: color var(--transition); }
.site-nav a:hover { color: var(--text); }
.site-main {
  padding-top: 2rem;
  padding-bottom: 4rem;
  max-width: 1180px;
  margin: 0 auto;
}
.site-footer {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  padding-bottom: calc(1.5rem + var(--safe-bottom));
  font-size: var(--type-sm);
  color: var(--text-muted);
}
.site-footer .footer-row { display: flex; flex-wrap: wrap; gap: 1rem; padding: 0.25rem 0; }
.site-footer .footer-brand { letter-spacing: 0.18em; color: var(--text); font-family: var(--font-mono); }
.site-footer .footer-links a { color: var(--text-muted); }
.site-footer .footer-links a:hover { color: var(--text); }
.site-footer .footer-fineprint { color: var(--text-dim); font-size: var(--type-xs); }

.global-notice {
  background: var(--accent);
  color: #000;
  text-align: center;
  font-size: var(--type-sm);
  letter-spacing: 0.04em;
  padding: 0.6rem 1rem;
}

/* Hero */
.hero { padding: 3rem 0 2rem; max-width: 720px; }
.hero-headline { font-size: var(--type-3xl); letter-spacing: -0.02em; margin: 0 0 0.4em; }
.hero-sub { color: var(--text-muted); max-width: 40ch; }

/* Beat grid */
.beat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  padding: 1rem 0 3rem;
}
.empty-state { color: var(--text-muted); padding: 3rem 0; text-align: center; }
.beat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: border-color var(--transition), transform var(--transition);
}
.beat-card:hover { border-color: var(--border-active); transform: translateY(-2px); }
.beat-card.is-sold-out { opacity: 0.55; }
.beat-card-media {
  aspect-ratio: 1 / 1;
  background: #050505;
  position: relative;
}
.beat-card-media img { width: 100%; height: 100%; object-fit: cover; }
.beat-card-meta { padding: 1rem 1.1rem 1.1rem; display: flex; flex-direction: column; gap: 0.4rem; }
.beat-card-label {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: var(--type-xs);
  color: var(--text-muted);
}
.beat-card.is-sold-out .beat-card-label { color: var(--text-dim); }
.beat-card-title { font-size: var(--type-lg); margin: 0; }
.beat-card-counter { font-family: var(--font-mono); color: var(--text-muted); font-size: var(--type-sm); }

/* Beat page */
.beat-page {
  display: grid;
  gap: 2rem;
  padding: 1rem 0 3rem;
  grid-template-columns: 1fr;
}
.beat-video {
  position: relative;
  aspect-ratio: 9 / 16;
  background: #050505;
  border: 1px solid var(--border);
  overflow: hidden;
  border-radius: var(--radius);
  max-width: 480px;
  margin-inline: auto;
  width: 100%;
}
.beat-video video { width: 100%; height: 100%; object-fit: cover; }
.beat-poster {
  aspect-ratio: 1 / 1;
  background: #050505 center/cover no-repeat;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 480px;
  margin-inline: auto;
  width: 100%;
}
@media (min-width: 880px) {
  .beat-page { grid-template-columns: minmax(0, 480px) 1fr; align-items: start; }
}
.unmute-chip {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  background: rgba(0,0,0,0.7);
  color: var(--text);
  border: 1px solid var(--border-active);
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  font-family: var(--font-mono);
  font-size: var(--type-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  backdrop-filter: blur(6px);
}
.unmute-chip[data-muted="false"] { display: none; }

.beat-meta { display: flex; flex-direction: column; gap: 1rem; }
.beat-title { margin: 0; }
.beat-desc { color: var(--text-muted); white-space: pre-line; max-width: 60ch; }
.beat-counter {
  display: inline-flex; align-items: baseline; gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: var(--type-xl);
  letter-spacing: 0.04em;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  width: max-content;
}
.beat-counter .counter-num,
.beat-counter .counter-total { font-weight: 600; }
.beat-counter .counter-label {
  font-family: var(--font-sans);
  font-size: var(--type-xs);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  margin-left: 0.5rem;
}

.beat-cta-block {
  display: flex; flex-direction: column; gap: 0.6rem;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-size: var(--type-sm);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 600;
  padding: 0.95rem 1.6rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  min-height: 44px;
  text-decoration: none;
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform var(--transition);
  touch-action: manipulation;
}
.btn-primary:hover,
.btn-primary:focus-visible { background: var(--accent); color: #000; }
.btn-primary[disabled],
.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  border-color: var(--border);
  color: var(--text-muted);
  background: transparent;
}
.btn-ghost { border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--border-active); }
.btn-small { padding: 0.55rem 0.95rem; font-size: var(--type-xs); min-height: 36px; }
.cta-btn { width: 100%; max-width: 320px; }
.cta-btn[data-state="loading"]::after {
  content: '';
  width: 0.85em; height: 0.85em; border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  margin-left: 0.5em;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Forms */
.claim-form label,
.form-grid label {
  display: flex; flex-direction: column; gap: 0.35rem;
  font-size: var(--type-xs);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-muted);
}
.claim-form input,
.claim-form textarea,
.form-grid input,
.form-grid textarea,
.form-grid select {
  font-family: var(--font-sans);
  font-size: 16px; /* prevents iOS zoom on focus */
  background: #000;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  width: 100%;
  transition: border-color var(--transition);
  text-transform: none;
  letter-spacing: normal;
}
.claim-form input:focus,
.claim-form textarea:focus,
.form-grid input:focus,
.form-grid textarea:focus,
.form-grid select:focus { outline: none; border-color: var(--border-active); }

.checkbox-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: var(--type-sm) !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  color: var(--text);
  cursor: pointer;
  line-height: 1.4;
}
.checkbox-row input[type="checkbox"] {
  width: 18px; height: 18px;
  margin-top: 0.25rem;
  flex: 0 0 auto;
  accent-color: #fff;
  cursor: pointer;
}

.terms-disclosure {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-surface);
}
.terms-disclosure summary {
  padding: 0.75rem 1rem;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: var(--type-sm);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  list-style: none;
}
.terms-disclosure summary::-webkit-details-marker { display: none; }
.terms-disclosure summary:hover { color: var(--text); }
.terms-disclosure[open] summary { border-bottom: 1px solid var(--border); color: var(--text); }
.terms-snapshot {
  padding: 1rem 1.1rem;
  font-size: var(--type-sm);
  color: var(--text-muted);
  white-space: pre-wrap;
  line-height: 1.6;
  max-height: 280px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.claim-form-error {
  background: rgba(255, 91, 91, 0.08);
  border: 1px solid rgba(255, 91, 91, 0.5);
  color: var(--error);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: var(--type-sm);
}

/* Claim modal */
.claim-modal[hidden] { display: none; }
.claim-modal {
  position: fixed; inset: 0;
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 50;
}
.claim-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
}
.claim-modal-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 520px;
  padding: 1.5rem 1.25rem calc(2rem + var(--safe-bottom));
  max-height: 92vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; gap: 1rem;
  animation: slideUp 0.3s ease-out;
}
.claim-modal-close {
  position: absolute; top: 0.5rem; right: 0.75rem;
  background: transparent; border: 0;
  color: var(--text-muted);
  font-size: 1.6rem;
  width: 2rem; height: 2rem;
  cursor: pointer;
}
.claim-modal-close:hover { color: var(--text); }
@media (min-width: 720px) {
  .claim-modal { align-items: center; }
  .claim-modal-card { border-radius: var(--radius-lg); }
}
@keyframes slideUp { from { transform: translateY(20%); opacity: 0; } to { transform: none; opacity: 1; } }

/* State page (sold out, revoked, error) */
.state-page {
  text-align: center;
  padding: 4rem 1rem;
  max-width: 520px;
  margin: 0 auto;
}
.state-heading { font-size: var(--type-2xl); }
.state-body { color: var(--text-muted); }

/* Access page */
.access-page {
  display: flex; flex-direction: column; gap: 1.5rem;
  max-width: 640px; margin: 0 auto;
  padding: 2rem 0 4rem;
}
.access-token-badge {
  font-family: var(--font-mono);
  font-size: var(--type-xs);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  width: max-content;
}
.access-player {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.access-player audio { width: 100%; }
.access-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.bookmark-tip {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: var(--type-sm);
}

/* Instruction page */
.instruction-page {
  max-width: 640px; margin: 0 auto;
  padding: 2rem 0 3rem;
  display: flex; flex-direction: column; gap: 1.25rem;
}
.instruction-list {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 1.5rem 1.5rem 1.5rem 2.25rem;
  border-radius: var(--radius);
  color: var(--text);
  line-height: 1.6;
}
.instruction-list li { margin-bottom: 0.5rem; }

/* Legal pages */
.legal-page { max-width: 720px; margin: 0 auto; padding: 2rem 0 4rem; }
.legal-body { white-space: pre-wrap; line-height: 1.7; color: var(--text-muted); }
.legal-body, .legal-page p { color: var(--text-muted); }
.legal-page h1 { color: var(--text); }
.legal-page h2 { color: var(--text); margin-top: 2rem; }

/* Flash */
.flash {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  font-size: var(--type-sm);
  background: var(--bg-surface);
}
.flash-success { border-color: var(--success); color: var(--success); }
.flash-error   { border-color: var(--error);   color: var(--error); }
.flash-warning { border-color: var(--warn);    color: var(--warn); }

/* Preview banner */
.preview-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem;
  background: var(--warn);
  color: #000;
  padding: 0.6rem 1rem;
  font-size: var(--type-sm);
  letter-spacing: 0.04em;
  margin-bottom: 1.5rem;
  border-radius: var(--radius);
}
.preview-banner code { background: rgba(0,0,0,0.15); padding: 0.1rem 0.35rem; border-radius: 3px; color: #000; }

/* Motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
