/* Dancing Saints. Design tokens follow design.md (from saintgregorys.org). */
:root {
  --sg-black: #000000;
  --sg-teal: #155263;
  --sg-teal-dark: #0e2f38;
  --sg-white: #ffffff;
  --sg-butter: #fcefbc;
  --sg-cream: #faf6e5;
  --sg-saffron: #ffc93c;
  --sg-orange: #ff6f3c;
  --sg-green: #3b7659;
  --sg-wine: #a12a44;
  --sg-apricot: #ff9a3c;
  --sg-sage: #5e7c6d;
  --sg-sage-light: #98baa6;
  --sg-bg-warm: linear-gradient(#ffffff, #fcefbc);
  --sg-bg-soft: linear-gradient(#ffffff, #faf6e5);
  --sg-photo-scrim: linear-gradient(rgba(0,0,0,0) 45%, #000 100%);

  --ink: var(--sg-black);
  --muted: #4a5a55;
  --line: #e8e0c4;
  --accent: var(--sg-teal);
  --scrim: rgba(255, 255, 255, 0.3);

  --font: 'Lexend Deca', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-title: var(--font); /* page titles: Lexend Deca 600 */
  --fs-hero: 2.5rem;
  --fs-h1: 2rem;
  --fs-h2: 1.5rem;
  --fs-h3: 1.125rem;
  --fs-body: 1.0625rem;
  --fs-small: 0.9375rem;
  --fs-eyebrow: 0.75rem;

  --radius-btn: 6px;
  --gutter: 16px;
  --content: 1200px;
  --reading: 680px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
@media (min-width: 700px) {
  :root { --fs-hero: 4.25rem; --fs-h1: 2.625rem; --fs-h2: 1.625rem; --fs-body: 1.125rem; --gutter: 24px; }
}

.accent-orange { --accent: var(--sg-orange); }
.accent-green { --accent: var(--sg-green); }
.accent-wine { --accent: var(--sg-wine); }
.accent-teal { --accent: var(--sg-teal); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-body);
  font-weight: 300;
  line-height: 1.6;
  color: var(--ink);
  background: var(--sg-cream);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
[hidden] { display: none !important; }
h1, h2, h3 { line-height: 1.2; font-weight: 600; margin: 0 0 .5em; }
h1 { font-size: var(--fs-h1); letter-spacing: -0.01em; }
h2 { font-size: var(--fs-h2); }
strong { font-weight: 600; }
a { color: var(--sg-teal); }
button { font: inherit; color: inherit; }
/* No focus outlines after a tap or click; keyboard users get a subtle ring (js/app.js sets .kbd). */
html { -webkit-tap-highlight-color: transparent; }
:focus, :focus-visible { outline: none; }
.kbd :focus-visible { outline: 2px solid rgba(21,82,99,.55); outline-offset: 2px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: #fff; padding: 8px 12px; }
.skip-link:focus { left: 8px; }
.label { font-size: var(--fs-small); font-weight: 600; margin: 0; }
.muted { color: var(--muted); }

/* Section header: eyebrow, heading, short accent rule (as on saintgregorys.org) */
.eyebrow {
  margin: 0 0 6px; color: var(--accent);
  font-size: var(--fs-eyebrow); font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
}
.page h1, .intro__crawl h1, .topbar__title span { font-family: var(--font-title); font-weight: 600; letter-spacing: -0.01em; }
.page h1::after {
  content: ''; display: block; width: 40px; height: 3px; margin-top: 14px; background: var(--accent);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 20px; border-radius: var(--radius-btn);
  border: 2px solid transparent; font-weight: 600; font-size: 1rem; letter-spacing: .04em;
  text-decoration: none; cursor: pointer; transition: transform .15s, background-color .15s, color .15s;
}
.btn:active { transform: scale(.97); }
.btn--primary { background: var(--sg-teal); color: #fff; }
.btn--primary:hover { background: var(--sg-teal-dark); }
.btn--secondary { background: #fff; color: var(--sg-teal); border-color: var(--sg-teal); }
.btn--lang { background: #fff; color: var(--sg-teal); border-color: var(--sg-teal); min-width: 136px; }
.btn--lang[aria-pressed="true"] { background: var(--sg-teal); color: #fff; }
.btn--on-photo { background: #fff; color: var(--sg-teal); }
.btn--link-light { color: #fff; background: none; text-decoration: underline; text-underline-offset: 3px; font-weight: 400; letter-spacing: 0; }
.btn--wide { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--radius-btn);
  border: 0; background: transparent; cursor: pointer; color: inherit; padding: 0;
}
.icon-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn--outline { border: 2px solid var(--sg-teal); color: var(--sg-teal); }
.icon-btn:disabled { opacity: .3; cursor: default; }

/* ---------- Loading screen ---------- */
.splash {
  --svh: 1vh;   /* the screen height with the browser's bars showing */
  position: fixed; inset: 0; z-index: 30;
  display: flex; flex-direction: column; overflow: auto;
  padding: calc(var(--safe-t) + 16px) var(--gutter) calc(var(--safe-b) + 16px);
  background: var(--sg-bg-warm);
}
@supports (height: 1svh) { .splash { --svh: 1svh; } }
.splash__inner { margin: 0 auto; max-width: 440px; width: 100%; flex: 1 0 auto; text-align: center; display: flex; flex-direction: column; align-items: center; }
.splash__title { margin: clamp(4px, calc(3.5 * var(--svh)), 40px) 0 0; display: flex; flex-direction: column; align-items: center; text-transform: uppercase; }
.splash__the { font-size: 1.125rem; font-weight: 500; letter-spacing: .04em; color: var(--ink); }
.splash__name { margin: 4px 0 8px; max-width: 6.2em; font-size: clamp(2.25rem, min(15vw, calc(8 * var(--svh))), 4rem); font-weight: 700; line-height: .98; letter-spacing: .01em; color: var(--sg-teal); }
.splash__es { font-size: 1.125rem; font-weight: 400; letter-spacing: .01em; color: var(--ink); }
.splash__title::after { content: ''; width: 76px; height: 4px; margin-top: clamp(12px, calc(2.4 * var(--svh)), 20px); background: var(--sg-orange); }
.splash__quote { margin: clamp(16px, calc(4.5 * var(--svh)), 48px) 0 0; }
.splash__quote blockquote { margin: 0 auto; max-width: 12.7em; font-size: 1.375rem; line-height: 1.36; font-weight: 400; color: var(--sg-teal); }
.splash__quote p { margin: 0; }
.splash__quote figcaption { margin-top: clamp(16px, calc(3 * var(--svh)), 28px); color: #8f8f8f; font-size: .875rem; font-weight: 400; }
.splash .splash__lang { margin-top: clamp(18px, calc(5 * var(--svh)), 56px); gap: 36px; }
.splash .btn--lang { min-width: 110px; background: var(--sg-teal); color: #fff; border-color: #fff; box-shadow: 0 0 0 1px rgba(21,82,99,.25); border-radius: 6px; letter-spacing: 0; font-size: 1.125rem; font-weight: 500; }
.splash__logo { width: clamp(120px, calc(22 * var(--svh)), 200px); height: auto; margin-top: auto; margin-bottom: clamp(0px, calc(2 * var(--svh)), 24px); padding-top: clamp(16px, calc(4 * var(--svh)), 48px); }
.lang-buttons { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
@media (max-height: 700px) {
  .splash { padding-top: calc(var(--safe-t) + 8px); padding-bottom: calc(var(--safe-b) + 8px); }
  .splash__quote blockquote { font-size: 1.2rem; }
  .splash .btn--lang { min-height: 44px; padding-top: 8px; padding-bottom: 8px; }
}
@media (max-height: 600px) {
  .splash__the, .splash__es { font-size: 1rem; }
  .splash__quote blockquote { font-size: 1.1rem; }
  .splash__quote figcaption { margin-top: 10px; }
}
.splash.is-out { animation: fade-out .4s var(--ease) forwards; }
@keyframes fade-out { to { opacity: 0; visibility: hidden; } }

/* ---------- Intro: full-bleed photo hero with slowly scrolling text ---------- */
.splash--intro {
  padding: 0; color: #fff; background: #000 url(../img/communion.jpg) center / cover no-repeat;
}
.splash--intro::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(rgba(0,0,0,.55), rgba(0,0,0,.35) 40%, rgba(0,0,0,.85));
}
.intro__scroller {
  flex: 1; overflow: hidden; position: relative;
  -webkit-mask-image: linear-gradient(transparent, #000 12%, #000 80%, transparent);
          mask-image: linear-gradient(transparent, #000 12%, #000 80%, transparent);
}
.intro__crawl {
  max-width: 560px; margin: 0 auto; padding: 45vh var(--gutter) 30vh; text-align: center;
  will-change: transform;
}
.intro__christ { width: 48%; max-width: 220px; margin: 0 auto 28px; display: block; }
.intro__crawl h1 { font-size: var(--fs-hero); margin: 0; line-height: 1.1; }
.intro__church { font-size: var(--fs-small); margin: 8px 0 32px; color: var(--sg-butter); }
.intro__quote { margin: 0; }
.intro__quote blockquote { margin: 0; font-size: 1.5rem; line-height: 1.5; font-weight: 300; }
.intro__quote figcaption { color: var(--sg-saffron); margin-top: 12px; font-weight: 400; }
.intro__actions {
  position: relative; padding: 16px var(--gutter) calc(var(--safe-b) + 24px); text-align: center;
}
.intro__actions > div { display: grid; gap: 10px; max-width: 440px; margin: 0 auto; width: 100%; }
.intro__actions p { margin: 0 0 6px; }

/* ---------- Loader: loading image with a scanning light ---------- */
/* A band of full opacity moves up and down the picture; the mask only touches the painted
   pixels, so the empty space around the image stays empty. */
.loader { display: grid; justify-items: center; gap: 14px; text-align: center; }
.loader__image { position: relative; width: 150px; aspect-ratio: 3 / 4; }
.loader__image img {
  width: 100%; height: 100%; object-fit: contain; display: block;
  -webkit-mask-image: linear-gradient(rgba(0,0,0,.3) 0, rgba(0,0,0,.3) 38%, #000 50%, rgba(0,0,0,.3) 62%, rgba(0,0,0,.3) 100%);
  mask-image: linear-gradient(rgba(0,0,0,.3) 0, rgba(0,0,0,.3) 38%, #000 50%, rgba(0,0,0,.3) 62%, rgba(0,0,0,.3) 100%);
  -webkit-mask-size: 100% 300%; mask-size: 100% 300%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  animation: scan 1.6s ease-in-out infinite alternate;
}
@keyframes scan {
  from { -webkit-mask-position: 0 100%; mask-position: 0 100%; }
  to { -webkit-mask-position: 0 0; mask-position: 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  .loader__image img { -webkit-mask-image: none; mask-image: none; animation: pulse 1.6s ease-in-out infinite alternate !important; animation-duration: 1.6s !important; }
  @keyframes pulse { from { opacity: .4; } to { opacity: 1; } }
}

/* ---------- Shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--safe-t) + 6px) 6px 6px var(--gutter);
  background: #fff; color: var(--ink); border-bottom: 1px solid var(--line);
}
.topbar__title { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-size: 1.375rem; }
.topbar__title img { width: 32px; height: 32px; }
body.is-camera .topbar { position: fixed; left: 0; right: 0; }
body.is-camera.cam-live .topbar {
  border: 0; color: #fff; background: linear-gradient(rgba(0,0,0,.6), rgba(0,0,0,0));
}

.menu { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.35); }
.menu__panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(340px, 88vw);
  background: var(--sg-bg-soft); background-color: var(--sg-cream);
  padding: calc(var(--safe-t) + 8px) var(--gutter) calc(var(--safe-b) + 24px);
  display: flex; flex-direction: column; animation: slide-in .25s var(--ease);
}
@keyframes slide-in { from { transform: translateX(100%); } }
.menu__head { display: flex; align-items: center; justify-content: space-between; }
.menu__head .label { font-size: var(--fs-eyebrow); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--sg-teal); }
.menu__lang { display: inline-flex; border: 2px solid var(--sg-teal); border-radius: var(--radius-btn); overflow: hidden; margin: 12px 0 16px; align-self: flex-start; }
.menu__lang button { border: 0; background: none; padding: 8px 18px; min-height: 40px; font-weight: 600; cursor: pointer; color: var(--sg-teal); letter-spacing: .04em; }
.menu__lang button[aria-pressed="true"] { background: var(--sg-teal); color: #fff; }
.menu ul { list-style: none; margin: 0; padding: 0; }
.menu li a {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 4px; border-bottom: 1px solid var(--line);
  color: var(--ink); text-decoration: none; font-size: var(--fs-h3); font-weight: 400;
}
.menu li a::after { content: '›'; color: var(--sg-teal); font-size: 1.5rem; line-height: 1; }
.menu li a[aria-current="page"] { font-weight: 600; color: var(--sg-teal); }
.menu__foot { margin-top: auto; color: var(--muted); font-size: var(--fs-small); line-height: 1.5; }
.menu__foot a { color: inherit; }

.page { background: var(--sg-bg-soft); background-color: var(--sg-cream); min-height: calc(100vh - 57px); }
.page__inner { max-width: var(--reading); margin: 0 auto; padding: 28px var(--gutter) calc(var(--safe-b) + 56px); }
.lede { color: var(--muted); margin-top: 0; }

/* Desktop home: 2-up photo cards with a black bottom scrim */
.page__inner.home { max-width: var(--content); }
/* Computer: the saints list with links to the other pages beside it */
.browse-aside ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.browse-aside a { display: block; padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--sg-teal); font-weight: 600; text-decoration: none; }
.browse-aside a::after { content: '\00a0›'; color: var(--accent); }
.browse-aside [aria-current] { display: block; padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-weight: 600; }
.browse-aside a:hover { text-decoration: underline; text-underline-offset: 3px; }
.browse-layout:has(.browse-aside:not([hidden])) { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 40px; max-width: calc(var(--reading) + 288px + 2 * var(--gutter)); margin: 0 auto; }
.browse-layout:has(.browse-aside:not([hidden])) .page__inner { margin: 0; max-width: none; }
.browse-aside:not([hidden]) { padding: 24px 0 0; }
.browse-aside > ul { position: sticky; top: 96px; }
@media (max-width: 760px) { .browse-layout:has(.browse-aside:not([hidden])) { display: block; } .browse-aside:not([hidden]) { padding: 0 var(--gutter) 48px; } }
.home h1, .home .lede { max-width: var(--reading); }
.cards { list-style: none; padding: 0; margin: 32px 0 0; display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .cards { grid-template-columns: 1fr 1fr; } }
.card {
  position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden; background: #000;
  color: #fff; text-decoration: none;
}
.card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease); }
.card--christ img { object-fit: contain; background: var(--sg-teal-dark); }
.card::after { content: ''; position: absolute; inset: 0; background: var(--sg-photo-scrim); }
.card:hover img { transform: scale(1.03); }
.card__text { position: absolute; left: 20px; right: 20px; bottom: 18px; z-index: 1; }
.card__title { font-size: 1.375rem; font-weight: 600; line-height: 1.25; }
.card__title::after { content: ' ›'; }

/* ---------- Browse ---------- */
.filter { position: relative; margin: 20px 0 12px; }
.filter svg { position: absolute; left: 14px; top: 50%; translate: 0 -50%; width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 2; }
.filter input {
  width: 100%; min-height: 48px; padding: 10px 14px 10px 44px; font: inherit; font-weight: 300;
  border: 1px solid #cfc6a6; border-radius: var(--radius-btn); background: #fff;
}
.filter input:focus { border-color: var(--sg-teal); }
.saint-list { list-style: none; margin: 0; padding: 0; }
.saint-list li + li { border-top: 1px solid var(--line); }
.saint-list__head h2 { margin: 36px 0 8px; font-size: var(--fs-h2); }
.saint-list li.saint-list__head, .saint-list li.saint-list__head + li { border-top: 0; }
.profile__dates[hidden] + .profile__bio { margin-top: 18px; }
.profile__source { display: block; margin-top: 14px; font-size: var(--fs-small); color: var(--muted); }
.saint-row {
  width: 100%; display: flex; align-items: center; gap: 14px; padding: 10px 0;
  background: none; border: 0; text-align: left; cursor: pointer;
}
.saint-row::after { content: '›'; margin-left: auto; color: var(--accent); font-size: 1.5rem; line-height: 1; padding-right: 4px; }
.thumb {
  border-radius: 4px;
  width: 64px; height: 64px; flex: none; overflow: hidden;
  background: linear-gradient(100deg, #efe7c9 30%, #f8f2dc 50%, #efe7c9 70%) 0 0 / 300% 100%;
  animation: shimmer 1.4s linear infinite;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .3s; }
.thumb.is-loaded { animation: none; }
.thumb.is-loaded img { opacity: 1; }
@keyframes shimmer { to { background-position: -300% 0; } }
.saint-row__text { display: grid; }
.saint-row__name { font-size: var(--fs-h3); font-weight: 600; line-height: 1.3; }
.saint-row__dates { font-size: var(--fs-small); color: var(--muted); }

/* ---------- Prose pages ---------- */
.prose p { margin: 0 0 1em; }
.byline { color: var(--muted); }
.prose figure { margin: 28px calc(-1 * var(--gutter)); }
@media (min-width: 700px) { .prose figure { margin: 28px 0; } }
.prose figure img { display: block; width: 100%; }
.poem {
  margin: 36px 0; padding: 24px; text-align: center; background: var(--sg-butter);
  font-weight: 400; font-size: 1.25rem; line-height: 1.6;
}
.poem p { margin: 0; }
.poem cite { display: block; margin-top: 10px; font-size: var(--fs-small); font-style: normal; color: var(--accent); font-weight: 600; }
.portrait { display: block; width: 60%; max-width: 260px; margin: 8px 0 24px; }
.dropcap::first-letter { float: left; font-size: 3.5em; line-height: .9; margin: 4px 4px 0 0; color: var(--accent); font-weight: 600; }

/* ---------- Camera ---------- */
.camera { position: fixed; inset: 0; background: #000; overflow: hidden; touch-action: manipulation; }
.camera video, .camera canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.camera__spots { position: absolute; inset: 0; }
.spot {
  position: absolute; left: 0; top: 0; border-radius: 50%; padding: 0; cursor: pointer;
  border: 3px solid #fff; background: transparent;
  box-shadow: 0 0 0 2px var(--sg-teal), inset 0 0 0 1px rgba(21,82,99,.6);
  transition: opacity .25s;
  min-width: 72px; min-height: 72px;
}
.spot.is-stale, .spot.is-pending { opacity: 0; pointer-events: none; }
.camera__scrim { position: absolute; inset: 0; width: 100%; height: 100%; }
.camera__ring { fill: none; stroke: var(--sg-saffron); stroke-width: 4; }
.camera__status, .camera__banner {
  position: absolute; left: 50%; translate: -50% 0; margin: 0; text-align: center;
  width: max-content; max-width: calc(100% - 2 * var(--gutter));
  padding: 10px 18px; border-radius: var(--radius-btn); font-weight: 400;
}
.camera__status { bottom: calc(var(--safe-b) + 28px); background: rgba(0,0,0,.7); color: #fff; }
.camera__status:empty { display: none; }
.camera__banner { top: calc(var(--safe-t) + 72px); background: #fff; color: var(--ink); font-weight: 600; border-bottom: 3px solid var(--sg-saffron); }
.camera .loader { position: absolute; inset: 0; place-content: center; background: var(--sg-bg-warm); background-color: var(--sg-butter); color: var(--ink); }
.camera__error {
  position: absolute; inset: 0; display: grid; place-content: center; gap: 12px; padding: var(--gutter);
  background: var(--sg-bg-soft); background-color: var(--sg-cream); text-align: center;
}
.camera__error p { max-width: 340px; margin: 0 auto 8px; }
.camera.is-frozen .camera__status { display: none; }

.tray {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  padding: 20px var(--gutter) calc(var(--safe-b) + 20px);
  background: #fff; box-shadow: 0 -8px 30px rgba(0,0,0,.25);
  animation: pop-up .32s var(--ease);
}
@keyframes pop-up { from { transform: translateY(100%); } }
.tray__step { max-width: 440px; margin: 0 auto; }
.tray__step[data-step="choose"] { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.guess { display: grid; gap: 12px; padding-top: 12px; transition: opacity .35s, transform .35s; }
.guess label { font-weight: 600; }
.guess.is-dissolving, .tray__step.is-dissolving { opacity: 0; transform: translateY(8px); }
.combo { position: relative; }
.combo input {
  width: 100%; min-height: 50px; padding: 10px 14px; font: inherit; font-weight: 400; font-size: 1.0625rem;
  border: 2px solid #cfc6a6; border-radius: var(--radius-btn);
}
.combo input:focus { border-color: var(--sg-teal); outline: none; }
.combo__list {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); margin: 0; padding: 6px; list-style: none;
  background: #fff; border-radius: var(--radius-btn); box-shadow: 0 6px 24px rgba(0,0,0,.2); max-height: 40vh; overflow: auto;
}
.combo__list li { padding: 10px 12px; border-radius: 4px; cursor: pointer; font-weight: 400; }
.combo__list li[aria-selected="true"], .combo__list li:hover { background: var(--sg-cream); }
.tray__wait { text-align: center; margin: 8px auto; color: var(--ink); }
.tray__wait::after { content: ''; display: inline-block; width: 14px; height: 14px; margin-left: 10px; vertical-align: -2px;
  border: 2px solid var(--sg-teal); border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pick__q { margin: 0 0 10px; font-weight: 600; text-align: center; }
.pick__list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pick__btn { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; padding: 8px 4px;
  border: 1px solid rgba(0,0,0,.12); border-radius: 8px; background: #fff; color: var(--ink); font: inherit; font-size: 14px; line-height: 1.25; cursor: pointer; }
.pick__btn img { width: 64px; height: 64px; border-radius: 4px; object-fit: cover; }
.tray__result { text-align: center; font-size: var(--fs-h1); font-weight: 600; color: var(--sg-teal); margin: 8px auto; animation: pop .4s var(--ease); }
@keyframes pop { from { transform: scale(.7); opacity: 0; } }

/* ---------- Profile bottom sheet ---------- */
.sheet {
  padding: 0; border: 0; margin: 0; max-width: none; max-height: none; width: 100%; height: 100%;
  background: transparent; overflow: hidden; overflow: clip;   /* clip: the dialog itself must never scroll */
}
.sheet::backdrop { background: var(--scrim); }
.sheet__panel {
  position: absolute; left: 0; right: 0; bottom: 0; height: 85%; height: 85dvh;
  max-width: var(--reading); margin: 0 auto;
  display: flex; flex-direction: column;
  background: var(--sg-bg-soft); background-color: var(--sg-cream);
  border-radius: 12px 12px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,.25);
  transform: translateY(100%); transition: transform .3s var(--ease);
}
.sheet.is-open .sheet__panel { transform: none; }
/* iOS Safari shows the page itself, not fixed layers, under its floating bottom toolbar. So while
   the sheet is open the page can't scroll, and once the sheet is up the page under it is hidden
   and the area below the sheet takes the sheet's colour. */
html.sheet-lock { overflow: hidden; overscroll-behavior: none; }
html.sheet-open body { background: var(--sg-cream); }
html.sheet-open .page { visibility: hidden; }
.sheet__grip { width: 44px; height: 5px; border-radius: 3px; background: #d8cfae; margin: 10px auto 0; flex: none; }
.sheet__close { position: absolute; top: 8px; right: 8px; color: var(--ink); z-index: 2; background: var(--sg-cream); border-radius: 50%; }
.sheet__scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 14px calc(var(--gutter) + 18px) 16px; }
.profile__media { position: relative; width: 60%; max-width: 260px; margin: 10px auto 20px; }
.profile__img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; background: #efe7c9; border-radius: 8px; }
.profile__media .dissolve { position: absolute; inset: 0; height: 100%; }
.profile__media.is-mural { width: 80%; max-width: 360px; }
.profile__media.is-mural .profile__img { aspect-ratio: auto; object-fit: contain; }
/* Paired saints: the second portrait slowly fades in over the first and out again. */
.dissolve { animation: dissolve 10s ease-in-out infinite; }
@keyframes dissolve { 0%, 35% { opacity: 0; } 50%, 85% { opacity: 1; } 100% { opacity: 0; } }
.thumb--pair { position: relative; }
.thumb--pair img.dissolve { position: absolute; inset: 0; }
.thumb.is-loaded img.dissolve { opacity: 0; animation: dissolve 10s ease-in-out infinite; }
.profile__name { text-align: center; margin-bottom: 4px; }
.profile__dates { text-align: center; color: var(--muted); margin: 0 0 18px; font-size: var(--fs-small); }
.profile__dates::after { content: ''; display: block; width: 40px; height: 3px; margin: 14px auto 0; background: var(--sg-saffron); }
.profile__bio { margin: 0 0 16px; }
.profile__feast { margin: 0 0 16px; text-align: center; text-transform: uppercase; font-size: 0.8em; letter-spacing: 0.08em; }
.sheet__foot {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  /* after the text (not pinned); extra room below so it scrolls clear of Safari's toolbar */
  padding: 8px 0 calc(var(--safe-b) + 28px);
}
.sheet__foot .btn { min-width: 140px; }
.sheet:not(.is-browse) #sheet-prev, .sheet:not(.is-browse) #sheet-next { display: none; }

@media (prefers-reduced-motion: reduce) {
  .dissolve, .thumb.is-loaded img.dissolve { animation: none !important; opacity: 0 !important; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
