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

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --max-width: 1100px;
  --header-height: 60px;
}

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

/* ── Skip link ────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  background: var(--color-header-bg);
  color: var(--color-header-text);
  padding: 0.5rem 1rem;
  z-index: 200;
  text-decoration: none;
  font-size: 0.95rem;
}
.skip-link:focus { top: 0; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-body-bg);
  line-height: 1.7;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Header ───────────────────────────────────────────────── */
.site-header {
  background: var(--color-header-bg);
  height: var(--header-height);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-brand img { display: block; }
.site-brand .site-name {
  color: var(--color-header-text);
  font-size: 1.2rem;
  font-weight: 700;
  text-decoration: none;
}
.site-brand { text-decoration: none; }

.site-nav ul {
  list-style: none;
  display: flex;
  gap: 0.25rem;
}

.site-nav a {
  color: var(--color-header-text);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  transition: background 0.15s;
}

.site-nav a:hover {
  background: rgba(255,255,255,0.15);
}

.site-nav a:focus-visible {
  outline: 2px solid var(--color-header-text);
  outline-offset: 2px;
  text-decoration: underline;
}

.site-nav a.active {
  background: var(--color-nav-active);
}

/* ── Hamburger toggle ─────────────────────────────────────── */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  flex-direction: column;
  gap: 5px;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-header-text);
  transition: transform 0.2s, opacity 0.2s;
}

.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;
}
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ── Page layout ──────────────────────────────────────────── */
.page-wrap {
  flex: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  width: 100%;
}

.page-wrap.with-aside {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 3rem;
  align-items: start;
}

/* ── Page content ─────────────────────────────────────────── */
.page-content {
  min-width: 0;
}

.typeset .page-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-heading);
  margin-top: 0;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 3px solid var(--color-heading-border);
}

/* ── Aside ────────────────────────────────────────────────── */
.page-aside {
  position: sticky;
  top: calc(var(--header-height) + 1.5rem);
}

.aside-section {
  background: var(--color-aside-bg);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-aside-border);
  border-radius: 6px;
  padding: 1.25rem;
}

.aside-section h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--color-heading);
}

.aside-logo {
  display: block;
  width: 100%;
  max-width: 180px;
  margin: 0 auto 1rem;
}

.aside-section p {
  font-size: 1rem;
  color: var(--color-text-light);
  line-height: 1.6;
}

.aside-section a {
  color: var(--color-aside-link);
}

/* ── Typography (typeset) ─────────────────────────────────── */
.typeset h1, .typeset h2, .typeset h3,
.typeset h4, .typeset h5, .typeset h6 {
  font-weight: 700;
  line-height: 1.3;
  margin: 1.5rem 0 0.75rem;
  color: var(--color-heading);
}

.typeset h2 { font-size: 1.5rem; border-bottom: 2px solid var(--color-heading-border); padding-bottom: 0.35rem; }
.typeset h3 { font-size: 1.2rem; border-bottom: 1px solid var(--color-border); padding-bottom: 0.25rem; }
.typeset h4 { font-size: 1.05rem; }
.typeset h5 { font-size: 0.95rem; color: var(--color-text-light); font-weight: 600; }

.typeset p { margin-bottom: 1rem; }

.typeset a { color: var(--color-accent); text-decoration: underline; }
.typeset a:hover { color: var(--color-accent-hover); }

.typeset ul, .typeset ol {
  margin: 0.75rem 0 1rem 1.5rem;
}

.typeset li { margin-bottom: 0.35rem; }

.typeset em { font-style: italic; }
.typeset strong { font-weight: 700; }

.typeset hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 2rem 0;
}

.typeset blockquote {
  border-left: 3px solid var(--color-blockquote);
  padding-left: 1rem;
  color: var(--color-text-light);
  margin: 1rem 0;
}

/* ── People / figure floats ───────────────────────────────── */
.typeset img[style*="float:left"],
.typeset img[style*="float: left"] {
  margin: 0.25rem 1.25rem 1rem 0;
}

.typeset img[style*="float:right"],
.typeset img[style*="float: right"] {
  margin: 0.25rem 0 1rem 1.25rem;
}

/* Person blocks: clear floats after each h2/h3/h4 section */
.typeset h2, .typeset h3, .typeset h4 { clear: both; }

/* ── Footer ───────────────────────────────────────────────── */
.site-footer {
  background: var(--color-footer-bg);
  border-top: 3px solid var(--color-footer-border);
  padding: 1.5rem;
  text-align: center;
  font-size: 1rem;
  color: var(--color-text-light);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.footer-logo img { display: block; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1100px) {
  .nav-toggle { display: flex; }

  .site-nav ul {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--color-header-bg);
    padding: 0.5rem 1rem 1rem;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    gap: 0;
  }

  .site-nav.is-open ul { display: flex; }

  .site-nav li { border-bottom: 1px solid rgba(255,255,255,0.1); }

  .site-nav a {
    display: block;
    font-size: 1rem;
    padding: 0.6rem 0.75rem;
  }
}

@media (max-width: 768px) {
  .page-wrap.with-aside {
    grid-template-columns: 1fr;
  }

  .page-aside {
    position: static;
    order: -1;
  }
}

/* ── News list ────────────────────────────────────────────── */
.news-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.news-item {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--color-border);
}

.news-item:first-child { padding-top: 0; }

.news-item-title {
  display: block;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-accent);
  text-decoration: underline;
  margin-bottom: 0.25rem;
}

.news-item-title:hover {
  color: var(--color-accent-hover);
}

.news-item-meta {
  font-size: 0.875rem;
  color: var(--color-text-light);
  margin-bottom: 0.5rem;
}

.news-item-summary { margin: 0 0 0.5rem; }

.news-item-more {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-accent);
  text-decoration: none;
}

.news-item-more:hover {
  color: var(--color-accent-hover);
  text-decoration: underline;
}

/* ── Article ──────────────────────────────────────────────── */
.article-meta {
  font-size: 0.875rem;
  color: var(--color-text-light);
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

.article-back {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}
