/* Layout shared by guest-facing pages on phones. */
@layer toni {
  @media (max-width: 767px) {
    html { scroll-padding-top: 4.75rem; }
    html body { --mobile-inset: clamp(16px, 4.35vw, 23px); }

    /* Photo cards keep one reading edge for title, occupancy, price and action. */
    html body.tour-page main :is(#case-in-vetrina,#gt-prime-case-title) .tour-card {
      border: 1px solid #cdd7cd !important;
      border-radius: 14px !important;
      background: #fffefa !important;
      padding: 0 0 13px !important;
    }
    html body.tour-page main :is(#case-in-vetrina,#gt-prime-case-title) .tour-card > .tour-frame {
      border-radius: 13px 13px 0 0 !important;
      margin: 0 0 16px !important;
    }
    html body.tour-page main :is(#case-in-vetrina,#gt-prime-case-title) .tour-card > :is(h3,p,.tour-card-action) {
      box-sizing: border-box;
      width: auto !important;
      margin-inline: var(--mobile-inset) !important;
      overflow-wrap: anywhere;
      text-align: start !important;
    }
    html body.tour-page main :is(#case-in-vetrina,#gt-prime-case-title) .tour-card > h3 {
      margin-bottom: 6px !important;
      font-size: 1.35rem !important;
      line-height: 1.22 !important;
      letter-spacing: -.03em !important;
      text-wrap: pretty;
    }
    html body.tour-page main :is(#case-in-vetrina,#gt-prime-case-title) .tour-card > p:not(.tour-price) {
      font-size: 1rem !important;
      line-height: 1.5 !important;
    }
    html body.tour-page main #case-in-vetrina > .tour-card::after { right: 16px !important; }
    html body.tour-page main #gt-prime-case-title .tour-card > .tour-card-action { min-height: 44px; }

    /* Editorial pages and property descriptions. */
    html body main :is(.dimora-prose,.tour-lead-copy p,.gt27-intro > p,.v28-article-block p,
      .gt-bv-card p,.v18-card p,.v57-card p,.inner-section details p,.gt-v138-route-body p,.gt740-detail p) {
      text-align: start !important;
      line-height: 1.6 !important;
      overflow-wrap: break-word;
    }
    html body main :is(.tour-lead-copy,.gt27-intro,.gt-v138-route-body,.v28-article-block,.dimora-head) :is(h1,h2,h3) { text-wrap: pretty; }
    html body main#contenuto .v28-article-main > .v28-article-block { padding-block: 22px !important; }
    html body main#contenuto .v28-article-main > .v28-article-block:first-child { padding-top: 0 !important; }
    html body main#contenuto .v28-article-block > h2 { margin-bottom: 12px !important; }
    html body main#contenuto .v28-article-aside a { min-height: 46px !important; }
    html body main .gt27-intro > figure.gt-pro-foto { margin-block: 20px !important; }
    html body main .gt-v138-route-body { padding: var(--mobile-inset) !important; }
    html body main .tour-lead-copy:has(+ figure) { padding: var(--mobile-inset) !important; }
    html body main .tour-lead-grid > figure > figcaption:not(:empty) { line-height: 1.45 !important; }

    /* Touch controls and date sheet. Only the month scrolls inside the open dialog. */
    html body .tour-menu[open] > nav {
      max-height: calc(100dvh - 72px - env(safe-area-inset-bottom,0px)) !important;
      overflow-y: auto !important;
      overscroll-behavior: contain;
      padding-bottom: max(14px,env(safe-area-inset-bottom,0px)) !important;
    }
    html body .tour-head .tour-menu[open] > nav a { min-height: 44px !important; box-sizing: border-box; }
    html body main :is(#tour-search,#prenotazione,.tour-form) .stay-date-field [data-open-date]:not([hidden]) {
      min-height: 46px !important;
      font-size: 1rem !important;
    }
    html body main :is(.gt27-form,.reserve-guest,.reserve-dates,.tour-form) :is(input:not([type=hidden]):not([type=checkbox]):not([type=radio]),textarea,select) {
      font-size: max(16px,1rem) !important;
    }
    html body main dialog.stay-calendar[open] {
      box-sizing: border-box !important;
      display: grid !important;
      grid-template-rows: auto auto auto minmax(0,1fr) auto !important;
      gap: 8px !important;
      inset: auto 0 0 !important;
      margin: 0 auto !important;
      width: min(100%, 38rem) !important;
      max-width: 100% !important;
      max-height: calc(100vh - 8px) !important;
      max-height: calc(100dvh - max(8px,env(safe-area-inset-top,0px))) !important;
      overflow: hidden !important;
      padding: 14px max(12px,env(safe-area-inset-right,0px)) max(10px,env(safe-area-inset-bottom,0px)) max(12px,env(safe-area-inset-left,0px)) !important;
      border-radius: 18px 18px 0 0 !important;
    }
    html body main .stay-calendar[open] > :is(header,.stay-range,.stay-months-nav,.stay-months) { margin: 0 !important; }
    html body main .stay-calendar[open] > .stay-months {
      min-height: 0 !important;
      overflow: auto !important;
      overscroll-behavior: contain;
      scroll-padding-block: 4px;
    }
    html body main .stay-calendar .stay-days button { min-height: 42px !important; }
    html body main .stay-calendar :is(.stay-close,.stay-months-nav button) { min-width: 44px !important; min-height: 44px !important; }
    html body main .stay-calendar[open] > .stay-calendar-actions {
      align-items: center !important;
      gap: 6px !important;
      min-width: 0;
      margin: 0 !important;
      padding: 8px 0 0 !important;
      background: #fff !important;
    }
    html body main .stay-calendar-actions :is([data-clear],[data-apply]) { min-height: 46px !important; }

    /* On a phone the quote has one column, with prices and additional costs visible. */
    html body.gt-dimora .dimora #prenotazione :is(.reserve-summary,.reserve-guest) { border-radius: 12px !important; }
    html body.gt-dimora .dimora #prenotazione .reserve-summary > p { font-size: 1rem !important; line-height: 1.5 !important; }
    html body.gt-dimora .dimora #prenotazione .reserve-summary > h3 { margin-bottom: 8px !important; }
    html body.gt-dimora .dimora #prenotazione .reserve-summary .gt-stay-facts dt { font-weight: 620 !important; }
    html body.gt-dimora .dimora #prenotazione .reserve-summary .gt-stay-facts dd { font-size: 1rem !important; }
    html body.gt-dimora .dimora #prenotazione .reserve-summary .mobile-disclosure {
      margin: 8px 0 0;
      padding: 0;
      border: 0;
      border-top: 1px solid #cad7cc;
    }
    html body.gt-dimora .dimora #prenotazione .mobile-disclosure summary {
      display: flex; align-items: center; justify-content: space-between; gap: 12px;
      min-height: 48px; padding: 6px 0; box-sizing: border-box; list-style: none;
      color: #204e42; font: 600 1rem/1.45 'DM Sans',sans-serif; cursor: pointer;
    }
    html body.gt-dimora .dimora #prenotazione .mobile-disclosure summary::-webkit-details-marker { display: none; }
    html body.gt-dimora .dimora #prenotazione .mobile-disclosure summary::after {
      content: ''; width: 8px; height: 8px; flex: none; margin-inline-end: 3px;
      border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg);
    }
    html body.gt-dimora .dimora #prenotazione .mobile-disclosure[open] > summary::after { transform: rotate(225deg); }
    html body.gt-dimora .dimora #prenotazione .reserve-guest label { gap: 6px !important; }
    html body.gt-dimora .dimora #prenotazione .reserve-guest form { gap: 14px !important; }
    html body.gt-dimora .dimora #prenotazione .reserve-guest .reserve-primary { min-height: 50px !important; }
  }
  @media (max-width:767px) and (max-height:480px) {
    html body main dialog.stay-calendar[open] { gap: 4px !important; padding-top: 6px !important; }
    html body main .stay-calendar[open] header p { display: none !important; }
    html body main .stay-calendar[open] .stay-range button { padding-block: 4px !important; }
  }
}
@layer toni {
  @media (max-width:767px) and (max-height:650px) {
    html body main .stay-calendar[open] header p { display: none !important; }
    html body main .stay-calendar[open] .stay-range button { padding-block: 5px !important; }
  }
  @media (min-width:520px) and (max-width:767px) and (max-height:480px) {
    html body #tour-cookie:has(.tc-options[hidden]):not([hidden]) {
      display: grid !important; grid-template-columns: minmax(0,1fr) auto; align-items: center;
      gap: 14px; left: max(8px,env(safe-area-inset-left,0px)) !important; right: max(8px,env(safe-area-inset-right,0px)) !important;
      width: auto !important; max-width: none !important; padding: 10px 14px !important;
      bottom: max(6px,env(safe-area-inset-bottom,0px)) !important;
    }
    html body #tour-cookie:has(.tc-options[hidden]) .tc-actions {
      display: grid !important; grid-template-columns: repeat(2,minmax(0,1fr)); margin: 0 !important; gap: 4px !important;
    }
    html body #tour-cookie:has(.tc-options[hidden]) button[data-choice=manage] { grid-column: 1/-1; }
    html body #tour-cookie:has(.tc-options[hidden]) button { min-height: 44px !important; }
  }
}
@layer toni {
  @media (max-width:767px) {
    html body :is(.ga-card .ga-body,.gp-photo .gp-photo-copy) {
      box-sizing: border-box; padding: var(--mobile-inset) !important;
    }
    html body :is(.guest-shell,.rule-main,.ga-body,.gp-benefit,.gp-step,.bodycopy,.press-deck) :is(p,li),
    html body[data-touring-layout=public]:has(.tour-static-head) main p {
      text-align: start !important; line-height: 1.6 !important; overflow-wrap: break-word;
    }
    html body :is(.guest-shell,.gp-form-card,.ga-toolbar) :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]),select,textarea) {
      box-sizing: border-box; min-width: 0; max-width: 100%; font-size: max(16px,1rem) !important;
    }
    html body :is(.guest-shell,.ga-actions,.gp-form-card) :is(.ga-btn,button[type=submit]) { min-height: 46px !important; }
    html body[data-touring-layout=public] :is(.photo-caption,.gp-photo-copy p) {
      line-height: 1.5 !important; overflow-wrap: break-word;
    }
  }
}
@layer toni {
  /* Prevent wide intrinsic grid tracks on the local guides and the Observatory. */
  @media (max-width:600px) {
    html body main :is(.gt-ad-request,.gt636-final-cta,.gt-container > .head,.cam-area-top,.obs-duo,.news-hook-grid) {
      grid-template-columns: minmax(0,1fr) !important;
    }
    html body main :is(.gt-ad-request,.gt636-final-cta,.gt-container > .head,.cam-area-top,.obs-duo,.news-hook-grid) > * {
      box-sizing: border-box; min-width: 0 !important; max-width: 100% !important;
    }
    html body main :is(.gt636-final-cta,.gt-ad-form,.gt-ad-preview,.cam-area-copy,.obs-highlight,.news-hook-grid) {
      padding-inline: var(--mobile-inset) !important;
    }
    html body main :is(.gt636-final-cta,.gt-ad-form,.gt-container > .head,.cam-area-copy,.obs-highlight,.news-hook-grid) :is(h2,h3,p,label,a) {
      white-space: normal !important; overflow-wrap: anywhere; text-wrap: pretty;
    }
    html body main .gt-container > .head h2 { font-size: clamp(1.65rem,7.4vw,2.3rem) !important; line-height: 1.12 !important; }
    html body main :is(.gt636-final-cta,.gt-ad-form) :is(a,input,select,textarea,button) {
      box-sizing: border-box; min-width: 0 !important; max-width: 100% !important;
    }
    html body main .gtx-beach-grid {
      display: grid !important; grid-template-columns: minmax(0,1fr) !important;
      gap: 16px !important; overflow: visible !important; scroll-snap-type: none !important;
    }
    html body main .gtx-beach-grid > .gtx-beach {
      width: auto !important; min-width: 0 !important; max-width: 100% !important; grid-column: 1 !important;
    }
  }
}
