/* ==========================================================================
   Blog styles for muhammad-ahmed.com/blog
   Palette is derived from a single hue, matching assets/css/styles.css on the
   main portfolio (--hue-color: 274).
   ========================================================================== */

:root {
  --hue: 274;

  --first-color: hsl(var(--hue), 95%, 51%);
  --first-color-alt: hsl(var(--hue), 57%, 53%);
  --first-color-lighter: hsl(var(--hue), 92%, 85%);

  --title-color: hsl(var(--hue), 8%, 15%);
  --text-color: hsl(var(--hue), 8%, 45%);
  --text-color-light: hsl(var(--hue), 8%, 65%);
  --body-color: hsl(var(--hue), 60%, 99%);
  --container-color: #fff;
  --border-color: hsl(var(--hue), 14%, 90%);
  --code-bg: hsl(var(--hue), 30%, 97%);
  --code-border: hsl(var(--hue), 20%, 91%);
  --selection-bg: hsl(var(--hue), 92%, 88%);

  /* Prism tokens — light */
  --tok-comment: hsl(var(--hue), 8%, 58%);
  --tok-keyword: hsl(var(--hue), 72%, 50%);
  --tok-string: hsl(158, 60%, 33%);
  --tok-number: hsl(22, 82%, 44%);
  --tok-function: hsl(212, 76%, 46%);
  --tok-operator: hsl(var(--hue), 8%, 38%);

  --body-font: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono-font: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --font-medium: 500;
  --font-semi-bold: 600;

  --measure: 68ch;
  --radius: 0.6rem;
  --header-height: 3.5rem;
}

/* Dark palette. Applies when the OS prefers dark and the reader has not
   explicitly chosen light, so the toggle wins in both directions. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --title-color: hsl(var(--hue), 8%, 95%);
    --text-color: hsl(var(--hue), 8%, 75%);
    --text-color-light: hsl(var(--hue), 8%, 55%);
    --body-color: hsl(var(--hue), 28%, 12%);
    --container-color: hsl(var(--hue), 29%, 16%);
    --border-color: hsl(var(--hue), 18%, 26%);
    --code-bg: hsl(var(--hue), 26%, 17%);
    --code-border: hsl(var(--hue), 18%, 26%);
    --selection-bg: hsl(var(--hue), 50%, 32%);
    --first-color: hsl(var(--hue), 90%, 68%);
    --first-color-lighter: hsl(var(--hue), 40%, 34%);

    --tok-comment: hsl(var(--hue), 8%, 55%);
    --tok-keyword: hsl(var(--hue), 85%, 76%);
    --tok-string: hsl(158, 52%, 62%);
    --tok-number: hsl(28, 85%, 68%);
    --tok-function: hsl(207, 82%, 72%);
    --tok-operator: hsl(var(--hue), 8%, 68%);
  }
}

:root[data-theme="dark"] {
  --title-color: hsl(var(--hue), 8%, 95%);
  --text-color: hsl(var(--hue), 8%, 75%);
  --text-color-light: hsl(var(--hue), 8%, 55%);
  --body-color: hsl(var(--hue), 28%, 12%);
  --container-color: hsl(var(--hue), 29%, 16%);
  --border-color: hsl(var(--hue), 18%, 26%);
  --code-bg: hsl(var(--hue), 26%, 17%);
  --code-border: hsl(var(--hue), 18%, 26%);
  --selection-bg: hsl(var(--hue), 50%, 32%);
  --first-color: hsl(var(--hue), 90%, 68%);
  --first-color-lighter: hsl(var(--hue), 40%, 34%);

  --tok-comment: hsl(var(--hue), 8%, 55%);
  --tok-keyword: hsl(var(--hue), 85%, 76%);
  --tok-string: hsl(158, 52%, 62%);
  --tok-number: hsl(28, 85%, 68%);
  --tok-function: hsl(207, 82%, 72%);
  --tok-operator: hsl(var(--hue), 8%, 68%);
}

/* ------------------------------ base ------------------------------------- */

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

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

body {
  margin: 0;
  font-family: var(--body-font);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-color);
  background-color: var(--body-color);
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--selection-bg); }

h1, h2, h3, h4 {
  color: var(--title-color);
  font-weight: var(--font-semi-bold);
  line-height: 1.25;
  margin: 0 0 0.5rem;
}

a { color: var(--first-color); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--first-color-alt); }

img { max-width: 100%; height: auto; display: block; }

:focus-visible { outline: 2px solid var(--first-color); outline-offset: 2px; border-radius: 3px; }

.container {
  max-width: 46rem;
  margin-inline: auto;
  padding-inline: 1.25rem;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--container-color);
  color: var(--title-color);
  padding: 0.6rem 1rem;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* ----------------------------- header ----------------------------------- */

.site-header {
  border-bottom: 1px solid var(--border-color);
  background-color: var(--container-color);
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav {
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.nav__brand {
  font-weight: var(--font-semi-bold);
  color: var(--title-color);
  text-decoration: none;
  margin-right: auto;
}
.nav__brand:hover { color: var(--first-color); }

.nav__list {
  display: flex;
  gap: 1.1rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.9rem;
  font-weight: var(--font-medium);
}
.nav__list a { color: var(--text-color); text-decoration: none; }
.nav__list a:hover { color: var(--first-color); }

.theme-toggle {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  color: var(--text-color);
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  flex-shrink: 0;
}
.theme-toggle:hover { color: var(--first-color); border-color: var(--first-color); }

/* ------------------------------ intro ----------------------------------- */

.intro { padding: 2.75rem 0 1.5rem; }
.intro__title { font-size: clamp(1.75rem, 5vw, 2.5rem); }
.intro__text { color: var(--text-color-light); margin: 0; }

/* ---------------------------- post list --------------------------------- */

.post-list { list-style: none; margin: 0; padding: 0 0 3rem; }

.post-list__item {
  padding: 1.5rem 0;
  border-top: 1px solid var(--border-color);
}

.post-list__title { font-size: 1.3rem; margin-bottom: 0.25rem; }
.post-list__title a { color: var(--title-color); text-decoration: none; }
.post-list__title a:hover { color: var(--first-color); }

.post-list__meta,
.post__meta {
  font-size: 0.82rem;
  color: var(--text-color-light);
  margin: 0 0 0.5rem;
}

.post-list__excerpt { margin: 0; }

.empty { color: var(--text-color-light); padding-bottom: 3rem; }

/* ------------------------------ post ------------------------------------ */

.post { padding: 2.75rem 0 3rem; }
.post__header { margin-bottom: 2rem; }
.post__title { font-size: clamp(1.6rem, 4.5vw, 2.25rem); }

.prose { max-width: var(--measure); }
.prose > * + * { margin-top: 1.1rem; }
.prose h2 { font-size: 1.4rem; margin-top: 2.4rem; }
.prose h3 { font-size: 1.15rem; margin-top: 1.8rem; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li + li { margin-top: 0.3rem; }

.prose blockquote {
  margin: 1.6rem 0;
  padding: 0.25rem 0 0.25rem 1.1rem;
  border-left: 3px solid var(--first-color);
  color: var(--text-color-light);
  font-style: italic;
}

.prose hr { border: none; border-top: 1px solid var(--border-color); margin: 2.5rem 0; }

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.prose thead th {
  text-align: left;
  color: var(--title-color);
  border-bottom: 2px solid var(--border-color);
  padding: 0.5rem 0.6rem;
}
.prose tbody td { border-bottom: 1px solid var(--border-color); padding: 0.5rem 0.6rem; }

/* Wide content scrolls inside its own box; the page never scrolls sideways. */
.table-scroll, .prose > pre { overflow-x: auto; }

.post__footer { margin-top: 3rem; }

.back-link {
  font-size: 0.9rem;
  font-weight: var(--font-medium);
  text-decoration: none;
}
.back-link:hover { text-decoration: underline; }

/* ------------------------------ tags ------------------------------------ */

.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; margin: 0.75rem 0 0; padding: 0; }

.tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: var(--font-medium);
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: var(--first-color-lighter);
  color: var(--first-color-alt);
  text-decoration: none;
}
.tag:hover { background: var(--first-color); color: #fff; }

.tags--large { margin-bottom: 3rem; }
.tags--large .tag { font-size: 0.88rem; padding: 0.3rem 0.85rem; }

:root[data-theme="dark"] .tag,
:root:not([data-theme="light"]) .tag { color: var(--title-color); }

/* ------------------------------ code ------------------------------------ */

code, pre, kbd, samp { font-family: var(--mono-font); }

:not(pre) > code {
  font-size: 0.86em;
  padding: 0.12em 0.36em;
  border-radius: 4px;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
}

pre[class*="language-"] {
  margin: 1.6rem 0;
  padding: 1rem 1.1rem;
  font-size: 0.85rem;
  line-height: 1.6;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  overflow-x: auto;
  tab-size: 2;
}
pre[class*="language-"] code { background: none; border: none; padding: 0; font-size: inherit; }

.token.comment, .token.prolog, .token.doctype, .token.cdata { color: var(--tok-comment); font-style: italic; }
.token.punctuation { color: var(--tok-operator); }
.token.keyword, .token.selector, .token.important, .token.atrule, .token.rule { color: var(--tok-keyword); }
.token.string, .token.char, .token.attr-value, .token.regex { color: var(--tok-string); }
.token.number, .token.boolean, .token.constant, .token.symbol { color: var(--tok-number); }
.token.function, .token.class-name, .token.tag { color: var(--tok-function); }
.token.operator, .token.entity, .token.url { color: var(--tok-operator); }
.token.property, .token.attr-name, .token.variable { color: var(--tok-function); }
.token.deleted { color: hsl(0, 65%, 55%); }
.token.inserted { color: hsl(150, 55%, 42%); }

/* ----------------------------- footer ----------------------------------- */

.site-footer {
  border-top: 1px solid var(--border-color);
  padding: 1.75rem 0;
  font-size: 0.85rem;
  color: var(--text-color-light);
}
.site-footer p { margin: 0; }
.site-footer a { color: var(--text-color-light); }
.site-footer a:hover { color: var(--first-color); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

/* ==========================================================================
   Long-form additions: table of contents, math, embeds, figures, callouts.
   ========================================================================== */

/* ----------------------------- contents --------------------------------- */

.toc {
  margin: 2rem 0 2.5rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--container-color);
  font-size: 0.9rem;
}
.toc__title {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  font-weight: var(--font-semi-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-color-light);
}
.toc__list ul { margin: 0; padding-left: 1.1rem; }
.toc__list > ul { padding-left: 0; list-style: none; }
.toc__list li { margin: 0.2rem 0; }
.toc__list a { color: var(--text-color); text-decoration: none; }
.toc__list a:hover { color: var(--first-color); text-decoration: underline; }

/* Anchor link revealed on heading hover. */
.heading-anchor {
  margin-left: 0.35rem;
  color: var(--text-color-light);
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}
h2:hover .heading-anchor,
h3:hover .heading-anchor,
.heading-anchor:focus-visible { opacity: 1; }

/* ------------------------------- math ----------------------------------- */

/* MathJax emits SVG, which inherits currentColor and so follows the theme. */
mjx-container { color: var(--title-color); }

/* A long equation scrolls inside its own box; the page never scrolls. */
mjx-container[display="true"] {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  padding: 0.35rem 0;
}

/* ------------------------- embeds and figures --------------------------- */

.embed, .figure { margin: 2rem 0; }

.embed__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--code-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
}
.embed__frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.figure img {
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
}

.embed figcaption,
.figure figcaption {
  margin-top: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-color-light);
  text-align: center;
}

/* ------------------------------ callout --------------------------------- */

.callout {
  margin: 2rem 0;
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--first-color);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--code-bg);
}
.callout__label {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  font-weight: var(--font-semi-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--first-color-alt);
}
.callout > :last-child { margin-bottom: 0; }

:root[data-theme="dark"] .callout__label,
:root:not([data-theme="light"]) .callout__label { color: var(--first-color); }

/* ==========================================================================
   Diagrams: hand-authored inline SVG, themed through CSS custom properties so
   one diagram works in both light and dark without being redrawn.
   ========================================================================== */

.diagram { margin: 2rem 0; }

/* A wide diagram scrolls inside its own box; the page never scrolls sideways. */
.diagram__scroll { overflow-x: auto; overflow-y: hidden; }

.diagram svg {
  display: block;
  width: 100%;
  height: auto;
  min-width: 34rem;          /* below this, scroll rather than crush the labels */
  margin-inline: auto;
  overflow: visible;
}

.diagram figcaption {
  margin-top: 0.6rem;
  font-size: 0.82rem;
  color: var(--text-color-light);
  text-align: center;
}

/* ---- diagram primitives -------------------------------------------------
   Boxes                                                                     */
.dgm-box {
  fill: var(--container-color);
  stroke: var(--border-color);
  stroke-width: 1.5;
  rx: 6;
}
.dgm-box--accent {
  fill: var(--first-color-lighter);
  stroke: var(--first-color);
}
.dgm-box--muted { fill: var(--code-bg); stroke: var(--code-border); }
.dgm-box--ghost { fill: none; stroke: var(--border-color); stroke-dasharray: 5 4; }

/* Text */
.dgm-text {
  fill: var(--title-color);
  font-family: var(--body-font);
  font-size: 13px;
  font-weight: 500;
  text-anchor: middle;
  dominant-baseline: middle;
}
.dgm-text--sm { font-size: 11px; font-weight: 400; fill: var(--text-color); }
.dgm-text--mono { font-family: var(--mono-font); font-size: 11.5px; }
.dgm-text--accent { fill: var(--first-color-alt); }
.dgm-text--start { text-anchor: start; }
.dgm-text--end { text-anchor: end; }

/* Edges. marker-end="url(#dgm-arrow)" picks up the stroke colour. */
.dgm-edge {
  fill: none;
  stroke: var(--text-color-light);
  stroke-width: 1.6;
  stroke-linecap: round;
}
.dgm-edge--accent { stroke: var(--first-color); }
.dgm-edge--dashed { stroke-dasharray: 5 4; }
.dgm-edge--thin { stroke-width: 1.1; }

/* Bars, for benchmark comparisons drawn as SVG rather than shipped as images */
.dgm-bar { fill: var(--first-color); }
.dgm-bar--muted { fill: var(--text-color-light); }
.dgm-axis { stroke: var(--border-color); stroke-width: 1; }

:root[data-theme="dark"] .dgm-box--accent,
:root:not([data-theme="light"]) .dgm-box--accent {
  fill: color-mix(in srgb, var(--first-color) 22%, transparent);
}
:root[data-theme="dark"] .dgm-text--accent,
:root:not([data-theme="light"]) .dgm-text--accent { fill: var(--first-color); }

/* ==========================================================================
   Newsletter signup.
   ========================================================================== */

.subscribe {
  margin: 3rem 0;
  padding: 1.5rem 1.5rem 1.25rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--container-color);
}

.subscribe__title { font-size: 1.05rem; margin-bottom: 0.35rem; }
.subscribe__blurb { margin: 0 0 1rem; font-size: 0.92rem; color: var(--text-color); }

/* Visible label kept for screen readers without doubling the visual heading. */
.subscribe__label {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.subscribe__row { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.subscribe__input {
  flex: 1 1 14rem;
  min-width: 0;
  padding: 0.6rem 0.8rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--title-color);
  background: var(--body-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}
.subscribe__input::placeholder { color: var(--text-color-light); }
.subscribe__input:focus-visible { border-color: var(--first-color); }

.subscribe__button {
  flex: 0 0 auto;
  padding: 0.6rem 1.15rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: var(--font-medium);
  color: #fff;
  background: var(--first-color);
  border: 1px solid var(--first-color);
  border-radius: var(--radius);
  cursor: pointer;
}
.subscribe__button:hover { background: var(--first-color-alt); border-color: var(--first-color-alt); }

.subscribe__note {
  margin: 0.85rem 0 0;
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--text-color-light);
}

:root[data-theme="dark"] .subscribe__button,
:root:not([data-theme="light"]) .subscribe__button { color: hsl(var(--hue), 30%, 10%); }

/* Honeypot. Moved off-screen rather than display:none, because some bots skip
   fields that are display:none but will happily fill a positioned one. */
.subscribe__trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ==========================================================================
   Listing page: hero, featured brief, archive cards.
   ========================================================================== */

.hero {
  padding: 3.25rem 0 2rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 2.5rem;
}
.hero__eyebrow {
  margin: 0 0 0.6rem;
  font-size: 0.72rem;
  font-weight: var(--font-semi-bold);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--first-color);
}
.hero__title {
  font-size: clamp(2rem, 7vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 0.6rem;
}
.hero__text {
  margin: 0 0 1rem;
  max-width: 34rem;
  font-size: 1.02rem;
  color: var(--text-color);
}
.hero__meta { margin: 0; font-size: 0.86rem; color: var(--text-color-light); }
.hero__meta a { color: var(--text-color-light); text-decoration: none; }
.hero__meta a:hover { color: var(--first-color); text-decoration: underline; }
.hero__sep { margin: 0 0.45rem; }

/* ---------------------------- featured brief ----------------------------- */

.feature {
  position: relative;
  padding: 1.6rem 1.5rem 1.4rem;
  margin-bottom: 2.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--container-color);
  overflow: hidden;
}
/* A hairline of accent along the top, rather than a heavy coloured block. */
.feature::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--first-color), var(--first-color-alt));
}
.feature__title {
  font-size: clamp(1.35rem, 3.6vw, 1.8rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0.15rem 0 0.55rem;
}
.feature__title a { color: var(--title-color); text-decoration: none; }
.feature__title a:hover { color: var(--first-color); }
.feature__excerpt { margin: 0 0 0.75rem; color: var(--text-color); }
.feature__badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: var(--first-color-lighter);
  color: var(--first-color-alt);
  font-size: 0.66rem;
  font-weight: var(--font-semi-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: 0.1em;
}
.feature__more {
  font-size: 0.9rem;
  font-weight: var(--font-medium);
  text-decoration: none;
}
.feature__more:hover { text-decoration: underline; }

:root[data-theme="dark"] .feature__badge,
:root:not([data-theme="light"]) .feature__badge {
  background: color-mix(in srgb, var(--first-color) 22%, transparent);
  color: var(--first-color);
}

/* ------------------------------- archive -------------------------------- */

.archive { padding-bottom: 3rem; }
.archive__heading {
  font-size: 0.74rem;
  font-weight: var(--font-semi-bold);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-color-light);
  margin-bottom: 1rem;
}

.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }

.card {
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--container-color);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.card:hover { border-color: var(--first-color); transform: translateY(-2px); }

.card__meta {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  color: var(--text-color-light);
}
.card__dot { margin: 0 0.35rem; }
.card__title { font-size: 1.12rem; line-height: 1.3; margin: 0 0 0.4rem; }
.card__title a { color: var(--title-color); text-decoration: none; }
.card__title a:hover { color: var(--first-color); }
.card__excerpt { margin: 0; font-size: 0.94rem; }

.tags--tight { margin-top: 0.6rem; }

@media (prefers-reduced-motion: reduce) {
  .card:hover { transform: none; }
}

/* ==========================================================================
   Newsletter: inline card and modal.
   ========================================================================== */

.subscribe__head { margin-bottom: 1rem; }
.subscribe__eyebrow,
.nl-modal__eyebrow {
  margin: 0 0 0.4rem;
  font-size: 0.7rem;
  font-weight: var(--font-semi-bold);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--first-color);
}
.subscribe__turnstile { margin-top: 0.75rem; }

/* ------------------------------- modal ---------------------------------- */

.nl-modal {
  width: min(30rem, calc(100vw - 2rem));
  padding: 0;
  border: 1px solid var(--border-color);
  border-radius: calc(var(--radius) * 1.6);
  background: var(--container-color);
  color: var(--text-color);
  box-shadow: 0 18px 50px -12px rgba(0, 0, 0, 0.35);
  overflow: visible;
}
.nl-modal::backdrop {
  background: rgba(12, 6, 22, 0.55);
  backdrop-filter: blur(3px);
}

.nl-modal__dismiss { margin: 0; }
.nl-modal__close {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--text-color-light);
  background: none;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.nl-modal__close:hover { color: var(--title-color); background: var(--code-bg); }

/* Positioned so the close button anchors to the card, not the viewport. */
.nl-modal__body { position: relative; padding: 1.6rem 1.5rem 1.4rem; }
.nl-modal__title {
  font-size: 1.3rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
}
.nl-modal__blurb { margin: 0 0 1.1rem; font-size: 0.95rem; }
.nl-modal__note {
  margin: 0.85rem 0 0;
  font-size: 0.76rem;
  line-height: 1.6;
  color: var(--text-color-light);
}

/* The modal stacks the field above the button so neither gets squeezed.
   Resetting flex on the input matters: the shared rule is `flex: 1 1 14rem`,
   and in a column flex container that basis becomes a 14rem *height*, which
   turned the email field into a 220px-tall box. */
.nl-modal .subscribe__row { flex-direction: column; align-items: stretch; }
.nl-modal .subscribe__input { flex: 0 0 auto; }
.nl-modal .subscribe__button { width: 100%; }

.nl-modal[open] { animation: nl-in 0.18s ease-out; }
@keyframes nl-in {
  from { opacity: 0; transform: translateY(6px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .nl-modal[open] { animation: none; }
  .nl-modal::backdrop { backdrop-filter: none; }
}
