/* ==========================================================
   Versione per telefono (fino a 760 px).
   Il sito su computer non cambia: tutto è dentro la media query.
   ========================================================== */
.mbar, .mmore, .mprog, .mtoggle, .join-open { display: none; }

@media (max-width: 760px) {
  :root { --mbar: 62px; }
  body { padding-bottom: calc(var(--mbar) + env(safe-area-inset-bottom)); }
  .sec { padding-block: 52px; }
  .sec-head { margin-bottom: 22px; }
  .sec-head .lead, .lead { font-size: 1rem; }
  h2 { font-size: clamp(1.75rem, 7.4vw, 2.2rem); }

  html, body { overflow-x: clip; }
  .chap-wrap > *, .wrap > *, .atlas > *, .press > *, .dop > * { min-width: 0; }

  /* ---------- barra di navigazione in basso ---------- */
  .mbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 55;
    height: calc(var(--mbar) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: #fff; border-top: 1px solid var(--linea);
    box-shadow: 0 -6px 20px rgba(40, 49, 58, .08);
  }
  .mbar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--piode-2, #55606a); font-size: .7rem; font-weight: 600; text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }
  .mbar svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .mbar a[aria-current="true"] { color: var(--pascolo); }
  .mbar a[aria-current="true"] svg { stroke-width: 2.3; }
  .mbar a:focus-visible { outline: 2px solid var(--pascolo); outline-offset: -4px; }

  /* ---------- hero: lascia intravedere il contenuto ---------- */
  .hero { min-height: calc(86svh - 70px) !important; }
  .hero h1 { font-size: 4rem; }

  /* ---------- testi lunghi: "Leggi di più" ---------- */
  .mhide, .mhide.mhide { display: none !important; }
  .mhide + .mprog { display: none !important; }
  .mmore {
    display: inline-flex; align-items: center; gap: 6px; margin-top: 4px;
    background: none; border: 0; padding: 6px 0; font: inherit; font-weight: 700;
    color: var(--pascolo); text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
  }

  /* ---------- caroselli orizzontali ---------- */
  .themes, #dayList, #borgoList, #prodList, .stay-list, #dormire, #mete, #ecoCards, .fig2, .figrow {
    display: grid !important; grid-auto-flow: column; grid-template-columns: none !important;
    grid-template-rows: none !important; grid-auto-rows: auto !important;
    grid-auto-columns: 84%; gap: 12px;
    overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory;
    margin-inline: -18px; padding: 4px 18px 6px; scroll-padding-inline: 18px;
    scrollbar-width: none; list-style: none;
  }
  .themes::-webkit-scrollbar, #dayList::-webkit-scrollbar, #borgoList::-webkit-scrollbar,
  #prodList::-webkit-scrollbar, .stay-list::-webkit-scrollbar, #dormire::-webkit-scrollbar,
  #mete::-webkit-scrollbar, #ecoCards::-webkit-scrollbar, .fig2::-webkit-scrollbar, .figrow::-webkit-scrollbar { display: none; }
  .themes > *, #dayList > *, #borgoList > *, #prodList > *, .stay-list > *, #dormire > *,
  #mete > *, #ecoCards > *, .fig2 > *, .figrow > * { scroll-snap-align: start; min-width: 0; grid-column: auto !important; grid-row: auto !important; }

  /* barra di avanzamento sotto ogni carosello */
  .mprog { display: block; height: 3px; border-radius: 3px; background: var(--linea); margin: 10px 0 0; overflow: hidden; }
  .mprog i { display: block; height: 100%; background: var(--pascolo); border-radius: 3px; transform-origin: left; transition: transform .15s linear; }
  .mprog[hidden] { display: none; }

  /* temi della home */
  .themes { grid-auto-columns: 62%; margin-top: 28px; }
  .themes .theme { height: 230px; }

  /* "Che giornata cercate?" come schede */
  .day-tabs, .prod-tabs, .fchips, .ptabs, .board-filters, .go-tabs {
    display: flex; flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: none;
    margin-inline: -18px; padding-inline: 18px;
  }
  .day-tabs::-webkit-scrollbar, .prod-tabs::-webkit-scrollbar, .fchips::-webkit-scrollbar, .board-filters::-webkit-scrollbar { display: none; }
  .day-tabs button, .prod-tabs button, .fchips button, .board-filters button { white-space: nowrap; flex: 0 0 auto; }
  .day-head { margin-bottom: 14px; }
  #dayList > li { border: 1px solid var(--linea); border-radius: 14px; background: #fff; overflow: hidden; }
  #dayList > li > a { display: flex !important; flex-direction: column; gap: 0 !important; height: 100%; padding: 0 !important; border: 0 !important; }
  #dayList .ph { width: 100% !important; height: 150px !important; aspect-ratio: auto !important; border-radius: 0 !important; }
  #dayList .ph img { width: 100%; height: 100%; object-fit: cover; }
  #dayList .tx { padding: 14px 14px 6px; }
  #dayList .tx span { display: -webkit-box !important; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .9rem; }
  #dayList .fx { margin: auto 14px 14px !important; grid-template-columns: repeat(4, 1fr) !important; }
  #dayList > li.more { display: grid; place-items: center; background: var(--calcare); border-style: dashed; }

  /* borghi: la mappa grande sopra basta, qui solo le schede */
  #borghi .bmap-stick, #borghi .sec-head .lead { display: none !important; }
  .bmap-wrap { display: block !important; }
  #borgoList > li { border: 1px solid var(--linea); border-radius: 14px; background: #fff; overflow: hidden; opacity: 1 !important; transform: none !important; }
  #borgoList > li > a { display: flex !important; flex-direction: column; padding: 0 !important; gap: 0 !important; }
  #borgoList .ph { width: 100% !important; height: 170px !important; border-radius: 0 !important; }
  #borgoList .ph img { width: 100%; height: 100%; object-fit: cover; }
  #borgoList .tx { padding: 14px; }
  #borgoList .tx span { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

  /* produttori e locali */
  #prodList .pcard, #food .fcard { height: 100%; display: flex; flex-direction: column; }
  #prodList .p-d, #food .fcard p { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
  #prodList .p-acts, #food .fcard .acts { margin-top: auto; padding-top: 12px; }
  .dop { margin-top: 36px; }
  .dop-img img { height: 210px; width: 100%; object-fit: cover; }

  /* dormire */
  #dormire .baita .ph img { height: 180px; width: 100%; object-fit: cover; }
  #dormire .baita dl { font-size: .88rem; }
  .callout { padding: 22px !important; }
  #mangiare { margin-top: 56px !important; }
  .food-note { font-size: .95rem; }

  /* mappa: più bassa, pannello apribile */
  .atlas #map { height: 58svh !important; min-height: 340px !important; }
  .mtoggle {
    display: flex; width: 100%; justify-content: space-between; align-items: center;
    padding: 14px 16px; background: #fff; border: 0; border-top: 1px solid var(--linea);
    font: inherit; font-weight: 700; color: var(--piode); cursor: pointer;
  }
  .mtoggle::after { content: ""; width: 9px; height: 9px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform .2s; margin-top: -4px; }
  .mtoggle[aria-expanded="true"]::after { transform: rotate(-135deg); margin-top: 4px; }
  .atlas-panel.mclosed { display: none !important; }
  #mappa .sec-head .btn { display: none; }

  /* modulo di adesione chiuso finché non serve */
  .join.mclosed > :not(h3):not(.join-type):not(.join-open):not([type="hidden"]) { display: none !important; }
  .join-open { display: inline-flex; margin-top: 14px; }
  .press figure > img { max-height: 240px; width: 100%; object-fit: cover; }

  .go-tabs button { white-space: nowrap; flex: 0 0 auto; }
  .press { display: flex !important; flex-direction: column; gap: 28px; }
  .press > figure { order: 2; }

  /* piè di pagina: la barra in basso sostituisce i menu */
  footer .f-top > div:nth-child(2), footer .f-top > div:nth-child(3) { display: none; }

  /* storia: indice dei capitoli che scorre */
  .toc {
    position: sticky !important; top: 70px; z-index: 6; background: var(--calcare, #eef1ee);
    flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: none;
    margin-inline: -18px; padding: 10px 18px !important;
  }
  .toc::-webkit-scrollbar { display: none; }
  .toc b { display: none; }
  .toc a { flex: 0 0 auto; white-space: nowrap; background: #fff; }
  .chapter { scroll-margin-top: 140px; }
  .chapter { padding-block: 22px 26px !important; margin-bottom: 18px !important; }
  .chapter .era { font-size: 2.2rem; }
  .board { columns: 2 !important; column-gap: 12px !important; }
  .board .pin-photo { padding: 6px 6px 10px; margin-bottom: 14px; }
  .board .pin-photo figcaption { font-size: .78rem; line-height: 1.3; }
  .fig2, .figrow { grid-auto-columns: 86%; }
  .figrow img, .figrow figure.tall img { height: 340px !important; width: 100%; object-fit: cover; }
  .fig, .fig img { max-width: 100%; }
  .fig img { max-height: 62svh !important; width: 100%; object-fit: contain; }
  main table { display: block; overflow-x: auto; }
  .fig2 img { height: 260px; object-fit: cover; }
  .board .pin-photo.mhide { display: none !important; }

  /* sentieri */
  #mete .card, #ecoCards .card { height: 100%; }
}
