/* =========================================================================
   HERO THRESHOLD + DOOR PORTAL — v05
   Governing sequence: threshold → mystery → passage → Earth → village.
   The doorway carries ~65–75% of hero visual weight; words carry ~10–15%.
   Progressive enhancement: the door and CTA are real links to start-here.html
   and work with zero JavaScript. The portal is a decorative enhancement.
   ========================================================================= */

.hero-threshold {
  position: relative;
  background: linear-gradient(180deg, #EFE6D4 0%, var(--clouded-linen) 100%);
  padding-block: var(--space-5) var(--space-6);
  overflow-x: hidden;
}

.hero-threshold__top {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.hero-threshold__bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hero-threshold__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: var(--space-4);
}
.hero-threshold__mark { width: 56px; height: auto; }
.hero-threshold__brand .eyebrow { display: block; }

/* ---- The door: a real link, full-bleed horizontal fill --------------------
   Lives outside .wrap in the markup (a direct child of .hero-threshold,
   which itself is unpadded and spans the full viewport) so it is simply
   100% of its parent — no viewport-unit math required. ---------------------- */
.hero-threshold__door {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  box-shadow: 0 24px 48px -24px rgba(61, 44, 35, 0.35);
  outline-offset: -4px;

  /* Responsive art direction: a taller portrait crop on narrow screens so
     the arch still reads as a doorway rather than a thin letterboxed strip;
     the full landscape crop takes over from 640px up. Capped max-height
     keeps very wide monitors from turning the hero into a wall of scroll. */
  aspect-ratio: 771 / 941;
  max-height: 92vh;
}
@media (min-width: 640px) {
  .hero-threshold__door { aspect-ratio: 1672 / 941; max-height: 86vh; }
}
.hero-threshold__door picture,
.hero-threshold__door img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  filter: saturate(1.03);
  transition: filter var(--duration-slow) var(--ease-organic);
}
.hero-threshold__door:hover img,
.hero-threshold__door:focus-visible img { filter: saturate(1.1) brightness(1.02); }

/* Resting state: nearly imperceptible life — a faint ember at the seam */
.hero-threshold__door::after {
  content: "";
  position: absolute;
  top: 8%; bottom: 10%; left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, transparent, rgba(244,199,122,0.35) 35%, rgba(244,199,122,0.35) 65%, transparent);
  opacity: 0.55;
  filter: blur(0.6px);
  transition: opacity var(--duration-slow) var(--ease-organic), width var(--duration-slow) var(--ease-organic);
  pointer-events: none;
}
.hero-threshold__door:hover::after,
.hero-threshold__door:focus-visible::after,
.hero-threshold__door.is-glowing::after {
  opacity: 1;
  width: 4px;
}

/* Hover/focus: inscriptions awaken, depth shifts slightly */
.hero-threshold__door .hero-threshold__glint {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 45% 30% at 50% 40%, rgba(244,199,122,0.16), transparent 70%);
  opacity: 0;
  transition: opacity var(--duration-slow) var(--ease-organic);
  pointer-events: none;
}
.hero-threshold__door:hover .hero-threshold__glint,
.hero-threshold__door:focus-visible .hero-threshold__glint,
.hero-threshold__door.is-glowing .hero-threshold__glint { opacity: 1; }

.hero-threshold__door:hover,
.hero-threshold__door:focus-visible {
  transform: translateY(-2px);
}
.hero-threshold__door { transition: transform var(--duration-base) var(--ease-organic); }

.hero-threshold__cta-row { margin-top: var(--space-5); }
.hero-threshold__caption {
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  color: var(--ink-soft);
}

/* ---- Threshold band --------------------------------------------
   A dedicated full-width band between the door and the orientation
   section. The old .hero-threshold__bottom treatment
   lived inside .hero-threshold itself, shared its gradient (which ends at
   the same --clouded-linen as the section beneath), and was capped at
   max-width:22ch - forcing an early wrap that read as part of the next
   section's heading rather than a threshold of its own. This band gets its
   own background (--warm-parchment, distinct from both the door's gradient
   above and --clouded-linen below), generous vertical padding, and no
   forced wrap width, so "A living path of right relationship." reads as
   one line at comfortable desktop sizes and wraps naturally, never
   illegibly, on narrow phones. Display text, not a heading - no H-level
   semantics here. -------------------------------------------------------- */
.threshold-band {
  background: var(--warm-parchment);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding-block: var(--space-5);
  text-align: center;
}
.threshold-band__line {
  font-family: var(--font-display);
  font-style: italic;
  /* v09.26: reduced - a secondary threshold statement, not a headline */
  font-size: clamp(1.05rem, 0.95rem + 0.5vw, 1.3rem);
  color: var(--ink-soft);
  max-width: 48rem;
  margin-inline: auto;
}

@media (max-width: 640px) {
  .hero-threshold__mark { width: 46px; }
}

/* ---- Portal transition overlay (door reveal, v4) ------------------------
   Decorative enhancement only. Hidden and inert until JS activates it
   (js/portal-door.js, homepage-only). Layers, bottom to top: the real
   hero doors (cropped from the source photo — see that file's header for
   the exact pixel boundaries) sit closed over a masked reveal of the
   provided forest photo, visible only through the archway opening; a
   dust-and-light canvas sits above everything for the final magical
   transport. The underlying static hero photo never moves - only these
   overlay layers animate. ------------------------------------------- */
.portal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #0E1712;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 220ms ease, visibility 0s linear 220ms;
  overflow: hidden;
}
.portal-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
  transition: opacity 220ms ease;
}
/* The natural end of the sequence - reveals the page beneath, timed to
   start once the dust has resolved into a full warm veil. */
.portal-overlay.is-dissolving {
  opacity: 0;
  transition: opacity 550ms ease;
}
/* Skipping (click/Escape) or the reduced-motion path want a snappier
   dissolve than the natural ending. */
.portal-overlay.is-dissolving-quick {
  opacity: 0;
  transition: opacity 260ms ease;
}
.portal-overlay.is-instant {
  transition: none;
}

/* The stage holds the reveal/frame/leaves at the source photo's own
   aspect ratio, "cover"-fit to the viewport by JS (see layout() in
   portal-door.js) so every layer stays pixel-aligned with the archway
   hole at any screen size. */
.door-stage {
  position: absolute;
  overflow: hidden;
  perspective: 1800px;
  perspective-origin: 50% 50%;
}

/* The forest-reveal photo, pre-cropped to the archway hole's own aspect
   ratio and positioned at that exact box within the stage - so it fills
   only the doorway opening, never the full hero. A very gentle forward
   scale (1.00 → 1.06, driven by JS adding .is-advancing) suggests depth
   without an aggressive zoom down the path. */
.door-reveal {
  position: absolute;
  left: 33.91%;
  top: 15.94%;
  width: 30.02%;
  height: 69.61%;
  overflow: hidden;
  border-radius: 2px 2px 38% 38% / 2px 2px 10% 10%;
}
.door-reveal::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url(../assets/img/threshold-forest-reveal.jpg);
  background-size: 100% 100%;
  background-repeat: no-repeat;
  transform: scale(1);
  transform-origin: 46.4% 34.9%; /* the path's own vanishing point */
  transition: transform 3200ms ease-out;
}
.door-reveal.is-advancing::before { transform: scale(1.06); }
/* A restrained interior shadow at the archway edges, as if the frame
   itself casts a little shade into the opening. */
.door-reveal::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 6% rgba(10, 14, 10, 0.55);
  pointer-events: none;
}

/* The archway photo with the door itself cut to soft-edged transparency -
   sits above the reveal (masking it to only show through the doorway
   hole) and below the door leaves. */
.door-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background-image: url(../assets/img/door-frame.webp);
  background-size: 100% 100%;
  background-repeat: no-repeat;
  pointer-events: none;
}

/* The two real leaves, cropped from the original closed-door photo so
   the wood grain, lettering, and emblem line up exactly while closed.
   Percentages are the exact measured door bounds within the 1672×941
   source (see portal-door.js header). Each hinges from its outer edge
   via transform-origin + rotateY - genuine 3D rotation, not a stretch,
   split, slide, or fade. */
.door-leaf {
  position: absolute;
  top: 15.94%;
  height: 69.61%;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.55);
  will-change: transform, filter;
  transition: transform 2100ms cubic-bezier(0.45, 0, 0.2, 1), filter 2100ms ease;
}
/* A soft shadow along each leaf's inner (hinge-far) edge - the edge that
   sweeps away during opening - to suggest the door's own thickness. */
.door-leaf::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 12%;
}
.door-leaf--left {
  left: 33.91%;
  width: 15.73%;
  background-image: url(../assets/img/door-leaf-left.jpg);
  transform-origin: left center;
  transform: rotateY(0deg);
}
.door-leaf--left::after { right: 0; background: linear-gradient(to left, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0)); }
.door-leaf--right {
  left: 49.64%;
  width: 14.29%;
  background-image: url(../assets/img/door-leaf-right.jpg);
  transform-origin: right center;
  transform: rotateY(0deg);
}
.door-leaf--right::after { left: 0; background: linear-gradient(to right, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0)); }
.door-leaf--left.is-open {
  transform: rotateY(-100deg);
  filter: brightness(0.5) saturate(0.75);
}
.door-leaf--right.is-open {
  transform: rotateY(100deg);
  filter: brightness(0.5) saturate(0.75);
}

/* The dust/light canvas - full viewport, above the door-stage, so
   particles can travel out past the archway and fill the whole screen
   as the final warm veil resolves. Drawn procedurally (see
   portal-door.js); no separate DOM bloom element needed. */
#dust-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

@media (prefers-reduced-motion: reduce) {
  .door-stage, #dust-canvas { display: none; }
}
