@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,400;0,500;1,400&display=swap');

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

:root {
  --paper: #fdfbf7;
  --paper2: #f5f5f5;
  --ink: #1a1a1a;
  --ink-mid: #444444;
  --ink-light: #888888;
  --border: #d0cec8;
  --border-dark: #1a1a1a;
  --nav-h: 56px;
  --ticker-h: 32px;
  --font: 'JetBrains Mono', 'Courier New', Courier, monospace;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  background: var(--paper);
  color: var(--ink);
}

body.eink-body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  padding-bottom: calc(var(--nav-h) + 8px);
  overflow-x: hidden;
}

section[id] {
  scroll-margin-top: calc(var(--nav-h) + var(--ticker-h) + 8px);
}

/* Grain texture overlay */
.grain-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}

/* Top ticker */
.top-ticker {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  height: var(--ticker-h);
  background: var(--ink);
  color: var(--paper);
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-dark);
  overflow: hidden;
}
.ticker-text {
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Site header */
.site-header {
  margin-top: var(--ticker-h);
  border-bottom: 1px solid var(--border);
  background: var(--paper);
  padding: 20px 24px 16px;
}
.header-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.brand-logo {
  text-decoration: none;
  color: var(--ink);
}
.brand-logo img {
  height: 36px;
  width: auto;
  display: block;
}
.brand-text {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.04em;
}
.site-tagline {
  font-size: 12px;
  color: var(--ink-mid);
  letter-spacing: 0.08em;
}

/* Hero */
.hero-section {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-bottom: 2px solid var(--ink);
  overflow: hidden;
  background: var(--paper);
}
.hero-bg-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(80px, 22vw, 220px);
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--paper2);
  user-select: none;
  pointer-events: none;
  white-space: nowrap;
  border: none;
  line-height: 1;
}
.hero-img-wrap {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 45%;
  overflow: hidden;
  opacity: 0.12;
}
.hero-img-wrap .hero-bg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(100%) contrast(1.2);
}
.hero-content {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 40px 24px;
  max-width: 700px;
}
.hero-h1 {
  font-size: clamp(24px, 5vw, 48px);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: 0.03em;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 16px;
}
.hero-sub {
  font-size: 15px;
  color: var(--ink-mid);
  line-height: 1.7;
  margin-bottom: 28px;
  letter-spacing: 0.02em;
}
.hero-cta {
  display: inline-block;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font);
  font-size: 14px;
  letter-spacing: 0.1em;
  padding: 12px 32px;
  text-decoration: none;
  border: 2px solid var(--ink);
  transition: none;
  min-height: 44px;
  line-height: 1.5;
}
.hero-cta:hover,
.hero-cta:focus {
  background: var(--paper);
  color: var(--ink);
  outline: 2px solid var(--ink);
}

/* Page layout */
.page-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px 60px;
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 48px;
  align-items: start;
}

/* Main content */
.main-content {
  min-width: 0;
}
.main-content article {
  /* direct child of main */
}
.main-content article section {
  /* direct child of article */
}
.content-body {
  font-size: 16px;
  line-height: 1.75;
}

/* Content body typography from page.content */
.content-body h2 {
  font-size: 20px;
  font-weight: 500;
  margin: 40px 0 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.04em;
}
.content-body h3 {
  font-size: 17px;
  font-weight: 500;
  margin: 28px 0 8px;
  letter-spacing: 0.02em;
}
.content-body p {
  margin-bottom: 16px;
}
.content-body ul,
.content-body ol {
  padding-left: 20px;
  margin-bottom: 16px;
}
.content-body li {
  margin-bottom: 8px;
}
.content-body a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.content-body a:hover {
  text-decoration: none;
}
.content-body blockquote {
  border-left: 3px solid var(--ink);
  padding-left: 16px;
  color: var(--ink-mid);
  margin: 20px 0;
  font-style: italic;
}
.content-body strong {
  font-weight: 500;
}
.content-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  font-size: 14px;
}
.content-body th,
.content-body td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
}
.content-body th {
  background: var(--paper2);
  font-weight: 500;
}
.content-body section {
  padding-top: 8px;
  margin-bottom: 48px;
  border-bottom: 1px solid var(--border);
}
.content-body section:last-child {
  border-bottom: none;
}

/* Sidebar */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 32px;
  position: sticky;
  top: calc(var(--ticker-h) + 16px);
}
.sidebar-block {
  border: 1px solid var(--border);
  background: var(--paper2);
  padding: 16px;
}
.eyebrow {
  display: block;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-light);
  margin-bottom: 8px;
}
.sidebar-title {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 12px;
  letter-spacing: 0.04em;
}
.sidebar-nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: none;
}
.sidebar-nav-list li {
  border-bottom: 1px solid var(--border);
}
.sidebar-nav-list li:last-child {
  border-bottom: none;
}
.sidebar-nav-list a {
  display: block;
  padding: 8px 4px;
  font-size: 12px;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.04em;
  line-height: 1.4;
  min-height: 40px;
  display: flex;
  align-items: center;
}
.sidebar-nav-list a:hover {
  text-decoration: underline;
}
.kw-text {
  font-size: 13px;
  color: var(--ink-mid);
  letter-spacing: 0.06em;
  word-break: break-all;
}

/* Stagger list animation */
.stagger-list > * {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.stagger-list.revealed > * {
  opacity: 1;
  transform: none;
}
.stagger-list.revealed > *:nth-child(1) { transition-delay: 0s; }
.stagger-list.revealed > *:nth-child(2) { transition-delay: 0.06s; }
.stagger-list.revealed > *:nth-child(3) { transition-delay: 0.12s; }
.stagger-list.revealed > *:nth-child(4) { transition-delay: 0.18s; }
.stagger-list.revealed > *:nth-child(5) { transition-delay: 0.24s; }
.stagger-list.revealed > *:nth-child(6) { transition-delay: 0.30s; }
.stagger-list.revealed > *:nth-child(7) { transition-delay: 0.36s; }
.stagger-list.revealed > *:nth-child(n+8) { transition-delay: 0.42s; }

@media (prefers-reduced-motion: reduce) {
  .stagger-list > * {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* Footer */
.site-footer {
  border-top: 2px solid var(--ink);
  background: var(--paper);
  padding: 40px 24px 24px;
}
.footer-cta-block {
  max-width: 960px;
  margin: 0 auto 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}
.footer-cta-text {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.06em;
}
.footer-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 28px;
  border: 2px solid var(--ink);
  color: var(--ink);
  font-family: var(--font);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-decoration: none;
  transition: none;
}
.footer-cta-btn:hover {
  background: var(--ink);
  color: var(--paper);
}
.footer-dl-row {
  max-width: 960px;
  margin: 0 auto 24px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.footer-dl-row dl {
  border: 1px solid var(--border);
  padding: 12px 16px;
  background: var(--paper2);
}
.footer-dl-row dt {
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-light);
  margin-bottom: 6px;
}
.footer-dl-row dd {
  font-size: 13px;
  color: var(--ink);
  word-break: break-all;
}
.footer-copy {
  max-width: 960px;
  margin: 0 auto;
  text-align: center;
  font-size: 12px;
  color: var(--ink-light);
  letter-spacing: 0.06em;
}

/* Bottom nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 300;
  background: var(--paper);
  border-top: 2px solid var(--ink);
  height: var(--nav-h);
  overflow: hidden;
}
.bottom-nav ol {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  align-items: stretch;
}
.bottom-nav ol::-webkit-scrollbar {
  display: none;
}
.bottom-nav li {
  flex: 0 0 auto;
  border-right: 1px solid var(--border);
}
.bottom-nav li:last-child {
  border-right: none;
}
.bottom-nav a {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 44px;
  padding: 8px 14px;
  font-family: var(--font);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  transition: none;
}
.bottom-nav a:hover,
.bottom-nav a:focus {
  background: var(--ink);
  color: var(--paper);
}

/* Scroll reveal blocks */
.scroll-reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.scroll-reveal.in-view {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  .scroll-reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .page-layout {
    grid-template-columns: 1fr;
    padding: 24px 16px 48px;
    gap: 32px;
  }
  .sidebar {
    position: static;
    order: -1;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 16px;
  }
  .sidebar-block {
    flex: 1 1 140px;
  }
  .hero-h1 {
    font-size: 26px;
  }
  .hero-bg-text {
    font-size: 72px;
  }
  .footer-dl-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .site-header {
    padding: 14px 16px 12px;
  }
  .hero-content {
    padding: 32px 16px;
  }
  .bottom-nav {
    height: var(--nav-h);
  }
}

@media (max-width: 375px) {
  body.eink-body {
    font-size: 16px;
  }
  .bottom-nav a {
    font-size: 10px;
    padding: 8px 10px;
  }
  .hero-bg-text {
    font-size: 56px;
  }
}

button[aria-expanded]{min-width:44px;min-height:44px}
