/* FIORI DI CAMPO — MOBILE LAYOUT SYSTEM
   Foglio indipendente, caricato DOPO app.css e dopo il tema attivo.
   Tutte le correzioni sono circoscritte a tablet e dispositivi mobili.
*/

@media screen and (max-width: 1080px) {
  :root { --header-h: 82px; }

  html, body {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: clip !important;
  }

  body { position: relative; }

  img, picture, video, canvas, iframe, embed, object, svg {
    max-width: 100%;
  }

  main, #main, .page-view, .legal-page,
  .container, .section, .section > .container,
  .page-content, .legal, .legal-layout, .legal-body,
  .legal-sec, .prose, .site-footer, .footer-grid,
  .booking-grid, .contact-grid, .split, .dest,
  .post-grid, .post-card, .post-body {
    box-sizing: border-box !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .container {
    width: min(1280px, calc(100% - 36px)) !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  /* Header e menu laterale */
  .site-header, .site-header.is-scrolled {
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
  }
  .site-header .header-inner {
    width: calc(100% - 32px) !important;
    max-width: 100% !important;
    min-width: 0 !important;
    gap: 12px !important;
    justify-content: space-between !important;
  }
  .site-header .brand {
    display: block;
    flex: 0 1 auto !important;
    min-width: 0 !important;
    max-width: min(72%, 310px) !important;
  }
  .site-header .brand svg,
  .site-header .brand .logo-img {
    display: block;
    width: auto !important;
    max-width: 100% !important;
    height: clamp(42px, 10vw, 58px) !important;
  }
  .site-header .nav-toggle {
    display: flex !important;
    flex: 0 0 42px !important;
    width: 42px !important;
    min-width: 42px !important;
    align-items: center;
    justify-content: center;
    padding: 8px !important;
  }
  .site-header .nav,
  .site-header .nav.is-open {
    box-sizing: border-box !important;
    width: min(390px, 100vw) !important;
    max-width: 100vw !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    padding-left: clamp(20px, 6vw, 32px) !important;
    padding-right: clamp(20px, 6vw, 32px) !important;
  }
  .site-header .nav > a {
    display: flex !important;
    flex: 0 1 auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
    line-height: 1.4 !important;
  }
  .site-header .nav > a *,
  .site-header .nav > a font {
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
  }

  /* Regole min-size per impedire che colonne e contenuti allarghino la pagina. */
  .sec-head > *, .split > *, .dest > *, .contact-grid > *,
  .booking-grid > *, .footer-grid > *, .post-grid > *,
  .room-grid > *, .gallery-grid > *, .legal-layout > *,
  .legal-card dl > *, .info-row > *, .booking-side > *,
  .trip-results > *, .trip-stop-card > *, .trip-nearby-list > * {
    min-width: 0 !important;
    max-width: 100%;
  }

  p, li, dd, dt, address, figcaption,
  .page-sub, .post-excerpt, .trip-stop-description,
  .trip-stop-fit, .footer-about, .footer-col,
  .legal-sec, .legal-card dd, .legal-toc a {
    overflow-wrap: anywhere;
    word-break: normal;
  }

  input, select, textarea, button {
    max-width: 100%;
    box-sizing: border-box;
  }
  input:not([type="checkbox"]):not([type="radio"]),
  select, textarea {
    min-width: 0 !important;
  }

  /* Privacy e Cookie Policy: layout realmente a colonna. */
  .legal-layout {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 26px !important;
    width: 100% !important;
  }
  .legal-toc {
    position: static !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 0 8px !important;
  }
  .legal-toc ol, .legal-toc li, .legal-toc a,
  .legal-body, .legal-sec {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
  .legal-card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: hidden;
  }
  .legal-card dl {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 4px 0 !important;
    width: 100% !important;
    min-width: 0 !important;
  }
  .legal-card dt { margin-top: 12px; }
  .legal-card dt:first-child { margin-top: 0; }
  .legal-card dd, .legal-card dd a {
    display: block;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-wrap: anywhere !important;
    word-break: break-word;
  }

  /* Tabelle ordinarie: se non trasformabili, scorrono nel proprio riquadro. */
  .legal-table-wrap, .table-wrap, .table-responsive,
  .prose .table-wrap, .rich-content .table-wrap {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: auto !important;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }
  table:not(.legal-table) {
    max-width: 100%;
  }
  .rate-table {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed;
  }
  .rate-table th, .rate-table td {
    padding: 8px 6px !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }
}

@media screen and (max-width: 760px) {
  .container {
    width: calc(100% - 32px) !important;
  }

  .section { padding: 58px 0 !important; }
  .sec-head {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px !important;
    padding-bottom: 22px !important;
    margin-bottom: 30px !important;
  }
  .sec-lead, .sec-aside {
    grid-column: auto !important;
    justify-self: stretch !important;
    text-align: left !important;
  }
  .sec-aside .micro { justify-content: flex-start !important; }

  .hero-inner { width: calc(100% - 32px) !important; padding-top: 122px !important; }
  .hero h1 { font-size: clamp(2.35rem, 10vw, 4.1rem) !important; line-height: 1.04 !important; }
  .page-hero, .legal-hero {
    padding-top: calc(var(--header-h) + 32px) !important;
    padding-bottom: 38px !important;
  }
  .page-hero h1, .legal-hero h1 {
    font-size: clamp(2rem, 8.5vw, 3.5rem) !important;
    line-height: 1.08 !important;
    overflow-wrap: anywhere;
  }
  .page-sub, .legal-hero p { font-size: .98rem !important; }
  .page-cover img { height: auto !important; max-height: 58vh; aspect-ratio: 16 / 10; }
  .page-content { padding: 38px 0 58px !important; }
  .prose { width: 100% !important; max-width: 100% !important; font-size: 1rem !important; }
  .prose h2 { font-size: clamp(1.55rem, 6.5vw, 2.2rem) !important; }
  .prose h3 { font-size: clamp(1.25rem, 5vw, 1.65rem) !important; }
  .prose img, .prose video, .prose iframe { max-width: 100% !important; }
  .prose blockquote { margin-inline: 0 !important; max-width: 100% !important; }

  .split, .dest, .contact-grid, .booking-grid, .svc,
  .legal-layout, .post-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .dest-alt .dest-media { order: 0 !important; }
  .split-media { padding-bottom: 28px !important; }
  .frame-sub { right: 0 !important; width: 46% !important; }
  .contact-form, .booking-card, .platform-card, .platform-highlights {
    padding: 20px 17px !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
  .row-2, .room-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .room-card:nth-child(2) { margin-top: 0 !important; }
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; grid-auto-rows: 110px !important; gap: 9px !important; }
  .gallery-item, .gallery-item:nth-child(1), .gallery-item:nth-child(6), .gallery-item:nth-child(9) {
    grid-column: span 2 !important;
    grid-row: span 2 !important;
  }
  .post-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .post-card, .post-body, .post-media { min-width: 0 !important; max-width: 100% !important; }
  .post-media img { width: 100%; height: auto; }

  /* Privacy: tabelle a schede verticali, non due colonne compresse. */
  .legal { padding: 34px 0 64px !important; }
  .legal-layout { gap: 22px !important; }
  .legal-toc { margin-bottom: 0 !important; padding-top: 16px !important; }
  .legal-toc ol { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px; }
  .legal-toc a { font-size: .82rem !important; line-height: 1.4 !important; }
  .legal-sec { padding: 25px 0 !important; }
  .legal-sec > h2 {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: baseline !important;
    gap: 5px 10px !important;
    font-size: clamp(1.35rem, 5.8vw, 1.8rem) !important;
    line-height: 1.16 !important;
  }
  .legal-sec > h2 .n { flex: 0 0 auto !important; }
  .legal-card { padding: 17px 15px !important; }

  .legal-table-wrap {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: visible !important;
    margin-bottom: 1.25em !important;
  }
  .legal-table, .legal-table tbody, .legal-table tr, .legal-table td {
    display: block !important;
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
  .legal-table {
    table-layout: fixed !important;
    border: 0 !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    font-size: .9rem !important;
  }
  .legal-table caption {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin-bottom: 10px !important;
    line-height: 1.45 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }
  .legal-table thead { display: none !important; }
  .legal-table tbody { display: grid !important; grid-template-columns: minmax(0, 1fr) !important; gap: 10px !important; }
  .legal-table tbody tr {
    display: block !important;
    margin: 0 !important;
    padding: 7px 13px !important;
    border: 1px solid var(--line) !important;
    border-radius: 10px !important;
    background: var(--surface, #fff) !important;
    box-shadow: 0 4px 16px rgba(20, 35, 25, .045) !important;
  }
  .legal-table tbody td {
    display: block !important;
    padding: 10px 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-bottom: 1px solid var(--line) !important;
    text-align: left !important;
    white-space: normal !important;
    line-height: 1.48 !important;
    font-size: .88rem !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
  }
  .legal-table tbody td:last-child { border-bottom: 0 !important; }
  .legal-table tbody td::before {
    content: attr(data-label) !important;
    display: block !important;
    width: 100% !important;
    margin: 0 0 4px !important;
    color: var(--gold-ink, #8b672e) !important;
    font: 700 .62rem/1.35 var(--sans, Arial, sans-serif) !important;
    letter-spacing: .09em !important;
    text-transform: uppercase !important;
  }

  .footer-wordmark {
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    font-size: clamp(2.6rem, 12vw, 4.8rem) !important;
  }
  .footer-grid { grid-template-columns: minmax(0, 1fr) !important; gap: 24px !important; }
  .footer-grid > * { min-width: 0 !important; }
  .footer-bottom .container { align-items: flex-start; flex-direction: column; }
  .socials { flex-wrap: wrap; }
  .socials a { max-width: 100%; overflow-wrap: anywhere; }
  .newsletter-form { display: grid !important; grid-template-columns: minmax(0, 1fr) !important; width: 100%; }
  .newsletter-form input, .newsletter-form button { width: 100% !important; min-width: 0 !important; }

  /* Prenotazioni, calendario e moduli */
  .booking-stepper { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; gap: 4px !important; }
  .booking-stepper li { min-width: 0 !important; padding: 7px 3px !important; gap: 5px !important; flex-direction: column !important; text-align: center !important; }
  .booking-stepper li small { font-size: .62rem !important; overflow-wrap: anywhere; }
  .booking-step-actions { display: flex !important; flex-direction: column-reverse !important; align-items: stretch !important; gap: 10px !important; }
  .booking-step-actions .btn, .booking-form .btn, .contact-form .btn { width: 100% !important; max-width: 100% !important; justify-content: center !important; white-space: normal !important; }
  .booking-review dl > div { grid-template-columns: minmax(0, 1fr) !important; gap: 3px !important; }
  .cal-grid { min-width: 0 !important; width: 100% !important; grid-template-columns: repeat(7, minmax(0, 1fr)) !important; gap: 3px !important; }
  .cal-day, .cal-wd { min-width: 0 !important; padding: 5px 1px !important; font-size: .68rem !important; }
  .cal-legend { flex-wrap: wrap !important; gap: 8px 12px !important; }

  /* Itinerari e card dinamiche */
  .trip-planner, .trip-planner-builder, .trip-results,
  .trip-results-head, .trip-stop-list, .trip-nearby-section,
  .trip-nearby-list, .trip-stop-card, .trip-stop-body {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .trip-planner { padding: 17px 13px !important; }
  .trip-planner-fields, .trip-planner-controls { grid-template-columns: minmax(0, 1fr) !important; }
  .trip-interest-options { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .trip-results-head { display: grid !important; grid-template-columns: minmax(0, 1fr) !important; }
  .trip-result-badges { justify-content: flex-start !important; max-width: 100% !important; }
  .trip-result-toolbar { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 7px !important; }
  .trip-action-button { min-width: 0 !important; max-width: 100% !important; white-space: normal !important; }
  .trip-stop-card, .trip-stop-card-nearby { grid-template-columns: 27px minmax(0, 1fr) !important; gap: 9px !important; padding: 12px !important; }
  .trip-stop-media { grid-column: 2 !important; width: 100% !important; max-width: 100% !important; height: auto !important; }
  .trip-stop-media img { width: 100% !important; height: 170px !important; object-fit: cover !important; }
  .trip-stop-body { grid-column: 2 !important; }
  .trip-stop-description { max-width: 100% !important; }
  .trip-stop-actions { flex-wrap: wrap !important; gap: 10px !important; }

  /* Componenti fissi e banner: restano dentro il viewport e sopra la barra rapida. */
  .mobile-quick-nav { left: 0 !important; right: 0 !important; width: 100% !important; max-width: 100vw !important; }
  .back-to-top { right: 12px !important; bottom: calc(82px + env(safe-area-inset-bottom, 0px)) !important; }
  .fdc-concierge { left: 12px !important; right: auto !important; bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important; max-width: calc(100vw - 24px) !important; }
  .concierge-panel { width: min(360px, calc(100vw - 24px)) !important; max-width: calc(100vw - 24px) !important; }
  .cookie-banner { left: 10px !important; right: 10px !important; bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important; width: auto !important; max-width: none !important; box-sizing: border-box !important; }
  .cookie-inner { display: flex !important; flex-direction: column !important; align-items: stretch !important; gap: 14px !important; width: 100% !important; min-width: 0 !important; }
  .cookie-copy { min-width: 0 !important; max-width: 100% !important; }
  .cookie-actions { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px !important; width: 100% !important; }
  .cookie-actions .btn { min-width: 0 !important; max-width: 100% !important; white-space: normal !important; padding: 10px 8px !important; }
  .site-toast-stack { left: 12px !important; right: 12px !important; width: auto !important; max-width: none !important; bottom: calc(78px + env(safe-area-inset-bottom, 0px)) !important; }
  .site-toast { min-width: 0 !important; max-width: 100% !important; }
  .pwa-install, .network-status { max-width: calc(100vw - 24px) !important; }
}

@media screen and (max-width: 420px) {
  .container { width: calc(100% - 28px) !important; }
  .legal-toc ol { grid-template-columns: minmax(0, 1fr) !important; }
  .legal-sec > h2 { font-size: clamp(1.28rem, 5.5vw, 1.55rem) !important; }
  .legal-table tbody tr { padding: 6px 11px !important; }
  .legal-table tbody td { font-size: .84rem !important; }
  .footer-wordmark { font-size: clamp(2.35rem, 11vw, 3.5rem) !important; }
  .trip-interest-options { grid-template-columns: minmax(0, 1fr) !important; }
  .trip-result-toolbar { grid-template-columns: minmax(0, 1fr) !important; }
  .booking-stepper li small { font-size: .58rem !important; }
}

@media (prefers-reduced-motion: reduce) {
  .site-header, .site-header *, .mobile-quick-nav,
  .back-to-top, .fdc-concierge, .cookie-banner { transition: none !important; }
}
