/* Kigest Landing Page — Matches app theme */
:root {
  --tint: #710aa4;
  --tint-dark: #5a0883;
  --tint-light: #f3e8fa;
  --bg: #ffffff;
  --text: #11181C;
  --text-secondary: #687076;
  --card-bg: #f8f8fa;
  --card-border: #eee;
  --amber: #FF9500;
  --nav-bg: rgba(255, 255, 255, 0.92);
  --bubble-bg: rgba(255, 255, 255, 0.6);
  --cta-gradient-from: var(--tint-light);
  --cta-gradient-to: #f0e0ff;
  --max-width: 1100px;
  --radius: 16px;
  --radius-card: 20px;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-rounded: 'SF Pro Rounded', 'Hiragino Maru Gothic ProN', var(--font-sans);
}

@media (prefers-color-scheme: dark) {
  :root {
    --tint: #ba2fff;
    --tint-dark: #9a1fdf;
    --tint-light: #2a1540;
    --bg: #151718;
    --text: #ECEDEE;
    --text-secondary: #9BA1A6;
    --card-bg: #1e2022;
    --card-border: #2c2e30;
    --nav-bg: rgba(21, 23, 24, 0.92);
    --bubble-bg: rgba(255, 255, 255, 0.12);
    --cta-gradient-from: #1f1528;
    --cta-gradient-to: #251a35;
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--tint); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; }

/* ── Navigation ─────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--card-border);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 700;
  color: var(--tint);
  font-family: var(--font-rounded);
}

.nav-logo img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
  list-style: none;
}

.nav-links a {
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-links a:hover { color: var(--tint); text-decoration: none; }

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 20px;
  background: var(--tint-light);
  color: var(--tint);
  font-size: 13px;
  font-weight: 600;
  transition: background 0.2s;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
}

.lang-switch:hover { text-decoration: none; }

/* ── Language Dropdown ─────────────────────── */
.lang-dropdown {
  position: relative;
}

.lang-menu {
  display: none;
  position: absolute;
  z-index: 250;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  max-height: 360px;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  padding: 6px;
  list-style: none;
}

@media (prefers-color-scheme: dark) {
  .lang-menu {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  }
}

.lang-menu-open {
  display: block;
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-sans);
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s;
  text-align: left;
}

.lang-option:hover {
  background: var(--card-bg);
}

.lang-option-active {
  background: var(--tint-light);
  color: var(--tint);
  font-weight: 600;
}

.lang-option-active:hover {
  background: var(--tint-light);
}

/* RTL: flip dropdown to open from the left */
[dir="rtl"] .lang-menu {
  right: auto;
  left: 0;
}

[dir="rtl"] .lang-option {
  text-align: right;
}

/* ── Hamburger Button ────────────────────────── */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: background 0.2s;
}

.hamburger:hover {
  background: var(--card-bg);
}

.hamburger-line {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.hamburger-open .hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger-open .hamburger-line:nth-child(2) {
  opacity: 0;
}

.hamburger-open .hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ── Mobile Menu ─────────────────────────────── */
.mobile-menu {
  display: none;
  overflow: hidden;
  border-top: 1px solid var(--card-border);
}

.mobile-menu-open {
  overflow-y: auto;
}

.mobile-menu-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 8px 24px 16px;
}

.mobile-nav-item {
  display: block;
  padding: 14px 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s;
}

.mobile-nav-item:hover {
  color: var(--tint);
  text-decoration: none;
}

.mobile-menu-divider {
  height: 1px;
  background: var(--card-border);
  margin: 4px 0;
}

.mobile-menu-section-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 0 8px;
}

.mobile-lang-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  max-height: 280px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0;
}

.mobile-lang-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-sans);
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s;
  text-align: left;
  min-height: 44px;
}

.mobile-lang-item:hover {
  background: var(--card-bg);
}

.mobile-lang-active {
  background: var(--tint-light);
  color: var(--tint);
  font-weight: 600;
}

.mobile-lang-active:hover {
  background: var(--tint-light);
}

/* Show hamburger, hide nav-links on mobile */
@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }

  .nav-links {
    display: none;
  }

  .mobile-menu {
    display: block;
    max-height: 0;
    transition: max-height 0.35s ease;
  }

  .mobile-menu-open {
    max-height: calc(100vh - 60px);
  }
}

/* RTL support for mobile menu */
[dir="rtl"] .mobile-nav-item {
  text-align: right;
}

[dir="rtl"] .mobile-lang-item {
  flex-direction: row-reverse;
  text-align: right;
}

[dir="rtl"] .mobile-menu-section-label {
  text-align: right;
}

/* ── Hero ───────────────────────────────────── */
.hero {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 80px 24px 60px;
  text-align: center;
}

.hero-emojis {
  font-size: 48px;
  margin-bottom: 24px;
  line-height: 1.4;
}

.hero h1 {
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 800;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 16px;
}

.hero h1 .accent { color: var(--tint); }

.hero-subtitle {
  font-size: clamp(16px, 2.5vw, 20px);
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 40px;
}

.cta-row {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 100px;
  font-size: 16px;
  font-weight: 600;
  transition: transform 0.15s, box-shadow 0.15s;
  cursor: pointer;
  border: none;
}

.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.12); text-decoration: none; }

.btn-primary {
  background: var(--tint);
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--tint);
  border: 2px solid var(--tint);
}

.btn-icon { font-size: 20px; }

/* ── Store Badges ───────────────────────────── */
.store-badges {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  align-items: center;
}

.store-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px 10px 16px;
  border-radius: 12px;
  background: #000;
  color: #fff;
  font-size: 14px;
  transition: transform 0.15s, opacity 0.15s;
  text-decoration: none;
  cursor: default;
  opacity: 0.7;
}

.store-badge:hover { transform: translateY(-2px); text-decoration: none; }

.store-badge-icon { font-size: 28px; line-height: 1; }

.store-badge-text { display: flex; flex-direction: column; text-align: left; }
.store-badge-label { font-size: 10px; opacity: 0.8; line-height: 1; }
.store-badge-store { font-size: 17px; font-weight: 600; line-height: 1.2; }

@media (prefers-color-scheme: dark) {
  .store-badge { background: #2c2e30; }
}

.coming-soon {
  display: block;
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 12px;
  font-style: italic;
}

/* ── How It Works ───────────────────────────── */
.section, .how-it-works, .features {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 80px 24px;
}

.section-title {
  text-align: center;
  font-size: clamp(24px, 3.5vw, 36px);
  font-weight: 700;
  margin-bottom: 12px;
}

.section-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 17px;
  margin-bottom: 48px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 32px;
}

.step {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  border: 1px solid var(--card-border);
  transition: transform 0.2s, box-shadow 0.2s;
}

.step:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,0.06); }

.step-emoji { font-size: 48px; margin-bottom: 16px; display: block; }
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--tint);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
}

.step h3 { font-size: 19px; font-weight: 600; margin-bottom: 8px; }
.step p { color: var(--text-secondary); font-size: 15px; }

/* ── Highlights / Key Differentiators ────── */
.highlights-section {
  padding: 80px 24px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.highlights-grid {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.highlight-card {
  flex: 1;
  min-width: 260px;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 36px 28px;
  border: 1px solid var(--card-border);
  border-left: 4px solid var(--tint);
  transition: transform 0.2s, box-shadow 0.2s;
}

.highlight-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
}

@media (prefers-color-scheme: dark) {
  .highlight-card:hover {
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  }
}

.highlight-icon {
  display: block;
  font-size: 48px;
  margin-bottom: 16px;
  line-height: 1.2;
}

.highlight-card h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.highlight-card p {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.65;
}

@media (max-width: 768px) {
  .highlights-section {
    padding: 48px 20px;
  }

  .highlights-grid {
    flex-direction: column;
  }

  .highlight-card {
    min-width: 0;
  }
}

/* ── Deep Dive / About Section ────────────── */
.deep-dive-content {
  max-width: 720px;
  margin: 0 auto;
}

.deep-dive-block {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 32px;
}

.deep-dive-block:last-child {
  margin-bottom: 0;
}

.deep-dive-icon {
  font-size: 32px;
  flex-shrink: 0;
  line-height: 1.6;
}

.deep-dive-block p {
  font-size: 17px;
  line-height: 1.8;
  color: var(--text);
}

@media (max-width: 768px) {
  .deep-dive-block {
    gap: 14px;
  }
  .deep-dive-icon {
    font-size: 24px;
  }
  .deep-dive-block p {
    font-size: 15px;
    line-height: 1.7;
  }
}

/* ── Features ───────────────────────────────── */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
}

.feature {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px;
  border-radius: var(--radius);
  transition: background 0.2s;
}

.feature:hover { background: var(--card-bg); }

.feature-icon {
  font-size: 32px;
  flex-shrink: 0;
  line-height: 1;
}

.feature h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.feature p { color: var(--text-secondary); font-size: 14px; }

/* ── Feature Card (landing page grid items) ── */
.feature-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

@media (prefers-color-scheme: dark) {
  .feature-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  }
}

.feature-card .feature-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.feature-card h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 6px;
}

.feature-card p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

/* ── Privacy Section ─────────────────────────── */
.privacy-section {
  padding: 64px 24px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.privacy-section .section-title {
  text-align: center;
}

.privacy-section .section-subtitle {
  text-align: center;
  margin-bottom: 32px;
}

/* ── Skip Link (accessibility) ───────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  background: var(--tint);
  color: #fff;
  padding: 8px 16px;
  border-radius: 8px;
  z-index: 1000;
  font-size: 14px;
  text-decoration: none;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 12px;
}

/* ── Browse CTA ─────────────────────────────── */
.browse-cta {
  text-align: center;
  background: linear-gradient(135deg, var(--cta-gradient-from) 0%, var(--cta-gradient-to) 100%);
  border-radius: var(--radius);
  padding: 48px 24px;
}

.browse-cta h2 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 12px;
}

.browse-cta p {
  color: var(--text-secondary);
  margin-bottom: 24px;
  font-size: 16px;
}

/* ── Footer ─────────────────────────────────── */
.footer {
  border-top: 1px solid var(--card-border);
  padding: 40px 24px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.footer-links {
  display: flex;
  gap: 24px;
  justify-content: center;
  list-style: none;
  margin-bottom: 16px;
}

.footer-links a { color: var(--text-secondary); }
.footer-links a:hover { color: var(--tint); }

/* ── Filter Bar ─────────────────────────────── */
.filter-bar {
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.filter-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 10px 16px;
}

.filter-search-icon { font-size: 16px; opacity: 0.5; }

.filter-search-field {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  outline: none;
  font-family: var(--font-sans);
}

.filter-search-field::placeholder { color: var(--text-secondary); }

.filter-search-clear {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.filter-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 8px 16px;
  border-radius: 20px;
  background: var(--card-bg);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  font-family: var(--font-sans);
  border: 1px solid var(--card-border);
}

.filter-chip:hover { background: var(--tint-light); }

.filter-chip.active {
  background: var(--tint);
  color: #fff;
  border-color: var(--tint);
}

.language-select {
  padding: 8px 32px 8px 12px;
  border-radius: 20px;
  background: var(--card-bg);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-sans);
  border: 1px solid var(--card-border);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' fill='none' stroke='%23888' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.language-select:hover { border-color: var(--tint); }
.language-select:focus { outline: 2px solid var(--tint); outline-offset: -1px; }

.filter-clear {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--card-border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-sans);
}

.filter-clear:hover { border-color: var(--text-secondary); }

/* Loading / empty states */
#loading-spinner {
  display: none;
  text-align: center;
  padding: 32px;
  color: var(--text-secondary);
  font-size: 14px;
}

.spinner-dot {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--card-border);
  border-top-color: var(--tint);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.no-results {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
  font-size: 16px;
  grid-column: 1 / -1;
}

/* ── Reading Progress Bar ──────────────────── */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 150;
  background: transparent;
  pointer-events: none;
}

.reading-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--amber);
  border-radius: 0 1.5px 1.5px 0;
  transition: width 0.1s ease-out;
}

/* ── Bottom CTA Bar ────────────────────────── */
.bottom-cta {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: linear-gradient(135deg, #710aa4 0%, #9b2fd4 100%);
  border-top: none;
  padding: 14px 24px;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  box-shadow: 0 -4px 20px rgba(113, 10, 164, 0.25);
}

@media (prefers-color-scheme: dark) {
  .bottom-cta {
    background: linear-gradient(135deg, #4a0873 0%, #7a1fbf 100%);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
  }
}

.bottom-cta-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.bottom-cta-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
}

.bottom-cta-text {
  flex: 1;
  min-width: 0;
}

.bottom-cta-text strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.bottom-cta-download {
  display: block;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
}

.bottom-cta-badges {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.bottom-cta-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
}

.bottom-cta-dismiss {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  line-height: 1;
  flex-shrink: 0;
}

.bottom-cta-dismiss:hover { color: #fff; }

/* ── Story Layout (desktop sidebar) ────────── */
.story-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.story-ad-inline { margin: 32px 0; }

/* ── Story Pages (rendered by Cloud Function) ─ */
.story-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 24px 120px;
}

.story-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  color: var(--text-secondary);
  font-size: 14px;
}

.story-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.story-content {
  font-size: 18px;
  line-height: 1.8;
  white-space: pre-line;
}

.story-content h2 {
  font-size: 22px;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 12px;
}

.chapter-separator {
  border: none;
  border-top: 1px solid var(--card-border);
  margin: 32px 0;
}

.story-ad {
  margin: 40px 0;
  padding: 24px;
  background: var(--card-bg);
  border-radius: var(--radius);
  text-align: center;
  border: 1px solid var(--card-border);
}

.story-ad-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.app-cta {
  margin-top: 48px;
  text-align: center;
  padding: 40px 24px;
  background: linear-gradient(135deg, var(--cta-gradient-from) 0%, var(--cta-gradient-to) 100%);
  border-radius: var(--radius);
}

.app-cta h3 { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.app-cta p { color: var(--text-secondary); margin-bottom: 20px; }

/* ── Story List Page — App-matching card style ─ */
.story-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
  gap: 16px;
}

.story-card {
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: var(--radius-card);
  padding: 12px;
  transition: transform 0.2s, box-shadow 0.2s;
  color: var(--text);
  border: none;
  /* background set inline via pastel hsl */
}

.story-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
  text-decoration: none;
}

.story-card-bubble {
  width: 65px;
  height: 100px;
  min-width: 65px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bubble-bg);
  padding: 5px;
}

.story-card-emoji {
  font-size: 20px;
  text-align: center;
  line-height: 1.4;
}

.story-card-body {
  flex: 1;
  min-width: 0;
}

.story-card-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.story-card-meta {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.story-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* ── 404 ────────────────────────────────────── */
.not-found {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 120px 24px;
  text-align: center;
}

.not-found h1 { font-size: 64px; margin-bottom: 16px; }
.not-found p { color: var(--text-secondary); font-size: 18px; margin-bottom: 32px; }

/* ── Desktop Sidebar ───────────────────────── */
@media (min-width: 1025px) {
  .story-layout {
    display: flex;
    gap: 32px;
    align-items: flex-start;
  }

  .story-layout .story-page {
    flex: 1;
    max-width: 720px;
    margin: 0;
    padding-left: 0;
    padding-right: 0;
  }

  .story-sidebar {
    width: 300px;
    flex-shrink: 0;
    position: sticky;
    top: 80px;
    padding-top: 40px;
  }
}

@media (max-width: 1024px) {
  .story-sidebar { display: none; }
  .story-layout { padding: 0; }
}

/* ── Sidebar CTA Card ────────────────────────── */
.sidebar-cta {
  margin-top: 24px;
  padding: 24px 20px;
  background: linear-gradient(135deg, var(--cta-gradient-from) 0%, var(--cta-gradient-to) 100%);
  border-radius: var(--radius);
  text-align: center;
  border: 1px solid var(--card-border);
}

.sidebar-cta-icon {
  border-radius: 12px;
  margin-bottom: 12px;
}

.sidebar-cta-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.sidebar-cta-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
}

.sidebar-cta .store-badges {
  flex-direction: column;
  gap: 8px;
}

.sidebar-cta .store-badge {
  width: 100%;
  justify-content: center;
  font-size: 13px;
  padding: 8px 16px 8px 12px;
}

.sidebar-cta .coming-soon {
  margin-top: 8px;
  font-size: 12px;
}

/* ── Responsive ─────────────────────────────── */
@media (max-width: 768px) {
  .hero { padding: 48px 20px 40px; }
  .hero-emojis { font-size: 36px; }
  .section { padding: 48px 20px; }
  .steps { grid-template-columns: 1fr; }
  .story-grid { grid-template-columns: 1fr; }
  .footer-links { flex-wrap: wrap; gap: 16px; }
}

@media (max-width: 480px) {
  .nav-inner { padding: 10px 16px; }
  .nav-logo { font-size: 18px; }
  .nav-logo img { width: 28px; height: 28px; }
  .store-badges { flex-direction: column; align-items: center; }
  .bottom-cta-badges { display: none; }
  .bottom-cta-download { display: block; }
  .mobile-menu-inner { padding: 8px 16px 16px; }
  .mobile-lang-list { grid-template-columns: 1fr; }
}

/* ── Accessibility ─────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.sr-only:focus-visible { position: static; width: auto; height: auto; padding: 8px 16px; margin: 0; overflow: visible; clip: auto; white-space: normal; background: var(--tint); color: #fff; text-decoration: none; z-index: 9999; }
:focus-visible { outline: 2px solid var(--tint); outline-offset: 2px; }

/* ── RTL Support (Arabic) ─────────────────── */
[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

[dir="rtl"] .nav-inner {
  flex-direction: row-reverse;
}

[dir="rtl"] .nav-links {
  flex-direction: row-reverse;
}

[dir="rtl"] .nav-logo {
  flex-direction: row-reverse;
}

[dir="rtl"] .story-card {
  flex-direction: row-reverse;
}

[dir="rtl"] .story-card-meta {
  flex-direction: row-reverse;
}

[dir="rtl"] .story-meta {
  flex-direction: row-reverse;
}

[dir="rtl"] .feature {
  flex-direction: row-reverse;
  text-align: right;
}

[dir="rtl"] .deep-dive-block {
  flex-direction: row-reverse;
}

[dir="rtl"] .store-badge {
  flex-direction: row-reverse;
}

[dir="rtl"] .store-badge-text {
  text-align: right;
}

[dir="rtl"] .bottom-cta-inner {
  flex-direction: row-reverse;
}

[dir="rtl"] .filter-bar {
  direction: rtl;
}

[dir="rtl"] .filter-chips {
  flex-direction: row-reverse;
}

[dir="rtl"] .filter-search {
  flex-direction: row-reverse;
}

[dir="rtl"] .language-select {
  background-position: left 12px center;
  padding: 8px 12px 8px 32px;
}

[dir="rtl"] .reading-progress-fill {
  border-radius: 1.5px 0 0 1.5px;
  float: right;
}

[dir="rtl"] .highlight-card {
  border-left: 1px solid var(--card-border);
  border-right: 4px solid var(--tint);
}

[dir="rtl"] .highlights-grid {
  flex-direction: row-reverse;
}

[dir="rtl"] .bottom-cta-badges {
  flex-direction: row-reverse;
}
