/* Sam Jenkins · Deliverability Engineer: Ghost theme
   Tokens mirror BRAND.md, web/public/styles.css and reports/template/report.typ.
   Change them together. The header, footer, buttons and CTA are copied from
   styles.css so the blog matches the main site exactly.
   --gh-font-body / --gh-font-heading are Ghost's optional custom fonts
   (Design settings); when unset, Inter is used. */

@font-face {
  font-family: "Inter";
  src: url("../fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/JetBrainsMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/JetBrainsMono-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

:root {
  --ink: #101828;
  --muted: #667085;
  --body: #344054;
  --accent: #0e7490;
  --accent-dark: #155e75;
  --accent-light: #ecfeff;
  --accent-bright: #22d3ee;
  --surface: #ffffff;
  --stripe: #f2f4f7;
  --rule: #d0d5dd;

  --good: #067647;
  --warn: #a15c07;
  --bad: #b42318;

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius: 6px;
  --width: 1080px;   /* site width, and the "wide" card width */
  --content: 720px;  /* reading column */
  --gutter: clamp(16px, 4vw, 32px);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--gh-font-body, var(--sans));
  font-size: 17px;
  line-height: 1.6;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-dark); }

code, .mono { font-family: var(--mono); font-size: 0.88em; }
code { background: var(--stripe); padding: 0.1em 0.35em; border-radius: 3px; }

h1, h2, h3, h4 { font-family: var(--gh-font-heading, var(--sans)); line-height: 1.15; letter-spacing: -0.02em; margin: 0; }
h1 { font-size: clamp(2rem, 4.5vw, 3rem); font-weight: 700; }
h2 { font-size: clamp(1.7rem, 3.5vw, 2.3rem); font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }
img, video { max-width: 100%; height: auto; }

.wrap { max-width: var(--width); margin: 0 auto; padding: 0 var(--gutter); }
.wrap-narrow { max-width: calc(var(--content) + 2 * var(--gutter)); }

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 14px;
}
.eyebrow a { text-decoration: none; }

.rule { width: 40px; height: 2px; background: var(--accent); border: 0; margin: 18px 0 24px; }

.lede { font-size: 1.2rem; color: var(--body); max-width: 36em; }
.muted { color: var(--muted); }

/* ---------- Buttons (as on the main site) ---------- */

.btn {
  display: inline-block;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 16px;
  line-height: 1.5;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); color: #fff; }
.btn-secondary { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn-secondary:hover { color: var(--ink); border-color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

/* ---------- Header (as on the main site) ---------- */

.site-header { border-bottom: 1px solid var(--stripe); }
.site-header .wrap { display: flex; align-items: center; gap: 16px 28px; min-height: 68px; padding-top: 10px; padding-bottom: 10px; }
.wordmark { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); line-height: 1.2; }
.wordmark img { display: block; border-radius: 7px; }
.wordmark strong { display: block; font-size: 17px; letter-spacing: -0.01em; }
.wordmark span { font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.site-nav { display: flex; align-items: center; gap: 24px; margin-left: auto; }
.site-nav a { color: var(--ink); text-decoration: none; font-size: 15px; font-weight: 500; }
.site-nav a:hover { color: var(--accent); }
.site-nav a[aria-current] { color: var(--accent); }
.nav-cta { padding: 8px 14px; font-size: 15px; white-space: nowrap; }

/* Phones: wordmark and button on the first row, the links on a second. */
@media (max-width: 720px) {
  .site-header .wrap { flex-wrap: wrap; gap: 8px 16px; }
  .wordmark { margin-right: auto; }
  .site-nav { order: 3; flex-basis: 100%; margin-left: 0; gap: 20px; }
  .site-nav a { font-size: 14px; }
}

/* ---------- Blog home ---------- */

.blog-hero { padding: clamp(48px, 8vw, 88px) 0; border-bottom: 1px solid var(--stripe); }
.blog-hero .wrap { display: grid; grid-template-columns: 1.2fr 1fr; gap: 56px; align-items: center; }
.blog-hero h1 { max-width: 15em; }
.blog-hero .lede { margin: 0; }
@media (max-width: 900px) {
  .blog-hero .wrap { grid-template-columns: 1fr; gap: 36px; }
}

.post-list-section { padding: clamp(40px, 6vw, 64px) 0 clamp(56px, 9vw, 96px); }
.post-list { border-top: 1px solid var(--rule); }
.post-item { padding: 28px 0; border-bottom: 1px solid var(--rule); }
.post-item-meta { font-family: var(--mono); font-size: 13px; color: var(--muted); margin: 0 0 10px; }
.post-item-meta a { color: var(--muted); text-decoration: none; }
.post-item-meta a:hover { color: var(--accent); }
.post-item-meta span { margin: 0 4px; }
.post-item-title { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.post-item-title a { color: var(--ink); text-decoration: none; }
.post-item-title a:hover { color: var(--accent); }
.post-item-excerpt { color: var(--body); font-size: 16px; margin: 10px 0 8px; max-width: 42em; }
.post-item-foot { font-size: 14px; color: var(--muted); margin: 0; }

.pagination { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-top: 28px; }
.pagination-count { font-family: var(--mono); font-size: 13px; color: var(--muted); }

/* ---------- Archives and errors ---------- */

.archive-head { padding: clamp(48px, 8vw, 80px) 0 0; }
.archive-head .muted { font-size: 15px; }
.error-page { padding-bottom: clamp(56px, 9vw, 96px); }
.error-page .eyebrow { font-family: var(--mono); letter-spacing: 0.04em; }

/* ---------- Post ---------- */

.post-header { padding-top: clamp(40px, 6vw, 72px); }
.post-header .rule { margin-bottom: 18px; }
.post-meta { font-family: var(--mono); font-size: 13.5px; color: var(--muted); margin: 0; }
.post-meta span { margin: 0 4px; }

.post-feature { margin: 40px auto 0; }
.post-feature img { display: block; width: 100%; border-radius: var(--radius); }
.post-feature figcaption { font-size: 14px; color: var(--muted); margin-top: 10px; }

.post-footer { padding-top: 16px; padding-bottom: clamp(56px, 9vw, 96px); } /* not the shorthand: .wrap owns the side padding */
.post-tags { font-size: 14px; color: var(--muted); margin: 0 0 32px; }
.page .gh-content { padding-bottom: clamp(56px, 9vw, 96px); }

/* ---------- Post content ----------
   A grid with three named columns: main (the reading column), wide (the site
   width) and full (the viewport). Ghost's editor adds kg-width-wide and
   kg-width-full to cards; everything else sits in the main column. */

.gh-content {
  display: grid;
  grid-template-columns:
    [full-start] minmax(var(--gutter), 1fr)
    [wide-start] minmax(0, calc((var(--width) - var(--content)) / 2))
    [main-start] min(var(--content), calc(100% - 2 * var(--gutter)))
    [main-end] minmax(0, calc((var(--width) - var(--content)) / 2))
    [wide-end] minmax(var(--gutter), 1fr)
    [full-end];
  padding: 40px 0 16px;
  font-size: 18px;
  line-height: 1.65;
  color: var(--ink);
}
.gh-content > * { grid-column: main-start / main-end; min-width: 0; }
.gh-content > .kg-width-wide { grid-column: wide-start / wide-end; }
.gh-content > .kg-width-full { grid-column: full-start / full-end; }

.gh-content > * + * { margin-top: 1.3em; }
.gh-content > h2, .gh-content > h3, .gh-content > h4 { margin-top: 2em; }
.gh-content > h2 + *, .gh-content > h3 + *, .gh-content > h4 + * { margin-top: 0.75em; }
.gh-content > .kg-card, .gh-content > figure, .gh-content > pre, .gh-content > table { margin-top: 2em; }
.gh-content > .kg-card + *, .gh-content > figure + *, .gh-content > pre + *, .gh-content > table + * { margin-top: 2em; }

.gh-content h2 { font-size: 1.7rem; }
.gh-content h3 { font-size: 1.3rem; font-weight: 600; }
.gh-content h4 { font-size: 1.1rem; font-weight: 600; letter-spacing: -0.01em; }
/* Only the bottom margins are zeroed: the top margins come from the sibling
   rules above. (`.gh-content p` outranks `.gh-content > * + *`, so a plain
   `margin: 0` here would remove the gap between paragraphs.) */
.gh-content p { margin-bottom: 0; }
.gh-content ul, .gh-content ol { padding-left: 1.4em; margin-bottom: 0; }
.gh-content li + li { margin-top: 0.4em; }
.gh-content li > ul, .gh-content li > ol { margin-top: 0.4em; }
.gh-content strong { font-weight: 600; }
.gh-content hr { border: 0; height: 1px; background: var(--rule); margin-top: 2.5em; }
.gh-content > hr + * { margin-top: 2.5em; }
.gh-content blockquote p + p, .gh-content li p + p { margin-top: 0.75em; }

.gh-content blockquote {
  margin: 0; margin-top: 1.3em; /* the sibling rules can't reach this: see the note above */
  padding: 0 0 0 20px;
  border-left: 2px solid var(--accent);
  color: var(--body);
}
.gh-content blockquote.kg-blockquote-alt {
  border: 0;
  padding: 0;
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.4;
  color: var(--ink);
}

/* Code: the same dark panel as the DNS check on the main site */
.gh-content pre {
  margin: 0; margin-top: 2em;
  padding: 18px 20px;
  background: var(--ink);
  color: #e4e7ec;
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.7;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.gh-content pre code { background: none; padding: 0; color: inherit; font-size: inherit; }
.gh-content code { font-size: 0.86em; }
.gh-content h2 code, .gh-content h3 code, .gh-content h4 code { font-size: 0.82em; font-weight: 500; padding: 0.05em 0.3em; }
.gh-content .kg-code-card { display: block; }

.gh-content table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 15.5px;
  line-height: 1.5;
}
.gh-content th, .gh-content td { padding: 10px 12px; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
.gh-content th { font-weight: 600; background: var(--stripe); white-space: nowrap; }
.gh-content td code, .gh-content th code { white-space: nowrap; }

/* Figures and editor cards */
.gh-content figure { margin: 0; margin-top: 2em; }
.gh-content figcaption { font-size: 14px; color: var(--muted); margin-top: 10px; line-height: 1.5; }
.gh-content figcaption a { color: var(--muted); }
.gh-content .kg-image { display: block; margin: 0 auto; border-radius: var(--radius); }
.gh-content .kg-width-full .kg-image { border-radius: 0; }
.gh-content .kg-gallery-image img { border-radius: 3px; }
.gh-content .kg-embed-card iframe { max-width: 100%; }

.gh-content .kg-bookmark-container { border: 1px solid var(--rule); border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.gh-content .kg-bookmark-container:hover { border-color: var(--ink); }
.gh-content .kg-bookmark-title { font-weight: 600; }
.gh-content .kg-bookmark-description, .gh-content .kg-bookmark-metadata { color: var(--muted); }

.gh-content .kg-callout-card { border-radius: var(--radius); font-size: 16.5px; }
.gh-content .kg-callout-card-grey { background: var(--stripe); }
.gh-content .kg-callout-card-blue { background: var(--accent-light); }

.gh-content .kg-btn { font-family: var(--sans); font-weight: 600; border-radius: var(--radius); }
.gh-content .kg-btn-accent { background: var(--accent); color: #fff; }
.gh-content .kg-btn-accent:hover { background: var(--accent-dark); }

.gh-content .kg-toggle-card, .gh-content .kg-file-card-container, .gh-content .kg-product-card-container {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.gh-content .kg-toggle-heading-text { font-weight: 600; }

/* ---------- Subscribe form ---------- */

.subscribe {
  padding: 26px;
  background: var(--stripe);
  border-radius: var(--radius);
}
.subscribe h3 { margin-bottom: 6px; }
.subscribe p { font-size: 15.5px; color: var(--body); margin: 0 0 16px; }
.subscribe-form { display: flex; flex-wrap: wrap; gap: 10px; }
.subscribe-form input {
  flex: 1 1 200px;
  min-width: 0;
  padding: 11px 14px;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.subscribe-form input::placeholder { color: var(--muted); }
.subscribe-form input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.subscribe-form .form-msg { display: none; flex-basis: 100%; margin: 4px 0 0; font-size: 15px; }
.subscribe-form.loading button { opacity: 0.6; pointer-events: none; }
.subscribe-form.success input, .subscribe-form.success button { display: none; }
.subscribe-form.success .form-success { display: block; color: var(--good); font-weight: 500; }
.subscribe-form.error .form-error { display: block; color: var(--bad); }

.post-footer .subscribe { margin-top: 8px; }

/* ---------- CTA + footer (as on the main site) ---------- */

.cta { background: var(--ink); color: #fff; padding: clamp(56px, 9vw, 96px) 0; }
.cta h2 { color: #fff; }
.cta p { color: #d0d5dd; max-width: 34em; }
.cta .rule { background: var(--accent-bright); }
.cta .btn-primary { background: #fff; color: var(--ink); }
.cta .btn-primary:hover { background: var(--accent-light); color: var(--ink); }
.cta .btn-secondary { color: #fff; border-color: #475467; }
.cta .btn-secondary:hover { border-color: #fff; color: #fff; }

.site-footer { padding: 28px 0; font-size: 14px; color: var(--muted); }
.site-footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px; }
.site-footer a { color: var(--muted); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
