/* Store styles. Colors live in :root so the whole look can be re-themed in one place. */
:root {
  --bg: #0b0d18;
  --surface: #141829;
  --surface-2: #1c2136;
  --border: #2a3150;
  --text: #eef0f8;
  --muted: #a3aac4;
  --accent: #4cc2ff;
  --accent-strong: #1fa8f0;
  --accent-text: #04121c;
  --good: #3ddc97;
  --warn: #ffb347;
  --bad: #ff6b6b;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --max: 1200px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
img { max-width: 100%; display: block; }
a { color: var(--accent); }
a:hover { color: #8fd8ff; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--accent); color: var(--accent-text); padding: 10px 16px; border-radius: 8px; font-weight: 700;
}
.skip-link:focus { top: 12px; }

/* ---------- Buttons: plain and simple ---------- */
.btn {
  display: inline-block; min-height: 40px; padding: 8px 16px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font-weight: 600; text-decoration: none; text-align: center; cursor: pointer;
}
.btn:hover { border-color: var(--accent); color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-strong); color: var(--accent-text); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--bad); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(11,13,24,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.header-row { display: flex; align-items: center; gap: 16px; min-height: 68px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.25rem; color: var(--text); text-decoration: none; white-space: nowrap; }
.logo-mark { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), #7a5cff); display: grid; place-items: center; color: #fff; }
.logo-mark svg { width: 20px; height: 20px; }
.search { flex: 1; display: flex; max-width: 560px; margin-left: auto; }
.search input {
  flex: 1; min-width: 0; height: 40px; padding: 0 12px; border-radius: 6px 0 0 6px;
  border: 1px solid var(--border); border-right: 0; background: var(--surface); color: var(--text);
}
.search input::placeholder { color: var(--muted); }
.search .btn { border-radius: 0 6px 6px 0; }
.category-nav { border-top: 1px solid var(--border); }
.category-nav ul { list-style: none; display: flex; gap: 4px; margin: 0 auto; padding: 6px 16px; overflow-x: auto; scrollbar-width: none; }
.category-nav ul::-webkit-scrollbar { display: none; }
.category-nav a {
  display: block; padding: 8px 14px; border-radius: 6px; color: var(--muted); text-decoration: none; white-space: nowrap; font-weight: 600;
}
.category-nav a:hover, .category-nav a[aria-current="page"] { background: var(--surface-2); color: var(--text); }

@media (max-width: 720px) {
  .header-row { flex-wrap: wrap; gap: 10px; padding-top: 10px; padding-bottom: 10px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .header-buttons { margin-left: auto; }
}

/* ---------- Footer ---------- */
.site-footer { margin-top: 64px; border-top: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: .95rem; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 24px; padding: 32px 16px; }
.site-footer h2 { font-size: 1rem; color: var(--text); }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); text-decoration: underline; }
.footer-bottom { border-top: 1px solid var(--border); padding: 16px; text-align: center; }

/* ---------- Home ---------- */
.hero { padding: 56px 0 40px; background: radial-gradient(900px 400px at 15% 0%, rgba(76,194,255,.18), transparent 70%), radial-gradient(700px 400px at 90% 10%, rgba(122,92,255,.18), transparent 70%); }
.hero-inner { display: grid; grid-template-columns: 1.2fr 1fr; gap: 32px; align-items: center; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); letter-spacing: -0.02em; }
.hero h1 span { color: var(--accent); }
.hero p { color: var(--muted); font-size: 1.15rem; max-width: 34em; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
.hero-art { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hero-art a { aspect-ratio: 1; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); display: grid; place-items: center; color: var(--accent); }
.hero-art a:hover { border-color: var(--accent); }
.hero-art svg { width: 45%; height: 45%; }
@media (max-width: 820px) { .hero-inner { grid-template-columns: 1fr; } .hero-art { display: none; } }

.section { padding: 32px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.section-head h2 { font-size: 1.5rem; margin: 0; }

.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.category-tile {
  display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 20px 12px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; font-weight: 700; text-align: center;
}
.category-tile:hover { border-color: var(--accent); color: var(--text); transform: translateY(-2px); }
.category-tile svg { width: 40px; height: 40px; color: var(--accent); }

.perks { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.perk { padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.perk h3 { font-size: 1.05rem; margin-bottom: 4px; }
.perk p { margin: 0; color: var(--muted); }

/* ---------- Product cards ---------- */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.product-card {
  position: relative; display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); transition: border-color .15s, transform .15s;
}
.product-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.product-card .thumb { aspect-ratio: 1; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.product-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-card .thumb svg { width: 42%; height: 42%; color: var(--muted); }
.product-card .body { padding: 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-card .brand { color: var(--muted); font-size: .85rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.product-card h3 { font-size: 1rem; margin: 0; }
.product-card h3 a { color: var(--text); text-decoration: none; }
.product-card h3 a::after { content: ""; position: absolute; inset: 0; } /* whole card is clickable */
.product-card .meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 6px; flex-wrap: wrap; }
.price { font-weight: 800; font-size: 1.15rem; }
.price s { color: var(--muted); font-weight: 500; font-size: .9rem; margin-left: 6px; }
.stock-note { font-size: .85rem; color: var(--muted); }
.stock-note.low { color: var(--warn); }
.stock-note.out { color: var(--bad); }

.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; border: 1px solid; white-space: nowrap; }
.badge-new { color: var(--good); border-color: rgba(61,220,151,.45); background: rgba(61,220,151,.1); }
.badge-like-new, .badge-excellent { color: var(--accent); border-color: rgba(76,194,255,.45); background: rgba(76,194,255,.1); }
.badge-good { color: #c9b6ff; border-color: rgba(201,182,255,.45); background: rgba(201,182,255,.1); }
.badge-fair { color: var(--warn); border-color: rgba(255,179,71,.45); background: rgba(255,179,71,.1); }
.badge-sale { position: absolute; top: 10px; left: 10px; z-index: 1; background: var(--bad); color: #fff; border-color: transparent; }
.badge-soldout { position: absolute; top: 10px; right: 10px; z-index: 1; background: var(--surface-2); color: var(--muted); border-color: var(--border); }

.empty-state, .load-error { padding: 40px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--border); border-radius: var(--radius); grid-column: 1 / -1; }
.skeleton { border-radius: var(--radius); background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; aspect-ratio: .78; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Shop page ---------- */
.shop-layout { display: grid; grid-template-columns: 240px 1fr; gap: 24px; padding-top: 24px; }
.filters { position: sticky; top: 130px; align-self: start; display: grid; gap: 18px; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.filters fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
.filters legend { font-weight: 700; margin-bottom: 6px; }
.filters label { display: flex; align-items: center; gap: 10px; min-height: 36px; cursor: pointer; color: var(--muted); }
.filters label:hover { color: var(--text); }
.filters input[type="radio"], .filters input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.shop-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.shop-toolbar h1 { margin: 0; font-size: 1.6rem; }
.result-count { color: var(--muted); }
select, input[type="text"], input[type="email"], input[type="number"], input[type="password"], input[type="search"], input[type="url"], textarea {
  min-height: 44px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
}
textarea { min-height: 120px; resize: vertical; }
.filters-toggle { display: none; }
@media (max-width: 820px) {
  .shop-layout { grid-template-columns: 1fr; }
  .filters { position: static; display: none; }
  .filters.open { display: grid; }
  .filters-toggle { display: inline-flex; }
}

/* ---------- Product page ---------- */
.breadcrumbs { padding: 18px 0 0; color: var(--muted); font-size: .92rem; }
.breadcrumbs a { color: var(--muted); }
.product-layout { display: grid; grid-template-columns: 1.1fr 1fr; gap: 36px; padding-top: 18px; }
.gallery-main { aspect-ratio: 1; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); overflow: hidden; display: grid; place-items: center; }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; }
.gallery-main svg { width: 40%; height: 40%; color: var(--muted); }
.gallery-thumbs { display: flex; gap: 10px; margin-top: 10px; overflow-x: auto; }
.gallery-thumbs button { flex: 0 0 72px; height: 72px; border-radius: 10px; border: 2px solid var(--border); background: var(--surface); padding: 0; overflow: hidden; cursor: pointer; }
.gallery-thumbs button[aria-current="true"] { border-color: var(--accent); }
.gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.product-info h1 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
.product-info .brand { color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.product-info .price { font-size: 1.9rem; }
.savings { color: var(--good); font-weight: 700; margin-left: 8px; font-size: 1rem; }
.condition-box { margin: 16px 0; padding: 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.condition-box p { margin: 6px 0 0; color: var(--muted); }
.buy-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 18px 0; }
.qty { display: inline-flex; align-items: center; gap: 6px; }
.qty .btn { min-width: 40px; padding: 8px 12px; }
.qty output, .qty span { min-width: 40px; text-align: center; font-weight: 700; }
.buy-row > .btn { flex: 1; min-width: 160px; }
.trust-list { list-style: none; padding: 0; margin: 18px 0; display: grid; gap: 8px; color: var(--muted); }
.trust-list li::before { content: "✓"; color: var(--good); font-weight: 800; margin-right: 10px; }
.specs { width: 100%; border-collapse: collapse; margin-top: 8px; }
.specs th, .specs td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.specs th { color: var(--muted); font-weight: 600; width: 40%; }
.description { white-space: pre-line; color: var(--text); }
@media (max-width: 820px) { .product-layout { grid-template-columns: 1fr; gap: 20px; } }

/* ---------- Cart page ---------- */
.cart-layout { display: grid; grid-template-columns: 1fr 340px; gap: 24px; padding-top: 24px; align-items: start; }
@media (max-width: 820px) { .cart-layout { grid-template-columns: 1fr; } }
.cart-lines { list-style: none; margin: 0; padding: 0; }
.cart-line { display: grid; grid-template-columns: 80px 1fr auto; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--border); align-items: start; }
.cart-line .thumb { width: 80px; height: 80px; border-radius: 8px; background: var(--surface-2); overflow: hidden; display: grid; place-items: center; }
.cart-line .thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart-line .thumb svg { width: 50%; height: 50%; color: var(--muted); }
.cart-line a { color: var(--text); font-weight: 600; }
.cart-line .line-controls { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.cart-summary { display: grid; gap: 10px; }
.totals-row { display: flex; justify-content: space-between; color: var(--muted); }
.totals-row.total { color: var(--text); font-weight: 800; font-size: 1.15rem; border-top: 1px solid var(--border); padding-top: 10px; }
.cart-note { font-size: .88rem; color: var(--muted); margin: 0; }
.notice { padding: 10px 12px; border-radius: 8px; font-size: .92rem; border: 1px solid; }
.notice-warn { color: var(--warn); border-color: rgba(255,179,71,.45); background: rgba(255,179,71,.08); }
.notice-error { color: var(--bad); border-color: rgba(255,107,107,.45); background: rgba(255,107,107,.08); }
.notice-good { color: var(--good); border-color: rgba(61,220,151,.45); background: rgba(61,220,151,.08); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 12px 20px; box-shadow: var(--shadow); font-weight: 600; max-width: calc(100% - 32px);
}

/* ---------- Simple content pages ---------- */
.page { max-width: 820px; padding-top: 32px; }
.page h2 { margin-top: 1.6em; }
.page p, .page li { color: var(--muted); }
.page dl { display: grid; gap: 10px; }
.page dt { font-weight: 700; color: var(--text); }
.page dd { margin: 0 0 6px; color: var(--muted); }
.card { padding: 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.order-lines { list-style: none; padding: 0; margin: 12px 0; }
.order-lines li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); color: var(--text); }

/* ---------- Small utilities ---------- */
.toolbar-controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.loading-note { padding: 40px 0; color: var(--muted); }
.page-title { margin-top: 28px; }
.center { text-align: center; }

/* Phones: two product cards per row. */
@media (max-width: 520px) {
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .product-card .body { padding: 10px; }
  .product-card h3 { font-size: .92rem; }
  .price { font-size: 1rem; }
  .badge-sale, .badge-soldout { top: 6px; font-size: .7rem; }
  .badge-sale { left: 6px; } .badge-soldout { right: 6px; }
}

/* ---------- Header buttons ---------- */
.header-buttons { display: flex; gap: 8px; }

/* ---------- Forms (account, cart email) ---------- */
.form-grid { display: grid; gap: 10px; }
.form-grid label { font-weight: 600; }
.form-grid input { width: 100%; }
.field-hint { font-size: .88rem; color: var(--muted); margin: 0; }

/* ---------- Account page ---------- */
.account-page { padding-top: 28px; }
.account-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; align-items: start; }
.account-columns .card h2 { margin-top: 0; }
.account-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.account-head h1 { margin: 0; }
.order-history { display: grid; gap: 14px; }
.order-history .card { display: grid; gap: 8px; }
.order-history-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.order-status { font-weight: 700; }
.order-status.paid { color: var(--warn); }
.order-status.shipped { color: var(--good); }
.order-status.cancelled { color: var(--muted); }
