/* maps.applesauce.chat — design tokens + components.
 * Vanilla CSS, dual theme via [data-theme]. Aligned with Applesauce design system.
 */

/* ---------- design tokens ---------- */
:root,
[data-theme="warm"] {
  --bg: #F2F0EB;
  --bg-subtle: #ECEAE4;
  --card-bg: rgba(255,255,255,0.55);
  --card-border: rgba(212,197,170,0.5);
  --card-shadow: 0 1px 2px rgba(42,33,24,0.04), 0 4px 16px rgba(42,33,24,0.06);
  --card-hover-shadow: 0 2px 6px rgba(42,33,24,0.08), 0 12px 32px rgba(42,33,24,0.10);

  --text: #2A2118;
  --text-muted: #6B5E4F;
  --text-dim: #A39686;

  --accent-primary: #1E40AF;     /* deep navy — maps brand */
  --accent-primary-soft: #DBEAFE;
  --accent-green: #15803D;
  --accent-red:   #B91C1C;
  --accent-gold:  #B45309;

  --border-subtle: rgba(42,33,24,0.10);
  --field-bg: rgba(255,255,255,0.7);
  --field-border: rgba(42,33,24,0.18);

  --noise-opacity: 0.04;
}

[data-theme="dark"] {
  --bg: #111117;
  --bg-subtle: #1a1a22;
  --card-bg: rgba(24,24,32,0.75);
  --card-border: rgba(255,255,255,0.06);
  --card-shadow: 0 2px 4px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.2);
  --card-hover-shadow: 0 4px 8px rgba(0,0,0,0.4), 0 8px 32px rgba(0,0,0,0.15);

  --text: #e4e4ec;
  --text-muted: #8e8e9e;
  --text-dim: #5a5a6a;

  --accent-primary: #60A5FA;
  --accent-primary-soft: rgba(96,165,250,0.14);
  --accent-green: #6EE7A0;
  --accent-red: #f87171;
  --accent-gold: #fbbf24;

  --border-subtle: rgba(255,255,255,0.08);
  --field-bg: rgba(255,255,255,0.04);
  --field-border: rgba(255,255,255,0.12);

  --noise-opacity: 0.03;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 0.95rem;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: 'DM Serif Display', 'Georgia', serif;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--text);
}

.mono { font-family: 'Space Mono', 'SF Mono', Menlo, monospace; }

/* ---------- noise overlay ---------- */
.noise {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: var(--noise-opacity);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/></filter><rect width='200' height='200' filter='url(%23n)' opacity='0.6'/></svg>");
  mix-blend-mode: multiply;
}
[data-theme="dark"] .noise { mix-blend-mode: screen; }

/* ---------- header / nav ---------- */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
}
.brand {
  display: inline-flex; align-items: baseline; gap: 8px;
  font-family: 'DM Serif Display', serif;
  color: var(--text);
  font-size: 1.5rem;
}
.brand:hover { text-decoration: none; }
.brand-mark { letter-spacing: -0.02em; }
.brand-tenant {
  font-family: 'Space Mono', monospace;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.site-nav { display: flex; align-items: center; gap: 16px; }
.nav-link, .nav-user {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.nav-user { font-family: 'Space Mono', monospace; }
.tenant-switch {
  background: var(--field-bg);
  border: 1px solid var(--field-border);
  color: var(--text);
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 0.8rem;
}
.logout-form { display: inline; margin: 0; }
.btn-link {
  background: none; border: none; color: var(--text-muted);
  font-size: 0.85rem; cursor: pointer; padding: 0;
  font-family: inherit;
}
.btn-link:hover { color: var(--accent-primary); }
.btn-link-danger { color: var(--accent-red); }
.btn-link-danger:hover { color: var(--accent-red); }
.theme-toggle {
  background: none; border: 1px solid var(--field-border);
  color: var(--text-muted);
  width: 32px; height: 32px; border-radius: 50%;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  transition: 0.2s cubic-bezier(.4,0,.2,1);
}
.theme-toggle:hover { color: var(--accent-primary); border-color: var(--accent-primary); }

/* ---------- main / footer ---------- */
.site-main { flex: 1; padding: 48px 32px; max-width: 1240px; margin: 0 auto; width: 100%; }
.site-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 32px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.75rem; color: var(--text-dim);
}
.footer-link { color: var(--text-muted); }

/* ---------- hero ---------- */
.hero { max-width: 720px; padding: 64px 0 32px; }
.hero-eyebrow {
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent-primary);
  margin: 0 0 16px;
}
.hero-title {
  font-size: 2.5rem;
  line-height: 1.05;
  margin-bottom: 20px;
}
.hero-lede {
  font-size: 1rem; color: var(--text-muted); max-width: 56ch;
  margin: 0 0 32px;
}
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 20px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: 0.2s cubic-bezier(.4,0,.2,1);
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(30,64,175,0.18);
}
.btn-primary:hover { box-shadow: 0 4px 14px rgba(30,64,175,0.30); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--field-border);
}
.btn-ghost:hover { background: var(--bg-subtle); }
.btn-danger {
  background: transparent;
  color: var(--accent-red);
  border-color: var(--accent-red);
}
.btn-danger:hover { background: var(--accent-red); color: #fff; }

/* ---------- glass card ---------- */
.glass-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ---------- auth ---------- */
.auth-shell {
  display: flex; align-items: center; justify-content: center;
  min-height: 60vh;
}
.auth-card { padding: 40px 36px; max-width: 460px; width: 100%; }
.auth-title { font-size: 1.75rem; margin: 4px 0 12px; }
.auth-lede { color: var(--text-muted); font-size: 0.9rem; margin: 0 0 24px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-submit { margin-top: 4px; }
.auth-msg {
  margin: 16px 0 0; min-height: 1.2em;
  font-size: 0.85rem; color: var(--text-muted);
}
.auth-msg-ok { color: var(--accent-green); }
.auth-msg-err { color: var(--accent-red); }

/* ---------- form fields ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-family: 'Space Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.field-input,
input.field-input,
select.field-input,
textarea.field-input {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--field-border);
  background: var(--field-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  transition: 0.15s ease;
  width: 100%;
}
.field-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-soft);
}
.field-hint { font-size: 0.7rem; color: var(--text-dim); }
.field-checkbox {
  flex-direction: row; align-items: center; gap: 8px;
}
.field-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.flex-1 { flex: 1; }

.form-grid { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
.form-grid > .field { grid-column: span 1; }
.form-grid > .field.flex-1 { grid-column: span 2; }
.form-grid > .field-row { grid-column: span 2; }
.form-grid > fieldset { grid-column: span 2; border: none; padding: 0; margin: 0; }
.form-grid > .form-actions { grid-column: span 2; }
.form-row {
  display: flex; gap: 16px; align-items: flex-end;
  flex-wrap: wrap;
}
.form-actions { display: flex; gap: 12px; align-items: center; }
.inline-form { display: inline; margin-left: 8px; }
.danger-form { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border-subtle); }

/* ---------- admin shell ---------- */
.admin-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 32px;
  align-items: start;
}
.admin-sidebar {
  position: sticky; top: 32px;
  padding: 20px 0;
}
.sidebar-heading {
  font-family: 'Space Mono', monospace;
  font-size: 0.7rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 12px;
}
.sidebar-tenant {
  display: flex; flex-direction: column;
  padding: 12px 14px;
  background: var(--bg-subtle);
  border-radius: 10px;
  margin-bottom: 12px;
}
.sidebar-tenant-label {
  font-family: 'Space Mono', monospace;
  font-size: 0.65rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-dim);
}
.sidebar-tenant-name {
  font-family: 'DM Serif Display', serif;
  font-size: 1.05rem;
  margin-top: 2px;
}
.sidebar-tenant-form { margin-bottom: 16px; }
.sidebar-tenant-select {
  width: 100%; padding: 8px;
  border: 1px solid var(--field-border);
  background: var(--field-bg); color: var(--text);
  border-radius: 8px; font-family: inherit; font-size: 0.85rem;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; }
.sidebar-link {
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: 0.15s ease;
}
.sidebar-link:hover {
  background: var(--bg-subtle);
  color: var(--text);
  text-decoration: none;
}
.sidebar-link-super {
  margin-top: 12px; padding-top: 14px;
  border-top: 1px dashed var(--border-subtle);
  color: var(--accent-primary);
}

.admin-content { min-width: 0; }
.admin-header { margin-bottom: 32px; }
.admin-header-row {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.admin-header-actions { display: flex; gap: 8px; }
.admin-h1 { font-size: 2rem; line-height: 1.1; margin: 4px 0 8px; }
.admin-subtle { color: var(--text-muted); font-size: 0.9rem; margin: 0; }
.link-inline { color: var(--accent-primary); }

/* ---------- panels ---------- */
.panel {
  padding: 28px 28px;
  border-radius: 16px;
  margin-bottom: 24px;
}
.panel-title {
  font-size: 1.25rem;
  margin: 0 0 20px;
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px;
}
.panel-counter { color: var(--text-muted); font-size: 0.8rem; }

/* ---------- metrics ---------- */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.metric-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 24px;
  text-decoration: none;
  color: inherit;
  transition: 0.2s cubic-bezier(.4,0,.2,1);
}
.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-hover-shadow);
  text-decoration: none;
}
.metric-label {
  font-family: 'Space Mono', monospace;
  font-size: 0.7rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-dim);
}
.metric-value {
  font-family: 'DM Serif Display', serif;
  font-size: 2.5rem;
  line-height: 1;
}
.quick-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- artwork grid ---------- */
.filter-bar {
  display: flex; gap: 12px;
  margin-bottom: 20px;
  align-items: center;
  flex-wrap: wrap;
}
.filter-bar .field-input { max-width: 280px; }

.bulk-toolbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  background: var(--accent-primary-soft);
  border-radius: 10px;
  margin-bottom: 16px;
}
.bulk-count {
  font-family: 'Space Mono', monospace;
  font-size: 0.8rem;
  color: var(--accent-primary);
}

.art-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.art-card {
  position: relative;
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px;
  border-radius: 12px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  cursor: pointer;
  transition: 0.2s cubic-bezier(.4,0,.2,1);
}
.art-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-hover-shadow);
}
.art-card-link {
  display: flex; flex-direction: column; gap: 6px;
  color: inherit; text-decoration: none;
}
.art-card-link:hover { text-decoration: none; }
.art-card-check {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  width: 18px; height: 18px; cursor: pointer;
}
.art-card-thumb {
  width: 100%; aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  background: var(--bg-subtle);
}
.art-card-thumb-empty {
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); font-size: 0.75rem;
}
.art-card-title {
  font-size: 0.85rem; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.art-card-meta {
  font-family: 'Space Mono', monospace;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ---------- upload dropzone ---------- */
.dropzone {
  border: 2px dashed var(--field-border);
  border-radius: 16px;
  padding: 48px 24px;
  text-align: center;
  margin-bottom: 24px;
  transition: 0.2s ease;
  cursor: pointer;
}
.dropzone.drag-active {
  border-color: var(--accent-primary);
  background: var(--accent-primary-soft);
}
.dropzone-title {
  font-family: 'DM Serif Display', serif;
  font-size: 1.5rem; margin: 0 0 6px;
}
.dropzone-sub { color: var(--text-muted); margin: 0; }

.upload-list { list-style: none; padding: 0; margin: 0 0 24px; display: flex; flex-direction: column; gap: 8px; }
.upload-item {
  display: grid;
  grid-template-columns: 1fr 80px;
  gap: 12px; align-items: center;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bg-subtle);
  font-size: 0.85rem;
}
.upload-item-name {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.upload-progress {
  width: 100%; height: 6px;
  background: var(--field-border);
  border-radius: 3px; overflow: hidden;
}
.upload-progress-bar {
  height: 100%; width: 0%;
  background: var(--accent-primary);
  transition: width 0.2s ease;
}
.upload-status { font-family: 'Space Mono', monospace; font-size: 0.75rem; text-align: right; }
.upload-status-ok  { color: var(--accent-green); }
.upload-status-err { color: var(--accent-red); }
.upload-warn { font-size: 0.75rem; color: var(--accent-gold); margin-top: 4px; grid-column: span 2; }

/* ---------- table ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  padding: 10px 12px; text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.85rem;
}
.table th {
  font-family: 'Space Mono', monospace;
  font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-muted);
}

/* ---------- tags ---------- */
.tag-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.tag-list-item {
  display: flex; align-items: center; gap: 16px;
  padding: 8px 12px; border-radius: 8px;
  background: var(--bg-subtle);
}
.tag-name { flex: 1; font-weight: 500; }
.tag-usage { color: var(--text-muted); font-size: 0.75rem; }

.tag-fieldset { border: none; padding: 0; margin: 0; }
.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--field-border);
  border-radius: 999px;
  background: var(--field-bg);
  cursor: pointer;
  font-size: 0.8rem;
  transition: 0.15s ease;
}
.tag-chip:has(input:checked) {
  background: var(--accent-primary-soft);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}
.tag-chip input { display: none; }
.tag-chip-kind {
  font-family: 'Space Mono', monospace;
  font-size: 0.65rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-dim);
}
.tag-chip:has(input:checked) .tag-chip-kind { color: var(--accent-primary); }

/* ---------- feed filters ---------- */
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 6px 6px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  border: 1px solid var(--field-border);
}
.filter-chip-include { background: var(--accent-primary-soft); border-color: var(--accent-primary); color: var(--accent-primary); }
.filter-chip-exclude { background: rgba(185,28,28,0.08); border-color: var(--accent-red); color: var(--accent-red); }
.filter-chip-mode {
  font-family: 'Space Mono', monospace;
  font-size: 0.65rem; letter-spacing: 0.12em; text-transform: uppercase;
}
.filter-chip-remove {
  background: none; border: none; cursor: pointer;
  color: inherit; font-size: 1rem; line-height: 1;
  width: 22px; height: 22px;
  border-radius: 50%;
}
.filter-chip-remove:hover { background: rgba(0,0,0,0.08); }
.empty-state-inline { color: var(--text-dim); font-size: 0.85rem; }

/* ---------- artwork edit grid ---------- */
.edit-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 24px;
  align-items: start;
}
.art-preview {
  width: 100%; border-radius: 12px;
  background: var(--bg-subtle);
}
.art-meta {
  margin-top: 12px; color: var(--text-muted); font-size: 0.8rem;
}

/* ---------- empty / dialog ---------- */
.empty-state {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  background: var(--bg-subtle);
  border-radius: 12px;
}
.dialog {
  border: none; padding: 0;
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  color: var(--text);
  backdrop-filter: blur(12px);
}
.dialog::backdrop { background: rgba(0,0,0,0.4); backdrop-filter: blur(4px); }
.dialog-form { padding: 28px; min-width: 360px; display: flex; flex-direction: column; gap: 16px; }
.dialog-title { font-size: 1.25rem; margin: 0; }
.dialog-sub { color: var(--text-muted); font-size: 0.85rem; margin: 0; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid > .field, .form-grid > .field.flex-1, .form-grid > .field-row,
  .form-grid > .form-actions { grid-column: span 1; }
  .field-row { grid-template-columns: 1fr; }
  .edit-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .site-main { padding: 24px 16px; }
  .site-header { padding: 12px 16px; }
  .hero-title { font-size: 2rem; }
}

/* ======================================================================
 * Storefront (/) — Phase 2
 * ====================================================================== */
.store-hero {
  max-width: 720px;
  padding: 56px 0 32px;
}
.store-eyebrow {
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent-primary);
  margin: 0 0 16px;
}
.store-title {
  font-size: 2.75rem;
  line-height: 1.05;
  margin-bottom: 20px;
}
.store-lede {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 56ch;
  margin: 0 0 28px;
}
.store-cta {
  display: flex; gap: 12px; flex-wrap: wrap;
}

.store-section-label {
  font-family: 'Space Mono', monospace;
  font-size: 0.7rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 12px;
}

.store-feed-bar {
  margin: 24px 0 28px;
}

.store-chips {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.store-chip {
  display: inline-flex; align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--field-border);
  background: var(--field-bg);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: 0.15s ease;
}
.store-chip:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}
.store-chip.is-active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}

.store-rail-section { margin-top: 16px; }
.store-rail-header {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
.store-rail-title {
  font-size: 1.5rem; margin: 0;
}
.store-rail-more {
  font-family: 'Space Mono', monospace;
  font-size: 0.8rem;
  color: var(--accent-primary);
}

.store-rail {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.store-rail.is-loading { opacity: 0.5; }
.store-tile {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px;
  border-radius: 12px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  text-decoration: none;
  color: var(--text);
  transition: 0.2s cubic-bezier(.4,0,.2,1);
}
.store-tile:hover {
  transform: translateY(-2px);
  text-decoration: none;
  box-shadow: var(--card-hover-shadow);
}
.store-tile-img {
  width: 100%; aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  background: var(--bg-subtle);
}
.store-tile-title {
  font-size: 0.85rem; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ======================================================================
 * Designer (/design) — Phase 2
 * ====================================================================== */
.designer {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  max-width: 1080px;
  margin: 0 auto;
}
.designer-canvas-wrap {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px;
}
.designer-canvas {
  position: relative;
  width: 100%;
  max-width: 560px;
  aspect-ratio: 800 / 900;
  border-radius: 16px;
  background: var(--bg-subtle);
  overflow: hidden;
  box-shadow: var(--card-shadow);

  /* Tint overlay: a colored block multiplied with the SVG mockup so
     arbitrary hex colors map cleanly onto the shirt body. */
  --shirt-tint: #E5E5E5;
  isolation: isolate;
}
.designer-canvas::before {
  /* The base color block */
  content: '';
  position: absolute; inset: 0;
  background: var(--shirt-tint);
  z-index: 0;
}
.designer-shirt {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  /* The mockup SVG is light grey — multiply against the tint block above
     gives us a fabric-like shaded version of any color. */
  mix-blend-mode: multiply;
  z-index: 1;
  pointer-events: none;
}
.designer-canvas.is-dark-shirt .designer-shirt {
  /* On dark shirts, multiply would crush the silhouette; switch to screen
     so the highlights still show. */
  mix-blend-mode: screen;
}
.designer-art {
  position: absolute;
  /* Print zone: SVG (240,240) -> (560,560) on an 800x900 viewBox.
     Convert to percentages of the box: x=30% y=26.67% w=40% h=35.56%. */
  left: 30%;
  top: 26.67%;
  width: 40%;
  height: 35.56%;
  object-fit: contain;
  mix-blend-mode: multiply;
  z-index: 2;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.designer-canvas.is-dark-shirt .designer-art {
  /* On dark shirts, switch to screen so the artwork stays visible. */
  mix-blend-mode: screen;
}
.designer-caption {
  font-family: 'Space Mono', monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 8px 0 0;
  text-align: center;
}

.designer-panel {
  display: flex; flex-direction: column;
  gap: 20px;
}
.designer-row { display: flex; flex-direction: column; gap: 8px; }
.designer-row-label {
  font-family: 'Space Mono', monospace;
  font-size: 0.7rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-dim);
  margin: 0;
}

/* swatches */
.swatch-row {
  display: flex; gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 8px;
  scrollbar-width: thin;
}
.swatch {
  flex: 0 0 auto;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 2px solid var(--field-border);
  background: transparent;
  padding: 0;
  cursor: pointer;
  position: relative;
  transition: 0.15s ease;
}
.swatch-dot {
  display: block;
  width: 100%; height: 100%;
  border-radius: 50%;
  background: var(--swatch-color, #ccc);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}
.swatch:hover { transform: translateY(-2px); }
.swatch.is-active {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-soft);
}

/* art rail (designer) */
.art-rail {
  display: flex; gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 8px;
  scrollbar-width: thin;
}
.art-rail.is-loading { opacity: 0.5; }
.art-tile {
  flex: 0 0 96px;
  display: flex; flex-direction: column; gap: 6px;
  padding: 6px;
  border-radius: 10px;
  border: 2px solid transparent;
  background: var(--card-bg);
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: 0.15s ease;
}
.art-tile img {
  width: 84px; height: 84px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--bg-subtle);
}
.art-tile-title {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 84px;
}
.art-tile:hover { transform: translateY(-2px); }
.art-tile.is-active {
  border-color: var(--accent-primary);
}
.art-tile.is-active .art-tile-title { color: var(--accent-primary); }

/* size pills */
.size-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.size-pill {
  min-width: 48px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--field-border);
  background: var(--field-bg);
  color: var(--text);
  font: inherit; font-size: 0.85rem;
  cursor: pointer;
  transition: 0.15s ease;
}
.size-pill:hover { border-color: var(--accent-primary); color: var(--accent-primary); }
.size-pill.is-active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}

/* footer */
.designer-footer {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}
.designer-price {
  display: flex; flex-direction: column; gap: 2px;
}
.designer-price-amount {
  font-family: 'DM Serif Display', serif;
  font-size: 1.75rem;
  line-height: 1;
}
.designer-price-meta {
  font-family: 'Space Mono', monospace;
  font-size: 0.7rem;
  color: var(--text-muted);
}
.designer-order {
  min-width: 140px;
}
.designer-order:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.designer-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 4px 0 0;
}

.checkout-msg {
  font-size: 0.85rem;
  color: var(--text-muted);
  min-height: 1.2em;
  margin: 0;
}
.checkout-msg.is-err { color: var(--accent-red); }

/* desktop layout */
@media (min-width: 900px) {
  .designer {
    grid-template-columns: minmax(360px, 1fr) minmax(360px, 1fr);
    align-items: start;
    gap: 48px;
  }
  .designer-canvas-wrap {
    position: sticky;
    top: 32px;
  }
  .designer-canvas { max-width: 100%; }
}

/* mobile tightening */
@media (max-width: 600px) {
  .store-title { font-size: 2.25rem; }
  .designer { gap: 20px; }
  .designer-price-amount { font-size: 1.5rem; }
}

/* ======================================================================
 * Order success / cancelled
 * ====================================================================== */
.order-confirm { max-width: 720px; padding: 56px 0 32px; }
.order-summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  padding: 24px;
  margin: 24px 0;
}
.order-preview {
  width: 100%;
  border-radius: 12px;
  background: var(--bg-subtle);
}
.order-summary-fields p {
  margin: 0 0 12px;
  font-size: 0.9rem;
  line-height: 1.55;
}
.order-summary-fields p:last-child { margin-bottom: 0; }
.order-summary-fields .field-label {
  display: inline-block;
  margin-right: 8px;
  min-width: 70px;
}
@media (min-width: 700px) {
  .order-summary { grid-template-columns: 320px 1fr; align-items: start; }
}

/* ───────────── interactive LA map (/map) ───────────── */
.map-page {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}
.map-page-header {
  text-align: center;
  margin-bottom: 16px;
}
.map-title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.map-sub {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.map-stage {
  position: relative;
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 297 / 210;
  max-height: 70vh;
  box-shadow: 0 10px 30px rgba(15,23,42,0.06);
}
.map-svg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.map-svg-el {
  width: 100%;
  height: 100%;
  display: block;
}
.map-svg-el path {
  fill: var(--surface);
  stroke: var(--border);
  stroke-width: 0.4;
  transition: fill 120ms ease, stroke 120ms ease;
}
.map-svg-el path.map-path-inactive {
  fill: var(--surface-2);
  stroke: var(--border);
  pointer-events: none;
  opacity: 0.55;
}
.map-svg-el path.map-path-active {
  fill: var(--accent-primary-soft);
  stroke: var(--accent-primary);
  stroke-width: 0.5;
  cursor: pointer;
}
.map-svg-el path.map-path-active:hover,
.map-svg-el path.map-path-active:focus {
  fill: var(--accent-primary);
  stroke: var(--accent-primary);
  outline: none;
}

.map-label {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  background: var(--ink);
  color: var(--surface);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-body);
  display: flex;
  flex-direction: column;
  gap: 1px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
  z-index: 5;
  white-space: nowrap;
  transition: transform 60ms linear;
}
.map-label-cta {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--accent-primary-soft);
  letter-spacing: 0.02em;
}

.map-hint {
  text-align: center;
  margin: 14px 0 8px;
  color: var(--ink-soft);
  font-size: 0.9rem;
}
.map-hint strong {
  color: var(--ink);
  font-weight: 600;
}

.map-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

@media (hover: none) {
  .map-svg-el path.map-path-active {
    fill: var(--accent-primary-soft);
  }
  .map-label-cta { display: none; }
}
