/* =========================================
   Church Kiosk – style.css
   1920×1080 touchscreen: fixed header/footer, scrollable main.
   Colours, fonts, sizes and shapes come from CSS variables that
   Admin › Settings › Appearance overrides (see lib/settings.php theme_css()).
   ========================================= */

/* ---------- Theme variables (defaults = "Warm stone") ---------- */
:root{
  --bg: #f6f4ef;
  --surface: #ffffff;
  --text: #101828;
  --accent: #1b5fa7;
  --accent-2: #0f766e;
  --header-bg: #ffffff;
  --header-text: #101828;
  --footer-bg: #ffffff;
  --footer-text: #475467;
  --button-bg: #1b5fa7;
  --button-text: #ffffff;

  --radius: 16px;
  --shadow: 0 2px 4px rgba(16,24,40,.04), 0 8px 24px rgba(16,24,40,.07);
  --font-body: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --font-heading: var(--font-body);
  --text-scale: 1;
  --home-cols: 3;

  /* Derived from the above */
  --text-muted: color-mix(in srgb, var(--text) 68%, var(--surface));
  --border: color-mix(in srgb, var(--text) 13%, transparent);
  --accent-soft: color-mix(in srgb, var(--accent) 11%, var(--surface));
  --accent-2-soft: color-mix(in srgb, var(--accent-2) 13%, var(--surface));
  --header-muted: color-mix(in srgb, var(--header-text) 72%, var(--header-bg));
  --radius-lg: calc(var(--radius) * 1.4);
  --radius-sm: calc(var(--radius) * .6);
  --heading-weight: 800;
  --heading-transform: none;
  --heading-spacing: -0.015em;
  --heading-variant: normal;

  --header-h: 112px;
  --footer-h: 78px;
}

/* Every font size is written as calc(Npx * var(--text-scale)) so Settings › Text size scales it */

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }

body{
  margin: 0;
  font-family: var(--font-body);
  font-size: calc(20px * var(--text-scale));
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;           /* only .main scrolls */
  /* Touchscreen: vertical swipes scroll; no pinch-zoom, double-tap zoom or sideways swipes */
  touch-action: pan-y;
  overscroll-behavior: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  user-select: none;          /* no accidental text selection on a touchscreen */
}
body.no-cursor, body.no-cursor *{ cursor: none !important; }

html{ overscroll-behavior: none; touch-action: pan-y; }
img{ max-width: 100%; -webkit-user-drag: none; user-drag: none; }
a{ -webkit-user-drag: none; }

h1, h2, h3,
.page__title, .home__title, .card__title, .event__title, .gallery__title, .screensaver__title, .home__button-title{
  font-family: var(--font-heading);
  font-weight: var(--heading-weight);
  text-transform: var(--heading-transform);
  letter-spacing: var(--heading-spacing);
  font-variant-caps: var(--heading-variant);
  line-height: 1.15;
}
body.headings-regular{ --heading-weight: 500; --heading-spacing: -0.01em; }
body.headings-uppercase{ --heading-transform: uppercase; --heading-spacing: 0.04em; --heading-weight: 750; }
body.headings-smallcaps{ --heading-variant: small-caps; --heading-spacing: 0.02em; --heading-weight: 700; }

/* ---------- Layout ---------- */
.app{
  height: 100vh;
  display: grid;
  grid-template-rows: var(--header-h) 1fr var(--footer-h);
}

.main{
  height: 100%;
  overflow: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 36px 104px 48px 40px;  /* right padding leaves room for the scrollbar column */
  position: relative;
  scrollbar-width: none;
}
.main::-webkit-scrollbar{ width: 0; height: 0; }

.content{
  max-width: 1600px;
  margin: 0 auto;
  animation: page-in .28s ease-out;
}
@keyframes page-in{ from{ opacity: 0; transform: translateY(8px); } to{ opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce){ .content{ animation: none; } }

/* ---------- Header ---------- */
.header{
  background: var(--header-bg);
  color: var(--header-text);
  border-top: 6px solid var(--accent-2);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(16,24,40,.06);
  position: relative;
  z-index: 2;
}
.header__inner{
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 32px;
}
.header__inner--centered{ position: relative; justify-content: center; }

.header__logo{
  position: absolute;
  left: 32px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: calc(50% - 160px);   /* never runs under the Home button */
}
.header__brand-img{
  height: 68px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
}
.header__text{ display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.header__title{
  font-family: var(--font-heading);
  font-size: calc(25px * var(--text-scale));
  font-weight: var(--heading-weight);
  text-transform: var(--heading-transform);
  letter-spacing: var(--heading-spacing);
  font-variant-caps: var(--heading-variant);
  color: var(--header-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.header__subtitle{
  margin-top: 4px;
  font-size: calc(15px * var(--text-scale));
  color: var(--header-muted);
  letter-spacing: .06em;
  text-transform: uppercase;
}

/* Big central Home button */
.home-button{
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 38px;
  min-height: 68px;
  border-radius: 999px;
  text-decoration: none;
  background: var(--button-bg);
  color: var(--button-text);
  font-size: calc(22px * var(--text-scale));
  font-weight: 800;
  letter-spacing: .02em;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--button-bg) 35%, transparent);
  transition: transform .08s ease, box-shadow .08s ease;
}
.home-button:active{ transform: scale(.96); box-shadow: none; }
.home-button__icon{ font-size: 1.3em; line-height: 1; }
body.page-home .home-button{ visibility: hidden; }   /* already home */

/* ---------- Footer ---------- */
.footer{
  background: var(--footer-bg);
  color: var(--footer-text);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  position: relative;
  z-index: 2;
}
.footer__inner{
  width: 100%;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.footer__text{
  font-size: calc(14px * var(--text-scale));
  color: var(--footer-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Logos sit on white so they look right on any footer colour */
.footer__logos{
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: nowrap;
  background: #fff;
  padding: 6px 16px;
  border-radius: var(--radius-sm);
}
.footer__logos img{
  max-height: 46px;
  max-width: 170px;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* ---------- Page basics ---------- */
.page__title{
  margin: 0 0 22px;
  font-size: calc(56px * var(--text-scale));
  color: var(--text);
}
.page__title::after{
  content: "";
  display: block;
  width: 88px;
  height: 6px;
  margin-top: 16px;
  border-radius: 999px;
  background: var(--accent-2);
}
.page__text{
  margin: 0 0 24px;
  font-size: calc(23px * var(--text-scale));
  color: var(--text-muted);
  line-height: 1.55;
  max-width: 1200px;
}
.page__text a{ color: var(--accent); }

/* ---------- Cards ---------- */
.card, .event{
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: var(--radius-lg);
  padding: 30px 34px;
}
.card + .card{ margin-top: 18px; }

.card__title{
  margin: 0 0 12px;
  font-size: calc(30px * var(--text-scale));
  color: var(--accent);
}
.card__body{
  margin: 0;
  font-size: calc(21px * var(--text-scale));
  color: var(--text);
  line-height: 1.6;
}
.card-list{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.card-list > .card + .card{ margin-top: 0; }
.card-list > .page__text{ grid-column: 1 / -1; }

/* ---------- Formatted text (lib/markup.php) ---------- */
.rt > :first-child{ margin-top: 0; }
.rt > :last-child{ margin-bottom: 0; }
.rt p{ margin: 0 0 .8em; max-width: 72ch; }
.rt h3{
  font-size: 1.2em;
  color: var(--accent);
  margin: 1.2em 0 .4em;
}
.rt ul, .rt ol{ margin: 0 0 .9em; padding-left: 1.4em; max-width: 72ch; }
.rt li{ margin: 0 0 .45em; padding-left: .2em; }
.rt ul li::marker{ color: var(--accent-2); font-size: 1.1em; }
.rt ol li::marker{ color: var(--accent); font-weight: 700; }
.rt strong{ font-weight: 700; }
.rt mark{
  background: color-mix(in srgb, var(--accent-2) 22%, var(--surface));
  color: inherit;
  padding: 0 .2em;
  border-radius: 4px;
}
.rt blockquote{
  margin: 0 0 .9em;
  padding: .5em 0 .5em 1em;
  border-left: 5px solid var(--accent-2);
  font-style: italic;
  font-size: 1.08em;
  color: var(--text);
  background: var(--accent-2-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  max-width: 72ch;
}

/* ---------- Home screen ---------- */
.home__title{
  margin: 8px 0 12px;
  font-size: calc(68px * var(--text-scale));
  color: var(--text);
}
.home__intro{
  margin: 0 0 32px;
  font-size: calc(25px * var(--text-scale));
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 1200px;
}
.home__grid{
  display: grid;
  grid-template-columns: repeat(var(--home-cols), minmax(0, 1fr));
  gap: 24px;
}
.home__button{
  position: relative;
  text-decoration: none;
  color: var(--text);
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 30px 72px 30px 32px;
  min-height: 176px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  transition: transform .08s ease, box-shadow .08s ease;
}
.home__button::before{            /* accent stripe */
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 8px;
  background: var(--accent);
}
.home__button::after{             /* arrow */
  content: "→";
  position: absolute;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  font-size: calc(34px * var(--text-scale));
  color: var(--accent);
  opacity: .8;
}
.home__button:active{ transform: scale(.975); box-shadow: none; }
.home__button-title{
  font-size: calc(32px * var(--text-scale));
  color: inherit;
}
.home__button-desc{
  margin-top: 8px;
  font-size: calc(19px * var(--text-scale));
  color: var(--text-muted);
}
.home__button-desc:empty{ display: none; }

/* Home button styles (Settings › Appearance) */
body.home-buttons-filled .home__button{
  background: var(--button-bg);
  color: var(--button-text);
  border-color: transparent;
}
body.home-buttons-filled .home__button::before{ display: none; }
body.home-buttons-filled .home__button::after{ color: var(--button-text); }
body.home-buttons-filled .home__button-desc{ color: color-mix(in srgb, var(--button-text) 80%, var(--button-bg)); }

body.home-buttons-outline .home__button{
  background: transparent;
  border: 3px solid var(--accent);
  box-shadow: none;
}
body.home-buttons-outline .home__button::before{ display: none; }

/* ---------- Events ---------- */
.event-list{ display: grid; gap: 18px; }
.event{
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.event__date{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 6px 14px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent);
  text-align: center;
  line-height: 1;
}
.event__dow{ font-size: calc(16px * var(--text-scale)); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.event__day{ font-family: var(--font-heading); font-size: calc(46px * var(--text-scale)); font-weight: 800; margin: 6px 0 4px; }
.event__month{ font-size: calc(17px * var(--text-scale)); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.event--soon .event__date{ background: var(--accent); color: var(--surface); }

.event__title{
  margin: 0 0 8px;
  font-size: calc(32px * var(--text-scale));
  color: var(--text);
}
.event__meta{
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: calc(20px * var(--text-scale));
}
.event__when{ font-weight: 700; color: var(--text); }
.event--soon .event__when{ color: var(--accent); }
.event__repeat{
  display: inline-block;
  margin: 0 0 14px;
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--accent-2-soft);
  color: var(--accent-2);
  font-size: calc(16px * var(--text-scale));
  font-weight: 700;
}
.event__body{
  margin: 0;
  font-size: calc(21px * var(--text-scale));
  color: var(--text);
  line-height: 1.6;
}
.event__image{
  display: block;
  width: 100%;
  max-width: 900px;
  height: auto;
  border-radius: var(--radius);
  margin: 6px 0 16px;
}

/* ---------- Map & memorials ---------- */
.map{ margin: 8px 0 24px; }
.map__image{
  width: 100%;
  max-width: 1300px;
  height: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: block;
}
.card .map__image{ margin-top: 16px; box-shadow: none; border-radius: var(--radius); }

/* ---------- Gallery ---------- */
.gallery{ margin-top: 28px; }
.gallery__title{
  margin: 0 0 16px;
  font-size: calc(32px * var(--text-scale));
  color: var(--text);
}
.gallery__grid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.gallery__item{
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.gallery__img{
  width: 100%;
  height: 280px;
  object-fit: cover;
  display: block;
}
.gallery__caption{
  padding: 12px 16px 14px;
  font-size: calc(17px * var(--text-scale));
  color: var(--text-muted);
}

/* ---------- Screensaver ---------- */
.screensaver{
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
}
.screensaver.screensaver--visible{ display: flex; animation: fade-in .6s ease; }
@keyframes fade-in{ from{ opacity: 0; } to{ opacity: 1; } }

body.screensaver-accent .screensaver{
  background: linear-gradient(140deg, var(--accent), color-mix(in srgb, var(--accent) 45%, var(--accent-2)));
  color: #fff;
}
body.screensaver-light .screensaver{ background: var(--bg); color: var(--text); }
body.screensaver-image .screensaver{
  background:
    linear-gradient(rgba(10,14,22,.35), rgba(10,14,22,.65)),
    var(--screensaver-image, none) center / cover no-repeat,
    var(--accent);
  color: #fff;
}
.screensaver__inner{ padding: 40px; max-width: 1400px; }
.screensaver__title{
  margin: 0 0 28px;
  font-size: calc(84px * var(--text-scale));
  color: inherit;
  text-shadow: 0 2px 20px rgba(0,0,0,.18);
}
body.screensaver-light .screensaver__title{ text-shadow: none; color: var(--accent); }
.screensaver__subtitle{
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin: 0;
  padding: 16px 34px;
  border-radius: 999px;
  font-size: calc(28px * var(--text-scale));
  font-weight: 600;
  background: rgba(255,255,255,.16);
  border: 2px solid rgba(255,255,255,.45);
  animation: pulse 2.6s ease-in-out infinite;
}
body.screensaver-light .screensaver__subtitle{
  background: var(--button-bg);
  color: var(--button-text);
  border-color: transparent;
}
.screensaver__hand{ font-size: 1.2em; }
@keyframes pulse{ 0%,100%{ transform: scale(1); } 50%{ transform: scale(1.05); } }
@media (prefers-reduced-motion: reduce){ .screensaver__subtitle{ animation: none; } }

/* Photo slideshow (Admin › Settings): photos crossfade with a slow zoom; text sits low over a shade */
.screensaver.screensaver--slideshow{ background: #0b0d12; color: #fff; overflow: hidden; }
.screensaver__slides{ position: absolute; inset: 0; }
.screensaver__slide{
  position: absolute;
  inset: 0;
  background: center / cover no-repeat;
  opacity: 0;
  transition: opacity 1.6s ease;
}
.screensaver__slide.is-active{ opacity: 1; animation: slide-zoom var(--slide-duration, 10s) linear forwards; }
@keyframes slide-zoom{ from{ transform: scale(1); } to{ transform: scale(1.08); } }
.screensaver--slideshow::after{
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0) 45%, rgba(0,0,0,.6));
  pointer-events: none;
}
.screensaver--slideshow .screensaver__inner{ position: relative; z-index: 1; align-self: flex-end; margin-bottom: 7vh; }
body .screensaver--slideshow .screensaver__title{ color: #fff; text-shadow: 0 2px 24px rgba(0,0,0,.55); }
body .screensaver--slideshow .screensaver__subtitle{
  background: rgba(255,255,255,.16);
  color: #fff;
  border: 2px solid rgba(255,255,255,.5);
  backdrop-filter: blur(6px);
}
.screensaver--no-text .screensaver__inner{ display: none; }
.screensaver--no-text::after{ display: none; }
@media (prefers-reduced-motion: reduce){ .screensaver__slide.is-active{ animation: none; } }

/* ---------- Focus (keyboard / accessibility) ---------- */
a:focus-visible, button:focus-visible{
  outline: 4px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 3px;
}

/* ---------- Kiosk scrollbar ---------- */
/* A fixed column on the right, between header and footer, whenever the page can scroll */
.kiosk-scroll{
  --sb-width: 64px;
  --sb-track: color-mix(in srgb, var(--text) 8%, var(--bg));
  --sb-thumb-a: var(--accent);
  --sb-thumb-b: color-mix(in srgb, var(--accent) 70%, var(--accent-2));
  position: fixed;
  top: calc(var(--header-h) + 16px);
  bottom: calc(var(--footer-h) + 16px);
  right: 14px;
  width: var(--sb-width);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  z-index: 4;
  animation: sb-in .35s ease-out;
}
.kiosk-scroll[hidden]{ display: none; }
@keyframes sb-in{ from{ opacity: 0; transform: translateX(12px); } to{ opacity: 1; transform: none; } }

/* ▲ ▼ buttons */
.kiosk-scroll__btn{
  flex: none;
  width: var(--sb-width);
  height: var(--sb-width);
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--accent) 35%, var(--surface));
  background: var(--surface);
  color: var(--accent);
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(16,24,40,.12);
  transition: transform .1s ease, background .15s ease, opacity .2s ease, box-shadow .15s ease;
}
.kiosk-scroll__btn svg{
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.kiosk-scroll__btn:active{
  transform: scale(.92);
  background: var(--accent);
  color: var(--surface);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 22%, transparent);
}
.kiosk-scroll__btn:disabled{
  opacity: .35;
  box-shadow: none;
  cursor: default;
}

/* Track */
.kiosk-scroll__track{
  position: relative;
  flex: 1;
  width: 30px;
  border-radius: 999px;
  background: var(--sb-track);
  box-shadow: inset 0 2px 6px rgba(16,24,40,.12), inset 0 0 0 1px color-mix(in srgb, var(--text) 8%, transparent);
  cursor: pointer;
  touch-action: none;
  outline: none;
}
.kiosk-scroll__track:focus-visible{ box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 45%, transparent); }

/* Soft trail showing how far down the page you are */
.kiosk-scroll__fill{
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  border-radius: 999px;
  background: linear-gradient(to bottom, transparent, color-mix(in srgb, var(--accent) 22%, transparent));
  pointer-events: none;
  transition: height .08s linear;
}

/* Thumb: wider than the track so it's easy to grab */
.kiosk-scroll__thumb{
  position: absolute;
  left: 50%;
  top: 0;
  width: 46px;
  margin-left: -23px;
  min-height: 96px;
  border-radius: 999px;
  background: linear-gradient(160deg, var(--sb-thumb-a), var(--sb-thumb-b));
  box-shadow:
    0 6px 16px color-mix(in srgb, var(--accent) 38%, transparent),
    inset 0 1px 0 rgba(255,255,255,.35),
    inset 0 -2px 0 rgba(0,0,0,.12);
  touch-action: none;
  cursor: grab;
  display: grid;
  place-items: center;
  transition: box-shadow .15s ease, width .15s ease, margin .15s ease;
  will-change: transform;
}
/* Grip: three raised lines */
.kiosk-scroll__grip{
  /* Same colour as button text, so it reads on light and dark themes */
  --grip: var(--button-text);
  width: 20px;
  height: 14px;
  background:
    linear-gradient(var(--grip), var(--grip)) 0 0 / 100% 2px no-repeat,
    linear-gradient(var(--grip), var(--grip)) 0 6px / 100% 2px no-repeat,
    linear-gradient(var(--grip), var(--grip)) 0 12px / 100% 2px no-repeat;
  border-radius: 2px;
  opacity: .85;
}
.kiosk-scroll.is-dragging .kiosk-scroll__thumb{
  cursor: grabbing;
  width: 54px;
  margin-left: -27px;
  box-shadow:
    0 0 0 8px color-mix(in srgb, var(--accent) 20%, transparent),
    0 10px 24px color-mix(in srgb, var(--accent) 45%, transparent),
    inset 0 1px 0 rgba(255,255,255,.35);
}
.kiosk-scroll.is-dragging .kiosk-scroll__fill{ transition: none; }

/* "There's more below" fade at the bottom of the page area */
.scroll-more{
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--footer-h);
  height: 90px;
  background: linear-gradient(to bottom, transparent, color-mix(in srgb, var(--bg) 92%, transparent));
  pointer-events: none;
  opacity: 0;
  transition: opacity .25s ease;
  z-index: 1;
}
.scroll-more.is-visible{ opacity: 1; }


@media (prefers-reduced-motion: reduce){
  .kiosk-scroll{ animation: none; }
  .kiosk-scroll__fill{ transition: none; }
}

/* ---------- Shared bits ---------- */
.hint{
  margin: 18px 0 0;
  font-size: calc(18px * var(--text-scale));
  color: var(--text-muted);
  text-align: center;
}
a[data-lightbox]{ display: block; cursor: zoom-in; }

/* ---------- Gallery page ---------- */
.photo-grid{
  --cols: 3;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: 18px;
}
.photo-grid__item{
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform .08s ease;
}
.photo-grid__item:active{ transform: scale(.98); }
.photo-grid__item img{ display: block; width: 100%; }
.photo-grid--square .photo-grid__item img{ aspect-ratio: 4 / 3; object-fit: cover; }
.photo-grid--natural{ align-items: start; }
.photo-grid--natural .photo-grid__item img{ height: auto; }
.photo-grid__caption{
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 36px 18px 14px;
  background: linear-gradient(transparent, rgba(0,0,0,.72));
  color: #fff;
  font-size: calc(18px * var(--text-scale));
  font-weight: 600;
  line-height: 1.3;
}

/* ---------- Full-screen photo viewer (lightbox.js) ---------- */
.lightbox{
  position: fixed;
  inset: 0;
  z-index: 9000;                 /* below the screensaver */
  background: rgba(8, 10, 14, .94);
  display: none;
  touch-action: none;
}
.lightbox.is-open{ display: block; animation: fade-in .2s ease; }
.lightbox__stage{
  position: absolute;
  inset: 24px 120px 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox__img{
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  opacity: 0;
  transition: opacity .2s ease;
}
.lightbox__img.is-shown{ opacity: 1; }
.lightbox__btn{
  position: absolute;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35);
  background: rgba(255,255,255,.12);
  color: #fff;
  font-size: 54px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.lightbox__btn:active{ background: rgba(255,255,255,.3); }
.lightbox__close{ top: 24px; right: 24px; width: 76px; height: 76px; font-size: 34px; }
.lightbox__prev{ left: 20px; top: 50%; transform: translateY(-50%); }
.lightbox__next{ right: 20px; top: 50%; transform: translateY(-50%); }
.lightbox__btn[hidden]{ display: none; }
.lightbox__bar{
  position: absolute;
  left: 0; right: 0; bottom: 0;
  min-height: 100px;
  padding: 18px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: #fff;
}
.lightbox__caption{ font-size: calc(24px * var(--text-scale)); font-weight: 600; }
.lightbox__tools{ display: flex; align-items: center; gap: 20px; margin-left: auto; }
.lightbox__count{ font-size: calc(20px * var(--text-scale)); opacity: .8; }
.lightbox__play{
  font: inherit;
  font-size: calc(18px * var(--text-scale));
  font-weight: 700;
  color: #fff;
  background: rgba(255,255,255,.14);
  border: 2px solid rgba(255,255,255,.4);
  border-radius: 999px;
  padding: 12px 24px;
  min-height: 56px;
  cursor: pointer;
}
.lightbox__play[hidden]{ display: none; }

/* ---------- Interactive church map ---------- */
.church-map{
  display: grid;
  grid-template-columns: minmax(0, 1fr) 520px;
  gap: 28px;
  align-items: start;
}
.church-map__canvas{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 16px;
}
.church-map__frame{ position: relative; }
.church-map__img{
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
}
.church-map__missing{
  padding: 80px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: calc(22px * var(--text-scale));
}

.map-pin{
  position: absolute;
  transform: translate(-50%, -50%);
  width: 64px;                    /* finger-sized target */
  height: 64px;
  padding: 0;
  border: 0;
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 1;
}
.map-pin__num{
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-heading);
  font-size: calc(22px * var(--text-scale));
  font-weight: 800;
  border: 3px solid #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
  transition: transform .15s ease, background .15s ease;
}
.map-pin:active .map-pin__num{ transform: scale(.92); }
.church-map.has-selection .map-pin:not(.is-active):not(.map-pin--here) .map-pin__num{
  background: color-mix(in srgb, var(--accent) 55%, #fff);
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.map-pin.is-active{ z-index: 3; }
.map-pin.is-active .map-pin__num{
  background: var(--accent-2);
  transform: scale(1.25);
  animation: pin-pulse 1.6s ease-out infinite;
}
@keyframes pin-pulse{
  0%{ box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-2) 60%, transparent), 0 4px 12px rgba(0,0,0,.3); }
  100%{ box-shadow: 0 0 0 26px transparent, 0 4px 12px rgba(0,0,0,.3); }
}

/* "You are here" marker */
.map-pin--here{ width: auto; height: auto; z-index: 2; }
.map-pin__dot{
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e5484d;
  border: 4px solid #fff;
  box-shadow: 0 0 0 0 rgba(229,72,77,.6);
  animation: here-pulse 2s ease-out infinite;
}
.map-pin__label{
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  white-space: nowrap;
  background: #e5484d;
  color: #fff;
  font-size: calc(17px * var(--text-scale));
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
}
@keyframes here-pulse{
  0%{ box-shadow: 0 0 0 0 rgba(229,72,77,.55); }
  100%{ box-shadow: 0 0 0 22px rgba(229,72,77,0); }
}
@media (prefers-reduced-motion: reduce){ .map-pin.is-active .map-pin__num, .map-pin__dot{ animation: none; } }

.church-map__panel{
  position: sticky;
  top: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 26px 26px 30px;
  max-height: calc(100vh - var(--header-h) - var(--footer-h) - 60px);
  overflow: auto;
  overscroll-behavior: contain;
}
.map-num{
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: calc(20px * var(--text-scale));
}
.map-num--here{ background: #e5484d; }

.map-list__title{ margin: 0 0 6px; font-size: calc(30px * var(--text-scale)); color: var(--text); }
.map-list__hint{ margin: 0 0 18px; color: var(--text-muted); font-size: calc(18px * var(--text-scale)); }
.map-list__items{ list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.map-list__item{
  width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  min-height: 70px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: calc(21px * var(--text-scale));
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.map-list__item:active{ transform: scale(.985); background: var(--accent-soft); }
.map-list__name{ flex: 1; }
.map-list__go{ font-size: 1.6em; color: var(--accent); line-height: 1; }

.map-detail__nav{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.map-detail__nav button{
  font: inherit;
  font-size: calc(19px * var(--text-scale));
  font-weight: 700;
  min-height: 56px;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}
.map-detail__step{ display: flex; gap: 10px; }
.map-detail__step button{ width: 56px; padding: 0; font-size: 30px; line-height: 1; }
.map-detail__title{
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 16px;
  font-size: calc(32px * var(--text-scale));
  color: var(--text);
}
.map-detail__photo{ margin: 0 0 18px; border-radius: var(--radius); overflow: hidden; }
.map-detail__photo img{ display: block; width: 100%; max-height: 340px; object-fit: cover; }
.map-detail__body{ font-size: calc(21px * var(--text-scale)); line-height: 1.6; }
.map-detail__note{ margin-top: 16px; color: var(--text-muted); font-size: calc(17px * var(--text-scale)); font-style: italic; }

/* ---------- "Fit to screen" pages (Admin › page layout) ---------- */
/* The page can't be scrolled; kiosk.js shrinks the content if it's too tall */
body.layout-fit .main{ overflow: hidden; }
body.layout-fit.fit-overflow .main{ overflow: auto; }   /* last resort if it can't shrink enough */
body.layout-fit:not(.fit-overflow) .kiosk-scroll,
body.layout-fit:not(.fit-overflow) .scroll-more{ display: none !important; }

/* Use the full width for text so less shrinking is needed */
body.layout-fit .rt p, body.layout-fit .rt ul, body.layout-fit .rt ol, body.layout-fit .rt blockquote{ max-width: none; }

/* The map fills whatever space is left under the title, as large as it can be */
body.page-map.layout-fit .content{ height: 100%; }
body.page-map.layout-fit .page--map{ height: 100%; display: flex; flex-direction: column; }
body.page-map.layout-fit .page__title{ margin-bottom: 16px; }
body.page-map.layout-fit .page__title::after{ margin-top: 12px; }
body.page-map.layout-fit .page__text{ margin-bottom: 16px; }
body.page-map.layout-fit .church-map{
  flex: 1;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr);
}
body.page-map.layout-fit .church-map__canvas{
  height: 100%;
  min-height: 0;
  container-type: size;           /* lets the frame measure the space it has */
  display: grid;
  place-items: center;
  padding: 12px;
}
body.page-map.layout-fit .church-map__frame{
  /* Largest box with the image's shape that fits both ways; pins stay in step */
  width: min(100cqw, calc(100cqh * var(--ratio, 1.7778)));
  aspect-ratio: var(--ratio, 1.7778);
}
body.page-map.layout-fit .church-map__img{ width: 100%; height: 100%; }
body.page-map.layout-fit .church-map__panel{
  position: static;
  max-height: 100%;
  min-height: 0;
}

/* ---------- High contrast extras ---------- */
body.theme-contrast{ --border: #000; --shadow: none; --text-muted: #1a1a1a; }
body.theme-contrast .card, body.theme-contrast .event, body.theme-contrast .home__button{ border-width: 2px; }

/* ---------- Admin preview banner ---------- */
.preview-banner{
  position: fixed;
  left: 50%;
  bottom: calc(var(--footer-h) + 20px);
  transform: translateX(-50%);
  z-index: 50;
  background: #7a4b00;
  color: #fff;
  padding: 10px 22px;
  border-radius: 999px;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
  pointer-events: none;
}

/* ---------- Smaller screens / portrait ---------- */
@media (min-width: 1600px){
  .gallery__img{ height: 320px; }
}
@media (max-width: 1300px){
  :root{ --header-h: 100px; }
  .header__logo{ max-width: calc(50% - 140px); }
  .header__brand-img{ height: 54px; }
}
@media (max-width: 1100px){
  .home__grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .church-map{ grid-template-columns: 1fr; }
  .church-map__panel{ position: static; max-height: none; }
  .photo-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-list{ grid-template-columns: 1fr; }
  .gallery__grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page__title{ font-size: calc(46px * var(--text-scale)); }
  .main{ padding: 28px 96px 40px 28px; }
}
@media (max-width: 900px){
  .header__logo{ display: none; }
  .footer__text{ display: none; }
}
@media (max-width: 700px){
  :root{ --header-h: 88px; }
  .photo-grid{ grid-template-columns: 1fr; }
  .lightbox__stage{ inset: 20px 12px 110px; }
  .lightbox__prev, .lightbox__next{ top: auto; bottom: 110px; transform: none; width: 64px; height: 64px; font-size: 40px; }
  .home__grid{ grid-template-columns: 1fr; }
  .gallery__grid{ grid-template-columns: 1fr; }
  .gallery__img{ height: 220px; }
  .page__title{ font-size: calc(38px * var(--text-scale)); }
  .event{ grid-template-columns: 1fr; }
  .event__date{ flex-direction: row; gap: 10px; justify-self: start; padding: 8px 16px; }
  .event__day{ margin: 0; font-size: calc(28px * var(--text-scale)); }
}

/* ---------- Visitor information page ---------- */
.visitor__top{ display: grid; gap: 28px; align-items: start; margin-bottom: 26px; }
.visitor__top.has-image{ grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.visitor__top .page__text{ margin: 0; }
.visitor__photo{ display: block; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); }
.visitor__photo img{ display: block; width: 100%; aspect-ratio: 16 / 10; max-height: 340px; object-fit: cover; }
.visitor__grid{ display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.visitor__card{ display: flex; gap: 22px; align-items: flex-start; }
.card.visitor__card + .card.visitor__card{ margin-top: 0; }
.visitor__icon{
  flex: none;
  display: grid;
  place-items: center;
  width: calc(68px * var(--text-scale));
  height: calc(68px * var(--text-scale));
  border-radius: 50%;
  font-size: calc(34px * var(--text-scale));
  background: var(--accent-soft);
}

/* ---------- History timeline page ---------- */
.timeline__list{ list-style: none; margin: 8px 0 0; padding: 0; position: relative; }
.timeline__list::before{          /* the line */
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: calc(85px * var(--text-scale) - 2px);   /* middle of the year column */
  width: 4px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--accent-2) 55%, transparent);
}
.timeline__entry{
  display: grid;
  grid-template-columns: calc(170px * var(--text-scale)) minmax(0, 1fr);
  gap: 26px;
  align-items: start;
  position: relative;
}
.timeline__entry + .timeline__entry{ margin-top: 22px; }
.timeline__year{
  position: relative;
  z-index: 1;
  justify-self: center;
  margin-top: 22px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: calc(22px * var(--text-scale));
  box-shadow: 0 0 0 6px var(--bg);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.timeline__card{ margin: 0; }
.card.timeline__card + .card{ margin-top: 0; }
.timeline__card.has-image{ display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 300px); gap: 26px; align-items: start; }
.timeline__photo{ display: block; border-radius: var(--radius); overflow: hidden; }
.timeline__photo img{ display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }

/* ---------- Donate page ---------- */
.donate__layout{ display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 34px; align-items: start; }
.donate__layout.no-qr{ grid-template-columns: minmax(0, 1fr); }
.donate__text .page__text{ margin-bottom: 20px; }
.donate__photo{ display: block; width: 100%; max-height: 38vh; object-fit: cover; border-radius: var(--radius-lg); box-shadow: var(--shadow); margin-bottom: 22px; }
.donate__qr{ text-align: center; padding: 34px; }
.donate__code{ display: block; width: min(100%, 420px); margin: 0 auto; aspect-ratio: 1; }
.donate__code svg{ display: block; width: 100%; height: 100%; }
img.donate__code{ object-fit: contain; }
.donate__caption{
  margin: 22px 0 6px;
  font-size: calc(26px * var(--text-scale));
  font-weight: 700;
  color: var(--accent);
}
.donate__link{ margin: 0; font-size: calc(19px * var(--text-scale)); color: var(--text-muted); word-break: break-all; }

/* ---------- Video page ---------- */
.video-player{ position: relative; border-radius: var(--radius-lg); overflow: hidden; background: #000; box-shadow: var(--shadow); }
.video-player video{ display: block; width: 100%; max-height: 72vh; background: #000; }
.video-player video::-webkit-media-controls-overlay-play-button{ display: none; }   /* ours is bigger */
.video-player video::-webkit-media-controls-start-playback-button{ display: none; }
.video-player__play{
  position: absolute;
  inset: 0;
  margin: auto;
  width: calc(150px * var(--text-scale));
  height: calc(150px * var(--text-scale));
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,.85);
  background: color-mix(in srgb, var(--accent) 80%, transparent);
  color: #fff;
  font-size: calc(58px * var(--text-scale));
  box-shadow: 0 8px 30px rgba(0,0,0,.35);
  cursor: pointer;
}
.video-player__play span{ display: inline-block; transform: translateX(6%); }
.video-player__play[hidden]{ display: none; }
.video-player__sound{
  position: absolute;
  right: 20px;
  bottom: 70px;
  padding: 14px 24px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,.7);
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: calc(22px * var(--text-scale));
  font-weight: 700;
  cursor: pointer;
}
.video-player__sound[hidden]{ display: none; }

@media (max-width: 1100px){
  .visitor__top.has-image, .visitor__grid, .donate__layout, .timeline__card.has-image{ grid-template-columns: minmax(0, 1fr); }
}
