/* ══════════════════════════════════════════════════════════════
   KIM LOONG — Design System
   "Cantine Cantonaise Contemporaine"
   ══════════════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --cream:     #FAF6EE;
  --ink:       #1A1A1A;
  --teal:      #009B95;
  --teal-dark: #007873;
  --teal-deep: #005E5A;
  --gold:      #C58200;
  --red:       #C30005;
  --border:    #E8E2D5;
  --dash:      #D4CFC0;
  --muted:     #6B6B6B;
  --faint:     #888888;

  --category-pill-color: var(--gold);

  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
  --font-zh:      'Noto Serif TC', serif;

  --site-veil-opacity: 0.55;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background-color: #2C2C2A;
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Voile blanc entre la photo de fond et le contenu (ADR-023) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, var(--site-veil-opacity));
  z-index: 0;
  pointer-events: none;
}

/* fallback scroll sur mobile — background-attachment:fixed bugue iOS Safari */
@media (max-width: 767px) {
  body { background-attachment: scroll; }
}

/* ── Layout : carte flottante sur photo de fond (ADR-023) ───── */
.kl-frame-wrap {
  position: relative;
  z-index: 1;
  background: transparent;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 2rem 1rem;
}

.kl-frame {
  width: 390px;
  background: var(--cream);
  border-radius: 16px;
  overflow: hidden;
  border: 0.5px solid var(--dash);
  box-shadow: 0 12px 48px rgba(0,0,0,0.25);
  position: relative;
}

.kl-frame::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(197,130,0,0.04) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(0,155,149,0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.kl-content { position: relative; z-index: 1; }

/* Mobile réel : carte pleine largeur, sans arrondi */
@media (max-width: 420px) {
  .kl-frame-wrap { padding: 0; }
  .kl-frame      { width: 100%; border-radius: 0; border: none; box-shadow: none; }
}

/* Sous-titre hero accueil */
.kl-hero-desc { max-width: 280px; }

/* Signatures accueil : scroll horizontal sur mobile */
.kl-signatures-wrap {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 0 12px;
  margin: 0 -24px;
  padding-left: 24px;
  scrollbar-width: none;
}
.kl-signatures-wrap::-webkit-scrollbar { display: none; }
.kl-signatures-card { min-width: 180px; }

/* Suggestions panier : scroll horizontal natif, scroll-snap */
.kl-suggestions-wrap {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.kl-suggestions-wrap::-webkit-scrollbar { display: none; }
.kl-suggestions-card {
  width: 180px;
  flex-shrink: 0;
  background: #FFFFFF;
  border: 0.5px solid var(--border);
  overflow: hidden;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
}
.kl-suggestions-info {
  padding: 10px 12px;
  border-left: 2px solid var(--gold);
  flex: 1;
}
.kl-suggestion-add {
  width: 100%;
  padding: 10px;
  background: var(--cream);
  border: none;
  border-top: 0.5px solid var(--border);
  cursor: pointer;
  color: var(--teal);
  font-size: 16px;
  transition: background 0.15s ease;
}
.kl-suggestion-add:hover { background: rgba(0,155,149,0.1); }

/* Desktop : carte élargie à 700px, photo visible autour (ADR-023) */
@media (min-width: 768px) {
  .kl-frame     { width: 700px; }
  .kl-cart-bar  { width: 700px; }
  .kl-modal     { max-width: 610px; }
  .kl-hero-desc { max-width: 480px; }

  /* Signatures : grille 3 colonnes sur desktop */
  .kl-signatures-wrap {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    overflow-x: visible;
    margin: 0;
    padding-left: 0;
  }
  .kl-signatures-card { min-width: unset; }
}

/* ── Typographie ───────────────────────────────────────────── */
.kl-display { font-family: var(--font-display); }
.kl-zh      { font-family: var(--font-zh); }
.kl-body    { font-family: var(--font-body); }
.kl-accent  { font-style: italic; color: var(--teal); }

/* ── Header nav ────────────────────────────────────────────── */
.kl-header {
  padding: 18px 24px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 0.5px solid var(--border);
}

.kl-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.kl-logo-zh {
  font-family: var(--font-zh);
  font-size: 11px;
  color: var(--gold);
  letter-spacing: 0.2em;
  margin-bottom: -2px;
}
.kl-logo-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.02em;
}

.kl-icon-btn {
  font-size: 22px;
  color: var(--ink);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  line-height: 1;
  position: relative;
  text-decoration: none;
}

.kl-cart-badge {
  position: absolute;
  top: -6px;
  right: -8px;
  background: var(--red);
  color: var(--cream);
  font-size: 9px;
  font-weight: 600;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Badge statut ──────────────────────────────────────────── */
.kl-badge-wrap {
  text-align: center;
  margin: 12px 0 0;
}
.kl-badge-inner {
  display: inline-block;
  padding: 0 14px;
  position: relative;
}
.kl-badge-inner::before,
.kl-badge-inner::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 10px;
  height: 0.5px;
}
.kl-badge-inner::before { left: 0;  background: var(--teal); }
.kl-badge-inner::after  { right: 0; background: var(--teal); }
.kl-badge-text {
  font-family: var(--font-display);
  font-size: 11px;
  font-style: italic;
  color: var(--teal);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.kl-badge-text.gold { color: var(--gold); }
.kl-badge-text.gold + * { --line-color: var(--gold); }

/* ── Section tag ───────────────────────────────────────────── */
.kl-section-tag {
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--gold);
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

/* ── Sceau "Fait maison" ───────────────────────────────────── */
.kl-seal {
  background: var(--red);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform: rotate(8deg);
  flex-shrink: 0;
}
.kl-seal-line {
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--cream);
  font-weight: 600;
  line-height: 1.1;
}

/* ── CTA Bouton ────────────────────────────────────────────── */
.kl-btn {
  width: 100%;
  background: var(--ink);
  color: var(--cream);
  border: none;
  padding: 16px 20px;
  border-radius: 0;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-decoration: none;
}
.kl-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.kl-btn i { font-size: 18px; }
.kl-btn.outline {
  background: transparent;
  color: var(--ink);
  border: 0.5px solid var(--ink);
}

/* ── Barre panier (fixed — position:sticky incompatible avec overflow:hidden) ── */
.kl-cart-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 390px;
  z-index: 100;
  padding: 14px 24px 18px;
  background: linear-gradient(180deg, rgba(250,246,238,0) 0%, rgba(250,246,238,0.95) 30%, var(--cream) 100%);
}
@media (max-width: 420px) {
  .kl-cart-bar { width: 100%; left: 0; transform: none; }
}
.kl-cart-bar .kl-btn { padding: 16px 18px; }
.kl-cart-count {
  background: var(--red);
  color: var(--cream);
  font-size: 11px;
  font-weight: 600;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Product row (liste menu) ──────────────────────────────── */
.kl-product-row {
  display: flex;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 0.5px solid var(--border);
  cursor: pointer;
}
.kl-product-thumb-img {
  width: 90px;
  height: 90px;
  flex-shrink: 0;
  object-fit: cover;
  border-radius: 6px;
}
.kl-product-modal-img {
  width: 100px;
  height: 100px;
  flex-shrink: 0;
  object-fit: cover;
  border-radius: 8px;
}
/* Conservé pour compatibilité — plus utilisé en prod */
.kl-product-thumb-num {
  position: absolute;
  bottom: 6px;
  left: 8px;
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--cream);
  font-style: italic;
  letter-spacing: 0.1em;
}
.kl-product-info { flex: 1; min-width: 0; padding-top: 2px; }
.kl-product-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.2;
  margin-bottom: 4px;
}
.kl-product-desc {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  line-height: 1.4;
  margin-bottom: 8px;
}
.kl-product-price {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  color: var(--teal);
  white-space: nowrap;
}
.kl-product-unavailable { opacity: 0.5; cursor: not-allowed; }

/* ── Séparateur catégorie ─────────────────────────────────── */
.kl-cat-separator {
  padding: 28px 24px 8px;
}
.kl-cat-separator-line {
  text-align: center;
  margin-bottom: 18px;
}
.kl-cat-separator-line span {
  display: inline-block;
  padding: 0 18px;
  position: relative;
  font-family: var(--font-display);
  font-size: 11px;
  font-style: italic;
  color: var(--gold);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.kl-cat-separator-line span::before,
.kl-cat-separator-line span::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 14px;
  height: 0.5px;
  background: var(--gold);
}
.kl-cat-separator-line span::before { left: 0; }
.kl-cat-separator-line span::after  { right: 0; }

/* ── Filtres catégories ────────────────────────────────────── */
.kl-filters {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
  border-bottom: 0.5px dashed var(--dash);
  scrollbar-width: none;
}
.kl-filters::-webkit-scrollbar { display: none; }
.kl-filter-btn {
  background: transparent;
  border: none;
  padding: 4px 0;
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--category-pill-color);
}
.kl-filter-btn.active {
  background: var(--gold);
  color: var(--ink);
  padding: 4px 10px;
  font-weight: 600;
}

/* ── Recherche ─────────────────────────────────────────────── */
.kl-search-wrap { position: relative; }
.kl-search-icon {
  position: absolute;
  left: 0;
  top: 12px;
  font-size: 18px;
  color: var(--faint);
}
.kl-search-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 0.5px solid var(--ink);
  padding: 10px 0 10px 26px;
  font-family: var(--font-display);
  font-size: 13px;
  font-style: italic;
  color: var(--ink);
  outline: none;
}
.kl-search-input::placeholder { color: var(--faint); }

/* ── Modal produit ─────────────────────────────────────────── */
.kl-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,26,26,0.6);
  z-index: 100;
  display: flex;
  align-items: flex-end;
}

.kl-modal {
  background: var(--cream);
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-width: 390px;
  margin: 0 auto;
  max-height: 92vh;
  overflow-y: auto;
  position: relative;
  scrollbar-width: none;
}
.kl-modal::-webkit-scrollbar { display: none; }

.kl-modal::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(197,130,0,0.04) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(0,155,149,0.03) 0%, transparent 50%);
  pointer-events: none;
  border-radius: 24px 24px 0 0;
}

.kl-modal-handle {
  height: 4px;
  width: 36px;
  background: var(--dash);
  border-radius: 2px;
  margin: 10px auto 0;
}

.kl-modal-close {
  width: 32px;
  height: 32px;
  border: 0.5px solid var(--ink);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: auto;
  margin-right: 20px;
  margin-top: 4px;
}
.kl-modal-close i { font-size: 18px; color: var(--ink); }

/* ── Options dans le modal ─────────────────────────────────── */
.kl-option-label {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  border: 0.5px solid var(--dash);
  background: transparent;
  position: relative;
  margin-bottom: 6px;
}
.kl-option-label.selected {
  border-color: var(--ink);
  background: #FFFFFF;
}
.kl-option-label.selected::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--teal);
}
.kl-option-label.disabled { opacity: 0.4; cursor: not-allowed; }

.kl-checkbox {
  width: 18px;
  height: 18px;
  border: 0.5px solid var(--faint);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.kl-checkbox.checked {
  background: var(--ink);
  border-color: var(--ink);
}
.kl-checkbox.checked i { font-size: 12px; color: var(--cream); }

.kl-option-name {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--ink);
  flex: 1;
}
.kl-option-price {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  color: var(--teal);
}

/* ── Quantité ──────────────────────────────────────────────── */
.kl-qty {
  display: flex;
  align-items: stretch;
  gap: 0;
  max-width: 160px;
}
.kl-qty-btn {
  width: 44px;
  height: 44px;
  border: 0.5px solid var(--ink);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.kl-qty-btn.plus { background: var(--ink); }
.kl-qty-btn.plus i { color: var(--cream); }
.kl-qty-val {
  flex: 1;
  height: 44px;
  background: #FFFFFF;
  border-top: 0.5px solid var(--ink);
  border-bottom: 0.5px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  color: var(--ink);
}

/* ── Panier — item card ────────────────────────────────────── */
.kl-cart-item {
  background: #FFFFFF;
  padding: 18px 18px 18px 22px;
  position: relative;
  margin-bottom: 14px;
  border: 0.5px solid var(--border);
}
.kl-cart-item-bar {
  position: absolute;
  left: 0;
  top: 18px;
  bottom: 18px;
  width: 2px;
}

/* ── Récapitulatif total ───────────────────────────────────── */
.kl-recap-header {
  text-align: center;
  margin-bottom: 16px;
}
.kl-recap-header span {
  display: inline-block;
  padding: 0 14px;
  position: relative;
  font-family: var(--font-display);
  font-size: 10px;
  font-style: italic;
  color: var(--gold);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.kl-recap-header span::before,
.kl-recap-header span::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 12px;
  height: 0.5px;
  background: var(--gold);
}
.kl-recap-header span::before { left: 0; }
.kl-recap-header span::after  { right: 0; }

/* ── Filigrane ─────────────────────────────────────────────── */
.kl-filigrane {
  text-align: center;
  padding: 12px 24px 24px;
}
.kl-filigrane-zh {
  font-family: var(--font-zh);
  font-size: 22px;
  color: rgba(197,130,0,0.2);
  letter-spacing: 0.1em;
}
.kl-filigrane-text {
  font-family: var(--font-display);
  font-size: 10px;
  font-style: italic;
  color: var(--faint);
  letter-spacing: 0.2em;
  margin-top: 6px;
}

/* ── Couleurs de fond produit ──────────────────────────────── */
.bg-gold    { background: linear-gradient(135deg, #FFCA63 0%, #C58200 100%); }
.bg-teal    { background: linear-gradient(135deg, #46B4B0 0%, #007873 100%); }
.bg-red     { background: linear-gradient(135deg, #FD6367 0%, #C30005 100%); }
.bg-brown   { background: linear-gradient(135deg, #C58200 0%, #9B6600 100%); }
.bg-green   { background: linear-gradient(135deg, #5B9F5B 0%, #3A7A3A 100%); }
.bg-purple  { background: linear-gradient(135deg, #9B7EBD 0%, #6B4E9A 100%); }

/* ── Utility ───────────────────────────────────────────────── */
.text-teal  { color: var(--teal); }
.text-gold  { color: var(--gold); }
.text-red   { color: var(--red);  }
.text-muted { color: var(--muted);}
.text-faint { color: var(--faint);}
.border-dash { border-top: 0.5px dashed var(--dash); }
.border-solid { border-top: 1px solid var(--ink); }

/* [x] Alpine : transition modal */
[x-cloak] { display: none !important; }
