/* ===== RESET & BASE ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #141414;
  --bg-sidebar: #141414;
  --text: #d4d4d4;
  --text-muted: #777;
  --text-heading: #f0f0f0;
  --accent: #8ba87a;
  --accent-subtle: #8ba87a1a;
  --border: #2a2a2a;
  --sidebar-w: 260px;
  --content-max: 680px;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-heading: 'Instrument Serif', Georgia, 'Times New Roman', serif;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 2rem;
  overflow-x: hidden;
}

body {
  font-family: var(--font-body);
  font-size: 16.5px;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  overflow-y: auto;
  padding: 3rem 0 2rem 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  z-index: 100;
}

.sidebar-nav {
  list-style: none;
}

.sidebar-nav li {
  margin: 0;
}

.sidebar-nav a {
  display: block;
  padding: 5px 24px 5px 24px;
  font-size: 12.5px;
  line-height: 1.5;
  letter-spacing: 0.01em;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.sidebar-nav a:hover {
  color: var(--text);
}

.sidebar-nav a.active {
  color: var(--text);
  border-left-color: var(--accent);
  font-weight: 500;
}

.sidebar-byline {
  position: absolute;
  bottom: 2rem;
  left: 1.5rem;
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 14px;
  color: var(--text-muted);
}

.sidebar-byline a {
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.sidebar-byline a:hover {
  border-bottom-color: var(--text-muted);
}

/* Scrollbar for sidebar */
.sidebar::-webkit-scrollbar {
  width: 3px;
}
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* ===== MAIN CONTENT ===== */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 0 2rem 6rem 2rem;
}

.content {
  width: 100%;
  max-width: var(--content-max);
}

/* ===== HERO / HEADER ===== */
.hero {
  position: relative;
  width: calc(100vw - var(--sidebar-w));
  margin-left: -2rem;
  height: 460px;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  margin-bottom: 3rem;
  overflow: visible;
  cursor: none;
}

#hero-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.hero-text {
  position: relative;
  z-index: 2;
  max-width: var(--content-max);
  width: 100%;
  padding: 0 0 2.5rem 2rem;
  padding-top: 6rem;
  margin-left: 0;
}

/* Subtle gradient fade at bottom of hero */
.hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(to bottom, transparent, var(--bg));
  z-index: 1;
  pointer-events: none;
}

/* ===== HEADER / BYLINE ===== */
.essay-title {
  font-family: var(--font-heading);
  font-size: 52px;
  font-weight: 400;
  line-height: 1.15;
  color: var(--text-heading);
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

.byline {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 20px;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.byline a {
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.byline a:hover {
  border-bottom-color: var(--text-muted);
}

.publish-date {
  font-family: var(--font-body);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.25);
  margin-top: 0.4rem;
  letter-spacing: 0.02em;
}

/* ===== TYPOGRAPHY ===== */
h2 {
  font-family: var(--font-heading);
  font-size: 34px;
  font-weight: 400;
  color: var(--text-heading);
  margin-top: 4rem;
  margin-bottom: 1.25rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h3 {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 400;
  color: var(--text-heading);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  line-height: 1.3;
}

p {
  margin-bottom: 1.35rem;
}

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

/* dfn — no special styling */
dfn {
  font-style: inherit;
  font-weight: inherit;
  color: inherit;
  text-decoration: inherit;
}

/* ===== LISTS (+ marker) — content area only ===== */
.content ul {
  list-style: none;
  margin-bottom: 1.35rem;
  padding-left: 0;
}

.content ul > li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.6rem;
}

.content ul > li::before {
  content: '+';
  position: absolute;
  left: 0;
  color: var(--text-muted);
  font-weight: 400;
}

ol {
  padding-left: 1.5rem;
  margin-bottom: 1.35rem;
}

ol > li {
  margin-bottom: 0.6rem;
  padding-left: 0.25rem;
}

/* ===== END NOTES ===== */
.note-divider {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin: 2.5rem 0;
  max-width: var(--content-max);
}

.end-note {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.7;
}

.end-note p {
  color: var(--text-muted);
}

/* ===== VISUAL MARKERS ===== */
.visual-note {
  font-style: italic;
  color: var(--text-muted);
  margin-bottom: 1.35rem;
}

.essay-image {
  max-width: 100%;
  width: 100%;
  border-radius: 6px;
  margin: 1.5rem 0;
  display: block;
}

/* ===== TABLE ===== */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.75rem;
  font-size: 15px;
}

thead th {
  text-align: left;
  font-weight: 500;
  color: var(--text-heading);
  padding: 10px 16px 10px 0;
  border-bottom: 1.5px solid var(--text);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

tbody td {
  padding: 9px 16px 9px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* ===== BLOCKQUOTE ===== */
blockquote {
  border-left: 2px solid var(--border);
  padding-left: 1.25rem;
  margin: 1.75rem 0;
  color: var(--text-muted);
  font-style: italic;
}

/* ===== SECTION SPACING ===== */
section {
  margin-bottom: 1rem;
}

/* ===== HAMBURGER (mobile) ===== */
.hamburger {
  display: none;
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 200;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0;
  width: 40px;
  height: 40px;
  padding: 0;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.hamburger-line {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--text);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 90;
}

.sidebar-overlay.active {
  display: block;
}

/* ===== SELECTION ===== */
::selection {
  background: var(--accent-subtle);
  color: var(--text);
}

/* ===== MOBILE ===== */
@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    background: var(--bg);
    padding-top: 4.5rem;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
    padding: 0 1.25rem 4rem 1.25rem;
  }

  .hero {
    width: 100vw;
    margin-left: -1.25rem;
    height: 380px;
  }

  .hero-text {
    padding: 0 1.25rem 2rem 1.25rem;
  }

  .essay-title {
    font-size: 36px;
  }

  h2 {
    font-size: 28px;
    margin-top: 3rem;
  }

  table {
    font-size: 14px;
  }

  thead th, tbody td {
    padding: 7px 10px 7px 0;
  }
}

/* ===== SMALL MOBILE ===== */
@media (max-width: 420px) {
  .essay-title {
    font-size: 30px;
  }

  .hero {
    height: 340px;
  }
}
