/* ============================================================
   VietAlpha Editorial Theme
   Modeled on Anthropic's news/blog aesthetic.
   Drop into any VietAlpha blog post or research report.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz,wght@8..60,400;8..60,600;8..60,700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Surfaces */
  --paper-cream: #F0EEE6;
  --manilla: #FAF9F5;
  --manilla-deep: #F2F0E9;
  --pure-white: #FFFFFF;
  --footer-black: #141414;

  /* Text */
  --ink: #191919;
  --graphite: #3D3D3A;
  --stone: #6B6862;
  --bone: #D9D5CC;

  /* Accents */
  --crail: #CC785C;
  --sage: #B8C9BB;
  --slate-blue: #3B5BBE;
  --olive: #5C8A7B;
  --wheat: #E5B656;
  --wax: #D4CFC2;

  /* Type families */
  --serif: 'Source Serif 4', 'Source Serif Pro', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'Menlo', 'Monaco', 'Courier New', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper-cream);
  color: var(--ink);
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ----------------- LAYOUT ----------------- */

.page {
  background: var(--paper-cream);
  min-height: 100vh;
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 48px;
  font-family: var(--sans);
  font-size: 14px;
}

.nav-logo {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 28px;
  align-items: center;
}

.nav-links a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 400;
}

.nav-cta {
  background: var(--ink);
  color: var(--manilla);
  padding: 8px 16px;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 500;
}

.container {
  max-width: 700px;
  margin: 0 auto;
  padding: 24px 24px 96px;
}

.container-wide {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px;
}

/* ----------------- TYPOGRAPHY ----------------- */

.eyebrow {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0.01em;
  text-align: center;
  margin: 32px 0 24px;
}

.eyebrow span + span::before {
  content: "·";
  margin: 0 8px;
  color: var(--bone);
}

h1, .h1 {
  font-family: var(--serif);
  font-size: 56px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 24px;
  text-align: center;
}

h2, .h2 {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.005em;
  color: var(--ink);
  margin: 64px 0 16px;
}

h3, .h3 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  margin: 40px 0 12px;
}

.dateline {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--graphite);
  text-align: center;
  margin: 0 0 40px;
}

p {
  margin: 0 0 20px;
  color: var(--ink);
}

.lede {
  font-size: 19px;
  line-height: 1.55;
  color: var(--ink);
}

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--bone);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-thickness 0.15s ease;
}

a:hover {
  text-decoration-thickness: 2px;
  text-decoration-color: var(--ink);
}

ul, ol {
  margin: 0 0 24px;
  padding-left: 24px;
}

li {
  margin: 0 0 12px;
  line-height: 1.6;
}

li em, li strong {
  color: var(--ink);
}

em {
  font-style: italic;
}

strong {
  font-weight: 600;
}

/* ----------------- HERO ----------------- */

.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 32px auto 32px;
  max-width: 700px;
  height: 320px;
}

.hero-coral {
  background: var(--crail);
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-mint {
  background: var(--sage);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.hero-mint-grid {
  width: 60%;
  height: 60%;
  background-image:
    linear-gradient(var(--manilla) 1px, transparent 1px),
    linear-gradient(90deg, var(--manilla) 1px, transparent 1px);
  background-size: 12px 12px;
  background-color: var(--manilla);
  border: 1px solid var(--manilla);
}

/* ----------------- TABLES ----------------- */

.benchmark-table {
  width: 100%;
  background: var(--manilla);
  border-collapse: collapse;
  margin: 32px 0;
  font-family: var(--serif);
  position: relative;
}

.benchmark-table thead th {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--stone);
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--bone);
  text-transform: none;
}

.benchmark-table thead th.highlight-col {
  color: var(--ink);
  border-left: 2px solid var(--crail);
  border-right: 2px solid var(--crail);
  border-top: 2px solid var(--crail);
  font-weight: 600;
}

.benchmark-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--bone);
  font-size: 16px;
  color: var(--ink);
}

.benchmark-table tbody td.highlight-col {
  border-left: 2px solid var(--crail);
  border-right: 2px solid var(--crail);
  background: var(--manilla);
}

.benchmark-table tbody tr:last-child td.highlight-col {
  border-bottom: 2px solid var(--crail);
}

.benchmark-table .label-cell {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}

.benchmark-table .label-cell .sub {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--stone);
  margin-top: 2px;
}

.benchmark-table .data-cell .annotation {
  display: block;
  font-family: var(--sans);
  font-size: 11px;
  color: var(--stone);
  margin-top: 2px;
}

/* ----------------- CHARTS ----------------- */

.chart-container {
  background: var(--manilla);
  padding: 32px 24px 24px;
  margin: 32px 0;
}

.chart-title {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
  margin: 0 0 4px;
}

.chart-subtitle {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--stone);
  text-align: center;
  margin: 0 0 24px;
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  height: 280px;
  border-bottom: 1px solid var(--bone);
  padding: 0 16px;
  position: relative;
}

.bar-chart::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(
    to top,
    transparent,
    transparent 24.9%,
    var(--bone) 25%,
    var(--bone) 25.1%,
    transparent 25.2%,
    transparent 49.9%,
    var(--bone) 50%,
    var(--bone) 50.1%,
    transparent 50.2%,
    transparent 74.9%,
    var(--bone) 75%,
    var(--bone) 75.1%,
    transparent 75.2%
  );
  pointer-events: none;
  opacity: 0.6;
}

.bar-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  z-index: 1;
}

.bar-value {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 8px;
}

.bar {
  width: 56px;
  border-radius: 0;
}

.bar.opus-47 { background: var(--crail); }
.bar.opus-46 { background: var(--slate-blue); }
.bar.gpt { background: var(--wax); }
.bar.gemini { background: var(--wax); }

.bar-label {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--stone);
  margin-top: 12px;
  text-align: center;
}

/* ----------------- QUOTES ----------------- */

.quote-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 40px 0;
}

.quote-box {
  background: var(--manilla);
  border: 1px solid var(--bone);
  padding: 32px;
}

.quote-logo {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 24px;
}

.quote-mark {
  font-family: var(--serif);
  font-size: 32px;
  color: var(--stone);
  line-height: 1;
  margin-bottom: 8px;
}

.quote-text {
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  margin: 0 0 24px;
}

.quote-attribution-name {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 2px;
}

.quote-attribution-title {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 400;
  color: var(--stone);
}

/* ----------------- CODE ----------------- */

code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--manilla-deep);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--ink);
}

pre {
  background: var(--manilla-deep);
  border: 1px solid var(--bone);
  padding: 16px 20px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.5;
  margin: 24px 0;
}

pre code {
  background: transparent;
  padding: 0;
  font-size: 14px;
}

/* ----------------- CALLOUTS ----------------- */

.callout {
  background: var(--manilla);
  border-left: 3px solid var(--crail);
  padding: 16px 20px;
  margin: 24px 0;
  font-size: 16px;
}

.callout-label {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--crail);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

/* ----------------- FIGURE / CAPTION ----------------- */

figure {
  margin: 32px 0;
}

figcaption {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--stone);
  margin-top: 12px;
  line-height: 1.5;
}

/* ----------------- HORIZONTAL RULE ----------------- */

hr {
  border: 0;
  border-top: 1px solid var(--bone);
  margin: 48px 0;
}

/* ----------------- FOOTER ----------------- */

.footer {
  background: var(--footer-black);
  color: var(--manilla);
  padding: 64px 48px 32px;
  margin-top: 96px;
}

.footer-grid {
  display: grid;
  grid-template-columns: auto repeat(4, 1fr);
  gap: 48px;
  max-width: 1200px;
  margin: 0 auto;
}

.footer-logo {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 22px;
  color: var(--manilla);
}

.footer-section h4 {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--manilla);
  margin: 0 0 16px;
}

.footer-section a {
  display: block;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--manilla);
  text-decoration: none;
  margin-bottom: 8px;
  opacity: 0.85;
}

.footer-section a:hover {
  opacity: 1;
  text-decoration: underline;
}

.footer-meta {
  margin-top: 48px;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--manilla);
  opacity: 0.6;
}

/* ----------------- RESPONSIVE ----------------- */

@media (max-width: 720px) {
  .nav { padding: 16px 24px; }
  .nav-links { gap: 16px; }
  h1, .h1 { font-size: 36px; }
  h2, .h2 { font-size: 24px; }
  .hero { grid-template-columns: 1fr; height: auto; }
  .hero-coral, .hero-mint { height: 180px; }
  .quote-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
  .container { padding: 16px 20px 64px; }
}

/* ----------------- MATH (KaTeX) ----------------- */
/* Loaded per-article via the opt-in block at the bottom of article HTML.
   See research/_article-template.html and research/README.md → "Adding math". */

.katex {
  color: var(--ink);
}

.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  margin: 28px 0;
  padding: 4px 0;
}

/* Defensive: KaTeX auto-render ignores <pre> and <code>, but guard against
   any future case where math markup ends up nested inside a code block. */
pre .katex,
code .katex {
  all: unset;
  font-family: inherit;
}

@media (max-width: 720px) {
  .katex-display {
    margin: 20px -8px;
    padding: 4px 8px;
  }
}
