@import url('https://fonts.googleapis.com/css2?family=Amiri:ital,wght@0,400;0,700;1,400&family=Noto+Naskh+Arabic:wght@400;500;600;700&family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;1,400&family=Karla:wght@300;400;500;600&display=swap');
@import url('family-tree.css');

:root {
  --radius: 0.25rem;
  --background: oklch(0.97 0.012 80);
  --foreground: oklch(0.28 0.025 50);
  --card: oklch(0.95 0.018 78);
  --card-foreground: oklch(0.28 0.025 50);
  --primary: oklch(0.48 0.045 55);
  --primary-foreground: oklch(0.97 0.012 80);
  --secondary: oklch(0.78 0.045 75);
  --muted: oklch(0.93 0.015 78);
  --muted-foreground: oklch(0.48 0.030 60);
  --accent: oklch(0.65 0.10 60);
  --accent-foreground: oklch(0.97 0.012 80);
  --border: oklch(0.85 0.022 75);
  --input: oklch(0.88 0.020 75);
  --ring: oklch(0.48 0.045 55);
  --sand: oklch(0.95 0.018 78);
  --gold: oklch(0.72 0.11 75);
  --font-display: "Amiri", "Cormorant Garamond", serif;
  --font-body: "Noto Naskh Arabic", "Karla", system-ui, sans-serif;
  --font-latin: "Cormorant Garamond", serif;
  color-scheme: light;
}

/* Dark mode — modern blue slate (clear, cool, readable; light theme unchanged) */
[data-theme="dark"] {
  color-scheme: dark;
  --background: oklch(0.24 0.012 252);
  --foreground: oklch(0.92 0.01 248);
  --card: oklch(0.30 0.014 250);
  --card-foreground: oklch(0.92 0.01 248);
  --primary: oklch(0.76 0.06 240);
  --primary-foreground: oklch(0.20 0.012 252);
  --secondary: oklch(0.35 0.014 248);
  --muted: oklch(0.33 0.012 248);
  --muted-foreground: oklch(0.70 0.018 242);
  --accent: oklch(0.75 0.07 232);
  --accent-foreground: oklch(0.20 0.012 252);
  --border: oklch(0.39 0.014 248);
  --input: oklch(0.33 0.014 248);
  --ring: oklch(0.75 0.07 232);
  --sand: oklch(0.29 0.012 250);
  --gold: oklch(0.74 0.05 235);
}

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

[data-theme="dark"] .paper-texture {
  background-image:
    radial-gradient(circle at 20% 18%, oklch(0.36 0.03 236 / 0.14) 0, transparent 55%),
    radial-gradient(circle at 82% 78%, oklch(0.33 0.022 248 / 0.1) 0, transparent 52%);
}

[data-theme="dark"] .hero-gradient {
  background: linear-gradient(
    to left,
    var(--background),
    color-mix(in oklch, var(--background) 82%, transparent),
    color-mix(in oklch, var(--background) 35%, transparent)
  );
}

[data-theme="dark"] .bg-card\/40,
[data-theme="dark"] .bg-card\/20 {
  background-color: color-mix(in oklch, var(--card) 55%, var(--background)) !important;
}

[data-theme="dark"] .border-border\/70 {
  border-color: color-mix(in oklch, var(--border) 75%, transparent) !important;
}

[data-theme="dark"] .ref-ig-card,
[data-theme="dark"] .ref-card,
[data-theme="dark"] .family-news-card,
[data-theme="dark"] .gallery-member-card {
  background: color-mix(in oklch, var(--card) 94%, var(--background));
  border-color: color-mix(in oklch, var(--border) 88%, transparent);
  box-shadow:
    0 1px 0 color-mix(in oklch, white 5%, transparent),
    0 10px 28px color-mix(in oklch, black 18%, transparent);
}

[data-theme="dark"] .ref-ig-card:hover,
[data-theme="dark"] .ref-card:hover,
[data-theme="dark"] .family-news-card:hover {
  border-color: color-mix(in oklch, var(--accent) 32%, var(--border));
  box-shadow:
    0 1px 0 color-mix(in oklch, white 6%, transparent),
    0 14px 32px color-mix(in oklch, black 22%, transparent);
}

[data-theme="dark"] .ref-ig-search,
[data-theme="dark"] input,
[data-theme="dark"] textarea {
  background-color: var(--card);
  border-color: var(--border);
  color: var(--foreground);
}

[data-theme="dark"] .ref-ig-search::placeholder,
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
  color: color-mix(in oklch, var(--muted-foreground) 85%, transparent);
}

[data-theme="dark"] .ref-ig-excerpt,
[data-theme="dark"] .text-muted-foreground {
  color: color-mix(in oklch, var(--foreground) 72%, var(--muted-foreground));
}

[data-theme="dark"] .theme-toggle {
  background: color-mix(in oklch, var(--card) 80%, var(--background));
  border-color: var(--border);
}

[data-theme="dark"] .ornament {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 20'><path d='M0 10h35M65 10h35' stroke='%238ea4c7' stroke-width='0.5'/><path d='M50 10l-8-6 0 12z M50 10l8-6 0 12z' fill='%23b8c8e3'/></svg>");
}

[data-theme="dark"] .ref-ig-card--source .ref-ig-thumb-label::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b8c8e3' stroke-width='1.35' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 19.5A2.5 2.5 0 0 1 6.5 17H20'/%3E%3Cpath d='M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z'/%3E%3Cpath d='M8 7h8M8 11h6'/%3E%3C/svg%3E");
}

[data-theme="dark"] .ref-ig-card--source .ref-ig-thumb-label {
  color: oklch(0.84 0.04 236);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: color-mix(in oklch, var(--card) 65%, transparent);
  color: var(--foreground);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.theme-toggle:hover {
  background: var(--card);
  border-color: color-mix(in oklch, var(--accent) 40%, var(--border));
  color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 18%, transparent);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.theme-toggle .icon {
  width: 1.05rem;
  height: 1.05rem;
}

.theme-toggle .theme-icon-sun {
  display: none;
}

.theme-toggle[aria-pressed="true"] .theme-icon-moon {
  display: none;
}

.theme-toggle[aria-pressed="true"] .theme-icon-sun {
  display: block;
}

/* Site footer */
.footer-grid {
  display: grid;
  gap: 2rem 2.25rem;
  grid-template-columns: minmax(0, 1fr);
}

.footer-brand {
  max-width: 22rem;
}

.footer-nav-heading {
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  font-family: var(--font-latin);
}

.footer-nav-list {
  margin: 0.85rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.45rem;
  font-size: 0.875rem;
}

.footer-nav-list a {
  color: color-mix(in oklch, var(--foreground) 82%, transparent);
  transition: color 150ms ease;
}

.footer-nav-list a:hover {
  color: var(--accent);
}

.footer-contact-col .footer-nav-heading {
  margin-bottom: 0;
}

@media (min-width: 640px) {
  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer-brand {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1024px) {
  .footer-grid {
    grid-template-columns: minmax(14rem, 1.45fr) repeat(3, minmax(6.5rem, 1fr)) minmax(10rem, 1.1fr);
    align-items: start;
  }

  .footer-brand {
    grid-column: auto;
  }
}

html.theme-animate,
html.theme-animate * {
  transition:
    background-color 220ms ease,
    color 220ms ease,
    border-color 220ms ease,
    box-shadow 220ms ease;
}

*, *::before, *::after { box-sizing: border-box; border-color: var(--border); }

html { scroll-behavior: smooth; overflow-x: clip; }

body {
  margin: 0;
  overflow-x: clip;
  background-color: var(--background);
  color: var(--foreground);
  font-family: var(--font-body);
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

a { color: inherit; text-decoration: none; }

img { max-width: 100%; height: auto; display: block; }

button, input, textarea { font-family: inherit; }

/* Custom utilities from original theme */
.font-display { font-family: var(--font-display); }
.font-body { font-family: var(--font-body); }
.font-latin { font-family: var(--font-latin); font-feature-settings: "liga", "dlig"; }

.ornament {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 20'><path d='M0 10h35M65 10h35' stroke='%238b7355' stroke-width='0.5'/><path d='M50 10l-8-6 0 12z M50 10l8-6 0 12z' fill='%23c9a84c'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  height: 20px;
}

.paper-texture {
  background-image:
    radial-gradient(circle at 20% 30%, oklch(0.88 0.04 70 / 0.3) 0, transparent 50%),
    radial-gradient(circle at 80% 70%, oklch(0.85 0.05 60 / 0.25) 0, transparent 50%);
}

/* Layout */
.min-h-screen { min-height: 100vh; }
.min-h-\[60vh\] { min-height: 60vh; }
.flex { display: flex; }
.flex-1 { flex: 1 1 0%; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.inline-flex { display: inline-flex; }
.inline-block { display: inline-block; }
.grid { display: grid; }
.hidden { display: none; }
.block { display: block; }
.place-items-center { place-items: center; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-7 { gap: 1.75rem; }
.gap-10 { gap: 2.5rem; }
.gap-12 { gap: 3rem; }
.gap-12 { gap: 3rem; }
.gap-px { gap: 1px; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-5 > * + * { margin-top: 1.25rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }
.space-y-10 > * + * { margin-top: 2.5rem; }
.space-y-16 > * + * { margin-top: 4rem; }
.divide-y > * + * { border-top: 1px solid var(--border); }
.divide-border > * + * { border-color: var(--border); }

.relative { position: relative; }
.absolute { position: absolute; }
.sticky { position: sticky; }
.inset-0 { inset: 0; }
.top-0 { top: 0; }
.top-1 { top: 0.25rem; }
.-bottom-6 { bottom: -1.5rem; }
.-left-6 { left: -1.5rem; }
.-right-\[42px\] { right: -42px; }
.z-10 { z-index: 10; }
.z-40 { z-index: 40; }

.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x-auto; }

.mx-auto { margin-left: auto; margin-right: auto; }
.-mx-6 { margin-left: -1.5rem; margin-right: -1.5rem; }
.mt-0\.5 { margin-top: 0.125rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.25rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-10 { margin-top: 2.5rem; }
.mt-12 { margin-top: 3rem; }
.mt-16 { margin-top: 4rem; }
.mt-20 { margin-top: 5rem; }
.mt-24 { margin-top: 6rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-16 { margin-bottom: 4rem; }
.my-5 { margin-top: 1.25rem; margin-bottom: 1.25rem; }
.my-6 { margin-top: 1.5rem; margin-bottom: 1.5rem; }
.my-12 { margin-top: 3rem; margin-bottom: 3rem; }
.mr-1 { margin-right: 0.25rem; }
.pl-6 { padding-left: 1.5rem; }
.pr-8 { padding-right: 2rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.px-7 { padding-left: 1.75rem; padding-right: 1.75rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-2\.5 { padding-top: 0.625rem; padding-bottom: 0.625rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-5 { padding-top: 1.25rem; padding-bottom: 1.25rem; }
.py-14 { padding-top: 3.5rem; padding-bottom: 3.5rem; }
.py-20 { padding-top: 5rem; padding-bottom: 5rem; }
.py-24 { padding-top: 6rem; padding-bottom: 6rem; }
.py-28 { padding-top: 7rem; padding-bottom: 7rem; }
.p-2 { padding: 0.5rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.p-12 { padding: 3rem; }
.pt-5 { padding-top: 1.25rem; }
.pt-10 { padding-top: 2.5rem; }
.pb-6 { padding-bottom: 1.5rem; }

.w-3\.5 { width: 0.875rem; }
.w-4 { width: 1rem; }
.w-5 { width: 1.25rem; }
.w-7 { width: 1.75rem; }
.w-10 { width: 2.5rem; }
.w-20 { width: 5rem; }
.w-32 { width: 8rem; }
.w-40 { width: 10rem; }
.w-44 { width: 11rem; }
.w-full { width: 100%; }
.h-3\.5 { height: 0.875rem; }
.h-4 { height: 1rem; }
.h-5 { height: 1.25rem; }
.h-6 { height: 1.5rem; }
.h-7 { height: 1.75rem; }
.h-10 { height: 2.5rem; }
.h-full { height: 100%; }
.h-auto { height: auto; }
.min-w-max { min-width: max-content; }
.max-w-md { max-width: 28rem; }
.max-w-xl { max-width: 36rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-3xl { max-width: 48rem; }
.max-w-4xl { max-width: 56rem; }
.max-w-5xl { max-width: 64rem; }
.max-w-7xl { max-width: 80rem; }
.max-w-sm { max-width: 24rem; }
.aspect-\[3\/2\] { aspect-ratio: 3 / 2; }
.aspect-\[3\/4\] { aspect-ratio: 3 / 4; }
.aspect-\[16\/9\] { aspect-ratio: 16 / 9; }

.text-center { text-align: center; }
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
.text-5xl { font-size: 3rem; line-height: 1; }
.text-7xl { font-size: 4.5rem; line-height: 1; }
.text-\[10px\] { font-size: 10px; }
.text-\[11px\] { font-size: 11px; }
.uppercase { text-transform: uppercase; }
.italic { font-style: italic; }
.leading-tight { line-height: 1.25; }
.leading-7 { line-height: 1.75rem; }
.leading-8 { line-height: 2rem; }
.leading-9 { line-height: 2.25rem; }
.leading-relaxed { line-height: 1.625; }
.tracking-wide { letter-spacing: 0.025em; }
.tracking-wider { letter-spacing: 0.05em; }
.tracking-widest { letter-spacing: 0.1em; }
.tracking-\[0\.2em\] { letter-spacing: 0.2em; }
.tracking-\[0\.25em\] { letter-spacing: 0.25em; }
.tracking-\[0\.3em\] { letter-spacing: 0.3em; }
.tracking-\[0\.4em\] { letter-spacing: 0.4em; }
.tracking-\[0\.5em\] { letter-spacing: 0.5em; }
.whitespace-nowrap { white-space: nowrap; }
.break-all { word-break: break-all; }

.text-foreground { color: var(--foreground); }
.text-muted-foreground { color: var(--muted-foreground); }
.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-primary-foreground { color: var(--primary-foreground); }
.text-foreground\/70 { color: color-mix(in oklch, var(--foreground) 70%, transparent); }
.text-foreground\/80 { color: color-mix(in oklch, var(--foreground) 80%, transparent); }
.text-foreground\/90 { color: color-mix(in oklch, var(--foreground) 90%, transparent); }
.text-primary\/80 { color: color-mix(in oklch, var(--primary) 80%, transparent); }

.bg-background { background-color: var(--background); }
.bg-card { background-color: var(--card); }
.bg-primary { background-color: var(--primary); }
.bg-border { background-color: var(--border); }
.bg-background\/60 { background-color: color-mix(in oklch, var(--background) 60%, transparent); }
.bg-background\/85 { background-color: color-mix(in oklch, var(--background) 85%, transparent); }
.bg-card\/30 { background-color: color-mix(in oklch, var(--card) 30%, transparent); }
.bg-card\/40 { background-color: color-mix(in oklch, var(--card) 40%, transparent); }
.bg-card\/50 { background-color: color-mix(in oklch, var(--card) 50%, transparent); }
.bg-card\/60 { background-color: color-mix(in oklch, var(--card) 60%, transparent); }
.bg-accent\/10 { background-color: color-mix(in oklch, var(--accent) 10%, transparent); }

.border { border-width: 1px; border-style: solid; }
.border-4 { border-width: 4px; border-style: solid; }
.border-b { border-bottom-width: 1px; border-bottom-style: solid; }
.border-t { border-top-width: 1px; border-top-style: solid; }
.border-y { border-top-width: 1px; border-top-style: solid; border-bottom-width: 1px; border-bottom-style: solid; }
.border-r { border-right-width: 1px; border-right-style: solid; }
.border-l { border-left-width: 1px; border-left-style: solid; }
.border-border { border-color: var(--border); }
.border-border\/60 { border-color: color-mix(in oklch, var(--border) 60%, transparent); }
.border-border\/70 { border-color: color-mix(in oklch, var(--border) 70%, transparent); }
.border-input { border-color: var(--input); }
.border-primary\/40 { border-color: color-mix(in oklch, var(--primary) 40%, transparent); }
.border-accent { border-color: var(--accent); }
.border-background { border-color: var(--background); }

.rounded-sm { border-radius: var(--radius); }
.rounded-md { border-radius: calc(var(--radius) + 2px); }
.rounded-full { border-radius: 9999px; }

.shadow-sm { box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); }
.shadow-xl { box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1); }

.backdrop-blur { backdrop-filter: blur(8px); }
.object-cover { object-fit: cover; }

.transition-colors { transition-property: color, background-color, border-color; transition-duration: 150ms; }
.transition-all { transition-property: all; transition-duration: 150ms; }
.transition-transform { transition-property: transform; transition-duration: 150ms; }
.duration-700 { transition-duration: 700ms; }

.grid-cols-\[auto_1fr_auto\] { grid-template-columns: auto 1fr auto; }
.columns-1 { columns: 1; }
.shrink-0 { flex-shrink: 0; }
.break-inside-avoid { break-inside: avoid; }
.column-fill-balance,
[class*="column-fill"] { column-fill: balance; }

.hero-gradient {
  background: linear-gradient(to left, var(--background), color-mix(in oklch, var(--background) 70%, transparent), color-mix(in oklch, var(--background) 20%, transparent));
}

/* Hover & focus */
.hover\:text-foreground:hover { color: var(--foreground); }
.hover\:text-accent:hover { color: var(--accent); }
.hover\:underline:hover { text-decoration: underline; }
.hover\:bg-card:hover { background-color: var(--card); }
.hover\:bg-primary:hover { background-color: var(--primary); }
.hover\:text-primary-foreground:hover { color: var(--primary-foreground); }
.hover\:bg-primary\/90:hover { background-color: color-mix(in oklch, var(--primary) 90%, transparent); }
.hover\:gap-3:hover { gap: 0.75rem; }
.group:hover .group-hover\:gap-3 { gap: 0.75rem; }
.group:hover .group-hover\:scale-\[1\.03\] { transform: scale(1.03); }
.group:hover .group-hover\:text-accent { color: var(--accent); }

.focus\:outline-none:focus { outline: none; }
.focus\:ring-1:focus { box-shadow: 0 0 0 1px var(--ring); }

/* Active nav */
.nav-link.is-active { color: var(--accent); font-weight: 600; }

/* Mobile menu */
#mobile-nav { display: none; }
#mobile-nav.is-open { display: block; }

/* Icon sizing */
.icon { flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }

/* Family tree — nested lists + CSS connectors (see css/family-tree.css) */
.family-tree-section {
  max-width: 100%;
  --family-tree-line: #9a6848;
  --family-tree-line-soft: color-mix(in oklch, var(--family-tree-line) 35%, transparent);
  --family-tree-line-width: 2.75px;
  --family-tree-joint: #b87850;
  --family-tree-card-from: #faf6ee;
  --family-tree-card-to: #ede3cf;
  --family-tree-card-border: #c9a56a;
  --family-tree-card-shadow: color-mix(in oklch, #6b4a2a 22%, transparent);
  --family-tree-accent: #b45309;
  --family-tree-gold: #c9952a;
  --family-tree-v-gap: 2.75rem;
  --family-tree-h-gap: 0.65rem;
  --family-tree-stem: 1.5rem;
  --tree-sibling-gap: 0.4rem;
  --tree-level-gap: 0.85rem;
}

.family-tree-lineage {
  border: 1px solid color-mix(in oklch, var(--family-tree-gold) 35%, var(--border));
  border-radius: calc(var(--radius) * 2);
  padding: 1.35rem 1.75rem;
  background: linear-gradient(
    165deg,
    color-mix(in oklch, var(--card) 88%, var(--background)),
    color-mix(in oklch, var(--family-tree-gold) 6%, var(--card))
  );
  box-shadow:
    0 1px 0 color-mix(in oklch, white 40%, transparent) inset,
    0 12px 32px color-mix(in oklch, var(--foreground) 6%, transparent);
}

.family-tree-member-count {
  flex: 1 1 100%;
  margin: 0;
  padding: 0.5rem 0.85rem;
  border-radius: calc(var(--radius) * 1.5);
  border: 1px solid color-mix(in oklch, var(--family-tree-gold) 32%, var(--border));
  background: color-mix(in oklch, var(--card) 70%, var(--background));
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--muted-foreground);
  text-align: center;
  width: 100%;
}

.family-tree-member-count-num {
  margin-inline-start: 0.35rem;
  font-family: var(--font-display, inherit);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--accent);
}

.family-tree-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 1.25rem;
  margin-bottom: 1.25rem;
}

.family-tree-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 1rem;
  font-size: 0.6875rem;
  color: var(--muted-foreground);
}

.family-tree-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.family-tree-legend-swatch {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 2px;
  flex-shrink: 0;
}

.family-tree-legend-swatch--root {
  background: linear-gradient(135deg, #faf0d4, #e8c878);
  border: 1px solid #c9952a;
}

.family-tree-legend-swatch--lineage {
  background: linear-gradient(135deg, #faf6ee, #ede3cf);
  border: 1px solid #a08050;
}

.family-tree-legend-swatch--focus {
  background: linear-gradient(135deg, #fff8ee, #f5dcc0);
  border: 1px solid #b45309;
  box-shadow: 0 0 0 1px color-mix(in oklch, #b45309 25%, transparent);
}

.family-tree-pan {
  width: 100%;
  max-width: 100%;
  margin-inline: auto;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-x pan-y;
  border: 1px solid color-mix(in oklch, var(--family-tree-gold) 28%, var(--border));
  border-radius: calc(var(--radius) * 2);
  background-color: #f3ebe0;
  background-image:
    radial-gradient(ellipse 120% 80% at 50% 0%, color-mix(in oklch, var(--family-tree-gold) 8%, transparent), transparent 55%),
    radial-gradient(circle, color-mix(in oklch, #6b4a2a 14%, transparent) 1px, transparent 1px);
  background-size: 100% 100%, 20px 20px;
  background-position: center, center;
  padding: 2rem 1.25rem 2.5rem;
  min-height: 28rem;
  max-height: min(96vh, 1800px);
  scrollbar-width: thin;
  scrollbar-color: var(--family-tree-accent) color-mix(in oklch, var(--border) 60%, transparent);
  direction: ltr;
  text-align: center;
  box-shadow:
    0 1px 0 color-mix(in oklch, white 50%, transparent) inset,
    0 20px 50px color-mix(in oklch, var(--foreground) 8%, transparent),
    0 0 0 1px color-mix(in oklch, var(--family-tree-gold) 12%, transparent) inset;
}

.family-tree-pan::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.family-tree-pan::-webkit-scrollbar-thumb {
  background: color-mix(in oklch, var(--family-tree-accent) 75%, var(--border));
  border-radius: 999px;
}

/* Cards — see css/family-tree.css for connector layout */
.tree li > a.family-tree-node,
.tree li > a.family-tree-node--link,
.tree li > .family-tree-node {
  position: relative;
  z-index: 3;
  display: inline-block;
  width: fit-content;
  max-width: 6.25rem;
  border-radius: 8px;
  border: 1px solid var(--family-tree-card-border);
  padding: 0.42rem 0.5rem 0.48rem;
  text-align: center;
  background: linear-gradient(168deg, var(--family-tree-card-from) 0%, var(--family-tree-card-to) 100%);
  box-shadow:
    0 1px 0 color-mix(in oklch, white 55%, transparent) inset,
    0 3px 10px var(--family-tree-card-shadow),
    0 1px 2px color-mix(in oklch, black 6%, transparent);
  white-space: normal;
  box-sizing: border-box;
  min-width: 4.25rem;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.family-tree-section .family-tree-given {
  font-size: 0.8125rem;
  line-height: 1.3;
}

.family-tree-section .family-tree-pat {
  font-size: 0.5625rem;
  line-height: 1.4;
  margin-top: 0.2rem;
  padding-top: 0.2rem;
}

.tree li > .family-tree-node::before,
.tree li > a.family-tree-node::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0.65rem;
  right: 0.65rem;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: color-mix(in oklch, var(--family-tree-card-border) 70%, transparent);
  opacity: 0.55;
}

.family-tree-given {
  display: block;
  font-family: var(--font-display, inherit);
  font-size: 0.875rem;
  line-height: 1.35;
  color: color-mix(in oklch, var(--foreground) 95%, #3d2810);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.family-tree-pat {
  display: block;
  margin-top: 0.28rem;
  padding-top: 0.28rem;
  border-top: 1px solid color-mix(in oklch, var(--family-tree-card-border) 45%, transparent);
  font-size: 0.625rem;
  line-height: 1.45;
  color: color-mix(in oklch, var(--foreground) 52%, var(--muted-foreground));
  font-weight: 500;
  word-break: break-word;
}

.family-tree-branches {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.family-tree-branch {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in oklch, var(--card) 35%, var(--background));
  overflow: hidden;
}

.family-tree-branch-head {
  padding: 0.875rem 1rem 0.625rem;
  border-bottom: 1px solid color-mix(in oklch, var(--border) 80%, transparent);
  background: color-mix(in oklch, var(--card) 55%, transparent);
  text-align: center;
}

.family-tree-branch-title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--foreground);
}

.family-tree-branch-desc {
  margin: 0.25rem 0 0;
  font-size: 0.6875rem;
  color: var(--muted-foreground);
}

.family-tree-pan--branch {
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.family-tree-node.is-root {
  min-width: 5.25rem;
  max-width: 8.5rem;
  padding: 0.7rem 0.85rem 0.75rem;
  border-color: color-mix(in oklch, var(--family-tree-gold) 65%, var(--family-tree-card-border));
  background: linear-gradient(168deg, #faf0d4 0%, #e8d4a0 100%);
  box-shadow:
    0 1px 0 color-mix(in oklch, white 60%, transparent) inset,
    0 6px 18px color-mix(in oklch, var(--family-tree-gold) 28%, transparent),
    0 0 0 1px color-mix(in oklch, var(--family-tree-gold) 20%, transparent);
}

.family-tree-node.is-root::before {
  background: linear-gradient(90deg, #c9952a, #e8c878, #c9952a);
  opacity: 1;
  left: 0.5rem;
  right: 0.5rem;
}

.family-tree-node.is-root .family-tree-given {
  font-size: 1.05rem;
}

.family-tree-node.is-lineage::before {
  background: color-mix(in oklch, var(--primary) 55%, var(--family-tree-card-border));
  opacity: 0.75;
}

.family-tree-node.is-focus {
  border-color: color-mix(in oklch, var(--family-tree-accent) 70%, var(--family-tree-card-border));
  background: linear-gradient(168deg, #fff8ee 0%, #f5dcc0 100%);
  box-shadow:
    0 1px 0 color-mix(in oklch, white 55%, transparent) inset,
    0 4px 14px color-mix(in oklch, var(--family-tree-accent) 22%, transparent),
    0 0 0 2px color-mix(in oklch, var(--family-tree-accent) 18%, transparent);
}

.family-tree-node.is-focus::before {
  background: linear-gradient(90deg, #b45309, #d4844a, #b45309);
  opacity: 1;
}

.tree li > a.family-tree-node--link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.tree li > a.family-tree-node--link:hover {
  transform: translateY(-2px);
  border-color: var(--family-tree-accent);
  box-shadow:
    0 1px 0 color-mix(in oklch, white 55%, transparent) inset,
    0 8px 20px color-mix(in oklch, var(--family-tree-accent) 20%, transparent),
    0 0 0 2px color-mix(in oklch, var(--family-tree-accent) 12%, transparent);
}

.tree li > a.family-tree-node--link:focus-visible {
  outline: 2px solid var(--family-tree-accent);
  outline-offset: 2px;
}

.family-tree-node--daughters {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.2rem;
  max-width: 2.8rem;
  padding: 0.25rem 0.3rem;
  border-style: dashed;
  border-color: color-mix(in oklch, var(--accent) 40%, var(--border));
  background: color-mix(in oklch, var(--muted) 30%, transparent);
}

.family-tree-node--daughters::before {
  display: none;
}

.family-tree-daughters-icons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
}

.family-tree-leaf {
  width: 0.75rem;
  height: 0.75rem;
  color: var(--accent);
  flex-shrink: 0;
}

.family-tree-legend-leaves {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin-inline: 0.15rem;
}

.family-tree-legend-leaves .family-tree-leaf {
  width: 0.9rem;
  height: 0.9rem;
}

[data-theme="dark"] .family-tree-section {
  --family-tree-line: #d4956a;
  --family-tree-joint: #e8a878;
  --family-tree-card-from: #2a3040;
  --family-tree-card-to: #222838;
  --family-tree-card-border: #6a7898;
  --family-tree-card-shadow: color-mix(in oklch, black 35%, transparent);
  --family-tree-accent: #e8a060;
  --family-tree-gold: #d4a840;
}

[data-theme="dark"] .family-tree-lineage {
  background: linear-gradient(
    165deg,
    color-mix(in oklch, var(--card) 92%, var(--background)),
    color-mix(in oklch, var(--family-tree-gold) 8%, var(--card))
  );
  border-color: color-mix(in oklch, var(--family-tree-gold) 25%, var(--border));
}

[data-theme="dark"] .family-tree-pan {
  background-color: #1a1e28;
  background-image:
    radial-gradient(ellipse 120% 80% at 50% 0%, color-mix(in oklch, var(--family-tree-gold) 6%, transparent), transparent 55%),
    radial-gradient(circle, color-mix(in oklch, white 8%, transparent) 1px, transparent 1px);
  border-color: color-mix(in oklch, var(--family-tree-gold) 22%, var(--border));
  box-shadow:
    0 1px 0 color-mix(in oklch, white 6%, transparent) inset,
    0 20px 50px color-mix(in oklch, black 35%, transparent);
}

[data-theme="dark"] .family-tree-node {
  box-shadow:
    0 1px 0 color-mix(in oklch, white 8%, transparent) inset,
    0 4px 12px var(--family-tree-card-shadow);
}

[data-theme="dark"] .family-tree-given {
  color: oklch(0.96 0.008 248);
}

[data-theme="dark"] .family-tree-pat {
  color: oklch(0.72 0.02 242);
  border-top-color: color-mix(in oklch, var(--family-tree-card-border) 55%, transparent);
}

[data-theme="dark"] .family-tree-node.is-root {
  background: linear-gradient(168deg, #3a3428 0%, #2a2418 100%);
  border-color: color-mix(in oklch, var(--family-tree-gold) 55%, var(--family-tree-card-border));
}

[data-theme="dark"] .family-tree-node.is-focus {
  background: linear-gradient(168deg, #3a3028 0%, #322820 100%);
  border-color: color-mix(in oklch, var(--family-tree-accent) 65%, var(--family-tree-card-border));
}

[data-theme="dark"] .family-tree-legend-swatch--root {
  background: linear-gradient(135deg, #3a3428, #2a2418);
  border-color: #d4a840;
}

[data-theme="dark"] .family-tree-legend-swatch--lineage {
  background: linear-gradient(135deg, #2a3040, #222838);
  border-color: #6a7898;
}

[data-theme="dark"] .family-tree-legend-swatch--focus {
  background: linear-gradient(135deg, #3a3028, #322820);
  border-color: #e8a060;
}

/* PDF export — hex/rgb only (html2canvas cannot parse oklch) */
.family-tree-pan.family-tree-pdf-mode {
  background-color: #f0e8dc !important;
  background-image: radial-gradient(circle, rgba(90, 70, 50, 0.1) 1px, transparent 1px) !important;
  box-shadow: none !important;
}

.family-tree-pdf-mode .family-tree-node {
  background: linear-gradient(168deg, #faf6ee, #ede3cf) !important;
  border-color: #c9a56a !important;
  box-shadow: 0 2px 6px rgba(80, 55, 30, 0.12) !important;
  color: #3d2810 !important;
}

.family-tree-pdf-mode .family-tree-node.is-root,
.family-tree-pdf-mode .family-tree-node.is-focus {
  background: linear-gradient(168deg, #faf0d4, #e8d4a0) !important;
  border-color: #c9952a !important;
}

.family-tree-pdf-mode .family-tree-node.is-focus {
  border-color: #b45309 !important;
  background: linear-gradient(168deg, #fff8ee, #f5dcc0) !important;
}

.family-tree-pdf-mode .family-tree-given {
  color: #3d2810 !important;
}

.family-tree-pdf-mode .family-tree-pat {
  color: #6b5344 !important;
  border-top-color: rgba(201, 165, 106, 0.45) !important;
}

.family-tree-pdf-mode .family-tree-lines path,
.family-tree-pdf-mode .family-tree-lines line {
  stroke: #9a6848 !important;
}

.family-tree-pdf-mode .family-tree-lines circle {
  fill: #b87850 !important;
}

.family-tree-hint {
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted-foreground);
  margin-bottom: 0.85rem;
  line-height: 1.65;
}

.family-tree-toolbar {
  display: flex;
  justify-content: center;
}

.family-tree-pdf-btn .icon {
  flex-shrink: 0;
}

.family-tree-pdf-btn[disabled] {
  opacity: 0.65;
  cursor: wait;
}

.family-tree-pan-hint {
  text-align: center;
  font-size: 0.65rem;
  color: var(--muted-foreground);
  margin-top: 0.65rem;
  letter-spacing: 0.02em;
  opacity: 0.85;
}

@media (min-width: 768px) {
  .family-tree-section {
    --family-tree-v-gap: 3.25rem;
    --family-tree-h-gap: 0.75rem;
  }

  .family-tree-node {
    min-width: 5rem;
    max-width: 8.25rem;
    padding: 0.6rem 0.8rem 0.65rem;
  }

  .family-tree-given {
    font-size: 0.9375rem;
  }

  .family-tree-pat {
    font-size: 0.6875rem;
  }

  .family-tree-node.is-root .family-tree-given {
    font-size: 1.125rem;
  }
}

/* Events list */
.event-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.5rem;
}

.event-date {
  text-align: center;
  width: 5rem;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  padding-left: 1.5rem;
}

/* Ancestors timeline */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
  border-right: 1px solid var(--border);
  padding-right: 2rem;
}

.timeline-item {
  position: relative;
}

.timeline-marker {
  position: absolute;
  top: 0.25rem;
  right: -2.625rem;
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border-radius: 9999px;
  background: var(--background);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 1rem;
}

/* Hero banner */
.hero-banner {
  min-height: 22rem;
}

.hero-banner .absolute.inset-0 img {
  min-height: 100%;
  object-fit: cover;
}

/* Site header */
.site-header-inner {
  gap: 0.75rem;
}

.site-logo-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.site-header-inner > a {
  min-width: 0;
  flex-shrink: 1;
}

#mobile-nav nav {
  padding-left: 1rem;
  padding-right: 1rem;
}

.footer-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

/* Page spacing utilities */
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.max-w-full { max-width: 100%; }
.mx-0 { margin-left: 0; margin-right: 0; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-balance { text-wrap: balance; }

/* Responsive */
@media (min-width: 640px) {
  .sm\:inline { display: inline; }
  .sm\:inline-flex { display: inline-flex; }
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .columns-1.sm\:columns-2,
  .sm\:columns-2 { columns: 2; }
}

@media (min-width: 768px) {
  .md\:mx-0 { margin-left: 0; margin-right: 0; }
  .md\:block { display: block; }
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md\:gap-12 { gap: 3rem; }
  .md\:text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
  .md\:py-14 { padding-top: 3.5rem; padding-bottom: 3.5rem; }
  .md\:py-20 { padding-top: 5rem; padding-bottom: 5rem; }
  .md\:py-40 { padding-top: 10rem; padding-bottom: 10rem; }
  .md\:text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
  .md\:text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
  .md\:text-5xl { font-size: 3rem; line-height: 1; }
  .md\:text-7xl { font-size: 4.5rem; line-height: 1; }
  .md\:pr-12 { padding-right: 3rem; }
  .md\:-right-\[54px\] { right: -54px; }
}

@media (min-width: 1024px) {
  .lg\:flex { display: flex; }
  .lg\:hidden { display: none; }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .lg\:columns-3 { columns: 3; }
}

/* Content blocks */
.notice-box {
  border: 1px solid color-mix(in oklch, var(--accent) 35%, var(--border));
  border-right: 4px solid var(--accent);
  background: color-mix(in oklch, var(--card) 70%, var(--background));
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

.notice-box--warning {
  border-right-color: oklch(0.55 0.12 45);
  background: color-mix(in oklch, var(--accent) 8%, var(--background));
}

.ref-section-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--foreground);
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.ref-section-title:first-child { margin-top: 0; }

.content-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}

.content-list li {
  position: relative;
  padding-right: 1.25rem;
  margin-bottom: 0.75rem;
  color: var(--muted-foreground);
  line-height: 1.85;
}

.content-list li::before {
  content: "◆";
  position: absolute;
  right: 0;
  color: var(--accent);
  font-size: 0.65rem;
  top: 0.35rem;
}

/* Ancestor detail blocks */
.ancestor-detail {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.ancestor-detail h4 {
  font-family: var(--font-display);
  font-size: 1.125rem;
  color: var(--foreground);
  margin: 0 0 0.75rem;
}

.fact-grid {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

@media (min-width: 640px) {
  .fact-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.fact-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
  background: color-mix(in oklch, var(--card) 50%, var(--background));
}

.fact-item dt {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.fact-item dd {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted-foreground);
  line-height: 1.7;
}

.doc-excerpt {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-right: 3px solid var(--accent);
  border-radius: var(--radius);
  background: color-mix(in oklch, var(--card) 40%, var(--background));
  font-size: 0.875rem;
  color: var(--muted-foreground);
  line-height: 1.9;
}

.doc-excerpt cite {
  display: block;
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: var(--accent);
  font-style: normal;
}

.archive-doc {
  margin-top: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
}

.archive-doc > img {
  display: block;
  width: 100%;
  height: auto;
}

.archive-doc figcaption {
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  border-top: 1px solid var(--border);
  line-height: 1.7;
}

.tribe-table {
  width: 100%;
  margin-top: 1rem;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.tribe-table th,
.tribe-table td {
  border: 1px solid var(--border);
  padding: 0.625rem 0.875rem;
  text-align: right;
  vertical-align: top;
}

.tribe-table th {
  background: color-mix(in oklch, var(--card) 60%, var(--background));
  color: var(--foreground);
  font-family: var(--font-display);
  font-weight: normal;
}

.tribe-table td {
  color: var(--muted-foreground);
  line-height: 1.7;
}

.tribe-table tr.highlight td {
  background: color-mix(in oklch, var(--accent) 6%, var(--background));
  color: var(--foreground);
}

/* Instagram feed */
.ig-profile-inner {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  align-items: center;
  text-align: center;
}

@media (min-width: 768px) {
  .ig-profile-inner {
    flex-direction: row;
    align-items: flex-start;
    text-align: right;
  }
}

.ig-profile-pic {
  width: 6rem;
  height: 6rem;
  border-radius: 9999px;
  object-fit: cover;
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.ig-profile-meta {
  flex: 1;
  min-width: 0;
}

.ig-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  margin: 1rem 0 0;
  padding: 0;
}

.ig-stats div {
  min-width: 4.5rem;
}

.ig-stats dt {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted-foreground);
}

.ig-stats dd {
  margin: 0.15rem 0 0;
  font-family: var(--font-display);
  font-size: 1.125rem;
  color: var(--foreground);
}

.ig-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .ig-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .ig-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.ig-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: color-mix(in oklch, var(--card) 50%, var(--background));
  transition: background-color 150ms, border-color 150ms;
}

.ig-card:hover {
  background: var(--card);
  border-color: color-mix(in oklch, var(--accent) 35%, var(--border));
}

.ig-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  height: 100%;
}

.ig-card-media {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--card);
}

.ig-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 500ms;
}

.ig-card:hover .ig-card-media img {
  transform: scale(1.03);
}

.ig-card-type {
  position: absolute;
  top: 0.625rem;
  left: 0.625rem;
  padding: 0.2rem 0.5rem;
  font-size: 0.6875rem;
  border-radius: 9999px;
  background: color-mix(in oklch, var(--background) 85%, transparent);
  border: 1px solid var(--border);
  color: var(--foreground);
}

.ig-card-body {
  padding: 1rem 1.125rem 1.125rem;
}

.ig-card-date {
  display: block;
  font-size: 0.75rem;
  color: var(--accent);
}

.ig-card-caption {
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
  line-height: 1.8;
  color: var(--muted-foreground);
}

.ig-card-more {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: var(--primary);
}

/* Instagram history archive (full captions) */
.ig-archive-list {
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.ig-archive-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in oklch, var(--card) 45%, var(--background));
  overflow: hidden;
  scroll-margin-top: 6rem;
}

.ig-archive-item-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--card) 60%, var(--background));
}

.ig-archive-num {
  font-family: var(--font-display);
  font-size: 1.125rem;
  color: var(--accent);
  min-width: 2rem;
}

.ig-archive-item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  flex: 1;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

.ig-archive-item-meta time {
  color: var(--accent);
}

.ig-archive-type {
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  border: 1px solid var(--border);
  font-size: 0.6875rem;
}

.ig-archive-ig-link {
  font-size: 0.75rem;
  color: var(--primary);
  text-decoration: none;
  margin-right: auto;
}

.ig-archive-ig-link:hover {
  text-decoration: underline;
}

.ig-archive-item-body {
  display: grid;
  gap: 0;
}

@media (min-width: 900px) {
  .ig-archive-item-body {
    grid-template-columns: minmax(280px, 42%) 1fr;
  }
}

.ig-archive-figure {
  margin: 0;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

@media (min-width: 900px) {
  .ig-archive-figure {
    border-bottom: none;
    border-left: 1px solid var(--border);
    min-height: 100%;
  }
}

.ig-archive-figure img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 32rem;
  object-fit: contain;
  margin: 0 auto;
  background: color-mix(in oklch, var(--card) 80%, black);
}

.ig-archive-figure--solo a {
  display: block;
}

.ig-archive-gallery {
  display: grid;
  gap: 2px;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  padding: 2px;
  background: var(--border);
}

.ig-archive-gallery .ig-archive-figure {
  border: none;
}

.ig-archive-gallery .ig-archive-figure img {
  max-height: 12rem;
  object-fit: cover;
  width: 100%;
  height: 12rem;
}

.ig-archive-text {
  padding: 1.25rem 1.5rem 1.5rem;
}

.ig-archive-caption-p {
  margin: 0 0 1rem;
  font-size: 0.9375rem;
  line-height: 2;
  color: var(--foreground);
  text-align: justify;
}

.ig-archive-caption-p:last-of-type {
  margin-bottom: 0.5rem;
}

.ig-archive-tag {
  color: var(--accent);
  text-decoration: none;
}

.ig-archive-tag:hover {
  text-decoration: underline;
}

.ig-archive-source {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  text-decoration: none;
}

.ig-archive-source:hover {
  color: var(--accent);
  text-decoration: underline;
}

.ig-archive-updated {
  margin-top: 2.5rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

/* Reference page — Instagram archive (grid + lightbox) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ref-archive-section {
  scroll-margin-top: 6rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.ref-section-block.is-section-empty {
  display: none;
}

.ref-ig-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in oklch, var(--card) 50%, var(--background));
}

.ref-global-toolbar {
  position: sticky;
  top: 4.25rem;
  z-index: 30;
  margin-bottom: 1.5rem;
  box-shadow: 0 8px 24px color-mix(in oklch, var(--background) 55%, transparent);
}

#references-archive {
  scroll-margin-top: 5rem;
  padding-top: 2.5rem;
}

@media (min-width: 640px) {
  #references-archive {
    padding-top: 3rem;
  }
}

#instagram-archive {
  scroll-margin-top: 5rem;
}

.ref-ig-search-wrap {
  flex: 1;
  min-width: min(100%, 16rem);
}

.ref-ig-search {
  width: 100%;
  padding: 0.65rem 1rem;
  font-size: 0.9375rem;
  font-family: inherit;
  color: var(--foreground);
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 150ms;
}

.ref-ig-search:focus {
  border-color: color-mix(in oklch, var(--accent) 50%, var(--border));
}

.ref-ig-count {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  white-space: nowrap;
}

.ref-ig-empty {
  margin: 0 0 1rem;
  padding: 1rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--muted-foreground);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.ref-ig-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
  list-style: none;
  padding: 0;
  margin: 0;
}

@media (min-width: 640px) {
  .ref-ig-grid,
  .ref-grid,
  .ref-source-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .ref-ig-grid,
  .ref-grid,
  .ref-source-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* References archive: compact horizontal cards on all widths (avoids huge square placeholders) */
#references-archive .ref-ig-card {
  flex-direction: row;
  align-items: stretch;
}

#references-archive .ref-ig-thumb,
#references-archive .ref-doc-thumb,
#references-archive .ref-ig-thumb--empty {
  width: 6.25rem;
  min-width: 6.25rem;
  max-width: 6.25rem;
  aspect-ratio: 1;
  flex-shrink: 0;
  border-bottom: none;
  border-inline-start: 1px solid color-mix(in oklch, var(--border) 85%, transparent);
  border-radius: 0;
}

#references-archive .ref-ig-card-body {
  flex: 1;
  min-width: 0;
  padding: 0.875rem 1rem;
  gap: 0.35rem;
}

#references-archive .ref-ig-sub {
  font-size: 0.6875rem;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

#references-archive .ref-ig-excerpt {
  -webkit-line-clamp: 2;
}

@media (min-width: 1280px) {
  #references-archive .ref-ig-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 1536px) {
  #references-archive .ref-ig-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
  }

  #references-archive .ref-ig-thumb,
  #references-archive .ref-doc-thumb,
  #references-archive .ref-ig-thumb--empty {
    width: 7rem;
    min-width: 7rem;
    max-width: 7rem;
  }
}

.ref-grid,
.ref-source-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
  list-style: none;
  padding: 0;
  margin: 0;
}

.ref-ig-card,
.ref-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in oklch, var(--card) 45%, var(--background));
  overflow: hidden;
  transition: border-color 150ms, box-shadow 150ms;
  scroll-margin-top: 6rem;
}

.ref-ig-card:hover,
.ref-card:hover {
  border-color: color-mix(in oklch, var(--accent) 35%, var(--border));
  box-shadow: 0 4px 20px color-mix(in oklch, var(--foreground) 6%, transparent);
}

.ref-ig-card.is-hidden,
.ref-card.is-hidden {
  display: none;
}

.ref-source-card {
  padding: 1.125rem 1.25rem 1.25rem;
}

.ref-source-card > h3.font-display {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  line-height: 1.65;
}

.ref-source-card > p.text-sm.text-muted-foreground.mt-1 {
  margin-top: 0;
  font-size: 0.8125rem;
  color: var(--accent);
}

.ref-source-card > p.mt-3.text-sm,
.ref-source-card > p.text-sm.text-muted-foreground.leading-7 {
  font-size: 0.8125rem;
  line-height: 1.85;
}

.ref-source-card--link {
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

.ref-source-card--link:hover {
  border-color: transparent;
  box-shadow: none;
}

.ref-card--link {
  padding: 0;
  color: inherit;
  text-decoration: none;
  height: 100%;
}

.ref-card--link > div {
  padding: 1.125rem 1.25rem;
  height: 100%;
}

.ref-card-media-wrap {
  margin-top: 1rem;
}

/* Match one grid column so doc thumbs align with Instagram cards */
.ref-source-card#bni-khalid-1916 .ref-card-media-wrap {
  width: 100%;
  max-width: 100%;
}

@media (min-width: 640px) {
  .ref-source-card#bni-khalid-1916 .ref-card-media-wrap {
    width: calc((100% - 1.25rem) / 2);
  }
}

@media (min-width: 1024px) {
  .ref-source-card#bni-khalid-1916 .ref-card-media-wrap {
    width: calc((100% - 2.5rem) / 3);
  }
}

.ref-source-card .doc-excerpt {
  margin-top: 0.75rem;
  font-size: 0.8125rem;
}

.ref-source-card .tribe-table {
  margin-top: 0.75rem;
  font-size: 0.8125rem;
}

.ref-source-card .content-list li {
  font-size: 0.8125rem;
}

.ref-ig-badge {
  font-family: var(--font-display);
  font-size: 0.8125rem;
  color: var(--accent);
}

.ref-ig-sub {
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  text-align: left;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ref-ig-thumb-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  height: 100%;
  padding: 0.75rem;
  text-align: center;
  pointer-events: none;
  font-family: var(--font-display);
  font-size: 1.25rem;
  line-height: 1.2;
  color: var(--accent);
  letter-spacing: 0.06em;
}

.ref-ig-card--source .ref-ig-thumb-label::before {
  content: "";
  display: block;
  width: 2.15rem;
  height: 2.15rem;
  flex-shrink: 0;
  opacity: 0.9;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c9a84c' stroke-width='1.35' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 19.5A2.5 2.5 0 0 1 6.5 17H20'/%3E%3Cpath d='M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z'/%3E%3Cpath d='M8 7h8M8 11h6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.ref-ig-thumb--link .ref-ig-thumb-label::before {
  display: none;
}

.ref-ig-thumb--link .ref-ig-thumb-label {
  font-family: var(--font-body);
  font-size: 0.875rem;
  letter-spacing: 0.04em;
}

.ref-ig-thumb--link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.ref-ig-thumb--link:hover .ref-ig-thumb-label,
.ref-ig-card--source a.ref-ig-thumb--card-link:hover .ref-ig-thumb-label {
  color: color-mix(in oklch, var(--accent) 88%, var(--foreground));
}

.ref-source-fulltext {
  font-size: 0.8125rem;
  line-height: 1.85;
  color: var(--muted-foreground);
}

.ref-source-fulltext .doc-excerpt,
.ref-source-fulltext .tribe-table,
.ref-source-fulltext .content-list {
  margin-top: 0.75rem;
}

.ref-source-fulltext .archive-doc figcaption {
  margin-top: 0.5rem;
  font-size: 0.75rem;
}

.ref-source-grid > li {
  display: flex;
  min-width: 0;
}

.ref-source-grid > li > .ref-card--link {
  flex: 1;
  width: 100%;
}

.ref-source-grid > li.is-hidden,
.ref-ig-card.is-hidden {
  display: none;
}

.ref-ig-thumb,
.ref-doc-thumb {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  margin: 0;
  border: none;
  background: var(--card);
  cursor: zoom-in;
  aspect-ratio: 1;
  overflow: hidden;
  flex-shrink: 0;
}

.ref-ig-thumb--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  cursor: default;
  background:
    radial-gradient(circle at 50% 38%, color-mix(in oklch, var(--accent) 16%, transparent) 0, transparent 58%),
    linear-gradient(
      160deg,
      color-mix(in oklch, var(--card) 88%, var(--background)),
      color-mix(in oklch, var(--muted) 55%, var(--card))
    );
  border-bottom: 1px solid color-mix(in oklch, var(--border) 85%, transparent);
}

.ref-ig-card--source .ref-ig-thumb--empty {
  cursor: pointer;
}

a.ref-ig-thumb--empty.ref-ig-thumb--card-link {
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

a.ref-ig-thumb--empty.ref-ig-thumb--card-link:hover {
  filter: brightness(1.06);
  box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--accent) 35%, transparent);
}

a.ref-ig-thumb--empty.ref-ig-thumb--card-link:hover .ref-ig-thumb-label::before {
  transform: scale(1.05);
  transition: transform 180ms ease;
}

[data-theme="dark"] .ref-ig-thumb--empty {
  background:
    radial-gradient(circle at 50% 38%, oklch(0.42 0.028 236 / 0.18) 0, transparent 62%),
    linear-gradient(
      160deg,
      color-mix(in oklch, var(--card) 92%, var(--background)),
      color-mix(in oklch, var(--muted) 75%, var(--card))
    );
  border-bottom-color: color-mix(in oklch, var(--border) 70%, transparent);
}

.ref-ig-thumb img,
.ref-doc-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
  object-position: center;
  display: block;
  transition: transform 300ms;
  background: hsl(var(--card));
}

.archive-doc .ref-ig-thumb {
  border-radius: calc(var(--radius) - 2px);
}

.ref-ig-thumb:hover img {
  transform: scale(1.04);
}

.ref-ig-play {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in oklch, black 25%, transparent);
  pointer-events: none;
}

.ref-ig-play::after {
  content: "";
  width: 3rem;
  height: 3rem;
  border-radius: 9999px;
  background: color-mix(in oklch, var(--background) 90%, transparent);
  box-shadow: 0 2px 12px color-mix(in oklch, black 30%, transparent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23000'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 55% center;
  background-size: 1.25rem;
}

.ref-ig-type-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 2;
  padding: 0.15rem 0.5rem;
  font-size: 0.6875rem;
  border-radius: 9999px;
  background: color-mix(in oklch, var(--background) 88%, transparent);
  border: 1px solid var(--border);
  color: var(--foreground);
  pointer-events: none;
}

.ref-ig-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 1rem 1.125rem 1.125rem;
  gap: 0.5rem;
}

.ref-ig-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.ref-ig-num {
  font-family: var(--font-display);
  font-size: 0.875rem;
  color: var(--accent);
}

.ref-ig-link {
  font-size: 0.6875rem;
  color: var(--primary);
  text-decoration: none;
}

.ref-ig-link:hover {
  text-decoration: underline;
}

.ref-ig-card-title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ref-ig-excerpt {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.85;
  color: var(--muted-foreground);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ref-ig-card-title-link {
  color: inherit;
  text-decoration: none;
}

.ref-ig-card-title-link:hover {
  color: var(--accent);
}

.ref-ig-card-actions {
  margin: 0.25rem 0 0;
}

.ref-ig-read-more {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}

.ref-ig-read-more:hover {
  text-decoration: underline;
}

a.ref-ig-thumb--card-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

a.ref-ig-thumb--card-link:hover img {
  opacity: 0.92;
}

/* Reference detail page */
.ref-detail-page .ref-detail-title {
  line-height: 1.35;
}

.ref-detail-body {
  font-size: 0.9375rem;
  line-height: 1.9;
  color: var(--foreground);
}

.ref-detail-body .ref-ig-caption-p,
.ref-detail-body p {
  margin: 0 0 1rem;
}

.ref-detail-body .doc-excerpt {
  margin: 1.25rem 0;
  padding: 1rem 1.25rem;
  border-right: 3px solid var(--accent);
  background: color-mix(in oklch, var(--card) 80%, transparent);
  border-radius: var(--radius);
}

.ref-thawadi-related {
  margin: 0 0 2rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid color-mix(in oklch, var(--accent) 35%, var(--border));
  border-radius: var(--radius);
  background: color-mix(in oklch, var(--accent) 7%, var(--card));
}

.ref-thawadi-related-title {
  font-family: var(--font-display, inherit);
  font-size: 1.125rem;
  margin: 0 0 0.75rem;
}

.ref-thawadi-related-list {
  margin: 0;
  padding: 0 1.25rem 0 0;
  list-style: disc;
}

.ref-thawadi-related-list li {
  margin: 0.35rem 0;
}

.ref-thawadi-related-note {
  margin: 0.75rem 0 0;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.ref-thawadi-mark {
  background: color-mix(in oklch, var(--accent) 22%, transparent);
  padding: 0.05em 0.3em;
  border-radius: 0.2em;
  font-weight: 600;
}

.ref-article-h2 {
  font-family: var(--font-display, inherit);
  font-size: 1.5rem;
  margin: 2rem 0 1rem;
  line-height: 1.4;
}

.ref-article-h3 {
  font-family: var(--font-display, inherit);
  font-size: 1.15rem;
  margin: 1.75rem 0 0.75rem;
  line-height: 1.45;
}

.ref-ship-list {
  margin: 0.5rem 0 1.5rem;
  padding: 0 1.25rem 0 0;
  list-style: decimal;
}

.ref-ship-item {
  margin: 0.35rem 0;
  line-height: 1.75;
}

.ref-ship-item--thawadi {
  padding: 0.35rem 0.5rem;
  margin-right: -0.5rem;
  border-radius: var(--radius);
  background: color-mix(in oklch, var(--accent) 10%, transparent);
}

.ref-ship-ref {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

.ref-source-list {
  margin: 0.5rem 0 1.5rem;
  padding: 0 1.25rem 0 0;
  list-style: decimal;
}

.ref-article-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* Family news cards */
.family-news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.15rem;
}

.family-news-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  background: color-mix(in oklch, var(--card) 82%, var(--background));
  overflow: hidden;
  box-shadow: 0 8px 24px color-mix(in oklch, black 9%, transparent);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.family-news-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in oklch, var(--accent) 28%, var(--border));
  box-shadow: 0 14px 30px color-mix(in oklch, black 14%, transparent);
}

.family-news-thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: color-mix(in oklch, var(--card) 88%, black 3%);
}

.family-news-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.family-news-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  font-size: 0.75rem;
  line-height: 1;
  padding: 0.3rem 0.45rem;
  border-radius: 999px;
  color: var(--accent-foreground);
  background: color-mix(in oklch, var(--accent) 82%, black 6%);
}

.family-news-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 0.95rem 1rem 1rem;
}

.family-news-meta {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--muted-foreground);
}

.family-news-title {
  margin: 0 0 0.55rem;
  font-size: 1rem;
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.family-news-card-title-link {
  color: inherit;
  text-decoration: none;
}

.family-news-card-title-link:hover {
  color: var(--accent);
}

.family-news-text {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.78;
  color: color-mix(in oklch, var(--foreground) 86%, transparent);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.family-news-link {
  display: inline-block;
  margin-top: auto;
  padding-top: 0.85rem;
  font-size: 0.84rem;
  color: var(--accent);
}

.family-news-link:hover {
  text-decoration: underline;
}

@media (max-width: 520px) {
  .family-news-grid {
    grid-template-columns: 1fr;
  }
}

/* Gallery family members — uniform cards */
.gallery-members-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 0.65rem;
  align-items: stretch;
}

.gallery-member-card {
  margin: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 13.75rem;
  overflow: hidden;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
  background: var(--card);
}

.gallery-member-thumb-btn {
  display: block;
  flex: 0 0 8.75rem;
  width: 100%;
  height: 8.75rem;
  padding: 0;
  border: none;
  cursor: pointer;
  overflow: hidden;
  background: color-mix(in oklch, var(--card) 88%, black 3%);
}

.gallery-member-thumb-btn img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  transition: transform 0.45s ease;
}

.gallery-member-card:hover .gallery-member-thumb-btn img {
  transform: scale(1.04);
}

.gallery-member-caption {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 5rem;
  padding: 0.45rem 0.5rem 0.5rem;
  border-top: 1px solid var(--border);
}

.gallery-member-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--foreground);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.9em;
  max-height: 2.9em;
}

.gallery-member-text {
  display: none;
}

.gallery-member-more {
  align-self: flex-start;
  margin-top: 0.35rem;
  padding: 0;
  border: none;
  background: none;
  font-size: 0.68rem;
  line-height: 1.2;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.gallery-member-more:hover {
  color: var(--foreground);
}

.gallery-member-badge {
  display: inline-block;
  margin-top: 0.25rem;
  font-size: 0.62rem;
  color: var(--muted-foreground);
}

body.gallery-member-modal-open {
  overflow: hidden;
}

.gallery-member-modal {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.gallery-member-modal[hidden] {
  display: none !important;
}

.gallery-member-modal-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: color-mix(in oklch, black 72%, transparent);
  cursor: pointer;
}

.gallery-member-modal-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(96vw, 22rem);
  max-height: min(90vh, 36rem);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  box-shadow: 0 24px 48px color-mix(in oklch, black 35%, transparent);
  overflow: hidden;
}

.gallery-member-modal-close {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 2;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: color-mix(in oklch, var(--background) 92%, transparent);
  color: var(--foreground);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.gallery-member-modal-close:hover {
  background: var(--card);
}

.gallery-member-modal-media {
  flex: 0 0 auto;
  aspect-ratio: 1;
  background: color-mix(in oklch, var(--card) 88%, black 3%);
}

.gallery-member-modal-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.gallery-member-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0.85rem 1rem 1rem;
}

.gallery-member-modal-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.95rem;
  line-height: 1.65;
}

.gallery-member-modal-text {
  margin: 0.65rem 0 0;
  font-size: 0.82rem;
  line-height: 1.75;
  color: var(--muted-foreground);
}

@media (min-width: 480px) {
  .gallery-members-grid {
    grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
    gap: 0.75rem;
  }
}

@media (min-width: 768px) {
  .gallery-members-grid {
    grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
    gap: 0.85rem;
  }

  .gallery-member-title {
    font-size: 0.8rem;
  }

  .gallery-member-thumb-btn {
    flex-basis: 9.25rem;
    height: 9.25rem;
  }
}

@media (min-width: 1024px) {
  .gallery-members-grid {
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  }
}

.ref-detail-media {
  margin: 2rem 0 0;
  text-align: center;
}

.ref-detail-media img,
.ref-detail-video {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: var(--radius);
  background: color-mix(in oklch, black 90%, transparent);
}

.ref-detail-gallery {
  display: grid;
  gap: 1rem;
  margin-top: 2rem;
}

.ref-detail-footer a {
  font-size: 0.875rem;
  color: var(--accent);
  text-decoration: none;
}

.ref-detail-footer a:hover {
  text-decoration: underline;
}

.ref-detail-ext-link {
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 9999px;
}

.ref-ig-details {
  margin-top: auto;
  font-size: 0.8125rem;
}

.ref-ig-details summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.25rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid color-mix(in oklch, var(--accent) 35%, var(--border));
  border-radius: 9999px;
  color: var(--accent);
  background: color-mix(in oklch, var(--accent) 8%, var(--background));
  user-select: none;
  transition: background 150ms, border-color 150ms;
}

.ref-ig-details summary::-webkit-details-marker {
  display: none;
}

.ref-ig-details summary::before {
  content: "◂";
  font-size: 0.65rem;
  opacity: 0.85;
}

.ref-ig-details summary:hover {
  background: color-mix(in oklch, var(--accent) 14%, var(--background));
  border-color: color-mix(in oklch, var(--accent) 55%, var(--border));
}

/* Content lives in popup — never expand inline */
.ref-ig-details .ref-ig-fulltext {
  display: none !important;
}

.ref-ig-fulltext {
  font-size: 0.875rem;
  line-height: 1.9;
  color: var(--muted-foreground);
}

/* Details popup */
body.ref-details-open {
  overflow: hidden;
}

.ref-details-dialog {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.ref-details-dialog[hidden] {
  display: none !important;
}

.ref-details-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: color-mix(in oklch, black 72%, transparent);
  cursor: pointer;
}

.ref-details-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(96vw, 40rem);
  max-height: min(88vh, 42rem);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  box-shadow: 0 24px 48px color-mix(in oklch, black 35%, transparent);
  overflow: hidden;
}

.ref-details-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.125rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--card) 55%, var(--background));
  flex-shrink: 0;
}

.ref-details-title {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.65;
  flex: 1;
  min-width: 0;
}

.ref-details-close {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: var(--background);
  color: var(--foreground);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: background 150ms, border-color 150ms;
}

.ref-details-close:hover {
  background: var(--card);
  border-color: color-mix(in oklch, var(--accent) 40%, var(--border));
}

.ref-details-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.125rem 1.25rem 1.25rem;
  -webkit-overflow-scrolling: touch;
}

.ref-details-body .ref-ig-caption-p,
.ref-details-body p {
  margin: 0 0 0.875rem;
  font-size: 0.875rem;
  line-height: 1.9;
  color: var(--muted-foreground);
  text-align: justify;
}

.ref-details-body .ref-ig-caption-p:last-child,
.ref-details-body p:last-child {
  margin-bottom: 0;
}

.ref-details-body .doc-excerpt {
  margin: 0.75rem 0;
  padding: 0.75rem 1rem;
  border-right: 3px solid var(--accent);
  background: color-mix(in oklch, var(--card) 60%, var(--background));
  font-size: 0.8125rem;
  line-height: 1.85;
}

.ref-details-body .tribe-table {
  width: 100%;
  margin: 0.75rem 0;
  font-size: 0.75rem;
  border-collapse: collapse;
}

.ref-details-body .tribe-table th,
.ref-details-body .tribe-table td {
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
}

.ref-details-body .content-list {
  margin: 0.5rem 0 0.75rem;
  padding-right: 1.25rem;
  font-size: 0.8125rem;
  line-height: 1.75;
}

.ref-details-body .archive-doc figcaption {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.ref-details-body a {
  color: var(--accent);
  word-break: break-word;
}

.ref-ig-caption-p {
  margin: 0 0 0.75rem;
  font-size: 0.8125rem;
  line-height: 1.9;
  color: var(--muted-foreground);
  text-align: justify;
}

.ref-source-url {
  border-top: 1px solid hsl(var(--border) / 0.6);
  padding-top: 0.75rem;
}
  margin-bottom: 0;
}

/* Lightbox */
body.ref-ig-lightbox-open {
  overflow: hidden;
}

.ref-ig-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.ref-ig-lightbox[hidden] {
  display: none !important;
}

.ref-ig-lightbox-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: color-mix(in oklch, black 75%, transparent);
  cursor: pointer;
}

.ref-ig-lightbox-panel {
  position: relative;
  z-index: 1;
  width: auto;
  max-width: min(96vw, 90rem);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ref-ig-lightbox-close {
  position: absolute;
  top: -2.5rem;
  left: 0;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 9999px;
  background: var(--background);
  color: var(--foreground);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

.ref-ig-lightbox-media {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: min(96vw, 90rem);
  max-height: calc(92vh - 1rem);
  border-radius: var(--radius);
  overflow: auto;
  background: color-mix(in oklch, black 92%, transparent);
}

/* Full image/video — no crop (thumbnails use cover in the grid only) */
.ref-ig-lightbox-media .ref-ig-lightbox-full {
  display: block;
  width: auto;
  height: auto;
  max-width: min(96vw, 90rem);
  max-height: calc(92vh - 1rem);
  object-fit: contain;
  object-position: center;
  margin: 0 auto;
}

.ref-ig-lightbox-media video.ref-ig-lightbox-full {
  background: #000;
}

.ref-ig-lightbox-gallery {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
}

.ref-ig-lightbox-nav {
  flex: 0 0 auto;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 9999px;
  background: color-mix(in oklch, var(--background) 88%, transparent);
  color: var(--foreground);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
}

.ref-ig-lightbox-counter {
  position: absolute;
  bottom: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  background: color-mix(in oklch, black 65%, transparent);
  color: #fff;
  font-size: 0.875rem;
}

@media (max-width: 767px) {
  .ref-ig-lightbox-close {
    top: 0.5rem;
    left: 0.5rem;
    background: color-mix(in oklch, var(--background) 90%, transparent);
  }

  .ref-ig-lightbox-panel {
    max-width: 100%;
    max-height: 85vh;
  }

  .ref-ig-lightbox-media,
  .ref-ig-lightbox-media .ref-ig-lightbox-full {
    max-width: 100%;
    max-height: calc(85vh - 1rem);
  }
}

/* Elfsight Instagram widget */
.elfsight-feed-wrap {
  width: 100%;
  min-height: 12rem;
  border-radius: var(--radius);
  overflow: hidden;
}

.elfsight-feed-wrap .elfsight-app-4095bbd6-e095-4481-be6d-50c9de2c9929 {
  width: 100%;
}

/* Contact page sections */
.contact-map-section {
  margin-bottom: 0;
}

.contact-details-section {
  margin-top: 0;
}

.contact-cards {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Google Maps embed */
.map-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  min-height: 220px;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--card);
}

.map-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.map-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0;
  padding-top: 0.25rem;
}

.map-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--background);
  transition: background-color 150ms, color 150ms;
}

.map-btn:hover {
  background: var(--card);
  color: var(--accent);
}

.map-btn--primary {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

.map-btn--primary:hover {
  background: color-mix(in oklch, var(--primary) 90%, transparent);
  color: var(--primary-foreground);
}

/* ========== Responsive layout ========== */
@media (min-width: 640px) {
  .sm\:px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
}

@media (max-width: 767px) {
  /* Typography scale */
  .text-5xl { font-size: 2rem; line-height: 1.2; }
  .text-4xl { font-size: 1.75rem; line-height: 1.25; }
  .text-3xl { font-size: 1.5rem; line-height: 1.3; }
  .text-2xl { font-size: 1.25rem; line-height: 1.35; }

  .py-20 { padding-top: 3rem; padding-bottom: 3rem; }
  .py-24 { padding-top: 3.5rem; padding-bottom: 3.5rem; }
  .py-28 { padding-top: 4rem; padding-bottom: 4rem; }
  .px-6 { padding-left: 1rem; padding-right: 1rem; }

  .-mx-6 { margin-left: 0; margin-right: 0; }

  .hero-banner { min-height: 18rem; }
  .hero-banner .relative.mx-auto { padding-top: 4rem; padding-bottom: 4rem; }

  .family-tree-lineage {
    padding: 0.85rem;
    font-size: 0.8rem;
  }

  .family-tree-lineage .font-display {
    font-size: 0.85rem;
  }

  /* Events */
  .event-row {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    padding: 1.25rem !important;
  }

  .event-date {
    width: 100%;
    border-left: none;
    border-bottom: 1px solid var(--border);
    padding-left: 0;
    padding-bottom: 0.75rem;
    text-align: right;
    display: flex;
    align-items: center;
    gap: 0.75rem;
  }

  .event-date .font-display { font-size: 1.25rem; }

  /* Timeline */
  .timeline {
    padding-right: 2.75rem;
  }

  .timeline-marker {
    right: -2.35rem;
    width: 2rem;
    height: 2rem;
    font-size: 0.875rem;
  }

  /* Heritage overlap image */
  .heritage-stack .heritage-inset {
    position: static;
    width: 100%;
    max-width: 14rem;
    margin: 1rem auto 0;
    display: block;
  }

  /* Footer */
  .footer-bar {
    flex-direction: column !important;
    justify-content: center !important;
    text-align: center;
    gap: 0.5rem;
  }

  /* Grid gaps on small screens */
  .grid.gap-12 { gap: 2rem; }
  .gap-6 { gap: 1rem; }

  /* Notice & forms */
  .notice-box { padding: 1rem; }

  form.border.p-8 { padding: 1.25rem; }

  /* References archive — compact cards, clear gaps */
  #references-archive.references-page {
    padding-left: 1rem;
    padding-right: 1rem;
    padding-top: 2rem;
    padding-bottom: 2.5rem;
  }

  #references-archive + .mt-16,
  #references-archive .mt-16 {
    margin-top: 2rem;
    padding-top: 1.5rem;
  }

  main > .mx-auto.max-w-4xl.py-8 {
    padding-top: 1rem;
    padding-bottom: 1rem;
  }

  #references-archive .ref-ig-grid {
    gap: 0.875rem;
  }

  #references-archive .ref-ig-card {
    flex-direction: row;
    align-items: stretch;
    border-radius: calc(var(--radius) - 1px);
  }

  #references-archive .ref-ig-thumb,
  #references-archive .ref-doc-thumb,
  #references-archive .ref-ig-thumb--empty {
    width: 5.75rem;
    min-width: 5.75rem;
    max-width: 5.75rem;
    aspect-ratio: 1;
    flex-shrink: 0;
    border-radius: 0;
  }

  #references-archive .ref-ig-card--source .ref-ig-thumb-label::before {
    width: 1.35rem;
    height: 1.35rem;
  }

  #references-archive .ref-ig-card--source .ref-ig-thumb-label {
    font-size: 0.95rem;
  }

  #references-archive .ref-ig-card-body {
    flex: 1;
    min-width: 0;
    padding: 0.625rem 0.75rem;
    gap: 0.3rem;
  }

  #references-archive .ref-ig-card-meta {
    gap: 0.35rem;
  }

  #references-archive .ref-ig-badge,
  #references-archive .ref-ig-num {
    font-size: 0.75rem;
  }

  #references-archive .ref-ig-sub {
    font-size: 0.625rem;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  #references-archive .ref-ig-card-title {
    font-size: 0.875rem;
    line-height: 1.45;
    -webkit-line-clamp: 2;
  }

  #references-archive .ref-ig-excerpt {
    font-size: 0.6875rem;
    line-height: 1.55;
    -webkit-line-clamp: 2;
  }

  #references-archive .ref-ig-details {
    font-size: 0.6875rem;
  }

  #references-archive .ref-ig-details summary {
    padding: 0.15rem 0;
  }

  #references-archive .ref-details-panel {
    width: 100%;
    max-height: 90vh;
  }

  #references-archive .ref-details-header {
    padding: 0.875rem 1rem;
  }

  #references-archive .ref-details-title {
    font-size: 0.9375rem;
  }

  #references-archive .ref-details-body {
    padding: 1rem;
  }

  #references-archive .ref-source-fulltext p,
  #references-archive .ref-source-fulltext .doc-excerpt,
  #references-archive .ref-source-fulltext li {
    font-size: 0.6875rem;
    line-height: 1.6;
    margin-top: 0.5rem;
  }

  #references-archive .ref-source-fulltext .tribe-table {
    font-size: 0.625rem;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #references-archive .ref-global-toolbar {
    top: 3.5rem;
    margin-bottom: 0.875rem;
    padding: 0.625rem 0.75rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  #references-archive .ref-ig-search {
    padding: 0.55rem 0.75rem;
    font-size: 0.875rem;
  }

  #references-archive .ref-ig-count {
    width: 100%;
    white-space: normal;
    text-align: center;
    font-size: 0.75rem;
  }

  #references-archive .ref-ig-empty {
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    font-size: 0.8125rem;
  }

  #references-archive .ref-ig-play::after {
    width: 2rem;
    height: 2rem;
    background-size: 0.875rem;
  }

  #references-archive .ref-ig-type-badge {
    font-size: 0.5625rem;
    top: 0.25rem;
    right: 0.25rem;
  }
}

/* References: 2-column grid on larger phones */
@media (min-width: 480px) and (max-width: 639px) {
  #references-archive .ref-ig-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }
}

@media (min-width: 768px) {
  .hero-banner { min-height: 32rem; }

  .timeline {
    padding-right: 3rem;
  }

  .timeline-marker {
    right: -3.375rem;
  }
}

