/* =========================================================================
   Almost Everything Happened First in Egypt — Theme Stylesheet
   Palette: "Papyrus & Lapis" (Light/Sand Warm Modern Theme)
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400;1,700&display=swap');

:root {
  /* System Typography */
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  
  /* Core Palette Tokens */
  --bg-color: #FBF7EE;               /* Warm Papyrus */
  --bg-surface: #F3EBD8;             /* Sandstone Container */
  --bg-surface-alt: #FAF1DF;         /* Warm Sand Highlight */
  --border-color: #E2D5BE;           /* Desert Dust */
  --border-subtle: #EBE1D0;          /* Soft Divider */

  /* Text & Typography Colors */
  --text-main: #2B2B2A;              /* Basalt Charcoal (Body) */
  --text-bold: #141413;              /* Obsidian Black */
  --text-muted: #5C5549;             /* Muted Earth Tone */
  --heading-primary: #0F2137;        /* Deep Egyptian Navy */
  --heading-secondary: #1E4268;      /* Ancient Lapis Blue */

  /* Interactive & Accent Colors */
  --gold: #C28B38;                   /* Desert Ochre Gold */
  --gold-dark: #A6742B;              /* Deep Gold */
  --link: #1A5694;                   /* Egyptian Royal Blue */
  --link-hover: #0D3A6A;             /* Deep Lapis Blue */

  /* Category Themes (Refined for Warm Light Background) */
  --theme-medicine: #0B7A55;
  --theme-engineering: #C45500;
  --theme-science: #1D6FB8;
  --theme-daily: #A32868;
  --theme-food: #A86E00;
  --theme-writing: #5E3EB8;
  --theme-society: #0B7674;
  --theme-default: #C28B38;
  --theme-event: #475569;
  
  --glass-bg: #F3EBD8;
  --glass-border: #E2D5BE;
  --card-shadow: 0 4px 15px rgba(15, 33, 55, 0.05);
  --card-shadow-hover: 0 8px 25px rgba(15, 33, 55, 0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { 
  font-family: var(--font-family);
  color: var(--heading-primary);
  font-weight: 700;
}

h1 { font-size: 26px; line-height: 1.2; }
h2 { font-size: 21px; line-height: 1.25; }
h3 { font-size: 17px; line-height: 1.35; color: var(--heading-secondary); font-weight: 600; }

a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 600;
  transition: color 0.15s ease;
}
a:hover { color: var(--link-hover); }

/* Header & Navigation */
.glass-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  padding: 1.1rem 2rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 2px 8px rgba(15, 33, 55, 0.04);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.glass-header h1 {
  font-size: 1.5rem;
  color: var(--heading-primary);
  margin: 0;
  letter-spacing: 0.02em;
}

.glass-header-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  text-decoration: none;
  color: inherit;
}

.glass-header-logo {
  height: 48px;
  width: auto;
  max-width: 130px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(15, 33, 55, 0.15));
  flex-shrink: 0;
  display: block;
}

.view-switcher {
  display: flex;
  gap: 0.75rem;
  background: var(--bg-color);
  padding: 0.35rem;
  border-radius: 2rem;
  border: 1px solid var(--border-color);
}

.view-switcher button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.4rem 1.25rem;
  border-radius: 1.5rem;
  cursor: pointer;
  font-family: var(--font-family);
  font-weight: 600;
  font-size: 13.5px;
  transition: all 0.2s ease;
}

.view-switcher button:hover { color: var(--heading-primary); }

.view-switcher button.active {
  background: var(--bg-surface);
  color: var(--heading-primary);
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 6px rgba(15, 33, 55, 0.05);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.25rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
}
.legend-item::before {
  content: '';
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  background-color: var(--c);
}

#app-container {
  margin-top: 130px; /* offset for fixed header */
  min-height: calc(100vh - 130px);
  position: relative;
  height: auto;
}

@media (max-width: 600px) {
  .glass-header { padding: 0.75rem 1rem 0.75rem 3.5rem; gap: 0.5rem; }
  .glass-header h1 { font-size: 1.15rem; line-height: 1.2; text-align: left; }
  .glass-header-logo { height: 32px; max-width: 80px; }
  .glass-header-brand { gap: 0.6rem; }
  .legend { gap: 0.4rem 0.6rem; font-size: 0.7rem; }
  .legend-item { gap: 0.25rem; }
  .legend-item::before { width: 6px; height: 6px; }
  #app-container { margin-top: 90px; min-height: calc(100vh - 90px); }
}

.view-section {
  display: none;
  width: 100%;
  height: auto;
  animation: fadeIn 0.4s ease;
}
.view-section.active { display: block; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* View: River Timeline */
.river-container {
  max-width: 900px;
  margin: 0 auto;
  position: relative;
  padding: 3rem 2rem 5rem 2rem;
}

.river-line {
  position: absolute;
  left: 50%;
  top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--border-color), var(--gold), var(--border-color));
  transform: translateX(-50%);
}

.era-divider {
  width: 100%;
  margin: 3.5rem 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  position: relative;
  z-index: 5;
}

.era-label {
  font-size: 0.75rem;
  color: var(--gold-dark);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  padding: 0.4rem 0;
  font-family: var(--font-family);
  font-weight: 700;
}

.era-line {
  width: 100%;
  height: 1px;
  background: linear-gradient(to left, var(--border-color), transparent);
}

.river-node {
  position: relative;
  margin: 2.5rem 0;
  width: 100%;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.river-node.left { justify-content: flex-start; }

.river-card {
  width: 45%;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 1.4rem;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: var(--card-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
}

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

.river-card::before {
  content: '';
  position: absolute;
  top: 50%;
  width: 40px; height: 2px;
  background: var(--c);
  opacity: 0.7;
}

.river-node.left .river-card::before { right: -40px; }
.river-node.right .river-card::before { left: -40px; }

.river-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 3px solid var(--c);
  box-shadow: 0 0 6px rgba(0,0,0,0.15);
  z-index: 2;
  transition: transform 0.2s ease;
}
.river-card:hover ~ .river-dot { transform: translate(-50%, -50%) scale(1.3); }

/* Events */
.river-event-node {
  margin: 1.5rem 0;
}
.river-event-card {
  width: 45%;
  font-size: 0.85rem;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  
  /* Pill styling */
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 0.65rem 1rem;
}
.river-event-card:hover {
  color: var(--heading-primary);
  background: #EFE6D2;
  border-color: var(--border-color);
  box-shadow: 0 4px 12px rgba(15, 33, 55, 0.08);
  transform: translateY(-2px);
}
.river-event-node.left .river-event-card { text-align: right; }
.river-event-node.right .river-event-card { text-align: left; }

.river-event-card::before {
  content: '';
  position: absolute;
  top: 50%;
  width: 40px; height: 1px;
  background: var(--border-color);
}
.river-event-node.left .river-event-card::before { right: -40px; }
.river-event-node.right .river-event-card::before { left: -40px; }

.river-event-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--theme-event);
  z-index: 2;
  transition: transform 0.2s;
}
.river-event-card:hover ~ .river-event-dot {
  transform: translate(-50%, -50%) scale(1.4);
}

@media (max-width: 600px) {
  .river-event-card {
    font-size: 0.75rem;
    line-height: 1.3;
  }
}

.meta { 
  font-size: 0.75rem; 
  color: var(--gold-dark); 
  font-weight: 700;
  text-transform: uppercase; 
  letter-spacing: 1px; 
  margin-bottom: 0.35rem; 
}
.title { 
  font-size: 1.15rem; 
  font-weight: 700;
  color: var(--heading-primary);
  margin-bottom: 0.35rem; 
}
.subtitle { 
  font-size: 0.9rem; 
  color: var(--text-muted); 
  line-height: 1.5; 
}

#bg-visuals {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  text-align: center;
  pointer-events: none;
  opacity: 1;
  color: var(--heading-primary);
  font-family: var(--font-family);
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: baseline;
  gap: 1.5rem;
  background: var(--bg-surface);
  padding: 0.85rem 1.5rem;
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -4px 15px rgba(15, 33, 55, 0.08);
  flex-wrap: wrap;
}

#bg-period {
  font-size: 1.3rem;
  font-weight: 800;
  text-transform: uppercase;
  white-space: normal;
  text-align: center;
  letter-spacing: 2px;
  line-height: 1.2;
  color: #0F2137;
}

#bg-century {
  font-size: 1.05rem;
  font-weight: 600;
  font-style: italic;
  white-space: nowrap;
  line-height: 1;
  color: #1E4268;
}

@media (max-width: 600px) {
  #bg-visuals {
    flex-direction: row;
    align-items: baseline;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem;
  }
  #bg-period {
    font-size: 0.95rem;
    letter-spacing: 1px;
  }
  #bg-century {
    font-size: 0.85rem;
  }
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 33, 55, 0.45);
  backdrop-filter: blur(4px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}
.modal.active { display: flex; animation: fadeIn 0.25s ease; }

.modal-content {
  background: var(--bg-page, #FBF7EE);
  border: 2px solid var(--c, var(--border-color));
  padding: 2.5rem;
  border-radius: 12px;
  max-width: 600px;
  width: 90%;
  position: relative;
  box-shadow: 0 15px 40px rgba(15, 33, 55, 0.2);
}

.close-btn {
  position: absolute;
  top: 1.2rem; right: 1.5rem;
  background: none; border: none;
  color: var(--text-muted);
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
}
.close-btn:hover { color: var(--heading-primary); }

.modal-meta { 
  color: var(--gold-dark); 
  font-size: 0.85rem; 
  font-weight: 700;
  text-transform: uppercase; 
  letter-spacing: 1px; 
  margin-bottom: 0.75rem; 
}
.modal-content h2 { 
  font-size: 1.8rem; 
  margin-bottom: 0.75rem; 
  color: var(--heading-primary);
}
.modal-content p { 
  font-size: 1rem; 
  color: var(--text-main); 
  line-height: 1.6; 
}

.modal-theme {
  display: inline-block;
  margin-top: 1.25rem;
  padding: 0.35rem 0.85rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--c);
  color: #FFFFFF;
}

.modal-link-btn {
  display: inline-block;
  padding: 0.65rem 1.4rem;
  background: var(--gold);
  color: #FFFFFF !important;
  text-decoration: none !important;
  font-weight: 700;
  font-size: 14px;
  border-radius: 6px;
  transition: background 0.15s ease, transform 0.15s ease;
  font-family: var(--font-family);
  box-shadow: 0 2px 6px rgba(194, 139, 56, 0.25);
}
.modal-link-btn:hover {
  background: var(--gold-dark);
  transform: translateY(-1px);
}

/* Hub Container & Pages */
.hub-container {
  max-width: 960px;
  margin: 0 auto 4rem auto;
  padding: 2rem 1.5rem;
  text-align: center;
}

.hub-header {
  margin-bottom: 1.5rem;
}

.hub-tagline {
  color: var(--heading-secondary);
  font-size: 15px;
  font-weight: 500;
  max-width: 860px;
  margin: 0 auto;
  line-height: 1.5;
  white-space: nowrap;
}
@media (max-width: 768px) {
  .hub-tagline {
    white-space: normal;
  }
}

.hub-eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #FFFFFF !important;
  background: #B37D2E !important;
  padding: 6px 14px;
  border-radius: 4px;
  margin-bottom: 1.25rem;
}

.hub-header h2 {
  color: #0F2137;
  font-family: var(--font-family);
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 0.85rem;
  margin-top: 0;
  letter-spacing: -0.02em;
}

.hub-header p {
  color: var(--heading-secondary);
  font-size: 16px;
  font-weight: 500;
  max-width: 650px;
  margin: 0 auto;
  line-height: 1.55;
}

.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  text-align: left;
}

.hub-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.4rem 1.5rem;
  text-decoration: none !important;
  display: flex;
  flex-direction: column;
  box-shadow: var(--card-shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

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

.hub-card-title {
  color: var(--heading-primary);
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.hub-card-title .hub-icon {
  font-family: "Segoe UI Historic", "Noto Sans Egyptian Hieroglyphs", "Gardiner", sans-serif;
  font-size: 1.45rem;
  color: var(--gold-dark);
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
}

.hub-card.hero-card .hub-card-title .hub-icon {
  width: 40px;
  height: 40px;
}

.hub-card-title .hub-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.12));
  transition: transform 0.2s ease;
}

.hub-card:hover .hub-card-title .hub-icon img {
  transform: scale(1.08);
}

.hub-card-desc {
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
}

.hub-card.hero-card {
  grid-column: 1 / -1;
  text-align: center;
  align-items: center;
  padding: 1.8rem 2rem;
  background: var(--bg-surface-alt);
  border: 2px solid var(--gold);
}
.hub-card.hero-card .hub-card-title {
  font-size: 22px;
  color: var(--heading-primary);
}
.hub-card.hero-card .hub-card-desc {
  font-size: 15px;
  max-width: 620px;
}

/* Book Promo Band */
.book-promo-band {
  display: flex;
  gap: 2rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 2rem;
  margin-top: 2.5rem;
  align-items: center;
  text-align: left;
  box-shadow: var(--card-shadow);
}
.book-promo-cover {
  width: 110px;
  height: auto;
  flex-shrink: 0;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 12px rgba(15, 33, 55, 0.12);
}
.book-promo-content {
  display: flex;
  flex-direction: column;
}
.book-promo-content h3 {
  color: var(--heading-primary);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 0.4rem;
  margin-top: 0;
}
.book-promo-content p {
  color: var(--text-main);
  line-height: 1.55;
  margin-bottom: 1.25rem;
  margin-top: 0;
  font-size: 14.5px;
}
.book-promo-btn {
  display: inline-block;
  align-self: flex-start;
  padding: 0.6rem 1.4rem;
  background: var(--gold);
  border: none;
  color: #FFFFFF !important;
  text-decoration: none !important;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s ease, transform 0.15s ease;
  box-shadow: 0 2px 6px rgba(194, 139, 56, 0.25);
}
.book-promo-btn:hover {
  background: var(--gold-dark);
  transform: translateY(-1px);
}

@media (max-width: 650px) {
  .hub-grid { grid-template-columns: 1fr; }
  .book-promo-band {
    flex-direction: column;
    text-align: center;
  }
  .book-promo-btn { align-self: center; }
}

/* Discrete Micro Book Plug / CTA */
.book-plug-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 3.5rem auto 1.5rem auto;
  width: 100%;
  max-width: 600px;
  text-align: center;
}

.book-plug-divider {
  width: 100%;
  height: 1px;
  background-color: var(--border-color, #E8E1D5);
  margin-bottom: 2rem;
}

.book-plug-micro {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.4rem 0.95rem;
  background: var(--bg-surface, #FDFBF7);
  border: 1px solid var(--border-color, #E8E1D5);
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-main, #2C3E50);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.book-plug-micro__thumb {
  width: 22px;
  height: auto;
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.book-plug-micro__text {
  white-space: nowrap;
}

.book-plug-micro__label {
  font-weight: 600;
  color: var(--heading-secondary, #7A6B58);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 0.25rem;
}

.book-plug-micro__text cite {
  font-style: italic;
  font-weight: 600;
}

.book-plug-micro__btn {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  font-size: 11.5px;
  font-weight: 600;
  color: #FFFFFF !important;
  background: var(--gold, #C28B38);
  border-radius: 12px;
  text-decoration: none !important;
  flex-shrink: 0;
  transition: background 0.15s ease, transform 0.1s ease;
  box-shadow: 0 1px 3px rgba(194, 139, 56, 0.25);
}

.book-plug-micro__btn:hover {
  background: var(--gold-dark, #A47228);
  transform: translateY(-1px);
}

@media (max-width: 600px) {
  .book-plug-wrapper {
    margin: 2.5rem auto 1.5rem auto;
    padding: 0 1rem;
    box-sizing: border-box;
  }
  .book-plug-divider {
    margin-bottom: 1.5rem;
  }
  .book-plug-micro {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
    background: #FAF5EA;
    border: 1px solid #E2D5BE;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(15, 33, 55, 0.06);
    width: 100%;
    max-width: 420px;
    box-sizing: border-box;
    text-align: left;
  }
  .book-plug-micro__thumb {
    width: 36px;
    height: auto;
    border-radius: 3px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
  }
  .book-plug-micro__text {
    flex: 1;
    min-width: 0;
    white-space: normal;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
  }
  .book-plug-micro__label {
    font-size: 0.68rem;
    font-weight: 700;
    color: #935E18;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
  }
  .book-plug-micro__text cite {
    font-size: 0.84rem;
    font-weight: 700;
    font-style: normal;
    color: #0F2137;
    line-height: 1.25;
  }
  .book-plug-micro__btn {
    flex-shrink: 0;
    padding: 0.45rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 6px;
    background: #C28B38;
    color: #FFFFFF !important;
    box-shadow: 0 2px 6px rgba(194, 139, 56, 0.25);
    white-space: nowrap;
  }
}

/* Pager / Next-Prev Buttons for Story Pages */
.pager {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 1.25rem;
  margin: 2.5rem 0 1.5rem 0;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border-color);
}
.pager > a {
  flex: 1;
  text-decoration: none !important;
  padding: 0.85rem 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--link);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: row;
  align-items: center;
  box-shadow: var(--card-shadow);
}
.pager__prev { justify-content: flex-start; text-align: left; gap: 0.6rem; }
.pager__next { justify-content: flex-end; text-align: right; gap: 0.6rem; }

.pager > a span:not(.arrow) {
  font-family: var(--font-family);
  color: var(--heading-primary);
  font-size: 14px;
  font-weight: 600;
}
.pager .arrow {
  font-size: 1.2rem;
  color: var(--gold-dark);
  line-height: 1;
}

.pager > a:hover {
  background: #EFE6D2;
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: var(--card-shadow-hover);
}
.pager > a:hover span:not(.arrow) { color: var(--link-hover); }

/* Global App Footer */
.app-footer {
  padding: 1.5rem 1rem;
  text-align: center;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  margin-top: 4rem;
  font-family: var(--font-family);
  font-size: 13px;
  color: var(--text-muted);
}
.app-footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 960px;
  margin: 0 auto;
}
.app-footer a {
  color: var(--heading-secondary);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.15s ease;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.app-footer a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}
@media (max-width: 600px) {
  .app-footer__inner {
    flex-direction: column;
    gap: 0.75rem;
  }
}

/* =========================================================================
   Social Media Share Bar (Compact, Standard Web Style)
   ========================================================================= */
.curator-share-deck {
  margin: 2rem auto 1.25rem auto;
  width: 100%;
  max-width: 720px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.curator-share-bar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  padding: 0.35rem 0.6rem;
}

.share-bar-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted, #7A6F5D);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 0.15rem;
  user-select: none;
}

.share-bar-icons {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: center;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-surface, #FAF1DF);
  border: 1px solid var(--border-color, #E2D7C3);
  color: var(--heading-primary, #0F2137);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  padding: 0;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(15, 33, 55, 0.05);
}

.share-btn .share-icon {
  display: block;
}

.share-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
  text-decoration: none;
}

.share-whatsapp:hover { background: #25D366; color: #FFFFFF; border-color: #25D366; }
.share-sms:hover { background: #34B7F1; color: #FFFFFF; border-color: #34B7F1; }
.share-x:hover { background: #000000; color: #FFFFFF; border-color: #000000; }
.share-linkedin:hover { background: #0A66C2; color: #FFFFFF; border-color: #0A66C2; }
.share-reddit:hover { background: #FF4500; color: #FFFFFF; border-color: #FF4500; }
.share-facebook:hover { background: #1877F2; color: #FFFFFF; border-color: #1877F2; }
.share-instagram:hover { background: #E4405F; color: #FFFFFF; border-color: #E4405F; }
.share-copy:hover { background: var(--gold, #C28B38); color: #FFFFFF; border-color: var(--gold, #C28B38); }
.share-native:hover { background: var(--heading-primary, #0F2137); color: #FFFFFF; border-color: var(--heading-primary, #0F2137); }

.share-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--heading-primary, #0F2137);
  color: #FFFFFF;
  padding: 0.7rem 1.3rem;
  border-radius: 30px;
  font-family: var(--font-family, 'Plus Jakarta Sans', sans-serif);
  font-size: 0.88rem;
  font-weight: 600;
  border: 1px solid var(--gold, #C28B38);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
  z-index: 999999;
  pointer-events: none;
}

.share-toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 600px) {
  .curator-share-deck {
    margin: 1.5rem auto 1rem auto;
  }
  .curator-share-bar {
    gap: 0.45rem;
    padding: 0.25rem;
  }
  .share-bar-icons {
    gap: 0.35rem;
  }
  .share-btn {
    width: 32px;
    height: 32px;
  }
  .share-btn .share-icon {
    width: 14px;
    height: 14px;
  }
}

/* =========================================================================
   Shared Welcome Banner (Hub Reception for Shared Links)
   ========================================================================= */
.shared-welcome-banner {
  background: linear-gradient(135deg, #FAF4E8 0%, #F5ECDA 100%);
  border: 1px solid #D4AF37;
  border-left: 5px solid #C28B38;
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  position: relative;
  box-shadow: 0 4px 18px rgba(15, 33, 55, 0.08);
  animation: fadeInDown 0.35s ease-out forwards;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.shared-welcome-close {
  position: absolute;
  top: 0.75rem;
  right: 0.85rem;
  background: transparent;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  color: #7A7265;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: color 0.2s, background-color 0.2s;
}

.shared-welcome-close:hover {
  color: #0F2137;
  background-color: rgba(194, 139, 56, 0.15);
}

.shared-welcome-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8C5E14;
  background: rgba(194, 139, 56, 0.15);
  padding: 0.25rem 0.65rem;
  border-radius: 1rem;
  margin-bottom: 0.5rem;
}

.shared-welcome-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0F2137;
  margin: 0.25rem 0 0.4rem 0;
  line-height: 1.35;
}

.shared-welcome-desc {
  font-size: 0.95rem;
  color: #3D4853;
  margin: 0 0 0.85rem 0;
  line-height: 1.5;
}

.shared-welcome-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #C28B38;
  color: #ffffff !important;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.45rem 1rem;
  border-radius: 1.5rem;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(194, 139, 56, 0.3);
  transition: background-color 0.2s, transform 0.2s;
}

.shared-welcome-btn:hover {
  background: #A67328;
  transform: translateY(-1px);
}

/* =========================================================================
   Era Transition Milestone (Interactive Timeline)
   ========================================================================= */
.era-transition-milestone {
  position: relative;
  width: 100%;
  max-width: 580px;
  margin: 4.5rem auto;
  padding: 1.5rem 1.75rem;
  background: rgba(12, 26, 44, 0.92);
  border: 1px solid rgba(212, 175, 55, 0.6);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), 0 0 24px rgba(212, 175, 55, 0.15);
  text-align: center;
  backdrop-filter: blur(12px);
  z-index: 10;
  box-sizing: border-box;
}

.era-transition-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #FFDF79;
  background: rgba(194, 139, 56, 0.22);
  border: 1px solid rgba(212, 175, 55, 0.45);
  padding: 0.35rem 0.9rem;
  border-radius: 2rem;
  margin-bottom: 0.75rem;
}

.era-transition-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  margin-bottom: 0.65rem;
  flex-wrap: wrap;
}

.era-transition-from {
  font-size: 1.05rem;
  color: #B2C4D8;
  font-weight: 600;
}

.era-transition-arrow {
  color: #D4AF37;
  font-size: 1.25rem;
  font-weight: 700;
}

.era-transition-to {
  font-size: 1.2rem;
  color: #FFFFFF;
  font-weight: 700;
  text-shadow: 0 1px 8px rgba(212, 175, 55, 0.35);
}

.era-transition-desc {
  font-size: 0.88rem;
  line-height: 1.5;
  color: #D0DBE5;
  margin: 0 0 1rem 0;
}

.era-transition-actions {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

.era-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid rgba(212, 175, 55, 0.45);
  color: #F8E2A2;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border-radius: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.era-share-btn:hover {
  background: #C28B38;
  color: #ffffff;
  border-color: #C28B38;
  transform: translateY(-1px);
}

/* =========================================================================
   Quick Share Buttons on Cards & Modal Share Decks
   ========================================================================= */
.card-quick-share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #FAF4E8;
  border: 1px solid #D4AF37;
  color: #8C5E14;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  flex-shrink: 0;
}

.card-quick-share-btn:hover {
  background: #C28B38;
  color: #ffffff;
  transform: scale(1.1);
}

.card-quick-share-btn svg {
  width: 14px;
  height: 14px;
}

.inline-share-deck {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(212, 175, 55, 0.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.inline-share-deck .share-label {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #C28B38;
}

.inline-share-icons {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  flex-wrap: wrap;
}

.inline-share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #FAF6EE;
  border: 1px solid #E2D7C3;
  color: #0F2137;
  text-decoration: none;
  transition: all 0.2s ease;
  padding: 0;
  cursor: pointer;
}

.inline-share-btn:hover {
  transform: translateY(-2px);
  border-color: #C28B38;
}

.inline-share-btn.share-x:hover { background: #000000; color: #ffffff; }
.inline-share-btn.share-whatsapp:hover { background: #25D366; color: #ffffff; }
.inline-share-btn.share-facebook:hover { background: #1877F2; color: #ffffff; }
.inline-share-btn.share-linkedin:hover { background: #0A66C2; color: #ffffff; }
.inline-share-btn.share-reddit:hover { background: #FF4500; color: #ffffff; }
.inline-share-btn.share-sms:hover { background: #34B7F1; color: #ffffff; }
.inline-share-btn.share-instagram:hover { background: #E4405F; color: #ffffff; }
.inline-share-btn.share-copy:hover { background: #C28B38; color: #ffffff; }

@media (max-width: 640px) {
  .era-transition-milestone {
    margin: 3rem 0.75rem;
    padding: 1.25rem 1rem;
  }
  .era-transition-from,
  .era-transition-to {
    font-size: 0.95rem;
  }
  .inline-share-deck {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}

/* =========================================================================
   Global Print Styles
   ========================================================================= */
@media print {
  .app-footer,
  .site-footer,
  footer,
  .site-header,
  .glass-header,
  .nav-toggle-btn,
  #timeline-navigator,
  .hide-on-print,
  .print-controls,
  .action-bar,
  .print-btn-container,
  .buy-btn-container,
  .contact-router,
  .pager,
  .btn,
  hr.rule,
  .curator-share-deck,
  .share-toast {
    display: none !important;
    visibility: hidden !important;
  }
}


/* Quick Browse Disclosure inside Timeline Hero Card */
.timeline-quick-browse {
  margin-top: 1.25rem;
  width: 100%;
  border-top: 1px solid var(--border-color);
  padding-top: 0.85rem;
  text-align: left;
}
.timeline-quick-browse-toggle {
  font-family: var(--font-family);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--heading-secondary, #5C6B73);
  cursor: pointer;
  text-align: center;
  list-style: none;
  transition: color 0.15s ease;
  user-select: none;
  padding: 0.25rem;
}
.timeline-quick-browse-toggle::-webkit-details-marker {
  display: none;
}
.timeline-quick-browse-toggle:hover {
  color: var(--gold-dark, #A6742B);
}
.timeline-browse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-top: 1.25rem;
  padding: 1rem 0.5rem 0.5rem;
  border-top: 1px dashed var(--border-color);
}
.timeline-browse-group h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold-dark);
  margin: 0 0 0.5rem;
  font-weight: 700;
}
.timeline-browse-group ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.timeline-browse-group li {
  margin-bottom: 0.35rem;
}.timeline-browse-group a {
  font-size: 0.84rem;
  color: var(--text-main);
  text-decoration: none;
  transition: color 0.15s ease;
}
.timeline-browse-group a:hover {
  color: var(--gold-dark);
  text-decoration: underline;
}

/* Universal Modal Overlay Elevation & Floating Nav Protection */
body.modal-open {
  overflow: hidden !important;
}

.word-modal-backdrop,
.pharaoh-modal-backdrop,
.deity-modal,
.modal-backdrop,
.modal-overlay {
  z-index: 20000 !important;
}

.word-modal-card,
.pharaoh-modal-card,
.deity-modal-content,
.modal-dialog {
  z-index: 20001 !important;
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body.modal-open .nav-toggle-btn {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}
