@import url("https://fonts.googleapis.com/css2?family=Aref+Ruqaa+Ink:wght@400;700&family=Cairo:wght@400;500;600;700;800&display=swap");

:root {
  --navy-900: #08172f;
  --navy-800: #102748;
  --navy-700: #1a3a63;
  --gold-500: #c8a867;
  --gold-400: #ddc08f;
  --gold-200: #f3e8d4;
  --white: #ffffff;
  --gray-100: #f5f7fb;
  --gray-200: #e8edf5;
  --text-main: #102748;
  --text-muted: #5f6f89;
  --radius-lg: 20px;
  --radius-md: 14px;
  --shadow-soft: 0 20px 40px rgba(16, 39, 72, 0.08);
  --shadow-card: 0 14px 28px rgba(16, 39, 72, 0.1);
  --transition: 0.32s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Cairo", sans-serif;
  direction: rtl;
  color: var(--text-main);
  background: var(--white);
  line-height: 1.8;
  overflow-x: hidden;
  position: relative;
  text-rendering: optimizeLegibility;
}

/* Performance: skip off-screen rendering for long pages */
.diwan-page .poem-card,
.about-page .figure-detail,
.home-page .card {
  content-visibility: auto;
  contain-intrinsic-size: 360px;
}

body.nav-open {
  overflow: hidden;
}

h1,
h2,
h3,
h4 {
  font-family: "Cairo", sans-serif;
  line-height: 1.35;
}

a {
  text-decoration: none;
  color: inherit;
}

.container {
  width: min(1180px, 92%);
  margin-inline: auto;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(72px);
  z-index: -1;
}

.orb-a {
  top: -130px;
  right: -100px;
  width: 360px;
  height: 360px;
  background: rgba(200, 168, 103, 0.24);
}

.orb-b {
  top: 340px;
  left: -140px;
  width: 430px;
  height: 430px;
  background: rgba(16, 39, 72, 0.14);
}

.site-navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(16, 39, 72, 0.08);
  box-shadow: 0 8px 22px rgba(9, 26, 53, 0.04);
}

.site-navbar.scrolled {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 12px 24px rgba(9, 26, 53, 0.08);
}

.nav-container {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: relative;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding-block: 6px;
}

.brand-logo-wrap {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28);
}

.brand-logo {
  width: 100%;
  height: 100%;
  display: block;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--white);
  font-weight: 800;
  font-size: 1.3rem;
  background: linear-gradient(150deg, var(--navy-700), var(--navy-900));
  box-shadow: var(--shadow-card);
}

.brand-text {
  display: grid;
  line-height: 1.3;
}

.brand-text strong {
  font-size: 1.1rem;
}

/* Brand name in navbar: traditional Arabic style */
.site-navbar .brand-text strong {
  font-family: "Aref Ruqaa Ink", "Aref Ruqaa", "Cairo", serif;
  font-weight: 700;
  letter-spacing: 0;
  color: #5a3b1f;
}

/* Navbar logo circle */
.site-navbar .brand-logo-wrap {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle at 30% 30%, #fff7e8, #f2e0bf 70%);
  border: 1.5px solid rgba(166, 119, 69, 0.4);
  padding: 2px;
  box-shadow:
    0 10px 24px rgba(88, 61, 35, 0.2),
    inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

.site-navbar .brand-logo {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: transparent;
  transform: scale(1.03);
}

.brand-text small {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.nav-menu {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: nowrap;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.theme-toggle {
  min-height: 40px;
  min-width: 72px;
  padding: 0.45rem 0.8rem;
  border-radius: 10px;
  border: 1px solid rgba(169, 188, 219, 0.34);
  background: #101d33;
  color: #dce7fb;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.theme-toggle:hover {
  transform: translateY(-2px);
  background: #1b355a;
}

.nav-menu a {
  padding: 0.54rem 0.8rem;
  border-radius: 10px;
  font-size: 0.93rem;
  font-weight: 700;
  transition: var(--transition);
  position: relative;
  white-space: nowrap;
}

.nav-menu a:hover,
.nav-menu a.active {
  background: var(--gray-100);
  color: var(--navy-700);
}

.nav-menu a::after {
  content: "";
  position: absolute;
  right: 12px;
  left: 12px;
  bottom: 4px;
  height: 2px;
  border-radius: 99px;
  background: linear-gradient(90deg, transparent, var(--gold-500), transparent);
  opacity: 0;
  transform: scaleX(0.5);
  transition: var(--transition);
}

.nav-menu a:hover::after,
.nav-menu a.active::after {
  opacity: 1;
  transform: scaleX(1);
}

.menu-toggle {
  display: none;
  border: none;
  background: transparent;
  width: 44px;
  height: 44px;
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  margin: 5px auto;
  background: var(--navy-900);
  transition: var(--transition);
  transform-origin: center;
}

.menu-toggle.is-open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.menu-toggle.is-open span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.is-open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.hero {
  background: linear-gradient(140deg, #091a35 0%, #12305a 45%, #1b4474 100%);
  color: var(--white);
  position: relative;
  overflow: hidden;
  padding: 5rem 0;
  min-height: 66vh;
  display: grid;
  align-items: center;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.25;
}

.hero-grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 2rem;
  align-items: center;
}

.hero-grid-single {
  grid-template-columns: 1fr;
  max-width: 920px;
}

.hero-pill {
  display: inline-block;
  margin-bottom: 0.8rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-weight: 700;
  color: var(--gold-200);
}

.hero h1 {
  font-size: clamp(2rem, 4.6vw, 3.7rem);
  margin-bottom: 0.9rem;
}

.hero p {
  color: #d8e3f2;
}

.hero-actions {
  margin-top: 1.6rem;
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.7rem 1.3rem;
  border-radius: 12px;
  font-weight: 800;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn:hover {
  transform: translateY(-3px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold-500), #ab8646);
  color: #1d1d1d;
  box-shadow: 0 12px 22px rgba(200, 168, 103, 0.35);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: var(--white);
}

.hero-panel {
  display: grid;
  gap: 0.8rem;
}

.stat-box {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  padding: 0.8rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(8px);
}

.stat-box strong {
  color: var(--gold-200);
  font-size: 1.2rem;
}

.page-hero {
  background: linear-gradient(145deg, var(--navy-900), var(--navy-700));
  color: var(--white);
  padding: 3.4rem 0;
  text-align: center;
}

.page-hero p {
  color: #d4deef;
}

.section {
  padding: 4.8rem 0;
}

.section-soft {
  background: var(--gray-100);
}

.section-head {
  margin-bottom: 1.8rem;
  text-align: center;
}

.section-head h2 {
  font-size: clamp(1.5rem, 3vw, 2.4rem);
}

.eyebrow {
  color: var(--gold-500);
  font-weight: 800;
  margin-bottom: 0.25rem;
}

.cards {
  display: grid;
  gap: 1rem;
}

.three-cols {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card {
  background: var(--white);
  border: 1px solid rgba(16, 39, 72, 0.08);
  border-radius: var(--radius-lg);
  padding: 1.3rem;
  box-shadow: var(--shadow-soft);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 1rem;
  left: 1rem;
  height: 3px;
  border-radius: 20px;
  background: linear-gradient(90deg,
      rgba(200, 168, 103, 0),
      rgba(200, 168, 103, 0.85),
      rgba(200, 168, 103, 0));
  opacity: 0;
  transition: var(--transition);
}

.card:hover {
  transform: translateY(-7px);
  box-shadow: 0 22px 34px rgba(16, 39, 72, 0.14);
}

.card:hover::before {
  opacity: 1;
}

.card h3 {
  margin-bottom: 0.45rem;
}

.card p {
  color: var(--text-muted);
}

.chip {
  display: inline-block;
  margin-bottom: 0.6rem;
  padding: 0.26rem 0.62rem;
  border-radius: 999px;
  background: rgba(200, 168, 103, 0.2);
  color: #84642d;
  font-size: 0.82rem;
  font-weight: 700;
}

.meta {
  color: var(--gold-500);
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.tree-preview {
  background: var(--white);
  border: 1px solid rgba(16, 39, 72, 0.1);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
}

.tree-row {
  display: flex;
  justify-content: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.tree-row span {
  padding: 0.55rem 1rem;
  border-radius: 999px;
  background: linear-gradient(145deg, #f8fafd, #eef3f9);
  border: 1px solid rgba(16, 39, 72, 0.08);
  font-weight: 700;
}

.tree-line {
  width: 3px;
  height: 24px;
  margin: 0.45rem auto;
  border-radius: 999px;
  background: linear-gradient(var(--gold-500), transparent);
}

.tree-cta {
  margin: 1rem auto 0;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.gallery-card {
  min-height: 190px;
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  transition: var(--transition);
  background: linear-gradient(160deg, #1b3c67, #224b7f, #c8a867);
}

.gallery-card:nth-child(2n) {
  background: linear-gradient(160deg, #102748, #1b3d68, #d5b77f);
}

.gallery-card:nth-child(3n) {
  background: linear-gradient(160deg, #0d2140, #2a568e, #c79f5e);
}

.gallery-card:hover {
  transform: translateY(-6px) scale(1.01);
}

.gallery-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top,
      rgba(8, 23, 47, 0.8),
      rgba(8, 23, 47, 0.15));
  opacity: 0.75;
  transition: var(--transition);
}

.gallery-card:hover::before {
  opacity: 0.55;
}

.gallery-card span {
  position: absolute;
  right: 12px;
  bottom: 12px;
  color: var(--white);
  font-weight: 700;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  padding: 0.3rem 0.55rem;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.filter-btn {
  border: 1px solid rgba(16, 39, 72, 0.2);
  background: var(--white);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--navy-800);
  color: var(--white);
}

.split-layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1rem;
}

.stack-cards {
  display: grid;
  gap: 1rem;
}

.clean-list {
  list-style: none;
  display: grid;
  gap: 0.45rem;
}

.clean-list li {
  color: var(--text-muted);
}

.quote-divider {
  margin: 0.75rem 0;
  text-align: center;
  color: var(--gold-500);
  opacity: 0.7;
}

.quote-divider::before,
.quote-divider::after {
  content: "";
  display: inline-block;
  width: 26%;
  height: 1px;
  vertical-align: middle;
  margin: 0 0.6rem;
  background: linear-gradient(90deg, transparent, var(--gold-500), transparent);
  opacity: 0.6;
}

.related-lineages-section .section-lead {
  max-width: 860px;
  line-height: 1.85;
}

.related-lineages-section .history-poem {
  display: grid;
  gap: 0.85rem;
}

.related-lineages-section .history-poem blockquote {
  border-right-color: var(--gold-500);
  border: 1px solid rgba(176, 136, 75, 0.25);
  background: linear-gradient(145deg,
      rgba(255, 255, 255, 0.08),
      rgba(255, 255, 255, 0.02));
  box-shadow: 0 12px 26px rgba(16, 39, 72, 0.12);
}

.lineage-branch-tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.75rem;
  padding: 0;
}

.lineage-branch-tags li {
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(176, 136, 75, 0.32);
  background: rgba(255, 255, 255, 0.18);
  font-weight: 700;
}

.related-lineages-section .lineage-branches-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.related-lineages-section .lineage-families-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.related-lineages-section .lineage-card--wide {
  grid-column: 1 / -1;
}

.related-lineages-section .lineage-columns {
  display: block;
  columns: 2;
  column-gap: 1.6rem;
}

.related-lineages-section .lineage-columns li {
  break-inside: avoid;
}

@media (max-width: 900px) {

  .related-lineages-section .lineage-branches-grid,
  .related-lineages-section .lineage-families-grid {
    grid-template-columns: 1fr;
  }

  .related-lineages-section .lineage-columns {
    columns: 1;
  }

  .quote-divider::before,
  .quote-divider::after {
    width: 18%;
  }
}

.about-page .card {
  max-width: 980px;
  margin: 0 auto;
}

.about-page .figures-names {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem 1.2rem;
  margin: 0 auto 1.6rem;
  max-width: 980px;
  padding: 0;
}

.about-page .figures-names li {
  border-radius: 999px;
  border: 1px solid rgba(150, 110, 66, 0.28);
  background: #f6edd8;
  font-weight: 700;
  text-align: center;
}

.about-page .figures-names a {
  display: block;
  padding: 0.65rem 0.9rem;
  color: inherit;
  text-decoration: none;
}

.about-page .figures-names a:focus-visible {
  outline: 2px solid rgba(150, 110, 66, 0.55);
  outline-offset: 2px;
}

.about-page .figure-detail {
  max-width: 980px;
  margin: 0 auto 1.4rem;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  scroll-margin-top: 120px;
}

.about-page .figure-detail+.figure-detail {
  padding-top: 0;
  border-top: 0;
}

.about-page .card h3 {
  margin-top: 1.2rem;
}

.about-page .card p {
  line-height: 1.9;
}

.field {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.8rem;
}

.field label {
  font-weight: 700;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid rgba(16, 39, 72, 0.2);
  border-radius: 10px;
  padding: 0.68rem 0.75rem;
  font-family: inherit;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--gold-500);
  box-shadow: 0 0 0 3px rgba(200, 168, 103, 0.2);
}

.page-404-card {
  max-width: 640px;
  margin-inline: auto;
  text-align: center;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--gold-500);
  outline-offset: 2px;
}

.form-status {
  margin-top: 0.7rem;
  font-weight: 700;
  color: #218a52;
}

.site-footer {
  margin-top: 2rem;
  background: linear-gradient(160deg, #0a1b36, #123058);
  color: #dde6f5;
  padding-top: 3rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.5rem;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.5rem;
}

.site-footer h3,
.site-footer h4 {
  color: var(--gold-200);
  margin-bottom: 0.5rem;
}

.site-footer ul {
  list-style: none;
  display: grid;
  gap: 0.35rem;
}

.site-footer p,
.site-footer li,
.site-footer a {
  color: #d2dcef;
}

.site-footer a:hover {
  color: var(--white);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.8rem 1.4rem;
  text-align: right;
  margin-top: 1.8rem;
  padding: 1rem 0 1.2rem;
  padding-inline-start: 1.6rem;
  padding-inline-end: 72px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  color: #b8c7e0;
}

.footer-bottom p {
  margin: 0;
  min-width: 0;
}

.dev-signature {
  margin-top: 0;
  font-weight: 600;
  font-size: 0.85rem;
  color: #c6b198;
  opacity: 0.75;
  overflow-wrap: anywhere;
  max-width: 100%;
}

.dev-signature a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dashed rgba(191, 174, 150, 0.5);
  padding-bottom: 1px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, filter 0.2s ease;
}

.dev-signature a:hover {
  color: #ffffff;
  border-bottom-color: rgba(255, 255, 255, 0.85);
  filter: drop-shadow(0 1px 0 rgba(90, 60, 30, 0.35));
}

@media (max-width: 720px) {
  .footer-bottom {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding-inline-end: 0;
  }
}

.reveal {
  opacity: 0;
  transform: translate3d(0, 22px, 0);
  will-change: opacity, transform;
  transition:
    opacity 0.7s ease,
    transform 0.7s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.delay-1 {
  transition-delay: 0.12s;
}

.delay-2 {
  transition-delay: 0.22s;
}

.delay-3 {
  transition-delay: 0.32s;
}

@media (max-width: 1100px) {

  .hero-grid,
  .split-layout {
    grid-template-columns: 1fr;
  }

  .three-cols {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .menu-toggle {
    display: block;
  }

  .nav-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    left: 0;
    background: var(--white);
    border: 1px solid rgba(16, 39, 72, 0.12);
    border-radius: 14px;
    box-shadow: var(--shadow-soft);
    display: grid;
    padding: 0.6rem;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
    max-height: calc(100vh - 100px);
    overflow-y: auto;
  }

  .nav-menu.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .nav-menu a {
    display: block;
    padding: 0.68rem;
  }

  .theme-toggle {
    min-width: 64px;
    min-height: 38px;
    font-size: 0.88rem;
  }

  .three-cols,
  .gallery-grid,
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .about-page .figures-names {
    grid-template-columns: 1fr;
  }

  .section {
    padding: 3.8rem 0;
  }

  * {
    transition-duration: 0.12s !important;
  }

  .hero {
    min-height: 56vh;
  }
}

@media (max-width: 560px) {
  .nav-container {
    min-height: 74px;
  }

  .brand-text strong {
    font-size: 1rem;
  }

  .brand-text small {
    display: none;
  }

  .hero h1 {
    font-size: clamp(1.75rem, 7vw, 2.3rem);
  }

  .card {
    padding: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 900px) {
  html {
    scroll-behavior: auto !important;
  }
}

/* Forced Dark Theme */
body {
  background: #060b16;
  color: #e5ecf7;
}

.orb-a {
  background: rgba(200, 168, 103, 0.12);
}

.orb-b {
  background: rgba(50, 90, 148, 0.18);
}

.site-navbar {
  background: rgba(7, 13, 25, 0.88);
  border-bottom: 1px solid rgba(169, 188, 219, 0.12);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

.site-navbar.scrolled {
  background: rgba(6, 11, 22, 0.95);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.52);
}

.brand-text small {
  color: #a8b8d2;
}

.nav-menu a {
  color: #dce7fb;
}

.nav-menu a:hover,
.nav-menu a.active {
  background: #15233a;
  color: #ffffff;
}

.menu-toggle span {
  background: #dce7fb;
}

.hero {
  background: linear-gradient(145deg, #050a15 0%, #0c1e3a 46%, #133260 100%);
}

.page-hero {
  background: linear-gradient(145deg, #081125, #12294f);
}

.page-hero p,
.hero p {
  color: #bfd0eb;
}

.section-soft {
  background: #0a1324;
}

.card,
.tree-preview {
  background: #0f1a2d;
  border: 1px solid rgba(159, 182, 217, 0.2);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.35);
}

.card:hover {
  box-shadow: 0 22px 36px rgba(0, 0, 0, 0.42);
}

.card p,
.clean-list li {
  color: #b2c3df;
}

.tree-row span {
  background: linear-gradient(145deg, #111f35, #152741);
  border: 1px solid rgba(159, 182, 217, 0.2);
  color: #e5ecf7;
}

.filter-btn {
  border: 1px solid rgba(165, 188, 222, 0.34);
  background: #101d33;
  color: #dce7fb;
}

.filter-btn:hover,
.filter-btn.active {
  background: #1b355a;
}

.field input,
.field textarea {
  background: #0d1728;
  border: 1px solid rgba(169, 188, 219, 0.28);
  color: #e5ecf7;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #8fa2c4;
}

.site-footer {
  background: linear-gradient(165deg, #050a15, #0b1f3d);
}

@media (max-width: 860px) {
  .nav-menu {
    background: #0b1527;
    border: 1px solid rgba(159, 182, 217, 0.2);
  }

  .about-page #related-lineages .lineage-branches-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Light Theme (second mode) */
body.theme-light {
  background: var(--white);
  color: var(--text-main);
}

body.theme-light .orb-a {
  background: rgba(200, 168, 103, 0.24);
}

body.theme-light .orb-b {
  background: rgba(16, 39, 72, 0.14);
}

body.theme-light .site-navbar {
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid rgba(16, 39, 72, 0.08);
  box-shadow: 0 8px 22px rgba(9, 26, 53, 0.04);
}

body.theme-light .site-navbar.scrolled {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 12px 24px rgba(9, 26, 53, 0.08);
}

body.theme-light .brand-text small {
  color: var(--text-muted);
}

body.theme-light .nav-menu a {
  color: var(--text-main);
}

body.theme-light .nav-menu a:hover,
body.theme-light .nav-menu a.active {
  background: var(--gray-100);
  color: var(--navy-700);
}

body.theme-light .menu-toggle span {
  background: var(--navy-900);
}

body.theme-light .theme-toggle {
  border: 1px solid rgba(16, 39, 72, 0.2);
  background: var(--white);
  color: var(--text-main);
}

body.theme-light .theme-toggle:hover {
  background: var(--gray-100);
}

body.theme-light .hero {
  background: linear-gradient(140deg, #091a35 0%, #12305a 45%, #1b4474 100%);
}

body.theme-light .page-hero {
  background: linear-gradient(145deg, var(--navy-900), var(--navy-700));
}

body.theme-light .hero p {
  color: #d8e3f2;
}

body.theme-light .page-hero p {
  color: #d4deef;
}

body.theme-light .section-soft {
  background: var(--gray-100);
}

body.theme-light .card,
body.theme-light .tree-preview {
  background: var(--white);
  border: 1px solid rgba(16, 39, 72, 0.1);
  box-shadow: var(--shadow-soft);
}

body.theme-light .card:hover {
  box-shadow: 0 22px 34px rgba(16, 39, 72, 0.14);
}

body.theme-light .card p,
body.theme-light .clean-list li {
  color: var(--text-muted);
}

body.theme-light .tree-row span {
  background: linear-gradient(145deg, #f8fafd, #eef3f9);
  border: 1px solid rgba(16, 39, 72, 0.08);
  color: var(--text-main);
}

body.theme-light .filter-btn {
  border: 1px solid rgba(16, 39, 72, 0.2);
  background: var(--white);
  color: var(--text-main);
}

body.theme-light .filter-btn:hover,
body.theme-light .filter-btn.active {
  background: var(--navy-800);
  color: var(--white);
}

body.theme-light .field input,
body.theme-light .field textarea {
  background: var(--white);
  border: 1px solid rgba(16, 39, 72, 0.2);
  color: var(--text-main);
}

body.theme-light .field input::placeholder,
body.theme-light .field textarea::placeholder {
  color: #7b8ea9;
}

body.theme-light .site-footer {
  background: linear-gradient(160deg, #0a1b36, #123058);
}

@media (max-width: 860px) {
  body.theme-light .nav-menu {
    background: var(--white);
    border: 1px solid rgba(16, 39, 72, 0.12);
  }
}

/* Color Tune */
body:not(.theme-light) {
  background: #070d1a;
  color: #eaf0ff;
}

body:not(.theme-light) .orb-a {
  background: rgba(212, 174, 108, 0.1);
}

body:not(.theme-light) .orb-b {
  background: rgba(71, 122, 192, 0.14);
}

body:not(.theme-light) .site-navbar {
  background: rgba(10, 18, 34, 0.9);
  border-bottom: 1px solid rgba(166, 185, 216, 0.14);
}

body:not(.theme-light) .site-navbar.scrolled {
  background: rgba(8, 15, 30, 0.96);
}

body:not(.theme-light) .nav-menu a {
  color: #e7efff;
}

body:not(.theme-light) .nav-menu a:hover,
body:not(.theme-light) .nav-menu a.active {
  background: #1a2a46;
}

body:not(.theme-light) .theme-toggle {
  background: #13233d;
  border-color: rgba(180, 199, 232, 0.36);
  color: #f4f8ff;
}

body:not(.theme-light) .theme-toggle:hover {
  background: #1f3961;
}

body:not(.theme-light) .hero {
  background: linear-gradient(145deg, #060d1b 0%, #102544 52%, #17406e 100%);
}

body:not(.theme-light) .page-hero {
  background: linear-gradient(145deg, #0a1428, #17365f);
}

body:not(.theme-light) .section-soft {
  background: #0c162a;
}

body:not(.theme-light) .card,
body:not(.theme-light) .tree-preview {
  background: #101c32;
  border-color: rgba(165, 186, 221, 0.2);
}

body:not(.theme-light) .card p,
body:not(.theme-light) .clean-list li {
  color: #b7c7e2;
}

body:not(.theme-light) .chip {
  background: rgba(214, 177, 110, 0.22);
  color: #f3d9a5;
}

body:not(.theme-light) .meta {
  color: #dbbc7e;
}

body:not(.theme-light) .btn-primary {
  background: linear-gradient(135deg, #d9b874, #b8863f);
  color: #1f1709;
}

body:not(.theme-light) .btn-outline {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.26);
}

body:not(.theme-light) .filter-btn {
  background: #13223c;
  border-color: rgba(173, 194, 227, 0.34);
}

body:not(.theme-light) .filter-btn:hover,
body:not(.theme-light) .filter-btn.active {
  background: #234676;
}

body:not(.theme-light) .field input,
body:not(.theme-light) .field textarea {
  background: #0e1930;
  border-color: rgba(171, 191, 223, 0.28);
}

body:not(.theme-light) .site-footer {
  background: linear-gradient(165deg, #060d1a, #10294d);
}

body.theme-light {
  background: #f4f7fc;
  color: #102747;
}

body.theme-light .orb-a {
  background: rgba(206, 170, 105, 0.2);
}

body.theme-light .orb-b {
  background: rgba(72, 118, 185, 0.12);
}

body.theme-light .site-navbar {
  background: rgba(248, 251, 255, 0.94);
  border-bottom: 1px solid rgba(16, 39, 72, 0.1);
}

body.theme-light .site-navbar.scrolled {
  background: rgba(252, 254, 255, 0.98);
}

body.theme-light .nav-menu a {
  color: #133059;
}

body.theme-light .nav-menu a:hover,
body.theme-light .nav-menu a.active {
  background: #e9f0fb;
  color: #0f2748;
}

body.theme-light .theme-toggle {
  background: #ffffff;
  border-color: rgba(18, 47, 88, 0.22);
  color: #133059;
}

body.theme-light .theme-toggle:hover {
  background: #eef4fc;
}

body.theme-light .section-soft {
  background: #ecf2fa;
}

body.theme-light .card,
body.theme-light .tree-preview {
  border-color: rgba(17, 43, 80, 0.1);
  box-shadow: 0 16px 30px rgba(16, 39, 72, 0.09);
}

body.theme-light .card p,
body.theme-light .clean-list li {
  color: #607494;
}

body.theme-light .filter-btn {
  background: #ffffff;
  border-color: rgba(17, 43, 80, 0.2);
  color: #113056;
}

body.theme-light .filter-btn:hover,
body.theme-light .filter-btn.active {
  background: #173861;
}

/* Modern Premium Polish */
.site-navbar::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 1px;
  background: linear-gradient(90deg,
      transparent,
      rgba(220, 186, 119, 0.55),
      transparent);
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  width: 580px;
  height: 580px;
  left: -180px;
  top: -220px;
  border-radius: 50%;
  background: radial-gradient(circle,
      rgba(214, 176, 114, 0.18) 0%,
      rgba(214, 176, 114, 0.06) 36%,
      transparent 70%);
  pointer-events: none;
}

.hero h1 {
  text-shadow: 0 8px 26px rgba(0, 0, 0, 0.28);
}

.hero-pill {
  backdrop-filter: blur(8px);
}

.btn-primary {
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg,
      transparent 25%,
      rgba(255, 255, 255, 0.35) 48%,
      transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.6s ease;
}

.btn-primary:hover::after {
  transform: translateX(120%);
}

.section-head h2 {
  position: relative;
  display: inline-block;
  padding-bottom: 0.45rem;
}

.section-head h2::after {
  content: "";
  position: absolute;
  right: 8%;
  left: 8%;
  bottom: 0;
  height: 3px;
  border-radius: 99px;
  background: linear-gradient(90deg,
      transparent,
      rgba(217, 184, 116, 0.85),
      transparent);
}

.stat-box,
.card,
.gallery-card,
.tree-preview {
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease,
    border-color 0.3s ease;
}

.stat-box:hover {
  transform: translateY(-4px);
  border-color: rgba(217, 184, 116, 0.45);
}

.card:hover {
  border-color: rgba(217, 184, 116, 0.45);
}

.gallery-card {
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.gallery-card:hover {
  box-shadow: 0 20px 34px rgba(0, 0, 0, 0.34);
}

body.theme-light .gallery-card {
  border-color: rgba(12, 35, 66, 0.22);
}

body.theme-light .card:hover {
  border-color: rgba(183, 134, 63, 0.4);
}

@media (max-width: 860px) {
  .brand-logo-wrap {
    width: 60px;
    height: 60px;
  }

  .hero::after {
    width: 420px;
    height: 420px;
    left: -150px;
    top: -160px;
  }
}

/* ==================== LUXURIOUS PROFESSIONAL OVERRIDE ==================== */
:root {
  --primary: #2c1810;
  --gold: #d4af8f;
  --light-gold: #e8d4c4;
  --dark: #1a0f0a;
  --white: #f5f1e8;
  --accent: #8b7355;
  --light: #c9a877;
  --shadow: rgba(0, 0, 0, 0.15);
  --transition-lux: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

body,
body.theme-light {
  font-family: "Cairo", sans-serif;
  font-weight: 300;
  letter-spacing: 0.5px;
  line-height: 1.8;
  color: #3d3026;
  background: linear-gradient(135deg, #f5f1e8 0%, #ede8dd 100%);
}

h1,
h2,
h3,
h4 {
  font-family: "Cairo", sans-serif;
  letter-spacing: 1px;
  font-weight: 700;
}

.site-navbar {
  background: linear-gradient(180deg, #2c1810 0%, #3d2817 100%);
  border-bottom: 3px solid var(--gold);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.site-navbar.scrolled {
  background: linear-gradient(180deg, #24140d 0%, #362316 100%);
}

.site-navbar::after {
  display: none;
}

.brand {
  transition: var(--transition-lux);
}

.brand:hover {
  transform: translateX(-5px);
}

.brand-logo-wrap {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
}

.brand-text strong {
  color: var(--gold);
  font-size: 1.35rem;
  letter-spacing: 1.2px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}

.brand-text small {
  color: var(--light-gold);
}

.nav-menu {
  gap: 1.4rem;
}

.nav-menu a {
  color: var(--light-gold);
  font-weight: 500;
  letter-spacing: 1px;
  font-size: 0.95rem;
}

.nav-menu a::before {
  content: "";
  position: absolute;
  right: 0;
  bottom: -8px;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--gold), var(--light-gold));
  transition: var(--transition-lux);
}

.nav-menu a::after {
  display: none;
}

.nav-menu a:hover,
.nav-menu a.active {
  color: var(--gold);
  background: transparent;
  text-shadow: 0 0 10px rgba(212, 175, 143, 0.5);
}

.nav-menu a:hover::before,
.nav-menu a.active::before {
  width: 100%;
}

.theme-toggle {
  background: linear-gradient(135deg, var(--gold) 0%, var(--light) 100%);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #ffffff;
  box-shadow: 0 10px 25px rgba(212, 175, 143, 0.32);
}

.theme-toggle:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 30px rgba(212, 175, 143, 0.45);
}

.menu-toggle span {
  background: #f3e6d8;
}

.hero {
  background: linear-gradient(135deg, #f5f1e8 0%, #e8dfd2 50%, #ddd0c4 100%);
  padding: 6rem 0;
}

.hero::before {
  background: radial-gradient(circle,
      rgba(212, 175, 143, 0.14) 0%,
      transparent 70%);
  animation: pulse 8s ease-in-out infinite;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto auto -240px -200px;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle,
      rgba(139, 115, 85, 0.14) 0%,
      transparent 70%);
  pointer-events: none;
}

.hero h1 {
  color: var(--primary);
  font-size: clamp(2.2rem, 4.6vw, 3.6rem);
  letter-spacing: 2px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.hero p {
  color: var(--accent);
  font-size: 1.15rem;
}

.hero-story-sequence {
  position: relative;
  margin-top: 0.9rem;
  min-height: 240px;
  border-radius: 14px;
  border: 1px solid rgba(212, 175, 143, 0.34);
  background: rgba(255, 249, 243, 0.34);
  padding: 0.9rem 1rem;
  overflow: hidden;
}

.hero-story-step {
  position: absolute;
  inset: 0;
  padding: 0.9rem 1rem;
  display: none;
  opacity: 0;
  transform: translateY(8px);
}

.hero-story-step.active {
  display: block;
  animation: heroStepFade 0.55s ease forwards;
}

.hero-step-label {
  margin: 0 0 0.28rem;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--accent);
}

.hero-step-title {
  margin: 0;
  font-size: clamp(1.3rem, 2.8vw, 1.8rem);
  color: var(--primary);
  font-weight: 800;
}

.hero-step-text {
  margin: 0;
  font-size: 1rem;
  line-height: 1.85;
  color: #6a5543;
}

.hero-step-poem {
  margin: 0;
  font-size: clamp(1.1rem, 2.2vw, 1.35rem);
  line-height: 1.9;
  font-weight: 800;
  white-space: pre-line;
  color: var(--primary);
}

.hero-step-note {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  color: var(--accent);
}

.hero-step-poet {
  display: block;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--primary);
}

.home-page .hero-step-note.hero-step-poet {
  color: #3e2a1c;
  font-weight: 800;
}

.hero-step-children {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.hero-step-children span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 143, 0.38);
  background: rgba(255, 255, 255, 0.64);
  padding: 0.25rem 0.7rem;
  font-size: 0.9rem;
}

@keyframes heroStepFade {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-inline-sequence {
  position: relative;
  min-height: 66px;
  margin-top: 0.85rem;
  padding: 0.55rem 0.8rem;
  border-radius: 12px;
  border: 1px solid rgba(212, 175, 143, 0.34);
  background: rgba(255, 249, 243, 0.3);
  overflow: hidden;
}

.hero-inline-line {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
  margin: 0;
  color: #6a5543;
  font-size: 1rem;
  line-height: 1.8;
  padding: 0.55rem 0.8rem;
}

.hero-inline-line.active {
  opacity: 1;
  transform: translateY(0);
}

.hero-pill {
  background: rgba(212, 175, 143, 0.22);
  color: var(--primary);
  border: 1px solid rgba(212, 175, 143, 0.45);
}

.btn {
  letter-spacing: 1.2px;
}

.btn-primary {
  background: linear-gradient(135deg, #d4af8f 0%, #c9a877 100%);
  color: #ffffff;
  box-shadow: 0 10px 30px rgba(212, 175, 143, 0.4);
}

.btn-primary:hover {
  box-shadow: 0 20px 50px rgba(212, 175, 143, 0.55);
}

.btn-outline {
  background: rgba(44, 24, 16, 0.08);
  border: 1px solid rgba(44, 24, 16, 0.25);
  color: #5a4634;
}

.hero-panel {
  gap: 1rem;
}

.hero-panel-quad {
  margin-top: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.hero-panel-quad .stat-box {
  min-height: 96px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.22rem;
  padding: 0.86rem 1rem;
}

.hero-panel-quad .stat-box strong {
  font-size: 1.16rem;
  line-height: 1.5;
  font-weight: 800;
}

.hero-panel-quad .stat-box span {
  color: #685140;
  font-size: 1rem;
  line-height: 1.65;
}

.stat-box {
  background: linear-gradient(135deg, #fff9f3 0%, #f5f1e8 100%);
  border: 2px solid rgba(212, 175, 143, 0.25);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
}

.stat-box strong {
  color: #b4874e;
  font-size: 1.25rem;
}

.section {
  padding: 5rem 0;
}

.section-soft {
  background: linear-gradient(135deg, #fff9f3 0%, #f3ede3 100%);
}

.section-head {
  margin-bottom: 2.4rem;
}

.section-head h2 {
  font-size: clamp(2rem, 3.6vw, 2.9rem);
  color: var(--primary);
  letter-spacing: 2px;
}

.section-head h2::after {
  content: "";
  display: block;
  width: 100px;
  height: 3px;
  margin: 0.9rem auto 0;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.eyebrow {
  color: var(--accent);
  font-weight: 600;
}

.card,
.tree-preview {
  background: linear-gradient(135deg, #fff9f3 0%, #f5f1e8 100%);
  border: 2px solid transparent;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
}

.card::before {
  background: radial-gradient(circle,
      rgba(212, 175, 143, 0.3) 0%,
      transparent 70%);
  height: 100%;
  top: -50%;
  right: -50%;
  left: auto;
  width: 100%;
  opacity: 0;
}

.card:hover {
  transform: translateY(-15px);
  border-color: var(--gold);
  box-shadow: 0 20px 50px rgba(212, 175, 143, 0.3);
}

.card:hover::before {
  opacity: 0.16;
}

.card h3 {
  font-size: 1.45rem;
  color: var(--primary);
}

.card p,
.clean-list li {
  color: #6b5d4f;
}

.chip {
  background: #f5e8db;
  color: #8b7355;
}

.meta {
  color: #b4874e;
}

.tree-row span {
  background: #f9f2e8;
  border: 1px solid rgba(212, 175, 143, 0.4);
  color: var(--primary);
}

.tree-line {
  background: linear-gradient(var(--gold), transparent);
}

.gallery-card {
  border: 2px solid rgba(212, 175, 143, 0.3);
}

.gallery-card::before {
  background: linear-gradient(to top,
      rgba(44, 24, 16, 0.75),
      rgba(44, 24, 16, 0.12));
}

.filter-btn {
  background: #fff9f3;
  border: 1px solid rgba(139, 115, 85, 0.38);
  color: #6e5a47;
}

.filter-btn:hover,
.filter-btn.active {
  background: linear-gradient(135deg, #d4af8f 0%, #c9a877 100%);
  color: #ffffff;
}

.field input,
.field textarea {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(139, 115, 85, 0.3);
  color: #433225;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 143, 0.2);
}

.form-status {
  color: #4d8b54;
}

.page-hero {
  background: linear-gradient(135deg, #f5f1e8 0%, #e8dfd2 100%);
  color: var(--primary);
  border-bottom: 1px solid rgba(139, 115, 85, 0.2);
}

.page-hero p {
  color: #8b7355;
}

.site-footer {
  background: linear-gradient(180deg, #2c1810 0%, #1a0f0a 100%);
  color: #d4c5b0;
  border-top: 3px solid var(--gold);
}

.site-footer h3,
.site-footer h4 {
  color: var(--gold);
}

.site-footer p,
.site-footer li,
.site-footer a {
  color: #d4c5b0;
}

.site-footer a:hover {
  color: #f1e0cc;
}

.footer-bottom {
  border-top: 1px solid rgba(212, 175, 143, 0.2);
  color: #a08968;
}

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
    opacity: 0.5;
  }

  50% {
    transform: scale(1.08);
    opacity: 0.8;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-slide-up {
  animation: fadeInUp 0.7s ease forwards;
  opacity: 0;
}

/* Dark mode as second style */
body.theme-dark {
  background: linear-gradient(135deg, #1a0f0a 0%, #27170f 100%);
  color: #e8d8c4;
}

body.theme-dark .site-navbar {
  background: linear-gradient(180deg, #160d08 0%, #26160f 100%);
}

body.theme-dark .brand-text strong,
body.theme-dark .nav-menu a:hover,
body.theme-dark .nav-menu a.active {
  color: #e8d4c4;
}

body.theme-dark .nav-menu a {
  color: #d6c3ac;
}

body.theme-dark .hero {
  background: linear-gradient(135deg, #2a1a12 0%, #3a2619 50%, #4b3222 100%);
}

body.theme-dark .hero h1,
body.theme-dark .page-hero,
body.theme-dark .section-head h2,
body.theme-dark .card h3 {
  color: #f1e3d0;
}

body.theme-dark .hero p,
body.theme-dark .page-hero p,
body.theme-dark .card p,
body.theme-dark .clean-list li {
  color: #cab79f;
}

body.theme-dark .hero-inline-sequence {
  border-color: rgba(212, 175, 143, 0.32);
  background: rgba(32, 19, 12, 0.45);
}

body.theme-dark .hero-inline-line {
  color: #e1cfb8;
}

body.theme-dark .hero-story-sequence {
  border-color: rgba(212, 175, 143, 0.32);
  background: rgba(32, 19, 12, 0.45);
}

body.theme-dark .hero-step-title,
body.theme-dark .hero-step-poem {
  color: #f1e3d0;
}

body.theme-dark .hero-step-text {
  color: #d7c2a8;
}

body.theme-dark .hero-step-note {
  color: #cab79f;
}

body.theme-dark .hero-step-children span {
  background: rgba(212, 175, 143, 0.1);
  border-color: rgba(212, 175, 143, 0.3);
}

body.theme-dark .section-soft {
  background: linear-gradient(135deg, #21140d 0%, #2b1a12 100%);
}

body.theme-dark .card,
body.theme-dark .tree-preview,
body.theme-dark .stat-box {
  background: linear-gradient(135deg, #2d1c13 0%, #3b271a 100%);
  border-color: rgba(212, 175, 143, 0.24);
}

body.theme-dark .hero-panel-quad .stat-box span {
  color: #d5c2a9;
}

body.theme-dark .filter-btn,
body.theme-dark .field input,
body.theme-dark .field textarea {
  background: #2f1e15;
  border-color: rgba(212, 175, 143, 0.3);
  color: #e8d8c4;
}

body.theme-dark .btn-outline {
  color: #f1e3d0;
  border-color: rgba(232, 212, 196, 0.36);
}

body.theme-dark .site-footer {
  background: linear-gradient(180deg, #160d08 0%, #100905 100%);
}

@media (max-width: 860px) {
  .nav-menu {
    background: linear-gradient(180deg, #2c1810 0%, #3d2817 100%);
    border: 1px solid rgba(212, 175, 143, 0.32);
  }

  body.theme-light .nav-menu {
    background: #fff8ef;
    border: 1px solid rgba(139, 115, 85, 0.3);
  }

  body.theme-light .nav-menu a {
    color: #4e3e31;
  }

  body.theme-light .menu-toggle span {
    background: #f3e6d8;
  }
}

@media (max-width: 768px) {
  .hero {
    padding: 3rem 0;
  }

  .hero-grid {
    gap: 2rem;
  }

  .hero h1 {
    font-size: 2.2rem;
  }

  .section-head h2 {
    font-size: 2rem;
  }

  .hero-inline-sequence {
    min-height: 74px;
  }

  .hero-inline-line {
    font-size: 0.94rem;
  }

  .hero-story-sequence {
    min-height: 300px;
  }

  .hero-step-text {
    font-size: 0.95rem;
  }
}

@media (max-width: 480px) {
  .about-page #related-lineages .history-events ul {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }
}

/* Family History Section */
.family-history-section {
  position: relative;
}

.family-showcase {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 1rem;
  align-items: start;
}

.showcase-identity {
  height: 100%;
}

.showcase-stage {
  min-height: 100%;
}

.showcase-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 0.9rem;
}

.showcase-btn {
  border: 1px solid rgba(139, 115, 85, 0.38);
  background: #fff9f3;
  color: #6e5a47;
  border-radius: 999px;
  padding: 0.42rem 0.9rem;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-lux);
}

.showcase-btn:hover,
.showcase-btn.active {
  background: linear-gradient(135deg, #d4af8f 0%, #c9a877 100%);
  color: #ffffff;
}

.showcase-panels {
  position: relative;
}

.showcase-panel {
  display: none;
}

.showcase-panel.active {
  display: block;
  animation: fadeInUp 0.45s ease;
}

.showcase-panel h4 {
  margin-bottom: 0.65rem;
}

.showcase-panel p {
  line-height: 1.9;
}

.showcase-list {
  list-style: none;
  display: grid;
  gap: 0.55rem;
}

.showcase-list li {
  position: relative;
  padding-right: 1.15rem;
  line-height: 1.85;
}

.showcase-list li::before {
  content: "";
  position: absolute;
  right: 0;
  top: 0.72rem;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--light));
  box-shadow: 0 0 0 3px rgba(212, 175, 143, 0.2);
}

.showcase-tags {
  margin-top: 0.35rem;
}

.history-layout {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 1.2rem;
  align-items: start;
}

.history-main {
  grid-row: span 2;
}

.history-label {
  font-size: 0.9rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.history-name {
  font-size: clamp(1.8rem, 3.2vw, 2.5rem);
  margin-bottom: 0.8rem;
}

.history-summary {
  margin-bottom: 1.2rem;
  line-height: 1.95;
}

.history-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  margin-bottom: 1.1rem;
}

.history-meta-item {
  background: rgba(212, 175, 143, 0.12);
  border: 1px solid rgba(212, 175, 143, 0.28);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
}

.history-meta-item span {
  display: block;
  font-size: 0.86rem;
  opacity: 0.8;
}

.history-meta-item strong {
  font-size: 0.98rem;
  font-weight: 700;
}

.history-sons h4 {
  margin-bottom: 0.65rem;
}

.history-sons-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.history-sons-list span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 143, 0.38);
  background: rgba(255, 255, 255, 0.6);
  padding: 0.25rem 0.7rem;
  font-size: 0.9rem;
}

.history-events h3,
.history-poem h3 {
  margin-bottom: 0.75rem;
}

.history-events ul {
  list-style: none;
  display: grid;
  gap: 0.6rem;
}

.history-events li {
  position: relative;
  padding-right: 1.2rem;
  line-height: 1.85;
}

.history-events li::before {
  content: "";
  position: absolute;
  right: 0;
  top: 0.72rem;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--light));
  box-shadow: 0 0 0 3px rgba(212, 175, 143, 0.2);
}

.history-poem blockquote {
  margin: 0;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  border-right: 4px solid var(--gold);
  background: rgba(212, 175, 143, 0.13);
}

.history-poem p {
  margin-bottom: 0.2rem;
  line-height: 1.95;
  font-size: 1.02rem;
}

.history-poem p:last-child {
  margin-bottom: 0;
}

.history-poem .poem-main {
  font-weight: 800;
  font-size: clamp(1.15rem, 2.4vw, 1.5rem);
  color: var(--primary);
  line-height: 1.9;
  letter-spacing: 0.3px;
}

.poem-rotator {
  display: grid;
  margin-bottom: 0.2rem;
}

.poem-line {
  grid-area: 1 / 1;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.55s ease,
    transform 0.55s ease;
}

.poem-line.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.history-poem .poem-credit {
  margin-top: 0.6rem;
  font-size: 0.9rem;
  color: var(--accent);
  opacity: 0.9;
}

body.theme-dark .history-poem .poem-main {
  color: #f1e3d0;
}

body.theme-dark .history-poem .poem-credit {
  color: #cbb79f;
}

body.theme-dark .showcase-btn {
  background: #2f1e15;
  border-color: rgba(212, 175, 143, 0.35);
  color: #e2cfb8;
}

body.theme-dark .showcase-btn:hover,
body.theme-dark .showcase-btn.active {
  color: #ffffff;
}

body.theme-dark .history-meta-item,
body.theme-dark .history-poem blockquote,
body.theme-dark .history-sons-list span {
  background: rgba(212, 175, 143, 0.1);
  border-color: rgba(212, 175, 143, 0.3);
}

@media (max-width: 980px) {
  .family-showcase {
    grid-template-columns: 1fr;
  }

  .history-layout {
    grid-template-columns: 1fr;
  }

  .history-main {
    grid-row: auto;
  }
}

@media (max-width: 600px) {
  .history-meta {
    grid-template-columns: 1fr;
  }
}

/* Heritage Section */
.heritage-section {
  position: relative;
}

.heritage-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.heritage-card {
  padding: 1.5rem;
}

.heritage-sequence {
  display: grid;
}

.heritage-step {
  display: none;
  opacity: 0;
  transform: translateY(10px);
}

.heritage-step.active {
  display: block;
  animation: heritageFade 0.55s ease forwards;
}

.heritage-sequence-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.95rem;
}

.heritage-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1px solid rgba(139, 115, 85, 0.45);
  background: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  transition: var(--transition-lux);
}

.heritage-dot.active {
  background: linear-gradient(135deg, #d4af8f 0%, #c9a877 100%);
  border-color: rgba(139, 115, 85, 0.75);
  transform: scale(1.15);
}

.heritage-order {
  font-size: 0.9rem;
  color: var(--accent);
  font-weight: 700;
  margin: 0.35rem 0;
}

.heritage-name {
  font-size: clamp(1.9rem, 3vw, 2.5rem);
  margin-bottom: 0.7rem;
}

.heritage-text {
  display: grid;
  gap: 0.38rem;
  margin-bottom: 0.9rem;
}

.heritage-text p {
  line-height: 1.95;
}

.heritage-poem-wrap {
  border-right: 3px solid var(--gold);
  background: rgba(212, 175, 143, 0.12);
  border-radius: 10px;
  padding: 0.8rem 0.9rem;
  margin-bottom: 0.7rem;
}

.heritage-poem {
  font-weight: 800;
  font-size: clamp(1.1rem, 2.3vw, 1.4rem);
  line-height: 1.9;
  margin: 0 0 0.2rem;
  color: var(--primary);
}

.heritage-poet {
  font-size: 0.9rem;
  color: var(--accent);
  margin: 0;
}

.heritage-children {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.8rem;
}

.heritage-children span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 143, 0.35);
  background: rgba(255, 255, 255, 0.64);
  padding: 0.25rem 0.7rem;
  font-size: 0.9rem;
}

.heritage-death {
  font-size: 1rem;
  margin-bottom: 0;
}

@keyframes heritageFade {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

body.theme-dark .heritage-poem {
  color: #f1e3d0;
}

body.theme-dark .heritage-poet {
  color: #cab79f;
}

body.theme-dark .heritage-poem-wrap,
body.theme-dark .heritage-children span {
  background: rgba(212, 175, 143, 0.1);
  border-color: rgba(212, 175, 143, 0.3);
}

body.theme-dark .heritage-dot {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(212, 175, 143, 0.35);
}

@media (max-width: 768px) {
  .heritage-card {
    padding: 1.1rem;
  }
}

/* First Page Typography Tune */
.hero h1,
.hero-step-label,
.hero-step-title,
.hero-step-text,
.hero-step-poem,
.hero-step-note,
.heritage-section .section-head h2,
.heritage-name,
.heritage-order,
.heritage-text p,
.heritage-poem,
.heritage-poet,
.heritage-death {
  font-family: "Cairo", sans-serif;
}

.hero h1 {
  font-size: clamp(2.6rem, 5.6vw, 4.3rem);
  font-weight: 800;
  letter-spacing: 0.6px;
}

.hero-main-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.85rem;
  align-items: stretch;
  margin-top: 0.35rem;
}

.hero-story-sequence {
  min-height: 250px;
  padding: 0.85rem 0.95rem;
  margin-top: 0;
  border-radius: 16px;
}

.hero-story-step {
  padding: 0.85rem 0.95rem;
  overflow-y: auto;
}

.hero-step-label {
  font-size: 1rem;
}

.hero-step-title {
  font-size: clamp(1.8rem, 3.2vw, 2.35rem);
}

.hero-step-text {
  font-size: 1.22rem;
  line-height: 1.95;
}

.hero-step-poem {
  font-size: clamp(1.35rem, 2.6vw, 1.8rem);
}

.hero-step-note {
  font-size: 1.02rem;
}

.hero-step-children span {
  font-size: 1.02rem;
  padding: 0.3rem 0.78rem;
}

.hero-main-row .hero-panel-quad {
  margin-top: 0;
  min-height: 250px;
  grid-auto-rows: 1fr;
  align-content: stretch;
}

.hero-main-row .hero-panel-quad .stat-box {
  height: 100%;
  min-height: 0;
}

.hero h1 {
  margin-bottom: 0.6rem;
}

.family-title-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.13em 0.62em;
  border-radius: 13px;
  border: 1px solid rgba(199, 154, 91, 0.62);
  background: linear-gradient(140deg,
      rgba(255, 249, 240, 0.9),
      rgba(242, 223, 195, 0.78));
  color: #2c1810;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
  box-shadow:
    0 10px 22px rgba(95, 67, 36, 0.2),
    inset 0 0 0 1px rgba(255, 255, 255, 0.5);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(3px);
  transition:
    transform 0.35s ease,
    box-shadow 0.35s ease,
    border-color 0.35s ease;
  font-size: 0.9em;
  line-height: 1.18;
}

.family-title-box::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  pointer-events: none;
}

.family-title-box::after {
  content: "";
  position: absolute;
  inset: -24% -58%;
  background: linear-gradient(120deg,
      transparent 35%,
      rgba(255, 255, 255, 0.5) 50%,
      transparent 65%);
  transform: translateX(90%);
  animation: familyShine 5.4s ease-in-out infinite;
}

.family-title-box:hover {
  transform: translateY(-2px);
  border-color: rgba(199, 154, 91, 0.9);
  box-shadow:
    0 12px 26px rgba(95, 67, 36, 0.28),
    inset 0 0 0 1px rgba(255, 255, 255, 0.58);
}

@keyframes familyShine {

  0%,
  70%,
  100% {
    transform: translateX(90%);
  }

  40% {
    transform: translateX(-90%);
  }
}

body.theme-dark .family-title-box {
  background: linear-gradient(145deg,
      rgba(76, 50, 30, 0.72),
      rgba(49, 31, 20, 0.88));
  color: #f3e1c9;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
  border-color: rgba(212, 175, 143, 0.58);
  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.38),
    inset 0 0 0 1px rgba(228, 197, 164, 0.18);
}

body.theme-dark .family-title-box::before {
  border-color: rgba(228, 197, 164, 0.2);
}

body.theme-dark .family-title-box::after {
  background: linear-gradient(120deg,
      transparent 35%,
      rgba(255, 229, 194, 0.35) 50%,
      transparent 65%);
}

.heritage-section .section-head h2 {
  font-size: clamp(2.1rem, 4vw, 3rem);
  font-weight: 800;
}

.home-page .hero {
  padding: 4.7rem 0 4.1rem;
  min-height: calc(100svh - 82px);
}

.home-page .hero-actions {
  margin-top: 0.65rem;
  gap: 0.7rem;
}

.home-page .section {
  padding: 4.3rem 0;
}

.home-page .heritage-section {
  padding-top: 4.6rem;
}

@media (max-width: 980px) {
  .hero-main-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .home-page .hero {
    padding: 3.1rem 0 2.8rem;
  }

  .home-page .section {
    padding: 3.3rem 0;
  }

  .hero-story-sequence {
    min-height: 285px;
    padding: 1rem;
  }

  .hero-story-step {
    padding: 1rem;
  }

  .hero-step-label {
    font-size: 0.95rem;
  }

  .hero-step-title {
    font-size: clamp(1.55rem, 6vw, 1.95rem);
  }

  .hero-step-text {
    font-size: 1.05rem;
  }

  .hero-step-poem {
    font-size: clamp(1.16rem, 4.8vw, 1.45rem);
  }

  .hero-panel-quad {
    grid-template-columns: 1fr;
  }

  .hero-panel-quad .stat-box {
    min-height: 0;
    padding: 0.78rem 0.9rem;
  }

  .hero-panel-quad .stat-box strong {
    font-size: 1.05rem;
  }

  .hero-panel-quad .stat-box span {
    font-size: 0.94rem;
  }

  .hero-main-row .hero-panel-quad {
    min-height: 0;
  }
}

@media (max-width: 560px) {
  .home-page .hero {
    min-height: calc(100svh - 74px);
  }
}

/* Home Text-Only Mode (No Boxes) */
.home-page .family-title {
  color: #f1e3d0;
  text-shadow: none;
  font-size: clamp(2.9rem, 6.4vw, 5.1rem);
  line-height: 1.1;
  letter-spacing: 0.3px;
  margin: 0 0 0.95rem;
}

.home-page .hero-pill {
  background: none;
  border: 0;
  padding: 0;
  margin-bottom: 0.4rem;
  color: #dfc48f;
  font-size: 1rem;
  font-weight: 700;
}

.home-page .hero-main-row {
  grid-template-columns: minmax(0, 1.18fr) minmax(0, 0.82fr);
  gap: 1.8rem;
  align-items: start;
  margin-top: 0.9rem;
}

.home-page .hero-main-row.poetry-only {
  grid-template-columns: minmax(0, 1fr);
  max-width: 720px;
}

.home-page .hero-story-sequence {
  min-height: 260px;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: hidden;
}

.home-page .hero-story-step {
  padding: 0 !important;
  overflow: hidden;
}

.home-page .hero-step-label {
  margin: 0 0 0.3rem;
  font-size: 1rem;
}

.home-page .hero-step-title {
  margin: 0;
  font-size: clamp(1.8rem, 3.1vw, 2.35rem);
}

.home-page .hero-step-text {
  margin: 0;
  font-size: 1.16rem;
  line-height: 1.9;
}

.home-page .hero-step-poem {
  margin: 0;
  font-size: clamp(1.2rem, 2.5vw, 1.65rem);
  line-height: 2;
}

.home-page .hero-step-note {
  margin-top: 0.35rem;
  font-size: 1rem;
}

.home-page .hero-main-row.poetry-only .hero-step-label {
  margin-bottom: 0.75rem;
}

.home-page .hero-highlights {
  display: grid;
  gap: 0.5rem;
  margin-top: 0;
  align-content: start;
  padding-right: 1rem;
  border-right: 2px solid rgba(223, 196, 143, 0.35);
}

.home-page .hero-highlights p {
  margin: 0;
  color: #c9d4e8;
  font-size: 1.08rem;
  line-height: 1.88;
}

.home-page .hero-highlights strong {
  color: #dfc48f;
  font-weight: 800;
}

.home-page .hero-step-children,
.home-page .heritage-children {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem 0.95rem;
  margin-top: 0.35rem;
  align-items: center;
}

.home-page .hero-step-children span,
.home-page .heritage-children span {
  display: inline-flex;
  align-items: center;
  padding: 0 !important;
  margin: 0;
  color: #e8d8c4;
  font-size: 1.03rem;
  line-height: 1.8;
  font-weight: 600;
}

.home-page .hero-step-children span::before,
.home-page .heritage-children span::before {
  content: "•";
  color: #d4af8f;
  margin-left: 0.38rem;
  font-size: 0.82rem;
  line-height: 1;
}

.home-page .card,
.home-page .tree-preview,
.home-page .heritage-plain,
.home-page .heritage-poem-wrap,
.home-page .heritage-children span,
.home-page .hero-step-children span,
.home-page .history-meta-item,
.home-page .history-poem blockquote,
.home-page .stat-box,
.home-page .chip,
.home-page .filter-btn,
.home-page .tree-row span,
.home-page .family-title-box {
  background: none !important;
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}

.home-page .card::before,
.home-page .gallery-card::before {
  display: none;
}

.home-page .card:hover,
.home-page .gallery-card:hover {
  transform: none;
  box-shadow: none;
}

.home-page .heritage-plain {
  padding: 0;
}

.home-page .heritage-sequence-nav {
  display: none;
}

.home-page .gallery-grid {
  grid-template-columns: 1fr;
  gap: 0.45rem;
}

.home-page .gallery-card {
  min-height: 0;
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
}

.home-page .gallery-card span {
  position: static;
  display: inline;
  padding: 0;
  background: none;
  color: #c9d4e8;
  border-radius: 0;
  font-weight: 600;
}

.home-page .tree-line {
  height: 14px;
  opacity: 0.3;
}

body.theme-dark.home-page .hero-story-sequence,
body.theme-dark.home-page .hero-inline-sequence {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.home-page .hero-actions {
  margin-top: 1.35rem;
  gap: 0.65rem;
}

.photo-archive-section .section-lead {
  margin-top: 0.6rem;
  color: #d4c3a8;
  max-width: 640px;
}

.photo-archive-section {
  position: relative;
  overflow: hidden;
}

.photo-archive-section::before {
  content: "";
  position: absolute;
  inset: -20% 0 auto 0;
  height: 280px;
  background:
    radial-gradient(420px 180px at 15% 0%,
      rgba(214, 176, 122, 0.22),
      transparent 65%),
    radial-gradient(520px 240px at 85% 10%,
      rgba(186, 140, 88, 0.2),
      transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.photo-archive-section .container {
  position: relative;
  z-index: 1;
}

.photo-archive-grid {
  margin-top: 2rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.2rem;
}

.photo-archive-section .section-actions {
  margin-top: 1.6rem;
  justify-content: center;
}

.photo-archive-card {
  position: relative;
  grid-column: auto;
  min-height: 200px;
  border-radius: 22px;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #f1e3cc;
  border: 1px solid rgba(214, 168, 108, 0.35);
  box-shadow: 0 18px 28px rgba(25, 18, 11, 0.18);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
  content-visibility: auto;
  contain-intrinsic-size: 260px 260px;
}

.photo-archive-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  background: none;
  transform: none;
  filter: none;
  transition: transform 0.4s ease;
}

.photo-archive-card figcaption {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  padding: 0.7rem 0.9rem 0.85rem;
  z-index: 3;
  background: linear-gradient(0deg, rgba(9, 7, 4, 0.65), rgba(9, 7, 4, 0));
}

.archive-label {
  color: #f7edd3;
  font-size: 0.95rem;
  font-weight: 700;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.photo-zoom {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  z-index: 4;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #1f1b14;
  font-size: 0.85rem;
  font-weight: 800;
  box-shadow: 0 10px 20px rgba(20, 14, 9, 0.18);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.photo-archive-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 22px 34px rgba(25, 18, 11, 0.26);
}

.photo-archive-card:hover img {
  transform: scale(1.02);
}

.photo-archive-card:hover .photo-zoom,
.photo-archive-card:focus-within .photo-zoom {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.6rem;
  background: rgba(8, 6, 4, 0.75);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.photo-lightbox.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.photo-lightbox-content {
  width: min(920px, 92vw);
  max-height: 88vh;
  background: #0f1a2d;
  border-radius: 22px;
  border: 1px solid rgba(214, 168, 108, 0.28);
  padding: 1rem;
  display: grid;
  gap: 0.7rem;
  box-shadow: 0 28px 46px rgba(8, 6, 4, 0.35);
}

.photo-lightbox-content img {
  width: 100%;
  max-height: 68vh;
  object-fit: contain;
  border-radius: 16px;
  background: #0b1322;
}

.photo-lightbox-close {
  justify-self: start;
  border: 0;
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.92);
  color: #1f1b14;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 10px 18px rgba(12, 9, 6, 0.2);
}

.photo-lightbox-close:hover {
  transform: translateY(-2px);
}

.photo-lightbox-caption {
  color: #f2e5cc;
  font-weight: 700;
  text-align: center;
}

body.lightbox-open {
  overflow: hidden;
}

@media (max-width: 1100px) {
  .photo-archive-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .photo-archive-grid {
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }

  .photo-zoom {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }

  .photo-archive-card,
  .photo-archive-card.wide {
    grid-column: span 1;
    min-height: 210px;
  }
}

.photo-archive-page .photo-archive-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.1rem;
}

.photo-archive-page .photo-archive-card {
  min-height: 240px;
  aspect-ratio: 4 / 5;
}

.photo-archive-page .photo-archive-card::before {
  opacity: 0.22;
}

@media (max-width: 1200px) {
  .photo-archive-page .photo-archive-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .photo-archive-page .photo-archive-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .photo-archive-page .photo-archive-grid {
    grid-template-columns: 1fr;
  }
}

.home-page .section {
  padding: 4.6rem 0 4rem;
}

.home-page .section-head {
  margin-bottom: 1.45rem;
}

.home-page .section-head h2 {
  font-size: clamp(1.95rem, 3.6vw, 2.95rem);
  line-height: 1.35;
}

.home-page .eyebrow {
  font-size: 1rem;
}

.home-page .cards {
  gap: 1.25rem;
}

.home-page .card h3 {
  font-size: 1.35rem;
  margin-bottom: 0.32rem;
}

.home-page .card p {
  font-size: 1.06rem;
  line-height: 1.9;
}

.home-page .prince-bio-content {
  display: grid;
  gap: 0.75rem;
  max-width: 980px;
  margin-inline: auto;
}

.home-page .prince-bio-content h3 {
  margin: 0;
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  color: #f1e3d0;
}

.home-page .prince-bio-content p {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.95;
  color: #d8c6ae;
}

.home-page .prince-bio-content .prince-poem {
  font-size: clamp(1.1rem, 2.2vw, 1.35rem);
  line-height: 2.05;
  font-weight: 700;
  color: #f0debf;
  white-space: pre-line;
}

.home-page .prince-bio-content .prince-meta {
  color: #e8d8c4;
}

.home-page .prince-bio-content .prince-meta strong {
  color: #f0debf;
}

@media (max-width: 980px) {
  .home-page .hero-main-row {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .home-page .hero-highlights {
    padding-right: 0;
    border-right: 0;
  }
}

@media (max-width: 768px) {
  .home-page .family-title {
    font-size: clamp(2.2rem, 10vw, 3.2rem);
    margin-bottom: 0.65rem;
  }

  .home-page .hero-story-sequence {
    min-height: 300px;
  }

  .home-page .hero-step-title {
    font-size: clamp(1.45rem, 6.6vw, 1.95rem);
  }

  .home-page .hero-step-text {
    font-size: 1.02rem;
  }

  .home-page .hero-step-poem {
    font-size: clamp(1.08rem, 4.6vw, 1.34rem);
  }

  .home-page .hero-highlights p {
    font-size: 1rem;
    line-height: 1.82;
  }

  .home-page .hero-step-children,
  .home-page .heritage-children {
    gap: 0.35rem 0.72rem;
  }

  .home-page .hero-step-children span,
  .home-page .heritage-children span {
    font-size: 0.97rem;
  }

  .home-page .section {
    padding: 3.4rem 0 3.1rem;
  }

  .home-page .prince-bio-content p {
    font-size: 1rem;
    line-height: 1.85;
  }
}

/* Match Other Pages With Homepage Palette */
body.theme-dark:not(.home-page) {
  background: linear-gradient(135deg, #1a0f0a 0%, #27170f 100%);
  color: #e8d8c4;
}

body.theme-dark:not(.home-page) .page-hero {
  background: linear-gradient(135deg, #2a1a12 0%, #3a2619 50%, #4b3222 100%);
  border-bottom: 1px solid rgba(212, 175, 143, 0.22);
}

body.theme-dark:not(.home-page) .page-hero h1,
body.theme-dark:not(.home-page) .section-head h2,
body.theme-dark:not(.home-page) .card h3 {
  color: #f1e3d0;
}

body.theme-dark:not(.home-page) .page-hero p,
body.theme-dark:not(.home-page) .card p,
body.theme-dark:not(.home-page) .clean-list li,
body.theme-dark:not(.home-page) .field label {
  color: #cab79f;
}

body.theme-dark:not(.home-page) .section-soft {
  background: linear-gradient(135deg, #21140d 0%, #2b1a12 100%);
}

body.theme-dark:not(.home-page) .card,
body.theme-dark:not(.home-page) .tree-preview {
  background: linear-gradient(135deg, #2d1c13 0%, #3b271a 100%);
  border: 1px solid rgba(212, 175, 143, 0.24);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.34);
}

body.theme-dark:not(.home-page) .chip {
  background: rgba(212, 175, 143, 0.14);
  color: #e7d2b5;
}

body.theme-dark:not(.home-page) .meta,
body.theme-dark:not(.home-page) .eyebrow {
  color: #d8bf92;
}

body.theme-dark:not(.home-page) .filter-btn {
  background: #2f1e15;
  border-color: rgba(212, 175, 143, 0.34);
  color: #e8d8c4;
}

body.theme-dark:not(.home-page) .filter-btn:hover,
body.theme-dark:not(.home-page) .filter-btn.active {
  background: linear-gradient(135deg, #d4af8f 0%, #c9a877 100%);
  color: #1e140f;
}

body.theme-dark:not(.home-page) .field input,
body.theme-dark:not(.home-page) .field textarea {
  background: #2f1e15;
  border-color: rgba(212, 175, 143, 0.32);
  color: #e8d8c4;
}

body.theme-dark:not(.home-page) .field input::placeholder,
body.theme-dark:not(.home-page) .field textarea::placeholder {
  color: #bfa88c;
}

body.theme-dark:not(.home-page) .btn-outline {
  border-color: rgba(232, 212, 196, 0.4);
  color: #f1e3d0;
}

/* Gradient Color Polish */
body.theme-dark {
  background:
    radial-gradient(1200px 600px at 90% -15%,
      rgba(212, 175, 143, 0.12),
      transparent 60%),
    radial-gradient(900px 520px at 0% 20%,
      rgba(120, 71, 39, 0.18),
      transparent 58%),
    linear-gradient(135deg, #160d08 0%, #24150d 45%, #2f1c12 100%);
  color: #eadbc7;
}

body.theme-dark .site-navbar {
  background: linear-gradient(180deg,
      rgba(18, 10, 6, 0.94) 0%,
      rgba(31, 18, 12, 0.92) 100%);
  border-bottom: 1px solid rgba(212, 175, 143, 0.22);
}

body.theme-dark .hero,
body.theme-dark .page-hero {
  background:
    radial-gradient(900px 420px at 80% -8%,
      rgba(212, 175, 143, 0.16),
      transparent 65%),
    linear-gradient(135deg, #24150d 0%, #3a2417 52%, #4b2f1f 100%);
}

body.theme-dark .section-soft {
  background: linear-gradient(145deg, #20120c 0%, #2a1911 100%);
}

body.theme-dark .card,
body.theme-dark .tree-preview,
body.theme-dark .stat-box,
body.theme-dark .heritage-poem-wrap {
  background: linear-gradient(145deg,
      rgba(59, 38, 24, 0.92),
      rgba(46, 29, 19, 0.94));
  border-color: rgba(212, 175, 143, 0.28);
}

body.theme-dark .btn-primary {
  background: linear-gradient(135deg, #e0bf8b 0%, #cb9f62 52%, #b9884f 100%);
  color: #1f140c;
  box-shadow: 0 12px 26px rgba(203, 159, 98, 0.38);
}

body.theme-dark .btn-outline {
  background: linear-gradient(135deg,
      rgba(255, 255, 255, 0.08),
      rgba(232, 212, 196, 0.04));
  border-color: rgba(232, 212, 196, 0.42);
  color: #f3e5d2;
}

body.theme-dark .hero-pill,
body.theme-dark .eyebrow,
body.theme-dark .meta {
  color: #e5c896;
}

body.theme-dark.home-page #about-prince-mohammed.section-soft {
  background:
    radial-gradient(760px 300px at 15% -8%,
      rgba(212, 175, 143, 0.08),
      transparent 70%),
    linear-gradient(180deg, #4b2f1f 0%, #3e2619 42%, #2d1c12 100%);
  margin-top: -6px;
  padding-top: 2.8rem;
  border-top: 0;
  border-bottom: 0;
}

body.theme-dark.home-page #about-prince-mohammed .section-head {
  margin-bottom: 1rem;
}

body.theme-dark.home-page #about-prince-mohammed .section-head h2 {
  color: #f5e7d5;
  letter-spacing: 0.2px;
}

body.theme-dark.home-page #about-prince-mohammed .section-head h2::after {
  display: none;
}

body.theme-dark.home-page #about-prince-mohammed .eyebrow {
  color: #e9c98f;
}

body.theme-dark.home-page #about-prince-mohammed .prince-bio-content {
  max-width: 940px;
  gap: 0.9rem;
}

body.theme-dark.home-page #about-prince-mohammed .prince-bio-content p {
  color: #e2cfb6;
  line-height: 2;
}

body.theme-dark.home-page #about-prince-mohammed .prince-poem {
  color: #f2ddb7;
}

body.theme-dark.home-page #about-prince-mohammed .prince-meta {
  color: #f0e0cc;
}

/* Paper Gold Theme Override */
body.theme-dark {
  background:
    radial-gradient(1200px 600px at 90% -15%,
      rgba(196, 150, 84, 0.12),
      transparent 60%),
    radial-gradient(900px 520px at 0% 20%,
      rgba(168, 124, 66, 0.12),
      transparent 58%),
    linear-gradient(135deg, #f8f2e6 0%, #f3ead9 45%, #ede1cc 100%);
  color: #4c3727;
}

body.theme-dark .site-navbar {
  background: linear-gradient(180deg,
      rgba(247, 239, 224, 0.96) 0%,
      rgba(241, 231, 212, 0.96) 100%);
  border-bottom: 1px solid rgba(172, 133, 73, 0.28);
}

body.theme-dark .site-navbar .brand-name,
body.theme-dark .site-navbar .nav-menu a {
  color: #111111;
}

body.theme-dark .hero,
body.theme-dark .page-hero {
  background:
    radial-gradient(900px 420px at 80% -8%,
      rgba(204, 158, 92, 0.2),
      transparent 65%),
    linear-gradient(135deg, #f5ebda 0%, #efe2cc 52%, #e6d5bb 100%);
}

body.theme-dark .section-soft,
body.theme-dark.home-page #about-prince-mohammed.section-soft {
  background:
    radial-gradient(760px 300px at 15% -8%,
      rgba(204, 158, 92, 0.1),
      transparent 70%),
    linear-gradient(180deg, #efe2cc 0%, #ebdcc4 44%, #e4d2b6 100%);
}

body.theme-dark .card,
body.theme-dark .tree-preview,
body.theme-dark .stat-box,
body.theme-dark .heritage-poem-wrap {
  background: linear-gradient(145deg,
      rgba(249, 241, 226, 0.94),
      rgba(242, 231, 210, 0.94));
  border-color: rgba(176, 136, 75, 0.34);
}

body.theme-dark .btn-primary {
  background: linear-gradient(135deg, #ddb777 0%, #cfa160 52%, #b9894e 100%);
  color: #2e1f13;
  box-shadow: 0 12px 26px rgba(189, 140, 70, 0.26);
}

body.theme-dark .btn-outline {
  background: linear-gradient(135deg,
      rgba(255, 255, 255, 0.4),
      rgba(245, 234, 214, 0.35));
  border-color: rgba(170, 128, 70, 0.4);
  color: #4a3322;
}

body.theme-dark .hero-pill,
body.theme-dark .eyebrow,
body.theme-dark .meta {
  color: #9a6f39;
}

body.theme-dark .section-head h2,
body.theme-dark .hero h1,
body.theme-dark .page-hero h1,
body.theme-dark .card h3 {
  color: #3f2b1d;
}

body.theme-dark .hero p,
body.theme-dark .page-hero p,
body.theme-dark .card p,
body.theme-dark .clean-list li {
  color: #5d4532;
}

body.theme-dark.home-page .family-title,
body.theme-dark.home-page .hero-step-title,
body.theme-dark.home-page .hero-step-poem {
  color: #3e2a1c;
}

body.theme-dark.home-page .hero-step-text,
body.theme-dark.home-page .hero-step-note,
body.theme-dark.home-page .hero-highlights p {
  color: #5b4432;
}

body.theme-dark.home-page .hero-highlights strong,
body.theme-dark.home-page .hero-step-label {
  color: #8b6436;
}

body.theme-dark.home-page #about-prince-mohammed .section-head h2 {
  color: #3f2b1d;
}

body.theme-dark.home-page #about-prince-mohammed .prince-bio-content p,
body.theme-dark.home-page #about-prince-mohammed .prince-meta {
  color: #5b4432;
}

body.theme-dark.home-page #about-prince-mohammed .prince-poem {
  color: #4a3322;
}

/* Top Bar Polish - Paper Theme */
body.theme-dark .site-navbar {
  background: linear-gradient(180deg,
      rgba(250, 243, 230, 0.94) 0%,
      rgba(245, 235, 218, 0.94) 100%);
  border-bottom: 1px solid rgba(176, 136, 75, 0.3);
  backdrop-filter: blur(12px) saturate(125%);
  box-shadow: 0 8px 22px rgba(120, 88, 50, 0.1);
}

body.theme-dark .site-navbar.scrolled {
  background: linear-gradient(180deg,
      rgba(250, 243, 230, 0.98) 0%,
      rgba(243, 231, 209, 0.98) 100%);
  box-shadow: 0 12px 28px rgba(120, 88, 50, 0.16);
}

body.theme-dark .brand-text strong {
  color: #3f2b1d;
}

body.theme-dark .brand-text small {
  color: #8a663d;
}

body.theme-dark .nav-menu a {
  color: #5b4330;
}

body.theme-dark .nav-menu a:hover,
body.theme-dark .nav-menu a.active {
  background: rgba(189, 146, 81, 0.18);
  color: #3b281b;
}

body.theme-dark .nav-menu a::after {
  background: linear-gradient(90deg, transparent, #bf9050, transparent);
}

body.theme-dark .menu-toggle {
  border-radius: 10px;
  background: rgba(226, 200, 162, 0.25);
}

body.theme-dark .menu-toggle span {
  background: #4a3322;
}

@media (max-width: 860px) {
  body.theme-dark .nav-menu {
    background: linear-gradient(180deg,
        rgba(250, 243, 230, 0.99) 0%,
        rgba(244, 233, 213, 0.99) 100%);
    border: 1px solid rgba(176, 136, 75, 0.34);
    box-shadow: 0 16px 30px rgba(120, 88, 50, 0.2);
  }

  body.theme-dark .nav-menu a {
    color: #4f3928;
  }
}

/* Unified Colors + No Section Separators */
body.theme-dark .hero,
body.theme-dark .page-hero,
body.theme-dark .section,
body.theme-dark .section-soft {
  background:
    radial-gradient(900px 420px at 80% -8%,
      rgba(204, 158, 92, 0.12),
      transparent 65%),
    linear-gradient(135deg, #f6eddc 0%, #f1e6d1 52%, #eadcc2 100%);
}

body.theme-dark .site-navbar,
body.theme-dark .site-navbar.scrolled,
body.theme-dark .page-hero,
body.theme-dark.home-page #about-prince-mohammed.section-soft,
body.theme-dark .footer {
  border-top: 0 !important;
  border-bottom: 0 !important;
}

body.theme-dark .section-head h2::after,
body.theme-dark .site-navbar::after {
  display: none !important;
}

body.theme-dark .section,
body.theme-dark .section-soft,
body.theme-dark .page-hero {
  box-shadow: none !important;
}

body.theme-dark .card,
body.theme-dark .tree-preview,
body.theme-dark .gallery-card {
  border-color: rgba(176, 136, 75, 0.2);
}

/* Contrast Fixes (Readability) */
body.theme-dark.home-page .hero-step-children span,
body.theme-dark.home-page .heritage-children span {
  color: #4a3322 !important;
}

body.theme-dark.home-page .prince-bio-content h3,
body.theme-dark.home-page .prince-bio-content .prince-meta strong {
  color: #3f2b1d !important;
}

body.theme-dark .site-footer {
  background: linear-gradient(180deg, #efe2cc 0%, #e5d4b8 100%);
  color: #4f3928;
}

body.theme-dark .site-footer h3,
body.theme-dark .site-footer h4 {
  color: #3f2b1d;
}

body.theme-dark .site-footer p,
body.theme-dark .site-footer li,
body.theme-dark .site-footer a,
body.theme-dark .footer-bottom p {
  color: #5a4330;
}

body.theme-dark .site-footer a:hover {
  color: #8b6436;
}

/* Fullscreen Hero (Homepage) */
.home-page .hero {
  min-height: 100vh !important;
  display: flex;
  align-items: center;
  padding-top: 6.5rem;
  padding-bottom: 3rem;
}

@media (max-width: 860px) {
  .home-page .hero {
    min-height: 100svh !important;
    padding-top: 5.5rem;
    padding-bottom: 2.2rem;
  }
}

/* Homepage Final Polish */
.home-page main {
  overflow: visible;
}

.home-page .hero .container {
  width: min(1180px, 92vw);
}

.home-page .hero-content {
  max-width: 1080px;
}

.home-page .family-title {
  font-size: clamp(3rem, 6.6vw, 5.4rem);
  line-height: 1.08;
  margin-bottom: 1rem;
}

.home-page .hero-main-row {
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  gap: 2rem;
  margin-top: 1rem;
}

.home-page .hero-story-sequence {
  min-height: 520px;
}

.home-page .hero-step-text,
.home-page .hero-step-poem {
  max-width: 62ch;
}

.home-page .hero-highlights {
  gap: 0.72rem;
  padding-right: 1.05rem;
  border-right: 2px solid rgba(139, 100, 54, 0.35);
}

.home-page .hero-highlights p {
  font-size: 1.05rem;
  line-height: 1.9;
}

.home-page .hero-actions {
  margin-top: 1.55rem;
}

.home-page #about-prince-mohammed {
  padding-top: 3.2rem;
}

.home-page #about-prince-mohammed .prince-bio-content {
  max-width: 1000px;
  gap: 1rem;
}

.home-page #about-prince-mohammed .prince-bio-content p {
  font-size: 1.08rem;
  line-height: 2;
}

.home-page .section {
  padding-top: 4.2rem;
  padding-bottom: 3.8rem;
}

.home-page .section-head {
  margin-bottom: 1.25rem;
}

@media (max-width: 980px) {
  .home-page .hero-main-row {
    grid-template-columns: 1fr;
    gap: 1.2rem;
  }

  .home-page .hero-highlights {
    padding-right: 0;
    border-right: 0;
  }
}

@media (max-width: 768px) {
  .home-page .hero .container {
    width: min(1180px, 94vw);
  }

  .home-page .family-title {
    font-size: clamp(2.35rem, 10vw, 3.45rem);
    margin-bottom: 0.72rem;
  }

  .home-page .hero-story-sequence {
    min-height: 260px;
  }

  .home-page .hero-step-text {
    font-size: 1.02rem;
    line-height: 1.85;
  }

  .home-page .hero-step-poem {
    font-size: clamp(1.08rem, 4.7vw, 1.32rem);
    line-height: 1.95;
  }

  .home-page .hero-highlights p {
    font-size: 1rem;
  }

  .home-page #about-prince-mohammed .prince-bio-content p {
    font-size: 1rem;
    line-height: 1.9;
  }
}

/* Brand Text Only */
.brand {
  text-decoration: none;
}

.brand-name {
  display: inline-flex;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: #000000;
  font-family: "Aref Ruqaa Ink", "Cairo", serif;
  font-size: 2.05rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  text-shadow: none;
}

body.theme-dark .brand-name {
  color: #000000;
}

body.theme-dark .brand:hover .brand-name {
  color: #000000;
}

@media (max-width: 560px) {
  .brand-name {
    font-size: 1.68rem;
  }
}

/* Warm Yellow Fine-Tune */
body.theme-dark {
  background:
    radial-gradient(1200px 620px at 90% -15%,
      rgba(205, 158, 88, 0.14),
      transparent 60%),
    radial-gradient(920px 540px at 0% 20%,
      rgba(184, 138, 72, 0.14),
      transparent 58%),
    linear-gradient(135deg, #f9f1de 0%, #f3e7ce 48%, #ecdab7 100%);
}

body.theme-dark .hero,
body.theme-dark .page-hero,
body.theme-dark .section,
body.theme-dark .section-soft {
  background:
    radial-gradient(920px 430px at 80% -8%,
      rgba(212, 166, 92, 0.16),
      transparent 65%),
    linear-gradient(135deg, #f7ecd6 0%, #f1e3c6 52%, #e9d5af 100%);
}

body.theme-dark .site-navbar,
body.theme-dark .site-navbar.scrolled {
  background: linear-gradient(180deg,
      rgba(251, 244, 227, 0.96) 0%,
      rgba(245, 234, 210, 0.96) 100%);
}

body.theme-dark .card,
body.theme-dark .tree-preview,
body.theme-dark .gallery-card {
  background: linear-gradient(145deg,
      rgba(250, 243, 225, 0.95),
      rgba(243, 232, 206, 0.95));
}

body.theme-dark .btn-primary {
  background: linear-gradient(135deg, #e1bc78 0%, #d2a45f 55%, #bc8d4c 100%);
}

/* Navbar Final Reset */
body.theme-dark .site-navbar,
body.theme-dark .site-navbar.scrolled {
  background: linear-gradient(180deg,
      rgba(251, 244, 227, 0.97) 0%,
      rgba(244, 233, 210, 0.97) 100%);
  border-bottom: 1px solid rgba(176, 136, 75, 0.3);
  box-shadow: 0 8px 20px rgba(120, 88, 50, 0.1);
}

body.theme-dark .brand {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  text-decoration: none;
}

body.theme-dark .brand-logo-wrap {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle at 30% 30%, #fff7e8, #f2e0bf 70%);
  border: 1.5px solid rgba(166, 119, 69, 0.4);
  padding: 2px;
  box-shadow:
    0 10px 24px rgba(80, 58, 34, 0.2),
    inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

body.theme-dark .brand-logo {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: transparent;
  transform: scale(1.03);
}

body.theme-dark .brand-text {
  display: grid;
  line-height: 1.2;
}

body.theme-dark .brand-text strong {
  color: #111111;
  font-family: "Aref Ruqaa Ink", "Aref Ruqaa", "Cairo", serif;
  font-size: 1.95rem;
  font-weight: 700;
  letter-spacing: 0;
  text-shadow: none;
}

body.theme-dark .brand-text small {
  color: #7b5a35;
  font-size: 0.78rem;
  font-weight: 600;
}

body.theme-dark .brand:hover .brand-text strong {
  color: #111111;
}

body.theme-dark .nav-menu {
  gap: 0.5rem;
  flex-wrap: nowrap;
}

body.theme-dark .nav-menu a {
  color: #3f2b1d;
  font-size: 0.9rem;
  padding: 0.45rem 0.6rem;
  white-space: nowrap;
}

body.theme-dark .nav-menu a:hover,
body.theme-dark .nav-menu a.active {
  color: #2f2318;
  background: rgba(189, 146, 81, 0.16);
}

body.theme-dark .menu-toggle span {
  background: #3f2b1d;
}

@media (max-width: 560px) {
  body.theme-dark .brand-logo-wrap {
    width: 60px;
    height: 60px;
  }

  body.theme-dark .brand-text strong {
    font-size: 1.55rem;
  }

  body.theme-dark .brand-text small {
    font-size: 0.72rem;
  }
}

/* Final Brand Color Lock */
body.theme-dark .site-navbar .brand .brand-text strong,
body.theme-dark .site-navbar .brand .brand-name {
  color: #5a3b1f !important;
  text-shadow: 0 1px 0 rgba(255, 246, 230, 0.5);
}

body.theme-dark .site-navbar .brand:hover .brand-text strong,
body.theme-dark .site-navbar .brand:hover .brand-name {
  color: #7a522a !important;
}

/* About Page Visual Alignment */
body.theme-dark.about-page {
  background:
    radial-gradient(900px 420px at 85% -10%,
      rgba(201, 159, 98, 0.14),
      transparent 60%),
    linear-gradient(135deg, #f8efde 0%, #f2e7d1 52%, #ebddc1 100%);
}

body.theme-dark.about-page .page-hero {
  background:
    radial-gradient(760px 340px at 80% -20%,
      rgba(201, 159, 98, 0.16),
      transparent 62%),
    linear-gradient(135deg, #f6ebd7 0%, #efe2c8 100%);
  border-bottom: 1px solid rgba(173, 136, 82, 0.24);
  padding: 1.4rem 0 1.1rem;
}

body.theme-dark.about-page .page-hero h1 {
  color: #3f2f20;
}

body.theme-dark.about-page .page-hero p {
  color: #6a533a;
}

body.theme-dark.about-page .section-head .eyebrow {
  color: #9f7541;
}

body.theme-dark.about-page .section-head h2 {
  color: #3f2f20;
}

body.theme-dark.about-page .card {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.6rem 1.4rem;
  background: #f6edd8;
  border: 1px solid rgba(170, 132, 79, 0.2);
  box-shadow: 0 10px 24px rgba(121, 90, 52, 0.1);
}

body.theme-dark.about-page .card h2,
body.theme-dark.about-page .card h3 {
  color: #43301f;
}

body.theme-dark.about-page .card h3 {
  margin-top: 1.1rem;
  margin-bottom: 0.35rem;
}

body.theme-dark.about-page .card p {
  color: #5d4a35;
  line-height: 2;
  margin-bottom: 0.55rem;
}

@media (max-width: 700px) {
  body.theme-dark.about-page .card {
    padding: 1.25rem 1rem;
    border-radius: 14px;
  }

  body.theme-dark.about-page .card p {
    line-height: 1.9;
  }
}

body.theme-dark.about-page .figures-section {
  margin-top: 2.2rem;
  padding-top: 1.2rem;
  border-top: 1px solid rgba(164, 126, 72, 0.26);
}

body.theme-dark.about-page .figures-quick {
  margin-bottom: 1.2rem;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.55rem !important;
}

body.theme-dark.about-page .figures-quick .card {
  padding: 0.9rem 0.8rem;
  min-height: 120px;
}

body.theme-dark.about-page .figures-quick .card h3 {
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
}

body.theme-dark.about-page .figure-detail {
  margin-top: 1rem;
  padding: 1.35rem 1.2rem;
  border: 1px solid rgba(160, 124, 72, 0.28);
  border-radius: 16px;
  background: #f6edd8;
}

body.theme-dark.about-page .figure-detail h3 {
  margin-top: 0;
  margin-bottom: 0.45rem;
  color: #3f2d1f;
}

body.theme-dark.about-page .figure-detail h3+p {
  margin-bottom: 0.65rem;
}

body.theme-dark.about-page .figure-detail p {
  margin-bottom: 0.5rem;
}

@media (max-width: 1100px) {
  body.theme-dark.about-page .figures-quick {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  body.theme-dark.about-page .figures-quick {
    grid-template-columns: 1fr;
  }
}

/* Family Tree Page Alignment */
body.theme-dark.family-tree-page {
  background:
    radial-gradient(900px 420px at 86% -10%,
      rgba(196, 153, 93, 0.14),
      transparent 60%),
    linear-gradient(135deg, #f8efde 0%, #f2e6cf 52%, #ecddc1 100%);
}

body.theme-dark.family-tree-page .page-hero {
  background:
    radial-gradient(760px 340px at 80% -20%,
      rgba(196, 153, 93, 0.16),
      transparent 62%),
    linear-gradient(135deg, #f6ebd7 0%, #efe2c8 100%);
  border-bottom: 1px solid rgba(170, 132, 78, 0.24);
}

body.theme-dark.family-tree-page .page-hero h1 {
  color: #3f2f20;
}

body.theme-dark.family-tree-page .page-hero p {
  color: #6a533a;
}

body.theme-dark.family-tree-page .section-head h2 {
  color: #3f2f20;
}

body.theme-dark.family-tree-page .section-head .eyebrow {
  color: #9f7541;
}

body.theme-dark.family-tree-page .family-tree-subhead {
  margin-top: 1.7rem;
}

body.theme-dark.family-tree-page .card {
  background: linear-gradient(145deg,
      rgba(249, 241, 224, 0.96),
      rgba(242, 230, 202, 0.96));
  border: 1px solid rgba(170, 132, 79, 0.22);
  box-shadow: 0 10px 24px rgba(121, 90, 52, 0.1);
  padding: 1.2rem 1rem;
}

body.theme-dark.family-tree-page .card h3 {
  color: #43301f;
}

body.theme-dark.family-tree-page .card p,
body.theme-dark.family-tree-page .clean-list li {
  color: #5d4a35;
}

body.theme-dark.family-tree-page .three-cols {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 860px) {
  body.theme-dark.family-tree-page .three-cols {
    grid-template-columns: 1fr;
  }
}

/* Home Page Buttons Refinement */
.home-page .hero-actions .btn,
.home-page .section-actions .btn {
  min-width: 190px;
}

/* Home: summary card polish */
.home-page .about-summary-card {
  display: grid;
  gap: 0.65rem;
  background: linear-gradient(145deg, #f7edd9, #edd9b9) !important;
  border: 1px solid rgba(150, 110, 66, 0.22) !important;
  box-shadow: 0 10px 22px rgba(88, 61, 35, 0.08) !important;
  position: relative;
  overflow: hidden;
  border-radius: 32px;
}

.home-page .about-summary-card::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 26px;
  border: 1px dashed rgba(168, 121, 71, 0.18);
  pointer-events: none;
}

/* Home: section cards with bordered look */
.home-page main .card {
  background: linear-gradient(145deg, #f7edd9, #edd9b9) !important;
  border: 1px solid rgba(150, 110, 66, 0.24) !important;
  border-radius: 22px !important;
  box-shadow: 0 8px 18px rgba(88, 61, 35, 0.08) !important;
}

.home-page .about-summary-card p {
  font-size: 1.02rem;
  line-height: 1.9;
}

/* Home: tree preview polish */
.home-page .tree-preview-card {
  display: grid;
  gap: 0.8rem;
  padding: 1.3rem 1.1rem;
  border: 1px solid rgba(150, 110, 66, 0.24);
  background: transparent !important;
  border-radius: 24px;
}

.home-page .tree-preview-card .tree-row {
  justify-content: center;
  gap: 0.6rem;
}

.home-page .tree-preview-card .tree-row span {
  background: transparent;
  border: 1px solid rgba(150, 110, 66, 0.22);
  font-weight: 700;
}

.home-page .tree-preview-card .tree-line {
  height: 20px;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(#b98752, transparent);
}

@media (max-width: 900px) {
  .home-page .about-summary-card {
    padding: 1rem 0.95rem;
  }

  .home-page .tree-preview-card {
    padding: 1rem 0.9rem;
  }
}

.home-page .section-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  justify-content: center;
}

@media (max-width: 980px) {

  .home-page .hero-actions .btn,
  .home-page .section-actions .btn {
    width: 100%;
    min-width: 0;
  }
}

/* Final Global Polish */
body.theme-dark {
  background:
    radial-gradient(1100px 520px at 88% -12%,
      rgba(198, 156, 97, 0.12),
      transparent 60%),
    linear-gradient(135deg, #f8efde 0%, #f2e6cf 52%, #ebddbf 100%);
}

body.theme-dark .page-hero,
body.theme-dark .section,
body.theme-dark .section-soft {
  background:
    radial-gradient(760px 340px at 82% -20%,
      rgba(198, 156, 97, 0.13),
      transparent 62%),
    linear-gradient(135deg, #f7ecd7 0%, #efe2c8 100%);
}

body.theme-dark .card,
body.theme-dark .tree-preview,
body.theme-dark .heritage-poem-wrap {
  background: linear-gradient(145deg,
      rgba(249, 241, 224, 0.97),
      rgba(242, 230, 202, 0.97));
  border: 1px solid rgba(170, 132, 79, 0.22);
  box-shadow: 0 10px 24px rgba(121, 90, 52, 0.1);
}

body.theme-dark .card h3,
body.theme-dark .section-head h2,
body.theme-dark .page-hero h1 {
  color: #3f2f20;
}

body.theme-dark .card p,
body.theme-dark .page-hero p,
body.theme-dark .clean-list li {
  color: #5f4b35;
}

.section {
  padding-top: 3.3rem !important;
  padding-bottom: 3rem !important;
}

.home-page .section {
  padding-top: 3.4rem !important;
  padding-bottom: 3rem !important;
}

.site-footer {
  margin-top: 0 !important;
}

/* Mobile Responsive Final */
@media (max-width: 768px) {

  html,
  body {
    overflow-x: hidden;
  }

  .container {
    width: min(100% - 1.2rem, 1140px);
  }

  .section,
  .home-page .section {
    padding-top: 2.3rem !important;
    padding-bottom: 2.1rem !important;
  }

  .page-hero {
    padding: 2.2rem 0 1.8rem;
  }

  .page-hero h1 {
    font-size: clamp(1.45rem, 6.3vw, 2rem);
    line-height: 1.4;
  }

  .section-head h2 {
    font-size: clamp(1.25rem, 5.8vw, 1.7rem);
    line-height: 1.45;
  }

  .hero-main-row {
    gap: 0.75rem;
  }

  .home-page .hero-story-sequence,
  .hero-story-sequence {
    min-height: 280px !important;
    padding: 0.95rem 0.85rem;
  }

  .hero-step-title {
    font-size: 1.15rem;
  }

  .hero-step-text,
  .hero-step-poem,
  .hero-step-note {
    font-size: 0.95rem;
    line-height: 1.85;
  }

  .card {
    padding: 1rem 0.9rem !important;
    border-radius: 14px;
  }

  .card h3 {
    font-size: 1.06rem;
    line-height: 1.45;
  }

  .card p,
  .clean-list li {
    font-size: 0.95rem;
    line-height: 1.85;
    overflow-wrap: anywhere;
  }

  .tree-row {
    gap: 0.45rem;
  }

  .tree-row span {
    width: 100%;
    text-align: center;
    padding: 0.52rem 0.75rem;
  }

  .hero-actions,
  .section-actions {
    gap: 0.5rem !important;
  }

  .hero-actions .btn,
  .section-actions .btn,
  .tree-cta {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 44px;
    font-size: 0.95rem;
  }

  .nav-menu a {
    padding: 0.8rem 0.72rem !important;
    font-size: 0.97rem;
  }
}

@media (max-width: 480px) {
  .container {
    width: min(100% - 0.9rem, 1140px);
  }

  .brand-text strong {
    font-size: 1.22rem !important;
  }

  .hero-pill {
    font-size: 0.75rem;
    padding: 0.2rem 0.55rem;
  }

  .home-page .hero-story-sequence,
  .hero-story-sequence {
    min-height: 220px !important;
    padding: 0.82rem 0.72rem;
  }

  .section-head {
    margin-bottom: 0.9rem;
  }
}

/* Maather Section */
.about-page #maather-ibn-oudah .figure-detail h3 {
  position: relative;
  padding-right: 0.7rem;
}

.about-page #maather-ibn-oudah .figure-detail h3::before {
  content: "";
  position: absolute;
  right: 0;
  top: 0.2rem;
}

.about-page #maather-ibn-oudah .figure-detail h3:first-of-type::before {
  width: 4px;
  height: calc(100% - 0.4rem);
  border-radius: 999px;
  background: linear-gradient(to bottom, #b88a50, #d8b27a);
}

.about-page #maather-ibn-oudah .figure-detail h3:not(:first-of-type) {
  padding-right: 1rem;
}

.about-page #maather-ibn-oudah .figure-detail h3:not(:first-of-type)::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  top: 0.72rem;
  background: #8d6333;
}

/* Diwan Page */

.diwan-page .diwan-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.diwan-page .diwan-index {
  position: sticky;
  top: 92px;
}

.diwan-page .diwan-index ul {
  margin-top: 0.5rem;
}

.diwan-page .diwan-index-select-wrap {
  display: block;
  margin-top: 0.45rem;
  font-weight: 700;
  color: #5a3a22;
  font-size: 0.92rem;
}

.diwan-page .diwan-index-select {
  width: 100%;
  margin-top: 0.35rem;
  border-radius: 10px;
  border: 1px solid rgba(134, 96, 57, 0.32);
  background: rgba(255, 255, 255, 0.82);
  color: #4f3721;
  padding: 0.5rem 0.55rem;
  font-family: inherit;
  font-weight: 700;
}

.diwan-page .diwan-index a {
  color: var(--text-main);
  text-decoration: none;
  font-weight: 700;
  display: inline-block;
  border-radius: 8px;
  padding: 0.1rem 0.3rem;
}

.diwan-page .diwan-index a:hover {
  color: var(--gold-500);
}

.diwan-page .diwan-index a.is-active {
  color: #8d6333 !important;
  background: rgba(184, 138, 80, 0.16);
}

.diwan-page .diwan-content {
  display: grid;
  gap: 0.9rem;
}

.diwan-page .poem-card h3 {
  margin-bottom: 0.25rem;
}

.diwan-page .poem-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  background: linear-gradient(145deg,
      rgba(251, 245, 232, 0.96),
      rgba(244, 235, 214, 0.96));
  border: 1px solid rgba(163, 126, 76, 0.24);
}

.diwan-page .poem-card h3,
.diwan-page .poem-card .meta {
  grid-column: 1 / -1;
}

.diwan-page .poem-card h3 {
  color: #352516;
}

.diwan-page .poem-card .meta {
  color: #7a5a35;
}

.diwan-page .poem-lines {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(163, 126, 76, 0.2);
  border-right: 3px solid rgba(184, 138, 80, 0.7);
  border-radius: 12px;
  padding: 0.55rem 0.65rem;
  font-size: 1.02rem;
  line-height: 2;
  margin-bottom: 0;
  color: #4a3723;
}

.diwan-page .diwan-more {
  border-style: dashed;
}

@media (max-width: 980px) {
  .diwan-page .diwan-layout {
    grid-template-columns: 1fr;
  }

  .diwan-page .diwan-index {
    position: static;
  }

  .diwan-page .poem-card {
    grid-template-columns: 1fr;
  }
}

/* Diwan Color Fix */
body.theme-dark.diwan-page .section-head h2 {
  color: #6b4a2b;
}

body.theme-dark.diwan-page .diwan-index {
  background: linear-gradient(145deg, #fff9ee, #f4e8cf);
  border: 1px solid rgba(150, 110, 66, 0.28);
}

body.theme-dark.diwan-page .diwan-index h3 {
  color: #452d19;
}

body.theme-dark.diwan-page .diwan-index a,
body.theme-dark.diwan-page .diwan-index a:visited,
body.theme-dark.diwan-page .diwan-index a:active {
  color: #5a3a22 !important;
}

body.theme-dark.diwan-page .diwan-index a:hover {
  color: #9a6a36 !important;
}

body.theme-dark.diwan-page .diwan-index a.is-active {
  color: #7f5529 !important;
  background: rgba(176, 131, 72, 0.2);
}

body.theme-dark.diwan-page .poem-card,
body.theme-dark.diwan-page .diwan-more {
  background: linear-gradient(145deg, #fffaf1, #f2e4cd);
  border: 1px solid rgba(150, 110, 66, 0.24);
}

body.theme-dark.diwan-page .poem-card h3 {
  color: #3e2917;
}

body.theme-dark.diwan-page .poem-card .meta {
  color: #6f4f2f;
}

body.theme-dark.diwan-page .poem-lines {
  background: rgba(255, 255, 255, 0.72);
  color: #4a3622;
  border-color: rgba(150, 110, 66, 0.26);
  border-right-color: rgba(167, 119, 69, 0.8);
}

/* Diwan Hero + Verse Readability */
body.theme-dark.diwan-page .page-hero {
  background: transparent !important;
  border: 0;
  box-shadow: none;
  padding: 1.6rem 0 0.9rem;
}

body.theme-dark.diwan-page .page-hero h1 {
  color: #f7ead6 !important;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

body.theme-dark.diwan-page .page-hero p {
  color: #ead7bf !important;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.28);
}

body.theme-dark.diwan-page .poem-lines {
  background: #fffdfa;
  color: #2b1f14 !important;
  font-weight: 700;
  border-color: rgba(134, 96, 57, 0.32);
  border-right-color: rgba(147, 102, 57, 0.95);
}

body.theme-dark.diwan-page .poem-card .meta {
  color: #4f3721 !important;
  font-weight: 700;
}

/* Global Calm Hover */
.nav-menu a,
.btn,
.card,
.gallery-card,
.filter-btn,
.site-footer a,
.theme-toggle,
.brand {
  transition:
    color 0.2s ease,
    background-color 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.nav-menu a:hover,
.btn:hover,
.card:hover,
.gallery-card:hover,
.filter-btn:hover,
.site-footer a:hover,
.theme-toggle:hover,
.brand:hover {
  transform: none !important;
}

.nav-menu a:hover {
  background: rgba(184, 138, 80, 0.12) !important;
  color: #5f3d23 !important;
}

.btn:hover,
.filter-btn:hover {
  box-shadow: 0 4px 12px rgba(88, 61, 35, 0.12) !important;
}

.card:hover,
.gallery-card:hover {
  box-shadow: 0 8px 20px rgba(88, 61, 35, 0.1) !important;
}

.site-footer a:hover {
  color: #7a5230 !important;
}

/* Diwan Verse Shape (like manuscript view) */
body.theme-dark.diwan-page .poem-card {
  grid-template-columns: 1fr !important;
  gap: 0.55rem;
}

body.theme-dark.diwan-page .poem-lines.poem-bayt {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem;
  align-items: center;
  background: #f7f7f7;
  color: #1f1a16 !important;
  border: 1px solid #d7d7d7;
  border-right: 0;
  border-radius: 8px;
  padding: 0.5rem 0.8rem;
  font-weight: 600;
  line-height: 1.9;
  box-shadow: none !important;
}

body.theme-dark.diwan-page .poem-lines.poem-bayt .sadr,
body.theme-dark.diwan-page .poem-lines.poem-bayt .ajz {
  display: block;
  text-align: right;
  white-space: normal;
}

body.theme-dark.diwan-page .poem-lines.poem-bayt .sadr {
  border-left: 1px dashed #cfcfcf;
  padding-left: 0.75rem;
}

@media (max-width: 760px) {
  body.theme-dark.diwan-page .poem-lines.poem-bayt {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  body.theme-dark.diwan-page .poem-lines.poem-bayt .sadr {
    border-left: 0;
    padding-left: 0;
    border-bottom: 1px dashed #d2d2d2;
    padding-bottom: 0.35rem;
  }
}

body.theme-dark.diwan-page .poem-lines.is-hidden-line {
  display: none !important;
}

body.theme-dark.diwan-page .diwan-more-btn {
  justify-self: center;
  margin-top: 0.35rem;
  padding: 0.5rem 1.2rem;
  border-radius: 999px;
  border: 1px solid rgba(132, 95, 57, 0.35);
  background: linear-gradient(145deg, #f8efe0, #efe1c8);
  color: #5a3b22;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(88, 61, 35, 0.1);
}

body.theme-dark.diwan-page .diwan-more-btn:hover {
  background: linear-gradient(145deg, #f9f2e7, #f2e6d1);
  box-shadow: 0 4px 10px rgba(88, 61, 35, 0.12) !important;
}

.about-page .figure-detail .is-hidden-line {
  display: none !important;
}

body.theme-dark.about-page .figure-more-btn {
  margin-top: 0.35rem;
  padding: 0.45rem 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(132, 95, 57, 0.35);
  background: linear-gradient(145deg, #f8efe0, #efe1c8);
  color: #5a3b22;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}

body.theme-dark.about-page .figure-more-btn:hover {
  background: linear-gradient(145deg, #f9f2e7, #f2e6d1);
}

.back-to-top {
  position: fixed;
  left: 18px;
  bottom: 18px;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(140, 101, 60, 0.35);
  border-radius: 50%;
  background: linear-gradient(145deg, #f7eddc, #ead8bc);
  color: #5a3b22;
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(88, 61, 35, 0.16);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    visibility 0.2s ease;
  z-index: 1200;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: linear-gradient(145deg, #faf3e7, #efdfc8);
}

@media (max-width: 768px) {
  .back-to-top {
    left: 12px;
    bottom: 12px;
    width: 40px;
    height: 40px;
  }
}

/* Scroll Flash Fix */
html,
body {
  background-color: #efe2c8 !important;
  overscroll-behavior-y: none;
}

body.theme-dark {
  background-color: #efe2c8 !important;
}

body.theme-dark .section,
body.theme-dark .section-soft,
body.theme-dark .page-hero {
  background-color: #efe2c8 !important;
  background-image: none !important;
}

@media (hover: none) and (pointer: coarse) {

  .reveal,
  .reveal.visible {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* Fast-scroll black flicker fix */
.site-navbar,
.site-navbar.scrolled {
  backdrop-filter: none !important;
}

.bg-orb {
  display: none !important;
}

.card,
.poem-card,
.diwan-index,
.poem-lines {
  backface-visibility: visible;
  -webkit-backface-visibility: visible;
}

/* Strong anti-flicker override */
html {
  scroll-behavior: smooth !important;
}

.site-navbar,
.site-navbar.scrolled,
.card,
.poem-card,
.diwan-index,
.poem-lines,
.back-to-top {
  transform: none !important;
  filter: none !important;
  will-change: auto !important;
  animation: none !important;
}

.card,
.poem-card,
.diwan-index,
.poem-lines {
  box-shadow: 0 3px 10px rgba(88, 61, 35, 0.08) !important;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }
}

@media (max-width: 900px) {

  body.theme-dark .site-navbar,
  body.theme-dark .site-navbar.scrolled {
    background: #efe2c8 !important;
    background-image: none !important;
  }

  body.theme-dark .card,
  body.theme-dark .poem-card,
  body.theme-dark .diwan-index,
  body.theme-dark .poem-lines {
    background-image: none !important;
    box-shadow: 0 2px 8px rgba(88, 61, 35, 0.07) !important;
  }
}

/* Warm Tone Boost */
:root {
  --gold-500: #b7864f;
  --gold-400: #cfa26d;
  --gold-200: #f3dfc0;
}

body.theme-dark {
  color: #4f3925 !important;
}

body.theme-dark .page-hero,
body.theme-dark .section,
body.theme-dark .section-soft {
  background-color: #efe2c8 !important;
}

body.theme-dark .card,
body.theme-dark .tree-preview,
body.theme-dark .poem-card,
body.theme-dark .diwan-index,
body.theme-dark .poem-lines {
  background: linear-gradient(145deg, #f6ead3, #ecd8b6) !important;
  border-color: rgba(150, 110, 66, 0.28) !important;
}

body.theme-dark .card h3,
body.theme-dark .section-head h2,
body.theme-dark .page-hero h1 {
  color: #5a3b1f !important;
}

body.theme-dark .card p,
body.theme-dark .page-hero p,
body.theme-dark .clean-list li {
  color: #6b5033 !important;
}

body.theme-dark .btn-primary {
  background: linear-gradient(135deg, #c7965d, #a97642) !important;
  color: #2d1f13 !important;
}

/* Lightweight + Mobile Consistency */
body.theme-dark .section {
  padding-top: 2.35rem !important;
  padding-bottom: 2.15rem !important;
}

body.theme-dark .section+.section {
  margin-top: 0 !important;
  border-top: 0 !important;
}

body.theme-dark.about-page .figures-quick {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 0.85rem;
}

body.theme-dark.about-page .figures-quick .card {
  min-height: 122px;
}

@media (max-width: 1024px) {
  body.theme-dark.about-page .figures-quick {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 900px) {

  .reveal,
  .reveal.visible,
  .hero-story-step,
  .hero-inline-line {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    animation: none !important;
  }

  .card,
  .poem-card,
  .tree-preview,
  .diwan-index,
  .poem-lines {
    box-shadow: 0 1px 5px rgba(88, 61, 35, 0.06) !important;
  }

  .section-actions .btn,
  .hero-actions .btn,
  .tree-cta {
    width: 100%;
    min-width: 0 !important;
  }
}

@media (max-width: 680px) {

  body.theme-dark .section,
  .home-page .section {
    padding-top: 1.7rem !important;
    padding-bottom: 1.55rem !important;
  }

  body.theme-dark.about-page .figures-quick {
    grid-template-columns: 1fr !important;
  }
}

/* Mobile Scroll Safety */
body.nav-open,
body.lightbox-open {
  overflow-y: auto !important;
}

html,
body {
  touch-action: pan-y;
}

body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 860px) {
  body:not(.nav-open) {
    overflow-y: auto !important;
  }

  .home-page main {
    overflow: visible !important;
  }
}

@media (max-width: 900px) {

  html,
  body {
    height: auto !important;
    min-height: 100% !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    position: static !important;
    overscroll-behavior-y: auto !important;
  }

  body {
    overflow: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  body.nav-open,
  body.lightbox-open {
    overflow: auto !important;
  }

  main {
    overflow: visible !important;
  }
}

/* Brand color override (ensure non-red in navbar) */
.site-navbar .brand-text strong {
  color: #4b2f19 !important;
  text-shadow: none !important;
}

/* Home: show poet name under long poem lines */
.home-page .hero-story-sequence {
  min-height: 520px;
}

.home-page .hero-step-note.hero-step-poet {
  margin-top: 0.5rem;
}

@media (max-width: 768px) {
  .home-page .hero-story-sequence {
    min-height: 640px;
  }
}

.home-page .hero-story-step {
  padding-bottom: 2.2rem;
}

.home-page .hero-step-note {
  display: inline-block;
  margin-top: 0.65rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 244, 226, 0.8);
  border: 1px solid rgba(176, 136, 75, 0.35);
  color: #2f2318;
  font-weight: 700;
}

.home-page .hero-step-note.hero-step-poet {
  background: rgba(255, 235, 204, 0.95);
  color: #2b1f14;
  font-weight: 800;
}

/* Delivery polish: section-by-section harmony */
.home-page #about-family-preview .about-summary-card {
  text-align: center;
  padding: 1.6rem 1.8rem;
}

.home-page #about-family-preview .about-summary-card p {
  margin-bottom: 0.6rem;
}

.home-page #key-figures-preview .cards,
.home-page #maather-preview .cards {
  align-items: stretch;
}

.home-page #key-figures-preview .card,
.home-page #maather-preview .card {
  text-align: center;
}

.home-page #diwan-preview .card,
.home-page #contributions-preview .card {
  text-align: center;
}

.home-page #photo-archive-preview .section-head {
  margin-bottom: 1.4rem;
}

.home-page #photo-archive-preview .section-lead {
  max-width: 640px;
}

.home-page #related-lineages .section-head {
  margin-bottom: 1.4rem;
  text-align: right;
}

.home-page #related-lineages .section-lead {
  max-width: 920px;
}

.home-page #related-lineages .card {
  max-width: 980px;
  margin-inline: auto;
  text-align: right;
  display: grid;
  gap: 0.8rem;
  padding: 1.5rem 1.6rem;
}

.home-page #related-lineages .card p {
  font-size: 1rem;
  line-height: 1.9;
}

.home-page #related-lineages .section-actions {
  margin-top: 1.2rem;
  justify-content: flex-start;
}

.home-page .tree-preview-card {
  text-align: center;
}

@media (max-width: 768px) {
  .home-page #about-family-preview .about-summary-card {
    text-align: right;
    padding: 1.25rem 1.3rem;
  }

  .home-page #key-figures-preview .card,
  .home-page #maather-preview .card,
  .home-page #diwan-preview .card,
  .home-page #contributions-preview .card {
    text-align: right;
  }

  .home-page #photo-archive-preview .section-lead {
    max-width: 100%;
  }

  .home-page #related-lineages .section-lead {
    max-width: 100%;
  }

  .home-page #related-lineages .card {
    max-width: 100%;
    padding: 1.15rem 1.2rem;
  }

  .home-page #related-lineages .section-actions {
    justify-content: flex-start;
  }
}

/* About page: clearer section rhythm */
.about-page #about-intro .card {
  padding: 1.6rem 1.8rem;
}

.about-page #about-intro h3 {
  margin-top: 1.1rem;
}

.about-page #about-intro ul,
.about-page #about-intro ol {
  margin-top: 0.6rem;
}

.about-page #about-intro ol {
  padding-inline-start: 1.4rem;
}

.about-page #related-lineages .history-poem {
  gap: 1rem;
}

.about-page #related-lineages .history-events h3 {
  margin-bottom: 0.35rem;
}

.about-page #related-lineages .lineage-tribe {
  font-size: 0.9rem;
  font-weight: 700;
  color: #b89666;
  margin-bottom: 0.6rem;
}

.about-page #related-lineages .lineage-branch-tags {
  justify-content: center;
}

.about-page #related-lineages .cards {
  gap: 1.2rem;
}

.about-page #related-lineages .history-events ul {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem 0.8rem;
}

.about-page #related-lineages .history-events li {
  text-align: center;
  padding: 0.5rem 0.7rem;
  border-radius: 12px;
  border: 1px solid rgba(150, 110, 66, 0.26);
  background: rgba(255, 255, 255, 0.18);
  line-height: 1.55;
  font-weight: 600;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.about-page #related-lineages .history-events li::before {
  display: none;
}

.about-page #contributions .figure-detail {
  margin-bottom: 1.6rem;
}

@media (max-width: 768px) {
  .about-page #about-intro .card {
    padding: 1.2rem 1.25rem;
  }

  .about-page #related-lineages .lineage-branch-tags {
    justify-content: flex-start;
  }

  .about-page #related-lineages .section-head {
    text-align: right;
  }

  .about-page #related-lineages .section-lead {
    max-width: 100%;
  }

  .about-page #related-lineages .history-poem {
    gap: 0.8rem;
  }

  .about-page #related-lineages .cards {
    gap: 0.9rem;
  }

  .about-page #related-lineages .card {
    padding: 1.15rem 1.2rem;
  }

  .about-page #related-lineages .history-events h3 {
    text-align: right;
    margin-bottom: 0.6rem;
  }

  .about-page #related-lineages .history-events ul {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
  }

  .about-page #related-lineages .history-events li {
    font-size: 0.95rem;
    padding: 0.4rem 0.5rem;
  }
}

/* Global section consistency + anchor offsets */
html {
  scroll-padding-top: 104px;
}

.section,
.figures-section,
.page-hero {
  scroll-margin-top: 104px;
}

.section-head {
  max-width: 980px;
  margin-inline: auto;
}

.section-lead {
  max-width: 920px;
  margin-inline: auto;
  color: var(--text-muted);
  line-height: 1.9;
}

.card p+p,
.card ul+p,
.card p+ul,
.card ul+ul {
  margin-top: 0.6rem;
}

.card ul {
  padding-inline-start: 1.1rem;
}

.card ul.clean-list {
  padding-inline-start: 0;
}

.section-actions {
  margin-top: 1.1rem;
}

/* Mobile polish: tighter rhythm, cleaner stacking */
@media (max-width: 768px) {
  html {
    scroll-padding-top: 90px;
  }

  .section,
  .figures-section,
  .page-hero {
    scroll-margin-top: 90px;
  }

  .section {
    padding: 3.4rem 0;
  }

  .section-head {
    margin-bottom: 1.25rem;
  }

  .section-head h2 {
    font-size: clamp(1.45rem, 5.2vw, 2.05rem);
  }

  .section-lead {
    font-size: 0.98rem;
  }

  .cards {
    gap: 0.9rem;
  }

  .three-cols {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 1.05rem;
  }

  .hero-grid,
  .hero-main-row {
    grid-template-columns: 1fr;
    gap: 1.1rem;
  }

  .hero-story-sequence {
    padding: 0.9rem;
  }

  .hero-step-title {
    font-size: 1.25rem;
  }

  .hero-step-text {
    font-size: 0.98rem;
  }

  .hero-step-poem {
    font-size: 1rem;
  }

  .hero-actions,
  .section-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }

  .hero-actions .btn,
  .section-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .hero-highlights {
    padding: 0.9rem;
  }

  .hero-highlights p {
    font-size: 0.98rem;
  }

  .photo-archive-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .photo-archive-card {
    min-height: 190px;
  }

  .photo-archive-card figcaption {
    font-size: 0.85rem;
  }

  .tree-preview-card .tree-row {
    flex-direction: column;
    gap: 0.5rem;
  }

  .tree-preview-card .tree-row span {
    width: 100%;
    text-align: center;
  }

  .about-page .figures-names {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .section {
    padding: 3rem 0;
  }

  .photo-archive-grid {
    grid-template-columns: 1fr;
  }

  .nav-menu {
    width: min(360px, 92%);
  }
}
/* Mobile zoom + readability fixes (Homepage) */
@media (max-width: 900px) {
  .home-page .hero-main-row > * {
    min-width: 0;
  }

  .home-page .family-title,
  .home-page .hero-step-title,
  .home-page .hero-step-text,
  .home-page .hero-step-poem,
  .home-page .hero-highlights p {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .home-page .hero-story-sequence {
    min-height: 0 !important;
    height: auto;
    overflow: visible;
  }

  .home-page .hero-story-step {
    position: static;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    display: none;
    opacity: 1;
    transform: none;
    animation: none;
  }

  .home-page .hero-story-step.active {
    display: block;
  }
}

@media (max-width: 600px) {
  .home-page .hero {
    min-height: auto !important;
    padding-top: 5rem;
    padding-bottom: 2rem;
  }

  .home-page .hero-story-sequence {
    padding: 0.75rem 0.85rem;
  }

  .home-page .hero-step-children {
    gap: 0.35rem 0.45rem;
  }

  .home-page .hero-step-children span {
    font-size: 0.85rem;
    padding: 0.2rem 0.55rem;
  }
}


