/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  /* Brand Colors */
  --c-primary:        #0052FF;
  --c-primary-active: #003ECC;
  --c-primary-muted:  #A8B8CC;

  /* Ink / Text */
  --c-ink:        #0A0F1D;
  --c-body:       #4E5560;
  --c-muted:      #696F78;
  --c-muted-soft: #767C84;

  /* Surfaces */
  --c-canvas:         #FFFFFF;
  --c-surface-soft:   #F7F7F7;
  --c-surface-strong: #EEF0F3;
  --c-surface-dark:   #0A0F1D;
  --c-surface-dark-2: #16181C;

  /* On-dark text */
  --c-on-dark:      #FFFFFF;
  --c-on-dark-soft: #A8ACB3;

  /* Borders */
  --c-hairline:      #DEE1E6;
  --c-hairline-soft: #EEF0F3;

  /* Semantic */
  --c-up:   #05B169;
  --c-down: #CF202F;

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  /* Spacing */
  --sp-2:   4px;
  --sp-4:   8px;
  --sp-6:   12px;
  --sp-8:   16px;
  --sp-10:  20px;
  --sp-12:  24px;
  --sp-16:  32px;
  --sp-24:  48px;
  --sp-48:  96px;

  /* Border radius */
  --r-xs:   4px;
  --r-sm:   8px;
  --r-md:   12px;
  --r-lg:   16px;
  --r-xl:   24px;
  --r-pill: 100px;
  --r-full: 9999px;

  /* Elevation */
  --shadow-sm:  0 2px 8px rgba(0,0,0,0.06);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.12);

  /* Layout */
  --container:     1200px;
  --header-h:      64px;
  --sidebar-w:     300px;
  --content-w:     820px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  background: var(--c-surface-dark);
}

/* Match canvas background to header style — eliminates the gap above sticky header */
html:has(body.header-light) { background: var(--c-canvas); }

body {
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--c-body);
  background: var(--c-canvas);
  -webkit-font-smoothing: antialiased;
}

img, video, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { cursor: pointer; border: none; background: none; font: inherit; }

/* ── Global focus-visible ring (keyboard nav only) ───────────── */
:focus-visible {
  outline: 2px solid var(--c-primary);
  outline-offset: 2px;
}

/* ── Skip Link ─────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--sp-8);
  background: var(--c-primary);
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--r-md);
  z-index: 9999;
  transition: top 0.2s;
}
.skip-link:focus { top: var(--sp-4); }

/* ── Ad Slots ──────────────────────────────────────────────── */
.ops-ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
}
.ops-ad-slot--full {
  width: 100%;
  padding: var(--sp-8) 0;
  background: var(--c-surface-soft);
  border-top: 1px solid var(--c-hairline);
  border-bottom: 1px solid var(--c-hairline);
}
.ops-ad-slot ins,
.ops-ad-slot iframe { display: block; margin: 0 auto; }

/* ── Container ─────────────────────────────────────────────── */
.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--sp-8);
}
.container-wide {
  width: 100%;
}

/* ── Typography Utilities ──────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font);
  color: var(--c-ink);
  line-height: 1.15;
  font-weight: 700;
}

/* Entry content (article body) */
.entry-content h2 { font-size: 1.6rem; margin: 2rem 0 0.75rem; }
.entry-content h3 { font-size: 1.3rem; margin: 1.75rem 0 0.6rem; }
.entry-content h4 { font-size: 1.1rem; margin: 1.5rem 0 0.5rem; }
.entry-content p  { margin-bottom: 1.25rem; color: var(--c-body); }
.entry-content a  { color: var(--c-primary); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.entry-content a:hover { color: var(--c-primary-active); }
.entry-content ul, .entry-content ol { padding-left: 1.5rem; margin-bottom: 1.25rem; list-style: revert; }
.entry-content li { margin-bottom: 0.4rem; }
.entry-content blockquote {
  border-left: 3px solid var(--c-primary);
  padding: var(--sp-6) var(--sp-8);
  margin: 1.5rem 0;
  background: var(--c-surface-soft);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-style: italic;
  color: var(--c-muted);
}
.entry-content pre, .entry-content code {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  background: var(--c-surface-strong);
  border-radius: var(--r-sm);
}
.entry-content code { padding: 2px 6px; }
.entry-content pre { padding: var(--sp-8); overflow-x: auto; margin-bottom: 1.25rem; }
.entry-content pre code { background: none; padding: 0; }
.entry-content table { width: 100%; border-collapse: collapse; margin-bottom: 1.25rem; }
.entry-content th, .entry-content td { padding: 10px 14px; border: 1px solid var(--c-hairline); text-align: left; }
.entry-content th { background: var(--c-surface-soft); font-weight: 600; }
.entry-content figure { margin: 1.5rem 0; }
.entry-content figcaption { font-size: 0.8125rem; color: var(--c-muted); text-align: center; margin-top: 6px; }
.entry-content img { border-radius: var(--r-md); width: 100%; }
.entry-content hr { border: none; border-top: 1px solid var(--c-hairline); margin: 2rem 0; }

/* ── Section header ────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--sp-12);
  padding-bottom: var(--sp-6);
  border-bottom: 1px solid var(--c-hairline);
}
.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--c-ink);
  letter-spacing: -0.3px;
}
.section-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--c-primary);
}
.section-link:hover { color: var(--c-primary-active); }

/* ── Screen reader only ────────────────────────────────────── */
.screen-reader-text {
  clip: rect(1px,1px,1px,1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  word-wrap: normal;
}

/* ── Skip link — override screen-reader-text clipping on focus ─ */
.skip-link:focus {
  clip: auto !important;
  clip-path: none !important;
  width: auto !important;
  height: auto !important;
  overflow: visible !important;
  white-space: normal !important;
  top: var(--sp-4);
}

/* ── Reduced motion ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .ops-ticker-track {
    animation: none;
    transform: none;
  }
}

/* ── Print styles ───────────────────────────────────────────── */
@media print {
  .site-header,
  .site-footer,
  .ops-share,
  #ops-btt,
  .sidebar-1,
  .single-sidebar,
  .archive-sidebar,
  #ops-toc,
  .comments-area,
  .related-posts,
  .ops-ticker-wrap,
  #ops-read-progress,
  .ops-infinite-feed .ops-article-wrap + .ops-article-wrap {
    display: none !important;
  }
  body { font-size: 12pt; color: #000; background: #fff; }
  a::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #555; }
  .entry-content { max-width: 100%; }
}
