/* ==========================================================================
   Tanakh 100 - Stylesheet
   Modern, Sacred, Multilingual & Fully Responsive
   ========================================================================== */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Georgia", "Merriweather", "Palatino Linotype", serif;
  --font-hebrew: "SBL Hebrew", "David Libre", "Times New Roman", serif;
  --font-arabic: "Amiri", "Traditional Arabic", "Scheherazade New", serif;

  /* Colors - Light Mode Default */
  --bg-body: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --border-color: #e2e8f0;
  --border-subtle: #cbd5e1;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-hebrew: #1e293b;

  --accent-gold: #b48a1c;
  --accent-gold-light: #fef9c3;
  --accent-gold-hover: #936e13;
  --accent-gold-rgb: 180, 138, 28;

  --navy-dark: #0a192f;
  --navy-mid: #1e293b;
  --navy-light: #334155;

  --badge-torah-bg: #eff6ff;
  --badge-torah-text: #1d4ed8;
  --badge-neviim-bg: #fdf2f8;
  --badge-neviim-text: #be185d;
  --badge-ketuvim-bg: #f0fdf4;
  --badge-ketuvim-text: #15803d;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --container-max: 1200px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-body: #0a0f1d;
  --bg-surface: #111827;
  --bg-surface-elevated: #1e293b;
  --bg-card: #141e33;
  --bg-subtle: #1f293d;
  --border-color: #243048;
  --border-subtle: #334155;

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-hebrew: #fef08a;

  --accent-gold: #eab308;
  --accent-gold-light: rgba(234, 179, 8, 0.15);
  --accent-gold-hover: #facc15;
  --accent-gold-rgb: 234, 179, 8;

  --navy-dark: #050b14;
  --navy-mid: #0b1329;
  --navy-light: #162444;

  --badge-torah-bg: rgba(59, 130, 246, 0.15);
  --badge-torah-text: #60a5fa;
  --badge-neviim-bg: rgba(236, 72, 153, 0.15);
  --badge-neviim-text: #f472b6;
  --badge-ketuvim-bg: rgba(34, 197, 94, 0.15);
  --badge-ketuvim-text: #4ade80;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

/* RTL Support */
[dir="rtl"] {
  direction: rtl;
  text-align: right;
}
[dir="rtl"] .hebrew-text {
  direction: rtl;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
}

a {
  color: var(--accent-gold);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--accent-gold-hover);
}

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

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

/* Header & Navbar */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
  gap: 1rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--text-primary);
}

.brand-logo .logo-menorah {
  width: 32px;
  height: 32px;
  color: var(--accent-gold);
  fill: currentColor;
}

.brand-badge {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: var(--accent-gold-light);
  color: var(--accent-gold);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  margin-left: 0.4rem;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Language Dropdown Selector */
.lang-select-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.lang-select {
  appearance: none;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}

.lang-select:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 3px rgba(var(--accent-gold-rgb), 0.2);
}

.lang-select-icon {
  position: absolute;
  right: 0.75rem;
  pointer-events: none;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Theme Toggle Button */
.btn-icon {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

/* Hero Section */
.hero-section {
  position: relative;
  background: linear-gradient(135deg, #0b1329 0%, #172554 50%, #1e1b4b 100%);
  color: #ffffff;
  padding: 4.5rem 0 3.5rem;
  text-align: center;
  overflow: hidden;
}

.hero-pattern {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: radial-gradient(rgba(212, 175, 55, 0.12) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.7;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 820px;
  margin: 0 auto;
}

.hero-eyebrow {
  display: inline-block;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: #fde047;
  font-weight: 700;
  margin-bottom: 0.85rem;
  padding: 0.3rem 0.85rem;
  background: rgba(253, 224, 71, 0.12);
  border: 1px solid rgba(253, 224, 71, 0.3);
  border-radius: var(--radius-full);
}

.hero-title {
  font-family: var(--font-serif);
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1.25rem;
  color: #f8fafc;
}

.hero-title span {
  background: linear-gradient(90deg, #facc15, #fef08a, #ca8a04);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.15rem;
  color: #cbd5e1;
  line-height: 1.6;
  margin-bottom: 2rem;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-number {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 700;
  color: #facc15;
}

.stat-label {
  font-size: 0.85rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Daily Verse Featured Card */
.daily-verse-wrapper {
  margin-top: -2rem;
  position: relative;
  z-index: 10;
  margin-bottom: 2.5rem;
}

.daily-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-top: 4px solid var(--accent-gold);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-xl);
}

.daily-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-gold);
  margin-bottom: 1rem;
}

.daily-quote {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  line-height: 1.6;
  color: var(--text-primary);
  margin-bottom: 1rem;
  font-style: italic;
}

.hebrew-banner {
  font-family: var(--font-hebrew);
  font-size: 1.6rem;
  line-height: 1.5;
  color: var(--text-hebrew);
  direction: rtl;
  margin-bottom: 0.75rem;
  font-weight: 500;
}

.daily-translit {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  font-style: normal;
}

.daily-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
}

.daily-actions {
  display: flex;
  gap: 0.5rem;
}

/* Ad Unit Containers */
.ad-slot-wrapper {
  margin: 2rem auto;
  text-align: center;
  width: 100%;
  max-width: 970px;
}

.ad-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.ad-container {
  background: var(--bg-subtle);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0.5rem;
}

/* Search and Filters */
.controls-section {
  padding: 1.5rem 0 2rem;
  position: sticky;
  top: 70px;
  z-index: 50;
  background: var(--bg-body);
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition);
}

.search-box {
  position: relative;
  margin-bottom: 1rem;
}

.search-input {
  width: 100%;
  padding: 0.85rem 1.25rem 0.85rem 3rem;
  font-size: 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  outline: none;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.search-input:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 3px rgba(var(--accent-gold-rgb), 0.2);
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.1rem;
}

.filter-pills {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.4rem;
  scrollbar-width: thin;
}

.pill-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.45rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition);
}

.pill-btn:hover {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.pill-btn.active {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: #ffffff;
}

/* Verses Grid */
.verses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0 3.5rem;
}

.verse-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
}

.verse-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-gold);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.section-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

.badge-torah { background: var(--badge-torah-bg); color: var(--badge-torah-text); }
.badge-neviim { background: var(--badge-neviim-bg); color: var(--badge-neviim-text); }
.badge-ketuvim { background: var(--badge-ketuvim-bg); color: var(--badge-ketuvim-text); }

.verse-ref {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-muted);
}

.card-hebrew {
  font-family: var(--font-hebrew);
  font-size: 1.35rem;
  line-height: 1.5;
  color: var(--text-hebrew);
  direction: rtl;
  margin-bottom: 0.5rem;
}

.card-translit {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 0.85rem;
}

.card-translation {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  flex-grow: 1;
}

.card-theme-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-subtle);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  padding-top: 0.85rem;
  margin-top: auto;
}

.btn-read-more {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.btn-read-more:hover {
  text-decoration: underline;
}

/* Detail Article View */
.article-header {
  padding: 3rem 0 2rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 2rem;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.article-title {
  font-family: var(--font-serif);
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.article-hebrew-hero {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-right: 4px solid var(--accent-gold);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  margin: 1.5rem 0;
  direction: rtl;
  text-align: right;
}

.article-hebrew-text {
  font-family: var(--font-hebrew);
  font-size: 2rem;
  line-height: 1.6;
  color: var(--text-hebrew);
  font-weight: 600;
}

.article-translit {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  direction: ltr;
  text-align: left;
  font-style: italic;
}

/* 10-Language Grid / Tabs */
.translation-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin: 2rem 0;
  box-shadow: var(--shadow-sm);
}

.trans-tabs-nav {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
  margin-bottom: 1.25rem;
}

.trans-tab-btn {
  background: transparent;
  border: none;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.trans-tab-btn.active {
  background: var(--accent-gold);
  color: #ffffff;
}

.trans-display-text {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  line-height: 1.7;
  color: var(--text-primary);
}

/* Three Main Editorial Sections */
.article-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--accent-gold);
  padding-bottom: 0.5rem;
}

.section-body {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text-secondary);
}

.section-body p {
  margin-bottom: 1rem;
}

.section-body p:last-child {
  margin-bottom: 0;
}

/* Nav Pager (Previous / Next) */
.verse-pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 3rem 0;
}

.btn-pager {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-weight: 700;
  transition: var(--transition);
}

.btn-pager:hover {
  background: var(--accent-gold);
  color: #ffffff;
  border-color: var(--accent-gold);
}

/* Consent Banner & Modal */
.consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-xl);
  display: none;
}

.consent-banner.show {
  display: block;
}

.consent-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.consent-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  max-width: 780px;
}

.consent-buttons {
  display: flex;
  gap: 0.75rem;
}

.btn-primary {
  background: var(--accent-gold);
  color: #ffffff;
  border: none;
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary:hover {
  background: var(--accent-gold-hover);
}

.btn-secondary {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

/* Footer */
.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  padding: 3.5rem 0 2rem;
  margin-top: auto;
  color: var(--text-secondary);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: 2.5rem;
  margin-bottom: 2.5rem;
}

.footer-col h4 {
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 1rem;
  font-family: var(--font-serif);
}

.footer-col ul {
  list-style: none;
}

.footer-col li {
  margin-bottom: 0.5rem;
}

.footer-col a {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-col a:hover {
  color: var(--accent-gold);
}

.footer-bottom {
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Responsive Breakpoints */
@media (max-width: 900px) {
  .hero-title { font-size: 2.15rem; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .controls-section { top: 60px; }
}

@media (max-width: 640px) {
  .navbar { height: 60px; }
  .brand-logo { font-size: 1.1rem; }
  .hero-title { font-size: 1.75rem; }
  .hero-subtitle { font-size: 1rem; }
  .verses-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .article-title { font-size: 1.75rem; }
  .article-hebrew-text { font-size: 1.5rem; }
  .article-section { padding: 1.25rem; }
  .consent-inner { flex-direction: column; align-items: flex-start; }
}
