/* Varsity Editorial DS — tokens from stitch_varsity_tee_studio/varsity_editorial/DESIGN.md */
:root {
  --surface: #faf9f4;
  --surface-white: #ffffff;
  --surface-container: #efeee9;
  --surface-container-low: #f5f4ef;
  --on-surface: #1b1c19;
  --on-surface-variant: #45464d;
  --outline: #76777d;
  --outline-variant: #c6c6cd;
  --navy: #131b2e;
  --burgundy: #a53936;
  --shadow-soft: 0 4px 20px rgba(19, 27, 46, 0.10);
  --radius: 0.5rem;
  --radius-lg: 1rem;
  --font-display: 'Libre Caslon Text', 'Noto Serif TC', serif;
  --font-ui: 'Hanken Grotesk', 'Noto Sans TC', sans-serif;
}

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

[hidden] { display: none !important; }

body {
  background: var(--surface);
  color: var(--on-surface);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 24px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 72px;
  background: var(--surface-white);
  box-shadow: var(--shadow-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}
.brand {
  display: flex;
  align-items: center;
}
.brand img { height: 40px; width: auto; display: block; }

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  border: none;
  cursor: pointer;
  border-radius: 9999px;
  padding: 10px 24px;
  transition: all 0.3s ease-in-out;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--navy);
  color: #fff;
}
.btn-primary:hover { background: #1f2a45; box-shadow: var(--shadow-soft); }
.btn-ghost {
  background: transparent;
  color: var(--navy);
  border: 2px solid var(--navy);
  border-radius: var(--radius);
  padding: 12px 24px;
}
.btn-ghost:hover { background: var(--surface-container-low); color: var(--burgundy); }
.btn-block { width: 100%; }

.icon-btn {
  width: 36px;
  height: 36px;
  flex: none;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius);
  background: var(--surface-white);
  color: var(--on-surface-variant);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { border-color: var(--navy); color: var(--navy); }
.icon-btn.danger:hover { border-color: var(--burgundy); color: var(--burgundy); }

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 40px 20px 8px;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: 34px;
  line-height: 44px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--navy);
  margin-bottom: 8px;
}
.hero p { color: var(--on-surface-variant); }

/* ---------- Workspace layout ---------- */
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(320px, 5fr);
  gap: 24px;
  width: 100%;
  max-width: 1200px;
  margin: 24px auto 64px;
  padding: 0 64px;
  align-items: start;
}

.preview-card {
  position: sticky;
  top: 96px;
  background: var(--surface-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 16px;
}
.preview-card.drag-over { outline: 2px dashed var(--navy); outline-offset: -8px; }
#preview-canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 896 / 1200;
  touch-action: none;
}

.inspector {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.panel {
  background: var(--surface-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 20px;
}

.label-caps {
  display: block;
  font-size: 12px;
  font-weight: 700;
  line-height: 16px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--on-surface-variant);
  margin-bottom: 14px;
}
.mini-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--on-surface-variant);
  white-space: nowrap;
}
.hint {
  font-size: 13px;
  line-height: 19px;
  color: var(--outline);
  margin-top: 10px;
}

/* ---------- Garment list ---------- */
.garment-list { display: flex; flex-direction: column; gap: 8px; }
.garment-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-left: 4px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-ui);
  transition: all 0.3s ease-in-out;
  width: 100%;
}
.garment-item:hover { background: var(--surface-container-low); }
.garment-item.active {
  background: var(--surface-container-low);
  border-left-color: var(--navy);
}
.garment-item svg { width: 28px; height: 28px; fill: var(--navy); flex: none; }
.garment-item .g-name { font-size: 15px; font-weight: 600; color: var(--on-surface); }
.garment-item .g-desc { font-size: 12px; color: var(--outline); }

/* ---------- View tabs ---------- */
.view-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.view-tab {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 9999px;
  border: 1px solid var(--outline-variant);
  background: var(--surface-white);
  color: var(--on-surface-variant);
  cursor: pointer;
  transition: all 0.3s ease-in-out;
}
.view-tab.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

/* ---------- Design row ---------- */
.design-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius);
  background: var(--surface-container-low);
}
.design-thumb {
  width: 44px;
  height: 44px;
  flex: none;
  object-fit: contain;
  border-radius: 0.25rem;
  background:
    conic-gradient(#e3e3de 90deg, #fff 90deg 180deg, #e3e3de 180deg 270deg, #fff 270deg) 0 0 / 12px 12px;
}
.design-name {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}
.slider-row input[type='range'] { flex: 1; accent-color: var(--navy); }
#scale-val { min-width: 44px; text-align: right; }

/* ---------- Swatches ---------- */
.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.swatch {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--outline-variant);
  cursor: pointer;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease;
}
.swatch:hover { transform: scale(1.08); }
.swatch.active { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--navy); }
.custom-color {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}
.custom-color input[type='color'] {
  width: 44px;
  height: 44px;
  border: 1px solid var(--outline-variant);
  border-radius: 50%;
  padding: 4px;
  background: var(--surface-white);
  cursor: pointer;
}

/* ---------- Footer ---------- */
footer {
  margin-top: auto;
  background: var(--surface-container);
  text-align: center;
  padding: 32px 20px;
}
footer .label-caps { margin-bottom: 6px; }
footer p { font-size: 13px; color: var(--on-surface-variant); opacity: 0.7; }
footer .powered-by { font-size: 11px; opacity: 0.45; margin-top: 8px; letter-spacing: 0.08em; }

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
    padding: 0 20px;
    margin-bottom: 40px;
  }
  .preview-card { position: static; }
  .hero { padding-top: 28px; }
  .hero h1 { font-size: 26px; line-height: 34px; }
  .topbar { padding: 0 20px; }
}
