/*
  MiFiL v5 — Watercolor Home
  ==========================
  Artistic direction: warm watercolor paper, a dark ink-blue night behind the
  house, and natural amber light. Edit this file to refine the home page without
  modifying the working 3D engine, translations or project pages.

  Assets:
    sand-paper.webp               — subtle warm paper grain
    night-watercolor.webp         — large desktop night watercolor, transparent
    night-watercolor-mobile.webp  — mobile framing of the same night watercolor
*/

.home-body {
  --ivory: #1b3a46;
  --muted: #516c76;
  --amber: #ab7647;
  --line: rgba(86, 77, 67, 0.23);
  color: #173744;
  background: #f7dcba url('sand-paper.webp') center center / cover fixed;
}

.home-body::before,
.home-body::after {
  display: none;
}

/* The watercolor is part of the setting, not a flat patch glued to the house. */
.home-body .site-shell {
  isolation: isolate;
  width: min(100%, 1586px);
  padding-inline: clamp(24px, 6.1vw, 94px);
}

.home-body .site-shell::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background: url('night-watercolor.webp') center center / 100% 100% no-repeat;
}

/* Top bar */
.home-body .site-header {
  min-height: 122px;
}

/* Keep the logo in front of the watercolor, including on narrow phones. */
.home-body .site-header {
  position: relative;
  z-index: 6;
}

.home-body .brand img {
  width: 140px;
  height: auto;
}

.home-body .header-link {
  color: #1d4554;
  font-size: 13px;
  letter-spacing: .01em;
}

/* Left column: simple, calm and obviously clickable. */
.home-body .home {
  grid-template-columns: minmax(230px, .72fr) minmax(0, 1.68fr);
  gap: clamp(26px, 5vw, 88px);
  min-height: min(625px, 69vh);
  padding-top: 0;
  padding-bottom: 6px;
}

.home-body .worlds {
  transform: translateY(-40px);
}

.home-body .worlds-inner {
  max-width: 310px;
}

.home-body .worlds h1 {
  margin-bottom: 24px;
  font-size: clamp(41px, 4.2vw, 58px);
  font-weight: 340;
  letter-spacing: -.047em;
  color: #173b48;
}

.home-body .project-list a {
  min-height: 58px;
  padding-block: 15px;
  color: #1e4653;
  border-color: rgba(90, 83, 73, .20);
  font-size: clamp(17px, 1.62vw, 22px);
  font-weight: 410;
}

.home-body .project-list a:hover,
.home-body .project-list a:focus-visible,
.home-body .project-list a.is-active {
  color: #9f673d;
  border-color: #bf906a;
}

.home-body .arrow {
  color: #8e715b;
  font-size: 17px;
}

/* The house remains a true interactive 3D scene. No static house overlay. */
.home-body .scene {
  transform: translateY(-25px);
}

.home-body .scene-stage {
  height: clamp(340px, 47vw, 575px);
}

/* Disable the old CSS splatter/blur that caused the artificial look. */
.home-body .scene-stage::before,
.home-body .scene-stage::after,
.home-body .scene-halo {
  display: none;
}

.home-body .scene-controls {
  margin-top: -8px;
  gap: 16px;
  color: #244753;
}

.home-body .rotate {
  width: 47px;
  height: 47px;
  background: rgba(251, 230, 199, .27);
  border-color: rgba(110, 79, 56, .38);
  color: #2b4b59;
}

.home-body .rotate:hover {
  background: rgba(255, 220, 166, .58);
  color: #98653b;
}

.home-body .scene-hint {
  color: #254653;
  font-size: 12px;
}

/* Footer is intentionally low contrast, like the reference drawing. */
.home-body .site-footer {
  min-height: 140px;
  padding-top: 30px;
  padding-bottom: 54px;
  align-content: start;
  color: #244956;
  border-top: 1px solid rgba(116, 87, 67, .20);
}

.home-body .footer-links a,
.home-body .language select {
  color: #244956;
}

.home-body .footer-links a:hover {
  color: #a16a41;
}

/* Tablet: pull the painting inward without losing its organic silhouette. */
@media (min-width: 761px) and (max-width: 1050px) {
  .home-body .site-shell::before {
    background-size: 115% 100%;
    background-position: 52% 50%;
  }

  .home-body .home {
    grid-template-columns: minmax(205px, .66fr) minmax(0, 1.55fr);
    gap: 22px;
  }

  .home-body .worlds h1 {
    font-size: 42px;
  }
}

/* Phone: image follows the 3D house instead of being squeezed across the page. */
@media (max-width: 760px) {
  /* The expanded watercolor may paint beyond the viewport, but must not
     produce horizontal scrolling on the page. */
  html {
    overflow-x: clip;
  }

  .home-body {
    background-attachment: scroll;
  }

  .home-body .site-shell::before {
    display: none;
  }

  .home-body {
    overflow-x: clip;
  }

  .home-body .site-header {
    min-height: 113px;
    align-items: start;
  }

  .home-body .brand img {
    width: clamp(122px, 36vw, 145px);
    height: auto;
  }

  .home-body .home {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 0;
    padding-bottom: 27px;
  }

  .home-body .scene {
    order: -1;
    transform: none;
    width: 100%;
  }

  .home-body .scene-stage {
    position: relative;
    height: clamp(290px, 90vw, 420px);
    overflow: visible;
  }

  /* The painting is a landscape, not a squeezed oval confined to the scene.
     It is deliberately wider than the phone viewport, with the edges cropped
     by the page rather than compressed into the content column. */
  .home-body .scene-stage::before {
    content: '';
    display: block;
    position: absolute;
    z-index: 0;
    pointer-events: none;
    inset: auto;
    width: clamp(530px, 155vw, 940px);
    aspect-ratio: 1160 / 780;
    height: auto;
    left: 50%;
    top: 47%;
    transform: translate(-50%, -50%);
    background: url('night-watercolor-mobile.webp') center / 100% 100% no-repeat;
  }

  .home-body .scene-controls {
    margin-top: -20px;
    margin-bottom: 18px;
    z-index: 3;
    gap: 8px;
  }

  .home-body .scene-hint {
    font-size: 11px;
  }

  .home-body .rotate {
    width: 43px;
    height: 43px;
    flex-shrink: 0;
  }

  .home-body .worlds {
    transform: none;
  }

  .home-body .worlds h1 {
    font-size: 39px;
    margin-bottom: 13px;
  }

  .home-body .project-list a {
    font-size: 19px;
    padding: 11px 0;
    min-height: 51px;
  }

  .home-body .site-footer {
    min-height: 0;
    padding-top: 19px;
    padding-bottom: 22px;
    gap: 12px 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-body .worlds,
  .home-body .scene {
    scroll-behavior: auto;
  }
}

/* v6.3: mobile project labels attached to the visible 3D windows. */
.window-names {
  display: none;
}

@media (max-width: 760px) {
  .home-body .window-label {
    display: none !important; /* The mouse tooltip duplicates the touch labels. */
  }

  .home-body .window-names:not([hidden]) {
    position: absolute;
    z-index: 5;
    inset: 0;
    display: block;
    pointer-events: none;
  }

  .home-body .window-name:not([hidden]) {
    position: absolute;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    max-width: 132px;
    min-height: 29px;
    padding: 6px 10px;
    border-radius: 18px;
    border: 1px solid rgba(242, 203, 146, .55);
    background: rgba(8, 34, 44, .87);
    box-shadow: 0 4px 14px rgba(7, 22, 32, .28);
    color: #ffebcb;
    font-size: 12px;
    line-height: 1.3;
    text-align: center;
    white-space: nowrap;
    text-decoration: none;
    transform: translate(-50%, -100%);
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .home-body .window-name:focus-visible {
    outline: 2px solid #ffdb9e;
    outline-offset: 3px;
  }

  .home-body .scene-stage.is-entering .window-names {
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
}

/* MiFiL GLB v9: hide the fallback once the actual 3D model has loaded. */
.home-body [hidden] { display: none !important; }
.home-body .scene-fallback img { width: min(93%, 650px); object-fit: contain; }
.home-body .scene-pager { display: grid; gap: 9px; justify-items: center; }
.home-body .scene-progress { display: flex; align-items: center; justify-content: center; gap: 8px; }
.home-body .scene-dot {
  border: 1px solid #779091; width: 11px; height: 11px; border-radius: 50%;
  background: rgba(247,220,186,.25); cursor: pointer; padding: 0;
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}
.home-body .scene-dot.is-active {
  background: #bb8250; border-color: #bb8250; transform: scale(1.18);
}
.home-body .scene-dot:hover,
.home-body .scene-dot:focus-visible { background: #d29f70; border-color: #9b714a; }
.home-body .project-list .project-entry { display: flex; align-items: center; gap: 12px; position: relative; }
.home-body .project-icon {
  flex: 0 0 40px; width: 40px; height: 40px; overflow: hidden;
  border-radius: 10px; border: 1px solid rgba(89,76,63,.16);
}
.home-body .project-icon img { width: 100%; height: 100%; object-fit: cover; }
.home-body .project-copy { display: grid; min-width: 0; flex: 1; }
.home-body .project-name { display: block; white-space: nowrap; }
.home-body .project-description {
  font-size: 11.5px; line-height: 1.4; color: #65747a;
  max-height: 0; opacity: 0; overflow: hidden;
  transition: opacity .18s ease, max-height .22s ease;
}
.home-body .project-entry:hover .project-description,
.home-body .project-entry:focus-visible .project-description,
.home-body .project-entry.is-active .project-description { max-height: 65px; opacity: 1; }
.home-body .project-list .project-entry .arrow { flex: 0 0 auto; }
@media (max-width: 760px) {
  .home-body .project-description { max-height: 44px; opacity: 1; }
  .home-body .project-list .project-entry { min-height: 68px; }
  .home-body .scene-pager { gap: 8px; }
}

/* v12: A-frame fit, real mobile watercolor layer, quiet project states. */
.home-body .scene { transform: translateY(-57px); }
.home-body .scene-pager { gap: 0; }
.home-body .scene-night { display: none; }
.home-body .scene-stage { isolation: isolate; }
.home-body .project-list button.project-entry {
  min-height: 58px; padding-block: 15px; color: #1e4653; font-size: clamp(17px, 1.62vw, 22px);
  appearance: none; width: 100%; border: 0; border-bottom: 1px solid rgba(90,83,73,.2);
  padding-inline: 0; margin: 0; background: none; text-align: start;
  font: inherit; cursor: pointer;
}
.home-body .project-list .project-entry {
  position: relative; gap: 11px; transition: color .2s ease, border-color .2s ease;
}
.home-body .project-list .project-icon {
  background: none; border: none; border-radius: 0; overflow: visible;
  flex: 0 0 45px; width: 45px; height: 45px;
}
.home-body .project-list .project-icon img { width: 100%; height: 100%; object-fit: contain; }
.home-body .project-list .project-name { white-space: nowrap; }
.home-body .project-list .project-entry .status-soon {
  flex: 0 0 auto; color: #9c7858; font-size: 11px; letter-spacing: .01em;
  border: 1px solid rgba(157, 110, 69, .26); padding: 4px 8px;
  border-radius: 999px; background: rgba(253,236,213,.3);
}
.home-body .project-list .project-entry.is-unreleased .project-name { color: #355763; }
.home-body .project-list .project-entry.is-unreleased:hover .project-name,
.home-body .project-list .project-entry.is-unreleased:focus-visible .project-name { color: #a87349; }
.home-body .project-list .project-entry:focus-visible { outline: 2px solid #9a6b47; outline-offset: 3px; }
.home-body .project-list .project-copy { flex: 1 1 0; }
.home-body .project-list .project-description { white-space: normal; }
.home-body .project-list .project-entry .arrow { flex: 0 0 auto; }
@media (max-width: 760px) {
  .home-body .scene { transform: translateY(-7px); }
  .home-body .scene-stage { isolation: isolate; }
  .home-body .scene-stage::before { display: none !important; }
  .home-body .scene-night {
    display: block !important; position: absolute; z-index: 0; pointer-events: none;
    width: clamp(550px, 173vw, 885px); height: auto; aspect-ratio: 1160 / 780;
    left: 54%; top: 53%; transform: translate(-50%,-50%);
    background: url('night-watercolor-mobile.webp') center / 100% 100% no-repeat;
  }
  .home-body #house-canvas { z-index: 2; }
  .home-body .scene-fallback { z-index: 1; }
  .home-body .window-names:not([hidden]) { z-index: 4; }
  .home-body .project-list .project-entry { min-height: 66px; }
  .home-body .project-list .project-entry .status-soon { font-size: 10px; padding-inline: 7px; }
  .home-body .project-list .project-name { font-size: 18px; }
}
@media (max-width: 380px) {
  .home-body .project-list .project-icon { flex-basis: 39px; width: 39px; height: 39px; }
  .home-body .project-list .project-entry { gap: 7px; }
  .home-body .project-list .project-name { font-size: 16px; }
}

/* v14: subtle light around the published project's real 3D window. */
.home-body .project-window-glow {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 50%;
  width: clamp(80px, 11vw, 145px);
  aspect-ratio: 1 / 1.13;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(ellipse at center,
    rgba(255, 226, 155, .41) 0%,
    rgba(255, 204, 126, .23) 30%,
    rgba(255, 185, 95, .08) 53%,
    rgba(255, 176, 94, 0) 74%);
  filter: blur(7px);
  mix-blend-mode: screen;
  opacity: 0;
  transform: translate(-50%, -50%);
  transition: opacity .32s ease;
}
.home-body .project-window-glow.is-visible { opacity: .67; }
.home-body .scene-stage.is-entering .project-window-glow { opacity: 0; }
@media (max-width: 760px) {
  .home-body .project-window-glow { width: clamp(64px, 20vw, 92px); filter: blur(5px); }
  .home-body .project-window-glow.is-visible { opacity: .62; }
}
@media (prefers-reduced-motion: reduce) {
  .home-body .project-window-glow { transition: none; }
}


/* v16: mobile project rows fill the available screen width.
   The desktop left column and watercolor/3D layout are unchanged. */
@media (max-width: 760px) {
  .home-body .worlds {
    width: 100%;
    min-width: 0;
  }

  /* Earlier desktop max-width:310px was shrinking the entire mobile list. */
  .home-body .worlds-inner,
  .home-body .project-list {
    width: 100%;
    max-width: none;
  }

  .home-body .project-list .project-entry {
    width: 100%;
  }
}

/* v21: the floating project tooltip must NEVER block the 3D window hit area.
   Otherwise the tooltip sits over the pane, causes pointerleave, and the
   curtains flicker or reopen while the cursor is still on the window. */
.home-body #window-label { pointer-events: none !important; }
