/* Campania Senza Glutine — design tokens */
@font-face {
  font-family: "Lazydog";
  src: url("../fonts/Lazydog.otf") format("opentype"),
       url("../fonts/Lazydog.ttf") format("truetype");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --color-sea: #420000;
  --color-sea-dark: #420000;
  --color-terracotta: #d04a2a;
  --color-terracotta-soft: #e89a7a;
  --color-lemon: #ffde59;
  --color-red: #c0341d;
  --color-cream: #fdf4cf;
  --color-sand: #f7e3a0;
  --color-ink: #141414;
  --color-muted: #3a3a3a;
  --color-white: #ffffff;
  --font-display: "Lazydog", "Cormorant Garamond", Georgia, serif;
  --font-card: "Cormorant Garamond", Georgia, serif;
  --font-body: "Source Sans 3", system-ui, sans-serif;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 8px 32px rgba(66, 0, 0, 0.12);
  --header-h: 72px;
  --max-width: 1100px;
  --transition: 0.2s ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
}

body {
  margin: 0;
  width: 100%;
  max-width: 100%;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--color-ink);
  background: #ffde59;
  overflow-x: hidden;
  overscroll-behavior-x: none;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--color-sea);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--color-terracotta);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 200;
  padding: 0.75rem 1rem;
  background: var(--color-sea);
  color: var(--color-white);
  border-radius: var(--radius);
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}

.container {
  width: min(100% - 2rem, var(--max-width));
  margin-inline: auto;
}

.container.narrow {
  max-width: 640px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 222, 89, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #e9c64a;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100% - 2rem, var(--max-width));
  margin-inline: auto;
  min-height: var(--header-h);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--color-sea-dark);
}

.logo-mark {
  width: 3.75rem;
  height: 3.75rem;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 10px rgba(66, 0, 0, 0.25));
  transition: transform var(--transition);
}

.logo:hover .logo-mark {
  transform: scale(1.05);
}

.logo-text {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--color-sea-dark);
}

.logo-text em {
  font-style: italic;
  color: var(--color-sea-dark);
}

.nav ul {
  display: flex;
  gap: 1.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav a {
  font-weight: 500;
  text-decoration: none;
  color: var(--color-ink);
}

.nav a:hover {
  color: var(--color-terracotta);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.nav-toggle-bar,
.nav-toggle-bar::before,
.nav-toggle-bar::after {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-ink);
  border-radius: 2px;
  transition: var(--transition);
}

.nav-toggle-bar {
  position: relative;
}

.nav-toggle-bar::before,
.nav-toggle-bar::after {
  content: "";
  position: absolute;
  left: 0;
}

.nav-toggle-bar::before {
  top: -7px;
}

.nav-toggle-bar::after {
  top: 7px;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar {
  background: transparent;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar::before {
  top: 0;
  transform: rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar::after {
  top: 0;
  transform: rotate(-45deg);
}

/* Hero */
.hero {
  position: relative;
  min-height: clamp(420px, 70vh, 560px);
  display: flex;
  align-items: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg, rgba(255, 222, 89, 0.94) 0%, rgba(255, 222, 89, 0.82) 45%, rgba(255, 222, 89, 0.62) 100%),
    url("https://images.unsplash.com/photo-1720360572655-35bf522fcf17?fm=jpg&q=72&w=2400&auto=format&fit=crop");
  background-size: cover;
  background-position: center;
}

.hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23420000' fill-opacity='0.06'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero-content {
  position: relative;
  width: min(100% - 2rem, var(--max-width));
  margin-inline: auto;
  padding: 4rem 0;
  color: var(--color-sea-dark);
}

.hero-eyebrow {
  display: inline-block;
  margin: 0 0 1.1rem;
  padding: 0.45rem 1.1rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-lemon);
  background: var(--color-sea-dark);
  border-radius: 999px;
  box-shadow: 0 8px 22px rgba(66, 0, 0, 0.25);
}

.hero h1 {
  margin: 0 0 1.25rem;
  font-family: var(--font-display);
  font-size: clamp(2.7rem, 6.5vw, 4.25rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.hero-accent {
  color: var(--color-sea-dark);
}

.hero-lead {
  max-width: 32rem;
  margin: 0 0 2rem;
  font-size: 1.125rem;
  color: var(--color-ink);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.5rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 999px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary {
  background: var(--color-sea-dark);
  color: var(--color-lemon);
  border-color: var(--color-sea-dark);
  box-shadow: 0 10px 26px rgba(66, 0, 0, 0.28);
}

.btn-primary:hover {
  background: var(--color-red);
  border-color: var(--color-red);
  color: var(--color-white);
  transform: translateY(-2px);
}

.btn-ghost {
  background: transparent;
  color: var(--color-sea-dark);
  border-color: var(--color-sea-dark);
}

.btn-ghost:hover {
  background: var(--color-sea-dark);
  color: var(--color-lemon);
  transform: translateY(-2px);
}

/* Sections */
.section {
  padding: 4.5rem 0;
}

.section-head {
  margin-bottom: 2.5rem;
  max-width: 36rem;
}

.section-head h2 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.5rem);
  font-weight: 600;
  color: var(--color-sea-dark);
}

.section-head p {
  margin: 0;
  color: var(--color-muted);
}

.intro {
  background: transparent;
}

.intro h2 {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--color-sea-dark);
}

.intro p {
  margin: 0 0 1rem;
  color: var(--color-muted);
}

.intro p:last-child {
  margin-bottom: 0;
}

/* Filters */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.filter-btn {
  padding: 0.5rem 1.1rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-sea-dark);
  background: var(--color-white);
  border: 1.5px solid var(--color-sea-dark);
  border-radius: 999px;
  cursor: pointer;
  transition: var(--transition);
}

.filter-btn:hover {
  background: rgba(66, 0, 0, 0.08);
}

.filter-btn.is-active {
  background: var(--color-sea-dark);
  border-color: var(--color-sea-dark);
  color: var(--color-lemon);
}

/* Search bar */
.search-bar {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 1.25rem;
}

.search-icon {
  position: absolute;
  left: 1rem;
  display: flex;
  color: var(--color-muted);
  pointer-events: none;
}

#search-input {
  width: 100%;
  padding: 0.95rem 3rem 0.95rem 3rem;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--color-ink);
  background: var(--color-white);
  border: 1px solid var(--color-sand);
  border-radius: 999px;
  box-shadow: var(--shadow);
  transition: border-color var(--transition), box-shadow var(--transition);
}

#search-input:focus {
  outline: none;
  border-color: var(--color-sea);
  box-shadow: 0 0 0 4px rgba(184, 67, 31, 0.15);
}

.search-clear {
  position: absolute;
  right: 0.85rem;
  width: 28px;
  height: 28px;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--color-muted);
  background: var(--color-sand);
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

.search-clear:hover {
  color: var(--color-ink);
}

/* Controls row */
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.controls .filters {
  margin-bottom: 0;
}

.comune-select select {
  padding: 0.5rem 2rem 0.5rem 1rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-sea-dark);
  background: var(--color-white)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23b8431f' d='M6 8 0 0h12z'/%3E%3C/svg%3E")
    no-repeat right 0.9rem center;
  border: 1px solid var(--color-sand);
  border-radius: 999px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.comune-select select:focus {
  outline: none;
  border-color: var(--color-sea);
}

/* Map */
.map-wrap {
  margin: 0 0 2rem;
}

.map {
  height: 460px;
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(66, 0, 0, 0.18);
  overflow: hidden;
  z-index: 1;
}

.map-caption {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: var(--color-muted);
  text-align: center;
}

/* Segnaposto personalizzato */
.csg-pin-dot {
  display: block;
  width: 18px;
  height: 18px;
  background: var(--color-terracotta);
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
}

.popup-addr {
  font-size: 0.82rem;
  color: var(--color-muted);
}

@media (max-width: 600px) {
  .map { height: 340px; }
}

.map .leaflet-popup-content {
  font-family: var(--font-body);
  line-height: 1.5;
}

.popup-badge {
  display: inline-block;
  margin: 0.2rem 0;
  padding: 0.1rem 0.45rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-sea-dark);
  background: var(--color-sand);
  border-radius: 4px;
}

.results-count {
  margin: 0 0 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-muted);
}

.no-results {
  padding: 2rem;
  text-align: center;
  color: var(--color-muted);
  background: var(--color-white);
  border-radius: var(--radius-lg);
}

/* Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}

.card.is-hidden {
  display: none;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 40px rgba(66, 0, 0, 0.2);
}

.card-photo {
  position: relative;
  aspect-ratio: 16 / 10;
  background-size: cover;
  background-position: center;
}

.card-body {
  display: flex;
  flex-direction: column;
  padding: 1.4rem 1.5rem 1.5rem;
}

.card-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  display: inline-block;
  padding: 0.3rem 0.7rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1rem;
}

.tag-chip {
  padding: 0.2rem 0.6rem;
  font-family: var(--font-body);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--color-sea-dark);
  background: var(--color-lemon);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: var(--transition);
}

.tag-chip:hover {
  background: var(--color-sea-dark);
  color: var(--color-lemon);
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: auto;
}

.badge-dedicated {
  background: #d4edda;
  color: #1e5631;
}

.badge-certified {
  background: #cce5ff;
  color: #0d47a1;
}

.badge-friendly {
  background: #fff3cd;
  color: #856404;
}

.card h3 {
  margin: 0 0 0.35rem;
  font-family: var(--font-card);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--color-sea-dark);
}

.card-meta {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  color: var(--color-terracotta);
  font-weight: 500;
}

.card-address {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.card-address::before {
  content: "📍 ";
}

.card p {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  color: var(--color-muted);
}

.card-link {
  font-weight: 600;
  text-decoration: none;
}

.disclaimer {
  margin-top: 2rem;
  font-size: 0.875rem;
  color: var(--color-muted);
  font-style: italic;
}

/* Shops */
.shops {
  background: transparent;
}

.shops .shop-list li {
  border-bottom-color: rgba(66, 0, 0, 0.18);
}

.shop-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.shop-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid rgba(28, 36, 41, 0.08);
}

.shop-list li:first-child {
  padding-top: 0;
}

.shop-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.shop-list h3 {
  margin: 0 0 0.25rem;
  font-family: var(--font-card);
  font-size: 1.35rem;
  color: var(--color-sea-dark);
}

.shop-hours {
  flex-shrink: 0;
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-lemon);
  background: var(--color-sea-dark);
  border-radius: var(--radius);
}

/* Tips */
.tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
}

.tip {
  padding: 1.75rem;
  background: var(--color-white);
  border-radius: var(--radius-lg);
  border-top: 5px solid var(--color-sea-dark);
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}

.tip:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(66, 0, 0, 0.2);
}

.tip-icon {
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  margin-bottom: 0.9rem;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-lemon);
  background: var(--color-sea-dark);
  border-radius: 50%;
  line-height: 1;
}

.tip h3 {
  margin: 0 0 0.5rem;
  font-family: var(--font-card);
  font-size: 1.3rem;
  color: var(--color-sea-dark);
}

.tip p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--color-muted);
}

/* CTA */
.cta {
  text-align: center;
  background: transparent;
  border-top: 2px solid rgba(66, 0, 0, 0.18);
}

.cta h2 {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.6rem);
  color: var(--color-sea-dark);
}

.cta p {
  margin: 0 0 1.5rem;
  color: var(--color-ink);
}

.cta-note {
  color: var(--color-ink);
}

.cta-note a {
  color: var(--color-sea-dark);
  font-weight: 600;
}

.cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  justify-content: center;
}

.btn-ig {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-white);
  background: linear-gradient(45deg, #f09433, #e6683c 30%, #dc2743 55%, #cc2366 75%, #bc1888);
  border-color: transparent;
}

.btn-ig:hover {
  color: var(--color-white);
  filter: brightness(1.07);
}

.cta-note {
  margin-top: 2rem !important;
  font-size: 0.9rem;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.footer-ig {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--color-sea-dark);
  font-weight: 600;
  text-decoration: none;
}

.footer-ig:hover {
  color: var(--color-red);
}

/* Footer */
.site-footer {
  padding: 2.5rem 0;
  background: transparent;
  border-top: 2px solid rgba(66, 0, 0, 0.18);
  color: var(--color-ink);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.footer-brand {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-sea-dark);
}

.footer-copy {
  margin: 0;
  font-size: 0.875rem;
  color: var(--color-ink);
}

.footer-top {
  color: var(--color-sea-dark);
  font-weight: 600;
  text-decoration: none;
}

.footer-top:hover {
  color: var(--color-red);
}

/* Mobile */
@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
  }

  .nav {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    padding: 1.5rem;
    background: var(--color-lemon);
    border-bottom: 1px solid #e9c64a;
    transform: translateY(-120%);
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
  }

  .nav.is-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav ul {
    flex-direction: column;
    gap: 1rem;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }

  .logo-mark {
    width: 2.9rem;
    height: 2.9rem;
  }

  .section {
    padding: 3rem 0;
  }

  .hero {
    min-height: auto;
  }

  .hero-content {
    padding: 3rem 0;
  }

  .hero h1 {
    font-size: clamp(2.1rem, 9vw, 3rem);
  }

  .hero-lead {
    font-size: 1.05rem;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .hero-actions .btn,
  .cta-actions .btn {
    width: 100%;
  }

  .section-head {
    margin-bottom: 1.75rem;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .comune-select select {
    width: 100%;
  }

  .footer-links {
    flex-direction: column;
    gap: 0.75rem;
  }
}

@media (max-width: 480px) {
  .card-grid {
    grid-template-columns: 1fr;
  }

  .shop-list li {
    flex-direction: column;
    gap: 0.5rem;
  }

  .map { height: 300px; }

  .search-bar input {
    font-size: 0.95rem;
  }

  .filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.4rem;
    scrollbar-width: none;
  }
  .filters::-webkit-scrollbar { display: none; }
  .filter-btn { flex: 0 0 auto; }

  .disclaimer { font-size: 0.82rem; }
}

@media (max-width: 380px) {
  .header-inner { padding-inline: 0.25rem; }
  .logo-mark { width: 2.5rem; height: 2.5rem; }
  .hero h1 { font-size: 1.95rem; }
  .hero-lead { font-size: 0.98rem; }
  .hero-eyebrow { font-size: 0.72rem; padding: 0.4rem 0.8rem; }
  .map { height: 270px; }
  .section-head h2,
  h2 { font-size: clamp(1.5rem, 7vw, 2rem); }
  .filter-btn { font-size: 0.85rem; padding: 0.45rem 0.9rem; }
}

/* Velo di transizione in ingresso dalla intro */
.page-veil {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: radial-gradient(circle at 50% 40%, #420000 0%, #1a0400 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
}

body.is-entering .page-veil {
  opacity: 1;
  pointer-events: all;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .card:hover {
    transform: none;
  }

  .page-veil {
    display: none;
  }
}
