/* ==========================================================================
   Miason Milano — theme.css
   Componenti condivisi tra sezioni e snippet (header, footer, card,
   breadcrumb, rating, trust badges, filtri collezione, accordion).
   ========================================================================== */

/* Accessibility & motion polish ------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 4px;
}
.btn:focus-visible { outline-offset: 4px; }

/* Staggered reveal for grids ---------------------------------------------- */
.anim-reveal .product-grid > *,
.anim-reveal .fc-grid > *,
.anim-reveal .usp-bar__grid > *,
.anim-reveal .materials__grid > *,
.anim-reveal .reviews__grid > *,
.anim-reveal .gallery__grid > * {
  opacity: 0;
  transform: translateY(22px);
}
.anim-reveal .section.is-visible .product-grid > *,
.anim-reveal .section.is-visible .fc-grid > *,
.anim-reveal .section.is-visible .usp-bar__grid > *,
.anim-reveal .section.is-visible .materials__grid > *,
.anim-reveal .section.is-visible .reviews__grid > *,
.anim-reveal .section.is-visible .gallery__grid > * {
  opacity: 1;
  transform: none;
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.anim-reveal .section.is-visible :is(.product-grid, .fc-grid, .usp-bar__grid, .materials__grid, .reviews__grid, .gallery__grid) > *:nth-child(2) { transition-delay: 0.06s; }
.anim-reveal .section.is-visible :is(.product-grid, .fc-grid, .usp-bar__grid, .materials__grid, .reviews__grid, .gallery__grid) > *:nth-child(3) { transition-delay: 0.12s; }
.anim-reveal .section.is-visible :is(.product-grid, .fc-grid, .usp-bar__grid, .materials__grid, .reviews__grid, .gallery__grid) > *:nth-child(4) { transition-delay: 0.18s; }
.anim-reveal .section.is-visible :is(.product-grid, .fc-grid, .usp-bar__grid, .materials__grid, .reviews__grid, .gallery__grid) > *:nth-child(5) { transition-delay: 0.24s; }
.anim-reveal .section.is-visible :is(.product-grid, .fc-grid, .usp-bar__grid, .materials__grid, .reviews__grid, .gallery__grid) > *:nth-child(n+6) { transition-delay: 0.3s; }

@media (prefers-reduced-motion: reduce) {
  .anim-reveal :is(.product-grid, .fc-grid, .usp-bar__grid, .materials__grid, .reviews__grid, .gallery__grid) > * { opacity: 1 !important; transform: none !important; }
}

/* Back to top ------------------------------------------------------------- */
.to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 80;
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-warm-white);
  color: var(--color-text);
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { background: var(--color-accent); color: var(--color-accent-text); border-color: var(--color-accent); }

/* Surfaces & section helpers ---------------------------------------------- */
.surface-secondary { background: var(--color-bg-secondary); }
.surface-warm { background: var(--color-warm-white); }

.section-intro {
  max-width: 680px;
  margin: 0 auto 48px;
  text-align: center;
}
.section-intro h2 { margin: 0 0 14px; }
.section-intro p { color: var(--color-text-60); margin: 0; }
.section-intro--left { margin-left: 0; text-align: left; }

/* Soft elevation on product media ----------------------------------------- */
.card__media { box-shadow: var(--shadow-soft); }
.card:hover .card__media { box-shadow: var(--shadow); }

.card__tag {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--color-green);
  color: var(--color-accent-text);
  margin: 0 0 8px;
}

/* Breadcrumb -------------------------------------------------------------- */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 0.82rem;
  color: var(--color-text-60);
  margin-bottom: 22px;
}
.breadcrumb a { color: var(--color-text-60); transition: color 0.2s ease; }
.breadcrumb a:hover { color: var(--color-text); }
.breadcrumb span[aria-current] { color: var(--color-text); }
.breadcrumb__sep { opacity: 0.5; }

/* Rating stars ------------------------------------------------------------ */
.rating { display: inline-flex; align-items: center; gap: 8px; }
.rating__stars { display: inline-flex; color: var(--color-wood); }
.rating__stars svg { width: 16px; height: 16px; }
.rating__count { font-size: 0.84rem; color: var(--color-text-60); }

/* Trust badges row (product) ---------------------------------------------- */
.trust-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 22px;
  margin: 24px 0;
  padding: 22px 0;
  border-block: 1px solid var(--color-border);
}
.trust-row__item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--color-text);
}
.trust-row__item svg { width: 22px; height: 22px; color: var(--color-wood); flex: none; }

/* Generic accordion ------------------------------------------------------- */
.accordion__item { border-bottom: 1px solid var(--color-border); }
.accordion__item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  list-style: none;
}
.accordion__item summary::-webkit-details-marker { display: none; }
.accordion__item summary::after {
  content: "";
  width: 12px;
  height: 12px;
  flex: none;
  background-size: contain;
  background-repeat: no-repeat;
  transition: transform 0.25s ease;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 5v14M5 12h14' stroke='%23000' stroke-width='2'/%3E%3C/svg%3E") center / contain no-repeat;
  background: currentColor;
}
.accordion__item[open] summary::after { transform: rotate(45deg); }
.accordion__content { padding: 0 0 20px; color: var(--color-text-60); }
.accordion__content > *:last-child { margin-bottom: 0; }

/* Collection filters (facets) --------------------------------------------- */
.collection-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 48px;
  align-items: start;
}
.collection-layout--with-facets {
  grid-template-columns: 250px 1fr;
}
.facets {
  position: sticky;
  top: 100px;
}
.facets-drawer__overlay,
.facets-drawer__head { display: none; }
.facets__group { border-bottom: 1px solid var(--color-border); padding: 18px 0; }
.facets__group:first-child { padding-top: 0; }
.facets__legend { font-weight: 600; font-size: 0.95rem; margin-bottom: 12px; }
.facets__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.facets__option { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; color: var(--color-text-60); cursor: pointer; }
.facets__option input { accent-color: var(--color-accent); width: 16px; height: 16px; }
.facets__option:hover { color: var(--color-text); }
.facets__price { display: flex; align-items: center; gap: 10px; }
.facets__price input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-warm-white);
  color: var(--color-text);
}
.facets__actions { margin-top: 18px; display: grid; gap: 8px; }
.facets__clear { font-size: 0.85rem; color: var(--color-text-60); text-decoration: underline; }

.collection-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
}
.collection-nav { margin: 0 0 28px; }
.collection-nav__scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.collection-nav__scroll::-webkit-scrollbar { display: none; }
.collection-nav__pill {
  flex: 0 0 auto;
  padding: 10px 18px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-warm-white);
  color: var(--color-text-60);
  font-size: 0.88rem;
  text-decoration: none;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.collection-nav__pill:hover,
.collection-nav__pill.is-active {
  border-color: var(--color-accent);
  color: var(--color-text);
  background: var(--color-card, var(--color-bg-secondary));
}
.collection-nav__pill.is-active { font-weight: 600; }
.collection-toolbar__count { color: var(--color-text-60); font-size: 0.9rem; }
.collection-toolbar select {
  padding: 11px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-warm-white);
  color: var(--color-text);
}
.facets-toggle { display: none; }

/* Mobile facets drawer ---------------------------------------------------- */
@media (max-width: 989px) {
  .collection-layout,
  .collection-layout--with-facets { grid-template-columns: 1fr; gap: 0; }
  .facets-drawer__overlay { display: block; }
  .facets-drawer__head { display: flex; }
  .facets-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 18px;
    border: 1px solid var(--color-border);
    border-radius: var(--btn-radius, 999px);
    background: var(--color-warm-white);
    font-weight: 600;
    font-size: 0.9rem;
  }
  .facets-drawer {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 90;
    visibility: hidden;
    pointer-events: none;
  }
  .facets-drawer.is-open { visibility: visible; pointer-events: auto; }
  .facets-drawer__overlay {
    position: absolute;
    inset: 0;
    background: rgba(24, 21, 18, 0.4);
    opacity: 0;
    transition: opacity 0.35s ease;
  }
  .facets-drawer.is-open .facets-drawer__overlay { opacity: 1; }
  .facets-drawer__panel {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: min(380px, 88vw);
    background: var(--color-bg);
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    padding: 22px;
    overflow-y: auto;
  }
  .facets-drawer.is-open .facets-drawer__panel { transform: translateX(0); }
  .facets-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
  }
  .facets { position: static; top: auto; }
}

/* ==========================================================================
   v2 — dinamicità & UX
   ========================================================================== */

/* Hero entrance + ken burns + scroll cue ---------------------------------- */
.anim-hover .hero-home__bg { animation: kenburns 18s ease-out forwards; }
.hero-home__content > * {
  opacity: 0;
  transform: translateY(20px);
  animation: heroIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
.hero-home__content > *:nth-child(1) { animation-delay: 0.1s; }
.hero-home__content > *:nth-child(2) { animation-delay: 0.22s; }
.hero-home__content > *:nth-child(3) { animation-delay: 0.34s; }
.hero-home__content > *:nth-child(4) { animation-delay: 0.46s; }
@keyframes heroIn { to { opacity: 1; transform: none; } }

.hero-scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 22px;
  z-index: 3;
  transform: translateX(-50%);
  color: var(--text-color, #fff);
  opacity: 0.8;
  display: inline-flex;
  animation: cueBob 1.8s ease-in-out infinite;
}
@keyframes cueBob { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 8px); } }

@media (prefers-reduced-motion: reduce) {
  .hero-home__content > * { opacity: 1; transform: none; animation: none; }
  .hero-scroll-cue { animation: none; }
}

/* Header search + mobile nav triggers ------------------------------------- */
.header__icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--color-text);
  padding: 4px;
}
/* Mobile header — default compact layout ---------------------------------- */
.header {
  max-width: 100%;
  overflow-x: clip;
}
.header__inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  padding-block: 12px;
}
.header__left { grid-column: 1; flex-shrink: 0; min-width: 0; }
.header__menu-btn { display: inline-flex; }
.header__nav { display: none !important; }
.header__logo {
  grid-column: 2;
  justify-self: center;
  text-align: center;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
.header__logo-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}
.header__actions {
  grid-column: 3;
  flex-shrink: 0;
  gap: 0;
  justify-self: end;
}
.header__icon-btn {
  min-width: 36px;
  min-height: 36px;
  padding: 4px;
  flex-shrink: 0;
}
.header__cart-count { top: -4px; right: -2px; }

@media (min-width: 990px) {
  .header__inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0;
    padding-block: 20px;
    overflow: visible;
  }
  .header__left { display: flex; align-items: center; gap: 16px; grid-column: auto; }
  .header__menu-btn { display: none !important; }
  .header__nav { display: block !important; }
  .header__logo { grid-column: auto; }
  .header__actions { grid-column: auto; gap: 14px; }
}

@media (max-width: 400px) {
  .header__actions .header__icon-btn:nth-child(2),
  .header__actions .header__icon:nth-child(2) { display: none; }
}

/* Slide-in panels (search + nav) ------------------------------------------ */
.panel {
  position: fixed;
  inset: 0;
  z-index: 95;
  visibility: hidden;
  pointer-events: none;
}
.panel.is-open { visibility: visible; pointer-events: auto; }
.panel__overlay {
  position: absolute;
  inset: 0;
  background: rgba(24, 21, 18, 0.4);
  opacity: 0;
  transition: opacity 0.35s ease;
}
.panel.is-open .panel__overlay { opacity: 1; }

.search-panel__box {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: var(--color-bg);
  padding: 24px;
  transform: translateY(-100%);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: var(--shadow);
}
.panel.is-open .search-panel__box { transform: translateY(0); }
.search-panel__form {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: var(--page-width);
  margin: 0 auto;
  border-bottom: 1px solid var(--color-text);
  padding-bottom: 12px;
}
.search-panel__form input {
  flex: 1;
  border: none;
  background: none;
  font-family: var(--font-heading);
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  color: var(--color-text);
}
.search-panel__form input:focus { outline: none; }
.search-panel__results {
  max-width: var(--page-width);
  margin: 18px auto 0;
  max-height: 60vh;
  overflow-y: auto;
}
.predictive__group-title {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-60);
  margin: 14px 0 8px;
}
.predictive__item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
}
.predictive__item img { width: 52px; height: 52px; object-fit: cover; border-radius: var(--radius); flex: none; }
.predictive__item-title { font-weight: 600; font-size: 0.95rem; }
.predictive__item-price { color: var(--color-text-60); font-size: 0.86rem; }
.predictive__empty { color: var(--color-text-60); padding: 14px 0; }

.nav-drawer__panel {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: min(360px, 86vw);
  background: var(--color-bg);
  transform: translateX(-100%);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  padding: 22px;
  overflow-y: auto;
}
.nav-drawer.is-open .nav-drawer__panel { transform: translateX(0); }
.nav-drawer__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.nav-drawer__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.nav-drawer__list a {
  display: block;
  padding: 14px 6px;
  font-family: var(--font-heading);
  font-size: 1.3rem;
  border-bottom: 1px solid var(--color-border);
}
.nav-drawer__actions { margin-top: 22px; display: grid; gap: 10px; }

/* Variant swatches / option buttons --------------------------------------- */
.variant-options { display: grid; gap: 18px; margin-bottom: 20px; }
.variant-option__label {
  display: block;
  font-size: 0.85rem;
  color: var(--color-text-60);
  margin-bottom: 8px;
}
.variant-option__label strong { color: var(--color-text); font-weight: 600; }
.variant-option__values { display: flex; flex-wrap: wrap; gap: 8px; }
.variant-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  padding: 11px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--btn-radius, 999px);
  background: var(--color-warm-white);
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.variant-pill input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.variant-pill:hover { border-color: var(--color-tortora); }
.variant-pill:has(input:checked),
.variant-pill.is-selected {
  border-color: var(--color-accent);
  color: var(--color-accent);
  box-shadow: inset 0 0 0 1px var(--color-accent);
}
.variant-pill:has(input:focus-visible) { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.variant-pill.is-unavailable { color: var(--color-text-40); text-decoration: line-through; opacity: 0.7; }

/* Quantity stepper -------------------------------------------------------- */
.qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: var(--btn-radius, 999px);
  background: var(--color-warm-white);
  overflow: hidden;
}
.qty__btn {
  width: 42px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--color-text);
  font-size: 1.2rem;
  line-height: 1;
}
.qty__btn:hover { background: var(--color-bg-secondary); }
.qty__input {
  width: 48px;
  height: 46px;
  text-align: center;
  border: none;
  background: none;
  color: var(--color-text);
  font-size: 1rem;
  -moz-appearance: textfield;
}
.qty__input::-webkit-outer-spin-button,
.qty__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.product__quantity .qty { margin-top: 4px; }

/* Sticky mobile add-to-cart bar ------------------------------------------- */
.buy-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 70;
  display: none;
  align-items: center;
  gap: 14px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in oklab, var(--color-bg) 90%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  border-top: 1px solid var(--color-border);
  transform: translateY(110%);
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.buy-bar.is-visible { transform: none; }
.buy-bar__info { flex: 1; min-width: 0; }
.buy-bar__title { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.buy-bar__price { color: var(--color-text-60); font-size: 0.86rem; }
.buy-bar .btn { flex: none; }
@media (max-width: 749px) {
  .buy-bar { display: flex; }
}

/* Cart free-shipping progress --------------------------------------------- */
.cart-progress { padding: 14px 24px 6px; }
.cart-progress__text { font-size: 0.85rem; margin: 0 0 8px; }
.cart-progress__text b { color: var(--color-accent); }
.cart-progress__bar { height: 7px; border-radius: 999px; background: var(--color-bg-secondary); overflow: hidden; }
.cart-progress__fill { height: 100%; width: 0; border-radius: 999px; background: var(--color-green); transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); }
.cart-progress--done .cart-progress__fill { background: var(--color-accent); }

/* Drawer quantity stepper ------------------------------------------------- */
.drawer-item__qty {
  display: inline-flex;
  align-items: center;
  margin-top: 8px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  overflow: hidden;
}
.drawer-item__qty button {
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  color: var(--color-text);
  font-size: 1rem;
  line-height: 1;
}
.drawer-item__qty button:hover { background: var(--color-bg-secondary); }
.drawer-item__qty span { min-width: 26px; text-align: center; font-size: 0.85rem; }

/* Card refinements --------------------------------------------------------- */
.card__media { transition: box-shadow 0.35s ease, transform 0.35s ease; }
.anim-hover .card:hover .card__media { transform: translateY(-4px); }
.card__title a { background-image: linear-gradient(currentColor, currentColor); background-size: 0 1px; background-repeat: no-repeat; background-position: 0 100%; transition: background-size 0.3s ease; }
.card:hover .card__title a { background-size: 100% 1px; }
