/* Phase 6: Enter the Ashram (/darshan; includes/views/darshan.php, assets/js/darshan-lite.js, darshan-loader.js, darshan.js).
   Two layers: the photo sequence (every scene a section: photographs, title, description, About this place, Sit here,
   Continue) that works alone, and the walk-through (html.dn-walk) where the scene fills the screen and the text floats
   over it. Tokens from tokens.css; Divine Dark Temple and both light palettes read correctly. Phones first. */

.dn { --dn-gap: clamp(16px, 4vw, 40px); }
.dn-title { margin: .2rem 0 .6rem; font: 500 clamp(2rem, 6vw, 3.4rem)/1.08 var(--font-display, var(--serif)); color: var(--ink); }
.dn-lead { max-width: 40rem; color: var(--muted); font-size: clamp(1.02rem, 1rem + .3vw, 1.18rem); line-height: 1.6; }
.dn-note { max-width: 40rem; margin-top: 1.6rem; color: var(--muted); font-size: .92rem; }

/* ------------------------------------------------------------------ threshold -- */
.dn-threshold { padding-block: clamp(36px, 7vw, 96px); }
.dn-gates { display: grid; gap: var(--dn-gap); margin: clamp(20px, 4vw, 40px) 0 0; padding: 0; list-style: none; }
@media (min-width: 760px) { .dn-gates { grid-template-columns: 1fr 1fr; } }
.dn-gate { position: relative; display: grid; gap: 10px; justify-items: center; padding: 18px 14px 22px; border-radius: 28px; text-align: center;
  color: var(--ink); text-decoration: none; background: var(--surface); border: 1px solid var(--card-border); }
.dn-gate:focus-visible { outline: 3px solid var(--focus, #F59E0B); outline-offset: 4px; }
.dn-gate__arch { position: relative; display: block; width: min(100%, 360px); aspect-ratio: 3 / 4; overflow: hidden; isolation: isolate;
  border-radius: 999px 999px 18px 18px / 46% 46% 18px 18px; background: var(--sunken);
  box-shadow: inset 0 0 0 2px rgba(245, 183, 91, .55), 0 0 0 6px rgba(245, 183, 91, .08), 0 20px 60px -30px rgba(245, 183, 91, .6); }
.dn-gate__arch picture, .dn-gate__arch img { display: block; width: 100%; height: 100%; object-fit: cover; }
.dn-gate__glow { position: absolute; inset: 0; background: radial-gradient(70% 55% at 50% 100%, rgba(245, 183, 91, .35), transparent 70%),
  linear-gradient(180deg, transparent 40%, rgba(7, 7, 16, .55)); transition: opacity .6s var(--ease, ease); }
.dn-gate:hover .dn-gate__glow, .dn-gate:focus-visible .dn-gate__glow { opacity: .55; }
.dn-gate__enter { font: 600 clamp(1.3rem, 1.1rem + .9vw, 1.7rem)/1.2 var(--font-display, var(--serif)); color: var(--gold-text, var(--ink)); }
.dn-gate__line { max-width: 30rem; color: var(--muted); line-height: 1.5; }

/* ------------------------------------------------------------- photo sequence -- */
.dn-bar { position: sticky; top: var(--header-h, 0px); z-index: 20; background: color-mix(in oklab, var(--surface) 92%, transparent);
  border-bottom: 1px solid var(--card-border); backdrop-filter: blur(8px); }
.dn-bar__in { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; max-width: 1200px; margin: 0 auto; padding: 8px 16px; }
.dn-bar__back { position: relative; display: inline-flex; align-items: center; min-height: 44px; color: var(--gold-text, var(--ink)); }
.dn-bar__title { margin: 0; flex: 1 1 auto; font: 600 1rem/1.3 var(--font-display, var(--serif)); color: var(--ink); }
.dn-bar__tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dn-bar__tools[hidden], .dn-bar__tools [hidden] { display: none; }
.dn-tool { display: inline-flex; align-items: center; gap: 6px; font-size: .92rem; color: var(--muted); }
.dn-tool select { min-height: 44px; padding: 0 10px; border-radius: 12px; border: 1px solid var(--card-border); background: var(--surface); color: var(--ink); font: inherit; }
.dn-tool--btn, .dn-tool--link { position: relative; min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--card-border);
  background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; text-decoration: none; }
.dn-tool--btn[aria-pressed="true"] { border-color: var(--amber, #F59E0B); box-shadow: inset 0 0 0 1px var(--amber, #F59E0B); }
.dn-intro { max-width: 46rem; margin-top: 1.2rem; color: var(--muted); font-size: 1.06rem; line-height: 1.6; }

.dn-scenes { margin: 0; padding: 0; list-style: none; counter-reset: none; }
.dn-scene { display: grid; gap: clamp(14px, 3vw, 32px); max-width: 1200px; margin: 0 auto; padding: clamp(28px, 6vw, 72px) 16px;
  border-bottom: 1px solid var(--card-border); scroll-margin-top: calc(var(--header-h, 0px) + 64px); }
@media (min-width: 900px) { .dn-scene { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: center; } }
.dn-scene__media { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dn-scene__media > .dn-frame:first-child { grid-column: 1 / -1; }
.dn-frame picture { aspect-ratio: 4 / 3; }
.dn-scene__media > .dn-frame:first-child picture { aspect-ratio: 3 / 2; }
.dn-frame.ds-frame--plain picture { aspect-ratio: auto; }
.dn-frame.ds-frame--plain img { height: auto; }
.dn-frame { display: flex; flex-direction: column; overflow: visible; background: none; border-radius: 0; }
.dn-frame picture { display: block; flex: 1 1 auto; min-height: 0; overflow: hidden; border-radius: inherit; background: var(--sunken); }
.dn-frame.ds-frame--arch picture { border-radius: 999px 999px var(--ds-radius-m, 14px) var(--ds-radius-m, 14px) / 46% 46% var(--ds-radius-m, 14px) var(--ds-radius-m, 14px); }
.dn-frame.ds-frame--plain picture { border-radius: var(--ds-radius-m, 14px); }
.dn-frame figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; padding: 6px 2px 0; color: var(--muted); font-size: .8rem; line-height: 1.35; }
.dn-frame__credit { opacity: .9; white-space: nowrap; }
.dn-scene__count { margin: 0; color: var(--gold-text, var(--muted)); font-size: .82rem; letter-spacing: .12em; text-transform: uppercase; }
.dn-scene__title { margin: .2rem 0 .5rem; font: 500 clamp(1.7rem, 1.3rem + 2vw, 2.6rem)/1.1 var(--font-display, var(--serif)); color: var(--ink); }
.dn-scene__desc { margin: 0; color: var(--ink); line-height: 1.65; }
.dn-scene__vision { margin: .8rem 0 0; color: var(--gold-text, var(--ink)); font-style: italic; }
.dn-about { margin-top: 1rem; border-top: 1px solid var(--card-border); padding-top: .6rem; }
.dn-about summary { position: relative; display: inline-flex; align-items: center; min-height: 44px; cursor: pointer; color: var(--gold-text, var(--ink)); font-weight: 600; }
.dn-about ul { margin: .4rem 0 0; padding-left: 1.1rem; color: var(--muted); line-height: 1.6; }
.dn-about li + li { margin-top: .4rem; }
.dn-about a { color: var(--gold-text, var(--ink)); }
.dn-scene__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 1.2rem; }
.dn-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 22px; border-radius: 999px;
  border: 1px solid transparent; background: var(--vermilion, #881337); color: var(--on-vermilion, #FCFAF6); font: 600 1rem/1 var(--sans); text-decoration: none; cursor: pointer; }
.dn-btn--sit { background: var(--amber, #F59E0B); color: #0B0B15; }
.dn-btn--next, .dn-btn--ghost { background: var(--surface); color: var(--ink); border-color: var(--card-border); }
.dn-btn:focus-visible { outline: 3px solid var(--focus, #F59E0B); outline-offset: 3px; }
.dn-end { padding-block: clamp(36px, 7vw, 80px); text-align: center; }
.dn-end__title { font: 500 clamp(1.6rem, 1.2rem + 2vw, 2.4rem)/1.15 var(--font-display, var(--serif)); color: var(--ink); }
.dn-end__links { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* ----------------------------------------------------------------- sit overlay -- */
.dn-sit { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 1px solid rgba(245, 183, 91, .35); border-radius: 28px;
  background: transparent; color: #FCFAF6; overflow: auto; }
.dn-sit::backdrop { background: rgba(7, 7, 16, .72); backdrop-filter: blur(6px); }
.dn-sit__in { min-height: 0; padding: 22px 18px 20px; text-align: center; border-radius: 28px; }
.dn-sit__place { margin: 0; color: #FCD34D; font-size: .9rem; letter-spacing: .08em; text-transform: uppercase; }
.dn-sit__title { margin: .2rem 0 .8rem; font: 500 1.8rem/1.1 var(--font-display, var(--serif)); }
.dn-sit__note, .dn-sit__join { margin: 1rem auto 0; max-width: 28rem; color: #D9CFC2; font-size: .92rem; line-height: 1.5; }
.dn-sit__join a { color: #FCD34D; }
.dn-sit__close { margin-top: 1rem; background: #1F1A16; color: #FCFAF6; border-color: rgba(245, 158, 11, .55); }

/* -------------------------------------------------------------- walk-through -- */
.dn-stage { position: fixed; inset: 0; z-index: 0; background: #070710; opacity: 0; transition: opacity 1.4s var(--ease, ease); }
html.dn-walk .dn-stage { opacity: 1; }
.dn-stage canvas { display: block; width: 100%; height: 100%; }
.dn-stage__still { position: absolute; inset: 0; opacity: 0; transition: opacity 1.6s var(--ease, ease); }
.dn-stage__still.is-on { opacity: 1; }
.dn-stage__still img { width: 100%; height: 100%; object-fit: cover; }
.dn-stage__still.is-plain { inset: 12px 12px auto 12px; height: 58%; }   /* whole and above the scene's card, never under it */
.dn-stage__still.is-plain img { object-fit: contain; object-position: 50% 0; }
@media (min-width: 900px) { .dn-stage__still.is-plain { inset: 16px 16px 16px auto; width: 56%; height: auto; } .dn-stage__still.is-plain img { object-position: 100% 50%; } }
.dn-stage.is-plain-still .dn-stage__veil { opacity: 0; }   /* no veil over a photograph that must stay whole */
.dn-stage__veil { transition: opacity 1.2s var(--ease, ease); }
.dn-stage__veil { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(7, 7, 16, .35) 0%, transparent 30%, transparent 55%, rgba(7, 7, 16, .78) 100%); }
html.dn-walk, html.dn-walk body.is-site { background: #070710 !important; }   /* the stage's night, in either theme, before it is drawn */
html.dn-walk .dn-bar__tools[hidden] { display: flex; }   /* the tools' place is kept from the first paint */
html.dn-walk .dn--journey { position: relative; z-index: 1; }
html.dn-walk .dn-intro, html.dn-walk .dn-end { display: none; }
html.dn-walk .dn-scene { min-height: calc(100dvh - var(--header-h, 0px)); grid-template-columns: 1fr; align-content: end; border-bottom: 0; padding-bottom: clamp(24px, 6vh, 64px); }
html.dn-walk .dn-scene__media { display: none; }
html.dn-walk .dn-scene__text { max-width: 36rem; padding: 18px 18px 16px; border-radius: 22px; color: #FCFAF6;
  background: rgba(11, 11, 21, .8); border: 1px solid rgba(245, 183, 91, .28); backdrop-filter: blur(6px); }   /* gold ≥ 7:1 over any photograph */
html.dn-walk .dn-scene__title, html.dn-walk .dn-scene__desc { color: #FCFAF6; }
html.dn-walk .dn-scene__count, html.dn-walk .dn-about summary, html.dn-walk .dn-about a, html.dn-walk .dn-scene__vision { color: #FCD34D; }
html.dn-walk .dn-about ul { color: #D9CFC2; }
html.dn-walk .dn-scene__text .dn-btn--next { background: rgba(31, 26, 22, .9); color: #FCFAF6; border-color: rgba(245, 158, 11, .55); }
html.dn-walk .site-footer { position: relative; z-index: 1; }
.dn-stage__credit { position: fixed; right: 10px; bottom: 8px; z-index: 2; margin: 0; color: rgba(252, 250, 246, .75); font-size: .72rem; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .dn-stage, .dn-gate__glow { transition: none; }
  .dn-stage__still { transition-duration: 2.4s; }   /* the gentle cross-fade between stills stays: nothing moves */
}

/* phones: the journey bar stays one row (it scrolls sideways inside itself; the page never does) */
@media (max-width: 599.98px) {
  .dn-bar__in { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-block: 6px; }
  .dn-bar__in::-webkit-scrollbar { display: none; }
  .dn-bar__title { display: none; }
  .dn-bar__back, .dn-bar__tools, .dn-tool { flex: 0 0 auto; white-space: nowrap; }
  .dn-bar__tools { flex-wrap: nowrap; }
  .dn-tool > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}

/* the festival banner steps aside on Enter the Ashram (the arrival is the page's own) */
body:has(main.dn) .ft-banner { display: none; }
/* the threshold: both arches and their names above the fold on a laptop */
@media (min-width: 760px) {
  .dn-threshold { padding-block: clamp(24px, 4vw, 56px); }
  .dn-gate__arch { width: min(100%, 300px); aspect-ratio: 4 / 5; }
}
/* phones: the journey bar's row fades at its edge, so the tools that scroll into view are signalled */
@media (max-width: 599.98px) {
  .dn-bar__in { -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); }
}
/* the header and the journey bar stay solid over the stage's night, so their words keep the theme's own contrast */
html.dn-walk .site-header, html.dn-walk .dn-bar { background: var(--surface, #FBF8F1); -webkit-backdrop-filter: none; backdrop-filter: none; }
