/* Three full-screen sections over the shared studio background. */
html { height: auto; min-height: 100%; scroll-behavior: smooth; scroll-snap-type: y mandatory; scrollbar-gutter: stable; }
body { height: auto; min-height: 100%; overflow: visible; background-image: none; isolation: isolate; }
/* One shared scene stays behind the scrolling content, without horizon repeats. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-color: var(--study-background);
  background-image: var(--studio-image);
  background-repeat: no-repeat;
  background-position: center bottom;
  background-size: var(--studio-size);
}
html:has(dialog[open]), body:has(dialog[open]) { overflow: hidden; }
.single-page { width: 100%; }
.study-toolbar { position: absolute; }
.mixer-study, .content-section {
  background: transparent;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
.content-section {
  --background: var(--study-background);
  --sans: var(--headline-font);
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 100dvh;
  min-width: 0;
  padding: clamp(24px, 4vh, 48px) max(clamp(16px, 3.3vw, 56px), env(safe-area-inset-right)) clamp(24px, 4vh, 48px) max(clamp(16px, 3.3vw, 56px), env(safe-area-inset-left));
  color: var(--ink);
  font-family: var(--headline-font);
}
/* Long-text and script-fallback layouts must remain naturally scrollable. */
html[data-guided-scroll], html[data-scene-flow] { scroll-snap-type: none; }
html:has(.single-page .visits-flow, .single-page .portfolio-flow),
html:not(:has(#works .reader[data-ready])) { scroll-snap-type: none; }
.content-section:focus { outline: none; }
#visit { grid-template-rows: auto minmax(0, 1fr); gap: 12px; }
#works { grid-template-rows: minmax(0, 1fr); gap: 12px; }
.visit-view-actions { display: flex; justify-content: center; }
.visit-view-actions .visits-action { font-family: var(--headline-font); }
.visit-views, .visit-panel { min-width: 0; min-height: 0; height: 100%; }
.visit-views { overflow-anchor: none; }
.visits-map-main, .photo-wall-viewport { height: 100%; }
.map-cluster-picker, .photo-viewer {
  --background: var(--study-background);
  --sans: var(--headline-font);
  background-color: var(--study-background);
  background-image: var(--studio-image);
  background-size: var(--studio-size);
  background-position: center bottom;
  font-family: var(--headline-font);
}
.map-picker-heading { background: rgba(210, 209, 207, .96); }
.viewer-placeholder { background: rgba(222, 225, 227, .92); }
#visit.visits-flow { height: auto; min-height: 100dvh; }
#visit.visits-flow .visit-views, #visit.visits-flow .visit-panel { height: auto; }
#visit.visits-flow .photo-wall-viewport { container-type: inline-size; min-height: 260px; }
#visit.visits-flow .visits-map-main { container-type: inline-size; min-height: 260px; }
#visit.visits-flow .visits-map-frame { width: 100%; }
#works:not(:has(.reader[data-ready])) { height: auto; }
#works:not(:has(.reader[data-ready])) .works-content { height: auto; }
@media (max-height: 480px) {
  .content-section { padding-block: 12px; }
  #visit { gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* Clip only enhanced foreground overflow; natural fallback content keeps its height. */
body[data-scroll-effects] .single-page { overflow: clip; }

/* Typed, local variables avoid passing each motion update through the SVG tree. */
@property --scroll-effect-opacity {
  syntax: '<number>';
  inherits: false;
  initial-value: 1;
}
@property --scroll-effect-shift {
  syntax: '<length>';
  inherits: false;
  initial-value: 0px;
}
body[data-scroll-effects] .headline-stage,
body[data-scroll-effects] .study-toolbar,
body[data-scroll-effects] .visit-views,
body[data-scroll-effects] .visit-view-actions,
body[data-scroll-effects] .works-content {
  opacity: var(--scroll-effect-opacity, 1);
  translate: 0 var(--scroll-effect-shift, 0px);
}
/* Keep keyboard users' active controls clear while they explore a section. */
body[data-scroll-effects] .study-toolbar:focus-within,
body[data-scroll-effects] .visit-views:focus-within,
body[data-scroll-effects] .visit-view-actions:focus-within,
body[data-scroll-effects] .works-content:focus-within { opacity: 1; }
@media (prefers-reduced-motion: reduce), print {
  body[data-scroll-effects] .headline-stage,
  body[data-scroll-effects] .study-toolbar,
  body[data-scroll-effects] .visit-views,
  body[data-scroll-effects] .visit-view-actions,
  body[data-scroll-effects] .works-content { opacity: 1; translate: none; }
}

/* One compact dock stays at the bottom while the sections scroll. */
.fixed-dock {
  position: fixed;
  top: auto;
  bottom: max(18px, env(safe-area-inset-bottom));
  left: 50%;
  width: min(360px, calc(100% - 32px));
  transform: translateX(-50%);
  z-index: 45;
  pointer-events: none;
  font-size: 11px;
}
.fixed-dock ul {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  width: 100%;
  gap: 4px;
  padding: 7px 8px;
  border-radius: 18px;
  pointer-events: auto;
}
.fixed-dock a { min-height: 48px; gap: 4px; }
.fixed-dock .dock-folder { width: 32px; height: 29px; }
.content-section { padding-bottom: var(--dock-bottom-clearance, 97px); }
.mixer-study {
  padding-top: max(72px, var(--toolbar-clearance, 72px));
  padding-bottom: var(--dock-bottom-clearance, 97px);
}
@media (max-width: 720px) {
  .fixed-dock { width: min(352px, calc(100% - 8px)); bottom: max(12px, env(safe-area-inset-bottom)); }
  .fixed-dock ul { gap: 2px; padding: 6px 5px; border-radius: 16px; }
  .fixed-dock a { min-height: 44px; gap: 3px; }
  .fixed-dock .dock-folder { width: 28px; height: 25.5px; }
  .content-section { padding-bottom: var(--dock-bottom-clearance, 84px); }
  .mixer-study { padding-top: max(64px, var(--toolbar-clearance, 64px)); padding-bottom: var(--dock-bottom-clearance, 84px); }
}
@media print { .fixed-dock { position: static; transform: none; margin: 16px auto; } }

/* The CV folder remains a drawer trigger; foreground text follows the hero ink. */
.fixed-dock .cv-trigger { font: inherit; }
.fixed-dock .cv-trigger::after { display: none; }
/* Reserve a top-right controls row so phone pins are never covered. */
/* The full-world camera keeps44px toolbar hit areas plus8px separation. */
#visit .visits-map-frame { grid-template-rows: auto auto auto; gap: 0; width: min(100%, calc((100cqh - 54px) * 1.9459459459)); }
#visit .map-controls { margin-bottom: 8px; justify-self: end; }

/* Disabled/busy turns retain the hero ink with a clear unavailable state. */
#works .reader-controls button:disabled,
#works .reader-controls button[aria-disabled="true"] { opacity: .35; }

/* Building photos sit on white paper; the studio and CV remain unchanged. */
#visit-viewer { --background: #fff; background: #fff; }
#visit-viewer .viewer-placeholder { background: #fff; }

/* Keep the longer Hungarian labels distinct on the narrowest phones. */
@media (max-width: 360px) {
  html[lang="hu"] .fixed-dock .dock-label { font-size: 9.5px; }
}

/* Browser pinch panning must not trigger mandatory section snapping. */
html[data-browser-zoomed] { scroll-snap-type: none; }

/* Smoked blue glass uses the existing geographic paths and camera, not a raster. */
/* Large zooms retain vector glazing/borders; shallow fit-view filters stay bounded. */
.world-map[data-zoomed] .map-glass-contact,
.world-map[data-zoomed] .map-glass-polish { display: none; }
.world-map .map-dot {
  background: #293d4b;
  box-shadow: 0 0 0 2px rgba(244, 249, 252, .92), 0 0 0 3px rgba(44, 65, 80, .5);
}
.world-map .map-cluster-badge {
  border: 1px solid rgba(255, 255, 255, .9);
  background: rgba(234, 243, 248, .94);
  color: #302d29;
  box-shadow: 0 1px 4px rgba(27, 48, 62, .23), inset 0 1px 1px rgba(255, 255, 255, .9);
}
.map-glass-ground { width: 100%; aspect-ratio: 1440 / 90; margin-top: -3.4722222222%; pointer-events: none; }
.map-glass-ground > svg { width: 100%; height: 100%; display: block; overflow: visible; }
/* Decorative floor light belongs to the fitted world; no stale light after panning. */
.visits-map-frame:has(.world-map[data-zoomed]) .map-glass-ground { visibility: hidden; }

/* Pressed smoked faces keep their existing hit areas and icon positions. */
.cv-close:active::before, .visits-action:active::before, .viewer-close:active::before,
.viewer-arrow:not(:disabled):active::before, .map-controls button:not([aria-disabled="true"]):active::before,
.map-geometry-error button:active::before, .work-image-viewer .work-image-control:not(:disabled):active::before,
#works .project-jumps button:not(:disabled):not([aria-disabled="true"]):active::before,
#works .reader-controls button:not(:disabled):not([aria-disabled="true"]):active::before,
#works .book .page-edge:not(:disabled):not([aria-disabled="true"]):active::before { background:var(--control-active); box-shadow:var(--control-active-shadow); }

/* Exceptionally short, narrow viewports retain every hero element in natural flow. */
@media (max-width: 440px) and (max-height: 360px) {
  html { scroll-snap-type: none; }
  .mixer-study {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
    padding-top: max(104px, calc(var(--toolbar-clearance, 112px) - 8px));
  }
  .headline-stage { padding-block: 104px 16px; transform: none; }
  .hero-copy { min-width: 0; max-width: 100%; font-size: clamp(17px, 5.6vw, 24px); }
  html:not([lang="en"]) .hero-copy { font-size: clamp(15px, 4.4vw, 20px); overflow-wrap: anywhere; }
  .mixer-figure { height: 90px; }
}


/* Enhanced phone pages occupy one viewport; only their own long content scrolls.
   This attribute is installed by JS, so no-script links keep the ordinary document. */
html[data-mobile-pages] {
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  scroll-behavior: auto;
  scroll-snap-type: none;
  scrollbar-gutter: auto;
}
html[data-mobile-pages] body {
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
html[data-mobile-pages] .single-page {
  position: relative;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
html[data-mobile-pages] .single-page > :is(#home, #works, #visit) {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scroll-snap-align: none;
  scroll-snap-stop: normal;
}
html[data-mobile-pages] .single-page > [data-mobile-inactive] { display: none; }
html[data-mobile-pages] .study-toolbar[data-mobile-inactive] { visibility: hidden; pointer-events: none; }
html[data-mobile-pages] #visit.visits-flow { grid-template-rows: auto auto; align-content: start; }
/* Grid overflow can extend past the section's bottom padding. Put its dock
   clearance after the actual arranged wall, without changing fit measurements. */
html[data-mobile-pages] #visit.visits-flow .photo-wall[data-arranged]::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  width: 1px;
  height: var(--dock-bottom-clearance, 84px);
  pointer-events: none;
}
/* Mobile folder changes have no trailing document-scroll compensation. */
html[data-mobile-pages] body[data-scroll-effects] .headline-stage,
html[data-mobile-pages] body[data-scroll-effects] .study-toolbar,
html[data-mobile-pages] body[data-scroll-effects] .visit-views,
html[data-mobile-pages] body[data-scroll-effects] .visit-view-actions,
html[data-mobile-pages] body[data-scroll-effects] .works-content { opacity: 1; translate: none; }
@media print {
  html[data-mobile-pages], html[data-mobile-pages] body { height: auto; overflow: visible; }
  html[data-mobile-pages] .single-page { height: auto; overflow: visible; }
  html[data-mobile-pages] .single-page > :is(#home, #works, #visit) { position: relative; height: auto; min-height: 0; max-height: none; overflow: visible; }
  html[data-mobile-pages] .single-page > [data-mobile-inactive] { display: block; }
}
