/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

/* ── Variables ── */
:root {
  --sidebar-bg:       #0d1f3c;
  --sidebar-bg2:      #0a1a32;
  --sidebar-border:   #1a3058;
  --sidebar-text:     #8facc8;
  --sidebar-hover:    #c8ddf0;
  --sidebar-active:   #ffffff;
  --sidebar-accent:   #c9a227;
  --sidebar-width:    260px;

  --content-bg:       #ffffff;
  --content-text:     #1a1a1a;
  --content-muted:    #555555;
  --content-rule:     #e0d8cc;

  --accent:           #0d1f3c;
  --accent-gold:      #c9a227;

  --font-body:        Georgia, 'Times New Roman', Times, serif;
  --font-display:     'Playfair Display', Georgia, serif;
  --font-ui:          'Barlow', system-ui, -apple-system, sans-serif;

  --transition:       0.2s ease;
}

/* ── Body ── */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-body);
  background: var(--content-bg);
  color: var(--content-text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  transition: transform var(--transition);
  scrollbar-width: thin;
  scrollbar-color: #1a3058 var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
}

.sidebar-inner {
  padding: 0 0 3rem;
}

/* Brand */
.sidebar-brand {
  display: block;
  padding: 1.75rem 1.5rem;
  text-decoration: none;
  background: var(--sidebar-bg2);
  border-bottom: 1px solid var(--sidebar-border);
  margin-bottom: 1.25rem;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--sidebar-accent);
  line-height: 1.4;
}

/* Nav */
.sidebar-nav {
  padding: 0 0.75rem;
}

.sidebar-link {
  display: block;
  font-family: var(--font-ui);
  font-size: 19px;
  font-weight: 400;
  color: var(--sidebar-text);
  text-decoration: none;
  padding: 0.5rem 0.85rem;
  border-radius: 4px;
  margin-bottom: 1px;
  border-left: 2px solid transparent;
  transition: all var(--transition);
  line-height: 1.35;
}

.sidebar-link:hover {
  color: var(--sidebar-hover);
  background: rgba(255,255,255,0.06);
  border-left-color: var(--sidebar-accent);
}

.sidebar-link.active {
  color: var(--sidebar-active);
  background: rgba(201,162,39,0.12);
  border-left-color: var(--sidebar-accent);
  font-weight: 500;
}

.sidebar-divider {
  height: 1px;
  background: var(--sidebar-border);
  margin: 1rem 0.85rem;
}

.sidebar-link--about {
  font-style: italic;
  font-size: 13px;
}

/* ── Mobile header ── */
.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 54px;
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--sidebar-border);
  align-items: center;
  padding: 0 1.25rem;
  gap: 1rem;
  z-index: 99;
}

.mobile-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
  flex-shrink: 0;
}

.mobile-menu-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: white;
  border-radius: 2px;
}

/* ── Main ── */
.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 3rem 4rem 5rem;
}

.content-wrap {
  width: 100%;
  max-width: 920px;
}

/* ── Article ── */
.article-header {
  margin-bottom: 1.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--accent-gold);
  text-align: center;
}

.article-title {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.15;
  letter-spacing: -0.02em;
  overflow-wrap: break-word;
  text-align: center;
}

.article-rule {
  width: 48px;
  height: 3px;
  background: var(--accent-gold);
  margin-top: 1.25rem;
  border-radius: 1px;
}

/* ── Article body typography (NYT-style) ── */
.article-body {
  font-family: var(--font-body);
  font-size: 19px;
  line-height: 1.85;
  color: var(--content-text);
  overflow-wrap: break-word;
}

.article-body p {
  margin-bottom: 1.1rem;
}

.article-body h1 {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 700;
  margin-top: 3rem;
  margin-bottom: 1rem;
  color: var(--accent);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.article-body h2 {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  color: var(--accent);
  line-height: 1.3;
}

.article-body h3 {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-gold);
  margin-top: 2rem;
  margin-bottom: 0.6rem;
}

.article-body strong {
  font-weight: bold;
}

.article-body em {
  font-style: italic;
  color: var(--content-muted);
}

.article-body hr {
  border: none;
  border-top: 2px solid var(--accent-gold);
  margin: 2.5rem 0;
}

.article-body ol,
.article-body ul {
  padding-left: 1.75rem;
  margin-bottom: 1.4rem;
}

.article-body li {
  margin-bottom: 0.45rem;
  line-height: 1.75;
}

.article-body blockquote {
  border-left: 3px solid var(--accent-gold);
  padding: 0.25rem 0 0.25rem 1.5rem;
  margin: 2rem 0;
  color: var(--content-muted);
  font-style: italic;
}

.article-body a {
  color: var(--accent);
  text-underline-offset: 3px;
}

/* ── Page-load animation ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.article-header {
  animation: fadeInUp 0.5s ease both;
}

.article-body > * {
  opacity: 0;
  animation: fadeInUp 0.5s ease forwards;
}

.article-body > *:nth-child(1)  { animation-delay: 0.1s; }
.article-body > *:nth-child(2)  { animation-delay: 0.15s; }
.article-body > *:nth-child(3)  { animation-delay: 0.2s; }
.article-body > *:nth-child(4)  { animation-delay: 0.25s; }
.article-body > *:nth-child(5)  { animation-delay: 0.3s; }
.article-body > *:nth-child(n+6){ animation-delay: 0.35s; }

/* ── Scrollbar ── */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: var(--sidebar-bg); }
.sidebar::-webkit-scrollbar-thumb { background: #1a3058; border-radius: 4px; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 6px 0 32px rgba(0,0,0,0.5);
  }
  .mobile-header { display: flex; }
  .main {
    margin-left: 0;
    padding: 5rem 1.5rem 5rem;
  }
  .article-title { font-size: 2.1rem; }
}

@media (max-width: 480px) {
  .main { padding: 5rem 1rem 4rem; }
  .article-body { font-size: 17px; }
  .article-title { font-size: 1.6rem; }
  .mobile-menu-btn { padding: 10px; }
}
