/* ============================================================
   THE ENDURANCE MANUAL — Website Styles
   Byzantine aesthetic: near-black, gold/amber, mosaic texture
   Light/dark mode with toggle
   ============================================================ */

/* --- CSS Variables: Dark Mode (default) --- */
:root {
  --bg-deep:       #0A0908;
  --bg-surface:    #131110;
  --bg-card:       #1A1714;
  --bg-card-hover: #221F1A;
  --gold:          #D4A642;
  --gold-light:    #E0BA60;
  --gold-dim:      #B08A2E;
  --amber:         #D4852A;
  --fire:          #C24A1A;
  --cream:         #F0E6D0;
  --cream-dim:     #D4C4A4;
  --text-primary:  #EDE4D4;
  --text-secondary:#C4B698;
  --text-muted:    #8A7D68;
  --border:        #2A2520;
  --border-gold:   rgba(212,166,66,0.25);
  --glow-gold:     rgba(212,166,66,0.15);
  --glow-amber:    rgba(212,133,42,0.12);
  --nav-bg:        rgba(10,9,8,0.92);
  --nav-mobile-bg: rgba(10,9,8,0.98);
  --cover-shadow:  rgba(0,0,0,0.6);
  --cover-glow:    rgba(212,166,66,0.08);
  --btn-primary-text: var(--bg-deep);

  --font-display:  'Cinzel', 'Palatino Linotype', serif;
  --font-body:     'Cormorant Garamond', 'Palatino Linotype', Georgia, serif;
  --font-ui:       'Cinzel', serif;

  --max-width:     1200px;
  --nav-height:    72px;
}

/* --- CSS Variables: Light Mode --- */
[data-theme="light"] {
  --bg-deep:       #F5F0E8;
  --bg-surface:    #EDE7DC;
  --bg-card:       #FFFFFF;
  --bg-card-hover: #FAF7F2;
  --gold:          #8B6914;
  --gold-light:    #A07A1A;
  --gold-dim:      #9E7A20;
  --cream:         #2C2418;
  --cream-dim:     #4A3D2C;
  --text-primary:  #1A1714;
  --text-secondary:#5C4E3A;
  --text-muted:    #8A7D6B;
  --border:        #D6CEBC;
  --border-gold:   rgba(139,105,20,0.25);
  --glow-gold:     rgba(139,105,20,0.08);
  --glow-amber:    rgba(176,115,30,0.06);
  --nav-bg:        rgba(245,240,232,0.92);
  --nav-mobile-bg: rgba(245,240,232,0.98);
  --cover-shadow:  rgba(0,0,0,0.15);
  --cover-glow:    rgba(139,105,20,0.06);
  --btn-primary-text: #FFFDF8;
}

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

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

body {
  font-family: var(--font-body);
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background 0.4s ease, color 0.4s ease;
}

/* Subtle ambient glow overlay */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background-image:
    radial-gradient(circle at 20% 50%, var(--glow-gold) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, var(--glow-amber) 0%, transparent 40%);
  pointer-events: none;
  z-index: 0;
}

a {
  color: var(--gold);
  text-decoration: none;
  transition: color 0.3s ease;
}
a:hover {
  color: var(--gold-light);
}

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

/* --- Navigation --- */
.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.4s ease, border-color 0.4s ease;
}

.nav-inner {
  width: 100%;
  max-width: var(--max-width);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-links {
  display: flex;
  gap: 2.5rem;
  list-style: none;
}

.nav-links a {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-secondary);
  transition: color 0.3s ease;
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--gold);
  transition: width 0.3s ease;
}

.nav-links a:hover {
  color: var(--gold);
}

.nav-links a:hover::after {
  width: 100%;
}

.nav-links a.active {
  color: var(--gold);
}

/* Theme toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.theme-toggle:hover {
  border-color: var(--gold);
  background: var(--border-gold);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  transition: transform 0.3s ease;
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  stroke: var(--text-secondary);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle:hover .icon-sun,
.theme-toggle:hover .icon-moon {
  stroke: var(--gold);
}

/* Show/hide icons based on theme */
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }

[data-theme="light"] .theme-toggle .icon-sun  { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--gold);
  margin: 5px 0;
  transition: all 0.3s ease;
}

/* --- Hero Section --- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--nav-height) + 3rem) 2rem 4rem;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background:
    radial-gradient(ellipse at 30% 40%, var(--glow-gold) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 80%, var(--glow-amber) 0%, transparent 50%);
  z-index: 0;
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: var(--max-width);
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}

.hero-cover {
  position: relative;
  display: flex;
  justify-content: center;
}

.hero-cover img {
  max-height: 620px;
  width: auto;
  border-radius: 4px;
  box-shadow:
    0 4px 30px var(--cover-shadow),
    0 0 60px var(--cover-glow),
    0 0 120px var(--cover-glow);
  transition: box-shadow 0.4s ease;
}

/* Subtle glow behind the cover */
.hero-cover::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 80%; height: 80%;
  background: radial-gradient(circle, var(--glow-gold) 0%, transparent 70%);
  filter: blur(40px);
  z-index: -1;
}

.hero-text {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.hero-subtitle-top {
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold-dim);
}

.hero-title {
  font-family: var(--font-display);
  font-size: 2.8rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--gold);
}

[data-theme="dark"] .hero-title,
:root:not([data-theme]) .hero-title {
  text-shadow: 0 0 40px rgba(212,166,66,0.15);
}

.hero-tagline {
  font-family: var(--font-body);
  font-size: 1.25rem;
  font-style: italic;
  color: var(--cream-dim);
  line-height: 1.5;
}

.hero-scripture {
  font-family: var(--font-body);
  font-size: 1.05rem;
  color: var(--text-secondary);
  border-left: 2px solid var(--gold-dim);
  padding-left: 1.25rem;
  font-style: italic;
  line-height: 1.6;
  transition: border-color 0.4s ease;
}

.hero-scripture .ref {
  display: block;
  margin-top: 0.4rem;
  font-style: normal;
  font-size: 0.85rem;
  color: var(--gold-dim);
  letter-spacing: 0.05em;
}

.hero-actions {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0.9rem 2rem;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--gold);
  color: var(--btn-primary-text);
}

[data-theme="dark"] .btn-primary,
:root:not([data-theme]) .btn-primary {
  box-shadow: 0 0 20px rgba(212,166,66,0.2);
}

.btn-primary:hover {
  background: var(--gold-light);
  color: var(--btn-primary-text);
  transform: translateY(-1px);
}

[data-theme="dark"] .btn-primary:hover,
:root:not([data-theme]) .btn-primary:hover {
  box-shadow: 0 0 30px rgba(212,166,66,0.35);
}

[data-theme="light"] .btn-primary {
  box-shadow: 0 2px 8px rgba(139,105,20,0.2);
}

[data-theme="light"] .btn-primary:hover {
  box-shadow: 0 4px 16px rgba(139,105,20,0.3);
}

.btn-outline {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--border-gold);
}
.btn-outline:hover {
  background: var(--border-gold);
  border-color: var(--gold);
  color: var(--gold-light);
  transform: translateY(-1px);
}

/* --- Section Shared --- */
.section {
  position: relative;
  z-index: 1;
  padding: 5rem 2rem;
}

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

.section-label {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 0.75rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  color: var(--cream);
  margin-bottom: 1rem;
}

.section-desc {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 680px;
  line-height: 1.7;
}

/* Decorative divider */
.divider {
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, var(--gold), transparent);
  margin: 3rem auto;
}

/* --- What's Inside (Manual Overview) --- */
.parts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-top: 2.5rem;
}

.part-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2rem;
  transition: all 0.35s ease;
  position: relative;
  overflow: hidden;
}

.part-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px;
  height: 100%;
  background: var(--gold-dim);
  transition: background 0.35s ease;
}

.part-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-gold);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

.part-card:hover::before {
  background: var(--gold);
}

.part-number {
  font-family: var(--font-display);
  font-size: 0.65rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 0.5rem;
}

.part-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--cream);
  margin-bottom: 0.75rem;
}

.part-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.part-chapters {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* --- Tracker Preview --- */
.tracker-section {
  background:
    linear-gradient(180deg, var(--bg-deep) 0%, var(--bg-surface) 50%, var(--bg-deep) 100%);
}

.tracker-preview {
  margin-top: 2.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: background 0.4s ease, border-color 0.4s ease;
}

.tracker-preview::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
}

.tracker-placeholder {
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 1.5rem;
}

/* --- Download CTA --- */
.download-section {
  text-align: center;
}

.download-box {
  margin-top: 2.5rem;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: 4px;
  padding: 3rem 4rem;
  position: relative;
  transition: background 0.4s ease, border-color 0.4s ease;
}

.download-formats {
  display: flex;
  gap: 1rem;
}

.download-note {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* --- Scripture Banner --- */
.scripture-banner {
  text-align: center;
  padding: 4rem 2rem;
  position: relative;
  z-index: 1;
}

.scripture-banner blockquote {
  font-family: var(--font-body);
  font-size: 1.3rem;
  font-style: italic;
  color: var(--cream-dim);
  max-width: 700px;
  margin: 0 auto;
  line-height: 1.7;
}

.scripture-banner .ref {
  display: block;
  margin-top: 0.75rem;
  font-style: normal;
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--gold-dim);
}

/* --- Footer --- */
.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  padding: 2.5rem 2rem;
  text-align: center;
  transition: border-color 0.4s ease;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.footer-brand {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold-dim);
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.footer-links a {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.footer-links a:hover {
  color: var(--gold);
}

.footer-legal {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* --- Responsive --- */
@media (max-width: 900px) {
  html { font-size: 16px; }

  .hero-inner {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 2.5rem;
  }

  .hero-cover { order: -1; }
  .hero-cover img { max-height: 420px; }

  .hero-text { align-items: center; }

  .hero-scripture {
    border-left: none;
    padding-left: 0;
    border-top: 1px solid var(--border-gold);
    padding-top: 1rem;
  }

  .hero-actions { justify-content: center; }

  .parts-grid { grid-template-columns: 1fr; }

  .section-title { font-size: 1.6rem; }
  .hero-title { font-size: 2rem; }

  .download-box { padding: 2rem; }
}

@media (max-width: 600px) {
  .nav-links { display: none; }
  .nav-toggle { display: block; }

  /* Mobile nav open state */
  .site-nav.open .nav-links {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--nav-height);
    left: 0; right: 0;
    background: var(--nav-mobile-bg);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 2rem;
    gap: 1.25rem;
  }

  .site-nav.open .nav-toggle span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }
  .site-nav.open .nav-toggle span:nth-child(2) {
    opacity: 0;
  }
  .site-nav.open .nav-toggle span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
  }

  .hero { min-height: auto; padding-top: calc(var(--nav-height) + 2rem); }
  .hero-cover img { max-height: 350px; }
  .hero-title { font-size: 1.7rem; }

  .download-formats { flex-direction: column; }
}

/* --- Animations --- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-up {
  animation: fadeUp 0.7s ease-out both;
}

.fade-up-delay-1 { animation-delay: 0.15s; }
.fade-up-delay-2 { animation-delay: 0.3s; }
.fade-up-delay-3 { animation-delay: 0.45s; }
.fade-up-delay-4 { animation-delay: 0.6s; }
