/* Foto prima di tutto: copertina, tour per ambienti, lettura a schermo intero. */
.boat-gallery-mosaic { position: relative; display: grid; grid-template-columns: 2fr 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 8px; height: 460px; border-radius: 22px; overflow: hidden; }
.boat-gallery-tile { min-width: 0; min-height: 0; border: 0; padding: 0; background: var(--foam-50); }
.boat-gallery-tile img { display: block; width: 100%; height: 100%; object-fit: cover; }
.boat-gallery-cover { grid-row: span 2; }
.gallery-all { position: absolute; bottom: 20px; right: 20px; display: flex; align-items: center; gap: 10px; min-height: 48px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 18px; background: var(--sail-white); color: var(--deep-harbour); font-size: 16px; font-weight: 600; }
.gallery-all svg { width: 18px; height: 18px; }
.gallery-total { display: none; }
.gallery-summary { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-top: 12px; font-size: 16px; color: var(--harbour-60); }
.gallery-summary button { display: inline-flex; align-items: center; gap: 9px; min-height: 48px; padding: 8px 0; border: 0; background: transparent; font-size: 16px; font-weight: 600; color: var(--deep-harbour); }
.gallery-summary svg { width: 18px; height: 18px; }

.section-nav { background: var(--deep-harbour); isolation: isolate; }
.section-nav a { position: relative; z-index: 1; color: var(--sail-white); }
.section-nav a[aria-current="location"] { background: transparent; color: var(--deep-harbour); }
.section-nav .section-indicator { display: block; position: absolute; top: 0; left: 0; z-index: 0; border-radius: 11px; background: var(--sail-white); pointer-events: none; }
.section-nav a:focus-visible { outline: 2px solid var(--sail-white); outline-offset: 3px; }

.photo-tour, .photo-viewer { position: fixed; inset: 0; width: 100%; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; border-radius: 0; overflow: hidden; box-shadow: none; }
.photo-tour[open], .photo-viewer[open] { display: flex; flex-direction: column; animation: none; }
.photo-tour { background: var(--sail-white); color: var(--deep-harbour); }
.photo-control { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; flex-shrink: 0; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; }
.photo-control svg { width: 24px; height: 24px; }
.tour-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-shrink: 0; min-height: 80px; padding: 12px 40px; border-bottom: 1px solid var(--line); }
.tour-header p { margin: 0 auto 0 0; font-family: var(--font-display); font-size: 19px; font-weight: 700; }
.tour-index-button { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 8px 0 8px 16px; border: 0; background: transparent; font-size: 16px; font-weight: 600; color: var(--deep-harbour); }
.tour-index-button svg { width: 18px; height: 18px; }
.tour-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; }
.tour-inner { width: min(1120px, calc(100% - 80px)); margin: auto; padding: 44px 0 80px; }
.tour-intro h2 { font-size: 38px; letter-spacing: -.035em; line-height: 1.15; margin: 0 0 12px; }
.tour-intro p { margin: 0; font-size: 18px; color: var(--harbour-60); }
.tour-intro h2:focus, .tour-room h3:focus { outline: none; }
.tour-shortcuts { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 18px; padding: 28px 0 36px; border-bottom: 1px solid var(--line); }
.tour-shortcut { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; padding: 0; border: 0; min-width: 0; background: transparent; color: var(--deep-harbour); text-align: left; font-size: 16px; }
.tour-shortcut img { display: block; width: 100%; aspect-ratio: 1.3; object-fit: cover; border-radius: 12px; margin-bottom: 7px; }
.tour-shortcut strong { font-weight: 650; line-height: 1.35; }
.tour-shortcut span { color: var(--harbour-60); }
.tour-room { display: grid; grid-template-columns: 200px minmax(0,1fr); align-items: start; gap: 36px; margin-top: 56px; }
.tour-room-heading { position: sticky; top: 24px; }
.tour-room-heading h3 { font-size: 26px; letter-spacing: -.025em; line-height: 1.25; margin: 0 0 8px; }
.tour-room-heading p { margin: 0; color: var(--harbour-60); font-size: 16px; }
.tour-photo-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; min-width: 0; }
.tour-photo { display: block; padding: 0; min-width: 0; border: 0; border-radius: 12px; overflow: hidden; aspect-ratio: 1.3; background: var(--foam-50); }
.tour-photo:first-child { grid-column: 1 / -1; aspect-ratio: 1.5; }
.tour-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tour-photo { position: relative; container-type: size; }
.tour-photo img.photo-rotated { position: absolute; left: 50%; top: 50%; width: 100cqh; height: 100cqw; translate: -50% -50%; }
.photo-right { rotate: 90deg; }
.photo-left { rotate: -90deg; }
.tour-photo:focus-visible { outline-offset: 4px; }

.photo-viewer { background: var(--photo-night); color: var(--sail-white); }
.viewer-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-shrink: 0; padding: 16px 32px; min-height: 80px; }
.viewer-header p { font-size: 17px; font-weight: 600; margin: 0 auto; }
.viewer-back { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 8px 0; border: 0; background: transparent; color: var(--sail-white); font-size: 16px; }
.viewer-back svg { width: 22px; height: 22px; }
.viewer-stage { position: relative; display: flex; flex: 1; align-items: center; justify-content: center; min-height: 0; overflow: hidden; padding: 0 56px; touch-action: pan-y pinch-zoom; }
.viewer-stage img { display: block; width: 100%; height: 100%; min-height: 0; max-width: 1400px; object-fit: contain; }
.viewer-stage { container-type: size; }
.viewer-stage img.photo-rotated { flex-shrink: 0; width: 100cqh; height: 100cqw; max-width: none; }
.viewer-stage[aria-busy="true"]::after { content: 'Caricamento…'; position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); padding: 8px 16px; border-radius: 8px; background: var(--photo-night); color: var(--sail-white); font-size: 16px; }
.viewer-error { padding: 24px; max-width: 380px; text-align: center; font-size: 18px; }
.viewer-footer { flex-shrink: 0; width: min(1120px,100%); margin: auto; min-height: 100px; padding: 20px 32px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.viewer-description p { margin: 0 0 6px; font-size: 17px; line-height: 1.4; }
.viewer-description span { font-size: 16px; color: var(--sea-foam); }
.viewer-arrows { display: flex; gap: 12px; flex-shrink: 0; }
.viewer-arrows .photo-control { border: 1px solid color-mix(in srgb,var(--sail-white) 40%,transparent); }
.photo-viewer button:focus-visible { outline: 2px solid var(--sail-white); outline-offset: 3px; }

@media (max-width: 760px) {
  .boat-gallery-mosaic { display: block; height: auto; aspect-ratio: 1.3; border-radius: 18px; }
  .boat-gallery-tile { display: none; }
  .boat-gallery-cover { display: block; width: 100%; height: 100%; }
  .gallery-all { bottom: 14px; right: 14px; padding: 8px 12px; gap: 8px; min-height: 44px; }
  .gallery-all > span:not(.gallery-total) { display: none; }
  .gallery-total { display: inline; }
  .gallery-summary { font-size: 16px; padding-top: 8px; gap: 12px; }
  .gallery-summary button { font-size: 16px; gap: 6px; }
  .section-nav { margin-top: 16px; }
  .tour-header { min-height: 72px; padding: 10px 16px; gap: 8px; }
  .tour-header p { font-size: 17px; }
  .tour-index-button { padding-left: 0; }
  .tour-index-button svg { display: none; }
  .tour-inner { width: calc(100% - 40px); padding: 28px 0 48px; }
  .tour-intro h2 { font-size: 30px; }
  .tour-intro p { font-size: 17px; }
  .tour-shortcuts { display: flex; gap: 14px; overflow-x: auto; padding: 24px 0; scrollbar-width: none; scroll-snap-type: x proximity; }
  .tour-shortcuts::-webkit-scrollbar { display: none; }
  .tour-shortcut { flex: 0 0 134px; scroll-snap-align: start; }
  .tour-shortcut img { aspect-ratio: 1.3; }
  .tour-room { display: block; margin-top: 36px; }
  .tour-room-heading { position: static; margin-bottom: 18px; }
  .tour-room-heading h3 { font-size: 25px; margin-bottom: 5px; }
  .tour-photo-grid { gap: 8px; }
  .tour-photo { border-radius: 10px; }
  .tour-photo:first-child { aspect-ratio: 1.25; }
  .viewer-header { min-height: 72px; padding: 10px 16px; gap: 12px; }
  .viewer-header p { margin: 0 auto 0 0; font-size: 16px; }
  .viewer-back span { display: none; }
  .viewer-back { width: 44px; justify-content: center; }
  .viewer-stage { padding: 0; }
  .viewer-footer { padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); gap: 12px; min-height: 110px; }
  .viewer-description p { font-size: 16px; }
  .viewer-arrows { gap: 8px; }
  .viewer-arrows .photo-control { width: 44px; height: 44px; }
}
@media (prefers-reduced-motion: no-preference) {
  .section-nav.is-ready .section-indicator { transition: transform 280ms var(--ease-out), width 280ms var(--ease-out), height 280ms var(--ease-out); }
  .section-nav.is-ready a { transition: color 180ms; }
  .photo-tour[open] .tour-inner { animation: tour-reveal 240ms ease-out; }
  @keyframes tour-reveal { from { opacity: .65; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
}
@media (prefers-reduced-motion: reduce) { .tour-scroll { scroll-behavior: auto; } }
