/* ==========================================================================
   MAIN STYLES — 4th of July Orations
   ========================================================================== */

/* Color Palette */
:root {
  --parchment: #f5f0e8;
  --parchment-dark: #ebe4d6;
  --navy: #1b2a4a;
  --dark-navy: #0f1a30;
  --brick-red: #8b3a3a;
  --brick-red-light: #a54a4a;
  --gold: #c5a55a;
  --gold-light: #d4b96e;
  --text-dark: #2d2d2d;
  --text-muted: #595959;
  --border-color: #d5cfc3;
  --header-height: 60px;
  --footer-height: 40px;
  --content-height: calc(100vh - var(--header-height) - var(--footer-height));
}

/* Dark mode colors */
[data-bs-theme="dark"] {
  --parchment: #1a1a2e;
  --parchment-dark: #141425;
  --border-color: #2d2d4a;
  --text-dark: #e0ddd5;
  --text-muted: #9a978f;
}

/* ==========================================================================
   BODY
   ========================================================================== */

body {
  background-color: var(--parchment);
  color: var(--text-dark);
}

[data-bs-theme="dark"] body {
  background-color: var(--parchment);
}

/* ==========================================================================
   NAVBAR
   ========================================================================== */

.navbar {
  min-height: var(--header-height);
  background-color: var(--navy) !important;
  border-bottom: 2px solid var(--gold);
  z-index: 1030;
}

.navbar-brand {
  font-weight: 700;
  font-stretch: condensed;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 1.35rem;
  color: var(--gold) !important;
}

.navbar-brand:hover {
  color: var(--gold-light) !important;
}

.navbar .nav-link {
  color: rgba(255, 255, 255, 0.85) !important;
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  padding: 0.5rem 0.75rem !important;
  transition: color 0.2s;
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
  color: var(--gold) !important;
}

.navbar .nav-link.active {
  font-weight: 600;
}

/* Theme toggle button */
.btn-theme-toggle {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.85);
  padding: 0.4rem 0.5rem 0.25rem 0.5rem;
  font-size: 0.9rem;
  border-radius: 0.25rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  width: 35px;
  height: 35px;
}

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

/* ==========================================================================
   FOOTER
   ========================================================================== */

.site-footer {
  height: var(--footer-height);
  background-color: var(--navy);
  border-top: 1px solid var(--gold);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1020;
}

.site-footer a {
  color: var(--gold);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--gold-light);
}

.footer-logo {
  height: 13px;
  width: auto;
  vertical-align: middle;
  filter: invert(1);
  opacity: 0.85;
  transition: opacity 0.2s;
  margin-bottom: 4px;
}

.site-footer a:hover .footer-logo {
  opacity: 1;
}

/* ==========================================================================
   MAIN CONTENT AREA
   ========================================================================== */

.main-content {
  margin-top: var(--header-height);
  padding-bottom: var(--footer-height);
  min-height: var(--content-height);
}

/* For pages that should not scroll (database) */
.main-content-fixed {
  margin-top: var(--header-height);
  height: var(--content-height);
  overflow: hidden;
}

[data-bs-theme="dark"] .metadata-label {
    color: var(--gold);
}

/* ==========================================================================
   GENERAL TYPOGRAPHY AND ELEMENTS
   ========================================================================== */

a {
  color: var(--brick-red);
  transition: color 0.2s;
}

a:hover {
  color: var(--brick-red-light);
}

[data-bs-theme="dark"] a {
  color: var(--gold);
}

[data-bs-theme="dark"] a:hover {
  color: var(--gold-light);
}

.text-gold {
  color: var(--gold) !important;
}

.text-brick {
  color: var(--brick-red) !important;
}

.bg-parchment {
  background-color: var(--parchment) !important;
}

.bg-navy {
  background-color: var(--navy) !important;
}

/* Decorative separator */
.separator {
  width: 60px;
  height: 2px;
  background-color: var(--gold);
  margin: 1.5rem auto;
}

/* Card styling */
.card {
  border: 1px solid var(--border-color);
  background-color: rgba(255, 255, 255, 0.5);
}

[data-bs-theme="dark"] .card {
  background-color: rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   SCROLLBAR — scoped to inner scrollable elements only
   (avoids forcing a scrollbar track on the page body)
   ========================================================================== */

.main-content ::-webkit-scrollbar,
.main-content-fixed ::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.main-content ::-webkit-scrollbar-track,
.main-content-fixed ::-webkit-scrollbar-track {
  background: transparent;
}

.main-content ::-webkit-scrollbar-thumb,
.main-content-fixed ::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.main-content ::-webkit-scrollbar-thumb:hover,
.main-content-fixed ::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ==========================================================================
   LOADING INDICATOR
   ========================================================================== */

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(245, 240, 232, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

[data-bs-theme="dark"] .loading-overlay {
  background: rgba(26, 26, 46, 0.9);
}

.loading-overlay .spinner-border {
  color: var(--gold);
}

/* ==========================================================================
   HOMEPAGE
   ========================================================================== */

/* Hero — full viewport with Declaration as atmospheric backdrop */
.hero {
  position: relative;
  min-height: calc(100vh - var(--header-height) + var(--footer-height));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: url('../images/Declaration_Pg1of1_AC.jpeg') center top / cover no-repeat;
  opacity: 0.78;
  filter: sepia(0.3) contrast(1.1);
}

[data-bs-theme="dark"] .hero-bg {
  opacity: 0.48;
  filter: sepia(0.1) contrast(1.2) brightness(0.8);
}

/* Subtle vignette overlay to focus attention center */
.hero-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, var(--parchment) 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 720px;
  padding: 3rem 1.5rem;
}

/* Decorative rule above the title */
.hero-rule {
  width: 80px;
  height: 1px;
  background: var(--gold);
  margin: 0 auto 1.5rem;
}

.hero-eyebrow {
  font-weight: 700;
  font-stretch: condensed;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.8rem;
  color: var(--brick-red);
  margin-bottom: 0.75rem;
}

[data-bs-theme="dark"] .hero-eyebrow {
  color: var(--gold);
}

.hero-title {
  font-weight: 300;
  font-size: clamp(2.4rem, 5.5vw, 4.2rem);
  line-height: 1.08;
  color: var(--navy);
  margin-bottom: 0.35em;
  letter-spacing: -0.01em;
}

[data-bs-theme="dark"] .hero-title {
  color: var(--text-dark);
}

.hero-title em {
  font-style: italic;
  font-weight: 300;
}

.hero-subtitle {
  font-weight: 400;
  font-size: clamp(1rem, 1.8vw, 1.15rem);
  line-height: 1.55;
  color: var(--text-muted);
  max-width: 540px;
  margin: 0 auto 2rem;
}

[data-bs-theme="dark"] .hero-subtitle {
  color: var(--text-dark);
}

/* CTA button — archival-feeling outlined style */
.btn-cta {
  display: inline-block;
  font-weight: 700;
  font-stretch: condensed;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.82rem;
  color: var(--navy);
  border: 1.5px solid var(--navy);
  padding: 0.7rem 2.2rem;
  text-decoration: none;
  transition: background 0.3s, color 0.3s, border-color 0.3s;
}

.btn-cta:hover {
  background: var(--navy);
  color: var(--gold);
  border-color: var(--navy);
}

[data-bs-theme="dark"] .btn-cta {
  color: var(--gold);
  border-color: var(--gold);
}

[data-bs-theme="dark"] .btn-cta:hover {
  background: var(--gold);
  color: var(--dark-navy);
}

/* Scroll indicator */
.scroll-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  opacity: 0.4;
  animation: drift 2.5s ease-in-out infinite;
}

.scroll-indicator svg {
  width: 20px;
  height: 20px;
  stroke: var(--text-muted);
  fill: none;
  stroke-width: 2;
}

@keyframes drift {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(6px); }
}

/* Homepage main-content sits flush below the hero (no header offset needed) */
.hero + .main-content {
  margin-top: 0;
}

/* Statistics strip */
.stats-strip {
  background: var(--navy);
  padding: 2.5rem 0;
  color: rgba(255, 255, 255, 0.9);
}

.stat-item {
  text-align: center;
  padding: 0.5rem 1rem;
}

.stat-number {
  font-weight: 300;
  font-size: 2.4rem;
  line-height: 1;
  color: var(--gold);
  margin-bottom: 0.3rem;
}

.stat-label {
  font-weight: 700;
  font-stretch: condensed;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.6);
}

/* About / book section */
.section-about {
  padding: 5rem 0 6rem;
  background: var(--parchment);
}

.section-heading {
  font-weight: 700;
  font-stretch: condensed;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 1.3rem;
  color: var(--brick-red);
}

[data-bs-theme="dark"] .section-heading {
  color: var(--gold);
}

.about-text {
  /* font-size: 1rem; */
  line-height: 1.75;
  color: var(--text-dark);
}

.about-text p + p {
  margin-top: 1rem;
}

.section-about .separator {
  margin: 0 0 1.5rem;
}

/* Book cover presentation */
.book-frame {
  position: relative;
  max-width: 260px;
}

.book-frame img {
  width: 100%;
  height: auto;
  display: block;
  box-shadow:
    4px 4px 0 var(--navy),
    8px 8px 24px rgba(27, 42, 74, 0.18);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.book-frame:hover img {
  transform: translateY(-3px);
  box-shadow:
    4px 6px 0 var(--navy),
    8px 12px 32px rgba(27, 42, 74, 0.24);
}

.book-caption {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.book-caption a {
  font-weight: 600;
}

/* Page-load animation */
.fade-in-up {
  opacity: 0;
  transform: translateY(18px);
  animation: fadeInUp 0.7s ease forwards;
}

.fade-in-up:nth-child(1) { animation-delay: 0.15s; }
.fade-in-up:nth-child(2) { animation-delay: 0.3s; }
.fade-in-up:nth-child(3) { animation-delay: 0.45s; }
.fade-in-up:nth-child(4) { animation-delay: 0.6s; }
.fade-in-up:nth-child(5) { animation-delay: 0.75s; }

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 767.98px) {
  .hero-content {
    padding: 2rem 1rem;
  }

  .book-frame {
    max-width: 200px;
    margin: 0 auto 2rem;
  }

  .section-about {
    padding: 3rem 0 4rem;
  }
}
