@font-face {
  font-family: "AVALYNE Entrance Cinzel";
  src: url("/assets/fonts/cinzel-decorative/CinzelDecorative-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* No open attribute is emitted. Even an unsupported dialog or missing controller
   leaves the existing page intact; these rules affect this entrance only. */
.avalyne-entrance {
  --avalyne-entrance-ready: 1;
  --ag-ink: #171A17;
  --ag-green: #3E4C41;
  --ag-gold: #BFA05A;
  --ag-ivory: #F3EEE4;
  --ag-leaf-duration: 1100ms;
  --ag-fade-duration: 320ms;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--ag-ink);
  color: var(--ag-ivory);
  overflow: auto;
  overscroll-behavior: contain;
  isolation: isolate;
  font-family: "Inter", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.avalyne-entrance:not([open]),
.avalyne-entrance[hidden] { display: none !important; }
.avalyne-entrance[open]:not([hidden]) { display: block; }
.avalyne-entrance::backdrop { background: #171A17; }
.avalyne-entrance *,
.avalyne-entrance *::before,
.avalyne-entrance *::after { box-sizing: border-box; }

.avalyne-entrance .avalyne-entrance__scene {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: 100%;
  height: 100%;
  min-height: 300px;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 60%, #67765a 0, #3E4C41 40%, #171A17 100%);
  opacity: 1;
  transition: opacity var(--ag-fade-duration) ease;
}

.avalyne-entrance .avalyne-entrance__environment {
  position: absolute;
  inset: 0;
  z-index: -2;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
}

.avalyne-entrance .avalyne-entrance__atmosphere {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(180deg, rgb(23 26 23 / 80%), rgb(23 26 23 / 12%) 32%, rgb(23 26 23 / 6%) 63%, rgb(23 26 23 / 86%)), radial-gradient(ellipse at center, transparent 25%, rgb(23 26 23 / 38%));
}

.avalyne-entrance .avalyne-entrance__heading {
  position: relative;
  z-index: 2;
  padding: 0 12px;
  text-align: center;
  pointer-events: none;
}

.avalyne-entrance .avalyne-entrance__heading h2 {
  margin: 0;
  color: var(--ag-ivory);
  font-family: "AVALYNE Entrance Cinzel", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: clamp(34px, 5.5vw, 82px);
  font-weight: 400;
  font-style: normal;
  line-height: 1.22;
  letter-spacing: .035em;
  text-transform: none;
  text-wrap: balance;
  text-shadow: 0 2px 28px #171A17;
}

.avalyne-entrance .avalyne-entrance__heading p {
  margin: 8px 0 0;
  font-size: clamp(12px, 1.1vw, 15px);
  line-height: 1.5;
  font-weight: 400;
  letter-spacing: .23em;
  color: var(--ag-ivory);
  text-transform: none;
  text-shadow: 0 1px 14px #171A17;
}

.avalyne-entrance .avalyne-entrance__gate-space {
  position: relative;
  min-width: 0;
  min-height: 0;
  margin: 2px 0;
}

.avalyne-entrance .avalyne-entrance__gate {
  appearance: none;
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  box-shadow: none;
  outline: 0;
  cursor: pointer;
  touch-action: manipulation;
}

.avalyne-entrance .avalyne-entrance__portal {
  position: relative;
  display: block;
  width: var(--ag-canvas-width, min(80vw, calc(60vh * var(--ag-art-ratio))));
  height: var(--ag-canvas-height, auto);
  aspect-ratio: var(--ag-art-ratio);
  perspective: 1500px;
  perspective-origin: 50% 48%;
  filter: drop-shadow(0 12px 24px rgb(0 0 0 / 42%));
  pointer-events: none;
}

.avalyne-entrance .avalyne-entrance__light,
.avalyne-entrance .avalyne-entrance__frame {
  position: absolute;
  top: var(--ag-bound-top);
  right: var(--ag-bound-right);
  bottom: var(--ag-bound-bottom);
  left: var(--ag-bound-left);
  border-radius: 50% 50% 2px 2px / var(--ag-arch-rise) var(--ag-arch-rise) 2px 2px;
}

.avalyne-entrance .avalyne-entrance__light {
  z-index: 0;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 52%, #fffaf0 0, #f8dfaa 38%, #be9255 78%, #6d643f);
  box-shadow: 0 0 32px rgb(243 238 228 / 26%);
  opacity: .82;
  transition: opacity var(--ag-leaf-duration) ease, box-shadow var(--ag-leaf-duration) ease;
}

.avalyne-entrance .avalyne-entrance__light::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(112deg, transparent 0 13%, rgb(255 251 229 / 32%) 15% 19%, transparent 22% 32%);
}

.avalyne-entrance .avalyne-entrance__leaf {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 1;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: rotateY(0deg);
  transition: transform var(--ag-leaf-duration) cubic-bezier(.24, .64, .22, 1);
}

.avalyne-entrance .avalyne-entrance__leaf--left {
  left: 0;
  width: var(--ag-seam);
  transform-origin: var(--ag-left-hinge) 50%;
}

.avalyne-entrance .avalyne-entrance__leaf--right {
  right: 0;
  width: calc(100% - var(--ag-seam));
  transform-origin: var(--ag-right-hinge) 50%;
}

/* Both IMG elements contain the SAME COMPLETE native-alpha artwork, at precisely
   the SAME full-canvas size. The wrappers alone clip at the seam. No cover fit,
   independent image scaling, altered art bytes, or overlap at the seam. */
.avalyne-entrance .avalyne-entrance__art,
.avalyne-entrance .avalyne-entrance__fallback-art {
  position: absolute;
  top: 0;
  display: block;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
  object-position: center;
  user-select: none;
}

.avalyne-entrance .avalyne-entrance__leaf--left .avalyne-entrance__art,
.avalyne-entrance .avalyne-entrance__leaf--left .avalyne-entrance__fallback-art {
  left: 0;
  width: var(--ag-left-image-width);
}

.avalyne-entrance .avalyne-entrance__leaf--right .avalyne-entrance__art,
.avalyne-entrance .avalyne-entrance__leaf--right .avalyne-entrance__fallback-art {
  right: 0;
  width: var(--ag-right-image-width);
}

.avalyne-entrance .avalyne-entrance__fallback-art::before {
  content: "";
  position: absolute;
  top: var(--ag-bound-top);
  right: var(--ag-bound-right);
  bottom: var(--ag-bound-bottom);
  left: var(--ag-bound-left);
  border: 3px solid var(--ag-gold);
  border-radius: 50% 50% 2px 2px / var(--ag-arch-rise) var(--ag-arch-rise) 2px 2px;
  background: linear-gradient(90deg, transparent calc(50% - 1px), #BFA05A 50%, transparent calc(50% + 1px)), repeating-linear-gradient(90deg, rgb(191 160 90 / 22%) 0 2px, transparent 2px 19%), repeating-linear-gradient(0deg, rgb(191 160 90 / 20%) 0 2px, transparent 2px 27%), linear-gradient(100deg, #25332c, #3E4C41 45%, #2a392f);
  box-shadow: inset 0 0 0 8px #26342a, inset 0 0 0 10px rgb(191 160 90 / 45%), inset 0 0 40px #171A17;
}

.avalyne-entrance[data-art-state="ready"] .avalyne-entrance__fallback-art { display: none; }
.avalyne-entrance:not([data-art-state="ready"]) .avalyne-entrance__art { visibility: hidden; }

.avalyne-entrance .avalyne-entrance__frame {
  z-index: 2;
  border: clamp(2px, .27vw, 4px) solid #BFA05A;
  box-shadow: 0 0 0 2px #26332a, inset 0 0 0 1px rgb(243 238 228 / 42%), 0 0 0 5px rgb(191 160 90 / 28%);
  pointer-events: none;
  /* Fixed architectural surround: it is intentionally NOT in either leaf. */
}

.avalyne-entrance .avalyne-entrance__gate:hover .avalyne-entrance__frame {
  border-color: #e1ca8f;
}

.avalyne-entrance .avalyne-entrance__gate:focus-visible .avalyne-entrance__frame {
  outline: 3px solid var(--ag-ivory);
  outline-offset: 9px;
  box-shadow: 0 0 0 6px #171A17, 0 0 32px rgb(243 238 228 / 55%);
}

.avalyne-entrance[data-phase="opening"] .avalyne-entrance__leaf--left,
.avalyne-entrance[data-phase="fading"] .avalyne-entrance__leaf--left { transform: rotateY(-82deg); }
.avalyne-entrance[data-phase="opening"] .avalyne-entrance__leaf--right,
.avalyne-entrance[data-phase="fading"] .avalyne-entrance__leaf--right { transform: rotateY(82deg); }
.avalyne-entrance[data-phase="opening"] .avalyne-entrance__light,
.avalyne-entrance[data-phase="fading"] .avalyne-entrance__light {
  opacity: 1;
  box-shadow: 0 0 90px 20px rgb(248 223 170 / 48%);
}
.avalyne-entrance[data-phase="fading"] .avalyne-entrance__scene { opacity: 0; }

.avalyne-entrance .avalyne-entrance__footer {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  margin: 0;
  text-align: center;
}

.avalyne-entrance .avalyne-entrance__instruction {
  margin: 0;
  color: var(--ag-ivory);
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: .2em;
  text-transform: uppercase;
}

.avalyne-entrance .avalyne-entrance__whisper {
  max-width: 35em;
  margin: 3px 0;
  color: var(--ag-ivory);
  font-family: Georgia, serif;
  font-size: 13px;
  line-height: 1.5;
  font-style: italic;
}

.avalyne-entrance .avalyne-entrance__skip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 132px;
  min-height: 44px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  box-shadow: none;
  color: var(--ag-ivory);
  font: inherit;
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: .07em;
  text-transform: none;
  cursor: pointer;
  touch-action: manipulation;
}

.avalyne-entrance .avalyne-entrance__skip:hover { text-decoration: underline; text-underline-offset: 4px; }
.avalyne-entrance .avalyne-entrance__skip:focus-visible { outline: 2px solid var(--ag-ivory); outline-offset: 2px; }

@media (max-width: 600px) {
  .avalyne-entrance .avalyne-entrance__scene {
    padding-top: max(24px, env(safe-area-inset-top));
    padding-right: max(14px, env(safe-area-inset-right));
    padding-left: max(14px, env(safe-area-inset-left));
  }
  .avalyne-entrance .avalyne-entrance__heading { padding: 0; }
  .avalyne-entrance .avalyne-entrance__heading h2 { font-size: clamp(28px, 8.5vw, 48px); letter-spacing: .015em; }
  .avalyne-entrance .avalyne-entrance__heading p { font-size: 11px; letter-spacing: .17em; }
  .avalyne-entrance .avalyne-entrance__instruction { font-size: 10px; letter-spacing: .15em; }
  .avalyne-entrance .avalyne-entrance__whisper { max-width: 26em; font-size: 12px; }
}

@media (max-height: 540px) and (min-width: 601px) {
  .avalyne-entrance .avalyne-entrance__scene { padding-top: max(10px, env(safe-area-inset-top)); padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .avalyne-entrance .avalyne-entrance__heading h2 { font-size: clamp(27px, 4vw, 46px); }
  .avalyne-entrance .avalyne-entrance__heading p { margin-top: 3px; font-size: 11px; }
  .avalyne-entrance .avalyne-entrance__whisper { display: none; }
  .avalyne-entrance .avalyne-entrance__footer { gap: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .avalyne-entrance .avalyne-entrance__scene,
  .avalyne-entrance .avalyne-entrance__leaf,
  .avalyne-entrance .avalyne-entrance__light { transition: none; }
}

/* PROPOSED opt-in guide layer. Existing gate geometry/art and all rules above stay intact. */
.avalyne-entrance[data-helper-media="true"] .avalyne-entrance__guide-poster {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
}

.avalyne-entrance[data-helper-media="true"] .avalyne-entrance__light {
  background: var(--ag-ink);
  opacity: 1;
}
.avalyne-entrance[data-helper-media="true"] .avalyne-entrance__light::after { display: none; }

.avalyne-entrance[data-helper-media="true"] .avalyne-entrance__film {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  opacity: 0; /* Visually hidden, but rendered for the user-gesture priming play. */
  object-fit: contain;
  object-position: center;
  background: var(--ag-ink);
  pointer-events: none;
}

.avalyne-entrance[data-helper-media="true"]:is([data-phase="film"], [data-phase="fading"]) .avalyne-entrance__scene {
  min-height: 0;
}
.avalyne-entrance[data-helper-media="true"]:is([data-phase="film"], [data-phase="fading"]) .avalyne-entrance__film {
  opacity: 1;
}
.avalyne-entrance[data-helper-media="true"]:is([data-phase="film"], [data-phase="fading"]) :is(.avalyne-entrance__heading, .avalyne-entrance__gate-space, .avalyne-entrance__instruction, .avalyne-entrance__whisper) {
  visibility: hidden;
  pointer-events: none;
}
.avalyne-entrance[data-helper-media="true"]:is([data-phase="film"], [data-phase="fading"]) .avalyne-entrance__footer {
  position: absolute;
  z-index: 5;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  align-items: flex-end;
}
.avalyne-entrance[data-helper-media="true"]:is([data-phase="film"], [data-phase="fading"]) .avalyne-entrance__skip {
  min-width: 132px;
  min-height: 44px;
  background: #171A17;
  color: #F3EEE4;
  border-color: #F3EEE4;
}
