/* The foyer and the hall. Alvin's gate stands in an ivory plaster wall; through it, a doorway per
   department, lit by sconces, recedes toward a lit door at depth --lit. Every layer is one drawing scaled by
   1 / (its depth - your position), so walking in is one number (--cam) and plain CSS perspective.
   hallway.js only maps scroll to --p; reduced motion, no-JS and older browsers see it standing still. */

/* ---------- still composition: at the gate, which stands on the scene's lower edge ---------- */
.hall{--p:0;--cam:0;position:relative;background:var(--plaster);color:var(--ink)}
.hall__stage{position:relative;display:flex;flex-direction:column;gap:clamp(28px,5vw,44px);padding:clamp(40px,7vw,72px) var(--pad) clamp(44px,7vw,72px);overflow:hidden}
.hall__intro{max-width:560px}
.hall__intro .eyebrow{margin-bottom:22px;color:var(--brass-ink)}
.hall__title{font-size:clamp(44px,5.4vw,80px);line-height:.98;font-weight:300;color:var(--evergreen)}
.hall__title i{font-style:italic;font-weight:300}
.hall__lede{margin-top:24px;color:var(--ink-2);font-size:clamp(16px,1.35vw,18px);line-height:1.6;max-width:42ch;text-wrap:pretty}
.hall__links{display:flex;flex-direction:column;gap:4px;width:100%;max-width:440px;align-self:center}
.hall__links .arrow{justify-content:space-between;color:var(--ink);border-bottom-color:var(--line)}
.hall__links .arrow:hover{color:var(--brass-ink);border-color:var(--brass-ink)}
.hall__scene{position:relative;align-self:center;width:min(100%,440px);aspect-ratio:4/5;overflow:hidden;isolation:isolate;background:var(--evergreen)}
.hall__glow{position:absolute;left:50%;top:50%;width:90%;aspect-ratio:1;transform:translate(-50%,-50%) scale(calc(1 + var(--p) * 2.6));
  background:radial-gradient(closest-side,rgba(240,214,160,.34),rgba(201,165,110,.12) 55%,rgba(201,165,110,0));pointer-events:none}
.hall__floor,.hall__door{position:absolute;inset:0;width:100%;height:100%;overflow:visible}
.hall__floor path{fill:none;stroke:#E9E4D8;stroke-opacity:.26;stroke-width:1.4}
.hall__floor .hall__runner{fill:#264437;stroke:var(--brass-2);stroke-opacity:.34}
.hall__door{transform-origin:50% 50%;
  transform:scale(calc(1 / max(.12, var(--z) - var(--cam))));
  opacity:clamp(0, calc((var(--z) - var(--cam) - .18) / .3), 1)}
.hall__door--lit{opacity:1}
.hall__wall{opacity:clamp(0, calc((var(--z) - var(--cam) - .1) / .05), 1)}
.hall__frame{fill:none;stroke:#E9E4D8;stroke-width:3}
.hall__moulding{fill:none;stroke:#E9E4D8;stroke-opacity:.3;stroke-width:1.2}
.hall__bulb{fill:#FFF3DA}
.hall__plaster{fill:var(--plaster)}
.hall__ground{fill:#DED3BF}
.hall__skirting{fill:none;stroke:var(--brass);stroke-width:2}
.hall__iron{fill:url(#hallBrass);stroke:#6E5230;stroke-width:4;stroke-linejoin:round;paint-order:stroke}
/* each door's sign: an engraved brass plate over the doorway; the door ahead's plate catches the light */
.hall__plate-edge{fill:none;stroke:rgba(74,54,24,.38);stroke-width:1.6}
.hall__screw{fill:#7C5E2F;stroke:rgba(255,246,225,.7);stroke-width:1.2}
.hall__plate-name{font-family:var(--serif);font-size:23px;font-weight:600;letter-spacing:3px;fill:#2A2114}
.hall__plate-n{font-size:27px;font-weight:500;letter-spacing:1px;fill:#6E5230}
/* a long name takes a tighter cut, so it stays between the screws */
.hall__plate-name--long{font-size:19px;letter-spacing:2.2px}
.hall__plate-name--long .hall__plate-n{font-size:23px}
.hall__plate-shade,.hall__plate-shade .hall__plate-n{fill:rgba(255,246,225,.6)}
.hall__plate-rule{fill:none;stroke:rgba(74,54,24,.3);stroke-width:1.2}
.hall__plate-cta{font-family:var(--sans);font-size:12.5px;font-weight:600;letter-spacing:3.4px;fill:#4A3818}
/* only the door ahead wears its plate; the others show their number at the keystone */
.hall__plate{opacity:0;transition:opacity .5s var(--ease)}
.hall__keynum{font-family:var(--serif);font-size:34px;font-weight:500;fill:var(--brass-2);transition:opacity .5s var(--ease)}
.hall__door.is-current .hall__plate{opacity:1}
.hall__door.is-current .hall__keynum{opacity:0}
.hall__halo,.hall__sheen{opacity:0}
.hall__door.is-current .hall__halo{animation:plate-halo 3.4s ease-in-out infinite}
.hall__door.is-current .hall__sheen{opacity:1;animation:plate-sheen 4.6s var(--ease) .6s infinite}
.hall__door.is-current .hall__enter:hover .hall__sheen{animation-duration:1.8s;animation-delay:0s}
@keyframes plate-halo{0%,100%{opacity:.3}50%{opacity:.85}}
@keyframes plate-sheen{0%{transform:translateX(0)}38%,100%{transform:translateX(540px)}}
.hall__door,.hall__lobby{pointer-events:none}
.hall__hit{fill:transparent}
.hall__enter{pointer-events:none}
.hall-live .hall__door.is-current .hall__enter{pointer-events:auto;cursor:pointer}
.hall__door.is-current .hall__enter:hover .hall__frame{stroke:var(--brass-2)}
/* the chosen door: no browser box; a brass ring rises up both jambs and meets at the keystone */
.hall__enter{outline:none}
.hall__ring{fill:none;stroke:var(--brass-2);stroke-width:4;stroke-linecap:round;stroke-dasharray:1;stroke-dashoffset:1;opacity:0;
  transition:stroke-dashoffset .45s var(--ease),opacity .45s var(--ease)}
.hall__door.is-current .hall__enter:is(:hover,:active) .hall__ring,
.hall:has(.hall__go:hover,.hall__go:focus-visible) .hall__door.is-current .hall__ring{stroke-dashoffset:0;opacity:1;transition-duration:.8s,.2s}
.hall__label{display:none}
.hall__lobby{display:none;margin:0}
.hall__cue{display:none}
/* "Step inside": the door ahead's name plate, engraved brass like the plates on the clinicians' doors, at the foot
   of the hall (hallway.js names it and shows it while you walk). A sheen of light glides across the brass and a warm
   halo breathes round it; hovering lifts it, and the matching door in the hall lights up.
   Since the doors carry their own plates (2026-10-25), this one only shows for the keyboard: it stays the named way in
   for keyboards and screen readers, while a pointer clicks the plate on the door itself. */
.hall__go{display:none}
.hall-live .hall__go:not([hidden]):not(:focus-visible){opacity:0;pointer-events:none}
.hall-live .hall__go:not([hidden]){
  --plate:inset 0 1px 0 rgba(255,250,235,.75),inset 0 -2px 0 rgba(90,64,28,.28),inset 0 0 0 1px rgba(120,90,45,.4),0 14px 34px rgba(8,16,12,.42);
  position:absolute;left:50%;bottom:clamp(18px,4.5vh,40px);z-index:3;overflow:hidden;translate:-50% 0;
  display:grid;grid-template-columns:auto auto;justify-content:center;align-items:baseline;column-gap:12px;row-gap:8px;
  width:max-content;max-width:calc(100% - 2 * var(--pad));padding:17px 32px 13px;border-radius:3px;text-align:center;
  color:#2A2114;text-shadow:0 1px 0 rgba(255,246,225,.55);
  background:linear-gradient(135deg,#E6CE9C 0%,#CDA96F 36%,#DDC08A 54%,#B8925A 100%);box-shadow:var(--plate);
  font-size:10.5px;font-weight:600;letter-spacing:.22em;text-transform:uppercase;
  animation:go-rise .6s var(--ease) backwards,go-halo 3.4s ease-in-out .6s infinite;
  transition:transform .3s var(--ease)}
/* the engraved border and its four screws */
.hall__go::before{content:"";position:absolute;inset:5px;border:1px solid rgba(74,54,24,.36);border-radius:1px;pointer-events:none;
  background:
    radial-gradient(circle,#7C5E2F 0 1.3px,rgba(255,246,225,.7) 1.4px 2px,transparent 2.1px) 0 0/7px 7px no-repeat,
    radial-gradient(circle,#7C5E2F 0 1.3px,rgba(255,246,225,.7) 1.4px 2px,transparent 2.1px) 100% 0/7px 7px no-repeat,
    radial-gradient(circle,#7C5E2F 0 1.3px,rgba(255,246,225,.7) 1.4px 2px,transparent 2.1px) 0 100%/7px 7px no-repeat,
    radial-gradient(circle,#7C5E2F 0 1.3px,rgba(255,246,225,.7) 1.4px 2px,transparent 2.1px) 100% 100%/7px 7px no-repeat}
/* the sheen: a band of light crossing the brass now and then */
.hall__go::after{content:"";position:absolute;top:-30%;bottom:-30%;left:-45%;width:34%;pointer-events:none;
  background:linear-gradient(100deg,rgba(255,250,235,0),rgba(255,250,235,.7) 50%,rgba(255,250,235,0));
  transform:skewX(-18deg);animation:go-sheen 4.6s var(--ease) 1.2s infinite}
.hall__go-n{font-size:21px;line-height:1;letter-spacing:.02em;color:#6E5230}
.hall__go-name{font-family:var(--serif);font-size:18px;font-weight:600;letter-spacing:.12em;line-height:1.15;text-wrap:balance}
.hall__go-cta{grid-column:1 / -1;justify-self:stretch;padding-top:8px;border-top:1px solid rgba(74,54,24,.28);font-size:10px;letter-spacing:.26em;color:#4A3818}
.hall__go-cta::after{content:"\2192";display:inline-block;margin-left:9px;font-family:var(--serif);font-size:16px;line-height:0;transition:transform .3s var(--ease)}
.hall__go:hover,.hall__go:focus-visible{transform:translateY(-3px)}
.hall__go:hover::after,.hall__go:focus-visible::after{animation-duration:1.8s;animation-delay:0s}
.hall__go:hover .hall__go-cta::after{transform:translateX(5px)}
/* the plate and its door answer each other: hover one and the other lights */
.hall:has(.hall__go:hover) .hall__door.is-current .hall__frame{stroke:var(--brass-2);stroke-width:5}
/* a new door ahead: the name changes in place */
.hall__go.is-new .hall__go-n,.hall__go.is-new .hall__go-name{animation:go-swap .55s var(--ease) both}
@keyframes go-rise{from{opacity:0;transform:translateY(18px)}}
@keyframes go-halo{0%,100%{box-shadow:var(--plate),0 0 0 0 rgba(236,206,150,0)}50%{box-shadow:var(--plate),0 0 30px 5px rgba(236,206,150,.4)}}
@keyframes go-sheen{0%{left:-45%}38%,100%{left:120%}}
@keyframes go-swap{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
@media (max-width:600px){
  .hall-live .hall__go:not([hidden]){padding:15px 22px 12px;column-gap:10px}
  .hall__go-n{font-size:19px}
  .hall__go-name{font-size:16px;letter-spacing:.1em}
}

/* wide screens that asked for less motion: the same foyer, composed side by side */
@media (min-width:861px){
  html:not(.hall-live) .hall__stage{display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"intro scene" "links scene";
    column-gap:clamp(40px,6vw,96px);row-gap:36px;max-width:var(--wrap);margin:0 auto}
  html:not(.hall-live) .hall__intro{grid-area:intro;align-self:end}
  html:not(.hall-live) .hall__links{grid-area:links;align-self:start;margin:0}
  html:not(.hall-live) .hall__scene{grid-area:scene;width:min(38vw,460px)}
}

/* ---------- live: walk through the gate and down the hall (set by hallway.js wherever motion is allowed) ---------- */
.hall-live .hall{
  --walk:calc(var(--lit) + .13);                                /* from -.25 to just short of the lit door */
  height:calc(100vh - var(--nav-h) + var(--walk) * 30.86vh);    /* the approved pace: 220vh for five doors */
  --cam:var(--camw, calc(-.25 + var(--walk) * min(1, var(--p) / .78)));   /* hallway.js sets --camw: the walk slows at each door */
  --box-h:min(max(100cqh, 62.5cqw), 125cqh);  /* the 1600 x 1000 set: covers the stage, but never cuts off the gate's base */
  --vp:50%;                                    /* the vanishing point, where the set is centred */
  --k:calc(var(--box-h) / 1000);               /* pixels per scene unit */
  --arch-w:calc(var(--k) * 524);               /* the gate's width a step back */
  --side:calc((100% - var(--arch-w)) / 2 - var(--pad) - 28px);
  --lift:calc(var(--p) * -60px);
  --fade:calc(1 - var(--p) * 14);
}
.hall-live .hall__stage{position:sticky;top:var(--nav-h);height:calc(100vh - var(--nav-h));height:calc(100lvh - var(--nav-h));padding:0;display:block;container-type:size}
.hall-live .hall__scene{position:absolute;inset:0;width:auto;aspect-ratio:auto;align-self:auto;container-type:size}
.hall-live .hall__floor,.hall-live .hall__door{inset:auto;left:50%;top:var(--vp);width:auto;height:var(--box-h);aspect-ratio:16/10;translate:-50% -50%}
.hall-live .hall__glow{top:var(--vp);width:min(80vh,70vw)}
/* the plates appear once through the gate, and each fades as you walk under it, before it fills the screen */
.hall-live .hall__label{display:inline;
  opacity:min(clamp(0, calc((var(--cam) - .5) * 5), 1), clamp(0, calc((var(--z) - var(--cam) - var(--hand, .75) + .25) / .25), 1))}
/* each room glows into its doorway as you near it (2.1 to 1.5 doors away), holds, and fades as you pass through */
.hall__room,.hall__spill{opacity:0}
.hall-live .hall__room,.hall-live .hall__spill{
  opacity:min(clamp(0, calc((var(--cam) - .5) * 5), 1), clamp(0, calc((2.1 - var(--z) + var(--cam)) / .6), 1),
              clamp(0, calc((var(--z) - var(--cam) - .5) / .3), 1))}
/* depth: the farther a doorway, the more it sinks into the hall's haze */
.hall-live .hall__frame{stroke-opacity:clamp(.22, calc(1.25 - (var(--z) - var(--cam)) * .17), 1)}
/* the click: a copy of the room, laid exactly over its doorway, carries the view into the department's own arch */
.hall__portal{position:absolute;z-index:4;pointer-events:none;border-radius:999px 999px 0 0;background:center / cover no-repeat;view-transition-name:door}
.hall-live .hall__intro,.hall-live .hall__links{position:absolute;top:50%;z-index:2;opacity:var(--fade);transform:translateY(calc(-50% + var(--lift)))}
.hall-live .hall__intro{left:var(--pad);width:min(520px,var(--side))}
.hall-live .hall__links{right:var(--pad);width:min(340px,var(--side));align-self:auto}
.hall-live .hall__title{font-size:clamp(34px,3.2vw,64px)}
.hall-live .hall.is-walking .hall__intro,.hall-live .hall.is-walking .hall__links{visibility:hidden}
.hall-live .hall__lobby{display:block;position:absolute;inset:0;z-index:1}
.hall-live .hall__photo{display:block;position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:50% 45%;
  opacity:clamp(0, calc((var(--p) - .74) * 9), 1);transform:scale(calc(1.12 - .12 * clamp(0, calc((var(--p) - .74) * 4), 1)))}
.hall-live .hall__dim{display:block;position:absolute;inset:0;background:linear-gradient(to top,rgba(18,33,26,.88),rgba(18,33,26,.3) 55%,rgba(18,33,26,.08));
  opacity:clamp(0, calc((var(--p) - .84) * 7), 1)}
.hall-live .hall__caption{display:block;position:absolute;left:var(--pad);right:var(--pad);bottom:clamp(40px,9vh,96px);max-width:760px;color:#F3EEE3;
  opacity:clamp(0, calc((var(--p) - .88) * 9), 1);
  transform:translateY(calc((1 - clamp(0, calc((var(--p) - .88) * 9), 1)) * 28px))}
.hall__caption .eyebrow{color:var(--brass-2);margin-bottom:16px}
.hall__caption p:last-child{font-family:var(--serif);font-weight:300;font-size:clamp(34px,3.6vw,56px);line-height:1.05}
.hall-live .hall__cue{display:flex;align-items:center;gap:14px;position:absolute;left:var(--pad);bottom:calc(50% - var(--k) * 400 + 20px);z-index:2;
  font-size:10.5px;font-weight:600;letter-spacing:.24em;text-transform:uppercase;color:var(--ink-2);opacity:calc(1 - var(--p) * 10)}
.hall__cue::before{content:"";width:1px;height:34px;background:linear-gradient(var(--brass),transparent);animation:cue 2.2s var(--ease) infinite}
@keyframes cue{0%{transform:scaleY(0);transform-origin:top}45%{transform:scaleY(1);transform-origin:top}55%{transform:scaleY(1);transform-origin:bottom}100%{transform:scaleY(0);transform-origin:bottom}}

/* portrait screens: the title on the wall, the gate on the floor line under it, the cue on the floor */
@media (orientation:portrait){
  .hall-live .hall{--box-h:min(113cqh, 160cqw);--vp:calc(100% - var(--box-h) * .4)}
  .hall-live .hall__stage{display:flex;flex-direction:column;padding-bottom:calc(100lvh - 100svh)}
  /* the corridor's green reaches past the band to every edge once the wall is behind you; the title and cue
     still sit on the stage's plaster, which is what's behind them until then */
  .hall-live .hall__scene{position:relative;inset:auto;order:2;flex:1;min-height:0;overflow:visible;box-shadow:0 0 0 100vmax var(--evergreen)}
  .hall-live .hall__intro{position:relative;order:1;top:auto;left:auto;width:auto;padding:clamp(22px,4.5svh,48px) var(--pad) 0;text-align:center;transform:translateY(var(--lift))}
  .hall-live .hall__intro .eyebrow{margin-bottom:14px}
  .hall-live .hall__title{font-size:clamp(34px,9.6vw,60px)}
  .hall-live .hall__lede,.hall-live .hall__links{display:none}
  .hall-live .hall__cue{position:relative;order:3;left:auto;bottom:auto;flex-direction:column;gap:8px;padding:10px 0 clamp(12px,2.4svh,24px)}
  .hall-live .hall__cue::before{height:26px}
  .hall-live .hall__photo{object-position:44% 50%}         /* keeps the patient walking in, and the desk */
  .hall-live .hall__caption{bottom:calc(100lvh - 100svh + clamp(36px,7svh,80px))}
}
@media (orientation:portrait) and (min-width:600px) and (min-height:900px){  /* tablets have room for the paragraph */
  .hall-live .hall__lede{display:block;margin:18px auto 0;max-width:40ch}
}
/* landscape phones: a short wall and narrow sides, so a smaller title, tighter tracking and no paragraph */
@media (orientation:landscape) and (max-height:560px){
  .hall-live .hall{--side:calc((100% - var(--arch-w)) / 2 - var(--pad) - 16px)}
  .hall-live .hall__lede{display:none}
  .hall-live .hall__intro .eyebrow{margin-bottom:12px;letter-spacing:.16em}
  .hall-live .hall__title{font-size:clamp(24px,min(8.5svh,3.9vw),40px)}
  .hall-live .hall__links .arrow{letter-spacing:.14em}
}
@media (orientation:landscape) and (max-height:560px) and (max-width:720px){
  .hall-live .hall__intro .eyebrow{display:none}  /* the header already says Prime Health */
}

/* ---------- still, on phones and narrow windows: the lobby stands under the foyer, the way the walk ends on it ---------- */
@media (max-width:860px){
  html:not(.hall-live) .hall__lobby{display:flex;flex-direction:column;gap:14px;align-self:center;width:min(100%,440px)}
  html:not(.hall-live) .hall__photo{border-radius:50% 50% 0 0 / 64px 64px 0 0}
  html:not(.hall-live) .hall__caption{order:-1;text-align:center}
  html:not(.hall-live) .hall__caption .eyebrow{margin:0;color:var(--brass-ink)}
  html:not(.hall-live) .hall__caption p:last-child,html:not(.hall-live) .hall__dim{display:none}
}
