:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --border: #e6e6e8;
  --text: #14171c;
  --muted: #6e7079;
  --accent: #14171c;        /* near-black primary — editorial, not toylike */
  --accent-hover: #34373d;
  --success: #1f9d55;       /* green used sparingly, e.g. free-shipping unlocked */
  --radius: 8px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

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

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
}
.logo {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.filters {
  display: flex;
  gap: 0.4rem;
  margin-left: auto;
  flex-wrap: wrap;
}
.filter-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s;
}
.filter-btn:hover { color: var(--text); border-color: var(--muted); }
.filter-btn.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }

.cart-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius);
  cursor: pointer;
}
.cart-icon { display: block; }
.cart-count {
  position: absolute;
  top: -7px;
  right: -7px;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  padding: 0 4px;
}

/* Layout */
.container { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
.hero { text-align: center; padding: 2.5rem 0 1.5rem; }
.hero h1 { font-size: 2.6rem; font-weight: 800; text-transform: uppercase; letter-spacing: -0.005em; }
.hero p { color: var(--muted); margin-top: 0.4rem; }

.toolbar {
  display: flex;
  gap: 0.75rem;
  margin: 1rem 0 1.75rem;
  flex-wrap: wrap;
}
.search, .sort {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
}
.search { flex: 1; min-width: 200px; }
.search::placeholder { color: var(--muted); }
.sort { cursor: pointer; }

/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--card-shadow);
  transition: transform 0.15s, box-shadow 0.15s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

.shirt {
  height: 200px;
  display: grid;
  place-items: center;
  position: relative;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.shirt svg { width: 130px; height: 130px; filter: drop-shadow(0 4px 10px rgba(0,0,0,0.12)); }
.badge {
  position: absolute;
  top: 0.7rem;
  left: 0.7rem;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}
.card-body { padding: 0.9rem 1rem 1.1rem; display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.card-team { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.card-name { font-weight: 700; font-size: 1rem; }
.card-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.price { font-weight: 800; font-size: 1.05rem; }
.size-select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 0.3rem 0.4rem;
  font-size: 0.8rem;
}
.add-btn {
  width: 100%;
  background: var(--accent);
  border: none;
  color: #fff;
  font-weight: 700;
  padding: 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.add-btn:hover { background: var(--accent-hover); }
.add-btn.added { background: var(--success); }

.empty-state { text-align: center; color: var(--muted); padding: 3rem 0; }

/* Cart drawer */
.drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 90;
}
.cart-drawer {
  position: fixed;
  top: 0; right: 0;
  height: 100%;
  width: min(380px, 100%);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow);
  z-index: 100;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
}
.cart-drawer.is-open { transform: translateX(0); }
.cart-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.cart-head h2 { font-size: 1.2rem; }
.close-btn { background: none; border: none; color: var(--muted); font-size: 1.2rem; cursor: pointer; }
.close-btn:hover { color: var(--text); }

.cart-items { flex: 1; overflow-y: auto; padding: 0.75rem 1.25rem; }
.cart-empty { color: var(--muted); text-align: center; padding: 2.5rem 0; }
.cart-row { display: flex; gap: 0.75rem; padding: 0.75rem 0; border-bottom: 1px solid var(--border); }
.cart-row .mini-shirt { width: 48px; height: 48px; flex-shrink: 0; }
.cart-row-info { flex: 1; min-width: 0; }
.cart-row-name { font-weight: 600; font-size: 0.9rem; }
.cart-row-meta { font-size: 0.78rem; color: var(--muted); }
.qty { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.3rem; }
.qty button {
  width: 24px; height: 24px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
}
.cart-row-price { font-weight: 700; white-space: nowrap; }

.cart-foot { padding: 1.1rem 1.25rem; border-top: 1px solid var(--border); }

.ship-nudge {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.85rem;
}
.ship-nudge.unlocked { background: rgba(31, 157, 85, 0.12); }
.ship-msg { font-size: 0.82rem; margin-bottom: 0.45rem; }
.ship-bar { height: 7px; background: var(--border); border-radius: 999px; overflow: hidden; }
.ship-bar-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.cart-line {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.cart-line #cartShipping { color: var(--text); font-weight: 600; }

.cart-total { display: flex; justify-content: space-between; font-size: 1.15rem; margin: 0.6rem 0 0.85rem; padding-top: 0.6rem; border-top: 1px solid var(--border); }
.checkout-btn {
  width: 100%;
  background: var(--accent);
  border: none;
  color: #fff;
  font-weight: 700;
  padding: 0.8rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1rem;
}
.checkout-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.checkout-btn:not(:disabled):hover { background: var(--accent-hover); }

/* Announcement bar */
.announce {
  background: var(--text);
  color: #fff;
  text-align: center;
  font-size: 0.82rem;
  padding: 0.5rem 1rem;
  letter-spacing: 0.01em;
}

/* Country flag on shirt */
.shirt { cursor: pointer; }
.flag {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  line-height: 0;
}
.flag-img {
  width: 28px;
  height: auto;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  vertical-align: middle;
  display: inline-block;
}
.flag-inline .flag-img { width: 18px; }
.card-name { cursor: pointer; }
.card-name:hover { color: var(--accent); }

/* Quick-view modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 30, 0.55);
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 1rem;
}
/* `hidden` must beat `display: grid` above, or the modal never closes. */
.modal-overlay[hidden] { display: none; }
.modal {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: min(680px, 100%);
  max-height: 90vh;
  overflow: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--border);
  border-radius: 999px;
  width: 32px;
  height: 32px;
  font-size: 1rem;
  cursor: pointer;
  color: var(--text);
  z-index: 1;
}
.modal-shirt {
  display: grid;
  place-items: center;
  position: relative;
  padding: 2rem;
  background: var(--surface-2);
  border-radius: var(--radius) 0 0 var(--radius);
}
.modal-shirt svg { width: 180px; height: 180px; filter: drop-shadow(0 6px 14px rgba(0,0,0,0.14)); }
.modal-shirt .flag { top: 1rem; right: 1rem; }
.modal-shirt .flag-img { width: 44px; }
.modal-info { padding: 1.75rem 1.75rem 1.75rem 0; display: flex; flex-direction: column; gap: 0.6rem; }
.modal-team { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.modal-name { font-size: 1.5rem; }
.modal-desc { color: var(--muted); font-size: 0.95rem; }
.modal-price { font-size: 1.4rem; font-weight: 800; }
.modal-size-label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; color: var(--muted); margin-top: 0.3rem; }
.modal-size-label .size-select { flex: 1; padding: 0.5rem; }
.modal-info .add-btn { margin-top: 0.5rem; }

/* Toast notifications */
.toast-wrap {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  pointer-events: none;
}
.toast {
  background: var(--text);
  color: #fff;
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.88rem;
  pointer-events: auto;
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
  max-width: 320px;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast .toast-flag { line-height: 0; }
.toast .toast-flag .flag-img { width: 20px; }
.toast .toast-action {
  margin-left: auto;
  color: #7ee2a8;
  font-weight: 700;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .filters { order: 3; width: 100%; margin-left: 0; }
  .hero h1 { font-size: 1.8rem; }
  .modal { grid-template-columns: 1fr; }
  .modal-shirt { border-radius: var(--radius) var(--radius) 0 0; }
  .modal-info { padding: 0 1.5rem 1.5rem; }
  .toast-wrap { left: 1rem; right: 1rem; bottom: 1rem; }
  .toast { max-width: none; }
}
