/* Decorative, time-bounded departures. No styles target the approved intro. */
@view-transition { navigation: none; }

.garden-passage {
  position: fixed;
  inset: 0;
  z-index: 10000;
  overflow: hidden;
  pointer-events: none;
  contain: layout paint style;
  isolation: isolate;
  background: #2c2c2c;
  opacity: 0;
  animation: garden-passage-appear 150ms ease-out both, garden-passage-depart 150ms ease-in 1780ms forwards;
}
.garden-passage *, .garden-passage *::before, .garden-passage *::after { box-sizing: border-box; }
.garden-passage svg { display: block; }
.garden-passage-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 49%, transparent 27%, #2c2c2c24 76%, #2c2c2ca6 110%);
  pointer-events: none;
}
@keyframes garden-passage-appear { from { opacity: 0; } to { opacity: 1; } }
@keyframes garden-passage-depart { from { opacity: 1; } to { opacity: 0; } }

/* Exact approved 1410×1024 whole-view crop, with no proof controls. */
.garden-approved-scene{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;}
.garden-approved-canvas{display:block;width:min(100vw,137.6953125vh);height:auto;max-height:100%;aspect-ratio:1410/1024;}
/* The reviewed forest projects individual ink drawings through camera depth. */
.garden-depth-forest,.garden-depth-canvas{position:absolute;inset:0;width:100%;height:100%;display:block;}
@media (prefers-reduced-motion: reduce) {
  .garden-passage { display: none !important; animation: none; }
  .garden-passage * { animation: none !important; }
}
@media print { .garden-passage { display: none !important; } }

/* The approved garden on dark ground is revealed once, gently, then held until
   native navigation. No late fade exposes the old dark page as a flash. */
.garden-passage-sand, .garden-passage-forest {
  background: #2c2c2c;
  animation: garden-passage-appear 420ms ease-in-out both;
}

/* Return to the destination's dark ground before native navigation. */
.garden-passage::after { content:'';position:absolute;inset:0;z-index:3;pointer-events:none;background:#2c2c2c;opacity:0;animation: garden-return-dark 260ms ease-in-out 1510ms forwards; }
.garden-passage[data-destination="contact"]::after { background:#2c2c2c; }
@keyframes garden-return-dark { from {opacity:0} to {opacity:1} }

.garden-passage-sand{animation:garden-passage-appear 120ms ease-out both;}
.garden-passage-sand::after{animation:garden-return-dark 100ms ease-in 800ms forwards;}
/* Keep the canvas crop aligned to the whole viewport, including pages that scroll. */
html[data-garden-transition]{overflow:hidden;}

/* Continuous dark ground, without a hard rectangular illustration boundary. */
.garden-passage-sand{background:#2c2c2c;}
.garden-approved-canvas{
 -webkit-mask-image:linear-gradient(to right,transparent,#000 9%,#000 96%,transparent),linear-gradient(to bottom,transparent,#000 7%,#000 95%,transparent);
 -webkit-mask-composite:source-in;
 mask-image:linear-gradient(to right,transparent,#000 9%,#000 96%,transparent),linear-gradient(to bottom,transparent,#000 7%,#000 95%,transparent);
 mask-composite:intersect;
}
.garden-passage-forest{background:#2c2c2c;}
.garden-passage-forest{animation:garden-passage-appear 120ms ease-out both;}
.garden-passage-forest::after{animation:garden-return-dark 100ms ease-in 800ms forwards;}
/* Mobile landscape: contain the frame above browser/notch safe areas. */
@media(max-width:899px),(hover:none) and (pointer:coarse){
 .garden-passage-sand{
  height:100vh;height:100dvh;bottom:auto;
  --sand-top:max(8px,env(safe-area-inset-top,0px));
  --sand-right:max(8px,env(safe-area-inset-right,0px));
  --sand-bottom:max(16px,env(safe-area-inset-bottom,0px));
  --sand-left:max(8px,env(safe-area-inset-left,0px));
 }
 .garden-approved-scene{align-items:flex-end;justify-content:flex-end;padding:var(--sand-top) var(--sand-right) var(--sand-bottom) var(--sand-left);}
 .garden-approved-canvas{
  width:min(calc(100vw - var(--sand-left) - var(--sand-right)),calc((100vh - var(--sand-top) - var(--sand-bottom))*1.376953125));
  width:min(calc(100vw - var(--sand-left) - var(--sand-right)),calc((100dvh - var(--sand-top) - var(--sand-bottom))*1.376953125));
  height:auto;max-height:100%;flex-shrink:0;
 }
}
/* Portrait: bring the foreground stone and moving grooves into the scene.
   Keep the complete bottom/right edge; let nonessential left ground extend
   beyond the viewport rather than cropping the bottom with a centered zoom.
   Bound the enlargement by both screen height and width on tall phones. */
@media(max-width:899px) and (orientation:portrait),(hover:none) and (pointer:coarse) and (orientation:portrait){
 .garden-approved-canvas{
  width:min(calc((100vw - var(--sand-left) - var(--sand-right))*2.1),calc((100vh - var(--sand-top) - var(--sand-bottom))*.936328125));
  width:min(calc((100vw - var(--sand-left) - var(--sand-right))*2.1),calc((100dvh - var(--sand-top) - var(--sand-bottom))*.936328125));
 }
}
/* Wide compositions fade through broad ground areas while retaining the stones. */
@media(min-width:900px) and (min-aspect-ratio:4/3){
 .garden-passage-sand{background-image:none;}
 .garden-approved-canvas{
  -webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;
  -webkit-mask-image:url('sand-wide-mask.svg'),linear-gradient(to right,transparent,#000 5%,#000 94%,transparent),linear-gradient(to bottom,transparent,#000 7%,#000 95%,transparent);
  mask-image:url('sand-wide-mask.svg'),linear-gradient(to right,transparent,#000 5%,#000 94%,transparent),linear-gradient(to bottom,transparent,#000 7%,#000 95%,transparent);
 }
}

html[data-garden-pending]{cursor:progress;}


/* Cover the source while the sand worker prepares its first frame. */
html[data-garden-pending]::after{content:"";position:fixed;inset:0;z-index:9999;background:#2c2c2c;pointer-events:none}

/* Closing the menu must not expose its underlying page during cover fade-in. */
.garden-passage-sand,.garden-passage-forest{opacity:1;animation:none}
.garden-passage canvas{animation:garden-passage-appear 120ms ease-out both}

/* Destination label and a keyboard-accessible immediate continuation. */
.garden-passage{pointer-events:auto}
.garden-passage-controls{position:absolute;inset:0;z-index:4;display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-end;gap:8px;padding:24px max(6vw,env(safe-area-inset-right)) max(32px,env(safe-area-inset-bottom)) max(6vw,env(safe-area-inset-left));color:#eeece4;text-align:left}
.garden-passage-controls h1{font-size:clamp(38px,8vw,88px);line-height:1.15;letter-spacing:.02em;margin:0;text-shadow:0 2px 18px #2c2c2c}
.garden-passage-skip{min-height:48px;min-width:64px;padding:10px 0;border:0;background:transparent;color:#eeece4;font-size:20px;display:flex;gap:20px;align-items:center;cursor:pointer}
.garden-passage-skip:focus-visible{outline:2px solid #eeece4;outline-offset:5px}
.garden-passage.is-navigating::after{animation:none;opacity:1}
@media(max-height:450px){.garden-passage-controls{gap:4px;padding-bottom:max(16px,env(safe-area-inset-bottom))}.garden-passage-controls h1{font-size:38px}}

.garden-passage-skip{text-decoration:underline;text-underline-offset:.22em;text-decoration-thickness:1px}

/* Reveal the already-painted destination using the existing 180ms arrival duration. */
.garden-passage.handoff-reveal{opacity:0;transition:opacity 180ms ease-out}
