/* Spud & Root: town/cathedral.html. Loaded after site.css. cathedral.js sets
   data-state on .cathedral as the visit goes on:
   pending -> outside -> opening -> narthex -> walking -> offer -> sitting
   -> welcome -> seated, and while you're looking at something from your
   seat, looking or candles (returning on the way back).
   The building itself is drawn on the canvas. */

.cathedral-page {
  background: #1a1620;
  color: var(--ink);
}
html.js .cathedral-page {
  overflow: hidden;
}

.cathedral {
  position: relative;
}

.stage {
  position: relative;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background: linear-gradient(#7fb5e3, #f4e9d2 70%, #d8cebd 70%);
  -webkit-tap-highlight-color: transparent;
}
html:not(.js) .stage {
  display: none;
}

.world {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ---------- Tap targets over the scene ---------- */
.spot {
  position: absolute;
  left: -200px;
  top: 0;
  width: 60px;
  height: 60px;
  padding: 0;
  margin: 0;
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.spot[hidden],
.spot.is-off {
  display: none;
}
.spot:focus-visible {
  outline: 3px solid var(--logo-yellow);
  outline-offset: 2px;
}
.spot--glow::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border-radius: 50%;
  background: rgba(255, 236, 170, 0.9);
  box-shadow: 0 0 0 3px var(--ink), 0 0 18px 6px rgba(255, 214, 120, 0.7);
  animation: spot-glow 2.6s ease-in-out infinite;
}
.spot__label {
  position: absolute;
  left: 50%;
  top: calc(50% + 18px);
  transform: translateX(-50%);
  padding: 0.15em 0.7em;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  color: var(--ink);
  background: var(--cream);
  border: 2px solid var(--ink);
  border-radius: var(--radius-pill);
  opacity: 0.92;
}
.spot--above .spot__label {
  top: auto;
  bottom: calc(50% + 18px);
}
.spot:hover .spot__label,
.spot:focus-visible .spot__label {
  background: var(--logo-yellow);
  opacity: 1;
}
@keyframes spot-glow {
  0%,
  100% {
    transform: scale(0.85);
    opacity: 0.75;
  }
  50% {
    transform: scale(1.05);
    opacity: 1;
  }
}

/* ---------- Words on the scene ---------- */
.hint {
  position: absolute;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  transform: translate(-50%, 8px);
  width: max-content;
  max-width: calc(100% - 32px);
  margin: 0;
  padding: 0.45em 1.1em;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  text-align: center;
  color: var(--ink);
  background: var(--cream);
  border: var(--stroke) solid var(--ink);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s, transform 0.4s;
}
.hint.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

.bubble {
  position: absolute;
  left: -400px;
  top: 0;
  transform: translate(-50%, calc(-100% - 12px));
  width: max-content;
  max-width: min(260px, 70vw);
  margin: 0;
  padding: 0.5em 0.9em;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.2;
  text-align: center;
  color: var(--ink);
  background: var(--white);
  border: var(--stroke) solid var(--ink);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -11px;
  width: 16px;
  height: 16px;
  margin-left: -8px;
  background: var(--white);
  border-right: var(--stroke) solid var(--ink);
  border-bottom: var(--stroke) solid var(--ink);
  transform: rotate(45deg);
}
.bubble.is-on {
  opacity: 1;
}

.toast {
  position: absolute;
  left: 50%;
  top: max(74px, calc(env(safe-area-inset-top) + 64px));
  transform: translate(-50%, -8px);
  width: min(30rem, calc(100% - 32px));
  margin: 0;
  padding: 0.8em 1.1em;
  font-size: 0.98rem;
  line-height: 1.4;
  color: var(--ink);
  background: var(--cream);
  border: var(--stroke) solid var(--ink);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s, transform 0.4s;
}
.toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

.fade {
  position: absolute;
  inset: 0;
  background: #120e16;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.fade.is-on {
  opacity: 1;
}

/* ---------- The note: a card about what you're looking at ---------- */
.note {
  position: absolute;
  left: max(16px, env(safe-area-inset-left));
  bottom: max(16px, env(safe-area-inset-bottom));
  width: min(27rem, calc(100% - 32px));
  max-height: calc(100% - 110px);
  overflow: auto;
  padding: 1.1rem 1.25rem 1.2rem;
  background: var(--cream);
  border: var(--stroke) solid var(--ink);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.35s, transform 0.35s;
}
.note:not(.is-on) {
  visibility: hidden;
}
.note.is-on {
  opacity: 1;
  transform: none;
}
.note__title:focus {
  outline: none;
}
.note__title {
  margin: 0 0 0.4rem;
  font-size: 1.45rem;
}
.note__body p {
  margin: 0 0 0.7rem;
  font-size: 1rem;
  line-height: 1.5;
}
.note__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0.2rem 0 0.8rem;
}
.note__actions:empty {
  display: none;
}
.note .btn {
  min-height: 46px;
  padding: 10px 20px;
  font-size: 1rem;
}
.note__back {
  --btn-bg: var(--white);
}

/* ---------- The dock, the chips and the way out ---------- */
.dock {
  position: absolute;
  right: max(14px, env(safe-area-inset-right));
  top: max(14px, env(safe-area-inset-top));
  display: flex;
  gap: 8px;
}
.dock__btn,
.leave,
.chip {
  min-height: 40px;
  padding: 0.35em 0.9em;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.3;
  white-space: nowrap;
  color: var(--ink);
  background: var(--white);
  border: var(--stroke) solid var(--ink);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  cursor: pointer;
}
.dock__btn:hover,
.leave.leave--back {
  background: var(--logo-yellow);
}
.leave:hover,
.chip:hover {
  background: var(--logo-yellow);
}
.dock__btn[hidden],
.chip[hidden] {
  display: none;
}
.dock__btn.is-new {
  animation: dock-new 0.9s ease-out 2;
}
@keyframes dock-new {
  50% {
    transform: scale(1.12);
  }
}
.dock__btn--sound {
  display: grid;
  place-items: center;
  width: 46px;
  padding: 0;
}
.dock__btn--sound .off,
.dock__btn--sound[aria-pressed="false"] .on {
  display: none;
}
.dock__btn--sound[aria-pressed="false"] .off {
  display: inline;
}
[data-state="pending"] .dock,
[data-state="welcome"] .dock {
  visibility: hidden;
}
.leave {
  position: absolute;
  left: max(14px, env(safe-area-inset-left));
  top: max(14px, env(safe-area-inset-top));
}
[data-state="pending"] .leave {
  visibility: hidden;
}

/* Along the bottom: what to do next */
.chips {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: max(18px, env(safe-area-inset-bottom));
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  pointer-events: none;
}
.chip {
  pointer-events: auto;
}
.chip--go {
  background: var(--logo-yellow);
}
.chip--seated {
  display: none;
}
[data-state="seated"] .chip--seated {
  display: inline-block;
}
[data-state="seated"] .hint,
[data-state="narthex"] .hint {
  bottom: max(78px, calc(env(safe-area-inset-bottom) + 64px));
}
/* On a short screen the doors are low down: say it at the top instead */
@media (max-height: 500px) {
  [data-state="outside"] .hint {
    top: max(14px, env(safe-area-inset-top));
    bottom: auto;
  }
}

/* ---------- There's room for you ---------- */
.welcome {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(26, 20, 32, 0.45);
  opacity: 0;
  transition: opacity 0.8s;
}
.welcome[hidden],
html.js .welcome:not(.is-on) {
  display: none;
}
.welcome.is-on {
  opacity: 1;
  animation: welcome-in 1.2s ease-out;
}
@keyframes welcome-in {
  from {
    opacity: 0;
  }
}
html:not(.js) .welcome {
  position: relative;
  min-height: 100vh;
  opacity: 1;
  /* Without the drawing: the colours of the rose window */
  background:
    radial-gradient(circle at 50% 40%, rgba(236, 185, 46, 0.35), transparent 30%),
    radial-gradient(circle at 50% 40%, #2c4f9e 0 40%, #1a1620 72%);
}
/* ---------- After "Leave quietly": a quiet thank-you, and the way home ---------- */
.thanks {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 16px;
  text-align: center;
  color: var(--cream);
  background: #120e16;
  opacity: 0;
  transition: opacity 1.2s;
}
.thanks[hidden] {
  display: none;
}
.thanks.is-on {
  opacity: 1;
}
.thanks h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 6vw, 2.4rem);
}
.thanks h2:focus {
  outline: none;
}
.thanks__home {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--cream);
  text-underline-offset: 0.25em;
  opacity: 0.85;
}
.thanks__home:hover,
.thanks__home:focus-visible {
  opacity: 1;
}

.welcome__card {
  width: min(32rem, 100%);
  max-height: calc(100svh - 32px);
  overflow: auto;
  padding: 1.6rem 1.6rem 1.3rem;
  text-align: center;
  background: var(--cream);
  border: var(--stroke) solid var(--ink);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.welcome__when {
  margin: 0 0 0.6rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--ink-soft);
}
.welcome h2 {
  margin: 0 0 0.8rem;
  font-size: clamp(2rem, 1.5rem + 2vw, 2.6rem);
  line-height: 1.05;
}
.welcome h2:focus {
  outline: none;
}
.welcome__card > p {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  line-height: 1.55;
}
.welcome__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}
.welcome .btn {
  --btn-bg: var(--white);
}
.cathedral-page .btn--primary {
  --btn-bg: var(--logo-yellow);
}
.welcome .welcome__small {
  font-size: 0.86rem;
  color: var(--ink-soft);
}
.welcome .welcome__stay {
  margin: 0;
}
.btn--quiet {
  min-height: 44px;
  padding: 8px 20px;
  box-shadow: none;
}
.welcome__nojs {
  display: none;
}
html:not(.js) .welcome__nojs {
  display: block;
  margin: 0;
}
html:not(.js) .welcome__stay {
  display: none;
}

/* ---------- The bulletin ---------- */
.bulletin {
  width: min(34rem, calc(100% - 32px));
  max-height: calc(100svh - 32px);
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  overflow: visible;
}
.bulletin::backdrop {
  background: rgba(26, 20, 32, 0.6);
}
.bulletin__paper {
  max-height: calc(100svh - 32px);
  overflow: auto;
  padding: 1.4rem 1.5rem 1.2rem;
  background: #fffdf6;
  border: var(--stroke) solid var(--ink);
  border-radius: 6px;
  box-shadow: var(--shadow);
}
.bulletin__head {
  text-align: center;
  padding-bottom: 0.8rem;
  margin-bottom: 0.9rem;
  border-bottom: 2px solid var(--ink);
}
.bulletin__parish {
  margin: 0;
  font-family: var(--font-script);
  font-size: 1.35rem;
}
.bulletin h2 {
  margin: 0.1rem 0;
  font-size: 1.9rem;
}
.bulletin__date {
  margin: 0;
  font-size: 0.92rem;
  color: var(--ink-soft);
}
.bulletin h3 {
  margin: 0.9rem 0 0.3rem;
  font-size: 1.15rem;
}
.bulletin p,
.bulletin li {
  margin: 0 0 0.5rem;
  font-size: 0.98rem;
  line-height: 1.5;
}
.bulletin ul {
  margin: 0;
  padding-left: 1.2rem;
}
.bulletin a {
  font-weight: 600;
  color: var(--ink);
}
.bulletin__close {
  margin: 1rem 0 0;
  text-align: center;
}

@media (max-width: 520px) {
  .dock__btn,
  .leave,
  .chip {
    font-size: 0.92rem;
  }
  .chips {
    gap: 8px;
  }
  .chip {
    padding: 0.35em 0.75em;
  }
  .spot__label {
    font-size: 0.8rem;
  }
  /* Leave room above it for what it's about; it scrolls, and "Back to
     your seat" is at the top while it's up */
  .note {
    width: auto;
    right: 16px;
    max-height: min(58%, calc(100% - 110px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .spot--glow::before,
  .dock__btn.is-new,
  .welcome.is-on {
    animation: none;
  }
}
