* {
  box-sizing: border-box;
}
:root {
  --bg: #ffffff; /* page background */
  --ink: #141e26; /* body text */
  --soft: #2e3f4f; /* muted text (footnotes, eyebrows) */
  --rule: #dde6ea; /* dividers and borders */
  --paper: #ffffff; /* card/chip backgrounds */
  --teal: #159ab7; /* primary accent */
  --teal-dk: #1e5067; /* dark teal — nav bar, footer, headings */
  --teal-lt: #9ac5d3; /* light teal — nav subtitle, pills */
  --pill-bg: #eaf4f7; /* book row / chip hover fill */
  --accent: #159ab7; /* alias for teal (used in older rules) */
  --fs: 1.075rem; /* base font size */
  --lh: 1.9; /* verse line height */
}
.redLetter {
  color: #c0392b; /* words of Christ — tune to taste (#b0281c deeper, #cc0000 brighter) */
  display: inline; /* only load-bearing if wrapper is <div>; harmless on <span> */
}
@media (prefers-color-scheme: dark) {
  .redLetter {
    color: #ff6b5e;
  } /* lift red for contrast on dark bg */
}
html {
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Mukta Malar", system-ui, -apple-system, sans-serif;
  font-weight: 400;
  line-height: var(--lh);
  font-size: var(--fs);
  overflow-wrap: break-word;
  word-break: normal;
}
img {
  max-width: 100%;
  height: auto;
}
a {
  color: var(--ink);
  text-decoration: none;
  text-underline-offset: 2px;
}
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  border-radius: 3px;
}

/* --- NAV BAR --- */
/* CSS grid: 3 EQUAL columns — center column is always geometric center regardless of side content */
.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0.5rem max(0.9rem, env(safe-area-inset-left));
  background: #cbd8df;
  border-bottom: 0.5px solid #b0c4ce;
  min-height: 5rem;
}
.bar-logo {
  justify-self: start;
  display: flex;
  align-items: center;
}
.bar-logo img {
  width: 2.5rem;
  height: auto;
  opacity: 0.85;
}
.bar-center {
  justify-self: center;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.brand {
  font-weight: 700;
  color: #159ab7;
  text-decoration: none;
  font-size: 1.5rem;
  line-height: 1.2;
  display: block;
}
.brandsub {
  font-size: 0.6rem;
  color: #fff;
  letter-spacing: 0.04em;
  font-weight: 500;
  display: block;
}
.searchpill {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.5);
  border: 0.5px solid rgba(30, 80, 103, 0.2);
  border-radius: 20px;
  padding: 5px 13px;
  font-size: 0.78rem;
  color: var(--teal-dk);
  text-decoration: none;
  white-space: nowrap;
}
.searchpill:hover {
  background: rgba(255, 255, 255, 0.75);
}
.bar .ic {
  font-size: 1.35rem;
  color: var(--teal-dk);
  text-decoration: none;
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- LAYOUT --- */
.wrap {
  max-width: 42rem;
  margin: 0 auto;
  padding: 1.4rem max(1rem, env(safe-area-inset-left)) 4rem;
}

/* --- TYPOGRAPHY --- */
.eyebrow {
  margin: 0 0 0.1rem;
  color: var(--soft);
  font-size: 0.95rem;
}
.eyebrow a {
  color: var(--soft);
}
h1 {
  font-weight: 700;
  font-size: clamp(1.5rem, 4.5vw, 2rem);
  line-height: 1.35;
  margin: 0.1rem 0 1.4rem;
  letter-spacing: 0.01em;
}
h1 .chno {
  font-weight: 400;
  font-size: 1.25em;
}
.sec {
  font-weight: 700;
  margin: 1.9rem 0 0.4rem;
  line-height: 1.45;
}
h2.sec {
  font-size: 1.18rem;
}
h3.sec {
  font-size: 1.04rem;
}
.xref {
  margin: 0.1rem 0 0.6rem;
  color: var(--soft);
  font-size: 0.9rem;
  font-style: italic;
}

/* --- VERSE TEXT --- */
.v {
  margin: 0.4rem 0;
}
.vn {
  font-weight: 700;
  font-size: 0.7em;
  vertical-align: 0.25em;
  margin-right: 0.2em;
  font-feature-settings: "tnum";
}
sup.fn a {
  font-size: 0.75em;
  font-weight: 700;
  padding: 0 0.12em;
  text-decoration: none;
}

/* --- FOOTNOTES --- */
.notes {
  margin-top: 2.4rem;
  border-top: 1px solid var(--rule);
  padding-top: 1rem;
}
.notes h4 {
  margin: 0.2rem 0 0.6rem;
  color: var(--soft);
  font-weight: 600;
  font-size: 0.95rem;
}
.notes .fnlist {
  margin: 0;
}
.notes .note {
  font-size: 0.92rem;
  color: var(--soft);
  line-height: 1.75;
  margin: 0.4rem 0;
  text-indent: -1.4rem;
  padding-left: 1.4rem;
}
.notes .fm {
  font-weight: 700;
  color: var(--ink);
  margin-right: 0.3rem;
}

/* --- PREV/NEXT PAGER (chapter navigation) --- */
.pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.4rem;
  margin-top: 2.6rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}
.pn {
  font-size: 0.95rem;
  padding: 0.55rem 0.3rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.pn.up {
  color: var(--soft);
}

/* --- CHAPTER GRID (book landing page) --- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(2.9rem, 1fr));
  gap: 0.5rem;
  margin-top: 1rem;
}
.chip {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 0.5rem;
  text-align: center;
  padding: 0.5rem 0.2rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chip:active {
  background: var(--pill-bg);
}

/* --- HOME PAGE MISC --- */
.home h1 {
  margin-bottom: 0.1rem;
}
.lead {
  color: var(--soft);
  margin: 0 0 1.4rem;
  font-size: 1.1rem;
}
.searchcta {
  display: block;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 0.6rem;
  padding: 0.85rem 1rem;
  margin: 0 0 2rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
}

/* --- CATEGORY HEADINGS (home page group labels) --- */
.cat {
  margin: 1.6rem 0;
}
.cat h2 {
  font-size: 0.92rem;
  color: var(--teal-dk);
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0 0 0.4rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid var(--teal);
}
.books {
  display: flex;
  flex-direction: column;
}

/* --- BOOK ROW (home + group pages) --- */
.bk {
  padding: 0.65rem 0.1rem;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  text-decoration: none;
  min-height: 44px;
  display: flex;
  align-items: center;
}

/* --- SEARCH PAGE --- */
.qbox {
  width: 100%;
  font: inherit;
  padding: 0.8rem 1rem;
  border: 1px solid #000;
  border-radius: 0.6rem;
  background: #fff;
  color: #000;
}
.stat {
  color: var(--soft);
  font-size: 0.9rem;
  min-height: 1.2rem;
}
.results {
  display: flex;
  flex-direction: column;
}
.hit {
  padding: 0.75rem 0.1rem;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  color: var(--ink);
  display: block;
}
.hit .ref {
  color: var(--ink);
  font-weight: 700;
  font-size: 0.9rem;
  display: block;
  margin-bottom: 0.15rem;
}
.hit mark {
  background: #b8e4ef;
  color: var(--teal-dk);
  padding: 0 0.05em;
} /* search highlight */

/* --- ACCESSIBILITY --- */
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
@media (min-width: 40rem) {
  .wrap {
    padding-left: 1.4rem;
    padding-right: 1.4rem;
  }
}

/* --- HOME TWO-COLUMN LAYOUT --- */
.logolink {
  color: var(--teal-lt);
}
.logo {
  display: block;
  width: 1.7rem;
  height: auto;
}
.masthead {
  text-align: center;
  padding: 1rem 0 1.6rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 1.8rem;
}
.masthead h1 {
  margin: 0;
  font-size: clamp(1.7rem, 6vw, 2.4rem);
  font-weight: 700;
  letter-spacing: 0.01em;
}
.masthead .lead {
  margin: 0.15rem 0 1.1rem;
  font-size: 1.05rem;
  color: var(--soft);
}
.masthead .searchcta {
  display: inline-block;
  margin: 0;
  padding: 0.6rem 1.2rem;
  border-radius: 2rem;
  font-size: 0.95rem;
}
.wrap.home {
  max-width: 60rem;
}
.home-cols {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.4rem;
}
.tcol .tst {
  font-size: clamp(1.25rem, 4vw, 1.55rem);
  font-weight: 700;
  margin: 0 0 1.1rem;
  padding-bottom: 0.5rem;
  position: relative;
}
.tcol .tst::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 2.4rem;
  height: 3px;
  background: var(--teal);
}
.cat {
  margin: 0 0 1.35rem;
}
.ceyebrow {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  color: var(--soft);
  margin: 0 0 0.25rem;
  text-transform: uppercase;
}
.books {
  display: flex;
  flex-direction: column;
}
.bk {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.55rem 0.3rem 0.55rem 0.55rem;
  border-bottom: 1px solid var(--rule);
  border-left: 3px solid transparent;
  color: var(--ink);
  text-decoration: none;
  min-height: 44px;
  transition: background 0.15s, border-color 0.15s;
}
.bk:hover {
  background: var(--pill-bg);
  border-left-color: var(--teal);
}
.bk .bn {
  font-weight: 500;
}
.bk .cnt {
  color: var(--soft);
  font-size: 0.8rem;
  font-weight: 600;
  font-feature-settings: "tnum";
  flex: none;
}
@media (min-width: 48rem) {
  .home-cols {
    grid-template-columns: 1fr 1fr;
    gap: 3.2rem;
    position: relative;
  }
  .home-cols::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1px;
    background: var(--rule);
  }
}

/* --- INTRO / BOOK LANDING PROSE --- */
.intro {
  margin: 0 0 1.4rem;
}
.intro .isec {
  font-size: 1.06rem;
  font-weight: 700;
  margin: 1.4rem 0 0.35rem;
}
.intro .ipara {
  margin: 0.6rem 0;
  text-align: justify;
  hyphens: auto;
}
.intro .ilist {
  margin: 0.6rem 0;
  padding-left: 1.15rem;
}
.intro .ilist li {
  margin: 0.45rem 0;
  text-align: justify;
}
.grid-h {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 1.6rem 0 0.3rem;
}

/* --- HOME NAV LINKS (முன்னுரை) --- */
.homenav {
  display: flex;
  gap: 1.4rem;
  justify-content: center;
  margin: 0.2rem 0 0;
}
.homenav a {
  font-weight: 600;
  text-decoration: none;
  padding: 0.45rem 0.2rem;
  border-bottom: 2px solid transparent;
}
.homenav a:hover {
  border-bottom-color: var(--teal);
}
.ceyebrow a {
  color: var(--soft);
  text-decoration: none;
}
.ceyebrow a:hover {
  color: var(--teal);
}

/* --- FOOTER --- */
.sitefoot {
  max-width: 100%;
  margin: 2.6rem 0 0;
  padding: 0.5rem max(0.85rem, env(safe-area-inset-left)) 0.5rem;
  background: var(--teal-dk);
  color: var(--teal-lt);
  font-family: "Open Sans", sans-serif !important;
  font-size: 0.5rem;
  line-height: 1.5;
  text-align: center;
}
.sitefoot .cw {
  margin: 0.15rem 0;
}
.sitefoot .cw {
  color: var(--teal-lt);
}
.sitefoot .cw:first-child {
  color: #fff;
  font-weight: 400;
}
.sitefoot .fine {
  font-size: 0.5rem;
  opacity: 0.85;
}

/* --- CHAPTER STRIP (chapter page) --- */
/* Wraps naturally; 2px scrollbar hairline for very long books (Psalms 150 etc.) */
.ch-strip-wrap {
  border-top: 0.5px solid var(--rule);
  border-bottom: 0.5px solid var(--rule);
  padding: 0.45rem max(1rem, env(safe-area-inset-left));
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}
.ch-strip-wrap::-webkit-scrollbar {
  height: 2px;
}
.ch-strip-wrap::-webkit-scrollbar-track {
  background: transparent;
}
.ch-strip-wrap::-webkit-scrollbar-thumb {
  background: var(--rule);
  border-radius: 1px;
}
.ch-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.cn {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--soft);
  background: var(--pill-bg);
  border: 0.5px solid transparent;
  text-decoration: none;
  font-family: inherit;
}
.cn:hover {
  border-color: var(--teal);
  color: var(--teal);
}
.cn.active {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}

/* --- FONT SIZE CONTROLS (chapter page) --- */
.font-ctrl {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.fc-btn {
  font-size: 0.7rem;
  background: var(--pill-bg);
  border: 0.5px solid var(--rule);
  border-radius: 5px;
  padding: 5px 9px;
  color: var(--soft);
  cursor: pointer;
  font-family: inherit;
}
.fc-btn:hover {
  border-color: var(--teal);
  color: var(--teal);
}
.fc-btn.active {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}

/* --- BREADCRUMB EYEBROW (chapter page) --- */
.eyebrow-tag {
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--teal);
  background: var(--pill-bg);
  border: 0.5px solid var(--teal-lt);
  border-radius: 20px;
  padding: 2px 9px;
  display: inline-block;
  margin-bottom: 5px;
}
.ch-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}
