/* ============================================================
   style-core.css — La Bottega del Caffè Castelbuono
   CSS CRITICO: sopra la piega, blocking render path
   Contiene: reset, variabili, navbar, hero, features, griglia
   prodotti/categorie, card, footer, responsive base mobile.
   ============================================================ */

/* ——— Font fallback con size-adjust per CLS minimo ——— */
@font-face {
  font-family: 'DM Sans Fallback';
  src: local('Arial'), local('Helvetica Neue'), local('system-ui');
  font-display: optional;
  size-adjust: 98%;
  ascent-override: 96%;
  descent-override: 22%;
  line-gap-override: 0%;
}
@font-face {
  font-family: 'Playfair Fallback';
  src: local('Georgia'), local('Times New Roman');
  font-display: optional;
  size-adjust: 92%;
  ascent-override: 92%;
  descent-override: 24%;
  line-gap-override: 0%;
}

/* ——— Variabili CSS ——— */
:root {
  --espresso:        #1a0d07;
  --dark-roast:      #2d1810;
  --mid-roast:       #6b3a2a;
  --caramel:         #b58a3e;
  --caramel-light:   #d4a84b;
  --cream:           #f5ede4;
  --milk:            #fdf8f3;
  --white:           #ffffff;
  --text-dark:       #1a0d07;
  --text-mid:        #5a3a2a;
  --text-light:      #8a6a5a;
  --border:          #e8d8cc;
  --border-strong:   #d4bfaf;
  --shadow-xs:       0 1px 3px rgba(26,13,7,.06), 0 1px 2px rgba(26,13,7,.04);
  --shadow-sm:       0 2px 8px rgba(26,13,7,.10), 0 1px 3px rgba(26,13,7,.06);
  --shadow-md:       0 8px 28px rgba(26,13,7,.14), 0 3px 8px rgba(26,13,7,.08);
  --shadow-lg:       0 20px 56px rgba(26,13,7,.22), 0 8px 20px rgba(26,13,7,.12);
  --shadow-xl:       0 32px 80px rgba(26,13,7,.30), 0 12px 28px rgba(26,13,7,.16);
  --shadow-card:     0 4px 16px rgba(26,13,7,.10), 0 1px 4px rgba(26,13,7,.06);
  --shadow-hover:    0 14px 40px rgba(26,13,7,.18), 0 4px 12px rgba(26,13,7,.09);
  --shadow-caramel:  0 8px 24px rgba(181,138,62,.30);
  --radius-sm:       8px;
  --radius-md:       14px;
  --radius-lg:       22px;
  --radius-xl:       32px;
  --transition:      .22s cubic-bezier(.4,0,.2,1);
  --max-w:           1240px;
}

/* ——— Reset & Base ——— */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', 'DM Sans Fallback', system-ui, -apple-system, sans-serif;
  background: var(--milk);
  color: var(--text-dark);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
h1,h2,h3,h4,h5 {
  font-family: 'Playfair Display', 'Playfair Fallback', serif;
  line-height: 1.25;
}
img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
a { text-decoration: none; color: inherit; }
input, select, textarea {
  font-family: inherit;
  font-size: 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .65rem .9rem;
  width: 100%;
  background: var(--white);
  color: var(--text-dark);
  transition: border-color var(--transition);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--caramel);
  box-shadow: 0 0 0 3px rgba(181,138,62,.18), 0 1px 4px rgba(26,13,7,.08);
}
textarea { resize: vertical; }

/* ——— Transizione pagina ——— */
#main-content {
  transition: opacity .18s ease, transform .18s ease;
  flex: 1;
}

/* ——— Loader globale ——— */
#global-loader {
  display: none;
  position: fixed; inset: 0;
  background: rgba(253,248,243,.75);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}
#global-loader::after {
  content: '';
  width: 44px; height: 44px;
  border: 3px solid var(--border);
  border-top-color: var(--caramel);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ——— NAVBAR ——— */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(253,248,243,.97);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(26,13,7,.06), 0 2px 12px rgba(26,13,7,.06);
  contain: layout style;
}
.navbar-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 68px;
  min-height: 68px;
  padding: 0 1.5rem;
  gap: 1rem;
}
.navbar-brand {
  font-family: 'Playfair Display', 'Playfair Fallback', serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--espresso);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
}
@media (max-width:900px) {
  .navbar-brand { overflow: hidden; text-overflow: ellipsis; max-width: calc(100vw - 120px); }
}
.navbar-brand span { color: var(--caramel); }
.navbar-nav {
  display: flex;
  align-items: center;
  gap: .25rem;
  list-style: none;
  margin-left: auto;
}
.navbar-nav li a,
.navbar-nav li button {
  font-size: .9rem; font-weight: 500;
  color: var(--text-mid);
  background: none; border: none;
  padding: .5rem .85rem;
  border-radius: 8px;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  display: block;
}
.navbar-nav li a:hover,
.navbar-nav li button:hover { background: var(--cream); color: var(--espresso); }
.navbar-cart {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  background: var(--espresso); color: var(--white);
  border: none; border-radius: 50%;
  font-size: 1.1rem; cursor: pointer;
  flex-shrink: 0;
  transition: transform var(--transition), background var(--transition);
}
.navbar-cart:hover { background: var(--mid-roast); transform: scale(1.08); }
#cart-badge {
  display: none;
  position: absolute; top: -4px; right: -4px;
  background: var(--caramel); color: var(--white);
  border-radius: 50%;
  font-size: .65rem; font-weight: 700;
  width: 18px; height: 18px;
  align-items: center; justify-content: center;
}

/* ——— MOBILE MENU ——— */
.navbar-right {
  display: flex; align-items: center; gap: .75rem; margin-left: auto;
}
.hamburger {
  display: none;
  flex-direction: column; justify-content: center; align-items: center;
  gap: 5px; width: 40px; height: 40px;
  background: none; border: none; cursor: pointer; padding: 6px;
  border-radius: 8px; flex-shrink: 0;
}
.hamburger span {
  display: block; width: 22px; height: 2px;
  background: var(--espresso); border-radius: 2px;
  transition: all .25s ease; transform-origin: center;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.mobile-menu {
  display: none; flex-direction: column;
  background: var(--white);
  border-bottom: 2px solid var(--border);
  box-shadow: 0 8px 24px rgba(26,13,7,.12);
  width: 100%;
}
.mobile-menu.open { display: flex; }
.mobile-link {
  padding: 1rem 1.5rem;
  font-size: 1rem; font-weight: 500;
  color: var(--text-dark); cursor: pointer;
  border: none; border-bottom: 1px solid var(--border);
  background: none; text-align: left; width: 100%;
  display: block; font-family: inherit;
}
.mobile-link:active { background: var(--cream); }

/* ——— BOTTOM NAV MOBILE ——— */
#bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 58px;
  background: rgba(253,248,243,.97);
  border-top: 1px solid #e8d8cc;
  z-index: 9999;
  flex-direction: row; align-items: stretch;
  box-shadow: 0 -4px 20px rgba(26,13,7,.10), 0 -1px 0 rgba(26,13,7,.04);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
#bottom-nav a {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; color: #8a6a5a; text-decoration: none;
  cursor: pointer; padding: 4px 2px;
  -webkit-tap-highlight-color: transparent;
  user-select: none; -webkit-user-select: none;
}
#bottom-nav a .bn-icon { font-size: 1.3rem; line-height: 1; display: block; }
#bottom-nav a .bn-label {
  font-size: .58rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
  font-family: 'DM Sans', sans-serif; display: block;
}
#bottom-nav a.active .bn-label { color: #b58a3e; }
#bottom-nav a:active { background: #f5ede4; }
#bnav-admin { display: none; }

/* body padding-bottom: solo su mobile con bottom nav
   JS la setta/rimuove dinamicamente su resize */
@media (max-width: 900px) {
  .navbar-nav { display: none !important; }
  .navbar-cart { display: none !important; }
  /* Riserva spazio per bottom-nav prima che JS la mostri — evita CLS */
  body { padding-bottom: 58px; }
  /* backdrop-filter: blur() non è GPU-accelerato su molti SoC mobile
     e causa scroll jank. Su schermi piccoli un bg opaco è percettivamente
     identico e non ha costo di compositing. */
  .navbar {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(253,248,243,.99);
  }
  #bottom-nav {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(253,248,243,.99);
  }
}
@media (min-width: 901px) {
  /* Desktop: nessun padding inutile */
  body { padding-bottom: 0; }
  .hamburger { display: none !important; }
}

/* ——— BUTTONS ——— */
.btn-primary {
  background: var(--espresso); color: var(--white);
  border: none; padding: .8rem 1.8rem;
  border-radius: var(--radius-sm);
  font-size: .95rem; font-weight: 600;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(26,13,7,.20);
}
.btn-primary:hover:not(:disabled) {
  background: var(--mid-roast);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(26,13,7,.28);
}
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary.btn-lg { padding: 1rem 2.4rem; font-size: 1.05rem; }
.btn-ghost {
  background: transparent; color: var(--espresso);
  border: 1.5px solid var(--espresso);
  padding: .75rem 1.6rem; border-radius: var(--radius-sm);
  font-size: .95rem; font-weight: 600;
  transition: all var(--transition); cursor: pointer;
}
.btn-ghost:hover { background: var(--espresso); color: var(--white); }
.btn-link {
  background: none; border: none; color: var(--caramel);
  font-size: inherit; font-weight: 600; cursor: pointer; padding: 0;
  text-decoration: underline; text-underline-offset: 3px;
}
.btn-sm {
  background: var(--cream); border: 1px solid var(--border);
  padding: .35rem .75rem; border-radius: 5px;
  font-size: .82rem; font-weight: 500;
  transition: all var(--transition); cursor: pointer;
}
.btn-sm:hover { background: var(--espresso); color: var(--white); }
.btn-sm.danger:hover { background: #c0392b; color: var(--white); border-color: #c0392b; }
.w-full { width: 100%; }

/* ——— HERO ——— */
.hero {
  min-height: calc(100svh - 68px);
  background: var(--espresso);
  display: flex;
  align-items: center;
  contain: layout style;
  position: relative;
  overflow: hidden;
  padding: 4rem 2rem;
}
.hero-bg {
  position: absolute; inset: 0;
  overflow: hidden;
}
/* Immagine di sfondo: copre l'intera hero come background-image ma
   è un <img> reale → il browser la preloada e la conta come LCP candidate */
.hero-bg-img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center center;
}
/* Gradiente scuro sovrapposto: più opaco a sinistra dove risiede il testo (contrasto WCAG AA),
   più trasparente a destra per mostrare l'immagine di sfondo. */
.hero-bg::after {
  content: '';
  position: absolute; inset: 0;
  background:
    linear-gradient(to right, rgba(26,13,7,.88) 0%, rgba(26,13,7,.65) 45%, rgba(26,13,7,.35) 100%),
    radial-gradient(ellipse at 72% 48%, rgba(181,138,62,.18) 0%, transparent 55%),
    radial-gradient(ellipse at 18% 80%, rgba(107,58,42,.28) 0%, transparent 50%);
}
.hero-content {
  position: relative; z-index: 2;
  max-width: 560px;
  padding-left: calc((100vw - var(--max-w)) / 2 + 1.5rem);
}
.hero-eyebrow {
  display: inline-block;
  font-size: .8rem; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--caramel); margin-bottom: 1.2rem;
}
.hero-title {
  font-size: clamp(2rem, 5vw, 4.5rem);
  color: var(--white); line-height: 1.1; margin-bottom: 1.4rem;
}
.hero-title em { color: var(--caramel); font-style: italic; }
.hero-sub {
  color: rgba(255,255,255,.72);
  font-size: 1.1rem; margin-bottom: 2.4rem; max-width: 420px;
}
.hero-cta { display: flex; gap: 1rem; flex-wrap: wrap; }
.hero-cta .btn-ghost { color: var(--white); border-color: rgba(255,255,255,.4); }
.hero-cta .btn-ghost:hover { background: rgba(255,255,255,.1); }

/* ——— FEATURES BAR — visibile anche mobile come scroll orizzontale ——— */
.features-bar {
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  background: var(--cream);
  border-bottom: 1px solid var(--border);
}
@media (min-width:901px) {
  .features-bar { justify-content: center; overflow-x: unset; }
}
.features-bar::-webkit-scrollbar { display: none; }
.feature-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .9rem 2rem;
  font-size: .88rem; font-weight: 500;
  color: var(--text-mid);
  border-right: 1px solid var(--border);
  transition: color var(--transition), background var(--transition);
  flex-shrink: 0;
  scroll-snap-align: start;
  white-space: nowrap;
}
.feature-item:hover { color: var(--espresso); background: rgba(181,138,62,.06); }
.feature-item:last-child { border-right: none; }
.fi-icon { font-size: 1.3rem; }

/* ——— SEZIONI GENERALI ——— */
.section {
  max-width: var(--max-w); margin: 0 auto;
  padding: 4rem 1.5rem;
  /* content-visibility per sezioni non above-the-fold */
  content-visibility: auto;
  contain-intrinsic-size: 0 600px;
}
.section-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 2rem;
}
.section-header h2 { font-size: 1.9rem; letter-spacing: -.02em; }

/* ——— PRODUCTS GRID ——— */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
  min-height: 360px;
  contain: layout;
}
/* Skeleton shimmer */
.product-skeleton {
  background: linear-gradient(90deg,
    var(--cream) 0%, var(--cream) 20%,
    rgba(232,216,204,.7) 40%, var(--border) 50%,
    rgba(232,216,204,.7) 60%, var(--cream) 80%, var(--cream) 100%
  );
  background-size: 300% 100%;
  border-radius: var(--radius-md);
  height: 340px;
  animation: shimmer 1.6s ease-in-out infinite;
  border: 1px solid rgba(232,216,204,.5);
}
.cat-skeleton {
  background: linear-gradient(90deg,
    var(--cream) 0%, var(--cream) 20%,
    rgba(232,216,204,.7) 40%, var(--border) 50%,
    rgba(232,216,204,.7) 60%, var(--cream) 80%, var(--cream) 100%
  );
  background-size: 300% 100%;
  border-radius: var(--radius-md);
  aspect-ratio: 4 / 3;
  animation: shimmer 1.6s ease-in-out infinite;
  border: 1px solid rgba(232,216,204,.5);
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ——— PRODUCT CARD ——— */
.product-card {
  background: var(--white);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(232,216,204,.7);
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
}
.product-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(181,138,62,.25);
}
.product-badge {
  position: absolute; top: 1rem; left: 1rem; z-index: 3;
  background: var(--caramel); color: var(--white);
  font-size: .72rem; font-weight: 700;
  padding: .25rem .65rem; border-radius: 20px;
  letter-spacing: .06em; text-transform: uppercase;
}
.product-img-wrap {
  position: relative; aspect-ratio: 4/3; overflow: hidden;
  background: var(--cream); contain: strict;
}
.product-img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .4s ease;
}
.product-card:hover .product-img { transform: scale(1.06); }
/* Overlay: solo su hover reale (desktop) */
.product-overlay {
  position: absolute; inset: 0;
  background: rgba(26,13,7,.5);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity var(--transition);
  pointer-events: none;
}
@media (hover: hover) {
  .product-overlay { pointer-events: auto; }
  .product-card:hover .product-overlay { opacity: 1; }
  .product-card:hover .btn-overlay { transform: translateY(0); }
}
.btn-overlay {
  background: var(--white); color: var(--espresso);
  border: none; padding: .65rem 1.4rem;
  border-radius: 30px; font-weight: 600; font-size: .88rem;
  transform: translateY(8px); transition: transform var(--transition); cursor: pointer;
}
.product-body { padding: 1.1rem; }
.product-compat {
  font-size: .75rem; color: var(--text-light);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: .3rem;
}
.product-name {
  font-family: 'Playfair Display', 'Playfair Fallback', serif;
  font-size: 1.05rem; margin-bottom: .4rem; line-height: 1.3;
}
/* Descrizione: clampata a 2 righe anche su mobile (migliora leggibilità) */
.product-desc {
  font-size: .83rem; color: var(--text-light); margin-bottom: .8rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-footer {
  display: flex; align-items: center; justify-content: space-between;
  gap: .5rem; flex-wrap: wrap;
}
.cur-price { font-size: 1.25rem; font-weight: 800; color: var(--espresso); letter-spacing: -.01em; }
.old-price { font-size: .88rem; color: var(--text-light); text-decoration: line-through; margin-right: .3rem; }
.disc-price { font-size: 1.1rem; font-weight: 700; color: #c0392b; }
.btn-cart {
  background: var(--espresso); color: var(--white);
  border: none; border-radius: 20px;
  padding: .45rem 1rem; font-size: .82rem; font-weight: 600;
  display: flex; align-items: center; gap: .35rem;
  transition: all var(--transition); cursor: pointer; white-space: nowrap;
}
.btn-cart:hover { background: var(--caramel); }
.btn-cart.added { background: #27ae60; }

/* ——— CATEGORIES GRID ——— */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  min-height: 270px; contain: layout;
}
.cat-card {
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: var(--radius-md); overflow: hidden;
  display: flex; flex-direction: column; align-items: center;
  font-weight: 600; cursor: pointer;
  transition: all var(--transition); box-shadow: var(--shadow-card);
}
.cat-card:hover {
  border-color: var(--caramel); transform: translateY(-6px); box-shadow: var(--shadow-hover);
}
.cat-card:hover .cat-logo { transform: scale(1.05); }
.cat-card > span { padding: .9rem 1rem; font-size: .95rem; text-align: center; }
.cat-logo {
  width: 100%; height: 200px; aspect-ratio: 4 / 3;
  object-fit: cover; display: block;
  transition: transform .35s ease; min-height: 150px;
}

/* ——— CTA BANNER ——— */
.cta-banner {
  background: linear-gradient(135deg, var(--espresso) 0%, #2d1408 60%, #1a0d07 100%);
  padding: 4rem 2rem; text-align: center;
  position: relative; overflow: hidden;
  content-visibility: auto; contain-intrinsic-size: 0 260px;
}
.cta-banner::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 30% 50%, rgba(181,138,62,.12) 0%, transparent 60%);
  pointer-events: none;
}
.cta-inner { max-width: 600px; margin: 0 auto; }
.cta-banner h2 { color: var(--white); font-size: 2rem; margin-bottom: .8rem; }
.cta-banner p { color: rgba(255,255,255,.7); margin-bottom: 2rem; }

/* ——— PAGE HEADER ——— */
.page-header {
  background: linear-gradient(180deg, var(--cream) 0%, rgba(245,237,228,.4) 100%);
  padding: 3.5rem 1.5rem 2.5rem; text-align: center;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(232,216,204,.6), inset 0 -1px 0 rgba(232,216,204,.4);
}
.page-header h1 { font-size: 2.4rem; margin-bottom: .4rem; }
.page-header p { color: var(--text-light); }

/* ——— SHOP LAYOUT ——— */
.shop-layout {
  display: grid; grid-template-columns: 220px 1fr;
  gap: 2rem; max-width: var(--max-w); margin: 0 auto;
  padding: 2.5rem 1.5rem;
}
.shop-sidebar h3 {
  font-size: 1rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-light); margin-bottom: 1rem;
}
.category-filters { display: flex; flex-direction: column; gap: .4rem; }
.filter-btn {
  text-align: left; padding: .55rem .9rem;
  border-radius: var(--radius-sm); border: none; background: none;
  font-size: .9rem; font-weight: 500; color: var(--text-mid);
  transition: all var(--transition); cursor: pointer; white-space: nowrap;
}
.filter-btn:hover, .filter-btn.active { background: var(--cream); color: var(--espresso); font-weight: 600; }
.filter-btn.active { border-left: 3px solid var(--caramel); }
.cat-filter-group { display: flex; flex-direction: column; }
.cat-filter-parent {
  display: flex !important; align-items: center;
  justify-content: space-between; gap: .5rem; text-align: left !important;
}
.cat-filter-parent span:first-child { flex: 1; }
.cat-arrow { font-size: .7rem; color: var(--text-light); transition: transform .2s ease; flex-shrink: 0; }
.cat-arrow.open { transform: rotate(90deg); }
.cat-arrow.hidden { visibility: hidden; }
.subcats-list {
  display: none; flex-direction: column; gap: .2rem;
  padding-left: 1.1rem; border-left: 2px solid var(--border);
  margin-left: .6rem; margin-top: .15rem; margin-bottom: .15rem;
}
.subcats-list.open { display: flex; }
.sub-filter-btn { font-size: .82rem !important; padding: .4rem .75rem !important; text-align: left !important; }
.shop-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem; gap: .75rem; flex-wrap: wrap;
}
#products-count { font-size: .85rem; color: var(--text-light); flex-shrink: 0; }
.toolbar-right {
  display: flex; align-items: center; gap: .6rem; flex: 1;
  justify-content: flex-end; flex-wrap: wrap;
}
.sort-select {
  padding: .5rem .75rem; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); background: var(--white);
  font-size: .82rem; color: var(--text-mid); cursor: pointer;
  transition: border-color var(--transition); flex-shrink: 0;
}
.sort-select:focus { outline: none; border-color: var(--caramel); }
.search-input { width: auto; min-width: 180px; flex: 1; max-width: 280px; }

/* ——— FOOTER ——— */
footer {
  background: var(--espresso); color: rgba(255,255,255,.7);
  padding: 3rem 1.5rem 2rem; contain: layout;
}
.footer-inner {
  max-width: var(--max-w); margin: 0 auto;
  display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem;
  min-height: 200px;
}
.footer-brand {
  font-family: 'Playfair Display', 'Playfair Fallback', serif;
  font-size: 1.3rem; color: var(--white); margin-bottom: .8rem;
}
footer p { font-size: .85rem; line-height: 1.7; }
.footer-col h4 {
  color: var(--white); margin-bottom: 1rem; font-size: .9rem;
  text-transform: uppercase; letter-spacing: .08em;
}
.footer-col a { display: block; font-size: .85rem; padding: .2rem 0; transition: color var(--transition); cursor: pointer; }
.footer-col a:hover { color: var(--caramel); }
.footer-bottom {
  max-width: var(--max-w); margin: 2rem auto 0;
  padding-top: 1.5rem; border-top: 1px solid rgba(255,255,255,.1);
  font-size: .78rem; text-align: center;
}
.footer-contact-row { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .8rem; }
.footer-cta {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem .9rem; border-radius: 20px;
  font-size: .8rem; font-weight: 600; text-decoration: none;
  transition: all var(--transition); cursor: pointer;
}
.footer-cta.wa  { background: #25D366; color: #fff; }
.footer-cta.wa:hover  { background: #1ebe5d; }
.footer-cta.fb  { background: #1877F2; color: #fff; }
.footer-cta.fb:hover  { background: #0f65d9; }
.footer-cta.tel { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.2); }
.footer-cta.tel:hover { background: rgba(255,255,255,.2); }

/* ——— EMPTY / SUCCESS / LOADING STATES ——— */
.empty-state, .success-state {
  text-align: center; padding: 5rem 2rem;
  max-width: 480px; margin: 0 auto;
}
.empty-icon, .success-icon { font-size: 4rem; margin-bottom: 1.2rem; }
.empty-state h2, .success-state h2 { margin-bottom: .8rem; }
.empty-state p, .success-state p { color: var(--text-light); margin-bottom: 1.5rem; }
.success-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.order-id {
  display: inline-block; background: var(--cream); border-radius: 8px;
  padding: .6rem 1.4rem; font-family: monospace;
  font-size: 1.3rem; font-weight: 700; margin: .8rem 0;
}
.empty { text-align: center; color: var(--text-light); padding: 2rem; }
.loading-dots { text-align: center; color: var(--text-light); padding: 2rem; }

/* ——— TOAST ——— */
#toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  z-index: 9998; display: flex; flex-direction: column; gap: .5rem;
}
@media (max-width: 900px) { #toast-container { bottom: 70px; } }
.toast {
  background: var(--espresso); color: var(--white);
  padding: .9rem 1.4rem; border-radius: var(--radius-md);
  font-size: .88rem; font-weight: 500; box-shadow: var(--shadow-lg);
  transform: translateX(120%);
  transition: transform .35s cubic-bezier(.34,1.56,.64,1);
  max-width: 340px; border: 1px solid rgba(255,255,255,.08);
}
.toast.show { transform: translateX(0); }
.toast.toast-error { background: #c0392b; }
.toast.toast-success { background: #27ae60; }

/* ——— COOKIE BANNER ——— */
#cookie-banner {
  display: none; position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--espresso); color: var(--white);
  padding: 1rem 2rem; align-items: center; gap: 1rem; flex-wrap: wrap;
  z-index: 10000; transition: transform .4s ease;
}
@media (max-width: 768px) {
  #cookie-banner { bottom: 58px; border-radius: var(--radius-md) var(--radius-md) 0 0; }
}
#cookie-banner.hide { transform: translateY(100%); }
#cookie-banner p { flex: 1; font-size: .88rem; opacity: .85; }
.cookie-buttons { display: flex; gap: .6rem; }
#cookie-accept {
  background: var(--caramel); color: var(--white);
  border: none; padding: .5rem 1.2rem; border-radius: 5px;
  font-weight: 600; cursor: pointer;
}
#cookie-reject {
  background: transparent; color: rgba(255,255,255,.6);
  border: 1px solid rgba(255,255,255,.3);
  padding: .5rem 1rem; border-radius: 5px; cursor: pointer;
}

/* ——— RESPONSIVE GLOBALE ——— */
@media (max-width: 900px) {
  .hero { min-height: auto; padding: 3rem 1.5rem; }
  .hero-content { padding-left: 0; max-width: 100%; }
  /* Crop mobile: sposta il punto focale verso il centro-alto dell'immagine
     dove tipicamente si trovano i chicchi. Regola object-position se necessario. */
  .hero-bg-img { object-position: 55% 40%; }
  /* Su mobile gradiente uniforme verticale per leggibilità su tutta la larghezza. */
  .hero-bg::after {
    background: linear-gradient(to bottom,
      rgba(26,13,7,.65) 0%,
      rgba(26,13,7,.82) 60%,
      rgba(26,13,7,.90) 100%);
  }
  .categories-grid { grid-template-columns: repeat(2, 1fr); }
  .cat-logo { height: 140px; min-height: 100px; }
  .shop-layout { grid-template-columns: 1fr; }
  .shop-sidebar { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
  .footer-inner { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .hero-title { font-size: 2rem; line-height: 1.15; }
  .hero-sub { font-size: .95rem; }
  .hero { padding: 2.5rem 1.2rem; }
  .products-grid { grid-template-columns: 1fr 1fr; gap: .75rem; }
  .product-body { padding: .75rem; }
  .product-name { font-size: .92rem; }
  /* Descrizione clampata a 1 riga su mobile piccolo */
  .product-desc { -webkit-line-clamp: 1; margin-bottom: .5rem; }
  .product-footer { flex-direction: column; align-items: flex-start; gap: .5rem; }
  .btn-cart { width: 100%; justify-content: center; padding: .55rem .5rem; font-size: .78rem; }
  .cur-price { font-size: 1.1rem; }
  .hero-cta { flex-direction: column; }
  .page-header h1 { font-size: 1.8rem; }
  .toolbar-right { width: 100%; }
  .sort-select { flex: 1; }
  .search-input { min-width: 0; max-width: none; width: 100%; }
}

/* ——— MOBILE CATEGORY FILTERS — chip system ——— */
@media (max-width: 900px) {
  .shop-sidebar h3 { display: none; }
  .sidebar-body { display: block !important; padding: 0 !important; }
  .category-filters { flex-direction: column !important; gap: 0 !important; overflow: visible !important; }
  .cat-filters-main-row {
    display: flex; flex-wrap: wrap; gap: .45rem;
    padding: .65rem .85rem .5rem;
    border-bottom: 1px solid transparent; transition: border-color .2s;
  }
  .cat-filters-main-row.has-subs { border-bottom-color: var(--border); }
  .cat-filters-sub-row {
    display: flex; flex-wrap: wrap; gap: .4rem;
    padding: 0 .85rem; background: var(--cream);
    overflow: hidden; max-height: 0; opacity: 0;
    transition: max-height .28s ease, opacity .2s ease, padding .2s ease;
  }
  .cat-filters-sub-row.visible { max-height: 300px; opacity: 1; padding: .5rem .85rem .65rem; }
  .shop-sidebar .cat-filter-group { display: none !important; }
  .filter-chip {
    display: inline-flex; align-items: center;
    padding: .45rem .95rem; border-radius: 20px;
    border: 1.5px solid var(--border); background: var(--white);
    font-size: .82rem; font-weight: 500; color: var(--text-mid);
    cursor: pointer; transition: all .15s ease; white-space: nowrap;
    -webkit-tap-highlight-color: transparent; user-select: none;
  }
  .filter-chip:active { transform: scale(.96); }
  .filter-chip.active { background: var(--espresso); color: var(--white); border-color: var(--espresso); font-weight: 600; }
  .filter-chip.sub-chip.active { background: var(--caramel); border-color: var(--caramel); color: var(--white); }
  .shop-sidebar .cat-arrow { display: none; }
}

:focus-visible { outline: 2px solid var(--caramel); outline-offset: 3px; border-radius: 3px; }
:focus:not(:focus-visible) { outline: none; }
