@tailwind base;
@tailwind components;
@tailwind utilities;

/* ============================================================
   GENE-ALOGY.NET — Classic Theme
   Design system: deep espresso brown + dusty rose / muted teal / dusty gold
   
   Accent color roles:
     --rose  → headlines, active states, drop caps, italic display text
     --teal  → hover states, section rules, pullquotes, focus rings
     --gold  → numbers, stats, section numbers, metadata keys
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;0,900;1,400;1,700&family=Outfit:wght@300;400;500&display=swap');

@layer base {
  :root {
    /* Backgrounds */
    --bg:           #180f0b;
    --surf:         #1f1410;
    --raise:        #2a1c16;
    --raise2:       #321f18;

    /* Borders */
    --border:       rgba(210, 160, 130, 0.13);
    --border2:      rgba(210, 160, 130, 0.26);

    /* Accent trio */
    --rose:         #c4748e;
    --rose2:        #db9fb3;
    --teal:         #6e9e9b;
    --teal2:        #97bfbc;
    --gold:         #b8935a;
    --gold2:        #d4b07a;

    /* Text */
    --text:         #ede3d5;
    --muted:        #8a7a6e;
    --dim:          #5c4c42;

    /* Fonts */
    --font-display: 'Playfair Display', Georgia, serif;
    --font-body:    'Outfit', system-ui, sans-serif;

    /* Legacy aliases kept for backward compatibility with any inline PHP */
    --color-beige:        var(--raise);
    --color-deep-brown:   var(--gold);
    --color-desert-rose:  var(--rose);
    --color-piink:        var(--rose);
    --color-slate-grey:   var(--teal);
    --color-marigold:     var(--gold2);
    --color-olive:        var(--teal);
    --color-cream:        var(--raise2);
    --color-dark:         var(--text);
    --color-light:        var(--bg);
    --font-heading:       var(--font-display);
  }
}

@layer base {
  * {
    @apply border-border;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }

  body {
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    width: 100%;
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 16px;
    line-height: 1.6;
    background-color: var(--bg);
    color: var(--text);
    overflow-x: hidden;
  }
}

::selection {
  background-color: var(--rose);
  color: var(--bg);
}

/* ── LINKS ── */
a {
  color: var(--teal2);
  text-decoration: none;
  transition: color 0.2s;
  border-bottom: 1px solid transparent;
}

a:hover {
  color: var(--rose2);
  border-bottom-color: transparent;
}

/* ── TYPOGRAPHY ── */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
}

h1 {
  font-size: 2.6rem;
  font-weight: 900;
  margin-bottom: 1rem;
}

h1 em, h2 em {
  font-style: italic;
  color: var(--rose);
  font-weight: 400;
}

h2 {
  font-size: 1.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.4rem;
  color: var(--text);
}

h3 {
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.8rem;
}

h4 {
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--rose2);
  text-align: center;
  padding: 14px 0;
  margin: 24px 0;
  background-color: var(--raise);
  border: 1px solid var(--border2);
  border-radius: 4px;
}

b, strong {
  color: var(--text);
  font-weight: 600;
}

p {
  line-height: 1.8;
  font-size: 0.95rem;
  font-family: var(--font-body);
  color: var(--muted);
  margin-bottom: 1rem;
}

hr {
  border: none;
  height: 1px;
  background-color: var(--border);
  margin: 20px 0;
}

/* ── LAYOUT GRID ── */
.grid-container {
  display: grid;
  grid-template-columns: clamp(160px, 16%, 220px) 1fr clamp(130px, 13%, 180px);
  grid-template-rows: auto auto 1fr auto;
  grid-template-areas:
    "logo nav  nav"
    "hero hero hero"
    "side main feat"
    "foot foot foot";
  min-height: 70vh;
  width: 90vw;
  max-width: 1600px;
  margin: 0 auto;
  gap: 0;
  position: relative;
  box-sizing: border-box;
  background-color: var(--bg);
  border: 1px solid var(--border);
}

/* header element must not create its own grid box */
.site-header {
  display: contents;
}

/* ── LOGO ── */
.logo-area {
  grid-area: logo;
  display: flex;
  align-items: center;
  padding: 0 28px;
  height: 52px;
  background-color: var(--surf);
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

.logo {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

.logo em {
  font-style: italic;
  color: var(--rose);
  font-weight: 400;
}

/* ── NAVIGATION ── */
.nav-area {
  grid-area: nav;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 20px;
  height: 52px;
  background-color: var(--surf);
  border-bottom: 1px solid var(--border);
}

.nav-container {
  display: flex;
  justify-content: flex-end;
  gap: 2px;
  align-items: center;
}

.nav-item {
  position: relative;
  padding: 6px 12px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s, background 0.2s;
  border: 1px solid transparent;
  border-radius: 3px;
  white-space: nowrap;
}

.nav-item:hover {
  color: var(--teal2);
  border-color: transparent;
  border-bottom-color: transparent;
  background-color: var(--raise);
}

.nav-item.active {
  color: var(--rose2);
  background-color: rgba(196, 116, 142, 0.09);
}

.nav-item:after {
  display: none;
}

/* ── HERO ── */
.hero-area {
  grid-area: hero;
  position: relative;
  padding: clamp(36px, 5vw, 72px) clamp(28px, 4vw, 56px);
  background-color: var(--surf);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.hero-area::after {
  content: '';
  position: absolute;
  right: -60px;
  top: -40px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(110, 158, 155, 0.07) 0%, transparent 65%);
  pointer-events: none;
}

/* Section number header — CV style */
.hero-eyebrow,
.sec-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold);
}

.hero-eyebrow::after,
.sec-rule {
  content: '';
  flex: 1;
  height: 1px;
  background-color: var(--teal);
  opacity: 0.35;
  display: block;
}

.sec-num  { font-size: 12px; font-weight: 500; color: var(--gold); min-width: 20px; }
.sec-name { font-size: 10px; letter-spacing: 2.5px; text-transform: uppercase; color: var(--muted); }
.sec-desc { font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--dim); }

.hero-content {
  max-width: clamp(520px, 70%, 900px);
  position: relative;
  z-index: 1;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 4.2vw, 4rem);
  font-weight: 900;
  line-height: 1.08;
  color: var(--text);
  margin-bottom: 16px;
}

.hero-title em {
  font-style: italic;
  color: var(--rose);
  font-weight: 400;
}

.hero-subtitle {
  font-size: 0.9rem;
  color: var(--muted);
  font-family: var(--font-body);
  font-style: normal;
  line-height: 1.75;
  margin-bottom: 28px;
  max-width: clamp(400px, 60%, 680px);
}

/* Hero stats row */
.hero-meta {
  display: flex;
  gap: 28px;
  align-items: center;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.hero-stat .n {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--gold2);
}

.hero-stat .n em {
  font-style: italic;
  color: var(--gold);
  font-weight: 400;
}

.hero-stat .l {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--dim);
}

.hero-divider {
  width: 1px;
  height: 34px;
  background-color: var(--border2);
}

/* ── SIDEBAR ── */
.sidebar-area {
  grid-area: side;
  padding: 24px 16px;
  background-color: var(--surf);
  border-right: 1px solid var(--border);
}

/* Numbered index nav — CV style */
.index-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 12px;
}

.index-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background-color: var(--border2);
}

.numbered-nav {
  list-style: none;
  margin-bottom: 4px;
}

.numbered-nav a,
.numbered-nav li a {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 5px 6px;
  text-decoration: none;
  font-size: 12px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.15s, background 0.15s;
  border-radius: 2px;
  border-left: 2px solid transparent;
  border-bottom: none;
}

.numbered-nav a:hover {
  color: var(--teal2);
  background-color: rgba(110, 158, 155, 0.05);
  border-bottom: none;
}

.numbered-nav a.active {
  color: var(--rose);
  background-color: rgba(196, 116, 142, 0.06);
}

.numbered-nav a span,
.nav-num {
  font-size: 10px;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  min-width: 18px;
}

.numbered-nav a.active span {
  color: var(--rose);
}

/* Sidebar counter block */
.counter,
.stat-block {
  background-color: var(--raise);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 14px 12px;
  margin-bottom: 18px;
  text-align: center;
}

.counter-value,
.stat-block .n {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold2);
  display: block;
}

.stat-block .l {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--dim);
  margin-top: 2px;
}

/* Section mini-label */
.s-label,
.s-mini-label {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 8px;
  padding-left: 4px;
}

/* Sidebar menu / browse nav */
.sidebar-menu,
.browse-nav {
  list-style: none;
  margin-bottom: 8px;
}

.sidebar-menu li,
.browse-nav li {
  padding-left: 0;
  position: relative;
}

.sidebar-menu a,
.browse-nav a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px;
  font-size: 12.5px;
  color: var(--muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: all 0.15s;
  border-bottom: none;
}

.sidebar-menu a:hover,
.browse-nav a:hover {
  color: var(--text);
  border-left-color: var(--teal);
  padding-left: 12px;
  background-color: rgba(110, 158, 155, 0.05);
  border-bottom: none;
}

/* Country sub-nav */
.country-nav a {
  font-size: 12px;
  padding: 3px 8px 3px 20px;
  color: var(--dim);
  display: block;
  text-decoration: none;
  transition: color 0.15s;
  border-bottom: none;
}

.country-nav a:hover {
  color: var(--teal2);
  border-bottom: none;
}

/* Search */
.sidebar-search {
  margin: 4px 0 18px;
  width: 100%;
}

.search-container {
  position: relative;
  width: 100%;
}

#ancestor-search {
  width: 100%;
  padding: 8px 10px 8px 28px;
  background-color: var(--raise);
  border: 1px solid var(--border2);
  border-radius: 3px;
  box-sizing: border-box;
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--text);
  transition: border-color 0.2s;
}

#ancestor-search:focus {
  border-color: var(--teal);
  outline: none;
  box-shadow: 0 0 0 2px rgba(110, 158, 155, 0.15);
}

#ancestor-search::placeholder {
  color: var(--dim);
}

.search-results {
  position: absolute;
  width: 100%;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border2);
  border-top: none;
  border-radius: 0 0 3px 3px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  display: none;
  background-color: var(--raise);
}

.search-result-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-body);
  color: var(--muted);
  transition: background 0.15s;
}

.search-result-item:hover {
  background-color: var(--raise2);
  color: var(--text);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-name {
  font-weight: 500;
  color: var(--text);
  font-size: 13px;
}

.search-result-dates {
  font-size: 12px;
  color: var(--gold);
  margin-top: 2px;
}

/* ── MAIN CONTENT ── */
.main-area {
  grid-area: main;
  position: relative;
  background-color: var(--bg);
  padding: 28px 34px;
}

.main-title {
  margin-bottom: 24px;
}

.content-block {
  margin-bottom: 36px;
}

/* Article title */
.article-title {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 900;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: 1.5rem;
  padding-bottom: 0.6rem;
  position: relative;
}

.article-title em {
  font-style: italic;
  color: var(--rose);
  font-weight: 400;
}

.article-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 48px;
  height: 2px;
  background-color: var(--rose);
  opacity: 0.55;
}

/* Post metadata — CV key-value style */
.post-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
  margin: 14px 0 18px;
}

.post-meta-label,
.pm-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gold);
}

.post-meta-val,
.pm-val {
  font-size: 10.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
}

/* Drop cap */
.dropcap {
  font-family: var(--font-display);
  font-size: 52px;
  font-weight: 700;
  line-height: 0.8;
  float: left;
  margin-right: 8px;
  margin-top: 4px;
  color: var(--rose);
}

/* Pull quote */
.pullquote {
  border-left: 2px solid var(--teal);
  margin: 18px 0;
  padding: 10px 18px;
  background-color: rgba(110, 158, 155, 0.05);
  border-radius: 0 3px 3px 0;
}

.pullquote p {
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--teal2);
  font-style: italic;
  margin: 0;
}

/* ── FEATURE / TOOLS PANEL ── */
.feature-area {
  grid-area: feat;
  padding: 24px 14px;
  background-color: var(--surf);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.feature-item {
  padding: 8px;
  transition: all 0.2s;
  background-color: var(--raise);
  border: 1px solid var(--border);
  border-radius: 3px;
  margin-bottom: 8px;
}

.feature-item:hover {
  border-color: var(--border2);
}

.feature-icon {
  font-size: 1rem;
  color: var(--teal);
  margin-bottom: 4px;
}

/* Tool links */
.tool-link {
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding: 4px 0;
  font-size: 12px;
  color: var(--dim);
  text-decoration: none;
  transition: color 0.15s;
  border-bottom: none;
}

.tool-link:hover {
  color: var(--teal2);
  border-bottom: none;
}

.tool-num {
  font-size: 9.5px;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

/* View style pills */
.view-pill {
  display: block;
  padding: 7px 10px;
  background-color: var(--raise);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 7px;
  transition: all 0.2s;
}

.view-pill:hover {
  border-color: var(--border2);
  color: var(--text);
  border-bottom: none;
}

.view-pill.on {
  border-color: rgba(196, 116, 142, 0.4);
  color: var(--rose2);
}

/* Feature label with rule */
.f-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 10px;
}

.f-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background-color: var(--border);
}

.f-divider {
  height: 1px;
  background-color: var(--border);
  margin: 14px 0;
}

/* ── FOOTER ── */
.footer-area {
  grid-area: foot;
  padding: 20px 28px;
  background-color: var(--surf);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
  width: 100%;
}

.footer-block {
  flex: 1;
  min-width: 200px;
}

.footer-block h3 {
  color: var(--gold);
  margin-bottom: 14px;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  position: relative;
  display: inline-block;
}

.footer-block h3::after {
  display: none;
}

.footer-block a {
  display: block;
  font-size: 12px;
  color: var(--dim);
  margin-bottom: 6px;
  border-bottom: none;
}

.footer-block a:hover {
  color: var(--muted);
  border-bottom: none;
}

.copyright {
  font-size: 11px;
  color: var(--dim);
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  width: 100%;
}

/* ── FORMS ── */
.form-group input,
input,
.username,
.password,
select,
option {
  width: 100%;
  padding: 10px 12px;
  background-color: var(--raise);
  border: 1px solid var(--border2);
  border-radius: 3px;
  color: var(--text);
  margin-bottom: 12px;
  transition: border-color 0.2s;
  font-size: 14px;
  font-family: var(--font-body);
}

.form-group input:focus,
input:focus,
.username:focus,
.password:focus,
select:focus {
  border-color: var(--teal);
  outline: none;
  box-shadow: 0 0 0 2px rgba(110, 158, 155, 0.15);
}

input::placeholder {
  color: var(--dim);
}

button,
button#id,
#chromosomeToggle {
  background-color: var(--raise2);
  color: var(--text);
  border: 1px solid var(--border2);
  padding: 10px 18px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  font-weight: 500;
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

button:hover,
button#id:hover,
#chromosomeToggle:hover {
  background-color: var(--rose);
  color: var(--bg);
  border-color: var(--rose);
  transform: translateY(-1px);
}

input[id=username],
input[id=password] {
  background-color: var(--raise);
  border: 1px solid var(--border2);
  color: var(--text);
}

input[id=username]:focus,
input[id=password]:focus {
  border-color: var(--teal);
  outline: none;
  box-shadow: 0 0 0 2px rgba(110, 158, 155, 0.15);
}

/* ── TABLES ── */
.table {
  width: 100%;
  margin-bottom: 2rem;
  color: var(--text);
  border-collapse: collapse;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.table thead th {
  vertical-align: bottom;
  padding: 12px 15px;
  background-color: var(--raise);
  border-bottom: 1px solid var(--border2);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--gold);
  font-family: var(--font-body);
}

.table-striped tbody tr:nth-of-type(odd) {
  background-color: var(--bg);
}

.table-striped tbody tr:nth-of-type(even) {
  background-color: var(--surf);
}

.table-striped tbody tr:hover {
  background-color: rgba(196, 116, 142, 0.07);
  transition: background-color 0.15s;
}

.table td {
  padding: 12px 15px;
  vertical-align: middle;
  border-top: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--muted);
}

/* ── CAROUSEL ── */
.carousel-container {
  width: 100%;
  height: 280px;
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.carousel-track {
  display: flex;
  position: absolute;
  width: max-content;
  height: 100%;
  animation: carousel 30s linear infinite;
}

.carousel-track:hover {
  animation-play-state: paused;
}

.carousel-slide {
  height: 280px;
  width: auto;
  margin-right: 16px;
  flex-shrink: 0;
  border-radius: 3px;
  overflow: hidden;
  transition: transform 0.3s ease;
}

.carousel-slide:hover {
  transform: scale(1.02);
}

.carousel-slide img {
  height: 100%;
  width: auto;
  display: block;
}

@keyframes carousel {
  0%   { transform: translateX(0); }
  100% { transform: translateX(calc(-100% + 100vw)); }
}

/* ── TIMELINE ── */
.timeline-header {
  text-align: center;
  margin-bottom: 20px;
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold);
}

.horizontal-timeline-container {
  position: relative;
  width: 100%;
  margin: 30px 0;
  padding: 20px 0;
  clear: both;
}

.horizontal-timeline-wrapper {
  padding: 20px 0;
  margin-bottom: 20px;
  width: 100%;
  overflow: visible;
}

.horizontal-timeline {
  position: relative;
  height: 100px;
  margin: 0 auto;
  padding: 30px 20px 0;
}

.timeline-line {
  position: absolute;
  top: 50px;
  left: 5%;
  right: 5%;
  width: 90%;
  height: 1px;
  background-color: var(--border2);
  z-index: 1;
}

.timeline-event {
  position: absolute;
  top: 20px;
  transform: translateX(-50%);
  z-index: 2;
  cursor: pointer;
  transition: all 0.3s ease;
}

.timeline-event:hover {
  transform: translateX(-50%) scale(1.1);
}

.timeline-event.active .timeline-point {
  transform: translateX(-50%) scale(1.3);
  border-color: var(--gold);
}

.timeline-point {
  width: 10px;
  height: 10px;
  background-color: var(--bg);
  border: 2px solid var(--muted);
  border-radius: 50%;
  position: absolute;
  top: 26px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  transition: all 0.3s ease;
}

.timeline-event.birth .timeline-point  { border-color: var(--rose); }
.timeline-event.death .timeline-point  { border-color: var(--dim); }
.timeline-event.residence .timeline-point { border-color: var(--gold); }

.timeline-label {
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  font-family: var(--font-body);
}

.year-marker {
  position: absolute;
  bottom: 0;
  transform: translateX(-50%);
  z-index: 1;
  text-align: center;
}

.year-marker span {
  display: block;
  color: var(--dim);
  font-size: 11px;
  font-family: var(--font-body);
}

.timeline-details {
  margin: 0 auto;
  border-radius: 4px;
  padding: 20px;
  text-align: center;
  opacity: 0;
  height: 0;
  overflow: hidden;
  transition: all 0.3s ease;
  background-color: var(--raise);
  border: 1px solid var(--border);
}

.timeline-details.visible {
  opacity: 1;
  height: auto;
  padding: 20px;
  margin-top: 20px;
}

.event-year     { font-weight: 600; color: var(--gold); margin: 5px 0; }
.event-location { font-style: italic; color: var(--teal2); }
#event-title    { margin-top: 0; color: var(--rose2); }

/* ── MISC COMPONENTS ── */
.glitch-btn {
  display: inline-block;
  padding: 12px 24px;
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  background-color: var(--raise2);
  color: var(--text);
  border: 1px solid var(--border2);
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s;
}

.glitch-btn:hover {
  background-color: var(--rose);
  color: var(--bg);
  border-color: var(--rose);
  transform: translateY(-1px);
}

.controls {
  margin: 10px 0;
  display: flex;
  gap: 10px;
}

.profile-container {
  position: relative;
  border-radius: 4px;
  margin-bottom: 20px;
}

#myDiagramDiv {
  width: 100%;
  height: 900px;
  border: none;
  background-color: var(--raise);
  overflow: hidden;
  position: relative;
}

#myDiagramDiv::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 70px;
  background-color: var(--raise);
  z-index: 10;
  pointer-events: none;
}

#myDiagramDiv.fullscreen-mode {
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding-top: 70px !important;
}

#myDiagramDiv.fullscreen-mode::after {
  content: "Press ESC to exit fullscreen";
  position: fixed;
  bottom: 10px;
  right: 10px;
  background-color: var(--rose);
  color: var(--bg);
  padding: 5px 10px;
  border-radius: 3px;
  font-size: 11px;
  z-index: 1000;
  opacity: 0;
  animation: fadeInOut 3s forwards;
}

@keyframes fadeInOut {
  0%   { opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { opacity: 0; }
}

/* Surname cloud */
.surname-cloud {
  width: auto;
  min-height: 300px;
  padding: 20px;
  text-align: center;
  line-height: 1.6;
}

.surname-tag {
  display: inline-block;
  margin: 4px;
  color: var(--muted);
  text-decoration: none;
  font-family: var(--font-display);
  padding: 3px 7px;
  border-radius: 3px;
  transition: color 0.15s;
  border-bottom: none;
}

.surname-tag:hover {
  color: var(--rose2);
  font-weight: bold;
  border-bottom: none;
}

/* DNA / biographical info blocks */
.dna-info,
.colonist-info,
.faith-info,
.military-service-info {
  font-family: var(--font-body);
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.biographical-details {
  margin-top: 20px;
  margin-bottom: 20px;
}

.biographical-details p,
.dna-info p,
.colonist-info p,
.faith-info p {
  margin-top: 0;
  margin-bottom: 10px;
  font-family: var(--font-body);
  line-height: 1.75;
}

/* Legend */
#legend {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
  padding: 5px;
  line-height: 1.6;
  font-family: var(--font-body);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  white-space: nowrap;
  margin-right: 12px;
  font-family: var(--font-body);
  color: var(--muted);
}

.legend-color {
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* Utilities */
.writing {
  display: block;
  text-align: right;
  font-family: "Ms Madi", serif;
  color: var(--teal2);
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 2.5rem;
  margin: 20px 0 0;
}

.rightSide    { display: block; text-align: right; }
.centre       { text-align: center; margin-top: 20px; }
.centreperson { text-align: center; padding-top: 10px; font-weight: 600; color: var(--gold2); }
.spaceR       { padding-top: 30px; padding-bottom: 30px; }
.ancestor-list { margin-top: 10px; }

#lBold   { font-weight: 600; color: var(--gold2); }
.blueBold { color: var(--teal2); font-weight: 600; }
.fa-person-rifle { color: var(--muted); }

#text {
  line-height: 1.75;
  font-family: var(--font-body);
}

div#tree   { max-height: 100vh; width: auto; }

/* Notes list */
.notes        { list-style: none; margin-left: 0; padding-left: 0; }
.notes li     { margin-bottom: 18px; position: relative; padding-left: 22px; }
.notes li::before { content: '—'; position: absolute; left: 0; color: var(--rose); opacity: 0.6; }
li.notes      { font-weight: normal; font-family: var(--font-body); }
ul.notes h2   { text-align: center; margin-bottom: 22px; }
ul.notes li   { font-family: var(--font-body); line-height: 1.75; }
ul.the-list   { list-style: none; padding: 0; }
ul li.the-list, ul li { list-style-image: none; list-style: none; padding: 0; }

/* Style switcher */
.style-switcher {
  z-index: 5;
  padding: 6px;
  background-color: var(--raise);
  border-radius: 4px;
  border: 1px solid var(--border);
}

.style-option {
  text-align: center;
  transition: all 0.2s;
  border: 1px solid transparent;
  border-radius: 3px;
}

.style-option:hover  { border-color: var(--rose); }
.style-option.active { border-color: var(--gold); }

.style-option img {
  width: 125px;
  border-radius: 3px;
  margin-bottom: 4px;
}

.style-name { display: none; }

/* Canvas / genome */
.tooltip-container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  overflow-x: auto;
}

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

/* Noise overlay */
.noise {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 99;
}

/* ── RESPONSIVE ── */

/* Collapse sidebar/feat below main on mid-size screens */
@media (max-width: 1100px) {
  .grid-container {
    grid-template-columns: clamp(150px, 15%, 200px) 1fr clamp(120px, 12%, 160px);
    width: 94%;
  }
  .hero-title { font-size: 2.4rem; }
  .nav-item   { padding: 5px 9px; font-size: 10px; }
  div#tree    { max-height: 400px; }
}

/* Stack to single column on tablets / mobile */
@media (max-width: 860px) {
  .grid-container {
    width: 100%;
    grid-template-columns: 1fr;
    grid-template-areas:
      "logo"
      "nav"
      "hero"
      "main"
      "side"
      "feat"
      "foot";
    gap: 0;
    margin: 0 auto;
  }

  .logo-area  { height: auto; padding: 16px 20px; justify-content: center; border-right: none; }
  .nav-area   { height: auto; padding: 10px 14px; justify-content: center; }
  .nav-container { justify-content: center; flex-wrap: wrap; gap: 4px; }
  .nav-item   { padding: 5px 8px; font-size: 10px; margin: 2px; }

  .hero-area     { padding: 36px 20px 30px; }
  .hero-title    { font-size: 2rem; }
  .hero-subtitle { font-size: 0.85rem; }
  .hero-meta     { flex-wrap: wrap; gap: 18px; }

  .main-area    { padding: 24px 20px; border-right: none; }
  .sidebar-area { border-right: none; border-top: 1px solid var(--border); }
  .feature-area { border-left: none;  border-top: 1px solid var(--border); }

  .timeline-line { left: 10%; right: 10%; width: 80%; }
  .year-marker span, .timeline-label { font-size: 11px; }
  div#tree { max-height: 500px; }

  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr  { margin-bottom: 12px; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
  .table td  { text-align: right; padding-left: 45%; position: relative; border-top: none; border-bottom: 1px solid var(--border); }
  .table td::before { content: attr(data-label); position: absolute; left: 14px; font-weight: 500; color: var(--gold); text-align: left; text-transform: uppercase; font-size: 11px; }
  .table td:last-child { border-bottom: none; text-align: center; padding-left: 14px; }

  .footer-area    { flex-direction: column; text-align: center; }
  .footer-content { flex-direction: column; }
  .footer-block   { width: 100%; text-align: center; }

  .carousel-container { height: 220px; }
  .carousel-slide     { height: 220px; }
}

@media (max-width: 480px) {
  .hero-title    { font-size: 1.8rem; }
  .article-title { font-size: 1.5rem; }
}