/* ============================================================
   North District — mini app showroom
   Dark premium, mobile-first (WebView Telegram) + desktop
   ============================================================ */

:root {
  --bg: #0b0b0d;
  --surface: #141419;
  --surface-2: #1c1c23;
  --line: rgba(255, 255, 255, 0.07);
  --text: #f3f1ec;
  --muted: #8f8f99;
  --accent: #e8693e;        /* terracotta / burnt sienna */
  --accent-deep: #b54e2b;
  --ok: #9aab87;            /* olive doux */
  --danger: #e05252;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  --font-display: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* L'attribut hidden doit TOUJOURS gagner, même sur elements en display:grid/flex */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; font-size: 16px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background: rgba(11, 11, 13, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  background: var(--accent);
  color: #0b0b0d;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  border-radius: 9px;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.14em;
  color: var(--text);
}

.icon-btn {
  position: relative;
  background: none;
  border: none;
  color: var(--text);
  font-size: 26px;
  width: 38px; height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  transition: background 0.15s;
}
.icon-btn:active { background: rgba(255, 255, 255, 0.08); }
#btnBack { font-size: 32px; line-height: 1; }

.cart-badge {
  position: absolute;
  top: 0; right: 0;
  min-width: 17px; height: 17px;
  padding: 0 4px;
  background: var(--accent);
  color: #0b0b0d;
  font-size: 11px;
  font-weight: 700;
  border-radius: 9px;
  display: grid;
  place-items: center;
}

/* ---------- Vues ---------- */
.view { padding: 0 16px 110px; animation: fadeUp 0.28s ease both; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Hero ---------- */
.hero {
  padding: 44px 4px 30px;
}
.hero-eyebrow {
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 38px;
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.hero-title em { font-style: normal; color: var(--accent); }
.hero-sub {
  color: var(--muted);
  margin: 14px 0 22px;
  max-width: 40ch;
}
.hero-cta { width: fit-content; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 14px;
  padding: 15px 20px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-body);
  transition: transform 0.12s, background 0.15s;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: #0b0b0d;
}
.btn-primary:active { background: var(--accent-deep); }

.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  margin-top: 10px;
}

.btn-block { width: 100%; }

/* ---------- Catalogue ---------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 26px 0 14px;
}
.section-title {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.section-note { color: var(--muted); font-size: 13px; }

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s;
}
.card:active { transform: scale(0.98); }

.card-media {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: #101013;
}
.card-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}
.card:hover .card-media img { transform: scale(1.04); }

.card-badge {
  position: absolute;
  top: 10px; left: 10px;
  background: rgba(11, 11, 13, 0.82);
  backdrop-filter: blur(6px);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
}

.card-body { padding: 12px 13px 14px; }
.card-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 5px;
}
.card-cat { color: var(--muted); font-size: 12px; margin-bottom: 7px; }
.card-price {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  color: var(--accent);
}

/* ---------- Fiche produit ---------- */
.product-media {
  margin: 0 -16px;
  aspect-ratio: 3 / 3.15;
  overflow: hidden;
  background: #101013;
  border-bottom: 1px solid var(--line);
}
.product-media img { width: 100%; height: 100%; object-fit: cover; }

.product-body { padding: 22px 2px 10px; }
.product-cat {
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.product-name {
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.product-price {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  margin: 10px 0 14px;
}
.product-desc { color: var(--muted); margin-bottom: 24px; }

/* ---------- Champs ---------- */
.field { margin-bottom: 22px; }
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 10px;
  letter-spacing: 0.04em;
}

.sizes { display: flex; flex-wrap: wrap; gap: 9px; }
.size {
  min-width: 52px;
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  transition: all 0.12s;
}
.size.active {
  background: var(--text);
  color: #0b0b0d;
  border-color: var(--text);
}

.qty {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px 10px;
}
.qty-btn {
  width: 36px; height: 36px;
  border: none;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 20px;
  display: grid;
  place-items: center;
}
.qty-val {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  min-width: 20px;
  text-align: center;
}

/* ---------- CTA sticky ---------- */
.sticky-cta {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 65%, transparent);
  z-index: 40;
}

/* ---------- Panier ---------- */
.cart-item {
  display: flex;
  gap: 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px;
  margin-bottom: 11px;
}
.cart-item img {
  width: 72px; height: 90px;
  object-fit: cover;
  border-radius: 12px;
}
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cart-item-meta { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.cart-item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 9px;
}
.cart-item-price { font-family: var(--font-display); font-weight: 700; }
.qty-sm { display: inline-flex; align-items: center; gap: 10px; }
.qty-sm .qty-btn { width: 27px; height: 27px; font-size: 16px; }
.qty-sm .qty-val { font-size: 14px; min-width: 14px; }
.remove {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  padding: 4px;
}

.cart-empty {
  text-align: center;
  color: var(--muted);
  padding: 70px 20px;
}
.cart-empty .big { font-size: 44px; margin-bottom: 14px; }

.cart-foot { margin-top: 18px; }
.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 4px 18px;
  font-size: 15px;
}
.cart-total {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--accent);
}

/* ---------- Checkout ---------- */
.recap {
  padding: 16px;
  margin-bottom: 20px;
}
.recap-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13.5px;
  padding: 6px 0;
  color: var(--muted);
}
.recap-row .q { color: var(--text); font-weight: 500; }
.recap-total {
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
}

.input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  padding: 15px 16px;
  outline: none;
  transition: border-color 0.15s;
}
.input:focus { border-color: var(--accent); }
.input::placeholder { color: #5c5c66; }

.demo-note {
  color: var(--muted);
  font-size: 12.5px;
  margin: -6px 0 22px;
}

/* ---------- Succès ---------- */
.success {
  text-align: center;
  padding: 70px 10px 20px;
  animation: fadeUp 0.35s ease both;
}
.success-check {
  width: 84px; height: 84px;
  margin: 0 auto 24px;
  border-radius: 50%;
  background: var(--ok);
  color: #0b0b0d;
  font-size: 40px;
  font-weight: 700;
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 12px rgba(154, 171, 135, 0.12);
}
.success-title {
  font-family: var(--font-display);
  font-size: 25px;
  margin-bottom: 10px;
}
.success-ref { font-size: 14px; color: var(--accent); margin-bottom: 16px; }
.success-sub { color: var(--muted); margin-bottom: 34px; }

/* ---------- Footer / Toast ---------- */
.footer {
  text-align: center;
  color: #4c4c56;
  font-size: 12px;
  padding: 22px 16px calc(30px + env(safe-area-inset-bottom));
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(30px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow);
  z-index: 100;
  white-space: nowrap;
  animation: toastIn 0.25s ease both;
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- Desktop ---------- */
@media (min-width: 700px) {
  body { max-width: 900px; margin: 0 auto; border-left: 1px solid var(--line); border-right: 1px solid var(--line); min-height: 100vh; }
  .grid { grid-template-columns: repeat(3, 1fr); gap: 18px; }
  .hero-title { font-size: 52px; }
  .product-media { margin: 0; border-radius: var(--radius); aspect-ratio: 4/3.4; }
  .product { display: grid; grid-template-columns: 1.1fr 1fr; gap: 30px; padding-top: 24px; }
  .recap { max-width: 520px; }
}

@media (min-width: 1100px) {
  body { max-width: 1080px; }
  .grid { grid-template-columns: repeat(3, 1fr); }
  .card-name { font-size: 15px; }
}