/* ==========================================================
   PENITENT — design tokens + components
   Palette and type are recommendations from the creative brief.
   ========================================================== */

:root {
  /* Palette */
  --ink: #171715;          /* dark surfaces, text on ivory */
  --charcoal: #35332F;     /* secondary dark surfaces */
  --ivory: #F2EBDD;        /* editorial panels, reading pages */
  --bone: #E5D9C2;         /* text on dark */
  --gold: #A38A55;         /* rules, borders, ornaments (not body text on ivory) */
  --gold-deep: #806A3B;    /* large gold text on ivory */
  --gold-text: #76612F;    /* small gold text on ivory (passes AA, 5.0:1) */
  --oxblood: #782B2C;      /* rare accents, selected states */
  --muted-on-dark: #B9AE98;
  --muted-on-ivory: #5A554C;

  /* Type */
  --font-display: "Cormorant Garamond", "EB Garamond", Garamond, Georgia, serif;
  --font-body: "EB Garamond", Garamond, Georgia, serif;
  --font-ui: "Libre Baskerville", Baskerville, Georgia, serif;

  --step--1: 0.8125rem;
  --step-0: 1.1875rem;     /* 19px body */
  --step-1: 1.375rem;
  --step-2: 1.75rem;
  --step-3: clamp(2rem, 1.6rem + 1.6vw, 2.75rem);
  --step-4: clamp(2.5rem, 1.8rem + 3vw, 4rem);

  /* Space */
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --space-6: clamp(4rem, 3rem + 5vw, 7.5rem);

  --measure: 66ch;
  --frame-inset: clamp(10px, 1.4vw, 20px);
  --panel-w: clamp(320px, 32vw, 470px);
  --header-h: 64px;

  /* Subtle paper grain */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.3 0 0 0 0 0.22 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
body {
  margin: 0;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.7;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 500; line-height: 1.1; margin: 0; letter-spacing: .01em; }
p { margin: 0 0 1em; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.surface-ivory :focus-visible { outline-color: var(--oxblood); }

.skip-link {
  position: absolute; left: 1rem; top: -100px; z-index: 100;
  background: var(--ivory); color: var(--ink); padding: .75rem 1rem;
  font-family: var(--font-ui); font-size: var(--step--1);
}
.skip-link:focus { top: 1rem; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Surfaces ---------- */
.surface-ivory { background: var(--ivory) var(--grain); color: var(--ink); }
.surface-ink { background: var(--ink) ; color: var(--bone); }
.surface-charcoal { background: var(--charcoal) var(--grain); color: var(--bone); }

.wrap { width: min(100% - 2.5rem, 1180px); margin-inline: auto; }
.wrap-narrow { width: min(100% - 2.5rem, 760px); margin-inline: auto; }
.section { padding-block: var(--space-6); }

/* ---------- Small caps labels ---------- */
.label {
  font-family: var(--font-ui);
  font-size: var(--step--1);
  letter-spacing: .16em;
  text-transform: uppercase;
}
.surface-ivory .label { color: var(--gold-text); }
.surface-ink .label, .surface-charcoal .label { color: var(--gold); }

/* ---------- Fine rule with star ---------- */
.fine-rule {
  display: flex; align-items: center; justify-content: center; gap: .75rem;
  color: var(--gold); margin: var(--space-3) auto; max-width: 220px;
}
.fine-rule::before, .fine-rule::after {
  content: ""; flex: 1; height: 1px; background: currentColor; opacity: .85;
}
.fine-rule svg { width: 12px; height: 12px; flex: none; }
.fine-rule--plain::before { flex: 0 0 70px; }
.fine-rule--plain::after { display: none; }
.fine-rule--plain { max-width: 70px; }

.star { width: 12px; height: 12px; display: inline-block; vertical-align: -1px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .7rem;
  min-height: 48px; padding: .7rem 1.4rem;
  font-family: var(--font-ui); font-size: .875rem; letter-spacing: .12em; text-transform: uppercase;
  text-decoration: none; border: 1px solid var(--gold); position: relative;
  transition: background-color .2s ease, color .2s ease;
}
.btn::after { /* inner hairline, like the mockups */
  content: ""; position: absolute; inset: 3px; border: 1px solid var(--gold); opacity: .55; pointer-events: none;
}
.btn .star { width: 14px; height: 14px; color: var(--gold); }
.btn--ivory { color: var(--ink); background: transparent; }
.btn--ivory .star { color: var(--gold-deep); }
.btn--ivory:hover { background: var(--ink); color: var(--ivory); }
.btn--dark { color: var(--bone); background: rgba(23,23,21,.55); }
.btn--dark:hover { background: var(--bone); color: var(--ink); }
.btn--small { min-height: 44px; padding: .5rem 1rem; font-size: .8125rem; }

/* ---------- Site header (inner pages + mobile) ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding-inline: clamp(1rem, 3vw, 2rem);
  background: rgba(23,23,21,.96);
  border-bottom: 1px solid rgba(163,138,85,.45);
}
.site-header__brand { display: flex; align-items: center; text-decoration: none; }
.site-header__brand img { height: 30px; width: auto; }
.site-header__actions { display: flex; align-items: center; gap: .75rem; }
.home .site-header { display: none; }

.menu-btn {
  min-width: 44px; min-height: 44px; display: inline-grid; place-items: center;
  background: transparent; border: 0; color: var(--bone); cursor: pointer; padding: 0;
}
.menu-btn svg { width: 30px; height: 20px; }

/* ---------- Menu overlay ---------- */
.menu {
  position: fixed; inset: 0; z-index: 60;
  background: var(--ink) var(--grain);
  overflow-y: auto;
  padding: var(--space-4) clamp(1.25rem, 5vw, 4rem);
}
.menu[hidden] { display: none; }
.menu__top { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-4); }
.menu__top img { height: 32px; width: auto; }
.menu__close {
  min-width: 44px; min-height: 44px; background: transparent; border: 1px solid var(--gold);
  color: var(--bone); font-family: var(--font-ui); font-size: .8125rem; letter-spacing: .12em; text-transform: uppercase;
  padding: 0 1rem; cursor: pointer;
}
.menu__list { list-style: none; margin: 0 auto; padding: 0; max-width: 880px; display: grid; gap: 0; }
.menu__list a {
  display: grid; grid-template-columns: minmax(0, 15rem) 1fr; gap: .25rem 2rem; align-items: baseline;
  padding: 1.1rem 0; border-bottom: 1px solid rgba(163,138,85,.3); text-decoration: none;
}
.menu__list a:hover .menu__name { color: var(--gold); }
.menu__name { font-family: var(--font-display); font-size: var(--step-2); color: var(--ivory); }
.menu__desc { color: var(--muted-on-dark); font-size: 1.0625rem; }
.menu__secondary { max-width: 880px; margin: var(--space-4) auto 0; display: flex; flex-wrap: wrap; gap: 1rem 2rem; }
.menu__secondary a { font-family: var(--font-ui); font-size: .8125rem; letter-spacing: .14em; text-transform: uppercase; color: var(--bone); min-height: 44px; display: inline-flex; align-items: center; }
@media (max-width: 640px) {
  .menu__list a { grid-template-columns: 1fr; }
}

/* ==========================================================
   HOMEPAGE HERO
   ========================================================== */
.hero {
  position: relative;
  min-height: max(640px, 100svh);
  overflow: hidden;
  isolation: isolate;
  background: var(--ink);
}
.hero__art { position: absolute; inset: 0; z-index: -2; }
.hero__art img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%; }
@media (max-width: 1279px) { .hero__art img { object-position: 72% 50%; } }
.hero::before { /* top shade so the controls stay legible */
  content: ""; position: absolute; inset: 0 0 auto 0; height: 160px; z-index: -1;
  background: linear-gradient(to bottom, rgba(23,23,21,.55), transparent);
}
.hero__frame { /* thin gold frame around the viewport */
  position: absolute; inset: var(--frame-inset); border: 1px solid rgba(163,138,85,.8);
  pointer-events: none; z-index: 2;
}
.hero__frame::before, .hero__frame::after {
  content: ""; position: absolute; width: 18px; height: 18px; border: 1px solid var(--gold);
}
.hero__frame::before { top: -6px; right: -6px; border-left: 0; border-bottom: 0; }
.hero__frame::after { bottom: -6px; right: -6px; border-left: 0; border-top: 0; }

.hero__controls {
  position: absolute; top: calc(var(--frame-inset) + 1.25rem); right: calc(var(--frame-inset) + 1.5rem);
  display: flex; align-items: center; gap: 1.25rem; z-index: 3;
}

.panel {
  position: absolute; z-index: 1;
  top: 0; bottom: 0; left: clamp(20px, 3.6vw, 64px);
  width: var(--panel-w);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  padding: var(--space-5) clamp(1.5rem, 2.6vw, 3rem);
  box-shadow: 0 0 0 1px rgba(163,138,85,.55), 0 0 60px rgba(0,0,0,.45);
}
.panel::before { /* inner gold hairline on the panel edges */
  content: ""; position: absolute; inset: 0 8px; border-inline: 1px solid rgba(163,138,85,.5); pointer-events: none;
}
.panel__emblem { width: 44px; height: auto; margin-bottom: .75rem; }
.panel__wordmark { width: min(100%, 300px); height: auto; }
.panel__tagline { margin-top: 1rem; }
.panel__nav ul { list-style: none; margin: 0; padding: 0; }
.panel__nav a {
  display: inline-flex; align-items: center; min-height: 44px;
  font-family: var(--font-ui); font-size: clamp(.875rem, .8rem + .25vw, 1rem); letter-spacing: .16em; text-transform: uppercase;
  text-decoration: none; color: var(--ink);
  background-image: linear-gradient(var(--gold), var(--gold)); background-size: 0 1px; background-repeat: no-repeat; background-position: 50% 82%;
  transition: background-size .25s ease;
}
.panel__nav a:hover { background-size: 100% 1px; }
.panel__mission {
  font-style: italic; font-size: clamp(1.1875rem, 1rem + .5vw, 1.5rem); line-height: 1.45;
  max-width: 17ch; margin: 0 auto var(--space-3);
}

/* Mobile hero: a book cover — title on the art, prayer in the first screen */
.cover, .begin { display: none; }

@media (max-width: 899px) {
  .hero { display: none; }
  .home .site-header {
    display: flex; position: absolute; left: 0; right: 0; top: 0;
    background: transparent; border: 0; justify-content: flex-end;
  }
  .home .site-header__brand, .home .site-header .btn { display: none; }

  .cover {
    display: flex; flex-direction: column; justify-content: space-between;
    position: relative; isolation: isolate; overflow: hidden;
    aspect-ratio: 529 / 816; max-height: 88svh; min-height: 560px;
    padding: calc(12% + .25rem) 1rem 2.6rem;
    text-align: center;
  }
  .cover__art { position: absolute; inset: 0; z-index: -2; }
  .cover__art img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%; }
  .cover::before { /* darken top for the title and bottom for the controls */
    content: ""; position: absolute; inset: 0; z-index: -1;
    background:
      radial-gradient(ellipse 70% 22% at 50% 20%, rgba(23,23,21,.6), rgba(23,23,21,0) 100%),
      linear-gradient(to top, rgba(23,23,21,.7) 0%, rgba(23,23,21,0) 22%);
  }
  .cover::after { /* thin gold frame, open at the bottom where the paper tears */
    content: ""; position: absolute; inset: 8px 8px 0; border: 1px solid rgba(163,138,85,.55); border-bottom: 0; pointer-events: none;
  }
  .cover__emblem { width: 30px; height: auto; margin: 0 auto .6rem; filter: brightness(1.35) saturate(1.1) drop-shadow(0 2px 8px rgba(0,0,0,.85)); }
  .cover__title { margin: 0; }
  .cover__title img { width: min(62vw, 270px); height: auto; margin-inline: auto; filter: drop-shadow(0 2px 14px rgba(0,0,0,.9)); }
  .cover .fine-rule { margin: 1rem auto; }
  .cover__mission {
    font-family: var(--font-display); font-style: italic; font-size: clamp(1.125rem, 4.8vw, 1.3125rem); line-height: 1.5;
    letter-spacing: .2em; text-transform: uppercase; color: var(--bone);
    max-width: 15.5rem; margin: 0 auto; text-shadow: 0 1px 12px rgba(0,0,0,.8);
  }
  .cover__mission span { display: block; }
  .btn--cover {
    width: min(100%, 360px); min-height: 54px; margin: 0 auto 1rem; font-size: .9375rem;
    color: var(--ivory); background: rgba(23,23,21,.82);
  }
  .btn--cover:hover { background: var(--ivory); color: var(--ink); }
  /* Torn paper: the ivory page rips up into the art */
  .begin {
    display: block; position: relative; z-index: 1; text-align: center;
    padding: 1.25rem 1.5rem 2.5rem; margin-top: -1px;
  }
  .begin::before {
    content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 30px;
    background: url("../img/torn-edge.svg") center bottom / 100% 100% no-repeat;
    filter: drop-shadow(0 -2px 2px rgba(0,0,0,.5));
  }
  .rule-heading {
    display: flex; align-items: center; gap: 1rem; justify-content: center;
    font-family: var(--font-ui); font-weight: 400; font-size: 1rem; letter-spacing: .28em; text-transform: uppercase;
    margin: 0 0 .9rem;
  }
  .rule-heading::before, .rule-heading::after { content: ""; flex: 1; max-width: 90px; height: 1px; background: var(--ink); opacity: .6; }
  .begin__lead { font-style: italic; font-size: 1.1875rem; line-height: 1.5; max-width: 22rem; margin: 0 auto 1.4rem; }
  .btn--ink {
    width: min(100%, 340px); min-height: 56px; font-size: 1rem; letter-spacing: .2em;
    background: var(--ink); color: var(--ivory); border-color: var(--gold);
  }
  .btn--ink::after { border-color: var(--gold); opacity: .7; }
  .btn--ink:hover { background: var(--charcoal); }
  .begin + .section { padding-top: var(--space-4); }
  .tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; max-width: 420px; margin-inline: auto; }
  .tile {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem;
    aspect-ratio: 1 / 1.05; min-height: 72px; padding: .5rem .25rem;
    background: rgba(23,23,21,.78); border: 1px solid rgba(163,138,85,.75);
    color: var(--gold); text-decoration: none;
  }
  .tile::before { content: ""; position: absolute; inset: 3px; border: 1px solid rgba(163,138,85,.3); pointer-events: none; }
  .tile img { width: 68%; max-width: 52px; height: auto; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
  .tile span { font-family: var(--font-ui); font-size: .625rem; letter-spacing: .1em; text-transform: uppercase; color: var(--bone); }
  .tile:hover, .tile:focus-visible { background: rgba(23,23,21,.95); border-color: var(--gold); }
  @media (max-width: 370px) { .tile span { font-size: .5625rem; letter-spacing: .06em; } }
}

/* ==========================================================
   SECTIONS
   ========================================================== */
.section-head { text-align: center; max-width: 40rem; margin: 0 auto var(--space-5); }
.section-head h2 { font-size: var(--step-4); margin-top: .5rem; }
.section-head p { margin-top: 1rem; font-size: var(--step-1); line-height: 1.55; }
.surface-ivory .section-head p { color: var(--muted-on-ivory); }
.surface-ink .section-head p, .surface-charcoal .section-head p { color: var(--muted-on-dark); }

/* Daily Vigil selector */
.vigil-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(1rem, 2vw, 2rem); }
.office {
  position: relative; display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: var(--space-4) var(--space-3) var(--space-3);
  border: 1px solid rgba(128,106,59,.55);
  text-decoration: none; color: inherit;
  transition: border-color .2s ease, background-color .2s ease;
}
.office:hover { border-color: var(--ink); background: rgba(23,23,21,.03); }
.office__icon { width: 52px; height: 52px; color: var(--gold-deep); margin-bottom: 1rem; }
.office__hour { font-family: var(--font-ui); font-size: var(--step--1); letter-spacing: .16em; text-transform: uppercase; color: var(--gold-text); }
.office h3 { font-size: var(--step-3); margin: .35rem 0 .75rem; }
.office p { color: var(--muted-on-ivory); font-size: 1.0625rem; line-height: 1.55; margin-bottom: 1.25rem; }
.office__go { margin-top: auto; font-family: var(--font-ui); font-size: .8125rem; letter-spacing: .14em; text-transform: uppercase; }
.office__now {
  position: absolute; top: -1px; left: 50%; transform: translate(-50%, -50%);
  background: var(--oxblood); color: var(--ivory);
  font-family: var(--font-ui); font-size: .6875rem; letter-spacing: .16em; text-transform: uppercase;
  padding: .3rem .8rem; white-space: nowrap;
}
.office[data-now] { border-color: var(--oxblood); box-shadow: inset 0 0 0 1px var(--oxblood); }
.office__now[hidden] { display: none; }
@media (max-width: 767px) { .vigil-grid { grid-template-columns: 1fr; } .office { padding-block: var(--space-4) var(--space-3); } }

/* Collections directory */
.collections { display: grid; grid-template-columns: repeat(12, 1fr); gap: clamp(1rem, 2vw, 1.75rem); }
.card { grid-column: span 3; display: flex; flex-direction: column; text-decoration: none; color: inherit; background: var(--charcoal); border: 1px solid rgba(163,138,85,.35); transition: border-color .2s ease; }
.card:nth-child(n+5) { grid-column: span 4; }
.card:hover { border-color: var(--gold); }
.card__img { aspect-ratio: 4 / 3; overflow: hidden; border-bottom: 1px solid rgba(163,138,85,.35); }
.card__img img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(.15) contrast(1.02); transition: transform .6s ease; }
.card:hover .card__img img { transform: scale(1.03); }
.card__body { padding: 1.25rem 1.25rem 1.5rem; }
.card h3 { font-size: var(--step-2); color: var(--ivory); }
.card p { color: var(--muted-on-dark); font-size: 1.0625rem; line-height: 1.55; margin: .5rem 0 0; }
@media (max-width: 1099px) { .card, .card:nth-child(n+5) { grid-column: span 4; } .card:nth-child(n+7) { grid-column: 3 / span 8; } }
@media (max-width: 767px) { .card, .card:nth-child(n+5), .card:nth-child(n+7) { grid-column: span 6; } .card:last-child { grid-column: 4 / span 6; } }
@media (max-width: 560px) {
  .collections { grid-template-columns: 1fr; }
  .card, .card:nth-child(n+5), .card:nth-child(n+7), .card:last-child { grid-column: auto; flex-direction: row; }
  .card__img { aspect-ratio: auto; width: 38%; flex: none; border-bottom: 0; border-right: 1px solid rgba(163,138,85,.35); }
  .card__body { padding: 1rem; }
  .card h3 { font-size: 1.5rem; }
  .card p { font-size: 1rem; }
}

/* Featured psalm */
.featured { display: grid; grid-template-columns: 1fr 1.3fr; gap: clamp(2rem, 5vw, 5rem); align-items: center; }
.featured__art { border: 1px solid var(--gold); padding: 8px; background: var(--ink); }
.featured__art img { width: 100%; aspect-ratio: 4/5; object-fit: cover; }
.featured blockquote { margin: 0; font-size: var(--step-1); line-height: 1.7; }
.featured blockquote p { margin-bottom: .6em; }
.featured cite { display: block; font-style: normal; margin-top: 1.25rem; }
@media (max-width: 899px) { .featured { grid-template-columns: 1fr; } .featured__art { max-width: 420px; margin-inline: auto; } }

/* About strip */
.about-strip { text-align: center; }
.about-strip p { font-size: var(--step-1); line-height: 1.65; color: var(--bone); max-width: 38rem; margin-inline: auto; }
.about-strip .lead { font-family: var(--font-display); font-style: italic; font-size: var(--step-3); line-height: 1.3; color: var(--ivory); margin-bottom: 1.5rem; }

/* Drop cap */
.dropcap::first-letter {
  float: left; font-family: var(--font-display); font-weight: 600;
  font-size: 4.6em; line-height: .82; padding: .06em .12em 0 0; color: var(--oxblood);
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid rgba(163,138,85,.45); padding: var(--space-5) 0 var(--space-4); text-align: center; background: #10100E; }
.site-footer img.footer-mark { width: 180px; margin: 0 auto 1rem; }
.site-footer nav ul { list-style: none; margin: var(--space-3) 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: .25rem 1.75rem; }
.site-footer nav a { font-family: var(--font-ui); font-size: .8125rem; letter-spacing: .14em; text-transform: uppercase; text-decoration: none; color: var(--bone); min-height: 44px; display: inline-flex; align-items: center; }
.site-footer nav a:hover { color: var(--gold); }
.site-footer small { display: block; color: var(--muted-on-dark); font-size: .9375rem; }

/* ==========================================================
   INNER PAGES
   ========================================================== */
.page-hero { position: relative; isolation: isolate; text-align: center; padding: clamp(4rem, 10vw, 8rem) 1.25rem; overflow: hidden; border-bottom: 1px solid var(--gold); }
.page-hero__art { position: absolute; inset: 0; z-index: -1; }
.page-hero__art img { width: 100%; height: 100%; object-fit: cover; opacity: .38; }
.page-hero h1 { font-size: var(--step-4); color: var(--ivory); margin-top: .5rem; }
.page-hero p { max-width: 36rem; margin: 1.25rem auto 0; font-size: var(--step-1); line-height: 1.55; color: var(--bone); }

.office-list { display: grid; gap: 0; border-top: 1px solid rgba(128,106,59,.5); }
.office-row {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 1.5rem; align-items: center;
  padding: 1.75rem .5rem; border-bottom: 1px solid rgba(128,106,59,.5); text-decoration: none; color: inherit; position: relative;
}
.office-row:hover { background: rgba(23,23,21,.035); }
.office-row .office__icon { margin: 0; }
.office-row h2 { font-size: var(--step-3); }
.office-row p { margin: .35rem 0 0; color: var(--muted-on-ivory); font-size: 1.0625rem; line-height: 1.55; }
.office-row .office__now { position: static; transform: none; display: inline-block; margin-left: .75rem; vertical-align: middle; }
.office-row[data-now] { box-shadow: inset 3px 0 0 var(--oxblood); }
.office-row--soon { opacity: .7; }
.arrow { font-family: var(--font-ui); font-size: .8125rem; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; }
@media (max-width: 640px) { .office-row { grid-template-columns: 44px 1fr; } .office-row .office__icon { width: 40px; height: 40px; } .office-row .arrow { grid-column: 2; } }

.note { font-size: 1rem; color: var(--muted-on-ivory); border-left: 2px solid var(--gold); padding: .25rem 0 .25rem 1rem; margin-top: var(--space-4); }
.surface-ink .note, .surface-charcoal .note { color: var(--muted-on-dark); }

.sample-badge {
  display: inline-block; font-family: var(--font-ui); font-size: .6875rem; letter-spacing: .14em; text-transform: uppercase;
  border: 1px dashed var(--oxblood); color: var(--oxblood); padding: .15rem .55rem; vertical-align: middle;
}
.surface-ink .sample-badge, .reader-dark .sample-badge { color: #D9A3A0; border-color: #D9A3A0; }

/* ---------- Prayer reader ---------- */
.reader { --reader-size: 1.1875rem; }
.reader[data-size="1"] { --reader-size: 1.0625rem; }
.reader[data-size="3"] { --reader-size: 1.375rem; }
.reader[data-size="4"] { --reader-size: 1.5625rem; }
.reader__bar {
  position: sticky; top: var(--header-h); z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: .4rem clamp(1rem, 3vw, 2rem);
  background: inherit; border-bottom: 1px solid rgba(128,106,59,.4);
}
.reader__bar a { font-family: var(--font-ui); font-size: .8125rem; letter-spacing: .12em; text-transform: uppercase; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.reader__tools { display: flex; gap: .4rem; align-items: center; }
.tool {
  min-width: 44px; min-height: 44px; border: 1px solid rgba(128,106,59,.6); background: transparent; color: inherit;
  font-family: var(--font-ui); font-size: .875rem; cursor: pointer; padding: 0 .6rem;
}
.tool:hover { border-color: currentColor; }
.tool[aria-pressed="true"] { background: var(--ink); color: var(--ivory); }

.reader__page { width: min(100% - 2.5rem, 42rem); margin-inline: auto; padding-block: var(--space-5) var(--space-6); font-size: var(--reader-size); line-height: 1.75; }
.reader__head { text-align: center; margin-bottom: var(--space-4); }
.reader__head h1 { font-size: var(--step-4); margin-top: .4rem; }
.reader__source { font-size: 1rem; color: var(--muted-on-ivory); margin-top: .75rem; }
.part { margin-top: var(--space-4); }
.part h2 { font-family: var(--font-ui); font-size: .8125rem; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-text); text-align: center; margin-bottom: 1rem; }
.part .ref { display: block; text-align: right; font-size: .9em; font-style: italic; color: var(--muted-on-ivory); margin-top: .25rem; }
.psalm .v { display: block; margin-bottom: .55em; }
.psalm .v:not(.dropcap) { padding-left: 1.1em; text-indent: -1.1em; }
.verse-num { font-size: .62em; vertical-align: super; color: var(--gold-text); font-family: var(--font-ui); margin-right: .2em; }
.rubric { font-style: italic; color: var(--oxblood); }
.response { font-weight: 500; }
.amen { font-variant: small-caps; letter-spacing: .05em; }
.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: var(--space-5); padding-top: var(--space-3); border-top: 1px solid rgba(128,106,59,.45); }
.pager a { text-decoration: none; display: flex; flex-direction: column; min-height: 44px; }
.pager a:last-child { text-align: right; margin-left: auto; }
.pager .label { margin-bottom: .2rem; }
.pager strong { font-family: var(--font-display); font-weight: 500; font-size: 1.5rem; }

/* Dark reading mode */
.reader-dark { background: var(--ink); color: var(--bone); }
.reader-dark .reader__bar { background: var(--ink); }
.reader-dark .label, .reader-dark .part h2, .reader-dark .verse-num { color: var(--gold); }
.reader-dark .reader__source, .reader-dark .part .ref { color: var(--muted-on-dark); }
.reader-dark .rubric, .reader-dark .dropcap::first-letter { color: #C98B86; }
.reader-dark .tool[aria-pressed="true"] { background: var(--bone); color: var(--ink); }
.reader-dark :focus-visible { outline-color: var(--gold); }

/* Stub pages */
.stub { text-align: center; }
.stub p { max-width: 36rem; margin-inline: auto; color: var(--muted-on-ivory); font-size: var(--step-1); line-height: 1.6; }
.stub .btn { margin-top: var(--space-3); }
.prose { max-width: var(--measure); margin-inline: auto; }
.prose h2 { font-size: var(--step-3); margin: var(--space-4) 0 1rem; }
.prose p, .prose li { color: var(--ink); }
.psalm .v.dropcap + .v { clear: left; }

/* oxblood kept minimal: drop caps and the pilgrim's robe only */
.office__now { background: var(--gold-deep); }
.office[data-now] { border-color: var(--gold-deep); box-shadow: inset 0 0 0 1px var(--gold-deep); }
.office-row[data-now] { box-shadow: inset 3px 0 0 var(--gold-deep); }
.rubric { color: var(--muted-on-ivory); }
.sample-badge { border-color: var(--gold-deep); color: var(--gold-text); }
.reader-dark .rubric { color: var(--muted-on-dark); }

/* Painted room headers: art at full strength, title low over a fade */
.page-hero { min-height: clamp(440px, 72svh, 680px); display: flex; flex-direction: column; justify-content: flex-end;
  padding-bottom: clamp(2.5rem, 6vw, 4.5rem); }
.page-hero__art img { opacity: 1; }
.page-hero__art::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(23,23,21,.92) 0%, rgba(23,23,21,.55) 32%, rgba(23,23,21,0) 62%); }
.page-hero h1, .page-hero p { text-shadow: 0 2px 18px rgba(0,0,0,.6); }
.page-hero__art img { object-position: 50% 12%; }
/* centre the panel wordmark (img is display:block); tiny optical nudge for the P's long tail */
.panel__wordmark { margin-inline: auto; transform: translateX(2%); }
.cover__title img { transform: translateX(2%); }
/* Vigil header: keep traveler and tower together on phones */
@media (max-width: 899px) { .page-hero__art img[src*="room-vigil"] { object-position: 44% 20%; } }
/* Painted band above each prayer, fading into the page */
.office-band { position: relative; height: clamp(220px, 42svh, 420px); overflow: hidden; background: var(--ink); }
.office-band img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 45%; }
.office-band::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 28px;
  background: url("../img/torn-edge.svg") center bottom / 100% 100% no-repeat; filter: drop-shadow(0 -2px 2px rgba(0,0,0,.45)); }
.office-band + .reader .reader__bar { top: var(--header-h); }
@media (max-width: 480px) { .page-hero .label { letter-spacing: .1em; font-size: .75rem; } }
@media (max-width: 899px) { .page-hero__art img[src*="room-memento-mori"] { object-position: 42% 20%; } }
/* Memento Mori: lift the painting so the traveler and stones sit above the title */
.page-hero__art img[src*="room-memento-mori"] { position: absolute; left: 0; bottom: 0; height: 150%; object-position: 100% 100%; }
@media (max-width: 899px) { .page-hero__art img[src*="room-memento-mori"] { height: 140%; object-position: 40% 100%; } }
@media (min-width: 900px) and (max-width: 1279px) { .page-hero__art img[src*="room-memento-mori"] { object-position: 48% 100%; } }
.office-band img[src*="office-morning"] { object-position: 58% 62%; }
/* Psalter: keep the kneeling traveler clear of the title */
.page-hero:has(img[src*="room-psalter"]) .page-hero__art img { object-position: 50% 100%; }
@media (min-width: 900px) {
  .page-hero:has(img[src*="room-psalter"]) { align-items: flex-start; text-align: left; padding-left: clamp(2rem, 6vw, 6rem); }
  .page-hero:has(img[src*="room-psalter"]) p { margin-left: 0; max-width: 22rem; }
}
@media (max-width: 899px) {
  .page-hero:has(img[src*="room-psalter"]) .page-hero__art img { height: 62%; object-position: 47% 100%;
    -webkit-mask-image: linear-gradient(#000 78%, transparent); mask-image: linear-gradient(#000 78%, transparent); }
}
@media (min-width: 900px) { .page-hero:has(img[src*="room-psalter"]) .label { white-space: nowrap; } }

/* Tiles as tiny paintings */
@media (max-width: 899px) {
  .tile { justify-content: flex-end; overflow: hidden; padding: 0 .2rem .45rem; background: var(--ink); }
  .tile picture, .tile img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; }
  .tile img { object-fit: cover; filter: none; opacity: .92; transition: opacity .2s ease, transform .4s ease; }
  .tile::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(23,23,21,.9) 0%, rgba(23,23,21,.35) 45%, rgba(23,23,21,0) 70%); }
  .tile::before { z-index: 2; }
  .tile span { position: relative; z-index: 3; text-shadow: 0 1px 4px rgba(0,0,0,.8); }
  .tile:hover img, .tile:focus-visible img { opacity: 1; transform: scale(1.05); }
}

/* Pilgrimage: road painting, traveler kept clear of the title (same treatment as the Psalter) */
.page-hero:has(img[src*="room-pilgrimage"]) .page-hero__art img { object-position: 50% 100%; }
@media (min-width: 900px) {
  .page-hero:has(img[src*="room-pilgrimage"]) { align-items: flex-start; text-align: left; padding-left: clamp(2rem, 6vw, 6rem); }
  .page-hero:has(img[src*="room-pilgrimage"]) p { margin-left: 0; max-width: 22rem; }
  .page-hero:has(img[src*="room-pilgrimage"]) .label { white-space: nowrap; }
}
@media (max-width: 899px) {
  .page-hero:has(img[src*="room-pilgrimage"]) .page-hero__art img { height: 62%; object-position: 45% 100%;
    -webkit-mask-image: linear-gradient(#000 78%, transparent); mask-image: linear-gradient(#000 78%, transparent); }
}
/* Midday band: keep the tree and the resting traveler in view */
.office-band img[src*="office-midday"] { object-position: 66% 78%; }
/* Pilgrimage desktop: title up in the dark sky, left, so the traveler on the road below stays clear */
@media (min-width: 900px) {
  .page-hero:has(img[src*="room-pilgrimage"]) { justify-content: center; padding-top: 0; padding-bottom: 14%; }
  .page-hero:has(img[src*="room-pilgrimage"]) .page-hero__art::after {
    background: linear-gradient(to right, rgba(23,23,21,.75) 0%, rgba(23,23,21,.35) 35%, rgba(23,23,21,0) 60%),
                linear-gradient(to top, rgba(23,23,21,.6) 0%, rgba(23,23,21,0) 25%); }
}
.part .ref em { font-style: normal; }
.part p + .ref, .part .ref { margin-bottom: 1.1em; }

/* ---------- Armoury ---------- */
.battle-num { display: flex; align-items: center; justify-content: center; height: auto; font-family: var(--font-display); font-size: 1.75rem; font-weight: 500; letter-spacing: .04em; color: var(--gold-deep); line-height: 1; }
@media (max-width: 640px) { .office-row .battle-num { font-size: 1.4rem; height: auto; } }
.old-word { margin: 0; padding: 0 0 0 1.25rem; border-left: 2px solid var(--gold); }
.old-word p { font-style: italic; margin: 0; }
.old-word footer { margin-top: .75rem; font-family: var(--font-ui); font-size: .8125rem; letter-spacing: .04em; color: var(--muted-on-ivory); }
.reader-dark .old-word footer { color: var(--muted-on-dark); }
.care { font-size: 1rem; line-height: 1.55; background: rgba(163,138,85,.12); border: 1px solid rgba(128,106,59,.45); padding: 1rem 1.25rem; margin: 0 0 var(--space-4); }
.reader-dark .care { background: rgba(163,138,85,.1); }
.office-band--armoury img { object-position: 50% 40%; }

/* ---------- Psalter ---------- */
.sc { font-variant: small-caps; letter-spacing: .03em; }
.list-heading { font-size: var(--step-3); text-align: center; margin: 0 0 .5rem; }
.list-intro { text-align: center; color: var(--muted-on-ivory); max-width: 34rem; margin: 0 auto var(--space-3); }
.office-row--need { grid-template-columns: 1fr auto; }
@media (max-width: 640px) { .office-row--need { grid-template-columns: 1fr; } .office-row--need .arrow { grid-column: 1; } }
.reader__subtitle { font-family: var(--font-display); font-style: italic; font-size: var(--step-1); margin: .25rem 0 0; }
.psalm-intro { font-size: 1.0625rem; color: var(--muted-on-ivory); max-width: 32rem; margin: 0 auto; }
.reader-dark .psalm-intro { color: var(--muted-on-dark); }
.superscription { font-style: italic; font-size: .9375rem; color: var(--muted-on-ivory); text-align: center; margin-bottom: 1.25rem; }
.reader-dark .superscription { color: var(--muted-on-dark); }
.old-word--long p { font-style: normal; }
.old-word--long .dropcap::first-letter { font-style: normal; }
.carry { font-family: var(--font-display); font-style: italic; font-size: var(--step-1); text-align: center; }
.old-word p + p { margin-top: 1rem; }
.pager a { flex: 1 1 0; min-width: 0; }

/* ---------- Desktop: show more of each painting (less zoom) ---------- */
@media (min-width: 900px) {
  .office-band { height: min(56.25vw, 62svh); min-height: 320px; }
  .page-hero { min-height: min(56.25vw, 86svh); }
}
/* Armoury: sword and shield sit right, so the title goes left on wide screens */
.page-hero:has(img[src*="room-armoury"]) .page-hero__art img { object-position: 72% 60%; }
.office-band--armoury img { object-position: 70% 62%; }
@media (min-width: 900px) {
  .page-hero:has(img[src*="room-armoury"]) { align-items: flex-start; text-align: left; padding-left: clamp(2rem, 6vw, 6rem); }
  .page-hero:has(img[src*="room-armoury"]) p { margin-left: 0; max-width: 24rem; }
  .page-hero:has(img[src*="room-armoury"]) .label { white-space: nowrap; }
  .page-hero:has(img[src*="room-armoury"]) .page-hero__art img { object-position: 50% 60%; }
}
.office-band--psalter img { object-position: 50% 88%; }
@media (max-width: 899px) {
  .page-hero:has(img[src*="room-armoury"]) .page-hero__art img { height: 64%; object-position: 74% 70%;
    -webkit-mask-image: linear-gradient(#000 75%, transparent); mask-image: linear-gradient(#000 75%, transparent); }
}

/* ---------- Homepage v2: clearer start ---------- */
.quiet-link {
  display: inline-flex; align-items: center; min-height: 44px; margin-top: .5rem;
  font-family: var(--font-ui); font-size: .8125rem; letter-spacing: .14em; text-transform: uppercase;
  color: inherit; text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: .35em;
}
.quiet-link:hover { text-decoration-thickness: 2px; }
.surface-ivory .quiet-link { color: var(--gold-text); }
.panel__mission { max-width: 21ch; font-size: clamp(1.0625rem, .95rem + .35vw, 1.3125rem); }
.panel .quiet-link { margin-top: 1rem; }
.section-more { text-align: center; margin: var(--space-4) 0 0; }

.carry-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
@media (max-width: 899px) { .carry-grid { grid-template-columns: 1fr 1fr; gap: .75rem; } }
.carry {
  display: flex; flex-direction: column; gap: .35rem; min-height: 9.5rem; padding: 1.25rem 1.25rem 1rem;
  border: 1px solid rgba(163,138,85,.6); color: var(--ivory); text-decoration: none;
  background: linear-gradient(to bottom, rgba(163,138,85,.08), rgba(163,138,85,0));
  transition: border-color .2s ease, background-color .2s ease;
}
.carry:hover, .carry:focus-visible { border-color: var(--gold); background-color: rgba(163,138,85,.12); }
.carry__when { font-family: var(--font-ui); font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); line-height: 1.4; }
.carry__name { font-family: var(--font-display); font-size: var(--step-2); line-height: 1.1; }
.carry__go { margin-top: auto; font-family: var(--font-ui); font-size: .75rem; letter-spacing: .16em; text-transform: uppercase; color: var(--bone); }

.road { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
.road__art img { width: 100%; height: auto; display: block; box-shadow: 0 0 0 1px rgba(163,138,85,.55); }
.road__body h2 { font-size: var(--step-4); margin: .4rem 0 1rem; }
.road__body p { font-size: var(--step-1); line-height: 1.55; }
.road__actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.5rem; margin-top: 1.5rem; }
@media (max-width: 899px) { .road { grid-template-columns: 1fr; } .road__body { text-align: center; } .road__actions { justify-content: center; } }

/* Phones: wordmark, purpose and Pray Now all on the first screen */
@media (max-width: 899px) {
  .cover { aspect-ratio: auto; height: 60svh; min-height: 430px; max-height: 560px; padding-bottom: 1.6rem; }
  .cover__art img { object-position: 50% 42%; }
  .tiles { gap: .4rem; max-width: 360px; }
  .tile { aspect-ratio: 1 / .9; min-height: 60px; }
  .begin { padding: .75rem 1.25rem 1.75rem; }
  .begin__lead { font-size: 1.0625rem; margin-bottom: 1rem; }
  .begin .quiet-link { margin-top: .35rem; }
}
.carry, .carry * { font-style: normal; }

/* ---------- Headings: Cinzel ---------- */
:root { --font-heading: "Cinzel", "Cormorant Garamond", Georgia, serif; }
h1 { font-family: var(--font-heading); font-weight: 500; letter-spacing: .02em; line-height: 1.12; text-wrap: balance; }
.page-hero h1 { font-size: clamp(2rem, 1.4rem + 3vw, 3.6rem); }
.reader__head h1 { font-size: clamp(1.75rem, 1.3rem + 2.2vw, 3rem); }
.panel h1, .cover__title { font-family: inherit; }

/* ---------- Pass: hero copy, tiles, torn paper ---------- */
.panel__mission { max-width: 26ch; font-size: clamp(1.125rem, 1rem + .35vw, 1.375rem); }
.purpose__lead, .purpose__sub { display: block; }
.purpose__sub { margin-top: .5rem; font-size: .9em; opacity: .85; }
.begin__lead .purpose__sub { margin-top: .35rem; }
.quiet-link { white-space: nowrap; }
@media (max-width: 899px) {
  .tile span { font-size: .5625rem; letter-spacing: .06em; padding: 0 .15rem; }
}
@media (max-width: 370px) { .tile span { font-size: .5rem; letter-spacing: .04em; } }
/* Torn paper: desktop homepage hero and every room opening */
.hero::after, .page-hero::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 34px; z-index: 4; pointer-events: none;
  background: url("../img/torn-edge.svg") center bottom / 100% 100% no-repeat;
  filter: drop-shadow(0 -2px 2px rgba(0,0,0,.45));
}
.page-hero { border-bottom: 0; padding-bottom: calc(clamp(4rem, 10vw, 8rem) + 10px); }
.panel .panel__mission { font-size: clamp(1.25rem, 1rem + .6vw, 1.625rem); max-width: 24ch; }

/* Desktop bands: show (nearly) the whole painting */
@media (min-width: 900px) {
  .office-band { height: min(56.25vw, 80svh); }
  .office-band img[src*="office-morning"] { object-position: 50% 55%; }
  .office-band img[src*="office-midday"] { object-position: 60% 72%; }
  .office-band img[src*="office-evening"] { object-position: 50% 70%; }
}
