body.light {
  --bg: #ffffff;
  --fg: #000000;
}
body.dark {
  --bg: #000000;
  --fg: #ffffff;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin: auto;
  padding: 0;
  background-color: var(--bg);
  color: var(--fg);
  font-family: "EB Garamond", serif;
  transition: all 0.3s ease;
}

body button {
  border-radius: 5px;
  cursor: pointer;
}

body.light {
  background: white;
  color: black;
}
body.light a {
  color: grey;
}
body.light a:hover {
  color: black;
}
body.light button {
  background-color: white;
  color: black;
  border-color: black;
}

body.dark {
  background: black;
  color: white;
}
body.dark a {
  color: grey;
}
body.dark a:hover {
  color: white;
}
body.dark button {
  background-color: black;
  color: white;
  border-color: white;
}
body.dark input {
  background-color: #3e3e3e;
  color: white;
}

/* ── PAGE CONTAINER ── */
.page-container {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  margin: auto;
  width: 90%;
  max-width: 768px;
}

@media screen and (max-width: 600px) {
  .page-container {
    width: 90%;
  }
}

/* ── NAV CONTAINER ── */
.nav-container {
  display: flex;
  position: fixed;
  top: 0;
  width: 100%;
  height: 50px;
  transition: all 0.3s ease;
  z-index: 999;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: white;
  /* FIX 1: symmetric vertical padding so inner elements sit centred */
  padding: 6px 10px;
  box-shadow: 0 4px 4px -2px rgba(0, 0, 0, 0.1);
}
body.dark .nav-container {
  background-color: black;
  box-shadow: 0 4px 4px -2px rgba(255, 255, 255, 0.5);
}

.mobile-nav {
  display: none;
}

.desktop-nav {
  width: 60%;
}

@media (max-width: 1200px) {
  .desktop-nav {
    width: 90%;
  }
}

/* ── NAV OPEN STATE ── */
.nav-container.nav-open {
  height: 140px; /* Expanded Height */
}

@media (max-width: 767px) {
  .desktop-nav {
    display: none;
  }
  /* FIX 2: mobile nav sits inside the fixed bar, stacked vertically */
  .mobile-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
  }
}

#nav-form-mobile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px; /* Adjust this for the vertical spacing you want */
  width: 100%;
}

.nav-container.nav-open #nav-open-panel {
  display: flex;
}

/* ── FADE IN ANIMATION ── */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Target children of the panel ONLY when the nav is open */
.nav-container.nav-open #nav-open-panel > * {
  opacity: 0; /* Start invisible */
  animation: fadeInUp 0.4s ease forwards;
}

/* ── STAGGERED DELAY ── */
/* This makes the form appear first, then the buttons second */
.nav-container.nav-open #nav-open-panel > *:nth-child(1) {
  animation-delay: 0.1s;
}

.nav-container.nav-open #nav-open-panel > *:nth-child(2) {
  animation-delay: 0.2s;
}

.nav-container.nav-open #nav-open-panel > *:nth-child(3) {
  animation-delay: 0.3s;
}

/* ── NAV CONTROLS (form) ── */
.nav-controls {
  display: flex;
  justify-content: center;
  /* FIX 1: align-items center so all children (inputs, buttons) share baseline */
  align-items: center;
  flex-direction: row;
  margin: 0 5px;
}
@media (max-width: 767px) {
  .nav-controls {
    flex-direction: row; /* keep fields + buttons on one row on mobile too */
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    margin: 4px 0;
  }
}

/* ── NAV FIELDS ── */
.nav-fields {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: row;
  width: 60%;
}

@media (max-width: 767px) {
  .nav-fields {
    width: auto;
    margin: 0;
  }
}

/* ── NAV FIELD (Book / Chapter / Verse) ── */
.nav-field {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: row;
  margin: 0 6px;
  width: 30%;
}
.nav-field input {
  margin: 2px;
  min-width: 23px;
  width: 25%;
}
@media (max-width: 767px) {
  .nav-field {
    width: auto;
    margin: 0 4px;
  }
}

/* ── BUTTONS CONTAINER ── */
.buttons-container {
  width: auto;
  display: flex;
  flex-direction: row;
  align-items: center;
}
.buttons-container button {
  margin: 0 6px;
}

.nav-closed-buttons-container,
.nav-open-buttons-container {
  width: auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 20px; /* This applies to both rows and columns */
}

.nav-open-buttons-container {
  margin-top: 15px;
}

/* ── INDIVIDUAL BUTTONS ── */
.btn-submit,
.btn-home,
.btn-theme {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 12px;
  font-size: inherit;
  font-family: inherit;
  font-weight: inherit;
  cursor: pointer;
  border: 1px solid black;
  border-radius: 5px;
  line-height: 1;
}

.btn-home,
.btn-theme {
  font-size: 1rem;
}

body.dark .btn-submit,
body.dark .btn-home,
body.dark .btn-theme {
  border-color: white;
}

.btn-submit:hover {
  background-color: #f0f0f0;
  color: black;
}
.btn-home:hover {
  background-color: lightgrey;
  color: black;
}
.btn-theme:hover {
  background-color: black;
  color: white;
}
body.dark .btn-theme:hover {
  background-color: white;
  color: black;
}

.btn-nav-toggle {
  /* 1. Reset & Layout */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  border: none;
  transition: all 0.3s ease;
  position: absolute;
  right: 25px;
  top: 50%;
  transform: translateY(-50%);
  /* 2. Shape and Size */
  width: 20px; /* Slightly smaller for better mobile fit */
  height: 20px;
  border-radius: 50%;
  z-index: 9999 !important; /* Higher than everything else */
  position: absolute;
}

/* Point the arrow UP by default */
.btn-nav-toggle svg {
  transition: transform 0.3s ease;
  transform: rotate(0deg);
}

/* Flip it DOWN when open */
.btn-nav-toggle.is-open svg {
  transform: rotate(180deg);
}

.nav-container.nav-open .btn-nav-toggle {
  top: auto;
  bottom: 20px; /* Spacing from the bottom edge */
  transform: translateY(0); /* Reset the vertical centering transform */
}

.btn-nav-toggle svg {
  width: 18px;
  height: 18px;
  transition: fill 0.3s ease;
}

body.light .btn-nav-toggle {
  background-color: #000000; /* Black background */
}
body.light .btn-nav-toggle svg {
  fill: #ffffff; /* White icon */
}

body.dark .btn-nav-toggle {
  background-color: #ffffff; /* White background */
}
body.dark .btn-nav-toggle svg {
  fill: #000000; /* Black icon */
}

/* 6. Interaction */
.btn-nav-toggle:hover {
  opacity: 0.8;
  /* transform: scale(1.05); */
}

/* ── MOBILE COLLAPSED ROW (always visible on mobile) ── */
.mobile-nav-collapsed {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 38px;
}

/* ── MOBILE EXPANDED PANEL ── */
.mobile-nav-expanded {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 4px 0 2px;
}
.mobile-nav-expanded.open {
  display: flex;
}

/* ── CONTENT CONTAINER ── */
.content-container {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  margin: auto;
  width: 100%;
  margin-top: 110px;
  transition: all 0.3s ease;
}
@media (max-width: 767px) {
  .content-container {
    width: 90%;
    margin-top: 60px;
  }
  .content-container.nav-open {
    margin-top: 140px;
  }
}

/* ── PAGE HEADING ── */
.book-title {
  width: 100%;
  font-size: 2.5rem;
  text-align: center;
  margin: 10px 0;
  font-weight: 600;
}

/* ── BOOK CONTENT ── */
.book-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 80%;
}
@media (max-width: 767px) {
  .book-content {
    width: 100%;
  }
}

/* ── CHAPTER HEADING ── */
.chapter-heading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  font-weight: 600; 
}
/* .chapter-heading.chapter-start { margin: 0.6rem auto 0; } */

.chapter-heading::before {
  content: "꧁ ";
  position: relative;
  top: -0.61rem;
  right: 0.2rem;
  font-size: 1rem;
}
.chapter-heading::after {
  content: " ꧂";
  position: relative;
  top: -0.59rem;
  left: 0.2rem;
  font-size: 1rem;
}
@media (max-width: 767px) {
  .chapter-heading::before {
    top: -0.2rem;
  }
  .chapter-heading::after {
    top: -0.2rem;
  }
}

/* ── VERSE ── */
.verse {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin-bottom: 10px;
  padding: 0 20px 20px;
  border-bottom: 2px solid gray;
  font-size: 1.2rem;
  width: 100%;
}

.verse.highlighted-verse {
  animation: highlight-verse 3s ease-in-out 1;
}
@keyframes highlight-verse {
  0% {
    background-color: rgba(0, 0, 0, 0);
  }
  50% {
    background-color: rgba(255, 226, 61, 0.6);
  }
  100% {
    background-color: rgba(0, 0, 0, 0);
  }
}

.verse p.v-num {
  position: relative;
  cursor: pointer;
}
.verse p.v-num:hover {
  text-decoration: underline;
}

.verse p.sans {
  font-family: "Tiro Devanagari Sanskrit", serif;
  font-weight: 400;
  font-style: normal;
  text-align: center;
  margin: 10px 0;
}

.verse p.trans {
  font-size: 1.2rem;
  text-align: justify;
}

.verse p.trans.ai::before {
  content: "AI: ";
  /* font-style: italic; */
  color: grey;
}

body.dark span.highlighted-text {
  color: black;
}

/* ── BOTTOM NAV ── */
.bottom-nav {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  width: 80%;
  padding-bottom: 10px;
  margin: 10px;
}
@media (max-width: 767px) {
  .bottom-nav {
    width: 100%;
  }
}
@media (min-width: 768px) and (max-width: 1023px) {
  .bottom-nav {
    width: 60%;
  }
}
@media (min-width: 1024px) {
  .bottom-nav {
    width: 60%;
  }
}

.bottom-nav button {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  color: inherit;
}
.bottom-nav button h3 {
  font-size: 1.1em;
  margin: 5px 0;
  padding: 3px 3px 0 3px;
}
.bottom-nav button h3:hover {
  color: #3d3c3c;
}

/* ── BOOKMARK ICON ── */
.bookmark-icon-wrap {
  position: absolute;
  top: -20px;
  right: -35px;
  padding: 5px;
}
.bookmark-icon {
  font-size: 1rem;
  color: #222;
  cursor: pointer;
}
.bookmark-icon:hover {
  color: #666;
}

/* ── SCROLL TO TOP BUTTON ── */
.btn-scroll-top {
  position: fixed;
  bottom: 80px;
  right: 20px;
  z-index: 1000;

  width: 45px;
  height: 45px;
  border-radius: 8px; /* Square with rounded corners */
  border: 1px solid transparent;

  /* 3. Centering the Icon/Content */
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;

  /* 4. Hidden by default (Logic) */
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
}

.btn-scroll-top svg {
  width: 24px;
  height: 24px;
  /* This ensures the SVG takes the color of the button text */
  fill: currentColor;
}

/* 5. Class to be toggled via JS when user scrolls */
.btn-scroll-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* 6. Theme Colors */
body.light .btn-scroll-top {
  background-color: #000000;
  color: #ffffff;
}

body.dark .btn-scroll-top {
  background-color: #ffffff;
  color: #000000;
}

/* 7. Hover States */
.btn-scroll-top:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
