/* ============================================================
   BHAGAVAD GITA PAGE — STYLESHEET
   Matches Sanskrit Alphabet app look & feel.
   Breakpoints: 800 | 560 | 420 | 320
   ============================================================ */

/* ── Fonts ── */
@font-face {
  font-family: 'Raja';
  src: url('../fonts/Raja.woff') format('woff');
  font-weight: normal;
  font-style: normal;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }

/* ── Body ── */
body {
  font-family: 'Georgia', 'Times New Roman', serif;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  background: #eef5fc;
}

/* ── Page wrapper ── */
div#wrapper {
  width: 100%;
  max-width: 1000px;
}

/* ── H1 ── */
h1#book-name{
  text-align: center;
  font-size: 40px;
  font-weight: bold;
  color: var(--primary-blue);
  margin-bottom: 0;
  padding: 0;
  text-transform: uppercase;
}

/* ============================================================
   MAIN CONTAINER
   ============================================================ */
#main-container {
  width: 100%;
  background: var(--interface-bg);
  border: 5px solid var(--border-gold);
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* ============================================================
   TOP TITLE  — clamp: 20px (320px screen) → 30px (fullscreen)
   ============================================================ */
#top-title {
  text-align: center;
  color: var(--primary-blue);
  font-size: clamp(20px, 4vw, 30px);
  /* font-weight: bold; */
  padding: 10px 0 6px;
  /* border-bottom: 1px solid rgba(0, 0, 204, 0.15); */
}

/* ============================================================
   SIDE PILLARS
   ============================================================ */
.btn-side {
  position: absolute;
  top: 0;
  height: 100%;
  width: var(--pillar);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #40C4FF;
  user-select: none;
  background: rgba(255, 255, 255, 0.1);
  z-index: 10;
}

/* Left pillar — split into STOP (top) and RESET (bottom) */
#left-pillar {
  left: 0;
  border-right: 1px solid rgba(0, 0, 0, 0.05);
  flex-direction: column;
  justify-content: stretch;
  padding: 0;
}

#play-pause-btn {
  right: 0;
  border-left: 1px solid rgba(0, 0, 0, 0.05);
}

/* ── btn-half: each occupies exactly half the pillar height ── */
.btn-half {
  display: flex;
  flex: 1;
  width: 100%;
  cursor: pointer;
  overflow: hidden;            /* clips hover background to its own half */
  transition: background 0.15s;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.btn-half:first-child {
  /* STOP: label pushed toward border from above */
  justify-content: flex-end;
  padding-bottom: 20px;
  border-bottom: 3px solid #40C4FF;
}

.btn-half:last-child {
  /* RESET: label pushed toward border from below */
  justify-content: flex-start;
  padding-top: 20px;
}

/* Hover: background only, font color unchanged, clipped to this half */
.btn-half:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* PLAY/PAUSE full-pillar hover — background only */
#play-pause-btn:hover {
  background: radial-gradient(circle at center,
    rgba(255, 255, 255, 0.45) 0%,
    rgba(255, 255, 255, 0)    75%);
}

/* Disable full-pillar hover for left-pillar — btn-half handles it */
#left-pillar:hover { background: none; }

.label-strip {
  width: 1ch;
  word-wrap: break-word;
  text-align: center;
  font-size: clamp(14px, 2.8vw, 32px);
  font-weight: bold;
  line-height: 1.7;
}

/* Fullscreen button inside play pillar */
#fs-wrapper {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 7%;
  z-index: 1000;
}

#play-pause-btn:has(#fs-wrapper:hover) {
  background: rgba(255, 255, 255, 0.1);
  color: #40C4FF;
}

#fullscreen-toggle {
  position: absolute;
  bottom: 0;
  width: 100%;
  background: none;
  border: none;
  color: #40C4FF;
  cursor: pointer;
  padding: 0;
  z-index: 20;
}

#fullscreen-toggle:hover { color: #0000cc; }
#fullscreen-toggle svg   { width: 80%; height: 80%; }

/* ============================================================
   CONTROLS ROW  — identical styling to alphabet app
   ============================================================ */
.controls {
  display: flex;
  justify-content: center;
  margin-left:  var(--pillar);
  margin-right: var(--pillar);
  padding: 4px 0 6px;
/*   border-bottom: 1px solid rgba(0, 0, 204, 0.1); */
}

.control-row {
  display: flex;
  justify-content: space-around;
  align-items: center;
  width: 100%;
  gap: 8px;
}

.control-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 0;
  align-self: flex-start;
}

.control-group select {
  font-size: clamp(13px, 2vw, 18px);
  padding: 4px 4px;
  /* width: clamp(46px, 8vw, 72px); */
  /* height: clamp(28px, 4vw, 38px); */
  border: 1px solid #0044CC;
  border-radius: 4px;
  background-color: #ffffff;
  color: #0044CC;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.16);
  outline: none;
  transition: all 0.2s ease;
  text-align: center;
  width: clamp(40px, 10vw, 72px);
  height: clamp(22px, 5vw, 30px);
  font-size: clamp(12px, 2.8vw, 16px);
}

.control-group select:hover { background-color: #f0f4ff; }

.control-label {
  margin-top: 4px;
  font-size: clamp(9px, 1.5vw, 13px);
  font-weight: bold;
  color: var(--primary-blue);
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;
}

/* ============================================================
   GITA CONTENT AREA
   ============================================================ */
#gita-content {
  margin-left:  var(--pillar);
  margin-right: var(--pillar);
  padding: 8px 12px 6px;
  background: rgba(255, 255, 255, 0.55);
  user-select: none;
  -webkit-user-select: none;
}

/* ── Verse block ── */
.verse {
  /* padding: 4px 0 2px; */
  padding: 10px 0;
}

.verse + .verse {
  /* border-top: 1px solid rgba(0, 0, 204, 0.1); */
  margin-top: 5px;
}

/* ── Half-line row ──
   gap: 0 so selected backgrounds form one unbroken green stripe.
   Spacing comes from padding inside .word instead.
   ── */
.line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0;
  line-height: 1;
}
.line.book-head {
    justify-content: center;
}

.line + .line { margin-top: 1px; }

/* ── Word base ── */
/* .word {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  white-space: nowrap;
  padding: 0 5px;
  border-radius: 0;
  transition: background-color 0.08s ease;
  position: relative;  
} */
/* .word {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  white-space: nowrap;
  padding: 0 5px;
  border-radius: 0;
  transition: background-color 0.08s ease;
  position: relative;

  touch-action: none;
  -webkit-tap-highlight-color: transparent;
} */
/* ===From Gemini ====== */
/* ── Word base ── */
.word {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  white-space: nowrap;
  padding: 0 5px;
  border-radius: 0;
  transition: background-color 0.08s ease;
  position: relative;

  touch-action: none;
  -webkit-tap-highlight-color: transparent;

  /* Multi-platform text selection elimination for pristine long-presses */
  -webkit-touch-callout: none; /* iOS Safari */
  -webkit-user-select: none;   /* Safari */
  -khtml-user-select: none;    /* Konqueror HTML */
  -moz-user-select: none;      /* Old Firefox */
  -ms-user-select: none;       /* Internet Explorer/Edge */
  user-select: none;           /* Modern Chrome, Edge, Opera, and Firefox */
}
/* =END==From Gemini ====== */
/* === From chatGPT ===== */
/* ============================================================
   MOBILE POINTER/TAP FIXES
   ============================================================ */

/* .word {
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
} */

/* Prevent accidental page scrolling during drag-selection */
.gita-page {
  touch-action: pan-y;
}
/* === From chatGPT END ===== */

/* ── Devanagari (font="D") ── */
.word.devanagari {
  font-family: 'Raja', serif;
  font-size: clamp(26px, 4.5vw, 50px);
  line-height: 1.2;
  color: var(--primary-blue);
}

/* ── Roman (font="R") ── */
.word.roman {
  font-family: 'Georgia', serif;
  font-size: clamp(13px, 2vw, 20px);
  line-height: 1.6;
  color: #2a4a6a;
  font-style: italic;
}

/* ── No-sound words ── */
.word.no-sound {
  cursor: default;
  /* opacity: 0.6; */
}

/* ── Selected range → colorB (#C4FF00) ── */
.word.selected-range {
  background-color: var(--colorB);
}

/* ── Active / playing → colorA (#FCC225) ── */
.word.active {
  background-color: var(--colorA) !important;
}

/* ── Verse number ── */
.verse-number {
  display: block;
  text-align: right;
  font-family: 'Raja', serif;
  font-size: clamp(14px, 2vw, 22px);
  color: #7a6a4a;
  line-height: 1.2;
  padding-right: 4px;
}

/* ============================================================
   FOOTER
   ============================================================ */
#app-footer {
  margin-left:  var(--pillar);
  margin-right: var(--pillar);
  margin-top: 6px;
  margin-bottom: 8px;
  text-align: center;
  font-size: clamp(10px, 1.6vw, 13px);
  color: var(--primary-blue);
  opacity: 0.7;
  border-top: 1px solid rgba(0, 0, 204, 0.1);
  line-height: 1.6;
}

#app-footer a { color: var(--primary-blue); }

/* ============================================================
   FULLSCREEN
   ============================================================ */
#fullscreen-wrapper:fullscreen {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f0f8ff;
  width: 100vw;
  height: 100vh;
}

#fullscreen-wrapper:fullscreen #main-container {
  width: 100%;
  max-width: 1000px;
  border: 5px solid var(--border-gold);
  background: var(--interface-bg);
  position: relative;
  max-height: 100vh;
  box-sizing: border-box;
  overflow-y: auto;
}


#fullscreen-wrapper::backdrop { background-color: #f0f8ff; }

/* ============================================================
   RESPONSIVE — 800px
   ============================================================ */
@media (max-width: 800px) {
  :root { --pillar: 44px; }
  h1 { font-size: 32px; }
  .label-strip { font-size: clamp(13px, 2.5vw, 26px); line-height: 1.7; }
}

/* ============================================================
   RESPONSIVE — 560px
   ============================================================ */
@media (max-width: 560px) {
  :root { --pillar: 32px; }
  h1 { font-size: 26px; }
  .label-strip { font-size: clamp(11px, 3vw, 20px); line-height: 1.7; }
  #gita-content { padding: 6px 8px 4px; }
  .word { padding: 0 3px; }
  .control-label { white-space: normal; }
}

/* ============================================================
   RESPONSIVE — 420px
   ============================================================ */
@media (max-width: 420px) {
  :root { --pillar: 26px; }
  h1 { font-size: 22px; }
  .label-strip { font-size: clamp(10px, 3.5vw, 17px); line-height: 1.7; }
  #gita-content { padding: 4px 4px 4px; }
  .word { padding: 0 2px; }
  .word.devanagari { font-size: clamp(20px, 6vw, 34px); }
  .word.roman      { font-size: clamp(11px, 3vw, 15px); }
  .verse-number    { font-size: clamp(12px, 3.5vw, 18px); }
  .control-row     { gap: 4px; }
  .control-group select { padding: 2px; }
  .control-label   { white-space: normal; }
}

/* ============================================================
   RESPONSIVE — 320px
   ============================================================ */
@media (max-width: 320px) {
  :root { --pillar: 20px; }
  h1 { font-size: 18px; }
  #top-title { font-size: 20px; }
  .label-strip { font-size: clamp(9px, 3.5vw, 14px); line-height: 1.7; }
  #gita-content { padding: 3px 3px 3px; }
  .word { padding: 0 1px; }
  .word.devanagari { font-size: clamp(16px, 7vw, 26px); }
  .word.roman      { font-size: clamp(10px, 3.5vw, 13px); }
  .verse-number    { font-size: clamp(11px, 4vw, 15px); }
  .control-group select { padding: 1px 2px; }
}

/* ============================================================
   PAGE NAVIGATOR  — compact, sits between #top-title and .controls
   ============================================================ */
#page-nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
  justify-content: center;
  align-items: center;
  margin-left:  var(--pillar);
  margin-right: var(--pillar);
  padding: 4px 0;
  /* border-bottom: 1px solid rgba(0, 0, 204, 0.1); */
  margin-bottom: 10px;
}

#pageSelect {
  padding: 4px 6px;
  border: 1px solid #0044CC;
  border-radius: 4px;
  background-color: #ffffff;
  color: #0044CC;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
  outline: none;
  max-width: 220px;
  width: auto;
  height: clamp(25px, 5vw, 30px);
  font-size: clamp(13px, 1.6vw, 16px);
}

div#page-note {
  font-size: clamp(9px, 1.5vw, 13px);
  font-weight: bold;
  color: var(--primary-blue);
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;
}

#pageSelect:hover { background-color: #f0f4ff; }

/* ============================================================
   GITA PAGES — show/hide
   ============================================================ */
.gita-page {
  display: none;
  margin-left:  var(--pillar);
  margin-right: var(--pillar);
  padding: 8px 12px 6px;
  background: rgba(255, 255, 255, 0.55);
  user-select: none;
  -webkit-user-select: none;
}

.gita-page.active-page {
  display: block;
}

/* ============================================================
   ROMAN HINT — hover tooltip above each Devanagari word
   ============================================================ */
.roman-hint {
  display: none;
  position: absolute;
  bottom: 80%;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Georgia', serif;
  font-size: clamp(10px, 1.4vw, 14px);
  /* font-style: italic; */
  color: var(--primary-blue);
  background: rgba(217, 233, 249, 0.97);
  border: 1px solid rgba(0, 0, 204, 0.2);
  padding: 1px 6px;
  border-radius: 3px;
  white-space: nowrap;
  z-index: 200;
  pointer-events: none;
  /* line-height: 1.4; */
  letter-spacing: 0.05em;
}

/* Desktop: pure CSS hover */
/* .word:hover .roman-hint                     { display: block; } */
/* Desktop only hover hints */
/* @media (hover: hover) and (pointer: fine) {
  .word:hover .roman-hint {
    display: block;
  }
} */
/* ============================================================
   DESKTOP ONLY HOVER HINTS
   ============================================================ */

html.desktop .word:hover .roman-hint {
  display: block;
}

/* Double-click / double-tap: pinned hint stays visible until toggled off */
.word.hint-pinned .roman-hint               { display: block; }

/* Don't show hint on no-sound words unless they are verse-num */
.word.no-sound:not(.verse-num) .roman-hint  { display: none !important; }

/* ── roman-off: hide all hints globally ── */
.roman-off .roman-hint                      { display: none !important; }
.roman-off .word.hint-pinned .roman-hint    { display: none !important; }

/* ── Verse number word — not selectable, not highlightable ── */
.word.verse-num {
  cursor: default;
  margin-left: 0.4rem;
}

.word.verse-num.selected-range,
.word.verse-num.active {
  background-color: transparent !important;
}
