/* Sitter (In Facility) Service: the signature section, "Wherever they are".

   Four doorways in a row, one for each kind of place: hospital, rehabilitation center,
   nursing home, assisted living. The visitor picks a doorway (tap, click, or the arrow keys
   once the row has focus) and its words open below. The lisianthus, this service's flower
   and here the sitter, walks to the chosen doorway and stands in it while a lamp comes on
   inside: one companion, whichever place your loved one is in.

   The doorways are the tabs of an ARIA tab list and the four texts are its panels.
   pages/sitter.js turns them into tabs (.stay--live). Without the script the doorways are
   not shown (.js-only) and the four texts stand one after another, so every word is there.

   Motion: the flower's walk and the marker under the doorways are transforms; the lamp is
   an opacity; the doorways' entrance is opacity and transform, started by an
   IntersectionObserver in the script. With reduced motion the flower simply stands in the
   chosen doorway and the texts change without a fade. */

/* ---------- the four doorways ---------- */
.stay__box { position: relative; }
.stay__arcade { --gap: clamp(1rem, 2.6vw, 2.5rem); position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.stay__door { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1.15rem; margin: 0; padding: 0 0 .5rem; border: 0; border-radius: 999px 999px 1.25rem 1.25rem; background: none; color: inherit; font: inherit; text-align: center; cursor: pointer; -webkit-tap-highlight-color: transparent; }
/* a doorway at night: a dark room behind gold mouldings, with a floor line near its foot */
.stay__arch { position: relative; display: block; width: 100%; aspect-ratio: 4 / 4.4; border-radius: 999px 999px 1.25rem 1.25rem; overflow: hidden; isolation: isolate; background: linear-gradient(180deg, rgba(232, 181, 82, 0) 80%, rgba(232, 181, 82, .09) 80%, rgba(232, 181, 82, .02) 100%), radial-gradient(90% 62% at 50% 40%, #33113B 0%, #220A28 56%, var(--plum-deep) 100%); box-shadow: 0 30px 40px -30px rgba(8, 2, 10, .9), inset 0 0 0 1px rgba(232, 181, 82, .55); transition: transform 200ms var(--ease-out); }
.stay__arch::before, .stay__arch::after { content: ""; position: absolute; z-index: 2; border: 1px solid rgba(232, 181, 82, .42); border-bottom: 0; border-radius: 999px 999px 0 0; pointer-events: none; }
.stay__arch::before { inset: .7rem .7rem 0 .7rem; }
.stay__arch::after { inset: 1.4rem 1.4rem 0 1.4rem; opacity: .5; }
/* the lamp inside: warm light from above when the sitter is there */
.stay__glow { position: absolute; inset: 0; z-index: 1; background: radial-gradient(74% 60% at 50% 30%, rgba(251, 240, 220, .52) 0%, rgba(232, 181, 82, .22) 46%, rgba(232, 181, 82, 0) 76%); opacity: 0; transition: opacity 220ms ease; }
.stay__door[aria-selected="true"] .stay__glow { opacity: 1; transition: opacity 600ms ease 320ms; }
/* the place itself, hung on the back wall; it steps aside for the sitter */
.stay__icon { position: absolute; left: 50%; top: 30%; z-index: 2; width: 38%; height: auto; aspect-ratio: 1; opacity: .5; transform: translateX(-50%); transition: opacity 260ms ease, transform 700ms var(--ease-in-out); }
.stay__door[aria-selected="true"] .stay__icon { opacity: 1; transform: translateX(-92%); }
.stay__name { position: relative; font-family: var(--serif); font-size: clamp(1.375rem, 1.8vw, 1.75rem); line-height: 1.12; color: rgba(251, 244, 234, .8); transition: color 220ms ease; }
.stay__name::after { content: ""; position: absolute; left: 0; right: 0; bottom: -.45rem; height: 2px; border-radius: 2px; background: var(--gold-light); transform: scaleX(0); transition: transform 320ms var(--ease-out); }
.stay__door[aria-selected="true"] .stay__name { color: var(--gold-light); }
.stay__door[aria-selected="true"] .stay__name::after { transform: none; }
.stay__door[aria-selected="true"] .stay__arch { box-shadow: 0 30px 44px -28px rgba(8, 2, 10, .95), inset 0 0 0 2px var(--gold-light); }
.stay__door:active .stay__arch { transform: scale(.98); }
.stay__door:focus { outline: none; }
.stay__door:focus-visible { outline: 3px solid var(--gold-light); outline-offset: 6px; }
@media (hover: hover) and (pointer: fine) {
  .stay__door:hover .stay__arch { transform: translateY(-4px); }
  .stay__door:not([aria-selected="true"]):hover .stay__icon { opacity: .8; }
  .stay__door:hover .stay__name { color: var(--cream); }
  .stay__door[aria-selected="true"]:hover .stay__name { color: var(--gold-light); }
}

/* the flower that walks from doorway to doorway (placed by the script) */
.stay__walker { position: absolute; left: 0; top: 0; z-index: 3; width: 0; height: 0; pointer-events: none; transition: transform 700ms var(--ease-in-out); }
.stay__walker.is-still { transition: none; }
.stay__stem { position: absolute; left: 69%; bottom: 3%; height: 78%; transform: translateX(-50%); transform-origin: 50% 100%; }
.stay__stem img { height: 100%; width: auto; max-width: none; filter: drop-shadow(0 14px 14px rgba(8, 2, 10, .6)); }

/* ---------- the four texts ---------- */
.stay__panels { position: relative; margin-top: clamp(2.25rem, 4vw, 3.25rem); padding-top: clamp(2rem, 3.6vw, 2.9rem); border-top: 1px solid var(--line-gold); }
.stay__notch { position: absolute; left: 0; top: 0; width: 14px; height: 14px; margin: -7px 0 0 -7px; background: var(--gold-light); transform: rotate(45deg); transition: transform 700ms var(--ease-in-out); }
.stay__notch.is-still { transition: none; }
.stay__panel { display: grid; grid-template-columns: minmax(0, 4.4fr) minmax(0, 6.6fr); gap: clamp(1.25rem, 5vw, 5.5rem); align-items: start; border-radius: 6px; }
.stay__panel + .stay__panel { margin-top: clamp(2rem, 3.6vw, 2.75rem); padding-top: clamp(2rem, 3.6vw, 2.75rem); border-top: 1px solid rgba(232, 181, 82, .3); }
.stay__panel h3 { font-size: var(--fs-h3); color: var(--cream); }
.stay__panel p { max-width: 41rem; font-size: var(--fs-lead); line-height: 1.6; }
.stay__panel:focus { outline: none; }
.stay__panel:focus-visible { outline: 3px solid var(--gold-light); outline-offset: 10px; }
/* with the script: one text at a time, all four in the same place, so nothing below jumps */
.stay--live .stay__panels { display: grid; }
.stay--live .stay__panel { grid-area: 1 / 1; }
.stay--live .stay__panel + .stay__panel { margin-top: 0; padding-top: 0; border-top: 0; }
.stay--live .stay__panel[hidden] { display: grid; visibility: hidden; }
.stay--live .stay__panel.is-fresh { animation: stay-in 380ms var(--ease-out) both; }
@keyframes stay-in { from { opacity: 0; transform: translateY(.65rem); } to { opacity: 1; transform: none; } }

/* ---------- the entrance (the script adds .stay--enter, then .is-in when the row is in view) ---------- */
.stay--enter .stay__door { opacity: 0; transform: translateY(1.75rem); }
.stay--enter.is-in .stay__door { opacity: 1; transform: none; transition: opacity 420ms ease calc(var(--i, 0) * 90ms), transform 820ms var(--rv-ease-soft) calc(var(--i, 0) * 90ms); }
.stay--enter .stay__stem { opacity: 0; transform: translateX(-50%) scaleY(.35); }
.stay--enter.is-in .stay__stem { opacity: 1; transform: translateX(-50%); transition: opacity 400ms ease 520ms, transform 1100ms var(--rv-ease-soft) 520ms; }
.stay--enter .stay__panels { opacity: 0; transform: translateY(1rem); }
.stay--enter.is-in .stay__panels { opacity: 1; transform: none; transition: opacity 500ms ease 420ms, transform 800ms var(--rv-ease-soft) 420ms; }

/* ---------- tablets and phones: two by two ---------- */
@media (max-width: 899px) {
  .stay__arcade { --gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 1.6rem; }
  .stay__door { gap: .8rem; }
  .stay__arch { aspect-ratio: 4 / 4.3; }
  .stay__arch::before { inset: .5rem .5rem 0 .5rem; }
  .stay__arch::after { inset: 1rem 1rem 0 1rem; }
  .stay__name { font-size: 1.25rem; }
  .stay__panel { grid-template-columns: minmax(0, 1fr); gap: .9rem; }
}

@media (prefers-reduced-motion: reduce) {
  .stay__walker, .stay__notch, .stay__glow, .stay__door[aria-selected="true"] .stay__glow, .stay__arch, .stay__icon, .stay__name, .stay__name::after { transition: none; }
  .stay--live .stay__panel.is-fresh { animation: none; }
}

/* ---------- the rest of the page ---------- */
/* "Alongside the staff" (band 5 markup on cream, between two aubergine bands): a lower arch for the landscape photograph, animated icons in place of the flower */
#alongside-staff .arch { aspect-ratio: 4 / 4.3; }
#alongside-staff .arch > img { object-position: 52% 50%; }
.sit-icon { display: block; width: 4.25rem; height: 4.25rem; }
/* "How sitter service starts": the two notes under the four steps */
.sit-next { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(2rem, 6vw, 6rem); margin-top: clamp(3rem, 6vw, 5rem); padding-top: clamp(2rem, 4vw, 3rem); border-top: 1px solid rgba(200, 144, 48, .6); }
.sit-next h3 { font-size: clamp(1.75rem, 2.4vw, 2.25rem); }
.sit-next h3 + p { margin-top: .9rem; max-width: 36rem; }
.sit-ticks { grid-template-columns: minmax(0, 1fr); gap: .85rem; margin-top: 1.4rem; }
.sit-next__go { margin-top: clamp(1.75rem, 3vw, 2.5rem); }
@media (max-width: 899px) {
  .sit-next { grid-template-columns: minmax(0, 1fr); }
  .sit-icon { width: 3.5rem; height: 3.5rem; }
  .sit-next__go .btn { width: 100%; }
}
