/* ============================================================
   STUDY FOR TRUTH — SHARED STYLESHEET
   studyfortruth.org  |  Version 1.0
   ============================================================
   TABLE OF CONTENTS
    1. Reset & Base
    2. CSS Custom Properties
    3. Typography
    4. Layout Utilities
    5. Reveal Animations
    6. Section Headings
    7. Buttons
    8. Navigation
    9. Hero (Homepage)
   10. Pillars Section
   11. About Section
   12. Featured Book Cards
   13. Library CTA Band
   14. Contact Section
   15. Footer
   16. Library Page — Page Header
   17. Library Page — Controls (Search & Filter)
   18. Library Page — Book Grid
   19. 404 Page
   20. Print Styles
   ============================================================ */


/* ============================================================
   1. RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: clamp(1rem, 1.5vw, 1.1rem);
  line-height: 1.8;
  color: var(--text);
  background: var(--parchment);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; height: auto; display: block; }
a   { color: var(--gold); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--navy); }
ul, ol { list-style: none; }

/* Skip-to-content accessibility link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--gold);
  color: var(--navy-deep);
  padding: 0.5rem 1rem;
  border-radius: 0 0 var(--radius) var(--radius);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 999;
  transition: top 0.2s;
}
.skip-link:focus { top: 0; }


/* ============================================================
   2. CSS CUSTOM PROPERTIES
   ============================================================ */
:root {
  /* Colour palette */
  --parchment:      #f7f1e5;
  --parchment-mid:  #ede3cf;
  --parchment-dark: #ddd0b7;
  --navy:           #1a2744;
  --navy-mid:       #243354;
  --navy-deep:      #0f1923;
  --gold:           #c4922a;
  --gold-light:     #e8b94a;
  --gold-pale:      #f5e6c0;
  --text:           #1f1a14;
  --text-soft:      #4a3f35;
  --text-muted:     #7a6e64;
  --surface:        #ffffff;
  --border:         #d4c4a8;
  --border-light:   #ece3d2;

  /* Typography */
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body:    'Crimson Pro', Georgia, serif;

  /* Spacing */
  --section-pad: clamp(60px, 8vw, 120px);
  --container:   1100px;
  --radius:      6px;
  --radius-lg:   14px;

  /* Shadows */
  --shadow-sm: 0 1px 4px rgba(26, 39, 68, 0.07);
  --shadow-md: 0 4px 18px rgba(26, 39, 68, 0.1);
  --shadow-lg: 0 8px 36px rgba(26, 39, 68, 0.13);
}


/* ============================================================
   3. TYPOGRAPHY
   ============================================================ */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  color: var(--navy);
}
h1 { font-size: clamp(2.6rem, 6vw, 5rem); line-height: 1.05; }
h2 { font-size: clamp(1.9rem, 3.5vw, 2.8rem); }
h3 { font-size: clamp(1.2rem, 2vw, 1.65rem); }
h4 { font-size: clamp(1rem, 1.5vw, 1.2rem); }
p  { line-height: 1.8; color: var(--text-soft); }


/* ============================================================
   4. LAYOUT UTILITIES
   ============================================================ */
.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 2.5rem);
}


/* ============================================================
   5. REVEAL ANIMATIONS
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.visible { opacity: 1; transform: none; }
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }


/* ============================================================
   6. SECTION HEADINGS
   ============================================================ */
.section-label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.6rem;
}

.section-heading {
  text-align: center;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}
.section-heading h2 { margin-bottom: 0.75rem; }
.section-heading p {
  max-width: 580px;
  margin-inline: auto;
  font-size: 1.05rem;
  color: var(--text-muted);
}

.heading-ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  margin-block: 0.85rem;
}
.heading-ornament::before,
.heading-ornament::after {
  content: '';
  width: 44px;
  height: 1px;
  background: var(--gold);
  opacity: 0.5;
}
.heading-ornament span {
  color: var(--gold);
  font-size: 0.55rem;
  letter-spacing: 0.2em;
}


/* ============================================================
   7. BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.78rem 1.9rem;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  border: none;
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s, color 0.2s, border-color 0.2s;
  text-decoration: none;
  line-height: 1;
}
.btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.btn-primary {
  background: var(--gold);
  color: var(--navy-deep);
}
.btn-primary:hover {
  background: var(--gold-light);
  color: var(--navy-deep);
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(196, 146, 42, 0.35);
}

.btn-outline {
  background: transparent;
  color: white;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
}
.btn-outline:hover {
  border-color: var(--gold);
  color: var(--gold);
  transform: translateY(-2px);
}

.btn-outline-navy {
  background: transparent;
  color: var(--navy);
  border: 1.5px solid var(--navy);
}
.btn-outline-navy:hover {
  background: var(--navy);
  color: white;
  transform: translateY(-2px);
}


/* ============================================================
   8. NAVIGATION
   ============================================================ */
.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  transition: background 0.35s, box-shadow 0.35s, border-color 0.35s;
  border-bottom: 1px solid transparent;
}
.site-nav.scrolled {
  background: rgba(15, 25, 35, 0.97);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom-color: rgba(196, 146, 42, 0.2);
  box-shadow: 0 2px 26px rgba(0, 0, 0, 0.3);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 1.1rem;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
}
.nav-logo-icon { color: var(--gold); flex-shrink: 0; }
.nav-logo-text {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: white;
  letter-spacing: 0.01em;
  line-height: 1.2;
}
.nav-logo-sub {
  display: block;
  font-size: 0.58rem;
  font-family: var(--font-body);
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.9rem;
}
.nav-links a {
  color: rgba(255, 255, 255, 0.8);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-decoration: none;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--gold); }
.nav-links .nav-cta {
  background: var(--gold);
  color: var(--navy-deep) !important;
  padding: 0.45rem 1.2rem;
  border-radius: var(--radius);
  font-weight: 600;
  transition: background 0.2s, transform 0.2s;
}
.nav-links .nav-cta:hover {
  background: var(--gold-light);
  transform: translateY(-1px);
}

/* Hamburger */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
}
.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: white;
  border-radius: 2px;
  transition: all 0.3s ease;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; width: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-mobile {
  display: none;
  flex-direction: column;
  background: rgba(15, 25, 35, 0.99);
  border-top: 1px solid rgba(196, 146, 42, 0.18);
  padding: 1.25rem 1.5rem 1.75rem;
}
.nav-mobile.open { display: flex; }
.nav-mobile a {
  display: block;
  color: rgba(255, 255, 255, 0.8);
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  text-decoration: none;
  transition: color 0.2s;
}
.nav-mobile a:last-child { border-bottom: none; }
.nav-mobile a:hover { color: var(--gold); }

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


/* ============================================================
   9. HERO (HOMEPAGE)
   ============================================================ */
.hero {
  min-height: 100svh;
  background: var(--navy-deep);
  position: relative;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding-top: 80px;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 65% 70% at 5% 55%, rgba(196, 146, 42, 0.09) 0%, transparent 65%),
    linear-gradient(155deg, #0f1923 0%, #1a2744 55%, #1e3a5f 100%);
}

.hero-pattern {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(196, 146, 42, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(196, 146, 42, 0.045) 1px, transparent 1px);
  background-size: 72px 72px;
  pointer-events: none;
}

.hero-watermark {
  position: absolute;
  right: -2%;
  bottom: -5%;
  width: min(55vw, 600px);
  height: auto;
  color: rgba(255, 255, 255, 0.03);
  pointer-events: none;
  user-select: none;
}

.hero-content {
  position: relative;
  z-index: 2;
  padding-block: clamp(3.5rem, 8vw, 7rem);
  max-width: 700px;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1.5rem;
  opacity: 0;
  animation: fadeUp 0.8s ease 0.2s forwards;
}
.hero-eyebrow::before,
.hero-eyebrow::after {
  content: '';
  width: 26px;
  height: 1px;
  background: var(--gold);
  opacity: 0.7;
}
.hero-eyebrow span {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--gold);
}

.hero h1 {
  color: white;
  font-weight: 500;
  opacity: 0;
  animation: fadeUp 0.85s ease 0.35s forwards;
}
.hero h1 em {
  font-style: italic;
  color: var(--gold-light);
}

.hero-text {
  color: rgba(255, 255, 255, 0.68);
  font-size: clamp(1rem, 1.8vw, 1.15rem);
  max-width: 520px;
  margin-top: 1.5rem;
  margin-bottom: 2.5rem;
  line-height: 1.85;
  opacity: 0;
  animation: fadeUp 0.85s ease 0.5s forwards;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  opacity: 0;
  animation: fadeUp 0.85s ease 0.65s forwards;
}

.hero-scroll {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-family: var(--font-display);
  animation: breathe 2.5s ease infinite;
  text-decoration: none;
  z-index: 2;
}
.scroll-line {
  width: 1px;
  height: 36px;
  background: linear-gradient(to bottom, transparent, rgba(196, 146, 42, 0.5));
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes breathe {
  0%, 100% { opacity: 0.35; }
  50%       { opacity: 0.75; }
}


/* ============================================================
   10. PILLARS SECTION
   ============================================================ */
.pillars {
  padding-block: var(--section-pad);
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
}

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

.pillar {
  text-align: center;
  padding: 2.5rem 1.75rem 2rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  position: relative;
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.3s;
}
.pillar:hover {
  border-color: rgba(196, 146, 42, 0.4);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}
.pillar::before {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 2px;
  background: var(--gold);
  border-radius: 1px;
  opacity: 0.7;
}

.pillar-icon {
  width: 48px;
  height: 48px;
  margin-inline: auto;
  margin-bottom: 1.25rem;
  color: var(--gold);
}
.pillar h3 { font-size: 1.3rem; margin-bottom: 0.65rem; }
.pillar p  { font-size: 0.94rem; color: var(--text-muted); line-height: 1.7; }

@media (max-width: 768px) {
  .pillars-grid { grid-template-columns: 1fr; gap: 1.25rem; }
}


/* ============================================================
   11. ABOUT SECTION
   ============================================================ */
.about {
  padding-block: var(--section-pad);
  background: var(--parchment);
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: clamp(2.5rem, 6vw, 5rem);
  align-items: center;
}

.about-image-wrap {
  position: relative;
}
.about-image-wrap::after {
  content: '';
  position: absolute;
  bottom: -12px;
  right: -12px;
  width: calc(100% - 28px);
  height: calc(100% - 28px);
  border: 2px solid var(--gold);
  border-radius: var(--radius-lg);
  pointer-events: none;
  opacity: 0.3;
  z-index: 0;
}

.about-photo-placeholder {
  aspect-ratio: 3 / 4;
  background: linear-gradient(150deg, var(--parchment-mid) 0%, var(--parchment-dark) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-align: center;
  padding: 2rem;
  position: relative;
  z-index: 1;
}
.about-photo-placeholder svg { opacity: 0.35; }

/* When a real photo is added, use:
   <img src="images/dr-wyeth.jpg" alt="Dr. Robert Wyeth" class="about-photo" ...> */
.about-photo {
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: var(--radius-lg);
  position: relative;
  z-index: 1;
}

.about-text .section-label { text-align: left; }
.about-text h2 { margin-bottom: 1.1rem; }
.about-text p  { margin-bottom: 1.1rem; }
.about-text p:last-of-type { margin-bottom: 2rem; }

@media (max-width: 768px) {
  .about-grid { grid-template-columns: 1fr; }
  .about-image-wrap::after { display: none; }
  .about-photo-placeholder { aspect-ratio: 4 / 3; }
}


/* ============================================================
   12. FEATURED BOOK CARDS (Homepage)
   ============================================================ */
.featured {
  padding-block: var(--section-pad);
  background: var(--surface);
}

.books-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.75rem;
}

.book-card {
  background: var(--parchment);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
}
.book-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(196, 146, 42, 0.35);
}

.book-card-spine {
  height: 4px;
  background: linear-gradient(90deg, var(--navy) 0%, var(--navy-mid) 100%);
}

.book-card-body {
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.book-eyebrow {
  font-family: var(--font-display);
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.55rem;
}

.book-card h3 {
  font-size: 1.15rem;
  margin-bottom: 0.7rem;
  line-height: 1.3;
  color: var(--navy);
}

.book-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.7;
  flex: 1;
  margin-bottom: 1.25rem;
}

.book-formats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1.2rem;
}

.format-tag {
  font-size: 0.66rem;
  font-family: var(--font-body);
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 0.22rem 0.55rem;
  border-radius: 3px;
  text-transform: uppercase;
}
.fmt-pdf  { background: #fee2e2; color: #c0392b; }
.fmt-epub { background: #dbeafe; color: #1d4ed8; }
.fmt-mobi { background: #d1fae5; color: #065f46; }
.fmt-doc  { background: #e0e7ff; color: #3730a3; }

.book-card-footer {
  border-top: 1px solid var(--border-light);
  padding-top: 1.1rem;
}

@media (max-width: 1024px) {
  .books-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .books-grid { grid-template-columns: 1fr; }
}


/* ============================================================
   13. LIBRARY CTA BAND
   ============================================================ */
.library-cta {
  padding-block: clamp(4rem, 7vw, 7rem);
  background: var(--navy);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.library-cta::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(196, 146, 42, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(196, 146, 42, 0.055) 1px, transparent 1px);
  background-size: 65px 65px;
  pointer-events: none;
}
.library-cta .container { position: relative; z-index: 1; }
.library-cta .section-label { color: rgba(196, 146, 42, 0.85); }
.library-cta h2 { color: white; margin-bottom: 1rem; }
.library-cta p {
  color: rgba(255, 255, 255, 0.62);
  max-width: 500px;
  margin-inline: auto;
  margin-bottom: 2.5rem;
  font-size: 1.05rem;
}


/* ============================================================
   14. CONTACT SECTION
   ============================================================ */
.contact {
  padding-block: var(--section-pad);
  background: var(--parchment);
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.45fr;
  gap: clamp(2rem, 6vw, 5rem);
  align-items: start;
}

.contact-info h2 { margin-bottom: 1rem; }
.contact-info > p { margin-bottom: 2rem; color: var(--text-muted); }

.contact-detail {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 1rem;
  padding: 0.9rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
}
.contact-detail svg    { color: var(--gold); flex-shrink: 0; margin-top: 3px; }
.contact-detail-text   { font-size: 0.9rem; }
.contact-detail-text strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--navy);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.15rem;
}
.contact-detail-text a {
  color: var(--text-soft);
  transition: color 0.2s;
}
.contact-detail-text a:hover { color: var(--gold); }

.contact-form-wrap {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: clamp(1.75rem, 4vw, 2.75rem);
  box-shadow: var(--shadow-sm);
}
.contact-form-wrap h3 { margin-bottom: 1.5rem; font-size: 1.35rem; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
  margin-bottom: 1rem;
}

.form-group label {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--navy);
}

.form-group input,
.form-group textarea,
.form-group select {
  padding: 0.68rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text);
  background: var(--parchment);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(196, 146, 42, 0.12);
}
.form-group textarea { resize: vertical; min-height: 130px; }

.form-submit { margin-top: 0.5rem; }

.form-success {
  display: none;
  text-align: center;
  padding: 2rem;
  background: #d1fae5;
  color: #065f46;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 1.1rem;
  line-height: 1.6;
}
.form-success.show { display: block; }
.form-success strong { display: block; font-size: 1.3rem; margin-bottom: 0.5rem; }

@media (max-width: 768px) {
  .contact-grid { grid-template-columns: 1fr; }
  .form-row     { grid-template-columns: 1fr; }
}


/* ============================================================
   15. FOOTER
   ============================================================ */
.site-footer {
  background: var(--navy-deep);
  color: rgba(255, 255, 255, 0.6);
  padding-block: clamp(3rem, 6vw, 5rem);
  border-top: 3px solid var(--gold);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 3rem;
}

.footer-brand .nav-logo { margin-bottom: 1.1rem; }
.footer-brand p {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.42);
  line-height: 1.75;
  max-width: 270px;
}

.footer-col h4 {
  color: rgba(255, 255, 255, 0.88);
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 1.1rem;
}
.footer-col ul { display: flex; flex-direction: column; gap: 0.5rem; }
.footer-col li a {
  color: rgba(255, 255, 255, 0.52);
  font-size: 0.9rem;
  text-decoration: none;
  transition: color 0.2s;
}
.footer-col li a:hover { color: var(--gold); }

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.3);
}
.footer-bottom a { color: rgba(255, 255, 255, 0.3); transition: color 0.2s; }
.footer-bottom a:hover { color: var(--gold); }

@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr; gap: 2rem; }
  .footer-brand p { max-width: none; }
  .footer-bottom { flex-direction: column; text-align: center; }
}


/* ============================================================
   16. LIBRARY PAGE — PAGE HEADER
   ============================================================ */
.page-header {
  background: var(--navy-deep);
  padding-top: 130px;
  padding-bottom: 4rem;
  position: relative;
  overflow: hidden;
}
.page-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(196, 146, 42, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(196, 146, 42, 0.055) 1px, transparent 1px);
  background-size: 65px 65px;
  pointer-events: none;
}
.page-header-content { position: relative; z-index: 1; }
.page-header .section-label { color: rgba(196, 146, 42, 0.85); }
.page-header h1 {
  color: white;
  font-size: clamp(2.1rem, 4.5vw, 3.5rem);
  margin-bottom: 0.85rem;
}
.page-header > .container > .page-header-content > p {
  color: rgba(255, 255, 255, 0.62);
  max-width: 540px;
  font-size: 1.05rem;
}

.page-header-stats {
  display: flex;
  gap: 2.5rem;
  margin-top: 2.25rem;
  flex-wrap: wrap;
}
.stat-num {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  color: var(--gold);
  line-height: 1;
  display: block;
}
.stat-label {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
  font-family: var(--font-display);
}


/* ============================================================
   17. LIBRARY PAGE — CONTROLS (Search & Filter)
   ============================================================ */
.library-controls {
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  padding-block: 1.25rem;
  position: sticky;
  top: 68px;
  z-index: 10;
  box-shadow: var(--shadow-sm);
}

.controls-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.search-wrap {
  flex: 1;
  min-width: 200px;
  position: relative;
}
.search-wrap svg {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
#book-search {
  width: 100%;
  padding: 0.65rem 0.9rem 0.65rem 2.5rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text);
  background: var(--parchment);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#book-search:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(196, 146, 42, 0.12);
}
#book-search::placeholder { color: var(--text-muted); font-style: italic; }

.format-filters {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.45rem 0.95rem;
  border: 1.5px solid var(--border);
  border-radius: 30px;
  background: transparent;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--text-soft);
  cursor: pointer;
  transition: all 0.2s;
}
.filter-btn:hover { border-color: var(--navy); color: var(--navy); }
.filter-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.filter-btn.active                   { background: var(--navy);  border-color: var(--navy);  color: white; }
.filter-btn[data-format="pdf"].active  { background: #c0392b; border-color: #c0392b; }
.filter-btn[data-format="epub"].active { background: #1d4ed8; border-color: #1d4ed8; }
.filter-btn[data-format="mobi"].active { background: #065f46; border-color: #065f46; }
.filter-btn[data-format="doc"].active  { background: #3730a3; border-color: #3730a3; }

@media (max-width: 640px) {
  .controls-inner { flex-direction: column; align-items: stretch; }
  .format-filters { justify-content: flex-start; }
}


/* ============================================================
   18. LIBRARY PAGE — BOOK GRID
   ============================================================ */
.library-section {
  padding-block: clamp(2.5rem, 5vw, 4rem);
}

.results-count {
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  letter-spacing: 0.04em;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.library-book-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
}
.library-book-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--parchment-dark);
}

.book-card-top {
  height: 4px;
  background: linear-gradient(90deg, var(--navy) 0%, var(--navy-mid) 100%);
}

.library-book-card .book-card-body { padding: 1.35rem; }

.book-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.45rem;
}
.book-category {
  font-size: 0.64rem;
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}

.library-book-card h3 {
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
  line-height: 1.35;
  color: var(--navy);
}

.book-desc {
  font-size: 0.87rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 1rem;
}

.book-downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 0.38rem;
  border-top: 1px solid var(--border-light);
  padding-top: 0.9rem;
}

.dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.3rem 0.65rem;
  border-radius: 4px;
  font-size: 0.71rem;
  font-weight: 700;
  font-family: var(--font-body);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-decoration: none;
  transition: opacity 0.2s, transform 0.2s;
  border: none;
  cursor: pointer;
}
.dl-btn:hover { opacity: 0.8; transform: translateY(-1px); }
.dl-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.dl-btn.dl-pdf  { background: #fee2e2; color: #c0392b; }
.dl-btn.dl-epub { background: #dbeafe; color: #1d4ed8; }
.dl-btn.dl-mobi { background: #d1fae5; color: #065f46; }
.dl-btn.dl-doc  { background: #e0e7ff; color: #3730a3; }

#no-results {
  display: none;
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 1.1rem;
  grid-column: 1 / -1;
}

@media (max-width: 640px) {
  .library-grid { grid-template-columns: 1fr; }
}


/* ============================================================
   19. 404 PAGE
   ============================================================ */
.page-404 {
  min-height: 100svh;
  background: var(--navy-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  position: relative;
}
.page-404::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(196, 146, 42, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(196, 146, 42, 0.04) 1px, transparent 1px);
  background-size: 65px 65px;
  pointer-events: none;
}
.page-404-content { position: relative; z-index: 1; max-width: 500px; }
.page-404 .big-404 {
  font-family: var(--font-display);
  font-size: clamp(6rem, 18vw, 12rem);
  font-weight: 700;
  color: rgba(255, 255, 255, 0.04);
  line-height: 1;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  pointer-events: none;
}
.page-404 h1 {
  color: white;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  margin-bottom: 1rem;
  position: relative;
  z-index: 1;
}
.page-404 p {
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 2rem;
  position: relative;
  z-index: 1;
}


/* ============================================================
   20. PRINT STYLES
   ============================================================ */
@media print {
  .site-nav, .hero-scroll, .nav-toggle, .nav-mobile,
  .contact-form-wrap, .library-controls { display: none !important; }
  body { background: white; color: black; font-size: 12pt; }
  a::after { content: ' (' attr(href) ')'; font-size: 0.8em; }
}
