/* Componenti ripetuti: pulsanti, header, menu, schede, FAQ, moduli, dialog e footer. */

/* Icone e pulsanti */
.icon {
  width: 24px; height: 24px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-sprite { display: none; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 52px;
  padding: 13px 24px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  transition: background var(--fast), color var(--fast), border-color var(--fast);
}
.button .icon { width: 20px; height: 20px; }
.button--primary { background: var(--rust); color: var(--cream); }
.button--primary:hover { background: var(--rust-dark); }
.button--outline { border-color: currentColor; background: transparent; }
.button--outline:hover { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.dark-section .button--outline:hover,
.hero .button--outline:hover,
.callout .button--outline:hover { background: var(--cream); color: var(--ink); border-color: var(--cream); }
.button--light { background: var(--cream); color: var(--ink); }
.button--light:hover { background: var(--paper); }
.button--dark { background: var(--ink); color: var(--cream); }
.button--dark:hover { background: #3a2f28; }

.actions { display: flex; flex-wrap: wrap; gap: 14px; }

.inline-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
}
.inline-link:hover { text-decoration-thickness: 2px; }
.inline-link .icon { width: 18px; height: 18px; }

.text-button {
  border: 0;
  padding: 0;
  background: none;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.round-button {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  padding: 0;
  flex: none;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: transparent;
  transition: background var(--fast), color var(--fast);
}
.round-button:hover { background: var(--cream); color: var(--ink); }
.round-button .icon { width: 20px; height: 20px; }

/* Header */
.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 40;
  height: var(--header);
  color: var(--cream);
  border-bottom: 1px solid #f5efe526;
  transition: background .25s, color .25s, border-color .25s;
}
.site-header.is-scrolled,
.site-header.header-solid {
  background: var(--cream);
  color: var(--ink);
  border-color: #211b171f;
}
.header-inner { height: 100%; display: flex; align-items: center; gap: 36px; }

.brand { position: relative; display: block; flex: none; width: 132px; }
.brand img { width: 132px; height: auto; }
.brand-dark { display: none; }
.is-scrolled .brand-light, .header-solid .brand-light { display: none; }
.is-scrolled .brand-dark, .header-solid .brand-dark { display: block; }

.desktop-nav { display: flex; align-items: center; gap: 30px; margin-left: auto; font-size: 16px; font-weight: 500; }
.desktop-nav > a, .nav-more summary { position: relative; padding-block: 10px; }
.desktop-nav > a::after, .nav-more summary::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 4px;
  height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--fast) var(--ease);
}
.desktop-nav > a:hover::after,
.desktop-nav > a[aria-current]::after,
.nav-more summary:hover::after,
.nav-more.is-current summary::after { transform: scaleX(1); }

/* Menu Esplora: Galleria, Domande frequenti e Contatti */
.nav-more { position: relative; }
.nav-more summary { display: flex; align-items: center; gap: 6px; list-style: none; cursor: pointer; }
.nav-more summary::-webkit-details-marker { display: none; }
.nav-more summary .icon { width: 18px; height: 18px; transition: transform var(--fast) var(--ease); }
.nav-more[open] summary .icon { transform: rotate(180deg); }
.nav-more-list {
  position: absolute;
  top: calc(100% + 12px); right: -18px;
  min-width: 230px;
  margin: 0; padding: 8px;
  list-style: none;
  border: 1px solid #211b171f;
  border-radius: var(--radius-lg);
  background: var(--cream);
  color: var(--ink);
  box-shadow: 0 18px 50px #211b1726;
}
.nav-more-list a { display: block; padding: 10px 14px; border-radius: var(--radius-sm); }
.nav-more-list a:hover { background: var(--paper); }
.nav-more-list a[aria-current] { color: var(--rust); font-weight: 600; }
.site-header .nav-more .nav-more-list :focus-visible { outline-color: var(--rust); outline-offset: 0; }

.header-cta { min-height: 44px; padding: 9px 20px; font-size: 16px; border-color: currentColor; }
.site-header:not(.is-scrolled):not(.header-solid) .header-cta:hover { background: var(--cream); color: var(--ink); border-color: var(--cream); }

.menu-toggle {
  display: none;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  margin-left: auto;
  padding: 8px 0 8px 12px;
  border: 0;
  background: none;
  font-weight: 600;
}
.menu-toggle .icon { width: 28px; height: 28px; }

/* Menu a tutto schermo */
.site-menu {
  position: fixed;
  inset: 0;
  width: 100%; height: 100%;
  max-width: none; max-height: none;
  margin: 0; padding: 0;
  border: 0;
  overflow-y: auto;
  background: var(--rust);
  color: var(--cream);
}
.site-menu::backdrop { background: #211b17aa; }
.site-menu[open] { display: flex; flex-direction: column; }
.menu-top {
  height: var(--header);
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #f5efe540;
}
.menu-top img { width: 132px; height: auto; }
.menu-close {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 0 8px 12px;
  border: 0;
  background: none;
  font-weight: 600;
}
.mobile-nav { display: grid; align-content: start; gap: 0; padding-block: 22px; flex: 1; }
.mobile-nav a {
  padding: 3px 0;
  font-family: var(--heading);
  font-size: clamp(30px, 5.4vh, 52px);
  font-weight: 600;
  font-stretch: 88%;
  line-height: 1.15;
  letter-spacing: -.035em;
}
.mobile-nav a:hover, .mobile-nav a[aria-current] { color: var(--honey); }
.mobile-nav a[aria-current] { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 8px; }
.menu-bottom {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 20px 28px;
  border-top: 1px solid #f5efe540;
  font-size: 15px;
}
.menu-bottom p { max-width: 42ch; }

/* Schede servizio */
.card-image {
  display: block;
  width: 100%;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: var(--paper);
}
.card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
a.card-image:hover img, button.card-image:hover img { transform: scale(1.03); }

.card-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  margin-bottom: 10px;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
}
.card-heading .icon { width: 22px; height: 22px; margin-top: 4px; transition: transform var(--fast) var(--ease); }
button.card-heading:hover .icon { transform: rotate(90deg); }
a.card-heading:hover .icon { transform: translateX(4px); }
.card-heading:hover h3 { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px; }

.service-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 52px 28px; }
.service-card .card-image { aspect-ratio: 8 / 5; margin-bottom: 22px; }
.service-card p { font-size: 17px; color: #574a40; max-width: 42ch; }
.service-card .inline-link { margin-top: 10px; font-size: 16px; }
.service-grid--two { grid-template-columns: repeat(2, 1fr); }

/* Schede caffè */
.product-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 56px 28px; }
.product-card { position: relative; }
.product-card .card-image { aspect-ratio: 4 / 5; margin-bottom: 20px; }
.product-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-bottom: 8px;
  font-size: 15px;
  color: var(--muted);
}
.product-meta span + span::before { content: '/'; margin-right: 10px; color: var(--line); }
.product-card h3 { font-size: clamp(26px, 2.3vw, 34px); font-stretch: 90%; }
.product-note { font-size: 17px; color: var(--muted); }
.product-price {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 15px;
  font-weight: 600;
}

/* FAQ */
.faq-list { border-top: 1px solid var(--line); }
.faq-list details { border-bottom: 1px solid var(--line); }
.faq-list summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 0;
  list-style: none;
  cursor: pointer;
  font-family: var(--heading);
  font-size: 21px;
  font-weight: 550;
  line-height: 1.35;
  letter-spacing: -.015em;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after {
  content: '';
  flex: none;
  width: 32px; height: 32px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background:
    linear-gradient(currentColor, currentColor) center / 12px 1.5px no-repeat,
    linear-gradient(currentColor, currentColor) center / 1.5px 12px no-repeat;
  transition: transform var(--fast) var(--ease), background-color var(--fast);
}
.faq-list details[open] summary::after { transform: rotate(45deg); background-color: var(--paper); }
.faq-list summary:hover { color: var(--rust); }
.faq-answer { max-width: 66ch; padding: 0 56px 26px 0; color: var(--muted); font-size: 17px; }

/* Moduli */
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field--full { grid-column: 1 / -1; }
.field label { font-size: 16px; font-weight: 600; }
.field label small { font-weight: 400; font-size: 15px; opacity: .85; }
.field input, .field select, .field textarea {
  width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid #817165;
  border-radius: var(--radius-sm);
  background: var(--cream);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.5;
}
.field select {
  appearance: none;
  padding-right: 44px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 22px) 52%, calc(100% - 16px) 52%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
}
.field textarea { min-height: 120px; resize: vertical; }
.field-error { font-size: 15px; font-weight: 600; line-height: 1.4; color: var(--rust); }
.field-error:empty { display: none; }
.field-hint { font-size: 15px; line-height: 1.4; color: var(--muted); }
.field [aria-invalid="true"] { border-color: var(--rust); box-shadow: 0 0 0 1px var(--rust); }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 20px; margin-top: 24px; }
.form-note { margin-top: 16px; font-size: 15px; }
.form-status { margin-top: 18px; padding: 12px 16px; border-radius: var(--radius-sm); font-size: 16px; font-weight: 600; }
.form-status:empty { display: none; }
.form-next { margin-top: 10px; }

/* Newsletter */
.newsletter { padding-block: clamp(56px, 6vw, 88px); background: var(--paper); }
.newsletter-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: center; }
.newsletter h2 { font-size: clamp(30px, 3vw, 44px); margin-bottom: 14px; }
.newsletter p { color: var(--muted); }
.newsletter-row { display: flex; align-items: end; gap: 10px; }
.newsletter-row .field { flex: 1; }
.newsletter .form-status { background: var(--cream); }

/* Dialog generico (anteprime) */
.dialog {
  width: min(820px, calc(100% - 40px));
  max-height: 90svh;
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--cream);
  color: var(--ink);
  box-shadow: 0 30px 100px #0005;
}
.dialog::backdrop { background: #130f0cd9; backdrop-filter: blur(4px); }
.dialog-close {
  position: absolute;
  top: 14px; right: 14px;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--cream);
  color: var(--ink);
  box-shadow: 0 2px 10px #0002;
}
.dialog-close:hover { background: var(--paper); }
.preview-img { width: 100%; aspect-ratio: 16 / 9; max-height: 360px; object-fit: cover; }
.preview-content { padding: 40px 44px 44px; }
.preview-content h2 { font-size: clamp(28px, 3.6vw, 42px); padding-right: 36px; margin-bottom: 20px; }
.preview-content [data-preview-body] { color: #4b3f36; white-space: pre-line; max-width: 62ch; }
.preview-note { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.preview-content .button { margin-top: 24px; }
.dialog--portrait { width: min(980px, calc(100% - 40px)); }
.dialog--portrait[open] { display: grid; grid-template-columns: 2fr 3fr; }
.dialog--portrait .preview-img { aspect-ratio: 4 / 5; height: 100%; max-height: none; background: var(--paper); }
.dialog--portrait .preview-content { align-self: center; }

/* Lightbox */
.lightbox {
  width: min(1240px, calc(100% - 32px));
  max-height: 94svh;
  padding: 64px 24px 20px;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--ink);
  color: var(--cream);
}
.lightbox::backdrop { background: #100c0bf0; }
.lightbox-image { width: 100%; max-height: 72svh; object-fit: contain; }
.lightbox-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 18px; }
.lightbox-caption { font-size: 16px; color: var(--on-dark); }
.lightbox-actions { display: flex; align-items: center; gap: 12px; }
.lightbox-count { min-width: 4.5ch; font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Footer */
.site-footer { padding: 88px 0 28px; background: var(--ink); color: var(--cream); }
.footer-top { display: grid; grid-template-columns: 1.5fr 1fr 1.2fr 1.1fr; gap: 48px; }
.footer-brand img { width: 190px; height: auto; margin-bottom: 24px; }
.footer-brand p { max-width: 32ch; color: var(--on-dark); font-size: 16px; }
.footer-col h2 { margin-bottom: 18px; font-family: var(--body); font-size: 16px; font-weight: 600; letter-spacing: 0; color: var(--honey); }
.footer-col ul { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.footer-col a, .footer-col p { font-size: 16px; color: var(--on-dark); }
.footer-col a:hover { color: var(--cream); text-decoration: underline; text-underline-offset: 4px; }
.footer-col p + p { margin-top: .5em; }
.footer-col .inline-link { color: var(--cream); margin-top: 6px; }
.footer-bottom {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--on-dark-line);
  font-size: 14px;
  color: #bfae9f;
}
.footer-bottom p { max-width: 70ch; }
.footer-bottom .text-button { font-size: 14px; color: var(--cream); white-space: nowrap; }

/* Pulsanti flottanti */
.floating-contact,
.back-top {
  position: fixed;
  bottom: 22px;
  z-index: 25;
  border: 1px solid var(--line);
  background: var(--cream);
  color: var(--ink);
  box-shadow: 0 4px 18px #211b171f;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity var(--fast), transform var(--fast) var(--ease), visibility 0s linear var(--fast), background var(--fast);
}
.floating-contact.is-visible,
.back-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity var(--fast), transform var(--fast) var(--ease), visibility 0s, background var(--fast);
}
.floating-contact {
  right: 22px;
  display: none;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
}
.floating-contact:hover { background: var(--honey); }
.floating-contact .icon { width: 20px; height: 20px; }
.back-top {
  left: 22px;
  display: grid;
  place-items: center;
  width: 48px; height: 48px;
  border-radius: 50%;
}
.back-top:hover { background: var(--paper); }
.back-top .icon { width: 20px; height: 20px; }

/* Adattamenti */
@media (min-width: 1600px) {
  .desktop-nav { gap: 38px; }
}

/* Sul desktop il contatto flottante non c'è: il torna su va a destra, lontano dall'inizio delle righe. */
@media (min-width: 1151px) {
  .back-top { left: auto; right: 22px; }
}

@media (max-width: 1150px) {
  .desktop-nav, .header-cta { display: none; }
  .menu-toggle { display: flex; }
  .header-inner { gap: 0; }
  .floating-contact { display: flex; }
  .footer-top { grid-template-columns: 1.3fr 1fr; gap: 44px; }
}

@media (max-width: 900px) {
  .service-grid, .product-grid { grid-template-columns: repeat(2, 1fr); }
  .newsletter-inner { grid-template-columns: 1fr; gap: 26px; }
}

@media (max-width: 540px) {
  .brand, .brand img, .menu-top img { width: 112px; }
  .button { min-height: 50px; padding: 12px 18px; }
  .service-grid { grid-template-columns: 1fr; gap: 40px; }
  .product-grid { gap: 36px 14px; }
  .product-card .card-image { margin-bottom: 14px; }
  .product-card h3 { font-size: 23px; }
  .product-meta { font-size: 13px; gap: 0 8px; }
  .product-meta span + span::before { margin-right: 8px; }
  .product-note { font-size: 15px; }
  .product-price { font-size: 13px; gap: 8px; }
  .card-heading { gap: 8px; }
  .card-heading .icon { width: 18px; height: 18px; }
  .faq-list summary { font-size: 19px; padding: 20px 0; gap: 16px; }
  .faq-answer { padding-right: 8px; }
  .field-grid { grid-template-columns: 1fr; }
  .newsletter-row { flex-direction: column; align-items: stretch; }
  .newsletter-row .button { align-self: start; }
  .dialog { width: calc(100% - 24px); }
  .preview-content { padding: 26px 22px 28px; }
  .dialog--portrait[open] { display: block; }
  .dialog--portrait .preview-img { aspect-ratio: auto; height: 300px; object-fit: contain; }
  .lightbox { width: calc(100% - 16px); padding: 64px 10px 16px; }
  .lightbox-footer { flex-direction: column; align-items: start; }
  .lightbox-caption { font-size: 14px; }
  .site-footer { padding-top: 64px; }
  .footer-top { grid-template-columns: 1fr 1fr; gap: 36px 20px; }
  .footer-brand, .footer-col--contact { grid-column: 1 / -1; }
  .footer-brand img { width: 160px; }
  .footer-bottom { flex-direction: column; gap: 12px; padding-bottom: 64px; }
  .floating-contact { right: 14px; bottom: 14px; }
  .back-top { left: 14px; bottom: 14px; }
}
