/* =========================================================
   Words of Prayer (Wren, 15 Oct 2026). Design spec for Kai.
   Theme tokens only. Gold TEXT on light grounds is #8A5A14 (AA);
   --gold is used for rules and borders only.
   ========================================================= */
:root { --wop-ink: #8A5A14; --wop-mark: rgba(138, 90, 20, 0.6); --wop-rule: rgba(201, 168, 76, 0.45); }

/* ---------- 1. The marked word ----------
   Server output is a real link to the glossary entry (works with no JS):
     <a class="wop-term" href="/words-of-prayer/#vouchsafe" data-wop="vouchsafe">vouchsafe</a>
   wop.js upgrades it to <button aria-expanded aria-controls> + popup.     */
.wop { position: relative; white-space: nowrap; }
.wop-term {
  font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit;
  background: none; border: 0; padding: 0; margin: 0; cursor: help;
  text-decoration: underline dotted var(--wop-mark); text-decoration-thickness: 1.5px; text-underline-offset: 0.22em;
  border-radius: 2px;
}
a.wop-term { color: inherit; }   /* the no-JS link looks the same as the upgraded button */
.wop-term:hover, .wop-term[aria-expanded="true"] { text-decoration-color: var(--wop-ink); background: rgba(201, 168, 76, 0.14); }
/* the theme's global focus ring (2px navy) applies; nothing extra needed */

/* ---------- the pop-up ---------- */
.wop-pop {
  position: absolute; z-index: 60; top: calc(100% + 10px); left: var(--wop-left, 0);
  width: min(330px, calc(100vw - 32px)); box-sizing: border-box;
  background: #fff; color: var(--text-dark); border-top: 3px solid var(--gold); border-radius: 8px;
  box-shadow: 0 10px 30px rgba(15, 28, 46, 0.18), 0 0 0 1px rgba(15, 28, 46, 0.06);
  padding: 0.85rem 1rem 0.8rem; text-align: left;
  font: 400 0.98rem/1.55 "Segoe UI", system-ui, -apple-system, sans-serif; font-style: normal; letter-spacing: 0; text-transform: none;
  white-space: normal;
}
.wop-pop[hidden] { display: none; }
.wop-pop::before {  /* the little pointer, aimed at the word by --wop-arrow */
  content: ""; position: absolute; top: -9px; left: var(--wop-arrow, 18px); width: 12px; height: 12px;
  background: var(--gold); transform: rotate(45deg); border-radius: 2px 0 0 0; z-index: -1; }
.wop-pop > span { display: block; }
.wop-head { margin-bottom: 0.25rem; }
.wop-word { font: 600 1.05rem/1.3 Georgia, serif; color: var(--navy); }
.wop-alt { font: italic 400 0.95rem Georgia, serif; color: var(--text-muted); }
.wop-say { display: block; margin-top: 0.1rem; font-size: 0.85rem; color: var(--text-muted); }
.wop-say b { font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.72rem; color: var(--wop-ink); margin-right: 0.35rem; }
.wop-def { color: var(--text-dark); }
.wop-def2 { color: var(--text-muted); font-size: 0.92rem; margin-top: 0.3rem; }
.wop-more { margin-top: 0.55rem; padding-top: 0.5rem; border-top: 1px solid var(--wop-rule); font-size: 0.9rem; }
.wop-more a { color: var(--navy); font-weight: 600; text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 3px; }
.wop-more a:hover { color: var(--wop-ink); }

/* ---------- the one-line hint at the top of a marked page ---------- */
.wop-hint { font-size: 0.92rem; color: var(--text-muted); margin: 0 0 1.4rem; }
.wop-hint .wop-sample { text-decoration: underline dotted var(--wop-mark); text-decoration-thickness: 1.5px; text-underline-offset: 0.22em; }
.wop-hint a { color: var(--navy); text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 3px; }

/* ---------- quiet mode: no marks, no hint (wop.js also unwraps the buttons to plain text) ---------- */
html[data-mode=quiet] .wop-hint, html[data-mode=quiet] .wop-pop { display: none !important; }
html[data-mode=quiet] .wop-term { text-decoration: none; background: none; cursor: inherit; }

/* ---------- 2. The glossary page ---------- */
.wop-page { background: var(--ivory); padding: 3.2rem 0 5rem; }
.wop-wrap { max-width: 720px; margin: 0 auto; padding: 0 1.5rem; font-size: 1.05rem; line-height: 1.75; color: var(--text-dark); }
.wop-intro p { margin: 0 0 1.1rem; }
.wop-small { font-size: 0.92rem; color: var(--text-muted); }

.wop-nav { background: #fff; border-top: 3px solid var(--gold); border-radius: 8px; box-shadow: var(--shadow); padding: 1.1rem 1.25rem 1.2rem; margin: 2rem 0 2.6rem; }
.wop-nav h2 { font: 600 0.78rem/1.4 "Segoe UI", system-ui, sans-serif; letter-spacing: 0.14em; text-transform: uppercase; color: var(--wop-ink); margin: 0 0 0.55rem; }
.wop-nav h2 + ul { margin-bottom: 1.1rem; }
.wop-groups { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem 1.5rem; }
.wop-groups a { color: var(--navy); font-family: Georgia, serif; font-weight: 600; text-decoration: underline; text-decoration-color: var(--wop-rule); text-underline-offset: 3px; }
.wop-groups a:hover { text-decoration-color: var(--gold); color: var(--wop-ink); }
.wop-groups .n { font: 400 0.85rem "Segoe UI", system-ui, sans-serif; color: var(--text-muted); margin-left: 0.25rem; }
.wop-az { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.3rem; }
.wop-az a, .wop-az span { display: inline-grid; place-items: center; min-width: 2.1rem; height: 2.1rem; border-radius: 4px; font: 600 0.95rem/1 Georgia, serif; }
.wop-az a { color: var(--navy); background: var(--ivory); border: 1px solid var(--wop-rule); text-decoration: none !important; }
.wop-az a:hover { background: rgba(201, 168, 76, 0.18); border-color: var(--gold); }
.wop-az span { color: #9a948a; }            /* letters with no words: shown, not linked */

.wop-group { scroll-margin-top: 130px; margin-bottom: 2.6rem; }
.wop-group > h2 { font-size: 1.6rem; margin: 0 0 0.4rem; padding-bottom: 0.45rem; border-bottom: 1px solid var(--wop-rule); }
.wop-group > .wop-small { margin: 0 0 1rem; }

/* Reading the old English: the twelve small words in one panel */
.wop-reading { background: var(--ivory-dark); border: 1px solid var(--wop-rule); border-radius: 8px; padding: 1rem 1.25rem 0.6rem; margin: 0 0 1.6rem; }
.wop-reading h3 { font-size: 1.15rem; margin: 0 0 0.25rem; }
.wop-reading > p { margin: 0 0 0.7rem; font-size: 0.95rem; color: var(--text-muted); }
.wop-reading dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 0; }
.wop-reading dt, .wop-reading dd { padding: 0.45rem 0; border-top: 1px solid var(--wop-rule); margin: 0; }
.wop-reading dt { font: 600 1.05rem/1.5 Georgia, serif; color: var(--navy); padding-right: 1.25rem; scroll-margin-top: 130px; }
.wop-reading dd { font-size: 0.98rem; line-height: 1.55; }

/* the entries */
.wop-list { margin: 0; }
.wop-list dt { scroll-margin-top: 130px; margin: 1.15rem 0 0.15rem; font: 600 1.15rem/1.35 Georgia, serif; color: var(--navy); }
.wop-list dfn { font-style: normal; }
.wop-list dt .alt { font-weight: 400; font-style: italic; color: var(--text-muted); font-size: 1rem; }
.wop-list dt .say { display: block; font: 400 0.88rem/1.4 "Segoe UI", system-ui, sans-serif; color: var(--text-muted); margin-top: 0.15rem; }
.wop-list dt .say b { font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.72rem; color: var(--wop-ink); margin-right: 0.35rem; }
.wop-list dd { margin: 0; padding-bottom: 1.05rem; border-bottom: 1px solid rgba(15, 28, 46, 0.08); }
.wop-list dd p { margin: 0; }
.wop-list dd p + p { margin-top: 0.35rem; color: var(--text-muted); font-size: 0.98rem; }
/* arriving from a pop-up's "more" link: a soft, brief highlight on the entry */
.wop-list dt:target, .wop-reading dt:target { background: rgba(201, 168, 76, 0.2); box-shadow: -0.6rem 0 0 rgba(201, 168, 76, 0.2), 0.6rem 0 0 rgba(201, 168, 76, 0.2); border-radius: 4px; }
.wop-list dt:target + dd, .wop-reading dt:target + dd { background: rgba(201, 168, 76, 0.08); box-shadow: -0.6rem 0 0 rgba(201, 168, 76, 0.08), 0.6rem 0 0 rgba(201, 168, 76, 0.08); }
.wop-top { font-size: 0.88rem; margin: 0.9rem 0 0; }
.wop-top a { color: var(--text-muted); text-decoration: underline; text-decoration-color: var(--wop-rule); text-underline-offset: 3px; }

/* A to Z index */
.wop-index h3 { font: 600 1.05rem Georgia, serif; color: var(--wop-ink); margin: 1rem 0 0.3rem; scroll-margin-top: 130px; }
.wop-index ul { list-style: none; margin: 0; padding: 0; columns: 3; column-gap: 1.5rem; }
.wop-index li { break-inside: avoid; line-height: 1.7; }
.wop-index a { color: var(--navy); text-decoration: underline; text-decoration-color: var(--wop-rule); text-underline-offset: 3px; }

@media (max-width: 600px) {
  .wop-page { padding: 2.2rem 0 3.5rem; }
  .wop-groups { grid-template-columns: 1fr; }
  .wop-group > h2 { font-size: 1.4rem; }
  .wop-reading { padding: 0.9rem 1rem 0.5rem; }
  .wop-reading dt { padding-right: 0.9rem; }
  .wop-index ul { columns: 2; }
}
