/* Craft-My-Cosplay.com - dark forge theme */
:root {
  --bg: #0d0b0a;
  --panel: #171311;
  --panel-2: #1f1a17;
  --line: #5b4630;
  --line-dim: #2c231b;
  --gold: #e3a54a;
  --gold-hi: #f6c873;
  --ember: #ff7a1f;
  --text: #e8e1d6;
  --muted: #a39887;
  --dim: #6f665a;
  --ok: #8fc48a;
  --warn: #f0b25a;
  --err: #ef7d6a;
  --serif: Cinzel, "Trajan Pro", Georgia, serif;
  --sans: Inter, system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(900px 500px at 50% 35%, rgba(255, 110, 30, 0.10), transparent 70%),
    repeating-linear-gradient(0deg, transparent 0 46px, rgba(0, 0, 0, 0.35) 46px 48px),
    repeating-linear-gradient(90deg, transparent 0 94px, rgba(0, 0, 0, 0.25) 94px 96px),
    linear-gradient(#141110, #0b0908);
  color: var(--text);
  font: 14px/1.45 var(--sans);
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 1em; height: 1em; flex: none; }
[hidden] { display: none !important; }

.site { max-width: 1400px; margin: 0 auto; padding: 16px 20px 24px; }

/* ------------------------------------------------------------------ frames */
.frame {
  position: relative;
  background: linear-gradient(180deg, rgba(36, 29, 24, 0.94), rgba(20, 16, 14, 0.96));
  border: 1px solid var(--line);
  box-shadow: inset 0 0 0 1px #000, inset 0 0 0 3px var(--line-dim), 0 10px 30px rgba(0, 0, 0, 0.55);
}
.frame::before, .frame::after {               /* small corner studs */
  content: ""; position: absolute; width: 6px; height: 6px; top: -4px;
  background: var(--line); transform: rotate(45deg);
}
.frame::before { left: -4px; }
.frame::after { right: -4px; }

h2 {
  font-family: var(--serif); font-weight: 600; font-size: 15px;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--gold); margin: 0;
}

/* ------------------------------------------------------------------ header */
.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "brand nav" "brand design" "cats design";
  gap: 10px 20px;
  padding: 20px 22px 0;
  border: 1px solid var(--line);
  box-shadow: inset 0 0 0 1px #000, inset 0 0 0 3px var(--line-dim);
  /* drop your own artwork into assets/hero.jpg - the gradients are the fallback */
  background:
    linear-gradient(90deg, rgba(10, 8, 7, 0.92) 0%, rgba(10, 8, 7, 0.35) 45%, rgba(10, 8, 7, 0.8) 100%),
    url("../assets/hero.jpg") center / cover no-repeat,
    radial-gradient(500px 220px at 58% 85%, rgba(255, 120, 40, 0.35), transparent 70%),
    radial-gradient(260px 140px at 72% 70%, rgba(255, 170, 60, 0.18), transparent 70%),
    linear-gradient(#1c1612, #0f0c0a);
}
.brand { grid-area: brand; align-self: start; }
.logo {
  display: inline-block;
  font-family: var(--serif); font-weight: 800; font-size: clamp(28px, 4.2vw, 50px);
  letter-spacing: 0.01em; line-height: 1.05; text-decoration: none; font-variant: small-caps;
  background: linear-gradient(180deg, #f3ece0 0%, #b9ad9c 45%, #7b6f60 55%, #d9cfbf 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 #000) drop-shadow(0 0 12px rgba(0, 0, 0, 0.8));
}
.logo span { font-size: 0.8em; }
.motto {
  margin: 8px 0 0; padding-left: 4px;
  font-family: var(--serif); font-size: clamp(12px, 1.4vw, 16px); letter-spacing: 0.32em;
  text-transform: uppercase; color: var(--gold);
}

.nav { grid-area: nav; display: flex; gap: 6px; justify-self: end; }
.nav a, .nav button {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 6px 10px; background: none; border: 0; cursor: pointer; text-decoration: none;
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text);
  position: relative;
}
.nav svg { width: 24px; height: 24px; color: var(--gold); }
.nav a:hover, .nav button:hover { color: var(--gold-hi); }
.cart-link b {
  position: absolute; top: 0; right: 4px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: var(--ember); color: #1a0d03; font-size: 10px; line-height: 17px;
}

.your-design { grid-area: design; align-self: start; width: 260px; padding: 14px 16px 16px; margin-bottom: 10px; }
.your-design dl { margin: 10px 0 12px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.your-design dl div { display: flex; gap: 6px; margin: 3px 0; }
.your-design dt { color: var(--muted); }
.your-design dd { margin: 0; }

.cats { grid-area: cats; align-self: end; margin: 0 -22px; }
.cat-main { display: flex; gap: 0; padding-left: 58px; }
.cat-main button, .cat-sub button {
  background: none; border: 0; cursor: pointer; font-family: var(--serif); text-transform: uppercase;
}
.cat-main button {
  padding: 12px 34px; font-size: 18px; font-weight: 600; letter-spacing: 0.05em; color: var(--muted);
  border: 1px solid var(--line); border-bottom: 0; background: linear-gradient(#211a15, #15110e);
}
.cat-main button[aria-selected="true"] {
  color: var(--text); border-color: var(--gold);
  background: linear-gradient(#3a2716, #1c140e);
  box-shadow: inset 0 -3px 0 var(--gold), inset 0 0 18px rgba(255, 140, 40, 0.18);
}
.cat-sub {
  display: flex; gap: 6px; padding: 8px 22px 8px 48px;
  border-top: 1px solid var(--line); background: rgba(10, 8, 7, 0.85);
}
.cat-sub button { padding: 6px 24px; font-size: 13px; letter-spacing: 0.08em; color: var(--muted); border: 1px solid transparent; }
.cat-sub button[aria-selected="true"] { color: var(--gold-hi); border-color: var(--gold); background: rgba(227, 165, 74, 0.08); }
.cat-main button:hover, .cat-sub button:hover { color: var(--text); }

/* ------------------------------------------------------------------ builder layout */
.builder {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr) 270px;
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

/* steps (left) */
.steps { padding: 6px 10px 10px; }
.step { padding: 14px 4px 14px; border-bottom: 1px solid var(--line-dim); }
.step:last-child { border-bottom: 0; }
.step-head { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.badge {
  width: 30px; height: 30px; flex: none; display: grid; place-items: center;
  border: 1px solid var(--gold); transform: rotate(45deg); margin: 0 4px;
  background: linear-gradient(135deg, #2c2016, #120d09);
}
.badge span { transform: rotate(-45deg); font-family: var(--serif); font-weight: 700; color: var(--gold-hi); }
.step-head p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }

.carousel { display: grid; grid-template-columns: 18px minmax(0, 1fr) 18px; gap: 6px; align-items: center; }
.arrow {
  background: none; border: 0; padding: 0; cursor: pointer; color: var(--line); height: 40px;
  display: grid; place-items: center;
}
.arrow svg { width: 18px; height: 18px; }
.arrow:hover { color: var(--gold); }
.strip {
  display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - 4 * 6px) / 5);
  gap: 6px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
}
.strip::-webkit-scrollbar { display: none; }

.card {
  scroll-snap-align: start;
  position: relative; aspect-ratio: 3 / 5; padding: 0; cursor: pointer;
  border: 1px solid #3b3026;
  background: radial-gradient(circle at 50% 40%, #2a2420, #0e0c0b 80%);
  display: flex; flex-direction: column;
}
.card img, .card .ph { flex: 1; min-height: 0; width: 100%; object-fit: contain; }
.card .ph { background: radial-gradient(circle, rgba(255,255,255,0.06), transparent 60%); animation: pulse 1.4s ease-in-out infinite; }
.card span {
  font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted);
  padding: 3px 2px 4px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card .price { position: absolute; top: 3px; right: 3px; font-size: 9px; color: var(--gold); }
.card:hover { border-color: #6d5940; }
.card[aria-checked="true"] {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold), 0 0 14px rgba(255, 150, 50, 0.35), inset 0 0 20px rgba(255, 140, 40, 0.12);
}
.card[aria-checked="true"] span { color: var(--gold-hi); }
.card:disabled { opacity: 0.35; cursor: not-allowed; }
@keyframes pulse { 50% { opacity: 0.4; } }

/* stage (centre) */
.stage {
  position: sticky; top: 12px;
  height: min(860px, calc(100vh - 24px)); min-height: 520px;
  border: 1px solid var(--line-dim);
  background:
    radial-gradient(60% 30% at 50% 92%, rgba(255, 110, 30, 0.28), transparent 70%),
    radial-gradient(40% 45% at 50% 45%, rgba(255, 190, 120, 0.06), transparent 70%),
    repeating-linear-gradient(0deg, transparent 0 38px, rgba(0, 0, 0, 0.4) 38px 40px),
    repeating-linear-gradient(90deg, transparent 0 78px, rgba(0, 0, 0, 0.3) 78px 80px),
    linear-gradient(#1b1512, #0c0a09);
  overflow: hidden;
}
.stage::after {   /* vignette */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 120px 40px rgba(0, 0, 0, 0.85);
}
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#view:active { cursor: grabbing; }
.stage-top {
  position: absolute; z-index: 1; top: 12px; left: 14px; right: 14px;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap;
  pointer-events: none;
}
.combo { font-family: var(--serif); font-size: 15px; color: var(--gold-hi); text-shadow: 0 1px 4px #000; }
.stage-tools { display: flex; gap: 6px; pointer-events: auto; }
.chip {
  padding: 5px 10px; font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; cursor: pointer;
  background: rgba(15, 12, 10, 0.75); border: 1px solid var(--line); color: var(--muted);
}
.chip:hover { color: var(--gold-hi); border-color: var(--gold); }
.drag-hint {
  position: absolute; z-index: 1; bottom: 14px; left: 0; right: 0; margin: 0;
  display: flex; justify-content: center; align-items: center; gap: 6px;
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); pointer-events: none;
}
.loading {
  position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; padding: 24px; text-align: center;
  font-family: var(--serif); color: var(--gold); letter-spacing: 0.08em;
}

/* side (right) */
.side { display: grid; gap: 14px; }
.box { padding: 14px 14px 16px; }
.box-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.box-head p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.info { background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; height: 18px; }
.info svg { width: 16px; height: 16px; }
.info-text { font-size: 12px; color: var(--muted); margin: -4px 0 10px; }

.slider .scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.slider .scale span:nth-child(2) { color: var(--text); }
input[type="range"] { width: 100%; margin: 8px 0 10px; accent-color: var(--gold); }
.num { display: flex; justify-content: center; align-items: center; gap: 10px; color: var(--muted); }
.num input {
  width: 80px; padding: 6px; text-align: center; background: #0c0a09; border: 1px solid var(--line); color: var(--text);
}
.field + .field { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-dim); }
.field-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.auto { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); cursor: pointer; }
.auto input { accent-color: var(--gold); margin: 0; }
.field input[type="range"] { margin: 8px 0 8px; }
.dims { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 16px; margin: 14px 0 0; font-size: 12px; }
.dims div { display: flex; gap: 5px; }
.dims dt { color: var(--muted); }
.dims dd { margin: 0; }
.note { margin: 10px 0 0; font-size: 12px; color: var(--muted); }
.note.ok { color: var(--ok); }
.note.warn { color: var(--warn); }

.outputs { display: grid; gap: 10px; }
.opt {
  display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center; text-align: left;
  padding: 12px; cursor: pointer; background: rgba(10, 8, 7, 0.6); border: 1px solid #3b3026;
}
.opt svg { width: 26px; height: 26px; color: var(--muted); }
.opt b { display: block; font-family: var(--serif); font-weight: 600; font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; }
.opt small { font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.opt .p { font-size: 13px; }
.opt[aria-checked="true"] { border-color: var(--gold); box-shadow: 0 0 12px rgba(255, 150, 50, 0.25), inset 0 0 18px rgba(255, 140, 40, 0.08); }
.opt[aria-checked="true"] svg { color: var(--gold); }
.opt:hover { border-color: #6d5940; }

.extras label { display: flex; align-items: center; gap: 10px; padding: 5px 0; cursor: pointer; font-size: 13px; }
.extras input { accent-color: var(--gold); width: 15px; height: 15px; margin: 0; }
.extras .p { margin-left: auto; color: var(--gold); }
.opt .p, .summary .p { color: var(--gold); }

.summary dl { margin: 0; font-size: 12px; }
.summary dl div { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; text-align: right; }
.total {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 12px 0; padding-top: 10px; border-top: 1px solid var(--line);
}
.total span { font-family: var(--serif); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gold); }
.total strong { font-size: 22px; color: var(--gold-hi); }

.btn {
  width: 100%; padding: 11px 14px; cursor: pointer;
  font-family: var(--serif); font-weight: 600; font-size: 14px; letter-spacing: 0.1em; text-transform: uppercase;
}
.btn:disabled { opacity: 0.5; cursor: progress; }
.btn-gold {
  color: #f7ead3; border: 1px solid #c58b3c;
  background: linear-gradient(#8a5a26, #5a3814);
  box-shadow: inset 0 1px 0 rgba(255, 220, 160, 0.35), 0 0 16px rgba(255, 140, 40, 0.18);
}
.btn-gold:hover:not(:disabled) { background: linear-gradient(#a06a2e, #6a4318); }
.btn-steel {
  color: var(--text); border: 1px solid #6c6660;
  background: linear-gradient(#4a4642, #2a2725);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.btn-steel:hover:not(:disabled) { background: linear-gradient(#57524d, #322e2b); }
.link-btn {
  display: block; margin: 8px auto 0; padding: 2px; background: none; border: 0; cursor: pointer;
  color: var(--muted); font-size: 12px; text-decoration: underline;
}
.link-btn:hover { color: var(--gold-hi); }
.status { margin: 10px 0 0; font-size: 12px; color: var(--muted); min-height: 1em; }
.status.error { color: var(--err); }

/* fit editor */
.fit fieldset { border: 1px solid var(--line-dim); margin: 0 0 10px; padding: 8px 10px; }
.fit legend { color: var(--gold); font-size: 12px; padding: 0 4px; }
.fit .f { display: grid; grid-template-columns: 82px 1fr; gap: 8px; align-items: center; margin: 4px 0; font-size: 12px; }
.fit .trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.fit input[type="number"] { width: 100%; padding: 3px 4px; background: #0c0a09; border: 1px solid var(--line-dim); }
.fit textarea { width: 100%; background: #0c0a09; border: 1px solid var(--line-dim); font: 11px/1.4 ui-monospace, monospace; margin-bottom: 8px; }
code { font-size: 0.95em; color: var(--gold-hi); }

/* ------------------------------------------------------------------ perks & footer */
.perks {
  display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 18px; padding: 16px 10px;
}
.perks div { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 4px 12px; }
.perks div + div { border-left: 1px solid var(--line-dim); }
.perks svg { width: 34px; height: 34px; color: var(--gold); }
.perks p { margin: 0; font-size: 12px; color: var(--muted); }
.perks b { display: block; font-family: var(--serif); font-weight: 600; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gold); }
.foot {
  text-align: center; padding: 18px 0 4px; font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--dim);
}

/* ------------------------------------------------------------------ drawers & toast */
.scrim { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.6); }
.drawer {
  position: fixed; z-index: 21; top: 0; right: 0; bottom: 0; width: min(380px, 100%);
  padding: 18px; display: flex; flex-direction: column; overflow-y: auto;
}
.drawer > header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.x { background: none; border: 0; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); }
.x:hover { color: var(--gold-hi); }
.list { list-style: none; margin: 0; padding: 0; flex: 1; }
.list li { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 0; border-bottom: 1px solid var(--line-dim); font-size: 13px; }
.list li small { grid-column: 1; color: var(--muted); font-size: 11px; }
.list li .acts { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.list li button { background: none; border: 0; padding: 0; cursor: pointer; color: var(--muted); font-size: 12px; text-decoration: underline; }
.list li button:hover { color: var(--gold-hi); }
.list .empty { display: block; color: var(--muted); border: 0; }
.toast {
  position: fixed; z-index: 30; left: 50%; bottom: 24px; transform: translateX(-50%);
  padding: 10px 18px; border: 1px solid var(--gold); background: #1c1511; color: var(--text);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6); font-size: 13px; max-width: calc(100% - 32px);
}

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1180px) {
  .builder { grid-template-columns: 300px minmax(0, 1fr); }
  .side { grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}
@media (max-width: 860px) {
  .site { padding: 10px 16px 20px; }
  .hero { grid-template-columns: 1fr; grid-template-areas: "brand" "nav" "design" "cats"; padding: 16px 16px 0; }
  .nav { justify-self: stretch; justify-content: space-between; }
  .nav a, .nav button { padding: 6px 4px; font-size: 10px; }
  .your-design { width: auto; }
  .cats { margin: 0 -16px; }
  .cat-main { padding-left: 16px; }
  .cat-main button { padding: 10px 20px; font-size: 15px; }
  .cat-sub { padding: 8px 16px; overflow-x: auto; }
  .cat-sub button { padding: 6px 12px; }
  .builder { grid-template-columns: minmax(0, 1fr); }
  .stage { position: relative; top: 0; height: 64vh; min-height: 420px; order: -1; }
  .side { grid-template-columns: minmax(0, 1fr); }
  .strip { grid-auto-columns: calc((100% - 3 * 6px) / 4); }
  .perks { grid-template-columns: repeat(2, 1fr); gap: 12px 0; }
  .perks div:nth-child(3) { border-left: 0; }
  .perks div { justify-content: flex-start; }
}

/* Fit editor (?fit): pinned as its own column on the right, so the preview stays in view while adjusting */
body.fit-mode { padding-right: 344px; }
body.fit-mode #fitPanel {
  position: fixed; top: 12px; right: 12px; bottom: 12px; width: 320px; margin: 0;
  overflow-y: auto; z-index: 40;
}
@media (max-width: 900px) {
  body.fit-mode { padding-right: 0; }
  body.fit-mode #fitPanel { position: static; width: auto; overflow: visible; }
}

/* Dragging the 3D view must never select text on the page */
.stage { -webkit-user-select: none; user-select: none; touch-action: none; }
body.dragging, body.dragging * { -webkit-user-select: none !important; user-select: none !important; cursor: grabbing !important; }
