/* One layout system for narrow phones, the Duo cover/open screens and rotation.
   Breakpoints follow available space, never a user-agent or hardware pixel count. */
:root {
  --overa-safe-top: env(safe-area-inset-top, 0px);
  --overa-safe-bottom: env(safe-area-inset-bottom, 0px);
  --overa-gutter: clamp(16px, 3.5vw, 40px);
  --overa-header-size: calc(76px + var(--overa-safe-top));
}
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--overa-header-size) + 12px); }
body { min-width: 0; }
img, video, canvas, model-viewer { max-width: 100%; }
.catalog-site .site-header,
.saphire-page.saphire-studio .site-header,
.brand-header,
.aluna-viewer-page .studio-nav {
  min-height: var(--overa-header-size);
  padding-top: var(--overa-safe-top);
  padding-left: max(var(--overa-gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--overa-gutter), env(safe-area-inset-right, 0px));
}
.catalog-site .site-header .catalog-tools { flex-shrink: 0; }
.catalog-menu-actions { display: none; }
.catalog-site .site-header .catalog-icon,
.catalog-site .site-header .home-glass-tools .catalog-icon { min-width: 44px; min-height: 44px; }
.overa-editorial-home.is-aluna-cinema .site-header { top: max(12px, var(--overa-safe-top)); padding-top: 0; min-height: 56px; }
.vizon-map-inner { padding-bottom: max(5px, var(--overa-safe-bottom)); }
.aluna-viewer-page .studio-controls { padding-bottom: max(25px, var(--overa-safe-bottom)); }
.aluna-viewer-page .studio-scene { width: 100%; min-width: 0; }

/* Dialogs remain reachable with the keyboard, home indicator and landscape bars. */
dialog:is(.catalog-dialog, #overa-idea-dialog, #editorial-menu-dialog, #editorial-search-dialog,
  #reference-selections-dialog, #cart-dialog, #order-dialog, #room-dialog,
  #saphire-room, #saphire-render-dialog, #aluna-review, #aluna-lightbox, #aluna-room) {
  max-width: calc(100% - max(24px, env(safe-area-inset-left, 0px) + env(safe-area-inset-right, 0px)));
  max-height: calc(100dvh - max(24px, var(--overa-safe-top) + var(--overa-safe-bottom)));
  overflow-y: auto;
  overscroll-behavior: contain;
}
@media (pointer: coarse), (max-width: 1024px) {
  input:not([type=checkbox]):not([type=radio]):not([type=range]), textarea, select { font-size: 16px; }
}

@media (max-width: 700px) {
  :root { --overa-header-size: calc(72px + var(--overa-safe-top)); }
  .catalog-site .site-header,
  .saphire-page.saphire-studio .site-header { height: var(--overa-header-size); gap: 8px; }
  .catalog-site .site-header .logo,
  .saphire-page.saphire-studio .site-header .logo { width: 104px; }
  .catalog-site .site-header .overa-home-brand { gap: 7px; }
  .catalog-site .site-header .overa-home-label { font-size: 14px; letter-spacing: .035em; }
  .catalog-site .site-header .catalog-icon,
  .catalog-site .site-header .home-glass-tools .catalog-icon { width: 44px; height: 44px; padding: 9px; }
  .catalog-site .site-header .catalog-icon svg { width: 24px; height: 24px; }
  .catalog-site .site-header .reference-collection-jump { margin-left: auto; margin-right: 0; }
  .catalog-site .site-header .home-glass-tools { margin-left: auto; padding-left: 0; gap: 0; }
  .saphire-page.saphire-studio:not(.saphire-gallery-mode) .saphire-product { padding-inline: var(--overa-gutter); }
  #saphire-model .saphire-device-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .saphire-gallery-mode #saphire-model .saphire-device-options { display: none; }
  .saphire-page.saphire-studio #saphire-canvas { min-height: 300px; aspect-ratio: 1.12; }
  .aluna-viewer-page .studio-scene { min-height: 540px; }
  .aluna-viewer-page .studio-intro { padding-top: calc(var(--overa-header-size) + 28px); }
  .aluna-viewer-page .angle-control button { min-height: 44px; font-size: 13px; }
  .aluna-viewer-page .auto-control { min-width: 44px; }
  .aluna-viewer-page .auto-control svg { width: 44px; height: 44px; }
  .aluna-viewer-page .view-controls { gap: 12px; margin-inline: 0; }
  .aluna-viewer-page .experience-title { font-size: 14px; }
  .aluna-viewer-page .experience-caption { font-size: 12px; }
  .aluna-viewer-page .studio-heading { flex-wrap: wrap; gap: 12px; }
  .aluna-viewer-page .studio-heading .studio-ar { min-height: 44px; }
  .linea-page #cabinet-live-3d .o-canvas { height: clamp(360px, 64svh, 540px); min-height: 360px; }
}
@media (max-width: 459px) {
  .catalog-site .site-header .reference-collection-jump { display: none; }
}
@media (max-width: 600px) {
  .linea-page .site-header .catalog-tools > :is([aria-label="Koleksiyonda ara"], [aria-label="Bu sayfayı paylaş"]) { display: none; }
  .linea-page .catalog-menu-actions { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 20px; }
  .linea-page .catalog-menu-actions button { min-height: 44px; padding: 10px 14px; border: 1px solid currentColor; border-radius: 999px; background: transparent; color: inherit; font: inherit; }
}
@media (max-width: 359px) {
  .catalog-site .site-header .logo { width: 86px; }
  .catalog-site .site-header .overa-home-label { font-size: 12px; }
  .catalog-site .site-header { gap: 4px; padding-inline: 12px; }
}

/* Compact open-screen portrait: avoid a phone page simply stretched vertically. */
@media (min-width: 600px) and (max-width: 1099px) {
  .reference-collection-night .reference-card { flex-basis: min(62vw, 410px); }
  .saphire-page.saphire-studio.saphire-gallery-mode { --cover-height: max(780px, 110svh); }
  .saphire-gallery-mode .saphire-gallery-intro { top: calc(var(--overa-header-size) + 30px); }
  body.saphire-page.saphire-studio #saphire-photo-panel .saphire-story-scene { min-height: clamp(700px, 100svh, 880px); }
  .aluna-cinema .aluna-scroll-stage { min-height: max(780px, 100svh); }
  .vizon-footer-inner { padding-top: 24px; padding-bottom: 10px; }
}

/* Wide Duo / tablet layout: keep controls beside the product, using the same DOM
   and state so folding or rotating never recreates a model or clears a selection. */
@media (min-width: 760px) and (max-width: 1199px) {
  body.saphire-page.saphire-studio:not(.saphire-gallery-mode) .saphire-product { padding-top: 18px; }
  body.saphire-page.saphire-studio:not(.saphire-gallery-mode) .saphire-stage-heading { padding: 0; }
  body.saphire-page.saphire-studio:not(.saphire-gallery-mode) .saphire-product-wordmark { width: 180px; margin-bottom: 0; }
  body.saphire-page:not(.saphire-gallery-mode) .saphire-stage-eyebrow { margin: 0 0 8px; }
  body.saphire-page:not(.saphire-gallery-mode) .saphire-stage-finish { margin: 8px 0 14px; font-size: 14px; }
  body.saphire-page:not(.saphire-gallery-mode) .saphire-gallery {
    display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr);
    grid-template-areas: "intro intro" "status status" "viewer config";
    gap: 16px 24px; width: 100%; max-width: none; align-items: start;
  }
  body.saphire-page:not(.saphire-gallery-mode) #saphire-status { grid-area: status; }
  body.saphire-page:not(.saphire-gallery-mode) .saphire-gallery-intro { display: block; grid-area: intro; }
  body.saphire-page:not(.saphire-gallery-mode) #saphire-3d-panel { grid-area: viewer; position: sticky; top: calc(var(--overa-header-size) + 16px); min-width: 0; }
  body.saphire-page:not(.saphire-gallery-mode) #saphire-customization { grid-area: config; width: 100%; max-width: none; margin: 0; padding: 20px 16px; }
  body.saphire-page:not(.saphire-gallery-mode) #saphire-customization .prism-option { grid-template-columns: 58px minmax(0,1fr) 30px; gap: 9px; padding-right: 9px; }
  body.saphire-page:not(.saphire-gallery-mode) #saphire-customization .prism-material { padding: 14px 10px; }
  body.saphire-page:not(.saphire-gallery-mode) #saphire-customization .prism-palette { gap: 8px; }
  body.saphire-page:not(.saphire-gallery-mode) #saphire-customization .prism-choice { grid-template-columns: 36px minmax(0,1fr); gap: 6px; }
  body.saphire-page:not(.saphire-gallery-mode) #saphire-customization .prism-sample-shell { width: 36px; height: 36px; padding: 5px; }
  body.saphire-page:not(.saphire-gallery-mode) #saphire-customization .prism-review { flex-grow: 1; text-align: center; }
  body.saphire-page:not(.saphire-gallery-mode) #saphire-model .saphire-topbar { display: grid; grid-template-columns: minmax(150px, 1fr) auto minmax(250px, 1.4fr); width: 100%; max-width: none; align-items: center; gap: 16px; }
  body.saphire-page:not(.saphire-gallery-mode) #saphire-model .saphire-device-options { grid-column: auto; }
  body.saphire-page.saphire-studio #saphire-canvas { min-height: 320px; height: clamp(320px, 50svh, 560px); aspect-ratio: auto; }
  .linea-page #cabinet-live-3d .o-layout { grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: 24px; padding-inline: var(--overa-gutter); }
  .linea-page #cabinet-live-3d .o-view { position: sticky; top: calc(var(--overa-header-size) + 12px); min-width: 0; }
  .linea-page #cabinet-live-3d .o-canvas { height: clamp(360px, 62svh, 590px); min-height: 360px; width: 100%; }
  .linea-page #cabinet-live-3d .o-controls { width: 100%; min-width: 0; margin: 0; padding: 24px 18px; }
  .linea-page #cabinet-live-3d .o-controls::before { inset: 0; }
}

/* Short, wide displays need a horizontal composition, not a tall phone crop. */
@media (min-width: 700px) and (max-width: 1199px) and (orientation: landscape) {
  .overa-editorial-home .reference-hero-saphire { min-height: 540px; height: 100svh; }
  .reference-hero-saphire .reference-hero-media { height: 100%; }
  .reference-hero-saphire .reference-hero-media::after { background: linear-gradient(90deg,#090b0dd9,transparent 75%),linear-gradient(0deg,#090b0d,transparent 24%); }
  .reference-hero-saphire .reference-hero-image { object-position: 66% center; }
  .reference-hero-saphire .reference-hero-content { top: 54%; bottom: auto; left: 4%; right: auto; width: 42%; transform: translateY(-50%); text-align: left; }
  .overa-editorial-home .reference-hero-content .reference-saphire-signature { margin-left: 0; width: 175px; margin-bottom: 16px; }
  .reference-hero-saphire h1 { font-size: clamp(28px, 4.1vw, 44px); }
  .reference-hero-saphire .reference-hero-button { margin-top: 22px; }
  .saphire-page.saphire-studio.saphire-gallery-mode { --cover-height: max(640px, 100svh); }
  .saphire-gallery-mode .saphire-gallery-intro { width: 38%; top: calc(var(--overa-header-size) + 28px); }
  .saphire-gallery-mode #saphire-model .saphire-gallery-intro .saphire-topbar { width: 100%; }
  .saphire-gallery-mode .saphire-campaign-opening > img { left: 22%; width: 78%; }
  .saphire-gallery-mode .saphire-campaign-opening .saphire-opening-caption { width: 34%; padding: 18px; bottom: 6%; }
  .aluna-viewer-page main { display: grid; grid-template-columns: minmax(0,1.6fr) minmax(250px,1fr); gap: 20px; padding: 0 var(--overa-gutter); }
  .aluna-viewer-page .studio-scene { aspect-ratio: auto; height: max(550px, 100svh); min-height: 0; }
  .aluna-viewer-page .studio-intro { padding: calc(var(--overa-header-size) + 26px) 16px 0; }
  .aluna-viewer-page .studio-heading { flex-wrap: wrap; gap: 12px; }
  .aluna-viewer-page .studio-wordmark { width: 135px; }
  .aluna-viewer-page .studio-degrees { font-size: 24px; }
  .aluna-viewer-page .studio-heading .studio-ar { font-size: 14px; min-height: 44px; padding: 0 12px; gap: 7px; }
  .aluna-viewer-page .model-note { font-size: 13px; margin-top: 16px; }
  .aluna-viewer-page .studio-controls { align-self: center; padding: 100px 0 24px; background: none; }
  .aluna-viewer-page .view-controls { gap: 12px; margin: 0 0 18px; }
  .aluna-viewer-page .angle-control { gap: 6px; }
  .aluna-viewer-page .angle-control button { font-size: 13px; min-height: 44px; padding: 8px 4px; }
  .aluna-viewer-page .auto-control { min-width: 44px; font-size: 11px; }
  .aluna-viewer-page .auto-control svg { width: 44px; height: 44px; }
  .aluna-viewer-page .experience-controls { padding: 5px 12px; }
  .aluna-viewer-page .experience-controls > button { padding: 18px 0; gap: 10px; min-height: 100px; }
  .aluna-viewer-page .experience-controls > button > svg { width: 28px; height: 28px; }
  .aluna-viewer-page .experience-title { font-size: 14px; }
  .aluna-viewer-page .experience-caption { font-size: 12px; }
  .aluna-cinema .aluna-scroll-stage { min-height: 720px; padding-top: 130px; }
  .aluna-cinema-dock { width: min(53%, 480px); }
}
@media (max-height: 500px) and (orientation: landscape) {
  :root { --overa-header-size: calc(60px + var(--overa-safe-top)); }
  .catalog-site .site-header, .saphire-page.saphire-studio .site-header { height: var(--overa-header-size); }
  .aluna-viewer-page .studio-nav { height: var(--overa-header-size); }
  .linea-scroll .linea-scroll-stage { min-height: 560px; }
}
