/* ============================================================
   Lemmermann Genealogie — Main Stylesheet
   Pure CSS, no framework dependencies
   ============================================================ */

/* ---------- Inter variable font (local, offline) ---------- */
@font-face {
  font-family: 'Inter';
  src: url('../fonts/InterVariable.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../fonts/InterVariable-Italic.ttf') format('truetype');
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

/* ---------- Reset & base ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-bg:         #f0f4ff;
  --color-surface:    #ffffff;
  --color-border:     #bfdbfe;
  --color-accent:     #1d4ed8;
  --color-accent-lt:  #60a5fa;
  --color-text:       #0f172a;
  --color-muted:      #475569;
  --color-link:       #1d4ed8;
  --color-link-hover: #1e3a8a;
  --color-nav-bg:     #1e2d5e;
  --color-nav-text:   #dbeafe;
  --color-nav-hover:  #1e40af;
  --color-nav-active: #60a5fa;

  --font-body:   'Inter', system-ui, -apple-system, sans-serif;
  --font-ui:     'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:   'Courier New', Courier, monospace;

  --nav-width:   220px;
  --content-max: 900px;
  --gap:         1.5rem;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.7;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: var(--nav-width) 1fr;
  grid-template-areas:
    "header  header"
    "nav     main"
    "footer  footer";
}

/* ---------- Links ---------- */
a {
  color: var(--color-link);
  text-decoration: underline;
  text-underline-offset: 2px;
}
a:hover {
  color: var(--color-link-hover);
}

/* ---------- Header ---------- */
.site-header {
  grid-area: header;
  background: var(--color-nav-bg);
  color: var(--color-nav-text);
  padding: 1rem var(--gap);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-header h1 {
  font-family: var(--font-body);
  font-size: 1.4rem;
  font-weight: bold;
  letter-spacing: 0.04em;
  color: inherit;
}

.site-header h1 a {
  color: inherit;
  text-decoration: none;
}

.lang-switcher {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.coa-intro {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  margin: 1rem auto;
  text-align: left;
}

.coa-img {
  height: 7rem;
  width: auto;
  flex-shrink: 0;
}

.section-divider {
  border: none;
  border-top: 1px solid var(--color-border, #ccc);
  margin: 1rem 0;
  width: 100%;
}

.lang-switcher a {
  color: var(--color-nav-text);
  opacity: 0.75;
  text-decoration: none;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  border: 1px solid transparent;
  transition: opacity 0.15s, border-color 0.15s;
}
.lang-switcher a:hover {
  opacity: 1;
  color: var(--color-nav-text);
  border-color: var(--color-nav-text);
}
.lang-switcher a[aria-current="page"] {
  opacity: 1;
  border-color: var(--color-nav-text);
}

/* ---------- Navigation ---------- */
.site-nav {
  grid-area: nav;
  background: var(--color-nav-bg);
  color: var(--color-nav-text);
  padding: 1.25rem 0;
  overflow-y: auto;
  position: sticky;
  top: 0;
  max-height: 100vh;
}

.site-nav h2 {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-nav-active);
  padding: 0.6rem 1rem 0.3rem;
  margin-top: 0.75rem;
}

.site-nav h2:first-child {
  margin-top: 0;
}

.site-nav ul {
  list-style: none;
}

.site-nav ul li a {
  display: block;
  padding: 0.25rem 1rem;
  color: var(--color-nav-text);
  text-decoration: none;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  line-height: 1.4;
  transition: background 0.12s;
}

.site-nav ul li a:hover {
  background: var(--color-nav-hover);
  color: var(--color-nav-text);
}

.site-nav ul li a[aria-current="page"] {
  background: var(--color-nav-active);
  color: #fff;
}

/* ---------- Main content ---------- */
main {
  grid-area: main;
  padding: var(--gap) calc(var(--gap) * 1.5);
  max-width: calc(var(--content-max) + var(--gap) * 3);
}

/* ---------- Footer ---------- */
.site-footer {
  grid-area: footer;
  background: var(--color-nav-bg);
  color: var(--color-nav-text);
  text-align: center;
  padding: 0.75rem var(--gap);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  opacity: 0.85;
}

.site-footer a {
  color: var(--color-nav-text);
}

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-body);
  color: var(--color-accent);
  line-height: 1.25;
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
}

h1 { font-size: 1.75rem; margin-top: 0; }
h2 { font-size: 1.35rem; border-bottom: 1px solid var(--color-border); padding-bottom: 0.2rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }

p { margin-bottom: 0.9rem; }

strong { color: var(--color-accent); }
em { font-style: italic; }

/* ---------- Genealogy person entries ---------- */
.person {
  margin-bottom: 1.25rem;
  padding-left: 1rem;
  border-left: 2px solid var(--color-border);
}

.person .person-id {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--color-muted);
  margin-right: 0.5rem;
}

.person .children {
  margin-top: 0.5rem;
  margin-left: 1rem;
  list-style: none;
}

.person .children li::before {
  content: "↳ ";
  color: var(--color-muted);
}

/* ---------- Tables (Letters from America, etc.) ---------- */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  font-family: var(--font-ui);
}

th {
  background: var(--color-accent);
  color: #fff;
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

td {
  padding: 0.15rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

td p {
  margin: 0;
}

tr:nth-child(even) td {
  background: #dbeafe;
}

tr:hover td {
  background: #bfdbfe;
}

/* ---------- Intro / welcome block ---------- */
.intro-section {
  margin-bottom: 2rem;
  padding: 1.25rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 4px;
}

.intro-section + .intro-section {
  margin-top: 1.5rem;
}

.callout {
  margin: 1.25rem 0;
  padding: 0.75rem 1rem;
  background: #f0f4ff;
  border-left: 4px solid var(--color-accent);
  border-radius: 3px;
  font-style: italic;
  font-size: 0.95rem;
  color: #334155;
}

.section-divider {
  border: none;
  border-top: 2px solid var(--color-border);
  margin: 2rem 0;
}

/* ---------- Source note ---------- */
.source-note {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--color-muted);
  font-style: italic;
  margin-top: 2rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--color-border);
}

/* ---------- Responsive: collapse nav on small screens ---------- */
@media (max-width: 700px) {
  body {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "nav"
      "main"
      "footer";
  }

  .site-nav {
    position: static;
    max-height: none;
    overflow: visible;
  }

  main {
    padding: var(--gap);
  }
}

/* Nameindex (holland.html) */
body.has-name-index {
  grid-template-columns: var(--nav-width) 1fr 14rem;
  grid-template-areas:
    "header  header     header"
    "nav     main       nameindex"
    "footer  footer     footer";
}

aside.name-index {
  grid-area: nameindex;
  border-left: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-size: 0.8rem;
}

.name-index-header {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
  position: sticky;
  top: 0;
}

.ni-letter-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  padding: 0.3rem 0.6rem;
  border-bottom: 1px solid var(--color-border);
}

.ni-letter-nav a {
  font-weight: bold;
  padding: 0 0.2rem;
  text-decoration: none;
}

.name-index-body {
  overflow-y: auto;
  padding: 0.4rem 0.6rem;
  flex: 1;
}

.ni-surname {
  font-weight: bold;
  margin: 0.4rem 0 0;
}

.ni-person {
  display: block;
  padding-left: 0.75rem;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ni-person:hover {
  text-decoration: underline;
}

.ni-letter-anchor {
  display: block;
  height: 0;
}

/* Scrollbars: hidden until hover */
html {
  overflow-y: auto;
  scrollbar-width: none;
}
html:hover {
  scrollbar-width: thin;
}
html::-webkit-scrollbar { width: 0; }
html:hover::-webkit-scrollbar { width: 8px; }
html::-webkit-scrollbar-track { background: transparent; }
html::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
}

.site-nav,
.name-index-body {
  scrollbar-width: none;
}
.site-nav:hover,
.name-index-body:hover {
  scrollbar-width: thin;
}
.site-nav::-webkit-scrollbar,
.name-index-body::-webkit-scrollbar { width: 0; }
.site-nav:hover::-webkit-scrollbar,
.name-index-body:hover::-webkit-scrollbar { width: 6px; }
.site-nav::after {
  content: '';
  display: block;
  height: 100px;
}

.pdf-viewer-main {
  padding: 0;
  max-width: none;
  overflow: hidden;
}

.pdf-embed {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

body:has(.pdf-embed) {
  height: 100vh;
  overflow: hidden;
}
