/* Portrait layout: the landscape desktop composition remains untouched. */
@media (max-width: 700px) and (orientation: portrait) {
  html, body { min-height: 100%; }
  body { min-height: 100svh; overflow-x: hidden; overflow-y: auto; }

  .menu-switcher { top: 10px; right: 68px; }
  .language-switcher { top: 10px; right: 10px; }

  /* Landing page: keep the video full-width and let the page scroll naturally. */
  body:has(.video-frame video) {
    min-height: 100svh;
    display: flex;
    flex-direction: column;
  }
  body:has(.video-frame video) main {
    flex: 1 0 auto;
    width: calc(100% - 24px);
    padding: 64px 0 34px;
  }
  body:has(.video-frame video) .brand,
  body:has(.film-frame) .masthead {
    width: min(264px, 86vw);
    height: 82px;
    margin-bottom: 14px;
  }
  body:has(.video-frame video) .video-frame {
    width: 100%;
    aspect-ratio: 16 / 9;
  }
  body:has(.video-frame video) .discover {
    flex-direction: column;
    align-items: center;
    gap: 3px;
    margin-top: 16px;
    font-size: clamp(16px, 4.5vw, 20px);
  }
  body:has(.video-frame video) .copyright-notice {
    position: static;
    transform: none;
    margin: auto auto 8px;
  }

  /* Cabin tour: stack the video above two compact rows of photo choices. */
  body:has(.film-frame) {
    min-height: 100svh;
    display: flex;
    flex-direction: column;
  }
  body:has(.film-frame) main {
    flex: 1 0 auto;
    width: calc(100% - 24px);
    padding: 64px 0 30px;
  }
  body:has(.film-frame) .showcase {
    left: auto;
    width: 100%;
    transform: none;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto 1fr;
    gap: 9px;
  }
  body:has(.film-frame) .film-frame {
    grid-column: 1 / -1;
    grid-row: 1;
    width: 100%;
    aspect-ratio: 4 / 3;
  }
  body:has(.film-frame) .feature-list {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
    gap: 8px;
  }
  body:has(.film-frame) .feature-list:first-of-type { grid-column: 1; grid-row: 2; }
  body:has(.film-frame) .feature-list:last-of-type { grid-column: 2; grid-row: 2; }
  body:has(.film-frame) .bed-feature { order: 1; }
  body:has(.film-frame) .bath-feature { order: 2; }
  body:has(.film-frame) .location-feature { order: 3; }
  body:has(.film-frame) .feature {
    height: auto;
    min-height: 58px;
    flex: 1 1 0;
  }
  body:has(.film-frame) .feature {
    min-height: 58px;
    padding: 9px 6px;
    font-size: 14px;
  }
  body:has(.film-frame) .request {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: baseline;
    gap: 0 .35em;
    white-space: normal;
    margin-top: 16px;
  }
  body:has(.film-frame) .request-link,
  body:has(.film-frame) .request p { font-size: 14px; }
  body:has(.film-frame) .request-link { padding-bottom: 0; }
  body:has(.film-frame) .request p { text-align: center; }
  body:has(.film-frame) .request-forward {
    display: inline-block;
    margin-left: 2px;
    color: #24577d;
    font: 18px/1 Arial, Helvetica, sans-serif;
    text-decoration: none;
  }
  body:has(.film-frame) .copyright-notice {
    position: static;
    transform: none;
    margin: auto auto 8px;
  }

  /* Interior pages use a photo-led header and a readable white content sheet. */
  body:has(.panel) {
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
  body:has(.panel) .backdrop {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100svh;
    object-fit: cover;
  }
  body:has(.panel) .panel {
    position: relative;
    inset: auto;
    width: min(560px, calc(100% - 24px));
    min-width: 0;
    min-height: 68svh;
    height: auto;
    margin: 27svh auto 0;
    padding: 12px 18px 22px;
    border-radius: 16px;
    overflow: visible;
    box-shadow: 0 10px 34px rgba(15, 33, 42, .22);
  }
  body:has(.panel) .brand {
    width: min(273px, 82vw);
    height: 80px;
    flex: 0 0 80px;
    margin-bottom: 4px;
  }
  body:has(.panel) .page-nav {
    flex: 0 0 auto;
    margin-top: 20px;
    padding-top: 12px;
    border-top: 1px solid #e4e9e8;
  }
  body:has(.panel) .page-nav a {
    font-size: 10px;
    line-height: 1.4;
  }
  body:has(.panel) .copyright-notice {
    position: relative;
    left: auto;
    bottom: auto;
    transform: none;
    width: max-content;
    max-width: calc(100% - 24px);
    margin: 10px auto 0;
    padding: 3px 7px;
    border-radius: 3px;
    background: rgba(22, 37, 43, .5);
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .85);
  }

  body:is(:has(.contact-content), :has(.map-frame)) {
    /* Crop the contact photo just below the boat and match both panel edges. */
    --contact-photo-height: 46vw;
    --contact-panel-height: calc(64svh + clamp(190px, 33svh, 310px) - var(--contact-photo-height));
  }

  /* Contact page: photo first, then the white form card, then copyright. */
  body:has(.contact-content) {
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
  }
  body:has(.contact-content) .backdrop {
    position: relative;
    inset: auto;
    display: block;
    width: 100%;
    height: var(--contact-photo-height);
    flex: 0 0 var(--contact-photo-height);
    object-fit: cover;
    object-position: 78% 29%;
  }
  body:has(.contact-content) .panel {
    position: relative;
    inset: auto;
    box-sizing: border-box;
    width: min(560px, calc(100% - 20px));
    min-width: 0;
    min-height: 0;
    height: var(--contact-panel-height);
    flex: 0 0 var(--contact-panel-height);
    margin: 0 auto;
    padding: 8px 16px 12px;
    border-radius: 0 0 14px 14px;
    overflow: visible;
  }
  body:has(.contact-content) .brand {
    width: min(264px, 86vw);
    height: 82px;
    flex: 0 0 82px;
    margin-bottom: 8px;
  }
  body:has(.contact-content) .contact-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    justify-content: safe center;
    gap: 8px;
    padding: 2px 0 6px;
  }
  body:has(.contact-content) .contact-intro { font-size: 14px; }
  body:has(.contact-content) .contact-note { font-size: 13px; }
  body:has(.contact-content) .contact-form { gap: 7px; }
  body:has(.contact-content) .contact-form input { height: 38px; }
  body:has(.contact-content) .phone-control select { min-height: 38px; }
  body:has(.contact-content) .contact-form textarea { min-height: 58px; }
  body:has(.contact-content) .contact-privacy { font-size: 10px; }
  body:has(.contact-content) .contact-submit { min-height: 38px; }
  body:has(.contact-content) .page-nav {
    padding-top: 16px;
    border-top: 1px solid #e4e9e8;
  }
  body:has(.contact-content) .copyright-notice {
    position: static;
    left: auto;
    bottom: auto;
    transform: none;
    width: max-content;
    max-width: calc(100% - 20px);
    margin: 4px auto 0;
    padding: 0;
    background: transparent;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .7);
  }

  /* Legal/map page follows the same photo, white card, copyright order. */
  body:has(.map-frame) {
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
  }
  body:has(.map-frame) .backdrop {
    position: relative;
    inset: auto;
    display: block;
    width: 100%;
    height: var(--contact-photo-height);
    flex: 0 0 var(--contact-photo-height);
    object-fit: cover;
    object-position: 60% 75%;
  }
  body:has(.map-frame) .panel {
    position: relative;
    inset: auto;
    box-sizing: border-box;
    width: min(560px, calc(100% - 20px));
    min-width: 0;
    min-height: 0;
    height: var(--contact-panel-height);
    flex: 0 0 var(--contact-panel-height);
    margin: 0 auto;
    padding: 8px 16px 12px;
    border-radius: 0 0 14px 14px;
    overflow: visible;
  }
  body:has(.map-frame) .brand {
    width: min(264px, 86vw);
    height: 82px;
    flex: 0 0 82px;
    margin-bottom: 8px;
  }
  body:has(.map-frame) .map-frame {
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    aspect-ratio: 1.15 / 1;
    margin: 4px 0 10px;
  }
  body:has(.map-frame) .map-info-card {
    top: 8px;
    left: 8px;
    width: min(64%, 270px);
    padding: 10px;
  }
  body:has(.map-frame) .map-info-title { font-size: 15px; }
  body:has(.map-frame) .map-info-address,
  body:has(.map-frame) .map-info-email { font-size: 11px; }
  body:has(.map-frame) .open-maps { min-height: 34px; padding: 0 11px; font-size: 11px; }
  body:has(.map-frame) .map-links-space { flex: 0 0 auto; min-height: 72px; }
  body:has(.map-frame) .page-nav {
    padding-top: 16px;
    border-top: 1px solid #e4e9e8;
  }
  body:has(.map-frame) .copyright-notice {
    position: static;
    left: auto;
    bottom: auto;
    transform: none;
    width: max-content;
    max-width: calc(100% - 20px);
    margin: 4px auto 0;
    padding: 0;
    background: transparent;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .7);
  }
}

@media (max-width: 380px) and (orientation: portrait) {
  body:has(.panel) .panel { width: calc(100% - 18px); padding-inline: 14px; }
  body:has(.map-frame) .map-info-card { width: 68%; }
}

/* Anchor the contact and legal navigation to the same panel edge. */
body:is(:has(.contact-content), :has(.map-links-space)) .page-nav {
  flex: 0 0 auto;
  margin-top: auto;
  align-items: last baseline;
}

body:has(.map-links-space) .map-frame {
  min-height: 0;
}

body:has(.map-links-space) .map-links-space {
  flex-shrink: 0;
  min-height: max-content;
}
    
@media (orientation: landscape) {
  .menu-switcher .site-menu {
    width: 202px;
    height: 184px;
  }

  .menu-switcher .site-menu-link {
    line-height: 18px;
  }
}

/* Contact page on phones with a short visible height (e.g. Safari with toolbars):
   tighter spacing so the whole card fits without scrolling. */
@media (max-width: 700px) and (orientation: portrait) and (max-height: 860px) {
  body:is(:has(.contact-content), :has(.map-frame)) { --contact-photo-height: 42vw; }
  body:has(.contact-content) .brand { margin-bottom: 0; }
  body:has(.contact-content) .contact-content { gap: 5px; padding: 0 0 4px; }
  body:has(.contact-content) .contact-intro { font-size: 13px; line-height: 1.35; }
  body:has(.contact-content) .contact-note { font-size: 12px; line-height: 1.35; }
  body:has(.contact-content) .contact-form { gap: 5px; }
  body:has(.contact-content) .contact-form input { height: 34px; }
  body:has(.contact-content) .phone-control select { min-height: 34px; height: 34px; }
  body:has(.contact-content) .contact-form textarea { min-height: 44px; height: 44px; }
  body:has(.contact-content) .contact-submit { min-height: 34px; }
  body:has(.contact-content) .page-nav { padding-top: 10px; }
}

/* Contact page on phones: if the card content is taller than the space,
   let the card grow and the whole page scroll (no hidden inner scrolling). */
@media (max-width: 700px) and (orientation: portrait) {
  body:has(.contact-content) .panel {
    height: auto;
    min-height: var(--contact-panel-height);
    flex: 0 0 auto;
  }
  body:has(.contact-content) .contact-content {
    overflow-y: visible;
    min-height: auto;
  }
}

/* Wider screens (desktop, tablets): keep the copyright at the bottom of the
   screen, but let it move below the content instead of overlapping it when
   the visible height is short (e.g. iPad in landscape with Safari toolbars). */
@media not all and (max-width: 700px) and (orientation: portrait) {
  body:has(.video-frame video),
  body:has(.film-frame) {
    min-height: 100svh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
  }
  body:has(.video-frame video) main,
  body:has(.film-frame) main {
    flex: 1 0 auto;
  }
  body:has(.video-frame video) .copyright-notice,
  body:has(.film-frame) .copyright-notice {
    position: static;
    left: auto;
    bottom: auto;
    transform: none;
    align-self: center;
    margin: 0 auto 8px;
  }
}

/* Contact page on wide but short screens (tablets in landscape, low browser windows):
   tighter form, and if it still doesn't fit, the card grows and the page scrolls
   normally instead of hiding content inside the card. */
@media (min-width: 701px) and (max-height: 760px) {
  body:has(.contact-content) .contact-content { gap: 5px; padding: 2px 0; overflow: visible; flex: 1 0 auto; }
  body:has(.contact-content) .contact-intro { font-size: 14px; line-height: 1.35; }
  body:has(.contact-content) .contact-form { gap: 5px; }
  body:has(.contact-content) .contact-form input { height: 34px; }
  body:has(.contact-content) .phone-control select { height: 34px; }
  body:has(.contact-content) .contact-form textarea { min-height: 44px; height: 44px; }
  body:has(.contact-content) .contact-submit { min-height: 34px; }
  body:has(.contact-content) .contact-privacy { font-size: 11px; }
  body:has(.contact-content) .contact-note { font-size: 13px; line-height: 1.35; }
  body:has(.contact-content) { overflow: auto; padding-top: 4vh; padding-top: 4svh; }
  body:has(.contact-content) .panel {
    position: relative;
    top: auto;
    bottom: auto;
    left: auto;
    margin: 0 0 0 4vw;
    min-height: 92vh;
    min-height: 92svh;
  }
  body:has(.contact-content) .copyright-notice {
    position: relative;
    bottom: auto;
    margin: max(2px, calc(4vh - 22px)) 0 8px;
    margin: max(2px, calc(4svh - 22px)) 0 8px;
  }
}

/* Cabin tour on tablets/wide screens in landscape: size the video by the visible
   height (svh) and always leave room for readable photo tiles at the sides. */
@media (min-width: 761px) and (orientation: landscape) {
  body:has(.film-frame) .showcase {
    grid-template-columns: minmax(0, 1fr) minmax(0, min(1200px, 120vh, calc((100svh - 220px) * 16 / 9), calc(100vw - 48px - 2 * 150px - 20px))) minmax(0, 1fr);
  }
  body:has(.film-frame) .feature {
    min-height: clamp(120px, 18svh, 170px);
    flex-basis: clamp(120px, 18svh, 170px);
  }
}
@media (min-width: 761px) and (orientation: landscape) and (max-height: 850px) {
  body:has(.film-frame) .feature {
    min-height: clamp(96px, 16svh, 140px);
    flex-basis: clamp(96px, 16svh, 140px);
  }
}

/* Landing page on wide screens: size the video by the visible height so logo, video,
   ENTER line and copyright all fit on the first screen (tablets with Safari toolbars). */
@media (min-width: 701px) and (orientation: landscape) {
  body:has(.video-frame video) .video-frame {
    width: min(100%, 120vh, calc((100svh - 220px) * 16 / 9));
  }
}

/* Cabin tour on tablets held upright: video full width, photo tiles below in two columns. */
@media (min-width: 761px) and (orientation: portrait) {
  body:has(.film-frame) .showcase {
    left: auto;
    transform: none;
    width: 100%;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  body:has(.film-frame) .film-frame { grid-column: 1 / -1; grid-row: 1; aspect-ratio: 16 / 9; }
  body:has(.film-frame) .feature-list { display: grid; grid-template-columns: 1fr; gap: 10px; }
  body:has(.film-frame) .feature { height: auto; min-height: 76px; flex: initial; padding: 10px 7px; }
}

/* Legal Notice page on touch devices (tablets, phones): keep the address card
   inside the map. Narrow maps get a wider, more compact card; anything that
   still doesn't fit can be scrolled inside the card instead of being cut off. */
@media (hover: none) and (min-width: 701px) {
  body:has(.map-frame) .map-info-card {
    width: min(calc(100% - 24px), calc(50% + 70px));
    padding: 12px 14px;
  }
  body:has(.map-frame) .map-info-title { font-size: 16px; margin-bottom: 4px; }
  body:has(.map-frame) .map-info-address,
  body:has(.map-frame) .map-info-email { font-size: 13px; }
  body:has(.map-frame) .map-info-email { margin-bottom: 8px; }
  body:has(.map-frame) .open-maps { min-height: 34px; padding: 0 14px; font-size: 13px; }
  body:has(.map-frame) .map-directions { margin-top: 6px; }
  body:has(.map-frame) .map-usage-note { margin-top: 6px; font-size: 10.5px; }
}
@media (hover: none) {
  body:has(.map-frame) .map-info-card {
    max-height: calc(100% - 24px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  body:has(.map-frame) .map-info-email { overflow-wrap: anywhere; }
}

/* Legal Notice card on wide but short screens: same top/bottom edges as the contact card
   (based on the visible height, so both cards line up on tablets too). */
@media (min-width: 701px) and (max-height: 760px) {
  body:has(.map-frame) .panel { top: 4svh; bottom: 4svh; }
}
