/* arunraghavan.net
 *
 * One stylesheet, in sections:
 *   1. Fonts        2. Tokens (colours, type, sizes)   3. Base
 *   4. Header       5. Layout                          6. Post header & prose
 *   7. Code         8. Media                           9. Archive listings
 *  10. Post footer, navigation, comments              11. Footer          12. Search
 *  13. Print
 *
 * Colours and sizes live in the tokens (section 2); the rest of the file only refers to them.
 * The theme is chosen by data-theme on <html> ("dark" or "light"), set by the script in base.html.
 */


/* 1. Fonts ------------------------------------------------------------------------------------
 * Variable fonts, self-hosted, SIL Open Font License (licences in /fonts/):
 * Source Serif 4 for prose, Inter for headings and interface, JetBrains Mono for code.
 * Each comes as a Latin file plus a Latin Extended one that only loads if a page needs it. */

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url(../fonts/source-serif-4-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url(../fonts/source-serif-4-latin-ext-wght-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url(../fonts/source-serif-4-latin-wght-italic.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url(../fonts/source-serif-4-latin-ext-wght-italic.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(../fonts/inter-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(../fonts/inter-latin-ext-wght-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url(../fonts/jetbrains-mono-latin-wght-normal.woff2) format("woff2");
}


/* 2. Tokens ----------------------------------------------------------------------------------- */

:root {
  /* Type */
  --font-prose: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-ui: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-code: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --text-size: clamp(1.0625rem, 0.95rem + 0.45vw, 1.25rem);   /* prose: 17px on phones, 20px wide */
  --ui-size: 0.9375rem;                                        /* nav, dates, captions: 15px */
  --code-size: 0.84em;
  --line-height: 1.65;

  /* Widths: prose sits at a comfortable measure; code, tables and images may use the wide track. */
  --measure: 48rem;
  --wide: 48rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);                          /* page side padding */

  /* Spacing */
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --radius: 6px;
}

/* Dark (the default). The accent is a richer take on the old site's Rams purple (#686fa5). */
:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #15171c;            /* page */
  --surface: #1c1f26;       /* code blocks, quotes, tags */
  --border: #2c303a;
  --text: #d6d9e0;          /* body text: off-white, softer than #fff */
  --text-strong: #f0f1f4;   /* headings */
  --muted: #949aa8;         /* dates, captions, secondary text */
  --accent: #b9a8ff;        /* links, site name */
  --accent-hover: #d8ceff;
  --link-underline: rgba(185, 168, 255, 0.4);
  --mark: rgba(185, 168, 255, 0.16);   /* highlighted code lines */
  --selection: rgba(185, 168, 255, 0.3);
  --img-bg: #e6e7eb;        /* behind images, so transparent diagrams (black arrows, text) stay visible */
  --img-filter: brightness(0.9);   /* takes the glare off white diagrams and screenshots */
}

/* Light: a soft, slightly warm paper tone rather than bright white, with an ember-orange accent. */
[data-theme="light"] {
  color-scheme: light;
  --bg: #eeede8;
  --surface: #e4e3dd;
  --border: #d5d3cc;
  --text: #2a2b30;
  --text-strong: #121317;
  --muted: #5a5e69;
  --accent: #9a4f0c;
  --accent-hover: #6f3605;
  --link-underline: rgba(154, 79, 12, 0.35);
  --mark: rgba(255, 213, 0, 0.28);
  --selection: rgba(154, 79, 12, 0.18);
  --img-bg: transparent;
  --img-filter: none;
}


/* 3. Base ------------------------------------------------------------------------------------- */

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover { color: var(--accent-hover); }

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

img, video, iframe { max-width: 100%; }
img { height: auto; }
svg { flex-shrink: 0; }

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -3rem;
  padding: var(--space-1) var(--space-2);
  background: var(--surface);
  border-radius: var(--radius);
}
.skip-link:focus { top: var(--space-1); }

@media (prefers-reduced-motion: no-preference) {
  a, .theme-toggle { transition: color 0.15s ease, background-color 0.15s ease; }
}


/* 4. Header ----------------------------------------------------------------------------------- */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1) var(--space-3);
  width: 100%;
  max-width: calc(var(--wide) + 2 * var(--gutter));
  margin: 0 auto;
  padding: var(--space-3) var(--gutter);
}

.site-title {
  color: var(--accent);
  font-size: clamp(1.3rem, 1.15rem + 0.6vw, 1.6rem);
  font-weight: 650;
  letter-spacing: -0.01em;
}
.site-title:hover { color: var(--accent-hover); }

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.site-tools {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.main-menu,
.social-menu {
  display: flex;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.main-menu a {
  color: var(--muted);
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  font-weight: 500;
}
.main-menu a:hover { color: var(--text-strong); }

.social-menu { gap: var(--space-2); }
.social-menu a {
  display: flex;
  color: var(--muted);
}
.social-menu a:hover { color: var(--text-strong); }
.social-menu svg { width: 1.2rem; height: 1.2rem; }

.theme-toggle,
.search-toggle {
  display: flex;
  padding: 0.4rem;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.theme-toggle:hover,
.search-toggle:hover { color: var(--text-strong); background: var(--surface); }
.theme-toggle svg,
.search-toggle svg { width: 1.1rem; height: 1.1rem; }
.search-toggle[hidden] { display: none; }
/* Show the icon of the theme you'd switch to. */
[data-theme="dark"] .icon-dark,
[data-theme="light"] .icon-light { display: none; }

/* Wider screens: more room around the header, and between the menu, search, social links and
   theme button. */
@media (min-width: 40rem) {
  .site-header { padding-top: var(--space-4); padding-bottom: var(--space-4); }
  .site-nav { gap: 2rem; }
  .site-tools { gap: 2rem; }
  .main-menu { gap: 1.5rem; }
}

/* Phones: the menu goes on its own line, and the social links and theme button follow on the
   next one if they don't fit. */
@media (max-width: 40rem) {
  .site-nav { flex-wrap: wrap; gap: var(--space-2) var(--space-3); width: 100%; }
  .main-menu { gap: var(--space-2); }
}


/* 5. Layout ------------------------------------------------------------------------------------
 * Main is the wide track; prose children are centred at the measure, and wide content
 * (code, tables, galleries, figures, images on their own line) uses the full wide track. */

.site-main {
  flex: 1;
  width: 100%;
  max-width: calc(var(--wide) + 2 * var(--gutter));
  margin: 0 auto;
  padding: var(--space-4) var(--gutter) var(--space-5);
}

.post-header,
.page-header,
.post-content > *,
.featured-media,
.post-meta,
.comments,
.post-nav,
.archive,
.term-list {
  max-width: var(--measure);
  margin-left: auto;
  margin-right: auto;
}

.post-content > pre,
.post-content > table,
.post-content > figure,
.post-content > .gallery,
.post-content > .wp-caption,
.post-content > p:has(> img:only-child),
.post-content > p:has(> a:only-child > img:only-child),
.post-content > iframe {
  max-width: var(--wide);
}


/* 6. Post header & prose ------------------------------------------------------------------- */

.post-header,
.page-header { margin-bottom: var(--space-4); }

.post-date {
  display: block;
  margin-bottom: var(--space-1);
  color: var(--muted);
  font-size: var(--ui-size);
  font-variant-numeric: tabular-nums;
}
.post-date a { color: inherit; }
.post-date a:hover { color: var(--accent); }

.post-title,
.page-title {
  margin: 0;
  color: var(--text-strong);
  font-size: clamp(1.9rem, 1.4rem + 2vw, 2.75rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.025em;
  text-wrap: balance;
  overflow-wrap: break-word;
}

.page-kicker {
  margin: 0 0 var(--space-1);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.page-feed { margin: var(--space-2) 0 0; font-size: var(--ui-size); }
.page-feed a { display: inline-flex; align-items: center; gap: 0.4em; }
.page-feed svg { width: 0.9em; height: 0.9em; }

.post-content {
  font-family: var(--font-prose);
  font-size: var(--text-size);
  line-height: var(--line-height);
  overflow-wrap: break-word;
}

.post-content > * { margin-top: 0; margin-bottom: 1.15em; }

.post-content a {
  text-decoration: underline;
  text-decoration-color: var(--link-underline);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
.post-content a:hover { text-decoration-color: currentColor; }

.post-content h1, .post-content h2, .post-content h3,
.post-content h4, .post-content h5, .post-content h6 {
  margin-top: 2em;
  margin-bottom: 0.6em;
  color: var(--text-strong);
  font-family: var(--font-ui);
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.post-content h1 { font-size: 1.6em; }
.post-content h2 { font-size: 1.4em; }
.post-content h3 { font-size: 1.2em; }
.post-content h4 { font-size: 1.05em; }
.post-content h5, .post-content h6 { font-size: 0.95em; }
.post-content h6 { color: var(--muted); letter-spacing: 0.05em; text-transform: uppercase; }

.post-content strong, .post-content b { font-weight: 650; color: var(--text-strong); }

.post-content ul, .post-content ol { padding-left: 1.4em; }
.post-content li { margin-bottom: 0.35em; }
.post-content li > p { margin: 0 0 0.35em; }
.post-content li > ul, .post-content li > ol { margin-top: 0.35em; }
.post-content li::marker { color: var(--muted); }

.post-content blockquote {
  padding: 0.1em 0 0.1em 1.25em;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  font-style: italic;
}
.post-content blockquote > :last-child { margin-bottom: 0; }

.post-content hr {
  height: 1px;
  margin: 2.5em auto;
  border: none;
  background: var(--border);
}

.post-content abbr[title], .post-content acronym[title] {
  text-decoration: underline dotted;
  cursor: help;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-ui);
  font-size: 0.85em;
  font-variant-numeric: tabular-nums;
}
/* Wide tables scroll sideways instead of widening the page. */
.post-content > table { display: block; overflow-x: auto; }
.post-content th, .post-content td {
  padding: 0.5em 0.9em;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.post-content th { color: var(--text-strong); font-weight: 600; border-bottom-width: 2px; }

.post-content sup, .post-content sub { line-height: 0; }
.post-content .footnote-reference a,
.post-content sup a { text-decoration: none; font-family: var(--font-ui); font-size: 0.8em; }
.post-content .footnotes {
  margin-top: 3em;
  padding-top: 1em;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.875em;
}
.post-content .footnotes ol { padding-left: 1.2em; }

/* The front page: the intro reads a little larger. */
.intro .post-content { font-size: calc(var(--text-size) * 1.1); }


/* 7. Code --------------------------------------------------------------------------------------
 * Token colours come from Zola's giallo-light.css / giallo-dark.css (github-light/-dark);
 * the block itself uses the site's colours so it sits quietly on the page. */

.post-content code,
.post-content kbd,
.post-content tt,
.comment-content code {
  padding: 0.12em 0.35em;
  border-radius: 4px;
  background: var(--surface);
  font-family: var(--font-code);
  font-size: var(--code-size);
}

.post-content pre {
  overflow-x: auto;
  padding: 1em 1.25em;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-code);
  font-size: 0.8em;
  line-height: 1.55;
  tab-size: 4;
}
.post-content pre,
.post-content pre.giallo { background: var(--surface); color: var(--text); }
.post-content pre code { padding: 0; background: none; font-size: 1em; }

/* Lines marked in the post (hl_lines), e.g. what changed in a snippet. */
.post-content .z-l-hl,
.post-content .z-d-hl { background: var(--mark); }
/* Highlighted lines run edge to edge of the block. */
.post-content pre .z-l-hl,
.post-content pre .z-d-hl { margin: 0 -1.25em; padding: 0 1.25em; width: calc(100% + 2.5em); }

/* Required by Zola's highlighter (giallo): one inline-block per line. */
.giallo-l { display: inline-block; min-height: 1lh; width: 100%; }
.giallo-ln {
  display: inline-block;
  min-width: 3ch;
  margin-right: 1em;
  color: var(--muted);
  opacity: 0.6;
  text-align: right;
  user-select: none;
}


/* 8. Media ------------------------------------------------------------------------------------- */

.post-content img { border-radius: 3px; }
/* Many diagrams are transparent PNGs drawn for a white page. Opaque images cover this completely. */
.post-content img:not(.emoji):not(.wp-smiley) { background: var(--img-bg); filter: var(--img-filter); }
.post-content p > img:only-child,
.post-content p > a:only-child > img:only-child { display: block; margin: 0 auto; }

.featured-media { margin-top: 0; margin-bottom: var(--space-4); }
.featured-media img { display: block; width: 100%; border-radius: var(--radius); }

.post-content figure { text-align: center; }
.post-content figure img { display: block; margin: 0 auto; }
.post-content .wp-caption { max-width: 100%; }

.post-content figcaption,
.post-content .wp-caption-text,
.post-content .gallery-caption {
  margin-top: 0.6em;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: var(--ui-size);
  line-height: 1.45;
  text-align: center;
}

.post-content .gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: var(--space-2);
}
.post-content .gallery figure,
.post-content .gallery .gallery-item { margin: 0; }
.post-content .gallery img { width: 100%; }

.post-content iframe,
.post-content video { display: block; margin-left: auto; margin-right: auto; border: 0; border-radius: var(--radius); }
.post-content audio { display: block; width: 100%; }


/* 9. Archive listings (/blog/, tag pages, tag list) ----------------------------------------- */

.archive-year {
  margin: var(--space-4) 0 var(--space-1);
  padding-bottom: var(--space-1);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: var(--ui-size);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}
.archive > .archive-year:first-child { margin-top: 0; }

.entry {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  column-gap: var(--space-2);
  padding: var(--space-2) 0;
}
.entry-date {
  grid-row: span 2;
  padding-top: 0.2em;
  color: var(--muted);
  font-size: var(--ui-size);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.entry-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.entry-title a { color: var(--text-strong); }
.entry-title a:hover { color: var(--accent); }
.entry-excerpt {
  margin: 0.35em 0 0;
  color: var(--muted);
  font-family: var(--font-prose);
  font-size: 1.05rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

@media (max-width: 30rem) {
  .entry { grid-template-columns: 1fr; }
  .entry-date { grid-row: auto; padding: 0; }
}

.term-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  padding: 0;
  list-style: none;
}
.term-list a,
.post-tags a {
  display: inline-block;
  padding: 0.25em 0.75em;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.875rem;
}
.term-list a:hover,
.post-tags a:hover { color: var(--accent-hover); }
.term-list li { display: flex; align-items: center; gap: 0.35em; }
.term-count { color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; }


/* 10. Post footer, navigation, comments ------------------------------------------------------ */

.post-meta { margin-top: var(--space-4); }
.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  margin-top: var(--space-5);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}
.post-nav a { color: var(--text-strong); font-weight: 550; line-height: 1.35; }
.post-nav a:hover { color: var(--accent); }
.post-nav span {
  display: block;
  margin-bottom: 0.25em;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.post-nav-older { grid-column: 2; text-align: right; }

.comments {
  margin-top: var(--space-5);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}
.comments-title {
  margin: 0 0 var(--space-2);
  color: var(--text-strong);
  font-size: 1.15rem;
  font-weight: 650;
}
.comment-list { margin: 0; padding: 0; list-style: none; }
/* Replies indent by their depth in the thread (set per comment as --depth). */
.comment {
  margin-left: min(calc(var(--depth, 0) * 1.5rem), 6rem);
  padding: var(--space-2) 0 var(--space-2) var(--space-2);
  border-left: 2px solid var(--border);
}
.comment + .comment { margin-top: var(--space-1); }
.comment-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.75em;
  font-size: var(--ui-size);
}
.comment-author { color: var(--text-strong); font-weight: 600; }
.comment-author a { color: inherit; }
.comment-date { color: var(--muted); font-size: 0.875rem; }
.comment-content {
  font-family: var(--font-prose);
  font-size: 1.05rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}
.comment-content p { margin: 0.4em 0 0; }
.comments-closed { margin: var(--space-3) 0 0; color: var(--muted); font-size: var(--ui-size); }


/* 11. Footer ------------------------------------------------------------------------------------ */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  width: 100%;
  max-width: calc(var(--wide) + 2 * var(--gutter));
  margin: 0 auto;
  padding: var(--space-3) var(--gutter) var(--space-4);
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.875rem;
}
.site-footer p { margin: 0; }
.footer-feed { display: inline-flex; align-items: center; gap: 0.45em; }
.footer-feed svg { width: 0.9rem; height: 0.9rem; }
.site-footer a { color: inherit; }
.site-footer a:hover { color: var(--text-strong); }


/* 12. Search -----------------------------------------------------------------------------------
 * A dialog holding Pagefind's default UI, recoloured through its --pagefind-ui-* variables. */

.search-dialog {
  width: min(44rem, 100% - 2 * var(--gutter));
  max-height: min(80vh, 50rem);
  margin: 8vh auto auto;
  padding: var(--space-2) var(--space-3) var(--space-3);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 2);
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.35);

  --pagefind-ui-scale: 0.85;
  --pagefind-ui-primary: var(--accent);
  --pagefind-ui-text: var(--text);
  --pagefind-ui-background: var(--bg);
  --pagefind-ui-border: var(--border);
  --pagefind-ui-tag: var(--surface);
  --pagefind-ui-border-width: 1px;
  --pagefind-ui-border-radius: var(--radius);
  --pagefind-ui-font: var(--font-ui);
}
.search-dialog::backdrop {
  background: rgba(8, 9, 12, 0.6);
  backdrop-filter: blur(2px);
}

.search-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-1);
}
.search-label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.search-close {
  display: flex;
  padding: 0.35rem;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.search-close:hover { color: var(--text-strong); background: var(--surface); }
.search-close svg { width: 0.9rem; height: 0.9rem; }

/* Pagefind's stylesheet loads later, so the input rule needs the id to win. */
#search .pagefind-ui__search-input { color: var(--text-strong); font-family: var(--font-ui); font-weight: 500; }
.search-dialog .pagefind-ui__search-clear {
  border: 0;
  background: none;
  color: var(--muted);
  font-family: var(--font-ui);
  cursor: pointer;
}
.search-dialog .pagefind-ui__search-clear:hover { color: var(--text-strong); }
.search-dialog .pagefind-ui__search-input::placeholder { color: var(--muted); opacity: 1; }
.search-dialog .pagefind-ui__result-link { color: var(--text-strong); }
.search-dialog .pagefind-ui__result-link:hover { color: var(--accent); }
.search-dialog .pagefind-ui__result-excerpt { color: var(--muted); }
.search-dialog mark {
  padding: 0 0.1em;
  border-radius: 2px;
  background: var(--mark);
  color: var(--text-strong);
}


/* 13. Print ------------------------------------------------------------------------------------- */

@media print {
  :root, [data-theme] {
    color-scheme: light;
    --bg: #fff; --surface: #f4f4f4; --border: #ccc;
    --text: #000; --text-strong: #000; --muted: #444; --accent: #000;
  }
  .site-header .site-nav, .skip-link, .search-dialog, .post-nav, .site-footer { display: none; }
  .post-content { font-size: 11pt; }
  .post-content a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; color: var(--muted); }
  .post-content pre { white-space: pre-wrap; }
}
