/* ————— The Book of Hours ————— */

@font-face {
  font-family: 'Palatino';
  src: url('/prayers/assets/fonts/Palatino.woff2') format('woff2'),
       url('/prayers/assets/fonts/Palatino.woff') format('woff'),
       url('/prayers/assets/fonts/Palatino.ttf') format('truetype');
  font-display: swap;
}

:root {
  --fs-scale: 1;
  --header-h: 3.5rem;
  --bg: #f7f6f3;
  --surface: #ffffff;
  --text: #3d3d3d;
  --heading: #1c1c1c;
  --muted: #6b6b6b;
  --rule: #dcdad5;
  --accent: #0c7dc6;
  --header-bg: #6b6b6b;
  --header-text: #ffffff;
  --acc-head-bg: #6a6b6b;
  --acc-head-text: #ffffff;
  --acc-body-bg: #ffffff;
  --shadow: 0 3px 10px rgba(0,0,0,.12);
  --drawer-bg: #565656;
}

:root[data-theme="dark"] {
  --bg: #111111;
  --surface: #1a1a1a;
  --text: #e8e6e1;
  --heading: #ffffff;
  --muted: #a5a5a5;
  --rule: #2e2e2e;
  --accent: #5db2ef;
  --header-bg: #1d1d1d;
  --header-text: #f2f2f2;
  --acc-head-bg: #2e2e2e;
  --acc-head-text: #f2f2f2;
  --acc-body-bg: #1a1a1a;
  --shadow: 0 3px 10px rgba(0,0,0,.5);
  --drawer-bg: #1d1d1d;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation; /* no double-tap zoom; taps on A+/A− stay taps */
  overflow-x: clip;
}

body {
  margin: 0;
  font-family: 'Palatino', 'Palatino Linotype', 'Book Antiqua', Georgia, serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  transition: background .25s ease, color .25s ease;
  overflow-x: clip;
}

/* ————— Header ————— */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: 0 .9rem;
  background: var(--header-bg);
  color: var(--header-text);
  box-shadow: var(--shadow);
  transition: transform .25s ease;
}
.site-header.tucked { transform: translateY(-100%); }

.brand {
  color: var(--header-text);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: .5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-controls { display: flex; align-items: center; gap: .25rem; }

.ctrl {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--header-text);
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: inherit;
}
.ctrl { -webkit-tap-highlight-color: transparent; }
.ctrl:hover { background: rgba(255,255,255,.14); }
.ctrl:active { background: rgba(255,255,255,.25); }
.ctrl:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.fs-a { font-size: 1.25rem; font-weight: 700; line-height: 1; }
.fs-a.small { font-size: .85rem; }

:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
:root[data-theme="light"] .icon-sun { display: none; }
:root[data-theme="light"] .icon-moon { display: block; }

/* ————— Nav drawer ————— */

.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 60;
  opacity: 0;
  transition: opacity .25s ease;
}
.nav-overlay.show { opacity: 1; }

.nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(21rem, 88vw);
  background: var(--drawer-bg);
  z-index: 70;
  transform: translateX(102%);
  visibility: hidden; /* fully out of layout when closed: no phantom horizontal scroll */
  transition: transform .28s ease, visibility 0s .28s;
  overflow-y: auto;
  padding: 3.6rem 0 2rem;
  box-shadow: -4px 0 18px rgba(0,0,0,.3);
}
.nav-drawer.open {
  transform: translateX(0);
  visibility: visible;
  transition: transform .28s ease, visibility 0s 0s;
}

.drawer-close { position: absolute; top: .6rem; right: .6rem; color: #fff; }

.nav-drawer ul { list-style: none; margin: 0; padding: 0; }
.nav-drawer a {
  display: block;
  padding: .85rem 1.5rem;
  color: #fff;
  text-decoration: none;
  font-size: 1.02rem;
  letter-spacing: .5px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.nav-drawer a:hover { background: rgba(255,255,255,.12); }
.nav-drawer li.active a {
  background: var(--surface);
  color: var(--accent);
  font-weight: 700;
}

/* ————— Page ————— */

.page {
  font-size: calc(1.15rem * var(--fs-scale));
  max-width: min(44em, 100% - 2.4rem);
  margin: 0 auto;
  padding: 2.2em 0 3em;
}

.entry-title {
  font-size: 2em;
  font-weight: 900;
  letter-spacing: 1px;
  text-align: center;
  color: var(--heading);
  position: relative;
  margin: .6em 0 1.6em;
  line-height: 1.25;
}
.entry-title::after {
  content: "";
  position: absolute;
  width: 70px;
  height: 3px;
  background: var(--heading);
  bottom: -.55em;
  left: 50%;
  transform: translateX(-50%);
}

.entry-content { color: var(--text); overflow-wrap: break-word; }

.entry-content h4 {
  font-size: 1.4em;
  font-weight: 900;
  letter-spacing: 1px;
  text-align: center;
  color: var(--heading);
  margin: 1.8em 0 .9em;
  line-height: 1.3;
}

.entry-content p { margin: 0 0 1em; }
.entry-content .center, .entry-content p.center { text-align: center; }

.entry-content a { color: var(--accent); text-decoration: none; }
.entry-content a:hover { text-decoration: underline; }

.entry-content strong { color: var(--heading); }
.entry-content em strong, .entry-content strong em { color: inherit; }

/* devotional blocks from the original */
.isthour-morning, .Worshipper-Prays, .lords-preyers, .thanksgiving {
  margin: 0 0 1em;
}
.lords-preyers p, .thanksgiving p { margin-bottom: .35em; }
.lords-preyers p:first-child, .thanksgiving p:first-child {
  text-align: center;
  margin-bottom: 1em;
}
.lords-preyers p strong, .thanksgiving p strong {
  font-size: 1.3em;
  font-weight: 900;
  letter-spacing: 1px;
}

/* hour links on the preface */
.hour-link {
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: var(--surface);
  padding: .55em .8em;
  margin: 0 0 .6em !important;
}
.hour-link a { color: var(--text) !important; display: block; }
.hour-link a strong { color: var(--heading); }
.hour-link a:hover { text-decoration: none; }
.hour-link:hover { border-left-width: 6px; }

/* ————— Accordions ————— */

.accordion { margin: 1.2em 0; }

.accordion details {
  margin-bottom: .5em;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--rule);
  background: var(--acc-body-bg);
}

.accordion summary {
  list-style: none;
  cursor: pointer;
  background: var(--acc-head-bg);
  color: var(--acc-head-text);
  padding: .65em 1em;
  font-size: .92em;
  letter-spacing: .5px;
  display: flex;
  align-items: center;
  gap: .6em;
  user-select: none;
}
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary::before {
  content: "";
  flex: 0 0 auto;
  width: .55em;
  height: .55em;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform .2s ease;
  margin-top: -.1em;
}
.accordion details[open] > summary::before { transform: rotate(45deg); margin-top: -.25em; }
.accordion summary:hover { filter: brightness(1.12); }
.accordion summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.accordion .accordion-body { padding: 1em 1.1em .4em; }

/* expand / collapse all */
.accordion-tools {
  display: flex;
  justify-content: center;
  gap: .6rem;
  margin-bottom: 1.2em;
}
.accordion-tools button {
  appearance: none;
  font-family: inherit;
  font-size: .85rem;
  letter-spacing: .5px;
  padding: 0 .95rem;
  height: 2.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}
.accordion-tools button:hover { color: var(--accent); border-color: var(--accent); }

/* ————— Pager ————— */

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3em;
  padding-top: 1.4em;
  border-top: 1px solid var(--rule);
  font-size: .85em;
}
.pager a {
  color: var(--muted);
  text-decoration: none;
  max-width: 48%;
}
.pager a:hover { color: var(--accent); }
.pager .next { margin-left: auto; text-align: right; }
.pager span.dir {
  display: block;
  font-size: .72em;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
  margin-bottom: .2em;
}
.pager a strong { color: var(--heading); font-weight: 700; }
.pager a:hover strong { color: var(--accent); }

/* ————— Footer ————— */

.site-footer {
  border-top: 1px solid var(--rule);
  padding: 1.4rem 1rem 2rem;
  text-align: center;
}
.site-footer p { color: var(--muted); font-size: .85rem; margin: 0; }

/* ————— Reduced motion ————— */

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
