/* ── Tokens ─────────────────────────────────────────────────────────────────── */
:root {
  --bg:      oklch(0.985 0.003 90);
  --bg-2:    oklch(0.965 0.004 90);
  --bg-3:    oklch(0.94  0.005 90);
  --fg:      oklch(0.18  0.008 250);
  --fg-2:    oklch(0.35  0.008 250);
  --fg-3:    oklch(0.55  0.008 250);
  --line:    oklch(0.92  0.004 250);
  --line-2:  oklch(0.86  0.005 250);
  --accent:  #6633ff;
  --accent-fg: #ffffff;
  --ok:      oklch(0.62 0.13 160);
  --font-display: 'Newsreader', Georgia, serif;
  --font-body:    'Inter', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, monospace;
  --radius: 4px;
  --u: 9px;
}

[data-theme="dark"] {
  --bg:     oklch(0.14 0.008 250);
  --bg-2:   oklch(0.18 0.009 250);
  --bg-3:   oklch(0.22 0.01  250);
  --fg:     oklch(0.98 0.003 90);
  --fg-2:   oklch(0.82 0.006 90);
  --fg-3:   oklch(0.62 0.008 90);
  --line:   oklch(0.24 0.008 250);
  --line-2: oklch(0.32 0.01  250);
}

/* ── Base reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--fg);
  font-size: 15.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img { display: block; max-width: 100%; }

.container { max-width: 1440px; margin: 0 auto; padding: 0 calc(var(--u) * 4); }
.label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-3);
}

/* ── Nav ────────────────────────────────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  background: color-mix(in oklch, var(--bg) 80%, transparent);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  height: 72px;
  gap: calc(var(--u) * 6);
}
.logo {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 600; font-size: 17px; letter-spacing: -0.02em;
}
.logo-img { height: 70px; width: auto; flex-shrink: 0; max-width: none; }
.logo-white { display: none; }
[data-theme="dark"] .logo-white { display: block; }
[data-theme="dark"] .logo-color { display: none; }
.nav-links {
  display: flex; gap: calc(var(--u) * 4);
  font-size: 13.5px; color: var(--fg-2);
}
.nav-links a { transition: color 0.2s; }
.nav-links a:hover { color: var(--fg); }
.nav-links a.is-active { color: var(--fg); font-weight: 500; }
.nav-right { display: flex; align-items: center; gap: calc(var(--u) * 2); }
.nav-hamburger {
  display: none; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--fg);
}
.nav-mobile-menu {
  border-top: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: calc(var(--u) * 2) calc(var(--u) * 4);
  gap: 4px;
  position: relative; z-index: 40;
  background: var(--bg);
}
.nav-mobile-menu a {
  display: block;
  padding: calc(var(--u) * 1.5) 0;
  font-size: 15px; color: var(--fg-2);
  border-bottom: 1px solid var(--line);
}
.nav-mobile-menu a:last-child { border-bottom: 0; }
.nav-mobile-menu a.is-active { color: var(--fg); font-weight: 500; }
.nav-mobile-theme {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--u) * 2) 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px; color: var(--fg-3);
}
.mobile-theme-seg {
  display: flex; border: 1px solid var(--line); border-radius: var(--radius);
}
.mobile-theme-seg button {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px; font-size: 12px; color: var(--fg-3);
  border-right: 1px solid var(--line);
}
.mobile-theme-seg button:last-child { border-right: 0; }
.mobile-theme-seg button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }

/* ── Theme toggle ───────────────────────────────────────────────────────────── */
.theme-toggle {
  display: inline-flex; align-items: center; gap: 2px;
  border: 1px solid var(--line); border-radius: 999px; padding: 2px;
}
.theme-toggle button {
  width: 26px; height: 22px; border-radius: 999px;
  display: grid; place-items: center;
  color: var(--fg-3); font-size: 12px;
  transition: background 0.15s, color 0.15s;
}
.theme-toggle button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }

/* ── Blog layout ────────────────────────────────────────────────────────────── */
.blog-main {
  padding: calc(var(--u) * 6) calc(var(--u) * 4) calc(var(--u) * 12);
}

.blog-header {
  max-width: 720px;
  margin-bottom: calc(var(--u) * 4);
  padding-bottom: calc(var(--u) * 3);
  border-bottom: 1px solid var(--line);
}
.section-index {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}
.blog-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(32px, 4vw, 52px);
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin: 0 0 16px;
  font-variation-settings: "opsz" 60;
}
.blog-sub {
  font-size: 17px;
  color: var(--fg-2);
  margin: 0;
  line-height: 1.6;
  max-width: 56ch;
}

/* ── Post grid (list view) ──────────────────────────────────────────────────── */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: calc(var(--u) * 3);
}
.post-card {
  display: flex; flex-direction: column;
  padding: calc(var(--u) * 4);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-2);
  transition: border-color 0.2s, background 0.2s, transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
.post-card:hover {
  border-color: var(--line-2);
  background: var(--bg-3);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px color-mix(in oklch, var(--fg) 6%, transparent);
}
.post-card-meta {
  display: flex; gap: 12px; align-items: center;
  margin-bottom: 12px;
}
.post-card-category {
  font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent); font-weight: 500;
}
.post-card-date {
  font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: 0.04em; color: var(--fg-3);
}
.post-card-title {
  font-family: var(--font-display);
  font-weight: 600; font-size: 22px;
  letter-spacing: -0.02em; line-height: 1.2;
  margin: 0 0 10px;
  font-variation-settings: "opsz" 60;
}
.post-card-excerpt {
  color: var(--fg-2); font-size: 14.5px; line-height: 1.6;
  margin: 0 0 auto; flex: 1;
  padding-bottom: calc(var(--u) * 3);
}
.post-card-read {
  font-size: 13.5px; font-weight: 500; color: var(--fg-2);
  margin-top: calc(var(--u) * 2);
  display: inline-flex; align-items: center; gap: 4px;
  transition: color 0.2s;
}
.post-card:hover .post-card-read { color: var(--fg); }
.post-card-read .arrow { transition: transform 0.2s; }
.post-card:hover .post-card-read .arrow { transform: translateX(3px); }

/* ── Post detail ────────────────────────────────────────────────────────────── */
.post-back { margin-bottom: calc(var(--u) * 5); }
.post-back-link {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 14px; color: var(--fg-2);
  transition: color 0.2s;
}
.post-back-link:hover { color: var(--fg); }

.post-article { max-width: 100%; }

.post-header {
  margin-bottom: calc(var(--u) * 7);
  padding-bottom: calc(var(--u) * 6);
  border-bottom: 1px solid var(--line);
}
.post-header-meta {
  display: flex; gap: 12px; align-items: center;
  margin-bottom: 16px;
}
.post-title {
  font-family: var(--font-display);
  font-weight: 700; font-size: clamp(30px, 4vw, 48px);
  letter-spacing: -0.025em; line-height: 1.08;
  margin: 0 0 14px;
  font-variation-settings: "opsz" 72;
}
.post-subtitle {
  font-size: 18px; color: var(--fg-2);
  line-height: 1.5; margin: 0;
  font-style: italic;
}

/* ── Post body typography ───────────────────────────────────────────────────── */
.post-body { display: flex; flex-direction: column; gap: 0; }

.post-p {
  font-size: 17px;
  line-height: 1.75;
  color: var(--fg-2);
  margin: 0 0 calc(var(--u) * 2.5);
}
.post-inline-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: opacity 0.2s;
}
.post-inline-link:hover { opacity: 0.75; }
.post-h2 {
  font-family: var(--font-display);
  font-weight: 600; font-size: clamp(22px, 2.5vw, 30px);
  letter-spacing: -0.02em; line-height: 1.15;
  margin: calc(var(--u) * 6) 0 calc(var(--u) * 2);
  font-variation-settings: "opsz" 60;
  padding-top: calc(var(--u) * 2);
  border-top: 1px solid var(--line);
}
.post-h3 {
  font-family: var(--font-display);
  font-weight: 600; font-size: 19px;
  letter-spacing: -0.015em; line-height: 1.2;
  margin: calc(var(--u) * 4) 0 calc(var(--u) * 1.5);
  color: var(--fg);
}
.post-list {
  list-style: none; padding: 0; margin: 0 0 calc(var(--u) * 2.5);
  display: flex; flex-direction: column; gap: 10px;
}
.post-list li {
  display: grid; grid-template-columns: 16px 1fr;
  gap: 12px; align-items: baseline;
  font-size: 16.5px; line-height: 1.65; color: var(--fg-2);
}
.post-list li::before {
  content: "—";
  font-family: var(--font-mono); color: var(--accent); font-size: 13px;
}

/* ── Video embed ────────────────────────────────────────────────────────────── */
.post-video-wrap {
  position: relative;
  width: 100%; padding-bottom: 56.25%;
  height: 0; overflow: hidden;
  border-radius: 10px;
  margin: calc(var(--u) * 4) 0;
  border: 1px solid var(--line);
  background: var(--bg-2);
}
.post-video-wrap iframe {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  border: 0; border-radius: 10px;
}

/* ── Figure (in-article image) ──────────────────────────────────────────────── */
.post-figure {
  display: flex; flex-direction: column; gap: calc(var(--u) * 1.5);
  margin: calc(var(--u) * 4) 0;
}
.post-figure img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  /* Diagrams are drawn on a light background, so keep one under them rather
     than letting a transparent PNG go invisible on the dark theme. */
  background: #fff;
}
[data-theme="dark"] .post-figure img { border-color: var(--line-2); }
.post-figure figcaption {
  font-size: 13.5px; color: var(--fg-3); line-height: 1.55;
}

/* ── Link card ──────────────────────────────────────────────────────────────── */
.post-link-card {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--u) * 3) calc(var(--u) * 4);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-2);
  margin: calc(var(--u) * 3) 0;
  transition: border-color 0.2s, background 0.2s;
  gap: 16px;
}
.post-link-card:hover {
  border-color: var(--accent);
  background: var(--bg-3);
}
.post-link-card-inner { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.post-link-card-label {
  font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent);
}
.post-link-card-title {
  font-family: var(--font-display);
  font-weight: 600; font-size: 18px;
  letter-spacing: -0.01em; color: var(--fg);
}
.post-link-card-desc {
  font-size: 13.5px; color: var(--fg-2); line-height: 1.5;
}
.post-link-card-url {
  font-family: var(--font-mono); font-size: 11px; color: var(--fg-3);
}
.post-link-card-arrow {
  font-size: 22px; color: var(--fg-3); flex-shrink: 0;
  transition: color 0.2s, transform 0.2s;
}
.post-link-card:hover .post-link-card-arrow {
  color: var(--accent); transform: translate(2px, -2px);
}
.post-contact-card {
  width: 100%;
  text-align: left;
  border-left: 3px solid var(--accent);
  font: inherit;
  cursor: pointer;
}

/* ── Gated download card (subscribe, then download) ─────────────────────────── */
.post-gate-card {
  display: flex; align-items: center; justify-content: space-between;
  gap: calc(var(--u) * 4);
  padding: calc(var(--u) * 4) calc(var(--u) * 4.5);
  /* No top margin: the card belongs to the paragraph that introduces it, so it
     sits directly underneath. .post-body is a flex column, so margins here add
     up rather than collapsing. */
  margin: 0 0 calc(var(--u) * 3);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 5%, var(--bg-2));
}
/* …and the paragraph pulls in towards it. */
.post-p:has(+ .post-gate-card) { margin-bottom: calc(var(--u) * 2); }
.post-gate-main { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.post-gate-meta {
  display: flex; align-items: center; gap: 6px; margin-top: 2px;
  font-family: var(--font-mono); font-size: 11px; color: var(--fg-3);
}
.post-gate-action {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 7px; flex-shrink: 0;
}
.post-gate-note { font-size: 11.5px; color: var(--fg-3); }
.post-gate-error { font-size: 12px; color: #c62828; max-width: 24ch; text-align: right; }
[data-theme="dark"] .post-gate-error { color: #ff8a80; }

/* ── Subscribe & Download popup ─────────────────────────────────────────────── */
.gate-modal-card { max-width: 500px; }
.gate-modal-consent { margin-top: -2px; }
/* The real checkbox is visually hidden, so show focus on the drawn box —
   the form moves focus here when the consent box is what's missing. */
.footer-newsletter-consent:has(.consent-checkbox-input:focus) .consent-checkbox-box {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.gate-modal-consent.is-invalid .consent-checkbox-box { border-color: #c62828; }
[data-theme="dark"] .gate-modal-consent.is-invalid .consent-checkbox-box { border-color: #ff8a80; }
.gate-modal-error {
  display: flex; align-items: flex-start; gap: 7px;
  padding: 9px 11px; border-radius: 8px;
  font-size: 13px; line-height: 1.45;
  color: #c62828;
  background: color-mix(in srgb, #c62828 8%, transparent);
  border: 1px solid color-mix(in srgb, #c62828 24%, transparent);
}
.gate-modal-error svg { flex-shrink: 0; margin-top: 2px; }
[data-theme="dark"] .gate-modal-error {
  color: #ff8a80;
  background: color-mix(in srgb, #ff8a80 10%, transparent);
  border-color: color-mix(in srgb, #ff8a80 26%, transparent);
}
.gate-modal-card .contact-field input[aria-invalid="true"] { border-color: #c62828; }
[data-theme="dark"] .gate-modal-card .contact-field input[aria-invalid="true"] { border-color: #ff8a80; }

/* ── Post footer CTA ────────────────────────────────────────────────────────── */
/* ── Table ──────────────────────────────────────────────────────────────────── */
.post-table-wrap {
  margin: calc(var(--u) * 4) 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-2);
  -webkit-overflow-scrolling: touch;
}
.post-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  min-width: 560px;
}
.post-table th,
.post-table td {
  text-align: left;
  padding: calc(var(--u) * 1.5) calc(var(--u) * 2.5);
  border-bottom: 1px solid var(--line);
  line-height: 1.5;
  vertical-align: top;
}
.post-table thead th {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
  background: var(--bg-3);
}
.post-table tbody td:first-child {
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
}
.post-table tbody td { color: var(--fg-2); }
.post-table tbody tr:last-child td { border-bottom: 0; }

.post-footer-cta {
  margin-top: calc(var(--u) * 8);
  padding: calc(var(--u) * 4) calc(var(--u) * 5);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: var(--bg-2);
  font-size: 16px; color: var(--fg-2); line-height: 1.65;
}
.post-footer-cta p { margin: 0; }
.post-footer-cta a, .footer-cta-link { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.post-footer-cta a:hover, .footer-cta-link:hover { opacity: 0.8; }

/* ── Loading / error ────────────────────────────────────────────────────────── */
.blog-message {
  font-size: 15px; color: var(--fg-3);
  padding: calc(var(--u) * 6) 0;
}

/* ── Footer ─────────────────────────────────────────────────────────────────── */
.blog-footer {
  margin-top: calc(var(--u) * 12);
  border-top: 1px solid var(--line);
  padding: calc(var(--u) * 6) 0 calc(var(--u) * 4);
  background: var(--bg-2);
}
.footer-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: calc(var(--u) * 5);
  border-bottom: 1px solid var(--line);
}
.footer-links { display: flex; gap: calc(var(--u) * 5); flex-wrap: wrap; }
.footer-links a { color: var(--fg-2); font-size: 14px; transition: color 0.2s; }
.footer-links a:hover { color: var(--fg); }
.footer-newsletter {
  display: flex; align-items: center; justify-content: space-between;
  gap: calc(var(--u) * 4);
  padding: calc(var(--u) * 5) 0;
  border-bottom: 1px solid var(--line);
}
.footer-newsletter-copy { display: flex; flex-direction: column; gap: 4px; }
.footer-newsletter-label { font-size: 14px; font-weight: 600; color: var(--fg); }
.footer-newsletter-sub { font-size: 13px; color: var(--fg-3); max-width: 340px; line-height: 1.5; }
.footer-newsletter-right { display: flex; flex-direction: column; gap: calc(var(--u) * 1.5); align-items: flex-end; }
.footer-newsletter-form { display: flex; gap: 8px; align-items: stretch; }
.footer-newsletter-form input {
  padding: 9px 14px; font-size: 14px; font-family: inherit;
  border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--fg); outline: none; width: 440px;
  transition: border-color 0.2s;
}
[data-theme="dark"] .footer-newsletter-form input { background: #222426; }
.footer-newsletter-form input:focus { border-color: var(--accent); }
.footer-newsletter-form .btn { align-self: stretch; }
.footer-newsletter-success { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--fg-2); }
.footer-newsletter-consent {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--fg-3); cursor: pointer; user-select: none;
}
.consent-checkbox-input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.consent-checkbox-box {
  width: 16px; height: 16px; flex-shrink: 0; border-radius: 4px;
  border: 1.5px solid var(--line); background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, border-color 0.15s; color: #fff;
}
[data-theme="dark"] .consent-checkbox-box { background: #222426; }
.footer-newsletter-consent:has(.consent-checkbox-input:checked) .consent-checkbox-box { background: var(--accent); border-color: var(--accent); }
.footer-newsletter-consent:hover .consent-checkbox-box { border-color: var(--accent); }
.footer-privacy-link {
  background: none; border: none; padding: 0;
  font-size: inherit; font-family: inherit; color: inherit;
  cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.footer-privacy-link:hover { color: var(--fg); }
.footer-bottom {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: calc(var(--u) * 3);
  font-size: 12px; color: var(--fg-3);
}
.footer-social { display: flex; align-items: center; gap: calc(var(--u) * 2); }
.footer-social a { color: var(--fg-3); display: flex; align-items: center; transition: color 0.2s; }
.footer-social a:hover { color: #6633ff; }
/* logo in footer */
.blog-footer .logo-img { height: 140px; }

/* Privacy modal */
.privacy-modal-card { max-width: 560px; }
.privacy-modal-card .modal-title { color: var(--fg); }
.privacy-modal-date { font-size: 12px; color: var(--fg-3); margin: 0 0 4px; }
.privacy-modal-body {
  margin-top: calc(var(--u) * 2); max-height: 50vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
  font-size: 14px; color: var(--fg); line-height: 1.65; padding-right: 4px;
}
.privacy-modal-body p { margin: 0 0 8px; }
.privacy-modal-body h4 { font-size: 13px; font-weight: 600; margin: 10px 0 0; }
.privacy-modal-body::-webkit-scrollbar { width: 5px; }
.privacy-modal-body::-webkit-scrollbar-thumb { background: var(--fg-3); border-radius: 10px; }
/* Modal (needed for privacy popup) */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: color-mix(in oklch, var(--fg) 40%, transparent);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal-card {
  position: relative; background: var(--bg); border: 1px solid var(--line);
  border-radius: 12px; width: 100%; max-width: 480px; padding: 40px;
  box-shadow: 0 24px 80px color-mix(in oklch, var(--fg) 20%, transparent);
}
.modal-close {
  position: absolute; top: 16px; right: 16px;
  width: 32px; height: 32px; display: grid; place-items: center;
  border-radius: 6px; color: var(--fg-3); transition: background 0.15s, color 0.15s;
}
.modal-close:hover { background: var(--bg-2); color: var(--fg); }
.modal-title {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(22px, 3vw, 28px); line-height: 1.1;
  letter-spacing: -0.02em; margin: 0 0 10px;
}

/* Responsive footer */
@media (max-width: 768px) {
  .footer-nav { flex-direction: column; align-items: flex-start; gap: calc(var(--u) * 3); }
  .footer-links { flex-wrap: wrap; gap: calc(var(--u) * 1.5) calc(var(--u) * 3); }
  .footer-newsletter { flex-direction: column; align-items: flex-start; gap: calc(var(--u) * 3); }
  .footer-newsletter-right { align-items: flex-start; width: 100%; }
  .footer-newsletter-form { width: 100%; }
  .footer-newsletter-form input { flex: 1; width: auto; min-width: 0; }
}

/* ── Contact modal ──────────────────────────────────────────────────────────── */
.modal-card--form { max-width: 580px; }
.modal-card--form .contact-form { margin-top: 8px; }
.modal-eyebrow {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 8px;
}
.modal-sub {
  font-size: 15px; color: var(--fg-2); line-height: 1.55; margin: 4px 0 0;
}
.contact-form { display: flex; flex-direction: column; gap: calc(var(--u) * 2.5); }
.contact-row { display: grid; grid-template-columns: 1fr 1fr; gap: calc(var(--u) * 2); }
.contact-field { display: flex; flex-direction: column; gap: 6px; }
.contact-field label { font-size: 13px; font-weight: 500; color: var(--fg); }
.contact-optional { font-weight: 400; color: var(--fg-3); }
.contact-field input,
.contact-field textarea {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 14px; font-size: 14px; color: var(--fg); font-family: inherit;
  outline: none; transition: border-color 0.2s; resize: vertical;
  width: 100%; box-sizing: border-box;
}
[data-theme="dark"] .contact-field input,
[data-theme="dark"] .contact-field textarea { background: #222426; }
.contact-field input:focus,
.contact-field textarea:focus { border-color: var(--accent); }
.contact-field input::placeholder,
.contact-field textarea::placeholder { color: var(--fg-3); }
.contact-success {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 16px;
  padding: calc(var(--u) * 8) 0; text-align: center; color: var(--accent);
}
.contact-success p { color: var(--fg-2); font-size: 15px; line-height: 1.6; margin: 0; max-width: 28ch; }

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-body); font-size: 13.5px; font-weight: 500;
  border-radius: var(--radius); border: 0; cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease, transform .1s ease;
  text-decoration: none; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn .arrow { display: inline-block; font-size: 1.25em; line-height: 1; transition: transform .2s ease; }
.btn:hover .arrow { transform: translateX(2px); }
.btn-hero-primary {
  background: #6633ff; color: #fff;
  border: 1.5px solid #6633ff; border-radius: 6px;
  padding: 0 20px; height: 44px; font-size: 14px;
  font-weight: 600; letter-spacing: -0.01em;
  transition: background .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.btn-hero-primary:hover {
  background: #7744ff; border-color: #8855ff;
  box-shadow: 0 0 8px 1px rgba(102,51,255,0.35), 0 0 20px 4px rgba(102,51,255,0.12);
}
.btn-sm { height: 30px; padding: 0 12px; font-size: 12.5px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 14px; }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .container { padding: 0 calc(var(--u) * 6); }
}
@media (min-width: 1281px) and (max-width: 1366px) {
  .container { padding: 0 calc(var(--u) * 16); }
}
/* Nav: switch to the hamburger at 1280px, matching the main site. Eight links
   plus the theme toggle and the CTA stop fitting well before this, and the
   bar was overflowing the viewport from ~1100px down. */
@media (max-width: 1280px) {
  .nav-links { display: none; }
  .nav-hamburger { display: flex; }
  .nav-right .theme-toggle { display: none; }
  /* Flex, not the desktop grid: with .nav-links hidden the grid's middle
     column is what's left for .nav-right, which parks the hamburger in the
     middle of the bar. Logo hard left, hamburger hard right. */
  .nav-inner { display: flex; justify-content: space-between; align-items: center; gap: calc(var(--u) * 2); }
  .nav-right { margin-left: auto; }
}

@media (max-width: 768px) {
  /* The header CTA does not fit beside the hamburger at phone widths — it
     pushed the bar past the viewport and made every page scroll sideways. The
     hamburger menu carries its own Contact button, so nothing is lost. */
  .nav-right .btn-hero-primary { display: none; }
  .blog-main { padding: calc(var(--u) * 4) calc(var(--u) * 2) calc(var(--u) * 8); }
  .post-grid { grid-template-columns: 1fr; }
  .post-article { max-width: 100%; }
  .container { padding: 0 calc(var(--u) * 4); }
  .contact-row { grid-template-columns: 1fr; }
  .post-gate-card { flex-direction: column; align-items: stretch; gap: calc(var(--u) * 2.5); }
  .post-gate-action { align-items: stretch; }
  .post-gate-action .btn { width: 100%; justify-content: center; }
  .post-gate-note, .post-gate-error { text-align: left; max-width: none; }
  .modal-card { padding: 28px 20px; }
  .modal-backdrop { align-items: flex-start; overflow-y: auto; }
  .modal-card { max-height: calc(100vh - 32px); overflow-y: auto; margin: 16px auto; }
}
@media (max-width: 640px) {
  .container { padding: 0 calc(var(--u) * 3); }
  /* Copyright and the six social icons no longer fit on one line. */
  .footer-bottom { flex-wrap: wrap; gap: calc(var(--u) * 2); }
}
