/* Mule Town Comics / Mule Town Comic Expo -- shared design system.
   Two related-but-distinct themes driven by a class on <body>:
   theme-shop (energetic, red/orange) and theme-expo (festival, gold/red). */

:root {
  --ink: #18120d;
  --ink-soft: #3a3027;
  --cream: #f3ecdc;
  --paper: #fffbf2;
  --line: rgba(24, 18, 13, 0.14);
  --accent: #cf3a24;
  --accent-ink: #ffffff;
  --accent-2: #e98a24;
  --success: #276b3f;
  --error: #a9281a;
  --radius: 10px;
  --shadow-offset: 6px;
  --font: ui-sans-serif, system-ui, "Segoe UI", Helvetica, Arial, sans-serif;
  --container: 1180px;
}

body.theme-expo {
  --cream: #efe6c9;
  --paper: #fffdf4;
  --accent: #e7b400;
  --accent-ink: #18120d;
  --accent-2: #cf3a24;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  background-image:
    radial-gradient(var(--line) 1px, transparent 1px);
  background-size: 14px 14px;
}

img { max-width: 100%; display: block; }
a { color: inherit; }
.visually-hidden {
  position: absolute !important;
  left: -9999px !important;
  top: auto;
  width: 1px; height: 1px;
  overflow: hidden;
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}
.container-narrow { max-width: 440px; }

/* ---------- Skip link / focus ---------- */
.skip-link {
  position: absolute;
  left: 8px;
  top: -48px;
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 8px 8px;
  z-index: 200;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 0; }

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

/* ---------- Topbar + nav ---------- */
.topbar {
  background: var(--ink);
  color: #f3ecdc;
  font-size: 0.82rem;
  padding: 7px 0;
}
.topbar .container { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.topbar a { text-decoration: none; }
.topbar a:hover { text-decoration: underline; }

.site-nav {
  background: var(--paper);
  border-bottom: 3px solid var(--ink);
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  padding-bottom: 10px;
  gap: 18px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 900;
  letter-spacing: -0.01em;
}
.brand img { height: 42px; width: 42px; border-radius: 50%; border: 2px solid var(--ink); }
.brand-name { font-size: 1.15rem; line-height: 1.1; }
.brand-sub { display: block; font-size: 0.62rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft); font-weight: 700; }

.nav-links { display: none; gap: 4px; align-items: center; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  display: inline-block;
  padding: 10px 14px;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.92rem;
  border-radius: 999px;
}
.nav-links a:hover, .nav-links a.active { background: var(--accent); color: var(--accent-ink); }

.nav-cta { display: none; }
.nav-toggle {
  border: 2px solid var(--ink);
  background: var(--paper);
  border-radius: 8px;
  padding: 8px 10px;
  font-weight: 700;
  cursor: pointer;
}

.mobile-menu { display: none; border-bottom: 3px solid var(--ink); background: var(--paper); }
.mobile-menu.open { display: block; }
.mobile-menu ul { list-style: none; margin: 0; padding: 10px 20px 16px; display: flex; flex-direction: column; gap: 6px; }
.mobile-menu a { text-decoration: none; font-weight: 700; padding: 10px 4px; display: block; border-bottom: 1px solid var(--line); }

@media (min-width: 900px) {
  .nav-links { display: flex; }
  .nav-cta { display: inline-flex; }
  .nav-toggle { display: none; }
  .mobile-menu { display: none !important; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  text-decoration: none;
  padding: 13px 22px;
  border-radius: 999px;
  border: 3px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.95rem;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.btn:hover { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.btn:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--ink); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 8px 16px; font-size: 0.82rem; box-shadow: 3px 3px 0 var(--ink); }
.btn-block { width: 100%; justify-content: center; }
.btn[disabled], .btn.is-disabled {
  opacity: 0.55; cursor: not-allowed; box-shadow: 4px 4px 0 var(--line);
  border-color: var(--line); color: var(--ink-soft);
}
.btn-danger { background: var(--error); color: #fff; border-color: var(--ink); }

/* ---------- Type ---------- */
.eyebrow {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--accent);
  margin: 0 0 10px;
}
h1, h2, h3, h4 { font-weight: 900; letter-spacing: -0.01em; margin: 0 0 0.5em; }
h1 { font-size: clamp(2.3rem, 6vw, 4.4rem); line-height: 1; }
h2 { font-size: clamp(1.7rem, 4vw, 2.6rem); line-height: 1.05; }
h3 { font-size: 1.3rem; }
p { margin: 0 0 1em; }
.lede { font-size: 1.2rem; color: var(--ink-soft); max-width: 640px; }
.lede-center { margin-left: auto; margin-right: auto; margin-bottom: 24px; }
.justify-center { justify-content: center; }
.muted { color: var(--ink-soft); }
.text-center { text-align: center; }

/* ---------- Panels / comic cards ---------- */
.panel {
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-offset) var(--shadow-offset) 0 var(--ink);
  padding: 28px;
}
.panel-flat { border: 3px solid var(--ink); border-radius: var(--radius); background: var(--paper); padding: 24px; }

.section { padding: 56px 0; }
.section-dark { background: var(--ink); color: var(--cream); }
.section-accent { background: var(--accent); color: var(--accent-ink); }

.hero {
  padding: 48px 0 64px;
  position: relative;
  overflow: hidden;
}
.hero-grid {
  display: grid;
  gap: 32px;
  align-items: center;
}
@media (min-width: 900px) {
  .hero-grid { grid-template-columns: 1.1fr 0.9fr; }
}
.hero-art {
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 8px 8px 0 var(--ink);
  overflow: hidden;
  background: var(--paper);
}
.hero-art img { width: 100%; height: auto; }

.ghost-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.1;
  object-fit: cover;
  width: 100%;
  height: 100%;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--ink);
  color: var(--cream);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.badge-accent { background: var(--accent); color: var(--accent-ink); }
.badge-outline { background: transparent; border: 2px solid currentColor; }

/* ---------- Grids ---------- */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- Category / product cards ---------- */
.cat-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 5px 5px 0 var(--ink);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.cat-card:hover { transform: translate(-2px, -3px); box-shadow: 8px 9px 0 var(--ink); }
.cat-card .cat-icon {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
  font-weight: 900;
  font-size: 1.1rem;
}
.cat-card .cat-count { font-size: 0.8rem; color: var(--ink-soft); font-weight: 700; }

.product-card {
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 5px 5px 0 var(--ink);
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--ink);
}
.product-card .thumb {
  aspect-ratio: 1 / 1;
  background: var(--cream);
  border-bottom: 3px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.product-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-card .thumb .placeholder { font-weight: 800; color: var(--ink-soft); font-size: 0.8rem; text-align: center; padding: 10px; }
.product-card .body { padding: 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-card .price { font-weight: 900; font-size: 1.15rem; }
.price-lg { font-weight: 900; font-size: 1.6rem; }
.badge-error { background: var(--error); color: #fff; }
.thumb-select { border: 3px solid var(--ink); border-radius: var(--radius); padding: 0; overflow: hidden; cursor: pointer; background: var(--paper); aspect-ratio: 1/1; }
.thumb-select img { width: 100%; height: 100%; object-fit: cover; }
.product-card .cat-tag { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); font-weight: 800; }

/* ---------- Forms ---------- */
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 800; margin-bottom: 6px; font-size: 0.92rem; }
.field .hint { font-size: 0.8rem; color: var(--ink-soft); margin-top: 4px; }
.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="password"],
.field input[type="number"],
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
  font: inherit;
  color: var(--ink);
}
.field textarea { min-height: 120px; resize: vertical; }
.field-error input, .field-error select, .field-error textarea { border-color: var(--error); }
.field-error-msg { color: var(--error); font-size: 0.82rem; font-weight: 700; margin-top: 4px; }
.checkbox-row { display: flex; align-items: flex-start; gap: 10px; font-weight: 600; }
.checkbox-row input { margin-top: 4px; }
.checkbox-list { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; margin: 0; padding: 0; }
.checkbox-list li { background: var(--cream); border: 2px solid var(--ink); border-radius: 999px; padding: 8px 14px; }
.checkbox-list label { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.88rem; }
.hp-field { position: absolute; left: -9999px; top: -9999px; }
fieldset { border: none; margin: 0; padding: 0; }
legend { font-weight: 800; margin-bottom: 10px; padding: 0; font-size: 0.92rem; }

/* ---------- Flash messages ---------- */
.flash-list { list-style: none; margin: 16px 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.flash {
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 12px 16px;
  font-weight: 700;
}
.flash-success { background: #e3f0e6; }
.flash-error { background: #fbe3df; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.admin-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table.admin-table th, table.admin-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.admin-table th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); }
table.admin-table tr:hover td { background: rgba(0,0,0,0.02); }

.status-pill { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; border: 1.5px solid var(--ink); }
.status-draft, .status-pending { background: #f1e6c8; }
.status-active, .status-approved, .status-paid, .status-fulfilled, .status-received { background: #d9ecd9; }
.status-archived, .status-declined, .status-cancelled, .status-refunded { background: #ecdcd8; }
.status-payment_pending, .status-processing, .status-shipped { background: #dde6f2; }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: #e9e0cf; padding: 48px 0 28px; margin-top: 40px; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.footer-grid { display: grid; gap: 28px; grid-template-columns: 1fr; margin-bottom: 28px; }
@media (min-width: 760px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }
.footer-grid h4 { color: #fff; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.15); padding-top: 18px; font-size: 0.78rem; color: #b8ad92; display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; }
.footer-logo { height: 36px; opacity: 0.92; }

/* ---------- Misc ---------- */
.divider-torn {
  height: 18px;
  background: var(--cream);
  clip-path: polygon(0% 100%, 2% 0%, 5% 100%, 8% 10%, 12% 100%, 16% 0%, 20% 100%, 24% 15%, 28% 100%, 32% 5%, 36% 100%, 40% 20%, 44% 100%, 48% 0%, 52% 100%, 56% 10%, 60% 100%, 64% 0%, 68% 100%, 72% 15%, 76% 100%, 80% 5%, 84% 100%, 88% 20%, 92% 100%, 96% 0%, 100% 100%);
}
details.panel-flat summary { cursor: pointer; font-size: 1.02rem; }
details.panel-flat[open] summary { margin-bottom: 4px; }
.callout {
  border: 3px dashed var(--ink);
  border-radius: var(--radius);
  padding: 20px;
  background: rgba(255, 255, 255, 0.5);
}
.confirm-note { font-size: 0.82rem; color: var(--ink-soft); font-style: italic; }
.empty-state { text-align: center; padding: 48px 20px; }
.kv-list { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 0.92rem; }
.kv-list dt { font-weight: 800; color: var(--ink-soft); }
.kv-list dd { margin: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-end { align-items: flex-end; }
.cart-row-placeholder { width: 70px; height: 70px; border: 2px solid var(--ink); border-radius: 8px; background: var(--cream); }
.order-total-row { border-top: 2px solid var(--ink); padding-top: 10px; margin-top: 10px; }
.cluster { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.space-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-sm { margin-top: 16px; }
.mt-md { margin-top: 24px; }
.mt-lg { margin-top: 36px; }
.text-invert-muted { color: #e9e0cf; }

.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar { width: 230px; background: var(--ink); color: #e9e0cf; padding: 22px 16px; flex-shrink: 0; }
.admin-sidebar a { display: block; padding: 10px 12px; border-radius: 8px; color: inherit; text-decoration: none; font-weight: 700; font-size: 0.92rem; margin-bottom: 2px; }
.admin-sidebar .brand { color: inherit; padding: 4px; }
.avatar-sm { height: 32px; width: 32px; border-radius: 50%; }
.admin-sidebar a:hover, .admin-sidebar a.active { background: rgba(255,255,255,0.12); }
.admin-main { flex: 1; min-width: 0; padding: 28px 32px 60px; background: var(--cream); }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; gap: 12px; flex-wrap: wrap; }
@media (max-width: 760px) {
  .admin-shell { flex-direction: column; }
  .admin-sidebar { width: auto; display: flex; overflow-x: auto; gap: 4px; }
  .admin-sidebar a { white-space: nowrap; }
}
.stat-card { background: var(--paper); border: 3px solid var(--ink); border-radius: var(--radius); padding: 18px; box-shadow: 4px 4px 0 var(--ink); }
.stat-card .num { font-size: 2rem; font-weight: 900; line-height: 1; }
.stat-card .label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); font-weight: 700; }
.notice-banner { background: #fff3c4; border: 2px solid var(--ink); border-radius: 8px; padding: 14px 18px; margin-bottom: 20px; font-weight: 700; display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; align-items: center; }

.cart-row { display: grid; grid-template-columns: 70px 1fr auto; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.cart-row img { width: 70px; height: 70px; object-fit: cover; border-radius: 8px; border: 2px solid var(--ink); }
.qty-input { width: 64px; padding: 8px; border: 2px solid var(--ink); border-radius: 6px; font: inherit; }
.search-input { flex: 1; min-width: 200px; padding: 12px 14px; border: 2px solid var(--ink); border-radius: 8px; font: inherit; background: var(--paper); color: var(--ink); }

.cart-badge { background: var(--ink); color: #fff; border-radius: 999px; padding: 1px 7px; font-size: 0.75rem; }
.footer-tagline { color: #c9bfa0; max-width: 420px; margin-top: 14px; }
.preview-thumb { width: 72px; height: 72px; object-fit: cover; border: 2px solid var(--ink); border-radius: 8px; }
.image-preview-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
