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

:root {
  --bg: #fafaf8;
  --surface: #ffffff;
  --text: #1a1a1a;
  --muted: #6b6b6b;
  --border: #e5e5e0;
  --accent: #2c4a2e;
  --accent-light: #f0f4f0;
  --sidebar-w: 220px;
  --font-serif: 'Georgia', 'Times New Roman', serif;
  --font-ui: system-ui, -apple-system, sans-serif;
}

html { font-size: 16px; scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: var(--font-serif); line-height: 1.75; min-height: 100vh; }

/* ── LAYOUT ── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding-bottom: 2rem;
}

.sidebar-brand {
  padding: 2rem 1.5rem 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.75rem;
}

.site-label {
  font-family: var(--font-ui);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.brand-name {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  font-family: var(--font-ui);
  margin: 0;
  transition: color 0.15s;
}

.brand-name span {
  display: block;
  font-weight: 400;
  font-style: italic;
  color: var(--muted);
  font-family: var(--font-serif);
  font-size: 0.9rem;
  margin-top: 0.2rem;
}

/* ── NAV ── */
nav {
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0;
}

nav a {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: var(--muted);
  text-decoration: none;
  padding: 0.45rem 1.5rem;
  transition: color 0.15s, background 0.15s;
  border-left: 2px solid transparent;
}

nav a:hover {
  color: var(--accent);
  background: var(--accent-light);
}

nav a.active {
  color: var(--accent);
  font-weight: 600;
  border-left-color: var(--accent);
  background: var(--accent-light);
}

/* ── PAGE CONTENT ── */
.page-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  max-width: 700px;
  padding: 3.5rem 3rem 5rem;
}

/* ── TYPOGRAPHY ── */
.page-badge {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent);
  font-family: var(--font-ui);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.28rem 0.7rem;
  border-radius: 2px;
  margin-bottom: 1.75rem;
}

h1 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 1.25rem;
  font-family: var(--font-ui);
  line-height: 1.3;
}

h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 2rem 0 1rem;
  font-family: var(--font-ui);
}

h3 {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  font-family: var(--font-ui);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 2rem 0 0.6rem;
}

p {
  font-size: 1.02rem;
  margin-bottom: 1.4rem;
  text-align: left;
  color: var(--text);
}

article p:first-of-type::first-letter {
  float: left;
  font-size: 3rem;
  line-height: 0.85;
  margin: 0.1rem 0.4rem 0 0;
  color: var(--accent);
  font-family: Georgia, serif;
}

blockquote {
  border-left: 3px solid var(--border);
  padding-left: 1.25rem;
  margin: 1.5rem 0;
  color: var(--muted);
  font-style: italic;
}

hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }

/* ── LISTS ── */
.link-list { list-style: none; margin-bottom: 2rem; }
.link-list li { border-bottom: 1px solid var(--border); }
.link-list li:first-child { border-top: 1px solid var(--border); }
.link-list a { display: block; padding: 0.55rem 0.25rem; font-family: var(--font-ui); font-size: 0.88rem; color: var(--accent); text-decoration: none; transition: background 0.1s, padding-left 0.1s; }
.link-list a:hover { background: var(--accent-light); padding-left: 0.6rem; text-decoration: none; }

.link-list-num { list-style: none; counter-reset: item; margin-bottom: 2rem; }
.link-list-num li { counter-increment: item; border-bottom: 1px solid var(--border); position: relative; }
.link-list-num li:first-child { border-top: 1px solid var(--border); }
.link-list-num li::before { content: counter(item); position: absolute; left: 0.25rem; font-family: var(--font-ui); font-size: 0.72rem; color: var(--muted); top: 0.72rem; pointer-events: none; }
.link-list-num a { display: block; padding: 0.55rem 0.25rem 0.55rem 2.5rem; font-family: var(--font-ui); font-size: 0.88rem; color: var(--accent); text-decoration: none; transition: background 0.1s, padding-left 0.1s; }
.link-list-num a:hover { background: var(--accent-light); }

/* ── NAME INDEX ── */
.alpha-nav { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-bottom: 2rem; }
.alpha-nav a { display: inline-block; padding: 0.2rem 0.5rem; font-family: var(--font-ui); font-size: 0.82rem; color: var(--accent); text-decoration: none; border: 1px solid var(--border); border-radius: 2px; }
.alpha-nav a:hover { background: var(--accent-light); }

.alpha-section { margin-bottom: 1.75rem; }
.alpha-letter { font-family: var(--font-ui); font-size: 1.1rem; font-weight: 700; color: var(--accent); border-bottom: 2px solid var(--accent); padding-bottom: 0.25rem; margin-bottom: 0.6rem; }
.name-entry { font-family: var(--font-ui); font-size: 0.83rem; padding: 0.18rem 0; color: var(--text); display: flex; gap: 0.5rem; }
.name-entry .gender { color: var(--muted); width: 1rem; flex-shrink: 0; }

/* ── INTRO STRIP ── */
.intro-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.intro-strip span { white-space: nowrap; }
.intro-sep { opacity: 0.35; }

/* ── QUICK LINKS ── */
.quick-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 2rem 0 2.5rem;
}
.ql-card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 4px;
  text-decoration: none;
  background: var(--surface);
  transition: border-color 0.15s, border-left-color 0.15s, box-shadow 0.15s, transform 0.1s;
}
.ql-card:hover {
  border-color: var(--border);
  border-left-color: var(--accent);
  box-shadow: 0 2px 10px rgba(44,74,46,0.07);
  transform: translateY(-1px);
}
.ql-card::after { display: none !important; }
.ql-title {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}
.ql-arrow {
  font-weight: 400;
  color: var(--muted);
  transition: color 0.15s, transform 0.15s;
  display: inline-block;
}
.ql-card:hover .ql-arrow {
  color: var(--accent);
  transform: translateX(3px);
}
.ql-desc {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.4;
}
@media (max-width: 700px) {
  .quick-links { grid-template-columns: 1fr; gap: 0.5rem; }
  .intro-strip { margin-bottom: 0.5rem; }
}

/* ── FEATURED LINK ── */
.featured-link { display: inline-block; margin: 0.5rem 0 1.5rem; padding: 0.55rem 1.1rem; background: var(--accent); color: #fff; text-decoration: none; font-family: var(--font-ui); font-size: 0.82rem; border-radius: 3px; transition: opacity 0.15s; }
.featured-link:hover { opacity: 0.85; }

/* ── EXTERNAL LINK INDICATOR ── */
a[target="_blank"]:not(.featured-link):not(.brand-link)::after {
  content: " ↗";
  font-size: 0.75em;
  opacity: 0.5;
  display: inline-block;
  vertical-align: middle;
}

/* ── FOCUS STYLES (accessibility) ── */
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ── SIDEBAR BRAND LINK ── */
.brand-link {
  text-decoration: none;
  color: inherit;
  display: block;
}
.brand-link:hover .brand-name { color: var(--accent); }
.brand-link::after { display: none !important; }

/* ── BACK TO TOP ── */
.back-to-top {
  display: inline-block;
  margin: 2.5rem 0 1rem;
  padding: 0.4rem 0.85rem;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  transition: color 0.15s, border-color 0.15s;
}
.back-to-top:hover { color: var(--accent); border-color: var(--accent); }
.back-to-top::after { display: none !important; }

/* ── FOOTER ── */
footer { border-top: 1px solid var(--border); padding: 1rem 3rem; background: var(--surface); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
footer p { font-family: var(--font-ui); font-size: 0.75rem; color: var(--muted); margin: 0; }
footer a { font-family: var(--font-ui); font-size: 0.75rem; color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--accent); }
footer a::after { display: none !important; }

/* ── SIDEBAR NAV SUB-ITEM ── */
nav a.nav-sub {
  font-size: 0.78rem;
  padding-left: 2.75rem;
  color: var(--muted);
  opacity: 0.8;
  position: relative;
}
nav a.nav-sub::before {
  content: '';
  position: absolute;
  left: 1.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 1px;
  background: var(--border);
}
nav a.nav-sub.active {
  border-left-color: var(--accent);
  background: var(--accent-light);
  opacity: 1;
}
nav a.nav-sub:hover::before { background: var(--accent); }

/* ── HAMBURGER BUTTON (desktop: hidden) ── */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 3px;
  flex-shrink: 0;
}
.nav-toggle:hover { background: var(--accent-light); }
.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── RESPONSIVE ── */
@media (max-width: 700px) {
  .layout { flex-direction: column; }

  .sidebar {
    width: 100%;
    height: auto;
    position: sticky;
    top: 0;
    z-index: 100;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  }

  .sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.25rem;
    border-bottom: none;
    margin-bottom: 0;
  }

  .site-label { display: none; }

  .brand-name {
    font-size: 0.9rem;
  }

  .nav-toggle { display: flex; }

  nav {
    display: none;
    flex-direction: column;
    padding: 0.5rem 0;
    border-top: 1px solid var(--border);
    background: var(--surface);
  }

  nav.open { display: flex; }

  nav a {
    padding: 0.65rem 1.5rem;
    border-left: none;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
  }

  nav a:last-child { border-bottom: none; }

  nav a.active {
    border-left: none;
    border-left: 3px solid var(--accent);
    background: var(--accent-light);
  }

  nav a.nav-sub { padding-left: 2.25rem; }

  article p:first-of-type::first-letter {
    float: none;
    font-size: inherit;
    line-height: inherit;
    margin: 0;
    color: inherit;
  }

  main { padding: 1.75rem 1.25rem 3rem; }
  footer { padding: 1rem 1.25rem; }
  .footer-inner { flex-direction: column; gap: 0.25rem; align-items: flex-start; }
}
