/* ===============================
   ROOT VARIABLES (Apple Books Vibe)
================================ */
:root {
  --bg-main: #fafafa;
  --bg-card: #ffffff;
  --bg-muted: #f2f2f7;

  --text-main: #1c1c1e;
  --text-secondary: #6e6e73;
  --text-soft: #8e8e93;

  --accent: #ff9f0a;
  --accent-soft: #fff4e5;

  --border-light: rgba(0, 0, 0, 0.08);

  --radius-lg: 18px;
  --radius-md: 12px;

  --font-title: -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui;
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui;

  --line-height: 1.85;
}

/* ===============================
   GLOBAL RESET
================================ */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 17px;
}

/* Disable text selection if needed */
.no-copy {
  user-select: none;
}

/* ===============================
   TOP BAR
================================ */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 250, 250, 0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-light);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.back-btn {
  font-size: 20px;
  text-decoration: none;
  color: var(--text-main);
}

.story-title-wrap {
  flex: 1;
  text-align: center;
}

.story-title {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}

.story-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ===============================
   META INFO
================================ */
.story-meta {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  flex-wrap: wrap;
}

.meta-chip {
  background: var(--bg-muted);
  color: var(--text-secondary);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
}

/* ===============================
   LANGUAGE BUTTONS
================================ */
.lang-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 10px 0 20px;
}

.lang-btn {
  background: var(--bg-muted);
  border: none;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.25s ease;
}

.lang-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

/* ===============================
   STORY CONTAINER
================================ */
.story-container {
  max-width: 720px;
  margin: auto;
  padding: 0 16px 120px;
}

/* ===============================
   STORY SECTION
================================ */
.story-section {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 28px 26px 32px;
  margin-bottom: 22px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
  transition: all 0.3s ease;
}

.story-section:hover {
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.section-title {
  font-family: var(--font-title);
  font-size: 22px;
  margin-bottom: 14px;
}

/* ===============================
   STORY TEXT
================================ */
.story-text {
  font-size: 18px;
  line-height: var(--line-height);
  color: var(--text-main);
  margin-bottom: 12px;
  transition: color 0.25s ease;
}

.story-text.urdu {
  display: none;
  font-size: 19px;
  line-height: 2;
  font-family: "Noto Nastaliq Urdu", serif;
}


/* ===============================
   BOOKMARK ICON
================================ */
.story-marker {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 26px;
  height: 26px;
  opacity: 0.35;
  cursor: pointer;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.story-marker:hover {
  opacity: 1;
  transform: scale(1.1);
}

.story-marker svg {
  width: 100%;
  height: 100%;
  fill: var(--accent);
}

.story-section.marked .story-marker svg {
  fill: var(--accent);
  filter: drop-shadow(0 0 6px rgba(255, 159, 10, 0.5));
}

/* ===============================
   FLOATING BOOKMARK BUTTON
================================ */
#scrollToBookmarkBtn {
  position: fixed;
  right: 18px;
  bottom: 90px;
  background: var(--accent);
  border: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease;
}

#scrollToBookmarkBtn:hover {
  transform: scale(1.1);
}

#scrollToBookmarkBtn svg {
  width: 22px;
  height: 22px;
  stroke: #fff;
}


/* ===============================
   DARK MODE SUPPORT
================================ */
body.dark {
  --bg-main: #000;
  --bg-card: #0b1020;
  --bg-muted: #050e34d6;
  --text-main: #f2f2f7;
  --text-secondary: #aeaeb2;
  --accent-soft: rgba(255, 159, 10, 0.2);
  --accent: #ff9f0a;
  --border-light: rgba(255, 255, 255, 0.08);
}


/* ===============================
   DARK MODE SUPPORT
================================ */
body.dim {
  --bg-main: #0f141c;
  --bg-card: #161e2fea;
  --bg-muted: #141c2d;
  --text-main: #f2f2f7;
  --text-secondary: #aeaeb2;
  --accent-soft: rgba(255, 159, 10, 0.2);
  --accent: #ff9f0a;
  --border-light: rgba(255, 255, 255, 0.08);
}

/* ===============================
   SMOOTH TRANSITIONS
================================ */
body, .story-section, .lang-btn, .story-text, .story-meta, .meta-chip {
  transition: all 0.25s ease;
}




/* ===============================
   AUDIO BAR
================================ */
.audio-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-light);
  padding: 10px 14px;
  z-index: 50;
}

.audio-bar audio {
  width: 100%;
  outline: none;
  border-radius: var(--radius-md);
}

/* ================= AUDIO BAR ================= */
#audioBar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 1rem 1.2rem;

  backdrop-filter: blur(10px);
  border-top-left-radius: 1.5rem;
  border-top-right-radius: 1.5rem;

  background: var(--audio-bg);
  transition: background 0.25s ease;
}

#audioBar audio {
  width: 100%;
  max-width: 640px;
  margin: auto;
}


/* ================= AUDIO BAR ================= */



/* ================= AUDIO PLAYER ================= */

audio {
  width: 100%;
  border-radius: 0.75rem;
  background: transparent;
}

/* DIM MODE → darker professional gray/blue (#0e1520 feel) */
body.dim audio {
  filter:
    invert(0.92)       /* darker base */
    hue-rotate(180deg) /* keep tint natural */
    brightness(0.80)   /* slightly darker */
    contrast(1);       /* maintain clarity */
  opacity: 0.95;       /* subtle polish */
}

/* DARK MODE → deep professional gray/blue (#0e1520 feel) */
body.dark audio {
  filter:
    invert(0.92)       
    hue-rotate(180deg) 
    brightness(0.75)   /* slightly darker than dim mode */
    contrast(1);       
  opacity: 0.95;       
}



/* ================= AUDIO PLAYER ================= */
