@import url('https://fonts.googleapis.com/css2?family=Libre+Baskerville&display=swap');

:root {
  --page-width: 980px;   /* adjust to match your screenshot */
  --topbar-h: 56px;  /* height of your sticky top bar */
}

.page {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 0 28px;       /* inner gutters */
}


body {
  font-family: Arial, sans-serif;
  margin: 0px;
  background: #FCFCFC;
  color: #312706;
}
h1:not(#chapter-title) { text-align: center; margin: 12px 0 16px; }

/* Ensure text over white backgrounds in index.html & books.html uses same color */
.lang-form label,
.lang-form button,
.book-list,
.book-list a,
.accordion,
.acc-button,
.acc-panel,
.chapter-list a {
  color: #312706;
}

.lang-form select {
  color: #312706;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between; /* title left, auth right */
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--banner);
  color: #FCFCFC;
  padding: .6rem 1rem;
  border-bottom: none;
  flex-wrap: wrap;
  gap: 1rem; /* keep room between title and auth on wide screens */

}

.lang-form {
  display: flex;
  flex-direction: row; /* side by side instead of column */
  gap: 1rem;           /* space between dropdowns */
  align-items: flex-start;
  justify-content: center; /* center in the page */
  max-width: 800px;
  margin: 0 auto;
}

.lang-form label {
  display: flex;
  flex-direction: column; /* keep label text above the select */
  gap: 6px;
  font-weight: bold;
}
.lang-form button { padding:8px 14px; cursor:pointer; }
.book-list h2 { margin: 16px 0 8px; border-bottom: 1px solid #ddd; padding-bottom: 4px; }
.book-list ul { list-style:none; padding-left:0; display:flex; flex-wrap:wrap; gap:8px 16px; }
.book-list li a { text-decoration:none; border:1px solid #ccc; padding:6px 10px; border-radius:8px; }

.controls {
  display: flex;
  align-items: center;
  justify-content: flex-end; /* move buttons to the right */
  gap: 12px;
  max-width: 100%;
  margin: 12px 0 8px;        /* add space so they don't merge with the green bar */
}

.controls .langs { display:flex; gap:8px; }
.badge { border:1px solid #ccc; padding:4px 8px; border-radius:999px; font-size:12px; }
@media (max-width: 800px) {
  td { display:block; width:100%; }
  tr { display:block; margin-bottom: 10px; }

}

/* Parent wrappers for each side */
.side-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  height: 50%;        /* hover target spans middle half of screen */
  width: 120px;       /* wide enough to include the revealed button */
  z-index: 999;
  pointer-events: none; /* Let clicks pass through the empty space to the text */
}
.side-nav.left  { left: 0; }
.side-nav.right { right: 0; }

/* Invisible “hot zone” area inside each side (near the edge) */
.side-nav .edge-zone {
  position: absolute;
  top: 25%;
  height: 50%;        /* center vertically */
  width: 30px;        /* narrower width so it doesn't cover text */
  pointer-events: auto; /* Re-enable clicking just for this thin strip */
}

/* Fix: Ensure the hot zone hugs the correct screen edge */
.side-nav.left .edge-zone  { left: 0; right: auto; }
.side-nav.right .edge-zone { left: auto; right: 0; }

/* Buttons: off-screen & transparent by default */
.prev-button, .next-button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);          /* base Y centering */
  background: #fff;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  z-index: 1000;
  opacity: 0;                            /* hidden */
  pointer-events: auto;                  
  transition: transform .35s ease, opacity .2s ease;
  will-change: transform, opacity;
  backface-visibility: hidden;
}

/* Set final on-screen anchor positions */
.side-nav.left  .prev-button { left: 10px;  }
.side-nav.right .next-button { right: 10px; }

/* Start fully off-screen using X translation (smooth, no reflow) */
.side-nav.left  .prev-button { transform: translateY(-50%) translateX(-40%); }
.side-nav.right .next-button { transform: translateY(-50%) translateX(40%);  }

/* Reveal when hovering anywhere on the side (edge OR button) */
.side-nav:hover .prev-button,
.side-nav:hover .next-button {
  transform: translateY(-50%) translateX(0);
  opacity: 1;
  pointer-events: auto;
}

/* Motion accessibility */
@media (prefers-reduced-motion: reduce) {
  .prev-button, .next-button { transition: none; }
}



/* Scripture display heading */
#chapter-title {
  font-family: "Merriweather", Georgia, serif;
  font-weight: 400;         /* not bold */
  line-height: 1.3;
  text-align: center;
  margin: 0;
}

#chapter-title .book-name {
  font-size: clamp(1.6rem, 2.5vw + 0.5rem, 2.3rem);
  font-variant: normal;     /* normal case */
  text-transform: capitalize; /* only first letter uppercase */
}

#chapter-title .chapter-name {
  font-size: clamp(1.3rem, 2vw + 0.3rem, 1.9rem);
  font-variant: normal;
  text-transform: capitalize;
  margin-top: 0.25rem;
}


/* Treat subtitle + intro like normal verses */
.meta-row {
  background: transparent !important;
  border-radius: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
}

/* Hide the labels completely */
.meta-row .meta-label {
  display: none !important;
}

/* Inherit typography from verses */
.meta-row .meta-text {
  all: unset;              /* reset custom styles */
  display: block;          /* ensure proper flow */
  white-space: normal;     /* wrap like normal text */
}

.verse-row {
  display: flex;
}

.verse-col {
  flex: 1;
  padding: 0 1rem; /* spacing so text doesn’t touch the divider */
}

/* Verses container holds the single vertical divider */
#verse-container{
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 1;  /* sits below the title; above the divider */
}
#verse-container { margin-top: 0px; }

#verse-container::before{
  content:"";
  position:absolute;
  top:0;                 /* starts at top of verses area, not the header */
  bottom:0;              /* full height of verses only */
  left:50%;
  transform:translateX(-0.5px);
  width:1px;
  background:#d6d6d6;
  z-index:0;             /* behind all verse content */
  pointer-events:none;
}

/* Ensure rows render above the divider */
.verse-row { position: relative; z-index: 1; }

/* Column spacing */
.verse-col { 
  font-family: "Libre Baskerville", Georgia, serif; /* your serif */
  font-size: 18px;                                  /* back to readable */
  line-height: 1.6;
  text-align: justify;
  text-justify: inter-word;
  padding: 0 1.25rem;
}

/* Optional: meta rows a bit tighter */
.meta-row .verse-col { padding: 0.75rem 1.25rem; }

/* Mobile: when columns stack, hide the divider */
/* Mobile: keep two columns; allow horizontal scroll; hide center line */
@media (max-width: 900px){
  #verse-container { overflow-x: auto; }    /* horizontal scroll area */
  #verse-container::before { display: none; } /* no vertical divider on mobile */

  .verse-row{
    flex-direction: row;     /* keep side-by-side */
    flex-wrap: nowrap;       /* never wrap under each other */
    min-width: 640px;        /* enough width to fit both columns */
  }
  .verse-col{
    min-width: 50%;          /* each column takes half of the row */
    padding: 0 .75rem;       /* a bit tighter padding on mobile */
  }
}

/* Title inside topbar (no sticky/pseudo layers) */
#chapter-title {
  margin: 0;
  color: #FCFCFC;
  font-family: "Merriweather", Georgia, serif;
  font-weight: 400;
  line-height: 1.3;
  flex: 1 1 auto; /* allow the title to grow but not crush the auth nav */

}
#chapter-title .book-name,
#chapter-title .chapter-name,
#chapter-title .chapter-sep {
  font-size: clamp(1.4rem, 2vw + .6rem, 2.1rem);
  font-variant: normal;
  text-transform: none;
}

/* Accordion for books.html */
.accordion {
  max-width: 760px;
  margin: 0 auto;
}

.acc-item {
  border: 1px solid var(--border, #ddd);
  border-radius: 12px;
  margin: 10px 0;
  overflow: hidden;
  background: var(--surface, #fff);
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

.acc-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 1.05rem;
  font-weight: 600;
  text-align: left;
}

.acc-button:hover {
  background: rgba(0,0,0,.03);
}

.acc-chevron::before {
  content: "▾"; /* simple caret; no external icon dependency */
  display: inline-block;
  transition: transform .18s ease;
}

.acc-item.open .acc-chevron::before {
  transform: rotate(180deg);
}

.acc-panel {
  display: none;
  padding: 8px 14px 14px;
}

.acc-item.open > .acc-panel {
  display: block;
}

/* inner list of books */
.books-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* chapters list */
.chapter-list {
  list-style: none;
  margin: 6px 0 4px;
  padding: 0 6px;
  columns: 2;              /* compact look; drop if you prefer one column */
  column-gap: 24px;
}

.chapter-list li {
  break-inside: avoid;
  margin: 4px 0;
}

.chapter-list a {
  text-decoration: none;
  font-weight: 500;
}

.chapter-list a:hover {
  text-decoration: underline;
}
/* ---------- View toggle ---------- */
.view-toggle { display:flex; gap:8px; align-items:center; }
.vt-btn {
  padding: 6px 10px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid #bfc6b6;
  background: #FCFCFC;
  color: #312706;
  cursor: pointer;
}
.vt-btn.is-active {
  background: #879375;
  color: #FFFFFF;
  border-color: #879375;
}

/* ---------- Single-view layout ---------- */
body.single-view #verse-container { gap: 8px; }
body.single-view #verse-container::before { display: none; } /* hide divider */
body.single-view .verse-row { display: none; }                /* hide parallel rows */

/* Verse item for single-view */
.verse-item {
  border-radius: 10px;
  background: transparent;
  padding: 10px 12px;
  transition: background-color .15s ease;
  cursor: pointer;
}
.verse-item:hover { background: rgba(0,0,0,0.035); }

.verse-item .v-main {
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 18px;
  line-height: 1.6;
  text-align: justify;
  text-justify: inter-word;
}

/* Hidden translation block */
.verse-item .v-second {
  display: none;
  margin-top: 10px;
  padding: 12px;
  border-radius: 10px;
  background: #FFFFFF; /* pure white background */
  box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 0 0 1px rgba(0,0,0,.04);
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 16px;           /* main is 18px; keep this a bit smaller */
  line-height: 1.6;
  text-align: justify;
  text-justify: inter-word;
  color: #312706;  
}
.verse-item .v-second * { font-family: inherit; color: inherit; }

/* Expanded state */
.verse-item.open .v-second { display: block; }
.verse-item[aria-expanded="true"] { background: rgba(0,0,0,0.02); }

/* Language selection page layout */
.lang-form {
  display: flex;            /* stack row + button */
  flex-direction: column;
  align-items: center;      /* center the whole form */
  gap: 1.5rem;              /* space between the selects row and the button */
  margin-top: 2rem;         /* space below the green title bar */
}

/* row that holds the two selects side-by-side, centered */
.lang-row {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 2rem;                /* space between the two label+select groups */
}

/* make each label render its text above the select, centered */
.lang-form label {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-weight: bold;
}

/* optional: on small screens, stack the selects vertically */
@media (max-width: 640px) {
  .lang-row { flex-direction: column; }
}

/* Back arrow button (white arrow over green bar) */
.back-button {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  z-index: 11;
}

.back-button svg {
  display: block;
}

.back-button:hover,
.back-button:focus {
  opacity: 0.8;
}


/* === THEME VARIABLES (Appended) ========================================= */
:root {
  /* Light theme (default) */
  --bg: #FCFCFC;
  --fg: #312706;
  --banner: #879375;      /* light banner */
  --surface: #FFFFFF;
  --border: #dddddd;
  --muted: rgba(0,0,0,0.04);
  --btn-border: #bfc6b6;

  --btn-bg: #FCFCFC;
  --btn-fg: #312706;
  --btn-active-bg: #879375;
  --btn-active-fg: #FFFFFF;
  --divider: #d6d6d6;
}
:root.theme-dark {
  --bg: #000000;          /* pure black background */
  --fg: #FCFCFC;          /* text */
  --banner: #312706;      /* requested dark banner */
  --surface: #0f0f0f;
  --border: #333333;
  --muted: rgba(255,255,255,0.06);

  --btn-bg: #111111;
  --btn-fg: #FCFCFC;
  --btn-active-bg: #4a461e;
  --btn-active-fg: #FCFCFC;
  --divider: #3a3a3a;
}

/* Base colors driven by variables */
body { background: var(--bg); color: var(--fg); }
.lang-form label, .lang-form button, .book-list, .book-list a, .accordion, .acc-button, .chapter-list a { color: var(--fg); }
.lang-form select { color: var(--fg); }
#verse-container::before { background: var(--divider); }
.verse-col { color: var(--fg); }

/* Panels/cards adopt themed surface */
.acc-item { border:1px solid var(--border); background: var(--surface); box-shadow: 0 1px 2px var(--muted); }
.verse-item .v-second { background: var(--surface); box-shadow: 0 1px 2px var(--muted), 0 0 0 1px var(--muted); color: var(--fg); }
.verse-item:hover { background: var(--muted); }

/* Controls row: view toggle left, theme toggle right */
.controls { justify-content: space-between !important; }
.controls:has(.theme-toggle):not(:has(.view-toggle)) { justify-content: flex-end !important; }

/* View toggle buttons (IDs exist in chapter.html) */
.vt-btn {
  padding: 6px 10px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-fg);
  cursor: pointer;
}
.vt-btn.is-active {
  background: var(--btn-active-bg);
  color: var(--btn-active-fg);
  border-color: var(--btn-active-bg);
}

/* Primary buttons adopt theme */
.lang-form button {
  background: var(--btn-active-bg);
  color: var(--btn-active-fg);
  border: 1px solid var(--btn-active-bg);
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
}

/* Nav buttons surface */
.prev-button, .next-button { background: var(--surface); box-shadow: 0 2px 6px rgba(0,0,0,0.3); }

/* === THEME TOGGLE ======================================================== */
.theme-toggle { display:inline-flex; align-items:center; gap:8px; }
.theme-toggle button {
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-fg);
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 600;
  cursor: pointer;
}
.theme-toggle button[aria-pressed="true"] {
  background: var(--btn-active-bg);
  color: var(--btn-active-fg);
  border-color: var(--btn-active-bg);
}

/* Force selects and their option lists to always be readable */
.lang-form select,
.lang-form select option {
  background-color: #FFFFFF !important;
  color: #000000 !important;
}

/* consistent login/signup bar */
.topbar h1 { margin:0; font-size:clamp(1.2rem,2vw+0.5rem,1.8rem); color:#FCFCFC; }
.auth-nav {
  display:flex;
  align-items:center;
  gap:.5rem;
  font-size:.95rem;
  white-space:nowrap;
  flex: 0 0 auto; /* never shrink to zero: keeps Login/Signup visible on wide screens */
}
.auth-nav a {
  color:#FCFCFC;
  text-decoration:none;
  padding:.125rem .25rem;
  border-radius:6px;
}
.auth-nav a:hover,
.auth-nav a:focus { text-decoration:underline; }
.auth-nav .sep { opacity:.6; }
.auth-nav .user-pill {
  padding:.2rem .5rem;
  border-radius:999px;
  background:rgba(255,255,255,.2);
  color:#FCFCFC;
  font-size:.85em;
}
@media (max-width: 640px){
  .topbar { justify-content:center; }
  .auth-nav { width:100%; justify-content:center; margin-top:.5rem; }
}

/* ===== Account icon + popup ===== */
.account-btn{
  appearance:none; border:0; background:transparent; color:#FCFCFC;
  display:inline-flex; align-items:center; justify-content:center;
  padding:.35rem; border-radius:999px; cursor:pointer; flex:0 0 auto;
}
.account-btn:hover, .account-btn:focus{ background: rgba(255,255,255,.14); outline:none; }
.account-menu{
  position:absolute; right:12px; top:calc(100% + 8px);
  min-width: 200px;
  background: var(--surface); color: var(--fg);
  border:1px solid var(--border); border-radius:12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  padding:6px; z-index: 30;
}
.account-menu .menu-header{
  font-weight:600; padding:8px 10px; border-bottom:1px solid var(--border); margin-bottom:6px;
}
.account-menu a{
  display:block; padding:8px 10px; border-radius:8px; color:inherit; text-decoration:none;
}
.account-menu a:hover{ background: var(--muted); }

/* ================= TRANSLATE POPUP ===================================== */
#translate-popup {
  position: absolute;
  display: none;
  z-index: 2000;
  padding: 6px 12px;
  border-radius: 6px;
  font-family: sans-serif;
  font-size: 14px;
  font-weight: 400; /* Normal weight for reading text */
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  max-width: 300px;  /* Prevent it from getting too wide */
  line-height: 1.4;
  
  /* Theming support */
  background-color: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border);
  transition: opacity 0.2s, background-color 0.2s;
}

#translate-popup:hover {
  /* Removed the hover effect because now it contains text to read, not just a button */
  background-color: var(--surface); 
  border-color: var(--btn-active-bg);
}

/* Style for the translated text result */
#translate-popup .t-result { margin-bottom: 6px; display: block; }
#translate-popup .t-link { font-size: 0.85em; color: var(--banner); text-decoration: underline; }
