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

:root {
  /* Canvas neutre — jamais la star, juste le fond du plateau de marché */
  --paper: #FBF6EC;
  --paper-dim: #F1EAD8;

  /* Structure : bordures et texte, façon étiquette tamponnée */
  --ink: #1A1712;

  /* Palette "étal de marché" — une couleur saturée par catégorie de fruits */
  --citrus: #FF6B35;  /* fruit basique */
  --berry:  #E23F73;  /* fruits rouges */
  --grape:  #6C3BAA;  /* fruits exotiques */
  --lime:   #B4D400;  /* agrumes */
  --leaf:   #3F7D45;  /* légumes */

  --white: #FFFFFF;
  --radius: 20px;
  --radius-sm: 14px;

  /* Ombre "dure", décalée, sans flou — esprit tampon/étiquette carton, pas glassmorphism */
  --shadow-off: 5px 5px 0 var(--ink);
  --shadow-off-sm: 3px 3px 0 var(--ink);
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Space Grotesk', system-ui, sans-serif;
}

h1, h2, h3, .display {
  font-family: 'Fredoka', system-ui, sans-serif;
  font-weight: 600;
  margin: 0;
}

.price, .price-tag {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
}

button { font-family: inherit; }
a { color: inherit; }

/* Bouton "pressé dans le papier" : vocabulaire tactile réutilisé partout */
.press {
  border: 3px solid var(--ink);
  box-shadow: var(--shadow-off);
  transition: transform .08s ease, box-shadow .08s ease;
}
.press:active {
  transform: translate(4px, 4px);
  box-shadow: 0 0 0 var(--ink);
}
.press-sm {
  border: 2.5px solid var(--ink);
  box-shadow: var(--shadow-off-sm);
  transition: transform .08s ease, box-shadow .08s ease;
}
.press-sm:active {
  transform: translate(3px, 3px);
  box-shadow: 0 0 0 var(--ink);
}

/* ---------- Layout shell ---------- */
.app { max-width: 720px; margin: 0 auto; padding-bottom: 150px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 1.3rem 1.2rem 0.5rem;
  gap: .6rem .8rem;
}
.topbar .brand { display: flex; align-items: center; gap: .6rem; transform: rotate(-1deg); }
.topbar .brand-mark {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--citrus);
  border: 3px solid var(--ink);
  box-shadow: var(--shadow-off-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.topbar h1 {
  font-size: clamp(1.15rem, 5vw, 1.5rem);
  letter-spacing: -0.02em;
  line-height: 1;
}

.week-pill {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.68rem;
  font-weight: 600;
  background: var(--paper);
  color: var(--ink);
  border: 2.5px solid var(--ink);
  padding: 0.4rem 0.7rem;
  border-radius: 30px;
  white-space: nowrap;
  transform: rotate(3deg);
  box-shadow: var(--shadow-off-sm);
  flex-shrink: 0;
}

.rules-strip {
  margin: 0.2rem 1.2rem 1.3rem;
  padding: 0.7rem 0.9rem;
  background: transparent;
  border-top: 2px dashed var(--ink);
  border-bottom: 2px dashed var(--ink);
  font-size: 0.76rem;
  color: var(--ink);
  opacity: 0.75;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
}
.rules-strip span { white-space: nowrap; }

/* ---------- Bottle builder (signature element) : carte-étiquette ---------- */
.builder {
  margin: 0 1.2rem 1.8rem;
  background: var(--white);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-off);
  padding: 1.6rem 1.3rem 1.5rem;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  position: relative;
}
.builder-bottle {
  width: 150px;
  transition: transform 0.12s ease;
}
.builder-bottle.bounce { animation: bottleBounce 0.42s ease; }
@keyframes bottleBounce {
  0% { transform: scale(1); }
  35% { transform: scale(1.1) rotate(-2deg); }
  65% { transform: scale(0.96) rotate(2deg); }
  100% { transform: scale(1); }
}
.builder-price {
  font-size: 1.5rem;
  background: var(--paper-dim);
  padding: 0.3rem 0.9rem;
  border-radius: 30px;
  border: 2px solid var(--ink);
}
.builder-cta {
  background: var(--citrus);
  color: var(--ink);
  padding: 0.7rem 1.4rem;
  border-radius: 30px;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  border: 2.5px solid var(--ink);
  box-shadow: var(--shadow-off-sm);
  transition: transform .08s ease, box-shadow .08s ease;
}
.builder-cta:not(:disabled):active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.builder-cta:disabled {
  background: var(--paper-dim); color: #A39D89; cursor: not-allowed;
  box-shadow: none; border-color: #D8D0BC;
}
.builder-cta:disabled:active { transform: none; }

/* ---------- Jus du mois (mis en avant) ---------- */
.featured-block {
  margin: 0 1.2rem 1.6rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius);
  padding: 1.4rem 1.3rem 1.3rem;
  position: relative;
  transform: rotate(-0.6deg);
}
.featured-tag {
  position: absolute; top: -0.7rem; left: 1.1rem;
  background: var(--citrus); color: var(--ink);
  border: 2.5px solid var(--ink);
  font-size: 0.72rem; font-weight: 700;
  padding: 0.25rem 0.7rem; border-radius: 20px;
  transform: rotate(3deg);
}
.featured-body { display: flex; align-items: center; gap: 0.9rem; margin: 0.4rem 0 1rem; }
.featured-emoji { font-size: 2.6rem; flex-shrink: 0; }
.featured-body h3 { font-size: 1.15rem; margin-bottom: 0.2rem; }
.featured-body p { margin: 0; font-size: 0.82rem; opacity: 0.85; }
.featured-ings { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }
.featured-ing {
  display: inline-flex; align-items: center; gap: 0.3rem;
  background: rgba(251,246,236,0.12);
  border: 1.5px solid rgba(251,246,236,0.35);
  border-radius: 20px;
  padding: 0.25rem 0.6rem 0.25rem 0.4rem;
  font-size: 0.75rem;
  font-weight: 500;
}
.featured-ing .dot { font-size: 0.95rem; }
.featured-cta {
  background: var(--citrus); color: var(--ink);
  border: 2.5px solid var(--paper); border-radius: 30px;
  padding: 0.6rem 1.2rem; font-weight: 600; font-size: 0.88rem; cursor: pointer;
  transition: transform .08s ease;
}
.featured-cta:active { transform: scale(0.95); }

/* ---------- Jus préconfigurés ---------- */
.section-heading {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 0 1.2rem; margin-bottom: 0.6rem;
}
.section-heading h3 { font-size: 1rem; }
.section-heading .cat-hint { font-size: 0.72rem; color: #8C8570; }
.preset-grid {
  display: flex; gap: 0.8rem; overflow-x: auto;
  padding: 0 1.2rem 0.4rem; margin-bottom: 1.8rem;
  scroll-snap-type: x proximity;
}
.preset-grid::-webkit-scrollbar { display: none; }
.preset-card {
  scroll-snap-align: start;
  flex: 0 0 160px;
  background: var(--white);
  border: 2.5px solid var(--ink);
  box-shadow: var(--shadow-off-sm);
  border-radius: var(--radius-sm);
  padding: 0.9rem 0.85rem;
  text-align: left;
  cursor: pointer;
  transition: transform .08s ease;
}
.preset-card:active { transform: scale(0.96); }
.preset-emoji { font-size: 1.8rem; display: block; margin-bottom: 0.4rem; }
.preset-card h4 { font-size: 0.88rem; margin-bottom: 0.15rem; }
.preset-tagline { font-size: 0.7rem; color: #5C5648; margin-bottom: 0.5rem; line-height: 1.3; min-height: 1.8em; }
.preset-ings { font-size: 0.68rem; color: var(--berry); font-weight: 600; line-height: 1.3; }

/* ---------- Grille de catégories (bento) ---------- */
.category-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.9rem;
  padding: 0 1.2rem;
  margin-bottom: 1.8rem;
}
.category-card {
  border-radius: var(--radius-sm);
  padding: 1.1rem 1rem 1rem;
  text-align: left;
  cursor: pointer;
  position: relative;
  color: var(--card-fg, var(--ink));
  background: var(--card-bg, var(--white));
  border: none;
  transition: transform .08s ease;
}
.category-card:active { transform: scale(0.96); }
.category-card .cat-emoji { font-size: 1.9rem; display: block; margin-bottom: 0.5rem; }
.category-card h3 { font-size: 0.95rem; margin-bottom: 0.15rem; }
.category-card .cat-hint { font-size: 0.72rem; opacity: 0.8; }
.category-card .cat-badge {
  position: absolute; top: 0.65rem; right: 0.65rem;
  background: var(--ink); color: var(--paper);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem; font-weight: 600;
  min-width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  padding: 0 0.3rem;
  border: 2px solid var(--card-bg, var(--white));
}

/* palette bento : 6 teintes cycliques assignées par index de catégorie */
.cat-color-0 { --card-bg: var(--citrus); --card-fg: var(--ink); }
.cat-color-1 { --card-bg: var(--berry);  --card-fg: var(--paper); }
.cat-color-2 { --card-bg: var(--grape);  --card-fg: var(--paper); }
.cat-color-3 { --card-bg: var(--lime);   --card-fg: var(--ink); }
.cat-color-4 { --card-bg: var(--leaf);   --card-fg: var(--paper); }
.cat-color-5 { --card-bg: var(--ink);    --card-fg: var(--paper); }

/* ---------- Grille de fruits (dans le tiroir de catégorie) ---------- */
.fruit-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
}
.fruit-card {
  background: var(--white);
  border-radius: var(--radius-sm);
  border: 2.5px solid var(--ink);
  box-shadow: var(--shadow-off-sm);
  padding: 0.9rem 0.8rem;
  cursor: pointer;
  position: relative;
  text-align: left;
  transition: transform .1s ease;
}
.fruit-card:active { transform: scale(0.97); }
.fruit-card.selected { background: var(--paper-dim); }
.fruit-card.disabled { opacity: 0.4; cursor: not-allowed; }
.fruit-emoji { font-size: 2rem; display: block; margin-bottom: 0.4rem; line-height: 1; }
.fruit-card h4 { font-size: 0.88rem; margin: 0 0 0.2rem; font-weight: 600; }
.fruit-card .benefit { font-size: 0.7rem; color: #5C5648; margin-bottom: 0.5rem; line-height: 1.3; }
.fruit-card .price-tag { font-size: 0.75rem; color: var(--berry); display: block; margin-bottom: 0.7rem; }

.fruit-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.icon-btn {
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: 'Fredoka', system-ui, sans-serif;
}

.icon-btn.info-btn {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--paper-dim);
  border: 2px solid var(--ink);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  font-style: italic;
}

.icon-btn.add-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--citrus);
  color: var(--ink);
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1;
  border: 2.5px solid var(--ink);
  box-shadow: var(--shadow-off-sm);
  transition: transform .08s ease, box-shadow .08s ease;
}
.icon-btn.add-btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.icon-btn.add-btn:disabled {
  background: var(--paper-dim); color: #A39D89; box-shadow: none; cursor: not-allowed; border-color: #D8D0BC;
}
.icon-btn.add-btn:disabled:active { transform: none; }

.qty-stepper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--citrus);
  border: 2.5px solid var(--ink);
  border-radius: 30px;
  padding: 0.25rem 0.35rem;
}
.qty-stepper button {
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--ink);
  background: var(--white); color: var(--ink);
  font-weight: 700; font-size: 1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform .08s ease;
}
.qty-stepper button:active { transform: scale(0.85); }
.qty-stepper button:disabled { opacity: 0.35; cursor: not-allowed; }
.qty-stepper .qty-count {
  color: var(--ink); font-family: 'IBM Plex Mono', monospace; font-weight: 700;
  font-size: 0.85rem; min-width: 14px; text-align: center;
}

/* ---------- Panneau d'info intégré (dans le tiroir de catégorie) ---------- */
.info-panel {
  background: var(--paper-dim);
  border: 2.5px solid var(--ink);
  border-radius: 16px;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
  position: relative;
  animation: infoPanelIn 0.18s ease;
}
@keyframes infoPanelIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.info-panel .fruit-emoji { font-size: 2rem; display: block; margin-bottom: 0.4rem; }
.info-panel h4 { font-size: 1rem; margin: 0 0 0.35rem; }
.info-panel p { font-size: 0.85rem; line-height: 1.5; color: #443F33; margin: 0; padding-right: 1.5rem; }
.info-panel-close {
  position: absolute; top: 0.8rem; right: 0.8rem;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--white); border: 2px solid var(--ink); color: var(--ink);
  font-size: 0.8rem; cursor: pointer;
}

/* ---------- Modal (compat, non utilisé actuellement) ---------- */

/* ---------- Cart bar & drawer ---------- */
.cartbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--white);
  border-top: 3px solid var(--ink);
  padding: 0.9rem 1.2rem;
  display: flex; align-items: center; justify-content: space-between;
  z-index: 40;
}
.cartbar-info { font-size: 0.85rem; color: #5C5648; }
.cartbar-info strong { color: var(--ink); font-size: 1rem; display: block; font-family: 'IBM Plex Mono', monospace; }
.cartbar button {
  background: var(--ink); color: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: 30px;
  padding: 0.65rem 1.2rem; font-weight: 600; cursor: pointer;
}

.drawer {
  position: fixed; inset: 0; background: rgba(26,23,18,0.6);
  display: none; align-items: flex-end; justify-content: center; z-index: 60;
}
.drawer.open { display: flex; }
.drawer-sheet {
  background: var(--paper);
  border-radius: 26px 26px 0 0;
  border: 3px solid var(--ink);
  border-bottom: none;
  width: 100%; max-width: 720px; max-height: 88vh; overflow-y: auto;
  padding: 1.4rem 1.3rem 2rem;
  animation: sheetUp .2s ease;
}
@keyframes sheetUp { from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.drawer-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.drawer-header h2 { font-size: 1.1rem; }
.drawer-header button {
  background: var(--white); border: 2px solid var(--ink); border-radius: 50%;
  width: 32px; height: 32px; font-size: 1.1rem; cursor: pointer; color: var(--ink);
}

.cart-bottle {
  background: var(--white); border: 2.5px solid var(--ink); border-radius: 14px;
  padding: 0.8rem 0.9rem; margin-bottom: 0.6rem;
  display: flex; justify-content: space-between; align-items: center; gap: 0.6rem;
}
.cart-bottle .cb-left { font-size: 0.85rem; }
.cart-bottle .cb-ings { color: #5C5648; font-size: 0.75rem; }
.cart-bottle .cb-remove { background: none; border: none; color: var(--berry); font-size: 1.2rem; cursor: pointer; padding: 0 0.3rem; }

.cart-empty { text-align: center; padding: 2rem 0; color: #8C8570; font-size: 0.9rem; }

.cart-total {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 0.9rem 0; border-top: 2px dashed var(--ink); margin-top: 0.4rem; margin-bottom: 1.1rem;
}
.cart-total strong { font-size: 1.3rem; }

.checkout-form { display: flex; flex-direction: column; gap: 0.7rem; }
.checkout-form input {
  padding: 0.7rem 0.9rem; border-radius: 10px; border: 2.5px solid var(--ink);
  font-size: 0.95rem; font-family: inherit; background: var(--white); color: var(--ink);
}
.checkout-form input::placeholder { color: #9A927C; }
.checkout-form button.submit {
  background: var(--citrus); color: var(--ink);
  border: 2.5px solid var(--ink); box-shadow: var(--shadow-off-sm);
  border-radius: 30px;
  padding: 0.8rem; font-weight: 600; font-size: 0.95rem; cursor: pointer; margin-top: 0.3rem;
  transition: transform .08s ease, box-shadow .08s ease;
}
.checkout-form button.submit:active { transform: translate(3px,3px); box-shadow: 0 0 0 var(--ink); }
.checkout-form button.submit:disabled { opacity: 0.5; cursor: not-allowed; }
.form-error { color: var(--berry); font-size: 0.85rem; font-weight: 600; }
.form-success { text-align: center; padding: 1.5rem 0; }
.form-success .big { font-size: 2.4rem; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; top: 1rem; left: 50%; transform: translateX(-50%) translateY(-20px);
  background: var(--ink); color: var(--paper);
  border: 2px solid var(--ink);
  padding: 0.6rem 1rem; border-radius: 30px;
  font-size: 0.85rem; font-weight: 600; opacity: 0; transition: all .2s ease; z-index: 100; pointer-events: none;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.flying-emoji {
  position: fixed;
  pointer-events: none;
  z-index: 999;
  will-change: transform, opacity;
}

.drawer-subtitle {
  font-size: 0.8rem;
  color: #5C5648;
  margin: -0.6rem 0 1rem;
  font-weight: 600;
}

footer {
  text-align: center; font-size: 0.72rem; color: #8C8570; padding: 1rem 1.2rem 2rem;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Focus visibility */
button:focus-visible, input:focus-visible, .fruit-card:focus-visible, .category-card:focus-visible {
  outline: 3px solid var(--grape); outline-offset: 2px;
}
