/* Static chapter pages (generated by tools/build_pages.py) */
.chapter { background: var(--bg); color: var(--fg); }

.cbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px var(--edge);
}

/* The last button's icon sits inside its tap area: line the icon up with the margin */
.cbar__tools { margin-right: -9px; }

.cbar__read,
.cmain a { color: inherit; }
.cbar__read { font-size: 13px; text-align: right; }

.cmain { max-width: 760px; margin: 0 auto; padding: 16px var(--pad) 56px; overflow-wrap: anywhere; }
.cmain__crumb { font-size: 14px; color: var(--muted); }
.cmain__crumb ol { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 7px; margin: 0; padding: 0; list-style: none; }
.cmain__crumb li + li::before { content: "›"; margin-right: 7px; }
.cmain__crumb a { display: inline-block; padding: 8px 0; text-underline-offset: 3px; }
.cmain__crumb [aria-current] { color: var(--fg); }

/* Every page opens the same way: title and intro in the centre, reading text below */
.cmain h1,
.cmain__crumb,
.clede,
.sempty,
.serror { text-align: center; }
.cmain h1 { margin-top: 18px; font-size: clamp(30px, 7vw, 42px); font-weight: 500; line-height: 1.2; }
.cmain__en { display: block; margin-top: 2px; font-size: 0.55em; font-weight: 400; color: var(--muted); }

.cverses { margin: 32px 0 0; padding: 0; list-style: none; }
.cv { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 6px; padding: 16px 0; border-top: 1px solid rgba(var(--ink), 0.12); }
.cv__n { font-size: 13px; color: var(--muted) !important; text-decoration: none; line-height: 28px; }
.cv__ta { font-size: 18px; line-height: 1.7; overflow-wrap: anywhere; }
.cv__en { margin-top: 8px; font-size: 16px; line-height: 1.6; color: rgba(var(--ink), 0.9); }

.csteps { display: flex; justify-content: space-between; gap: 16px; margin-top: 32px; font-size: 14px; }
.csteps__next { text-align: right; }

.cnums { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 28px; }
.cnums a {
  display: grid;
  place-items: center;
  min-width: 44px;
  height: 44px;
  border: 1px solid rgba(var(--ink), 0.14);
  border-radius: 12px;
  font-size: 14px;
  text-decoration: none;
}
.cnums a[aria-current] { background: var(--fg); color: var(--bg); }

.csource { margin-top: 32px; font-size: 13px; color: var(--muted); }

/* Word meanings, About and Saved pages */
.cmain h2 { margin-top: 36px; font-size: 22px; font-weight: 500; }
.cmain h3 { margin-top: 20px; font-size: 17px; font-weight: 600; }
.cmain p + h3 { margin-top: 24px; }
.cmain > p:not(.cmain__crumb):not(.csource),
.ctips { margin-top: 12px; line-height: 1.65; }
.clede { font-size: 17px; color: var(--muted); }
.ctips { padding-left: 20px; }
.ctips li + li { margin-top: 6px; }

.wentry { padding: 14px 0; border-top: 1px solid rgba(var(--ink), 0.12); scroll-margin-top: 12px; }
.wentry h3 { margin-top: 0; }
.wentry ol { margin-top: 6px; padding-left: 20px; line-height: 1.55; }
.wentry ol .l-en,
.wentry ol .l-ta { display: block; }
[data-lang-mode="both"] .wentry ol .l-ta { color: var(--muted); }
.wnote { margin-top: 8px; font-size: 14px; line-height: 1.5; color: var(--muted); }

.slist { margin-top: 24px; padding: 0; list-style: none; }
.sitem { position: relative; padding: 18px 0; border-top: 1px solid rgba(var(--ink), 0.12); }
.sitem__ref { display: block; margin-bottom: 8px; padding-right: 44px; font-size: 14px; font-weight: 500; }
.sitem__remove {
  position: absolute;
  top: 6px;
  right: -12px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s, background-color 0.2s;
}
.sitem__remove svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.sitem__remove:focus-visible { outline: 2px solid var(--fg); outline-offset: -2px; }
@media (hover: hover) {
  .sitem__remove:hover { background: rgba(var(--ink), 0.07); color: var(--fg); }
}

/* Site map */
.mbook { border-top: 1px solid rgba(var(--ink), 0.12); }
.mbook summary { display: flex; align-items: center; gap: 8px; min-height: 48px; font-size: 15px; cursor: pointer; }
.mbook small { margin-left: auto; color: var(--muted); font-size: 13px; }
.mbook .cnums { margin: 4px 0 16px; }

/* ---------- About ---------- */
.about {
  --a-serif: "Source Serif 4", Georgia, serif;
  --a-serif-ta: "Noto Serif Tamil", "Noto Sans Tamil", serif;
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px var(--pad) 72px;
  overflow-wrap: anywhere;
}

.about .l-en,
.about .l-ta { display: block; }
.about .btn .l-en,
.about .btn .l-ta,
.about figcaption .l-en,
.about figcaption .l-ta { display: inline; }
[data-lang-mode="en"] .about .l-ta,
[data-lang-mode="ta"] .about .l-en { display: none !important; }

/* Both languages: the Tamil follows, one step quieter */
[data-lang-mode="both"] .about h1 .l-ta,
[data-lang-mode="both"] .about h2 .l-ta,
[data-lang-mode="both"] .about h3 .l-ta { margin-top: 0.3em; font-size: 0.68em; line-height: 1.4; opacity: 0.8; }
[data-lang-mode="both"] .about p > .l-ta { margin-top: 0.65em; }
[data-lang-mode="both"] .about .btn .l-ta { display: none; }
[data-lang-mode="both"] .about figcaption .l-ta::after { content: " · "; }

.about h1,
.about h2 { font-family: var(--a-serif); font-weight: 400; letter-spacing: -0.015em; }
.about h1 :lang(ta),
.about h2 :lang(ta),
.about h3 :lang(ta) { font-family: var(--a-serif-ta); letter-spacing: 0; }

.ahero { max-width: 760px; margin: 0 auto; padding: 44px 0 56px; text-align: center; }
.ahero h1 { font-size: clamp(38px, 8vw, 68px); line-height: 1.08; }
.ahero__lede { margin-top: 22px; font-size: 18px; line-height: 1.65; color: var(--muted); }

/* The heart of the page: set like a page of a Bible */
.apage {
  max-width: 820px;
  margin: 0 auto;
  padding: clamp(32px, 7vw, 68px) clamp(24px, 7vw, 76px);
  border-radius: 6px 22px 22px 6px;
  background: var(--fg);
  color: var(--bg);
  box-shadow: inset 14px 0 18px -14px rgba(127, 127, 127, 0.55);
}
.apage h2 { margin-top: 14px; font-size: clamp(28px, 5.4vw, 42px); line-height: 1.16; }
.apage > p:last-child { margin-top: 20px; font-family: var(--a-serif); font-size: 19px; line-height: 1.7; }
.apage > p:last-child :lang(ta) { font-family: var(--a-serif-ta); font-size: 17.5px; line-height: 1.85; }

.apractices {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  max-width: 820px;
  margin: 12px auto 0;
  padding: 0;
  list-style: none;
}
.apractice { padding: 26px 0; border-bottom: 1px solid rgba(var(--ink), 0.14); }
.apractice svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.apractice h3 { margin-top: 12px; font-size: 18px; font-weight: 500; line-height: 1.35; }
.apractice p { margin-top: 8px; font-size: 15.5px; line-height: 1.6; color: var(--muted); }

.amoments { max-width: 820px; margin: 64px auto 0; }
.amoments h2 { font-size: clamp(30px, 6vw, 46px); line-height: 1.12; }
.amoments p { margin-top: 18px; font-size: 17px; line-height: 1.7; }
.amoments .btn { display: flex; width: fit-content; margin: 36px auto 0; grid-column: 1 / -1; }

.averse { margin: 84px auto; max-width: 720px; text-align: center; }
.averse blockquote { margin: 0; }
.averse .l-ta { font-family: var(--a-serif-ta); font-size: clamp(22px, 4.6vw, 30px); line-height: 1.6; }
.averse blockquote .l-en { margin-top: 14px; font-family: var(--a-serif); font-size: clamp(19px, 3.6vw, 24px); line-height: 1.5; }
.averse figcaption { margin-top: 20px; font-size: 14px; color: var(--muted); }
.averse figcaption a { color: inherit; }

.adetails { display: grid; gap: 44px; max-width: 820px; margin: 0 auto; }
.adetails h2 { font-size: 26px; }
.about .ctips { margin-top: 14px; line-height: 1.65; }
.afaq { border-bottom: 1px solid rgba(var(--ink), 0.14); }
.afaq:first-of-type { margin-top: 14px; }
.afaq summary { padding: 14px 0; font-size: 16px; font-weight: 500; line-height: 1.4; cursor: pointer; }
.afaq p { padding-bottom: 16px; font-size: 15.5px; line-height: 1.65; color: var(--muted); }

.ablessing { max-width: 640px; margin: 72px auto 0; text-align: center; }
.ablessing > p:first-child { font-family: var(--a-serif); font-size: clamp(22px, 4.4vw, 30px); line-height: 1.35; }
.ablessing > p:first-child :lang(ta) { font-family: var(--a-serif-ta); font-size: 0.8em; line-height: 1.6; }
.ablessing__sign { margin-top: 16px; font-size: 14px; color: var(--muted); }

@media (min-width: 760px) {
  .apractices { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; margin-top: 28px; }
  .apractice { border-bottom: 0; }
  .amoments { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr); column-gap: 40px; margin-top: 84px; }
  .amoments p:first-child { margin-top: 6px; }
  .adetails { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr); gap: 40px; }
}

/* Tamil words are long: keep Tamil headings inside their column */
[data-lang-mode="ta"] .about h2 .l-ta { font-size: 0.72em; line-height: 1.35; }
[data-lang-mode="ta"] .ahero h1 .l-ta { font-size: 0.78em; line-height: 1.3; }
.about h1,
.about h2,
.about h3 { overflow-wrap: break-word; }

/* About: habit icons and headings sit in the centre */
.apractice svg { display: block; margin: 0 auto; }
.apractice h3 { text-align: center; }

/* Common questions: the marker stays on the same line as the question */
.afaq summary .l-en,
.afaq summary .l-ta { display: inline; }
[data-lang-mode="both"] .afaq summary .l-ta { display: block; margin-top: 2px; font-weight: 400; color: var(--muted); }

/* Static pages follow the language menu */
.l-sep { display: none; }
[data-lang-mode="both"] .chapter .l-sep { display: inline; }
[data-lang-mode="en"] .chapter .l-ta,
[data-lang-mode="en"] .chapter .cv__ta,
[data-lang-mode="ta"] .chapter .l-en,
[data-lang-mode="ta"] .chapter .cv__en { display: none; }
[data-lang-mode="ta"] .cmain__en { font-size: inherit; color: inherit; }
[data-lang-mode="en"] .cv__en { margin-top: 0; font-size: 18px; }

.cbar__tools { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cbar__tools .langmenu__chev { flex: none; }
.cbar .pill,
.cbar .theme-toggle { height: 38px; }
.cbar .theme-toggle { width: 38px; }
.cbar .pill { padding: 0 12px; gap: 6px; font-size: 12px; }
.cbar .langmenu { position: relative; }
.chapter .cbar .logo { flex: none; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Phones: logo, language and theme share one row (Read stays in the footer) */
@media (max-width: 480px) {
  .cbar__read { display: none; }
  .cbar .langmenu__btn .langmenu__chev { display: none; }
  .cbar .langmenu__btn { white-space: nowrap; }
}

/* ---------- Continuous reading ---------- */
.flow {
  --f-serif: "Source Serif 4", Georgia, serif;
  --f-serif-ta: "Noto Serif Tamil", "Noto Sans Tamil", serif;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 var(--pad) 72px;
}

.fbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 8px 0 10px;
  background: var(--bg);
}

/* One capsule: book on the left, chapter on the right */
.fpick {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  max-width: 460px;
  margin: 0 auto;
  border: 1px solid rgba(var(--ink), 0.2);
  border-radius: 20px;
  background: rgba(var(--ink), 0.035);
  transition: border-color 0.2s;
}
.fpick:focus-within { border-color: var(--fg); }

.ffield {
  position: relative;
  display: block;
  min-width: 0;
  padding: 9px 34px 8px 18px;
  cursor: pointer;
}
.ffield--ch { padding-left: 14px; border-left: 1px solid rgba(var(--ink), 0.14); }

.ffield::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -5px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  pointer-events: none;
}

.ffield__k {
  display: block;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.ffield__k :lang(ta) { letter-spacing: 0; text-transform: none; font-size: 11.5px; }

.ffield select {
  display: block;
  width: 100%;
  margin-top: 1px;
  padding: 0;
  border: 0;
  outline: none;
  background: none;
  color: var(--fg);
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.35;
  text-overflow: ellipsis;
  -webkit-appearance: none;
          appearance: none;
  cursor: pointer;
}
.ffield select option { background: var(--bg); color: var(--fg); }

.fprev {
  display: block;
  min-height: 44px;
  margin: 18px auto 0;
  padding: 0 18px;
  border: 1px solid rgba(var(--ink), 0.28);
  border-radius: 999px;
  background: none;
  color: var(--fg);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.fprev[hidden] { display: none; }

.fchap { padding-top: 40px; scroll-margin-top: 56px; }

.fhead { margin-bottom: 24px; text-align: center; font-weight: 400; }
.fhead__ta { display: block; font-family: var(--f-serif-ta); font-size: 26px; line-height: 1.4; }
.fhead__en { display: block; font-family: var(--f-serif); font-size: 24px; line-height: 1.3; }
.fhead__ta + .fhead__en { margin-top: 2px; font-size: 16px; color: var(--muted); }

.fta { font-family: var(--f-serif-ta); font-size: 19px; line-height: 1.9; overflow-wrap: anywhere; }
.fen { font-family: var(--f-serif); font-size: 20px; line-height: 1.75; }

.fnum {
  margin-right: 3px;
  font-family: var(--sans);
  font-size: 0.62em;
  font-weight: 600;
  line-height: 0;
  color: var(--muted);
  vertical-align: super;
}

/* Both languages: verse by verse, still with no screens between them */
.fpair { padding: 8px 0; scroll-margin-top: 72px; }
.fpair .fen { margin-top: 2px; font-size: 16.5px; line-height: 1.6; color: rgba(var(--ink), 0.82); }
.is-target { background: rgba(var(--ink), 0.08); border-radius: 6px; box-shadow: 0 0 0 6px rgba(var(--ink), 0.08); }

.ffeed { min-height: 100vh; } /* keeps the footer below the screen until the text arrives */
.fsentinel { height: 1px; }
.fend,
.ferror,
.fnote { margin-top: 40px; text-align: center; color: var(--muted); }

@media (min-width: 760px) {
  [data-lang-mode="both"] .flow { max-width: 1040px; }
  .fpair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; }
  .fpair .fen { margin-top: 0; }
}

/* One language: each verse starts on its own line */
.fflow > span { display: block; padding: 5px 0; scroll-margin-top: 72px; }

/* ---------- Contact us ---------- */
.contact { text-align: center; }
.contact .l-en,
.contact .l-ta { display: block; }
.contact .l-sep { display: none !important; }
.contact h1 .l-ta { font-size: 0.9em; }
[data-lang-mode="both"] .contact h1 .l-ta { margin-top: 4px; font-size: 0.55em; font-weight: 400; color: var(--muted); }
.contact p .l-ta { margin-top: 4px; }
.cmain > .contact__mail { margin-top: 32px; font-family: "Source Serif 4", Georgia, serif; font-size: clamp(22px, 6vw, 30px); overflow-wrap: anywhere; }
.contact__mail a { text-underline-offset: 6px; text-decoration-thickness: 1px; }
.cmain.contact > p:nth-of-type(3) { margin: 32px auto 0; max-width: 560px; }
.cmain.contact > .contact__tip { margin: 16px auto 0; max-width: 560px; font-size: 14px; color: var(--muted); }
