/* Arson Theory — Vinyl Visualizer
   Brand: #fe2b09 red, black, white. Tight, editorial, dark-mode default. */

:root {
  --at-red: #fe2b09;
  --at-red-dark: #c42007;
  --bg: #0a0a0a;
  --bg-elev: #131313;
  --bg-elev-2: #1c1c1c;
  --line: #262626;
  --line-strong: #3a3a3a;
  --text: #f4f4f0;
  --text-mute: #9a9a96;
  --text-dim: #6a6a66;
  --radius: 4px;
  --radius-lg: 8px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: relative;
  z-index: 5;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}
.brand__wordmark-img {
  height: 26px;
  width: auto;
  display: block;
}
.topnav { flex: 1; display: flex; align-items: center; }
.topnav__crumb {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-mute);
  padding-left: 12px;
  border-left: 1px solid var(--line-strong);
  margin-left: 4px;
}
.topactions { display: flex; gap: 8px; }

/* ---------- Buttons ---------- */
.btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  padding: 9px 14px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}
.btn:hover { background: var(--bg-elev); border-color: #4a4a4a; }
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--at-red);
  border-color: var(--at-red);
  color: #fff;
}
.btn--primary:hover { background: var(--at-red-dark); border-color: var(--at-red-dark); }
.btn--ghost {}
.btn--block { width: 100%; margin-top: 12px; }

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  height: calc(100% - 53px); /* topbar height */
}
.stage {
  position: relative;
  background: radial-gradient(ellipse at 50% 60%, #1a1a1a 0%, #050505 70%);
  overflow: hidden;
}
.stage canvas { display: block; }

.panel {
  background: var(--bg-elev);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  padding: 4px 0 80px;
}
.panel__section {
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--line);
}
.panel__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.panel__header h2 {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.selected {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.selected__kind {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--at-red);
  border: 1px solid rgba(254, 43, 9, 0.35);
  padding: 1px 6px;
  border-radius: 2px;
}
.panel__footer {
  padding: 14px 18px 24px;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  text-align: center;
}

/* ---------- Tabs / chips ---------- */
.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 12px;
  background: var(--bg);
  padding: 3px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: thin;
}
.tabs::-webkit-scrollbar { height: 4px; }
.tabs::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 2px; }
.tab {
  flex: 0 0 auto;
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--text-mute);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 7px 10px;
  cursor: pointer;
  border-radius: 3px;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
.tab:hover { color: var(--text); }
.tab.is-active {
  background: var(--at-red);
  color: #fff;
}

.chiprow {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chiprow[hidden],
[hidden] {
  display: none !important;
}
.chiprow--sub {
  margin-top: 8px;
  padding: 6px 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.chiprow--sub::before {
  content: 'Variant';
  display: block;
  width: 100%;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 6px;
}
.chip--sub {
  font-size: 11px;
  padding: 5px 9px;
}
.chip {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s ease;
}
.chip:hover { border-color: #555; }
.chip.is-active {
  background: var(--at-red);
  border-color: var(--at-red);
  color: #fff;
}

/* ---------- Swatches ---------- */
.swatches {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
}
.swatches--sm { grid-template-columns: repeat(10, 1fr); }
.swatch {
  appearance: none;
  border: 0;
  padding: 0;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  cursor: pointer;
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: transform 0.12s ease, outline-color 0.15s ease;
}
.swatch:hover { transform: scale(1.08); }
.swatch.is-active {
  outline-color: var(--at-red);
  transform: scale(1.08);
}
.swatch--sm { /* same shape, the grid cols make them smaller */ }

/* ---------- Form fields ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.field--inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.field__label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.field input[type="text"] {
  background: var(--bg);
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 8px 10px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
}
.field input[type="text"]:focus {
  outline: none;
  border-color: var(--at-red);
}
.field input[type="color"] {
  width: 48px;
  height: 32px;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 2px;
}
.field input[type="file"] {
  font-size: 12px;
  color: var(--text-mute);
}
.field input[type="file"]::file-selector-button {
  background: var(--bg);
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 6px 10px;
  margin-right: 10px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: var(--radius);
}
.field input[type="file"]::file-selector-button:hover {
  background: var(--at-red);
  border-color: var(--at-red);
  color: #fff;
}
.field input[type="checkbox"] {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--bg);
  cursor: pointer;
  position: relative;
  margin: 0;
}
.field input[type="checkbox"]:checked {
  background: var(--at-red);
  border-color: var(--at-red);
}
.field input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.hint {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.5;
}

/* ---------- Photographic-accuracy disclaimer ---------- */
.panel__disclaimer {
  margin: 0;
  padding: 12px 16px;
  background: rgba(254, 43, 9, 0.06);
  border-bottom: 1px solid rgba(254, 43, 9, 0.16);
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-dim);
}
.panel__disclaimer strong {
  color: var(--text);
  font-weight: 600;
}

/* ---------- AI Designer ---------- */
.panel__section--ai {
  background: linear-gradient(180deg, rgba(254, 43, 9, 0.06) 0%, transparent 100%);
}
.badge {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--at-red);
  border: 1px solid rgba(254, 43, 9, 0.4);
  padding: 2px 6px;
  border-radius: 2px;
}
.hint--lead {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--text);
}
.hint--status {
  margin: 12px 0 0;
  min-height: 1.4em;
  font-size: 11px;
  color: var(--text-mute);
}
.ai-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}
.ai-grid:empty { margin-top: 0; }
.ai-card {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--text);
  padding: 6px;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.15s ease, transform 0.05s ease;
}
.ai-card:hover {
  border-color: var(--at-red);
}
.ai-card.is-active {
  border-color: var(--at-red);
  box-shadow: 0 0 0 1px var(--at-red) inset;
}
.ai-card:active { transform: translateY(1px); }
.ai-card__thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: block;
  border-radius: 3px;
}
.ai-card__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 2px 2px;
}
.ai-card__title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.ai-card__sub {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--at-red);
  text-transform: uppercase;
}
.ai-card__reason {
  font-size: 10px;
  line-height: 1.35;
  color: var(--text-mute);
  margin-top: 2px;
}

/* ---------- Order form ---------- */
.panel__section--order {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.25) 0%, transparent 100%);
}
.badge--neutral {
  color: var(--text-mute);
  border-color: var(--line-strong);
}
.req {
  color: var(--at-red);
  font-weight: 700;
  margin-left: 2px;
}
.field__input {
  background: var(--bg);
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 9px 11px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
  width: 100%;
}
.field__input:focus { outline: none; border-color: var(--at-red); }
.field__input--mt { margin-top: 8px; }
textarea.field__input {
  resize: vertical;
  min-height: 64px;
  font-family: inherit;
}
.order-summary {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 16px;
  display: grid;
  gap: 6px;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
}
.summary-row__k {
  color: var(--text-mute);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 10px;
}
.summary-row__v {
  color: var(--text);
  font-weight: 600;
  text-align: right;
}
.summary-row__meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--at-red);
  margin-left: 6px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.order-form fieldset.field {
  border: 0;
  padding: 0;
  margin: 0 0 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.order-form fieldset.field legend {
  padding: 0;
}
.order-success {
  text-align: center;
  padding: 28px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.order-success__check {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--at-red);
  color: #fff;
  font-size: 28px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.order-success__title {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.04em;
}
.order-success__detail {
  margin: 0;
  font-size: 13px;
  color: var(--text-mute);
  line-height: 1.5;
  max-width: 280px;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--at-red);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: none;
  max-width: 90vw;
  text-align: center;
  line-height: 1.4;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
}
.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Scrollbar ---------- */
.panel::-webkit-scrollbar { width: 8px; }
.panel::-webkit-scrollbar-track { background: transparent; }
.panel::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 4px;
}
.panel::-webkit-scrollbar-thumb:hover { background: #4a4a4a; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(55vh, 1fr) auto;
  }
  .panel {
    border-left: 0;
    border-top: 1px solid var(--line);
    max-height: 45vh;
  }
  .topbar { padding: 10px 14px; gap: 10px; }
  .topnav { display: none; }
  .topactions .btn { padding: 8px 10px; font-size: 11px; letter-spacing: 0.08em; }
  .brand__wordmark-img { height: 22px; }
}
@media (max-width: 480px) {
  .swatches { grid-template-columns: repeat(7, 1fr); }
  .swatches--sm { grid-template-columns: repeat(8, 1fr); }
}
