/* Historical study specimens retain their original registration.
   The live home below now uses independent, complete parallax planes. */
.home-original-crop {
  position: relative;
  width: 100%;
  aspect-ratio: 853 / 1154;
  overflow: hidden;
  isolation: isolate;
}
.home-original-crop > .home-original-source {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  right: auto;
  bottom: auto;
  width: 100%;
  max-width: none;
  height: auto;
  max-height: none;
  margin: 0;
  object-fit: fill;
  transform: none;
  filter: none;
  user-select: none;
  pointer-events: none;
}

/* The approved poster supplies the portrait scale: Olga close to the player,
   with the large title across her lower torso. The full-body source remains
   intact; framing its lower half is a composition choice, not asset damage. */
.home-desktop-backdrop { display: none; }
.home-discovery-panel { display: contents; }
body[data-screen="home"] {
  isolation: isolate;
  overflow-x: clip;
  background: #2d7467;
  --home-workspace-height: max(200px, calc(100svh - var(--play-dock-height, 190px) - 124px));
}
body[data-screen="home"] .home-desktop-backdrop {
  display: block;
  position: fixed;
  inset: -18px;
  z-index: -1;
  pointer-events: none;
  /* Static lens softness and distance haze belong only to the scenery.
     The existing overscan keeps the filtered edge beyond the viewport. */
  filter: blur(1.6px) saturate(.94) contrast(.97);
  background: linear-gradient(180deg, #fff8e61c, #fff8e62b 52%, #fff8e61a),
    #2d7467 url("../assets/expedition/home-panorama-v1.webp") center / cover no-repeat;
}
body[data-screen="home"] .game-header { background: none; }
body[data-screen="home"] .home-hub-hero { padding: 0; isolation: isolate; }
body[data-screen="home"] .home-hub-hero .home-art-window {
  position: relative;
  width: 100%;
  margin: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}
body[data-screen="home"] .home-art-window .expedition-art.has-parallax-art {
  position: relative;
  container-type: size;
  width: 100%;
  max-width: none;
  /* Short phones scroll the destination instead of shrinking Olga and title. */
  height: clamp(280px, calc(100svh - var(--play-dock-height, 160px) - 255px), 480px);
  margin: 0;
  left: auto;
  aspect-ratio: auto;
  /* The full body continues beneath the separate logo. Its own window
     contains viewport overscan without reducing the approved close portrait. */
  overflow: visible;
  border-radius: 0;
  background: none;
  /* Vertical swipes scroll; two fingers still zoom (docs/MOBILE_REVIEW.md:
     real fingers keep native scrolling and pinch). */
  touch-action: pan-y pinch-zoom;
  user-select: none;
  --home-portrait-height: min(100cqh, 135cqw);
  --home-portrait-inset: calc((100cqh - var(--home-portrait-height)) / 2);
  --home-reference-height: calc(var(--home-portrait-height) * 2.2);
  --home-character-height: calc(var(--home-reference-height) * .8750803843);
}
body[data-screen="home"] .home-hub-hero .has-parallax-art::before,
body[data-screen="home"] .home-hub-hero .has-parallax-art::after,
body[data-screen="home"] .home-scene-caption { display: none; }
body[data-screen="home"] .home-hub-hero .has-parallax-art .home-art-layer {
  display: block;
  position: absolute;
  pointer-events: none;
  mask-image: none;
  transition: none;
}
body[data-screen="home"] .home-hub-hero .has-parallax-art .home-art-brand {
  z-index: 3;
  left: 50cqw;
  top: auto;
  bottom: calc(var(--home-portrait-inset) + 12px);
  width: min(calc(100cqw - 28px), calc(var(--home-portrait-height) * .72));
  height: auto;
  aspect-ratio: auto;
  transform: translateX(-50%);
  filter: drop-shadow(0 5px 3px #17443b45);
}
body[data-screen="home"] .home-art-brand > .home-logo-art {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
body[data-screen="home"] .home-art-guide-window {
  position: absolute;
  z-index: 2;
  top: 0;
  /* Let the silhouette cross the layout's left gutter. The window still
     ends at the same right edge and viewport bottom; only the empty gutter
     is reclaimed, without moving or shrinking the approved portrait. */
  left: calc(-1 * var(--home-guide-bleed-left, 0px));
  width: calc(100% + var(--home-guide-bleed-left, 0px));
  /* Native viewport units track height changes immediately; JS registers
     only the portrait origin, never a stale pixel height. */
  height: max(100%, calc(100vh - var(--home-guide-top, 64px)));
  height: max(100%, calc(100dvh - var(--home-guide-top, 64px)));
  overflow: clip;
  pointer-events: none;
}
body[data-screen="home"] .home-hub-hero .has-parallax-art .home-art-guide {
  z-index: 2;
  /* Approved HERO source:2048x3072, pupil midpoint(1133.75,350),
     span161.128px. Register those eyes to the existing close portrait;
     retain its narrow-column clamp and the frozen title's exact geometry.
     The complete solid body continues below the separate foreground logo. */
  left: calc(min(50cqw, calc(100cqw - 12px - var(--home-reference-height) * .1965987609)) + var(--home-reference-height) * .0140625 - var(--home-character-height) * .03572591146 + var(--home-guide-bleed-left, 0px));
  right: auto;
  top: calc(var(--home-portrait-inset) + var(--home-portrait-height) * .04 + var(--home-reference-height) * .0870979167 - var(--home-character-height) * .11393229167);
  bottom: auto;
  width: auto;
  height: var(--home-character-height);
  aspect-ratio: 2 / 3;
  transform: translateX(-50%);
  filter: drop-shadow(0 9px 5px #17443b38);
}
body[data-screen="home"] .home-hub-hero .has-parallax-art .home-art-guide img {
  display: block;
  position: static;
  inset: auto;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
  object-position: center;
  /* The generated body is complete and solid; only outside alpha is clear. */
  mask-image: none;
  -webkit-mask-image: none;
  filter: none;
  user-select: none;
}
body[data-screen="home"] .has-parallax-art .home-art-text-fallback { display: none; }
body[data-screen="home"] .has-parallax-art[data-logo-failed="true"] .home-art-brand,
body[data-screen="home"] .has-parallax-art[data-guide-failed="true"] .home-art-guide { visibility: hidden; }
body[data-screen="home"] .has-parallax-art[data-logo-failed="true"] .home-art-text-fallback {
  display: flex;
  position: absolute;
  left: 3%;
  top: 16%;
  width: 48%;
  flex-direction: column;
  color: #fff2b8;
  text-shadow: 0 2px 3px #17443b;
  font-family: var(--heading);
}
.home-art-text-fallback strong { font-size: clamp(24px, 5vw, 54px); line-height: 1; }
.home-art-text-fallback span { font-size: 13px; }
body[data-screen="home"] .home-updates-heading h2 {
  color: #fff5d6;
  text-shadow: 0 2px 4px #073e39;
}
body[data-screen="home"] .first-run-options > summary { background: var(--relic-parchment); }
body[data-screen="home"] .first-run-options:not([open]) > :not(summary) { display: none; }
body[data-screen="home"] .first-run-options .theme-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
}
body[data-screen="home"] .first-run-options[open] {
  padding: 12px;
  border: 2px solid #dcad59;
  border-radius: 22px;
  background: #fff0d0f5;
  box-shadow: 0 6px 18px #123f3940;
}
body[data-screen="home"] .site-foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 16px;
  row-gap: 0;
  justify-content: initial;
  color: #fff4d5;
  text-shadow: 0 1px 3px #073e39;
}
body[data-screen="home"] .site-foot > span:first-child { grid-area: 1 / 1; }
body[data-screen="home"] .site-foot > span:last-child { grid-area: 2 / 1; }
body[data-screen="home"] .site-foot button {
  grid-area: 1 / 2 / 3;
  min-height: 44px;
  padding: 8px 5px;
  border: 0;
  border-radius: 5px;
  color: #fff4d5;
  background: none;
  font-size: 11px;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-shadow: 0 1px 3px #073e39, 0 0 6px #073e39;
}
body[data-screen="home"] .site-foot button:focus-visible {
  outline: 2px solid #fff0ae;
  outline-offset: 2px;
  background: #174e47d9;
}
@media (min-width: 761px) {
  body[data-screen="home"] .app {
    width: 100%;
    max-width: 1600px;
    min-height: 100svh;
    padding: 0 max(24px, min(4vw, 64px)) calc(var(--play-dock-height, 190px) + 12px);
  }
  body[data-screen="home"] .game-header { height: 64px; }
  body[data-screen="home"] #main {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
    align-items: center;
    column-gap: clamp(24px, 4vw, 64px);
    min-height: var(--home-workspace-height);
    padding: 0;
  }
  body[data-screen="home"] .home-hub-hero { grid-area: 1 / 1; width: 100%; margin: 0; }
  body[data-screen="home"] .home-art-window .expedition-art.has-parallax-art {
    height: min(var(--home-workspace-height), 900px);
  }
  body[data-screen="home"] .home-discovery-panel {
    grid-area: 1 / 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 18px;
    min-width: 0;
    padding-block: 12px;
  }
  body[data-screen="home"] .home-updates,
  body[data-screen="home"] .home-themes { width: 100%; max-width: none; margin: 0; }
  body[data-screen="home"] .home-updates-heading { margin: 0 0 12px; }
  body[data-screen="home"] .home-updates-heading h2 { font-size: clamp(21px, 2vw, 28px); }
  body[data-screen="home"] .home-updates-heading::after { background: linear-gradient(90deg, #ffda87, #ffda8700); }
  body[data-screen="home"] .home-season-main { grid-template-columns: 64px minmax(0, 1fr) 20px; min-height: 114px; gap: 12px; padding: 13px 16px; }
  body[data-screen="home"] .home-season-seal { width: 64px; height: 72px; }
  body[data-screen="home"] .home-season-copy > strong { font-size: clamp(21px, 2vw, 27px); }
  body[data-screen="home"] .home-season-copy > small > span { display: none; }
  body[data-screen="home"] .home-season-details { min-height: 44px; }
  body[data-screen="home"] .site-foot { min-height: 44px; padding: 0; }
}
@media (max-width: 760px) {
  body[data-screen="home"] #main { padding-bottom: 12px; }
  body[data-screen="home"] .home-updates { margin-top: 12px; }
  body[data-screen="home"] .home-updates-heading { display: none; }
  body[data-screen="home"] .home-season-main { grid-template-columns: 58px minmax(0, 1fr) 16px; gap: 9px; min-height: 96px; padding: 9px 12px; }
  body[data-screen="home"] .home-season-seal { width: 58px; height: 64px; }
  body[data-screen="home"] .home-season-copy > strong { font-size: 20px; }
  body[data-screen="home"] .home-season-copy > small { font-size: 8px; letter-spacing: .05em; }
  body[data-screen="home"] .home-season-copy > small > span { display: none; }
  body[data-screen="home"] .home-season-inventory { font-size: 10px; }
}
@media (min-width: 761px) and (max-height: 700px),
       (min-width: 500px) and (max-height: 550px) {
  body[data-screen="home"] .app-dock .bottom-nav button { min-height: 72px; }
  body[data-screen="home"] .app-dock .bottom-nav button > .illustrated-icon { width: 44px; height: 44px; }
  body[data-screen="home"] .home-discovery-panel { gap: 10px; padding: 6px 0; }
  body[data-screen="home"] .home-updates-heading { margin-bottom: 8px; }
  body[data-screen="home"] .home-updates-heading h2 { font-size: 21px; }
  body[data-screen="home"] .home-season-main { min-height: 88px; padding: 8px 12px; gap: 8px; grid-template-columns: 48px minmax(0, 1fr) 18px; }
  body[data-screen="home"] .home-season-seal { width: 48px; height: 56px; }
  body[data-screen="home"] .home-season-copy > strong { font-size: 21px; }
  body[data-screen="home"] .home-season-inventory { font-size: 11px; }
  body[data-screen="home"] .site-foot > span { display: none; }
}
@media (min-width: 500px) and (max-height: 550px) {
  body[data-screen="home"] .app { padding-inline: 16px; }
  body[data-screen="home"] #main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(230px, 1fr); gap: 14px; align-items: center; padding-bottom: 120px; }
  body[data-screen="home"] .home-art-window .expedition-art.has-parallax-art { height: max(100px, calc(100svh - var(--play-dock-height, 100px) - 104px)); }
  body[data-screen="home"] .home-updates { margin-top: 0; }
  body[data-screen="home"] .home-discovery-panel { display: flex; flex-direction: column; gap: 8px; }
}
/* The archived official study stays available beside the new live composition. */
.official-design .hero-art.approved-study-art { width: min(100%, 340px); height: auto; aspect-ratio: 853 / 1154; justify-self: center; align-self: center; }
.official-design .approved-study-art .home-original-crop { border: 1px solid #ba8343; border-radius: 22px; box-shadow: 0 5px #c49b57, 0 12px 24px #704c2529; }
@media (prefers-reduced-motion: reduce) {
  body[data-screen="home"] .has-parallax-art .home-art-layer { translate: none !important; }
  body[data-screen="home"] .home-desktop-backdrop { translate: none !important; }
}
