/* ============================================================
   Storefront — public retail theme (T-023 B)
   Landing, category browse, item detail, cart.
   T-020 theme: same IntuitiveTill dark tokens as the staff
   register (css/style.css); no staff nav on public pages.
   Hero depth + hover polish from t-storefront-cosmetic remapped
   onto these tokens (cream/wood/brass discarded).
   ============================================================ */

:root {
  /* IntuitiveTill palette — same tokens as css/style.css. */
  --bg: #0f1419;
  --surface: #1a2332;
  --surface-2: #212d3d;
  --text: #e8eef7;
  --muted: #8b9aaf;
  --accent: #3d9cfd;
  --accent-dim: rgba(61, 156, 253, 0.15);
  --green: #34d399;
  --green-dim: rgba(52, 211, 153, 0.15);
  --amber: #fbbf24;
  --amber-dim: rgba(251, 191, 36, 0.15);
  --qty-orange: #f97316;
  --qty-orange-ring: rgba(249, 115, 22, 0.45);
  --addon-gold: #f5d76e;
  --addon-gold-dim: rgba(245, 215, 110, 0.14);
  --purple: #a78bfa;
  --purple-dim: rgba(167, 139, 250, 0.15);
  --red: #f87171;
  --red-dim: rgba(248, 113, 113, 0.15);
  --border: rgba(255, 255, 255, 0.07);
  --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Aliases so existing sf-* selectors keep working (T-020). */
  --sf-ink: var(--text);
  --sf-ink-soft: var(--muted);
  --sf-paper: var(--bg);
  --sf-card: var(--surface);
  --sf-line: var(--border);
  --sf-accent: var(--accent);
  --sf-accent-deep: #2f86e0;
  --sf-accent-soft: var(--accent-dim);
  --sf-green: var(--green);
  --sf-green-soft: var(--green-dim);
  --sf-radius: var(--radius);
  --sf-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  --sf-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: var(--surface-2) transparent; }

html { color-scheme: dark; }

body.sf-body {
  margin: 0;
  background:
    radial-gradient(1100px 460px at 50% -140px, var(--accent-dim), transparent 70%),
    var(--sf-paper);
  background-attachment: fixed;
  color: var(--sf-ink);
  font-family: var(--sf-sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent-dim); }

.sf-container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* ---------- header ---------- */

.sf-header {
  background: var(--sf-card); /* spec top bar: --surface, not a second navy */
  color: var(--sf-ink);
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--sf-line);
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
}

.sf-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  max-width: 1120px;
  margin: 0 auto;
}

.sf-brand { display: flex; align-items: baseline; gap: 12px; text-decoration: none; color: inherit; }

/* Wordmark: store name in --text, tag word in --accent. */
.sf-brand-name { font-weight: 700; font-size: 1.45rem; letter-spacing: .01em; color: var(--sf-ink); }

.sf-brand-tag {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--sf-accent);
}

.sf-cart-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--sf-accent);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: .92rem;
  padding: 9px 16px;
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .20);
  transition: background .15s ease, transform .15s ease;
}

.sf-cart-link:hover { background: var(--sf-accent-deep); transform: translateY(-1px); }

.sf-cart-count {
  background: #fff;
  color: var(--sf-accent-deep);
  border-radius: 999px;
  min-width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  padding: 0 6px;
}

/* ---------- hero ---------- */

@keyframes sf-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.sf-hero {
  position: relative;
  background:
    linear-gradient(rgba(15, 20, 25, .62), rgba(15, 20, 25, .78) 55%, rgba(15, 20, 25, .88)),
    radial-gradient(120% 80% at 50% 0%, var(--accent-dim), transparent 60%),
    var(--sf-hero-img, none),
    var(--surface);
  background-size: cover, cover, cover, auto;
  background-position: center, center, center, center;
  color: var(--text);
  padding: 84px 0 72px;
}

/* soft fade where the hero meets the page below */
.sf-hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 26px;
  background: linear-gradient(rgba(15, 20, 25, 0), var(--bg));
  pointer-events: none;
}

.sf-hero .sf-container { position: relative; z-index: 1; animation: sf-rise .5s ease-out both; }

.sf-hero h1 {
  font-size: clamp(2.1rem, 5.2vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 14px;
  max-width: 18ch;
  line-height: 1.12;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .45);
}

.sf-hero h1::after {
  content: "";
  display: block;
  width: 52px;
  height: 3px;
  margin: 14px 0 0;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
}

.sf-hero-intro {
  font-size: 1.08rem;
  max-width: 58ch;
  color: var(--muted);
  white-space: pre-line;
  margin: 0 0 28px;
}

.sf-hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.sf-btn {
  display: inline-block;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius);
  padding: 11px 22px;
  transition: background .15s ease, transform .1s ease;
}

.sf-btn:active { transform: scale(0.97); }

.sf-btn-primary { background: var(--sf-accent); color: #fff; }
.sf-btn-primary:hover { background: var(--sf-accent-deep); transform: translateY(-1px); }

.sf-btn-ghost {
  background: transparent;
  color: var(--text);
  box-shadow: inset 0 0 0 1.5px rgba(232, 238, 247, .35);
}

.sf-btn-ghost:hover { background: rgba(255, 255, 255, .08); }

/* ---------- sections ---------- */

.sf-section { padding: 44px 0 8px; }
.sf-section-title { font-size: 1.5rem; font-weight: 700; margin: 0 0 18px; }
.sf-section-title::before {
  content: "";
  display: block;
  width: 46px;
  height: 3px;
  margin-bottom: 12px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
}

.sf-notice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

.sf-notice-card {
  background: var(--sf-card);
  border: 1px solid var(--sf-line);
  border-top: 3px solid var(--sf-accent);
  border-radius: var(--sf-radius);
  padding: 20px 22px;
  box-shadow: var(--sf-shadow);
}

.sf-notice-card h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--sf-accent);
}

.sf-notice-card p { margin: 0; white-space: pre-line; color: var(--sf-ink-soft); }

/* category cards */

.sf-cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.sf-cat-card {
  background: var(--sf-card);
  border: 1px solid var(--sf-line);
  border-radius: var(--sf-radius);
  padding: 18px 16px;
  text-align: center;
  text-decoration: none;
  color: var(--sf-ink);
  box-shadow: var(--sf-shadow);
  transition: transform .12s ease, border-color .12s ease, background-color .12s ease, box-shadow .12s ease;
}

.sf-cat-card:hover {
  transform: translateY(-2px);
  border-color: var(--sf-accent);
  background: var(--surface-2);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .35);
}
.sf-cat-card:active { transform: scale(0.97); }

.sf-cat-name { font-weight: 600; font-size: 1.02rem; display: block; margin-bottom: 4px; }

.sf-cat-count {
  font-size: .78rem;
  color: var(--sf-ink-soft);
  text-transform: uppercase;
  letter-spacing: .08em;
}

/* featured rail + browse grid + item cards */

.sf-rail {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  grid-template-rows: repeat(2, auto);
  overflow: hidden;
  gap: 18px;
  padding-bottom: 8px;
}

.sf-item-card {
  background: var(--sf-card);
  border: 1px solid var(--sf-line);
  border-radius: var(--sf-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--sf-shadow);
  transition: transform .15s ease, box-shadow .15s ease;
}

.sf-item-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, .4);
}

.sf-item-media {
  aspect-ratio: 1 / 1;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.sf-item-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
.sf-item-card:hover .sf-item-media img { transform: scale(1.05); }

.sf-item-placeholder { font-size: 2.4rem; color: var(--muted); }

.sf-item-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.sf-item-name { font-size: 1rem; font-weight: 600; margin: 0; line-height: 1.3; }
.sf-item-name a { color: inherit; text-decoration: none; }
.sf-item-name a:hover { color: var(--sf-accent); }
.sf-item-booth { font-size: .78rem; color: var(--sf-ink-soft); margin: 0; }
.sf-item-price { font-weight: 800; margin: 2px 0 0; color: var(--sf-accent); font-variant-numeric: tabular-nums; }
.sf-spacer { flex: 1; }

.sf-badge {
  display: inline-block;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 3px 10px;
  margin-top: 4px;
  width: fit-content;
}

.sf-badge--ships { background: var(--sf-green-soft); color: var(--sf-green); }
.sf-badge--pickup { background: var(--sf-accent-soft); color: var(--sf-accent); }

.sf-item-actions { margin-top: 10px; }
.sf-item-actions form { margin: 0; }
.sf-item-actions .sf-btn { width: 100%; text-align: center; }

/* gallery strip */

.sf-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.sf-gallery img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 12px;
  display: block;
  box-shadow: var(--sf-shadow);
  cursor: zoom-in;
  transition: transform .3s ease, box-shadow .3s ease;
}

.sf-gallery img:hover {
  transform: scale(1.03);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .45), 0 0 0 2px var(--accent-dim);
}

/* lightbox overlay — click any gallery image to enlarge; close on click or Esc */
.sf-lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(2, 6, 12, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.sf-lightbox-overlay[hidden] { display: none; }

.sf-lightbox-img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  cursor: zoom-out;
}

.sf-lightbox-close {
  position: absolute;
  top: 16px;
  right: 22px;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}

.sf-lightbox-close:hover { color: var(--sf-accent); }

/* ---------- browse ---------- */

.sf-browse-head { padding-top: 34px; }
.sf-browse-title { font-size: 1.8rem; font-weight: 700; margin: 0 0 4px; }
.sf-browse-sub { color: var(--sf-ink-soft); margin: 0; }

.sf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  padding: 24px 0 40px;
}

/* item detail */

.sf-detail {
  display: grid;
  grid-template-columns: minmax(0, 460px) 1fr;
  gap: 36px;
  padding: 36px 0 56px;
}

.sf-detail-media {
  background: var(--surface-2);
  border: 1px solid var(--sf-line);
  border-radius: var(--sf-radius);
  overflow: hidden;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--sf-shadow);
}

.sf-detail-media img { width: 100%; height: 100%; object-fit: cover; }

.sf-detail h1 { font-size: 1.9rem; font-weight: 700; margin: 0 0 6px; }
.sf-detail-price { font-size: 1.5rem; font-weight: 800; margin: 10px 0 4px; color: var(--sf-accent); font-variant-numeric: tabular-nums; }
.sf-detail-booth { color: var(--sf-ink-soft); margin: 0 0 16px; }
.sf-detail-desc { white-space: pre-line; margin: 0 0 22px; }
.sf-detail-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.sf-detail-actions { max-width: 320px; }
.sf-detail-actions .sf-btn { width: 100%; text-align: center; }

/* cart */

.sf-cart-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 28px;
  padding: 36px 0 56px;
  align-items: start;
}

.sf-cart-lines {
  background: var(--sf-card);
  border: 1px solid var(--sf-line);
  border-radius: var(--sf-radius);
  box-shadow: var(--sf-shadow);
  overflow: hidden;
}

.sf-cart-line {
  display: grid;
  grid-template-columns: 72px 1fr auto auto;
  gap: 16px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--sf-line);
}

.sf-cart-line:last-child { border-bottom: 0; }

.sf-cart-thumb {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  background: var(--surface-2);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sf-cart-thumb img { width: 100%; height: 100%; object-fit: cover; }

.sf-cart-name { font-weight: 600; margin: 0; }
.sf-cart-name a { color: inherit; text-decoration: none; }
.sf-cart-name a:hover { color: var(--sf-accent); }
.sf-cart-booth { font-size: .8rem; color: var(--sf-ink-soft); margin: 2px 0 0; }
.sf-cart-price { font-weight: 800; color: var(--sf-accent); font-variant-numeric: tabular-nums; }

.sf-remove-btn {
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 8px;
  transition: background .12s ease, color .12s ease;
}

.sf-remove-btn:hover { color: var(--red); background: var(--red-dim); }

.sf-summary {
  background: var(--sf-card);
  border: 1px solid var(--sf-line);
  border-radius: var(--sf-radius);
  padding: 20px 22px;
  box-shadow: var(--sf-shadow);
  position: sticky;
  top: 84px;
}

.sf-summary h2 { font-size: 1.15rem; font-weight: 700; margin: 0 0 12px; }

.sf-summary-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: .95rem; }

.sf-summary-total {
  border-top: 2px solid var(--sf-line);
  margin-top: 8px;
  padding-top: 12px;
  font-weight: 700;
  font-size: 1.05rem;
}

.sf-summary-note { font-size: .8rem; color: var(--sf-ink-soft); margin: 14px 0 16px; }

.sf-summary .sf-btn { width: 100%; text-align: center; }
.sf-summary-alt { text-align: center; margin: 12px 0 0; font-size: .88rem; }
.sf-summary-alt a { color: var(--sf-accent); }

.sf-empty { text-align: center; padding: 70px 20px 90px; }
.sf-empty p { color: var(--sf-ink-soft); }
.sf-empty a { color: var(--sf-accent); }

/* toast (public ?err= flashes) */

.sf-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: var(--surface);
  color: var(--red);
  border: 1px solid rgba(248, 113, 113, 0.3);
  padding: 10px 16px;
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  font-size: .9rem;
  font-weight: 600;
  z-index: 40;
}

/* footer */

.sf-footer {
  border-top: 1px solid var(--sf-line);
  margin-top: 30px;
  padding: 22px 0 34px;
  font-size: .82rem;
  color: var(--sf-ink-soft);
}

.sf-footer a { color: var(--sf-accent); }

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .sf-detail { grid-template-columns: 1fr; }
  .sf-cart-layout { grid-template-columns: 1fr; }
  .sf-summary { position: static; }
}

@media (max-width: 620px) {
  .sf-notice-grid { grid-template-columns: 1fr; }
  .sf-header-inner { flex-wrap: wrap; }
  .sf-hero { padding: 48px 0 44px; }
  .sf-cart-line { grid-template-columns: 56px 1fr auto; grid-template-rows: auto auto; }
  .sf-cart-thumb { width: 56px; height: 56px; }
  .sf-cart-price { grid-column: 2; }
}
