/* Al-Maktaba — Traditional Archive Stylesheet */

/* ── Base ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background-color: #fcf9ee;
  color: #1A1A1A;
  font-family: 'Work Sans', system-ui, sans-serif;
  line-height: 1.75;
  padding-top: 52px;   /* fixed header height */
  padding-bottom: 2px; /* for shelf bar */
}

/* ── Fixed Top Header ────────────────────────────────────── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 52px;
  background: #F4F1E6;
  border-bottom: 1px solid #D9D4C7;
  z-index: 40;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
}
.site-header .nav-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: #3D1C10;
  display: flex;
  align-items: center;
  padding: 4px;
  transition: color 200ms ease;
}
.site-header .nav-toggle:hover { color: #C5A059; }
.site-wordmark {
  font-family: 'Libre Caslon Text', Georgia, serif;
  font-size: 1.1rem;
  color: #3D1C10;
  text-decoration: none;
  letter-spacing: 0.01em;
}
.site-wordmark:hover { color: #C5A059; }

/* ── Sidebar Nav Drawer ──────────────────────────────────── */
.nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 26, 0.35);
  z-index: 45;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
}
.nav-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.nav-drawer {
  position: fixed;
  top: 0; left: -280px;
  width: 260px;
  height: 100vh;
  background: #F4F1E6;
  border-right: 1px solid #D9D4C7;
  z-index: 50;
  transition: left 280ms ease;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.nav-drawer.open { left: 0; }

.nav-drawer-head {
  padding: 16px 20px;
  border-bottom: 1px solid #D9D4C7;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #F4F1E6;
}
.nav-drawer-head .nav-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #514440;
  font-size: 1rem;
  padding: 4px;
  transition: color 200ms ease;
}
.nav-drawer-head .nav-close:hover { color: #C5A059; }

.nav-drawer-body { padding: 12px 0; flex: 1; }
.nav-drawer-section {
  padding: 12px 20px 4px;
}
.nav-drawer-section-label {
  font-family: 'Work Sans', sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #514440;
  margin-bottom: 6px;
}
.nav-drawer-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  font-family: 'Work Sans', sans-serif;
  font-size: 0.85rem;
  color: #514440;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}
.nav-drawer-link:hover {
  color: #3D1C10;
  border-left-color: #C5A059;
  background: rgba(197,160,89,0.07);
}
.nav-drawer-link.active {
  color: #3D1C10;
  border-left-color: #C5A059;
  font-weight: 600;
  background: rgba(197,160,89,0.1);
}
.nav-drawer-link .material-symbols-outlined {
  font-size: 16px;
  color: #C5A059;
  flex-shrink: 0;
}
.nav-drawer-footer {
  padding: 16px 20px;
  border-top: 1px solid #D9D4C7;
}
.nav-drawer-footer p {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #514440;
}

/* ── Fixed Decorative Shelf Bar ──────────────────────────── */
.shelf-bar {
  position: fixed;
  bottom: 0; left: 0;
  width: 100%; height: 1px;
  background-color: #3D1C10;
  z-index: 50;
}

/* ── Page Headers ────────────────────────────────────────── */
.page-header {
  background: #F4F1E6;
  border-bottom: 2px solid #3D1C10;
  padding: 48px 40px 36px;
}
.page-header-dark {
  background: #3D1C10;
  border-bottom: 2px solid #C5A059;
  padding: 48px 40px 36px;
}

/* ── Typography ──────────────────────────────────────────── */
.font-caslon { font-family: 'Libre Caslon Text', Georgia, serif; }
.font-work   { font-family: 'Work Sans', system-ui, sans-serif; }
.label-caps  { font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 600; font-family: 'Work Sans', sans-serif; }
.pull-quote  { font-family: 'Libre Caslon Text', serif; font-style: italic; line-height: 1.7; }

/* ── Section Headers ─────────────────────────────────────── */
.section-rule  { border-top: 1px solid #D9D4C7; padding-top: 1.75rem; }
.section-title { font-family: 'Libre Caslon Text', serif; font-size: 1.4rem; color: #3D1C10; margin-bottom: 0.2rem; }
.section-subtitle { font-family: 'Work Sans', sans-serif; font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: #514440; }

/* ── Spine Cards (reduced modernity) ────────────────────── */
.spine-card {
  border-left: 3px solid #3D1C10;
  border-radius: 0;
  border: 1px solid #D9D4C7;
  border-left-width: 3px;
  border-left-color: #3D1C10;
  background: #F4F1E6;
  transition: border-color 200ms ease;
}
.spine-card:hover { border-left-color: #C5A059; }
.spine-card-gold  { border-left-color: #C5A059; }
.spine-card-teal  { border-left-color: #17363B; }

/* ── Ledger Rows ─────────────────────────────────────────── */
.ledger-row {
  border-bottom: 1px solid #D9D4C7;
}
.ledger-row:last-child { border-bottom: none; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 1px 7px;
  font-size: 0.62rem;
  font-family: 'Work Sans', sans-serif;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  border-radius: 0;
  font-weight: 600;
  line-height: 1.7;
}
.badge-mahogany { background: #3D1C10;  color: #F4F1E6; }
.badge-gold     { background: #C5A059;  color: #3D1C10; }
.badge-teal     { background: #17363B;  color: #F4F1E6; }
.badge-outline  { border: 1px solid #3D1C10; color: #3D1C10; background: transparent; }
.badge-muted    { border: 1px solid #D9D4C7; color: #514440;  background: transparent; }

/* ── Parchment Texture ───────────────────────────────────── */
.parchment-texture {
  background-image: radial-gradient(circle, rgba(61,28,16,0.05) 1px, transparent 1px);
  background-size: 20px 20px;
}

/* ── Hero ────────────────────────────────────────────────── */
.hero-bg {
  background: linear-gradient(160deg, rgba(61,28,16,0.97) 0%, rgba(23,54,59,0.9) 100%);
  background-color: #1A1A1A;
}
.hero-pattern {
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23C5A059' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* ── Shelf cards (landing page) ──────────────────────────── */
.shelf-card {
  border: 1px solid #D9D4C7;
  border-top: 2px solid #3D1C10;
  background: #F4F1E6;
  text-decoration: none;
  display: block;
  transition: border-top-color 200ms ease, background 200ms ease;
}
.shelf-card:hover {
  border-top-color: #C5A059;
  background: #fcf9ee;
}

/* ── Notice banner ───────────────────────────────────────── */
.notice-banner {
  background-color: #17363B;
  color: #F4F1E6;
  border-left: 3px solid #C5A059;
}

/* ── Ledger table ────────────────────────────────────────── */
.ledger-table { width: 100%; border-collapse: collapse; }
.ledger-table th {
  font-family: 'Work Sans', sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #514440;
  padding: 8px 12px;
  text-align: left;
  border-bottom: 2px solid #3D1C10;
}
.ledger-table td {
  font-size: 0.875rem;
  color: #1A1A1A;
  padding: 10px 12px;
  border-bottom: 1px solid #D9D4C7;
  vertical-align: top;
}
.ledger-table tr:last-child td { border-bottom: none; }

/* ── Science / Knowledge map cards ──────────────────────── */
.science-card {
  border: 1px solid #D9D4C7;
  border-top: 2px solid #C5A059;
  background: #F4F1E6;
  transition: border-top-color 200ms ease;
}
.science-card:hover { border-top-color: #3D1C10; }

/* ── Region cards (orgs page) ────────────────────────────── */
.region-card {
  background: #F4F1E6;
  border-left: 3px solid #3D1C10;
  border: 1px solid #D9D4C7;
  border-left-width: 3px;
  border-left-color: #3D1C10;
}

/* ── Accordion ───────────────────────────────────────────── */
.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 400ms ease;
}
.accordion-content.open { max-height: 3000px; }
.accordion-trigger { cursor: pointer; user-select: none; }
.accordion-trigger:hover { background: rgba(197,160,89,0.05); }

/* ── Filter sidebar ──────────────────────────────────────── */
.filter-check { accent-color: #C5A059; }

/* ── Loading Spinner ─────────────────────────────────────── */
.loading-spinner {
  width: 24px; height: 24px;
  border: 2px solid #D9D4C7;
  border-top-color: #C5A059;
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Icon links ──────────────────────────────────────────── */
.tg-link, .yt-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  font-family: 'Work Sans', sans-serif;
  transition: color 200ms ease;
  text-decoration: none;
}
.tg-link { color: #17363B; }
.tg-link:hover { color: #C5A059; }
.yt-link { color: #3D1C10; }
.yt-link:hover { color: #C5A059; }

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: #F4F1E6; }
::-webkit-scrollbar-thumb { background: #D9D4C7; border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: #C5A059; }
