/* ============================================================
   PRESSING PLANT LEDGER - design tokens
   Studio White / Carbon / Signal Blue / Press Grey / Stamp Red
   ============================================================ */
/* dwnturn - near-black / off-white / lavender (matches existing brand) */
:root {
  --white:  #0F0F12;   /* page background (token names kept from original build) */
  --carbon: #F2F0FA;   /* foreground */
  --signal: #CDC1F5;   /* lavender accent - buttons, playhead, active states */
  --press:  #26262C;   /* dividers, idle surfaces */
  --stamp:  #FF5C4D;

  --font-display: "Archivo", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --rule: 1px solid #33333B;
  --pad: clamp(16px, 4vw, 48px);
  --tap: 44px; /* minimum tap target */
}

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

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--white);
  color: var(--carbon);
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.45;
  padding-bottom: 96px; /* room for sticky bar */
}

.mono { font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.02em; }

a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--signal);
  outline-offset: 2px;
}

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

/* ---------- header ---------- */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: var(--tap);
  padding: 12px var(--pad);
  border-bottom: var(--rule);
}
.wordmark {
  font-weight: 900;
  text-transform: lowercase;
  letter-spacing: 0.04em;
  text-decoration: none;
  font-size: 15px;
}
.socials { display: flex; gap: 20px; }
.socials a {
  font-family: var(--font-mono);
  font-size: 13px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--tap);
  min-height: var(--tap);
}
.socials a:hover { color: var(--signal); }

/* ---------- masthead ---------- */
.masthead {
  padding: clamp(32px, 8vw, 96px) var(--pad) clamp(20px, 4vw, 48px);
  border-bottom: var(--rule);
}
.masthead-title {
  font-weight: 900;
  font-stretch: 110%;
  text-transform: lowercase;
  line-height: 0.92;
  letter-spacing: -0.02em;
  font-size: clamp(44px, 12vw, 140px);
}
.masthead-index { margin-top: 16px; color: var(--carbon); }

/* ---------- ticker ---------- */
.ticker {
  overflow: hidden;
  border-bottom: var(--rule);
  background: var(--carbon);
  color: var(--white);
  padding: 8px 0;
}
.ticker-track {
  display: inline-block;
  white-space: nowrap;
  animation: ticker-scroll 40s linear infinite;
}
.ticker-line {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
}
@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ---------- tabs ---------- */
.tabs {
  display: flex;
  gap: 8px;
  padding: 14px var(--pad) 0;
}
.tab {
  font-family: var(--font-mono);
  font-size: 13px;
  min-height: var(--tap);
  padding: 0 18px;
  border: 1px solid #33333B;
  color: var(--carbon);
  opacity: 0.7;
}
.tab.is-active {
  background: var(--signal);
  border-color: var(--signal);
  color: var(--white);
  opacity: 1;
  font-weight: 500;
}
.tab:not(.is-active):hover { opacity: 1; border-color: var(--carbon); }

/* ---------- beatstars panel ---------- */
.beatstars-panel { padding: 14px var(--pad) 0; }
.beatstars-panel iframe {
  width: 100%;
  height: 800px;
  border: 1px solid #33333B;
  display: block;
  background: #1A1A1F;
}

/* ---------- ledger ---------- */
.ledger { list-style: none; margin-top: 14px; }

.beat-row {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  grid-template-areas:
    "idx cover main buy";
  align-items: center;
  gap: 0 16px;
  padding: 14px var(--pad);
  border-bottom: 1px solid var(--press);
  position: relative;
}
.beat-row:last-child { border-bottom: var(--rule); }

.beat-idx {
  grid-area: idx;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--carbon);
  opacity: 0.5;
  width: 3ch;
}

.beat-cover {
  grid-area: cover;
  width: 56px;
  height: 56px;
  object-fit: cover;
  background: var(--press);
  display: block;
  cursor: pointer;
}

/* play surface = everything except the BUY button */
.beat-main {
  grid-area: main;
  display: grid;
  grid-template-columns: minmax(120px, 220px) 1fr auto;
  align-items: center;
  gap: 16px;
  text-align: left;
  min-height: var(--tap);
  cursor: pointer;
}

.beat-title {
  font-weight: 800;
  text-transform: lowercase;
  letter-spacing: 0.01em;
  font-size: clamp(16px, 2.2vw, 22px);
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.beat-tags {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  text-transform: lowercase;
  opacity: 0.55;
  margin-top: 2px;
}

.beat-wave {
  width: 100%;
  height: 40px;
  display: block;
}

.beat-meta {
  font-family: var(--font-mono);
  font-size: 13px;
  white-space: nowrap;
  text-align: right;
}
.beat-meta .price { display: block; font-weight: 500; }

.beat-buy {
  grid-area: buy;
  justify-self: end;
}

.btn-buy {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 13px;
  background: var(--carbon);
  color: var(--white);
  min-height: var(--tap);
  min-width: 72px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-buy:hover { background: var(--signal); }

/* hover state (no hover dependency - purely additive) */
@media (hover: hover) {
  .beat-row:not(.is-playing):hover { background: #1A1A1F; }
  .beat-row:hover .beat-title { transform: translateX(4px); }
}
.beat-title { transition: transform 140ms ease; }

/* playing state */
.beat-row.is-playing { background: var(--carbon); color: var(--white); }
.beat-row.is-playing .beat-idx { opacity: 0.6; }
.beat-row.is-playing .btn-buy { background: var(--signal); }
.beat-row.is-playing .beat-cover { animation: vinyl-spin 3s linear infinite; border-radius: 50%; }
@keyframes vinyl-spin {
  from { transform: rotate(0); }
  to { transform: rotate(360deg); }
}

/* sold state */
.beat-row.is-sold .beat-main { cursor: default; }
.beat-row.is-sold .beat-title,
.beat-row.is-sold .beat-meta { opacity: 0.35; }
.sold-stamp {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--stamp);
  border: 1.5px solid var(--stamp);
  padding: 10px 14px;
  transform: rotate(-4deg);
}

.ledger-empty { padding: 32px var(--pad); }

/* ---------- footer ---------- */
.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 24px var(--pad);
}

/* ---------- sticky bar ---------- */
.stickybar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--carbon);
  color: var(--white);
  padding: 10px var(--pad);
  z-index: 40;
  animation: bar-rise 220ms ease-out;
}
@keyframes bar-rise {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.stickybar-toggle {
  width: var(--tap);
  height: var(--tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.stickybar-toggle svg { width: 18px; height: 18px; fill: var(--white); }
.stickybar[data-state="paused"] .icon-pause { display: none; }
.stickybar[data-state="playing"] .icon-play { display: none; }
.stickybar-meta { flex: 1; min-width: 0; }
.stickybar-title {
  display: block;
  font-weight: 800;
  text-transform: lowercase;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stickybar-wave { width: 100%; height: 28px; display: block; }
.stickybar .btn-buy { background: var(--signal); flex: none; }

/* ---------- license modal ---------- */
.license-modal {
  border: var(--rule);
  padding: 0;
  width: min(480px, calc(100vw - 24px));
  background: var(--white);
  color: var(--carbon);
}
.license-modal::backdrop { background: rgba(10, 10, 10, 0.55); }

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: var(--rule);
}
.modal-beat-title {
  font-weight: 900;
  text-transform: lowercase;
  font-size: 18px;
  line-height: 1.1;
}
.modal-close {
  width: var(--tap);
  height: var(--tap);
  font-size: 26px;
  line-height: 1;
  flex: none;
}

.tier-table { border-bottom: var(--rule); }
.tier-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: var(--tap);
  padding: 12px 20px;
  border-bottom: 1px solid var(--press);
  text-align: left;
}
.tier-row:last-child { border-bottom: none; }
.tier-row[aria-checked="true"] { background: var(--carbon); color: var(--white); }
.tier-name { font-weight: 800; text-transform: uppercase; font-size: 13px; letter-spacing: 0.04em; }
.tier-includes { font-family: var(--font-mono); font-size: 11px; opacity: 0.6; display: block; margin-top: 2px; }
.tier-price { font-family: var(--font-mono); font-size: 14px; font-weight: 500; white-space: nowrap; }
.tier-row[disabled] { opacity: 0.35; }

.direct-perk { padding: 14px 20px 0; color: var(--signal); }

.btn-direct {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 12px 20px 0;
  min-height: 52px;
  background: var(--signal);
  color: var(--white);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 15px;
  text-decoration: none;
}
.btn-direct:hover { background: var(--carbon); }

.wallet-hint { text-align: center; padding: 8px 20px 0; opacity: 0.55; font-size: 11px; }

.beatstars-slot { padding: 14px 20px 20px; text-align: center; }
.beatstars-link {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--carbon);
  opacity: 0.7;
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 8px;
}
.beatstars-link:hover { opacity: 1; }
.beatstars-embed { margin-top: 12px; }
.beatstars-embed iframe { width: 100%; border: var(--rule); }

/* ---------- responsive (down to 360px) ---------- */
@media (max-width: 720px) {
  .beat-row {
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "cover main buy";
  }
  .beat-idx { display: none; }
  .beat-main {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    gap: 6px;
  }
  .beat-meta { text-align: left; }
  .beat-meta .price { display: inline; margin-left: 12px; }
  .beat-wave { height: 32px; }
  .beat-cover { width: 48px; height: 48px; align-self: start; }
}

@media (max-width: 420px) {
  .masthead-title { font-size: clamp(36px, 13vw, 48px); }
  .stickybar { gap: 8px; }
}

/* sound kit rows: no vinyl spin, no BPM slot, longer title */
.beat-row.is-kit .beat-cover { border-radius: 0; }
.beat-row.is-kit.is-playing .beat-cover { animation: none; }
.beat-row.is-kit .beat-title { font-size: clamp(14px, 2vw, 18px); letter-spacing: 0.06em; text-transform: uppercase; }

/* ---------- motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .btn-buy, .btn-direct, .socials a, .beatstars-link { transition: background-color 120ms linear, color 120ms linear, opacity 120ms linear; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ============================================================
   ADMIN PANEL (BeatStars-like)
   ============================================================ */

.admin-shell { display: flex; min-height: calc(100vh - 60px); }
.admin-sidebar {
  width: 220px;
  border-right: var(--rule);
  padding: 20px 0;
  background: #131318;
  position: sticky;
  top: 0;
  align-self: flex-start;
  min-height: calc(100vh - 60px);
}
.admin-sidebar h2 {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em;
  text-transform: uppercase; opacity: 0.5; padding: 0 20px; margin: 20px 0 8px;
}
.admin-sidebar h2:first-child { margin-top: 0; }
.admin-nav { display: flex; flex-direction: column; }
.admin-nav button {
  text-align: left; padding: 12px 20px; font-family: var(--font-mono);
  font-size: 13px; color: var(--carbon); opacity: 0.75; border-left: 3px solid transparent;
}
.admin-nav button:hover { opacity: 1; background: #1A1A20; }
.admin-nav button.is-active {
  opacity: 1; background: #1A1A20; border-left-color: var(--signal);
  font-weight: 600;
}
.admin-nav .count { opacity: 0.5; font-size: 11px; margin-left: 6px; }

.admin-main {
  flex: 1;
  padding: 28px clamp(20px, 4vw, 44px);
  max-width: 1080px;
  width: 100%;
}
.admin-main h1 {
  font-weight: 900; text-transform: lowercase;
  font-size: clamp(24px, 3.4vw, 34px); margin-bottom: 4px;
}
.admin-sub {
  font-family: var(--font-mono); font-size: 12px; opacity: 0.6; margin-bottom: 22px;
}

/* toolbar */
.toolbar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 18px;
  flex-wrap: wrap;
}
.toolbar .search {
  flex: 1; min-width: 200px;
  background: #1A1A1F; border: 1px solid #33333B; color: var(--carbon);
  padding: 10px 12px; min-height: 40px; font: inherit;
}
.toolbar .search:focus-visible { outline: 2px solid var(--signal); }

/* item cards */
.item-grid { display: grid; grid-template-columns: 1fr; gap: 0; border-top: 1px solid #26262C; }
.item-card {
  display: grid;
  grid-template-columns: 56px 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 12px 4px;
  border-bottom: 1px solid #26262C;
}
.item-card img {
  width: 56px; height: 56px; object-fit: cover; background: var(--press); display: block;
}
.item-card .meta {
  min-width: 0;
}
.item-card .name { font-weight: 800; text-transform: lowercase; font-size: 17px; line-height: 1.1; }
.item-card .sub {
  font-family: var(--font-mono); font-size: 11px; opacity: 0.6; margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.item-card .price {
  font-family: var(--font-mono); font-size: 12px; white-space: nowrap;
}
.item-card .actions { display: flex; gap: 8px; }
.item-card .badge {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em;
  text-transform: uppercase; padding: 2px 6px; border: 1px solid var(--press);
  margin-left: 6px; opacity: 0.7;
}
.item-card .badge.sold { color: var(--stamp); border-color: var(--stamp); opacity: 1; }
.item-card .badge.kit { color: var(--signal); border-color: var(--signal); opacity: 1; }
.empty-state {
  padding: 40px 16px; text-align: center; opacity: 0.55;
  font-family: var(--font-mono); font-size: 13px;
}

/* ---------- form ---------- */
.form-panel {
  background: #131318; border: 1px solid #26262C; padding: 24px;
  margin-top: 22px;
}
.form-panel h2 { font-weight: 900; text-transform: lowercase; font-size: 22px; margin-bottom: 6px; }
.form-panel .h2-sub { font-family: var(--font-mono); font-size: 12px; opacity: 0.55; margin-bottom: 18px; }

.field { margin-bottom: 14px; display: flex; flex-direction: column; }
.field > label,
.field > .lbl {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em;
  text-transform: uppercase; opacity: 0.65; margin-bottom: 6px;
}
.field input[type="text"],
.field input[type="url"],
.field input[type="email"],
.field input[type="password"],
.field input[type="number"],
.field select,
.field textarea {
  width: 100%; background: #1A1A1F; border: 1px solid #33333B; color: var(--carbon);
  font: inherit; padding: 11px 12px; min-height: 44px;
}
.field textarea { min-height: 84px; font-family: var(--font-mono); font-size: 12px; line-height: 1.5; }
.field input:focus-visible,
.field textarea:focus-visible,
.field select:focus-visible { outline: 2px solid var(--signal); }
.field .hint { font-family: var(--font-mono); font-size: 11px; opacity: 0.45; margin-top: 4px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
@media (max-width: 720px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* drop zones */
.dropzone {
  border: 1.5px dashed #444451; padding: 20px; text-align: center;
  min-height: 100px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; background: #16161B;
  font-family: var(--font-mono); font-size: 12px; opacity: 0.85;
  transition: border-color 120ms linear, background-color 120ms linear;
}
.dropzone:hover, .dropzone.is-drag { border-color: var(--signal); background: #191922; }
.dropzone .dz-file { color: var(--signal); font-weight: 600; word-break: break-all; }
.dropzone.has-file { border-style: solid; border-color: #33333B; }
.dropzone-preview { width: 72px; height: 72px; object-fit: cover; margin-right: 12px; }

/* tier blocks */
.tier-blocks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 900px) { .tier-blocks { grid-template-columns: 1fr; } }
.tier-block {
  background: #16161B; border: 1px solid #26262C; padding: 14px;
}
.tier-block h3 {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.14em;
  text-transform: uppercase; margin-bottom: 4px;
}
.tier-block .tier-desc { font-family: var(--font-mono); font-size: 11px; opacity: 0.55; margin-bottom: 12px; }
.tier-block.is-exclusive { border-color: var(--signal); }
.tier-block.is-exclusive h3 { color: var(--signal); }

/* checkbox row */
.checkrow { display: flex; align-items: center; gap: 10px; font-family: var(--font-mono); font-size: 13px; }
.checkrow input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--signal); }

/* buttons */
.btn {
  background: var(--signal); color: var(--white); border: none;
  font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em;
  font-size: 13px; min-height: 44px; padding: 0 22px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn:hover { background: var(--carbon); }
.btn.ghost { background: transparent; color: var(--carbon); border: 1px solid #33333B; }
.btn.ghost:hover { background: #1A1A1F; color: var(--signal); }
.btn.danger { background: transparent; color: var(--stamp); border: 1px solid var(--stamp); }
.btn.danger:hover { background: var(--stamp); color: var(--white); }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 11px; }

.form-actions {
  display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px;
  padding-top: 18px; border-top: 1px solid #26262C;
}
.form-actions .spacer { flex: 1; }

.status {
  font-family: var(--font-mono); font-size: 12px; padding: 12px 0; min-height: 20px;
  color: var(--signal);
}
.status.error { color: var(--stamp); }

/* progress bar */
.progress {
  height: 4px; background: #26262C; margin-top: 10px; overflow: hidden;
}
.progress .bar {
  height: 100%; background: var(--signal); width: 0%;
  transition: width 200ms linear;
}

/* mobile admin */
@media (max-width: 780px) {
  .admin-shell { flex-direction: column; }
  .admin-sidebar {
    width: 100%; min-height: auto; position: static;
    border-right: none; border-bottom: var(--rule); padding: 12px 0;
  }
  .admin-nav { flex-direction: row; overflow-x: auto; }
  .admin-nav button { border-left: none; border-bottom: 3px solid transparent; }
  .admin-nav button.is-active { border-left: none; border-bottom-color: var(--signal); }
  .admin-sidebar h2 { display: none; }
  .item-card { grid-template-columns: 48px 1fr auto; grid-template-rows: auto auto; gap: 8px 12px; }
  .item-card .price { grid-column: 2; }
  .item-card .actions { grid-column: 3; grid-row: 1 / span 2; align-self: center; }
}
