/* ==========================================================================
   MadMax Shop — minimalist grayscale design system
   Neutral gray/white/black surfaces, hazard-orange as the sole accent color.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Anton&family=IBM+Plex+Mono:wght@400;500;600;700&display=swap');

/* Light theme (default) — minimalist neutral grayscale + hazard-orange accent */
:root {
  --bg: #f6f6f5;
  --bg-raised: #ececea;
  --bg-card: #ffffff;
  --line: #e2e1de;
  --line-bright: #c9c7c2;
  --text: #121212;
  --text-dim: #6b6b68;
  --hazard: #e0430f;
  --hazard-dark: #b93710;
  --acid: #8fae00;
  --ok: #2f8f57;
  --err: #d43c3c;

  --font-display: 'Anton', 'Arial Narrow', sans-serif;
  --font-body: 'IBM Plex Mono', 'Courier New', monospace;

  --radius: 2px;
  --container: 1240px;
  --stripe-size: 28px;

  color-scheme: light;
}

/* Dark theme (opt-in via toggle, persisted in localStorage) — neutral grayscale */
:root[data-theme="dark"] {
  --bg: #0d0d0d;
  --bg-raised: #171717;
  --bg-card: #1c1c1c;
  --line: #2e2e2e;
  --line-bright: #454545;
  --text: #f2f2f0;
  --text-dim: #9a9a96;
  --hazard: #ff4b1f;
  --hazard-dark: #c73a15;
  --acid: #d6ff3f;
  --ok: #6ee7a0;
  --err: #ff6b6b;

  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

h1, h2, h3, .display {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.01em;
  line-height: 0.95;
  margin: 0 0 0.4em;
}

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

/* Hazard stripe divider */
.hazard-stripe {
  height: 10px;
  background: repeating-linear-gradient(
    -45deg,
    var(--hazard) 0, var(--hazard) 14px,
    #0b0a09 14px, #0b0a09 28px
  );
}

/* ============================= Header ============================= */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 10, 9, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 74px;
}

.logo {
  font-family: var(--font-display);
  font-size: 26px;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo .dot { color: var(--hazard); }

.main-nav {
  display: flex;
  gap: 28px;
  align-items: center;
}
.main-nav a {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  transition: color 0.2s;
  position: relative;
}
.main-nav a:hover { color: var(--hazard); }
.main-nav a.active { color: var(--text); }

.cart-link {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-bright);
  padding: 8px 14px;
  border-radius: var(--radius);
  transition: border-color 0.2s, background 0.2s;
}
.cart-link:hover { border-color: var(--hazard); background: rgba(255,75,31,0.08); }
.theme-toggle {
  background: none;
  border: 1px solid var(--line-bright);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: border-color 0.2s;
}
.theme-toggle:hover { border-color: var(--hazard); color: var(--hazard); }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: inline; }

.cart-count {
  background: var(--hazard);
  color: #0b0a09;
  font-weight: 700;
  font-size: 11px;
  min-width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ============================= Hero ============================= */

.hero {
  position: relative;
  padding: 90px 0 70px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.hero::after {
  content: '';
  position: absolute;
  right: -10%;
  top: -30%;
  width: 60%;
  height: 160%;
  background: radial-gradient(circle, rgba(255,75,31,0.16) 0%, transparent 70%);
  pointer-events: none;
}
.terminal-tag {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--hazard);
  background: var(--bg-card);
  border: 1px solid var(--line-bright);
  padding: 6px 12px;
  border-radius: var(--radius);
  margin-bottom: 22px;
}
.terminal-tag::after {
  content: '';
  display: inline-block;
  width: 7px;
  height: 13px;
  margin-left: 3px;
  background: var(--hazard);
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.hero h1 {
  font-size: clamp(48px, 9vw, 108px);
  max-width: 900px;
}
.hero h1 .accent { color: var(--hazard); -webkit-text-stroke: 0; }
.hero p {
  color: var(--text-dim);
  max-width: 480px;
  font-size: 15px;
  margin-top: 18px;
}
.hero .cta-row { margin-top: 34px; display: flex; gap: 16px; flex-wrap: wrap; }

/* ============================= Buttons ============================= */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: transform 0.15s ease, background 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--hazard);
  color: #0b0a09;
}
.btn-primary:hover {
  background: #ff5f38;
  box-shadow: 0 0 0 3px rgba(255,75,31,0.25);
}
.btn-outline {
  border-color: var(--line-bright);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--hazard); color: var(--hazard); }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================= Product grid ============================= */

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 70px 0 28px;
}
.section-title h2 { font-size: clamp(28px, 4vw, 44px); }
.section-title .tag {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.filter-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 30px;
}
.filter-chip {
  border: 1px solid var(--line-bright);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  transition: all 0.2s;
}
.filter-chip:hover, .filter-chip.active {
  border-color: var(--hazard);
  color: var(--hazard);
  background: rgba(255,75,31,0.08);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 22px;
  padding-bottom: 80px;
}

.product-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease, border-color 0.25s;
}
.product-card.in-view { opacity: 1; transform: translateY(0); }
.product-card:hover { border-color: var(--hazard); }

.product-card .thumb {
  aspect-ratio: 1;
  background: #100f0c;
  overflow: hidden;
  position: relative;
}
.product-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(.2,.8,.2,1);
}
.product-card:hover .thumb img { transform: scale(1.08) rotate(-1deg); }

.product-card .body { padding: 16px; }
.product-card .name {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}
.product-card .price {
  color: var(--hazard);
  font-weight: 700;
  font-size: 15px;
}
.product-card .price .from { color: var(--text-dim); font-weight: 400; font-size: 11px; text-transform: uppercase; margin-right: 4px; }

/* ============================= Product detail ============================= */

.product-detail {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 56px;
  padding: 50px 0 90px;
}
@media (max-width: 860px) {
  .product-detail { grid-template-columns: 1fr; gap: 30px; }
}

.gallery-main {
  aspect-ratio: 1;
  background: var(--bg-card);
  border: 1px solid var(--line);
  overflow: hidden;
}
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumbs { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.gallery-thumbs img {
  width: 64px; height: 64px; object-fit: cover;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: border-color 0.2s;
}
.gallery-thumbs img:hover, .gallery-thumbs img.active { border-color: var(--hazard); }

.product-info .breadcrumb {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}
.product-info .breadcrumb a:hover { color: var(--hazard); }
.product-info h1 { font-size: clamp(30px, 4vw, 46px); }
.product-info .price {
  font-family: var(--font-display);
  font-size: 30px;
  color: var(--hazard);
  margin: 16px 0 22px;
}
.product-info .desc { color: var(--text-dim); font-size: 14px; margin-bottom: 26px; }

.option-group { margin-bottom: 22px; }
.option-group label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 10px;
}
.option-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.option-pill {
  border: 1px solid var(--line-bright);
  padding: 9px 16px;
  font-size: 13px;
  border-radius: var(--radius);
  transition: all 0.15s;
}
.option-pill:hover { border-color: var(--hazard); }
.option-pill.selected { background: var(--hazard); border-color: var(--hazard); color: #0b0a09; font-weight: 700; }

.qty-row { display: flex; align-items: center; gap: 16px; margin: 26px 0; }
.qty-stepper {
  display: flex;
  border: 1px solid var(--line-bright);
}
.qty-stepper button {
  background: none; border: none; color: var(--text);
  width: 38px; height: 38px; font-size: 16px;
}
.qty-stepper button:hover { color: var(--hazard); }
.qty-stepper input {
  width: 46px; text-align: center; background: none; border: none; color: var(--text);
  font-family: var(--font-body); font-size: 14px;
}

/* ============================= Cart ============================= */

.cart-page { padding: 50px 0 90px; }
.cart-item {
  display: grid;
  grid-template-columns: 90px 1fr auto auto;
  gap: 18px;
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.cart-item img { width: 90px; height: 90px; object-fit: cover; border: 1px solid var(--line); }
.cart-item .title { font-size: 14px; text-transform: uppercase; }
.cart-item .variant { color: var(--text-dim); font-size: 12px; margin-top: 4px; }
.cart-item .remove { color: var(--text-dim); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 8px; }
.cart-item .remove:hover { color: var(--err); }
.cart-item .line-price { font-weight: 700; color: var(--hazard); white-space: nowrap; }

.cart-summary {
  background: var(--bg-card);
  border: 1px solid var(--line);
  padding: 26px;
  margin-top: 30px;
  max-width: 420px;
  margin-left: auto;
}
.summary-row { display: flex; justify-content: space-between; font-size: 13px; padding: 8px 0; color: var(--text-dim); }
.summary-row.total { color: var(--text); font-size: 18px; font-weight: 700; border-top: 1px solid var(--line); margin-top: 8px; padding-top: 16px; }
.summary-row.total .amount { color: var(--hazard); }

.promo-form { display: flex; gap: 8px; margin: 18px 0; }
.promo-form input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--line-bright);
  color: var(--text);
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 13px;
}

/* ============================= Forms / checkout ============================= */

.checkout-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 50px;
  padding: 50px 0 90px;
  align-items: start;
}
@media (max-width: 860px) { .checkout-grid { grid-template-columns: 1fr; } }

.form-row { margin-bottom: 18px; }
.form-row.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); margin-bottom: 8px; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number], select, textarea {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--line-bright);
  color: var(--text);
  padding: 13px 14px;
  font-family: var(--font-body);
  font-size: 14px;
  border-radius: var(--radius);
  transition: border-color 0.2s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--hazard); }

.payment-options { display: grid; gap: 12px; margin-top: 10px; }
.payment-option {
  border: 1px solid var(--line-bright);
  padding: 18px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  display: flex;
  align-items: center;
  gap: 14px;
}
.payment-option:hover, .payment-option.selected { border-color: var(--hazard); background: rgba(255,75,31,0.06); }
.payment-option input { width: auto; }

/* ============================= Footer ============================= */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 50px 0 30px;
  margin-top: 60px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 30px;
}
@media (max-width: 700px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-grid h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-dim); margin-bottom: 14px; }
.footer-grid a { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 8px; }
.footer-grid a:hover { color: var(--hazard); }
.footer-bottom { display: flex; justify-content: space-between; color: var(--text-dim); font-size: 12px; flex-wrap: wrap; gap: 10px; }

/* ============================= Misc / states ============================= */

.empty-state { text-align: center; padding: 100px 20px; color: var(--text-dim); }
.empty-state h2 { color: var(--text); }

.flash {
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 20px;
  border: 1px solid;
}
.flash.error { border-color: var(--err); color: var(--err); background: rgba(255,107,107,0.08); }
.flash.success { border-color: var(--ok); color: var(--ok); background: rgba(110,231,160,0.08); }

.badge-sale {
  position: absolute;
  top: 10px; left: 10px;
  background: var(--acid);
  color: #0b0a09;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 8px;
  letter-spacing: 0.04em;
  z-index: 2;
}

::selection { background: var(--hazard); color: #0b0a09; }
