/* =========================
   FONT
========================= */
@font-face {
  font-family: "StackSans";
  src: url("StackSansText-VariableFont_wght.ttf") format("truetype");
}

@font-face {
  font-family: "Sartoriale";
  src: url("sartoriale.otf") format("truetype");
}

/* =========================
   VARIABILI COLORI PANEL
========================= */
#panel-about {
  --panel-bg: #eae9ec;
  --panel-fg: #35231c;
}
#panel-takeaway {
  --panel-bg: #35231c;
  --panel-fg: #d4b0b8;
}
#panel-catering {
  --panel-bg: #939c82;
  --panel-fg: #35231c;
}
#panel-homechef {
  --panel-bg: #f15c22;
  --panel-fg: #35231c;
}
#panel-corsi {
  --panel-bg: #563554;
  --panel-fg: #939c82;
}

/* =========================
   RESET & BASE
========================= */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  font-size: 16px;
}
img {
  max-width: 100%;
  display: block;
}

body {
  font-family: "StackSans", sans-serif;
  display: flex;
  flex-direction: column;
  height: 100dvh; /* altezza fissa = viewport, navbar sempre in fondo */
  overflow: hidden; /* evita scroll sul body */
}
@supports not (height: 100dvh) {
  body {
    height: 100vh;
  }
}
/* =========================
   LAYOUT
========================= */
.main-content {
  flex: 1 1 0; /* prende tutto lo spazio tra header e navbar */
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

.section-panel {
  display: none;
}
.section-panel.active {
  display: flex;
  flex-direction: column;
  min-height: 100%; /* si allunga a riempire main-content */
}

/* L'ultima sezione (gallery) viene sempre spinta verso il basso */
.section-panel.active > section:last-child {
  margin-top: auto;
}

/* =========================
   NAVBAR BOTTOM — sempre in fondo
========================= */
.bottom-nav {
  flex-shrink: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.nav-row {
  display: flex;
  align-items: center;
  padding: 7px 12px;
  cursor: pointer;
  border: none;
  width: 100%;
  text-align: left;
  font-family: "StackSans", sans-serif;
  font-size: 1rem;
  font-weight: normal;
  text-transform: lowercase;
  transition: filter 0.15s;
  line-height: 1.2;
}

.nav-row.active {
  text-transform: uppercase;
}
.nav-row:hover {
  filter: brightness(0.88);
}

.nav-row[data-section="home"] {
  background-color: #d4b0b8;
  color: #222;
}
.nav-row[data-section="about"] {
  background-color: #eae9ec;
  color: #35231c;
}
.nav-row[data-section="takeaway"] {
  background-color: #35231c;
  color: #d4b0b8;
}
.nav-row[data-section="catering"] {
  background-color: #939c82;
  color: #35231c;
}
.nav-row[data-section="homechef"] {
  background-color: #f15c22;
  color: #35231c;
}
.nav-row[data-section="corsi"] {
  background-color: #563554;
  color: #939c82;
}

.nav-row-img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  border-radius: 2px;
  margin-right: 8px;
  flex-shrink: 0;
}
.nav-row-img[src=""] {
  display: none;
}

/* Credit nella navbar */
.nav-credit {
  background-color: #ff0000;
  color: #000000;
  font-size: 0.64rem;
  text-align: center;
  padding: 6px 1rem;
  font-family: "StackSans", sans-serif;
}
.nav-credit a {
  color: #000000;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.nav-credit a:hover {
  color: #000000;
}

/* =========================
   HOME — HERO
   Riempie la prima schermata visibile, poi scrollando
   arriva la sezione esperienze.
========================= */
#panel-home {
  background-color: #d4b0b8;
}

.hero-section {
  background-color: #d4b0b8;
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1rem;
}

@supports not (min-height: 100svh) {
  .hero-section {
    min-height: 100vh;
  }
}

.hero-visual {
  position: relative;
  width: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 0;
}

.hero-illustration {
  width: 100%;
  object-fit: contain;
  padding-bottom: 5rem;
}
.hero-logo {
  position: absolute;
  width: 50%;
  max-width: 200px;
  height: auto;
  left: 50%;
  top: 40%;
  animation: rotateLogo 8s linear infinite;
}

@keyframes rotateLogo {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}
.hero-wrapper {
  overflow: hidden;
  width: 100%;
}

.hero-text {
  font-size: 20px;
  color: #2e1600;
  font-weight: bold;
  white-space: nowrap;
  display: inline-block;
  animation: scrollText 10s linear infinite;
}

@keyframes scrollText {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}

/* =========================
   HOME — ESPERIENZE
========================= */
.esperienze-section {
  background-color: #624f41;
  color: #d4b0b8;
  padding: 0;
}

.esperienze-title {
  text-align: center;
  font-size: 1.2rem;
  padding: 1.2rem 1rem 1rem;
}

/* Mobile: colonna verticale */
.esperienze-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.card-experience {
  background: transparent;
  border: 2px solid #d4b0b8;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 1rem 0.8rem 0.8rem;
  position: relative;
}

.card-experience > img {
  height: 36px;
  width: auto;
  flex-shrink: 0;
  position: absolute;
  top: 0.6rem;
  left: 0.7rem;
}

.card-experience-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}
.card-experience-text {
  text-align: center;
  width: 100%;
}

.card-experience h4 {
  color: #d4b0b8;
  font-size: 1rem;
  margin-bottom: 0;
  line-height: 1.1;
  text-align: center;
}
.card-experience p {
  line-height: 1.3;
  font-size: 0.75rem;
  margin: 0;
  text-align: center;
}
.card-experience .subtitle {
  color: #cddc39;
  font-family: "Sartoriale", sans-serif;
  display: block;
  font-size: 0.85rem;
  margin-top: 0;
  text-align: center;
}
.card-experience .info-text {
  font-size: 0.7rem;
  margin-top: 0.15rem;
  color: #cddc39;
  text-align: center;
}

/* =========================
   HOME — GALLERY & BOTTONE
   aspect-ratio 4:5 su tutte le foto.
   La sezione finisce esattamente con le foto
   (padding-bottom: 0, btn subito dopo la track).
========================= */
.gallery-section {
  background-color: #624f41;
  padding: 1rem 1rem 0;
}

.gallery-track {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.gallery-track::-webkit-scrollbar {
  display: none;
}

.gallery-item {
  flex: 0 0 44vw;
  aspect-ratio: 4 / 5; /* ← 4:5 su ogni viewport */
  height: auto;
  scroll-snap-align: start;
  overflow: hidden;
  flex-shrink: 0;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Il bottone sta dentro gallery-section, subito sotto la track,
   con un padding minimo per non essere incollato */
.contattami-section {
  text-align: center;
  padding: 1.2rem 1rem;
}

.gallery-wrapper {
  position: relative;
}

.gallery-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;

  width: 50px;
  height: 50px;
  border-radius: 50%;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 30px;
  pointer-events: none; /* ← solo decorative */
}

.gallery-arrow {
  color: #000000 !important;
}

.gallery-arrow.left {
  left: 6px;
}
.gallery-arrow.right {
  right: 6px;
}

.btn-contattami {
  display: inline-block;
  padding: 10px 30px;
  border-radius: 40px;
  border: 2px solid #d4b0b8;
  background-color: #624f41;
  color: #d4b0b8;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: 0.3s;
}
.btn-contattami:hover {
  background-color: #ced202;
  color: #d4b0b8;
}

/* =========================
   SUBPAGE — STRUTTURA COMUNE
========================= */
.section-panel:not(#panel-home) {
  background-color: var(--panel-bg);
  color: var(--panel-fg);
  overflow: visible; /* ⬅️ invece di overflow-y: auto */
  padding-bottom: 0.5rem;
}

.section-panel:not(#panel-home) h1,
.section-panel:not(#panel-home) h2,
.section-panel:not(#panel-home) h3,
.section-panel:not(#panel-home) h4,
.section-panel:not(#panel-home) p,
.section-panel:not(#panel-home) div {
  color: var(--panel-fg);
}

.subpage-hero {
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0.8rem 0.3rem;
}
.subpage-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.subpage-topbar-left {
  flex: 1;
  text-align: left;
}
.subpage-topbar-center {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.subpage-topbar-right {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.subpage-icon {
  height: 40px;
  width: auto;
  object-fit: contain;
}
.subpage-title {
  font-size: 15px;
  font-weight: bold;
  line-height: 1.1;
  margin-bottom: 0.1rem;
}
.subpage-subtitle {
  font-size: 12px;
  font-style: italic;
  font-family: "Sartoriale";
  margin-top: -0.3rem;
}
.subpage-desc {
  text-align: left;
  margin-top: 1rem;
  margin-bottom: 0.3rem;
  font-size: 10px;
  line-height: 1.25;
}
.subpage-desc p {
  margin-bottom: 0.2rem;
}
.subpage-info {
  font-size: 10px;
  line-height: 1;
  text-align: left;
  margin-bottom: 0.15rem;
  font-weight: bold;
}
.subpage-info p {
  margin-bottom: 0.05rem;
  font-weight: bold;
  line-height: 1;
}

/* Subpage gallery — aspect-ratio 4:5, con 1rem padding-bottom per spazio dalla navbar */
.subpage-gallery {
  padding: 0.3rem 0.8rem 0.5rem;
  overflow: hidden;
}

.subpage-gallery .gallery-track {
  gap: 8px;
}

.subpage-gallery .gallery-item {
  flex: 0 0 40vw;
  aspect-ratio: 4 / 5;
  height: auto;
  overflow: hidden;
  flex-shrink: 0;
}

.subpage-gallery .gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* About: seconda immagine (e tutte) ben visibili.
   La gallery di about usa item più stretti per vederne di più,
   ma stessa altezza proporzionale */
#panel-about .subpage-gallery {
  padding: 0.3rem 0.8rem 1rem;
  overflow: hidden;
}

#panel-about .subpage-gallery .gallery-track {
  padding-bottom: 4px;
}

#panel-about .subpage-gallery .gallery-item {
  flex: 0 0 46vw; /* leggermente più di metà schermo → entrambe visibili */
  aspect-ratio: 4 / 5;
  height: auto;
  overflow: hidden;
  flex-shrink: 0;
}

#panel-about .subpage-topbar {
  padding: 0;
}

.btn-subpage {
  background-color: transparent;
  color: var(--panel-fg) !important;
  border: 2px solid var(--panel-fg);
  padding: 6px 16px;
  font-size: 0.75rem;
  text-decoration: none !important;
  border-radius: 50px;
  transition: all 0.3s ease;
  display: inline-block;
  white-space: nowrap;
}
.btn-subpage:hover {
  background-color: var(--panel-fg);
  color: var(--panel-bg) !important;
}

/* Spazio minimo dopo la gallery nelle subpage (bottone, ecc.) */
.subpage-after-gallery {
  padding: 0.5rem 0.8rem;
}

/* panel-corsi: testo più compatto su mobile */
#panel-corsi .subpage-title {
  font-size: 13px;
}
#panel-corsi .subpage-subtitle {
  font-size: 10px;
}
#panel-corsi .subpage-desc,
#panel-corsi .subpage-desc p,
#panel-corsi .subpage-info,
#panel-corsi .subpage-info p {
  font-size: 9.5px;
}

/* =========================
   FOOTER
========================= */
.site-footer {
  flex-shrink: 0;
  text-align: center;
  padding: 6px 1rem;
  font-size: 0.65rem;
  background-color: #1a1a1a;
  color: #888;
}
.site-footer a {
  color: #888;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s;
}
.site-footer a:hover {
  color: #ccc;
}

/* =========================================================
   TABLET  ≥ 576px
========================================================= */
@media (min-width: 576px) {
  /* Hero */
  .hero-illustration {
    width: 68%;
    max-width: 520px;
  }
  .hero-logo {
    width: 22%;
    max-width: 170px;
  }

  /* Esperienze */
  .esperienze-title {
    font-size: 1.4rem;
  }

  .esperienze-grid {
    display: flex;
    flex-direction: row;
    gap: 0;
  }

  .esperienze-grid > div {
    display: flex;
    flex: 1;
  }

  .card-experience {
    width: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
  }

  .card-experience-text {
    text-align: center;
  }
  .card-experience > img {
    height: 42px;
  }
  .card-experience h4 {
    font-size: 1.05rem;
  }
  .card-experience p {
    font-size: 0.8rem;
  }
  .card-experience .subtitle {
    font-size: 0.9rem;
  }
  .card-experience .info-text {
    font-size: 0.75rem;
  }

  /* Gallery home */
  .gallery-item {
    flex: 0 0 36vw;
  }

  /* Subpage gallery */
  .subpage-gallery {
    overflow: visible;
  }
  .subpage-gallery .gallery-item {
    flex: 0 0 32vw;
  }
  #panel-about .subpage-gallery {
    overflow: visible;
  }
  #panel-about .subpage-gallery .gallery-item {
    flex: 0 0 46vw;
  }

  /* Subpage testo */
  .subpage-title {
    font-size: 20px;
  }
  .subpage-subtitle {
    font-size: 15px;
  }
  .subpage-desc,
  .subpage-info {
    font-size: 13px;
  }
  .subpage-icon {
    height: 55px;
  }
  .btn-subpage {
    padding: 8px 20px;
    font-size: 0.85rem;
  }
  .subpage-hero {
    padding: 0.8rem;
  }
  .subpage-topbar {
    margin-bottom: 0.8rem;
  }
  .subpage-gallery {
    padding: 0.5rem 0.8rem 1rem;
  }
  #panel-about .subpage-gallery {
    padding: 0.5rem 0.8rem 1rem;
  }
  .subpage-after-gallery {
    padding: 0.8rem;
  }

  /* corsi */
  #panel-corsi .subpage-title {
    font-size: 20px;
  }
  #panel-corsi .subpage-subtitle {
    font-size: 15px;
  }
  #panel-corsi .subpage-desc,
  #panel-corsi .subpage-desc p,
  #panel-corsi .subpage-info,
  #panel-corsi .subpage-info p {
    font-size: 13px;
  }
}

/* =========================================================
   DESKTOP  ≥ 992px
   Experience cards: riga orizzontale, tutte stessa altezza
   (align-items: stretch + height: 100% sulle card)
========================================================= */
@media (min-width: 992px) {
  /* Hero */
  .hero-illustration {
    width: 52%;
    max-width: 640px;
  }
  .hero-logo {
    width: 17%;
    max-width: 200px;
  }

  /* Esperienze — riga orizzontale, altezza uguale per tutte */
  .esperienze-title {
    font-size: 1.5rem;
    padding: 1.2rem 1rem 1rem;
  }

  .esperienze-grid {
    display: flex;
    flex-direction: row;
    align-items: stretch; /* tutte le card stessa altezza */
    gap: 0;
  }

  .esperienze-grid > div {
    display: flex;
    flex: 1;
  }

  .card-experience {
    width: 100%;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
    padding: 0.8rem 0.6rem;
    gap: 0.3rem;
  }

  .card-experience > img {
    height: 40px;
    margin-bottom: 0.3rem;
    flex-shrink: 0;
  }
  .card-experience-header {
    align-items: center;
    width: 100%;
  }
  .card-experience-text {
    text-align: center;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .card-experience h4 {
    font-size: 0.95rem;
  }
  .card-experience p {
    font-size: 0.72rem;
  }
  .card-experience .subtitle {
    font-size: 0.82rem;
  }
  .card-experience .info-text {
    font-size: 0.68rem;
  }

  /* Gallery home */
  .gallery-item {
    flex: 0 0 24vw;
  }

  /* Subpage gallery */
  .subpage-gallery {
    overflow: visible;
  }
  .subpage-gallery .gallery-item {
    flex: 0 0 26vw; /* più larghe */
    max-width: 380px; /* limite elegante */
  }
  #panel-about .subpage-gallery {
    overflow: visible;
  }
  #panel-about .subpage-gallery .gallery-item {
    flex: 0 0 46vw;
    max-width: 500px;
  }

  /* Subpage testo */
  .subpage-title {
    font-size: 22px;
  }
  .subpage-subtitle {
    font-size: 16px;
  }
  .subpage-desc,
  .subpage-info {
    font-size: 13px;
  }
  .subpage-icon {
    height: 72px;
  }
  .btn-subpage {
    padding: 8px 22px;
    font-size: 0.85rem;
  }

  .btn-contattami {
    padding: 10px 36px;
    font-size: 0.95rem;
  }

  /* corsi */
  #panel-corsi .subpage-title {
    font-size: 22px;
  }
  #panel-corsi .subpage-subtitle {
    font-size: 16px;
  }
  #panel-corsi .subpage-desc,
  #panel-corsi .subpage-desc p,
  #panel-corsi .subpage-info,
  #panel-corsi .subpage-info p {
    font-size: 13px;
  }
}
