/* ---------- fonts (IBM Plex, self-hosted, latin subset) ---------- */
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: italic; font-weight: 400; font-display: swap; src: url("fonts/ibm-plex-sans-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/ibm-plex-sans-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2"); }

/* ---------- theme tokens ---------- */
:root {
  color-scheme: light;
  --bg: #f2f2f5;
  --bg-word-opacity: 0.9;
  --ink: #15181f;
  --muted: #5b6270;
  --accent: #1f5fbf;
  --accent-hover: #0f3f8f;
  --visited: #6b3fa0;
  --active: #c0392b;
  --card: rgba(255, 255, 255, 0.35);
  --card-solid: #ffffff;
  --video-bg: rgba(255, 255, 255, 0.45);
  --card-border: rgba(255, 255, 255, 0.6);
  --card-shadow: rgba(0, 0, 0, 0.08);
  --rule: rgba(0, 0, 0, 0.08);
  --code-bg: rgba(0, 0, 0, 0.06);
  --toggle-bg: rgba(255, 255, 255, 0.5);
  --toggle-border: rgba(0, 0, 0, 0.12);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #14161c;
  --bg-word-opacity: 0.38;
  --ink: #e8e9ee;
  --muted: #9ba1ad;
  --accent: #8ab4f8;
  --accent-hover: #c2d8ff;
  --visited: #c4a6f0;
  --active: #ff8a80;
  --card: rgba(24, 26, 34, 0.45);
  --card-solid: #22252e;
  --video-bg: rgba(255, 255, 255, 0.22);
  --card-border: rgba(255, 255, 255, 0.10);
  --card-shadow: rgba(0, 0, 0, 0.4);
  --rule: rgba(255, 255, 255, 0.10);
  --code-bg: rgba(255, 255, 255, 0.07);
  --toggle-bg: rgba(255, 255, 255, 0.08);
  --toggle-border: rgba(255, 255, 255, 0.18);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  color: var(--ink);
  background-color: var(--bg);
  line-height: 1.6;
}

/* ---------- tiled, rotated "KZNJK" background ----------
   Generated by tools/gen-bg.py. The word is baked into the SVG tile as a path
   (IBM Plex Sans Bold outlines) in a cycle of pastel colors. The tile is
   seamless and the whole oversized layer is rotated 45deg, so no seams. */
body::before {
  content: "";
  position: fixed;
  top: -100vmax;
  left: -100vmax;
  width: 300vmax;
  height: 300vmax;
  z-index: -1;
  pointer-events: none;
  transform: rotate(-45deg);
  opacity: var(--bg-word-opacity);
  background-repeat: repeat;
  /* BG-START */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='553.2' height='180' viewBox='0 0 553.2 180'><defs><path id='w' d='M7.0 -6.6 5.0 -4.2V0.0H1.6V-15.3H5.0V-8.0H5.1L7.3 -11.0L10.8 -15.3H14.5L9.4 -9.0L15.0 0.0H11.1ZM29.3 0.0H17.6V-2.9L25.2 -12.3H18.0V-15.3H29.1V-12.3L21.5 -2.9H29.3ZM38.0 -7.2 36.5 -10.3H36.5V0.0H33.3V-15.3H37.0L41.2 -8.0L42.6 -5.0H42.7V-15.3H45.9V0.0H42.2ZM59.7 -15.3V-4.4Q59.7 -3.3 59.4 -2.5Q59.1 -1.6 58.4 -1.0Q57.7 -0.4 56.8 -0.0Q55.9 0.2 54.7 0.2Q53.5 0.2 52.7 -0.0Q51.8 -0.3 51.2 -0.9Q50.5 -1.5 50.1 -2.3Q49.7 -3.1 49.6 -4.0L52.7 -4.6Q53.1 -2.6 54.6 -2.6Q55.4 -2.6 55.9 -3.1Q56.4 -3.6 56.4 -4.5V-12.6H51.7V-15.3ZM69.9 -6.6 67.9 -4.2V0.0H64.5V-15.3H67.9V-8.0H68.0L70.2 -11.0L73.6 -15.3H77.4L72.3 -9.0L77.9 0.0H74.0Z'/></defs><use href='%23w' x='0.0' y='20.9' fill='%23f6a7c1'/><use href='%23w' x='92.2' y='20.9' fill='%23f9c59b'/><use href='%23w' x='184.4' y='20.9' fill='%23f3e48a'/><use href='%23w' x='276.6' y='20.9' fill='%23a8e6c3'/><use href='%23w' x='368.8' y='20.9' fill='%23a7cff6'/><use href='%23w' x='461.0' y='20.9' fill='%23c9b6f2'/><use href='%23w' x='553.2' y='20.9' fill='%23f6a7c1'/><use href='%23w' x='-46.1' y='50.9' fill='%23a8e6c3'/><use href='%23w' x='46.1' y='50.9' fill='%23a7cff6'/><use href='%23w' x='138.3' y='50.9' fill='%23c9b6f2'/><use href='%23w' x='230.5' y='50.9' fill='%23f6a7c1'/><use href='%23w' x='322.7' y='50.9' fill='%23f9c59b'/><use href='%23w' x='414.9' y='50.9' fill='%23f3e48a'/><use href='%23w' x='507.1' y='50.9' fill='%23a8e6c3'/><use href='%23w' x='0.0' y='80.9' fill='%23f9c59b'/><use href='%23w' x='92.2' y='80.9' fill='%23f3e48a'/><use href='%23w' x='184.4' y='80.9' fill='%23a8e6c3'/><use href='%23w' x='276.6' y='80.9' fill='%23a7cff6'/><use href='%23w' x='368.8' y='80.9' fill='%23c9b6f2'/><use href='%23w' x='461.0' y='80.9' fill='%23f6a7c1'/><use href='%23w' x='553.2' y='80.9' fill='%23f9c59b'/><use href='%23w' x='-46.1' y='110.9' fill='%23a7cff6'/><use href='%23w' x='46.1' y='110.9' fill='%23c9b6f2'/><use href='%23w' x='138.3' y='110.9' fill='%23f6a7c1'/><use href='%23w' x='230.5' y='110.9' fill='%23f9c59b'/><use href='%23w' x='322.7' y='110.9' fill='%23f3e48a'/><use href='%23w' x='414.9' y='110.9' fill='%23a8e6c3'/><use href='%23w' x='507.1' y='110.9' fill='%23a7cff6'/><use href='%23w' x='0.0' y='140.9' fill='%23f3e48a'/><use href='%23w' x='92.2' y='140.9' fill='%23a8e6c3'/><use href='%23w' x='184.4' y='140.9' fill='%23a7cff6'/><use href='%23w' x='276.6' y='140.9' fill='%23c9b6f2'/><use href='%23w' x='368.8' y='140.9' fill='%23f6a7c1'/><use href='%23w' x='461.0' y='140.9' fill='%23f9c59b'/><use href='%23w' x='553.2' y='140.9' fill='%23f3e48a'/><use href='%23w' x='-46.1' y='170.9' fill='%23c9b6f2'/><use href='%23w' x='46.1' y='170.9' fill='%23f6a7c1'/><use href='%23w' x='138.3' y='170.9' fill='%23f9c59b'/><use href='%23w' x='230.5' y='170.9' fill='%23f3e48a'/><use href='%23w' x='322.7' y='170.9' fill='%23a8e6c3'/><use href='%23w' x='414.9' y='170.9' fill='%23a7cff6'/><use href='%23w' x='507.1' y='170.9' fill='%23c9b6f2'/></svg>");
  background-size: 553.2px 180px;
  /* BG-END */
}

/* ---------- layout ---------- */
.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px 80px;
}

/* Header panel: same frost as the card, with a small gap above it. */
header.site {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 24px;
  padding: 24px 32px;
}

/* ---------- pastel glow ----------
   --mx / --my are the mouse position inside the header in percent (set by
   theme.js, 50/50 at rest). Each pastel blob is anchored at a different spot
   and drifts with the mouse at a different rate and direction, so moving the
   pointer pushes the colors around. Registered so they animate smoothly. */
@property --mx { syntax: "<number>"; inherits: true; initial-value: 50; }
@property --my { syntax: "<number>"; inherits: true; initial-value: 50; }

header.site {
  --mx: 50;
  --my: 50;
  transition: --mx 0.25s ease-out, --my 0.25s ease-out;
  --dx: calc((var(--mx) - 50) * 1%);
  --dy: calc((var(--my) - 50) * 1%);
  /* layer 1: three pastel blobs that drift against the cursor;
     layer 2: a full rainbow (two cycles wide) that slides with the cursor */
  --rainbow:
    radial-gradient(ellipse 18% 160% at calc(20% + var(--dx) * -0.8) calc(50% + var(--dy) * -0.8), #f6a7c1 0 25%, rgba(246,167,193,0) 100%),
    radial-gradient(ellipse 18% 160% at calc(50% + var(--dx) * -1.2) calc(50% + var(--dy) * 0.8),  #f3e48a 0 25%, rgba(243,228,138,0) 100%),
    radial-gradient(ellipse 18% 160% at calc(80% + var(--dx) * -0.8) calc(50% + var(--dy) * -0.6), #a7cff6 0 25%, rgba(167,207,246,0) 100%),
    linear-gradient(90deg, #f6a7c1, #f9c59b, #f3e48a, #a8e6c3, #a7cff6, #c9b6f2, #f6a7c1, #f9c59b, #f3e48a, #a8e6c3, #a7cff6, #c9b6f2, #f6a7c1);
  --rainbow-size: 100% 100%, 100% 100%, 100% 100%, 200% 100%;
  --rainbow-pos: 0 0, 0 0, 0 0, calc(var(--mx) * 1%) 0;
}

/* underline: a solid pastel bar just under the text, spanning the header's
   content width (inside the padding) */
header.site h1 {
  flex: 1;
  position: relative;
  padding-bottom: 0.14em;
}
header.site h1::after,
header.site h1::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0.1em;
  border-radius: 2px;
  pointer-events: none;
}
header.site h1::after {
  background: var(--rainbow);
  background-size: var(--rainbow-size);
  background-position: var(--rainbow-pos);
}
/* on hover anywhere in the header the bar fades to the text color */
header.site h1::before {
  z-index: 1;
  background: var(--ink);
  opacity: 0;
  transition: opacity 0.35s ease;
}
header.site:hover h1::before { opacity: 1; }

/* hover: the site name takes the same colors, with a blurred glow behind it */
header.site h1 a {
  position: relative;
  display: inline-block;
}
header.site h1 a::before,
header.site h1 a::after {
  content: attr(data-text);
  position: absolute;
  inset: 0 0 -0.4em;              /* extend below the line box so descenders stay painted */
  background: var(--rainbow);
  background-size: var(--rainbow-size);
  background-position: var(--rainbow-pos);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}
header.site h1 a::before { filter: blur(12px); }      /* the glow */
header.site h1 a:hover::before { opacity: 0.85; }
header.site h1 a:hover::after { opacity: 1; }
/* pastels are too faint on the light card; deepen them for the sharp text layer */
:root:not([data-theme="dark"]) header.site h1 a::after { filter: saturate(1.6) brightness(0.82); }

header.site h1 {
  margin: 0;
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

header.site h1 a {
  color: var(--ink);
  text-decoration: none;
}

/* ---------- theme toggle (temporary, fixed in the corner) ---------- */
.theme-toggle {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 10;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--toggle-border);
  background: var(--toggle-bg);
  color: var(--ink);
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: inline; }

/* ---------- frosted card ---------- */
.frost {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 28px 32px;
  backdrop-filter: blur(10px) saturate(130%);
  -webkit-backdrop-filter: blur(10px) saturate(130%);
  box-shadow: 0 10px 30px var(--card-shadow);
}

/* ---------- article list ---------- */
.section-title {              /* centered label with rules out to both edges */
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 10px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.section-title::before,
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}
.other { margin-top: 24px; }
.other .empty { margin: 4px 0; color: var(--muted); font-size: 0.95rem; }
.other .posts:not(:empty) + .empty { display: none; }   /* placeholder hides itself once the list has items */

.posts { list-style: none; margin: 0; padding: 0; }

.posts li {
  padding: 18px 0;
  border-bottom: 1px solid var(--rule);
}
.posts li:first-child { padding-top: 4px; }
.posts li:last-child { border-bottom: none; padding-bottom: 4px; }

.posts a {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}
.posts a:hover { color: var(--accent); text-decoration: underline dotted; text-underline-offset: 0.15em; }

.posts time,
.posts .sub,
.meta {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 2px;
}

.posts p { margin: 6px 0 0; color: var(--ink); }
.posts .sub a {                /* small secondary link on a project row */
  font-size: inherit;
  font-weight: 600;
  color: var(--muted);
  text-decoration: underline dotted;
  text-underline-offset: 0.15em;
}
.posts .sub a:hover { color: var(--accent); }

/* ---------- single post ---------- */
article h1 {
  margin: 0 0 4px;
  font-size: 2rem;
  line-height: 1.2;
}
article .meta { margin-bottom: 24px; }
article p { margin: 0 0 1em; }

/* "short version" callout at the top of a post */
.tldr {
  margin: 0 0 32px;
  padding: 16px 20px;
  border-radius: 10px;
  background: var(--video-bg);
  position: relative;
  overflow: hidden;              /* clips the stripe to the rounded corners */
}
.tldr::before {                  /* pastel stripe down the left edge */
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: linear-gradient(180deg, #f6a7c1, #f9c59b, #f3e48a, #a8e6c3, #a7cff6, #c9b6f2);
}
.tldr p { margin: 0 0 0.6em; }
.tldr p:last-child { margin-bottom: 0; }
.tldr-title { font-weight: 700; font-size: 1.05rem; }
article .tldr-link {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}
article .tldr-link:visited { color: #fff; }
article .tldr-link:hover, article .tldr-link:active { background: var(--accent-hover); color: #fff; text-decoration: none; }
:root[data-theme="dark"] article .tldr-link, :root[data-theme="dark"] article .tldr-link:visited { color: #14161c; }
:root[data-theme="dark"] article .tldr-link:hover { color: #14161c; }
article pre {
  background: var(--code-bg);
  padding: 12px 16px;
  border-radius: 10px;
  overflow-x: auto;
  font-size: 0.9rem;
}
code, pre, kbd { font-family: "IBM Plex Mono", ui-monospace, monospace; }
article img {
  max-width: 100%;
  height: auto;
  display: block;
  margin-left: auto;
  margin-right: auto;
  border-radius: 10px;
}

/* site footer: three outbound links with brand marks (paths from Simple Icons, CC0, inlined
   as data URIs so they also work when previewing over file://) */
.site-footer {
  margin-top: 24px;
  padding: 14px 24px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 28px;
}
.soc {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
}
.soc::before {
  content: "";
  width: 20px;
  height: 20px;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}
.soc:hover { color: var(--accent-hover); text-decoration: underline dotted; text-underline-offset: 0.2em; }
.soc[target="_blank"]::after { display: none; }   /* brand mark is enough; skip the external-link arrow */
.soc-github { --icon: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22%3E%3Cpath d=%22M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12%22/%3E%3C/svg%3E"); }
.soc-mastodon { --icon: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22%3E%3Cpath d=%22M23.268 5.313c-.35-2.578-2.617-4.61-5.304-5.004C17.51.242 15.792 0 11.813 0h-.03c-3.98 0-4.835.242-5.288.309C3.882.692 1.496 2.518.917 5.127.64 6.412.61 7.837.661 9.143c.074 1.874.088 3.745.26 5.611.118 1.24.325 2.47.62 3.68.55 2.237 2.777 4.098 4.96 4.857 2.336.792 4.849.923 7.256.38.265-.061.527-.132.786-.213.585-.184 1.27-.39 1.774-.753a.057.057 0 0 0 .023-.043v-1.809a.052.052 0 0 0-.02-.041.053.053 0 0 0-.046-.01 20.282 20.282 0 0 1-4.709.545c-2.73 0-3.463-1.284-3.674-1.818a5.593 5.593 0 0 1-.319-1.433.053.053 0 0 1 .066-.054c1.517.363 3.072.546 4.632.546.376 0 .75 0 1.125-.01 1.57-.044 3.224-.124 4.768-.422.038-.008.077-.015.11-.024 2.435-.464 4.753-1.92 4.989-5.604.008-.145.03-1.52.03-1.67.002-.512.167-3.63-.024-5.545zm-3.748 9.195h-2.561V8.29c0-1.309-.55-1.976-1.67-1.976-1.23 0-1.846.79-1.846 2.35v3.403h-2.546V8.663c0-1.56-.617-2.35-1.848-2.35-1.112 0-1.668.668-1.67 1.977v6.218H4.822V8.102c0-1.31.337-2.35 1.011-3.12.696-.77 1.608-1.164 2.74-1.164 1.311 0 2.302.5 2.962 1.498l.638 1.06.638-1.06c.66-.999 1.65-1.498 2.96-1.498 1.13 0 2.043.395 2.74 1.164.675.77 1.012 1.81 1.012 3.12z%22/%3E%3C/svg%3E"); }
.soc-kofi { --icon: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22%3E%3Cpath d=%22M11.351 2.715c-2.7 0-4.986.025-6.83.26C2.078 3.285 0 5.154 0 8.61c0 3.506.182 6.13 1.585 8.493 1.584 2.701 4.233 4.182 7.662 4.182h.83c4.209 0 6.494-2.234 7.637-4a9.5 9.5 0 0 0 1.091-2.338C21.792 14.688 24 12.22 24 9.208v-.415c0-3.247-2.13-5.507-5.792-5.87-1.558-.156-2.65-.208-6.857-.208m0 1.947c4.208 0 5.09.052 6.571.182 2.624.311 4.13 1.584 4.13 4v.39c0 2.156-1.792 3.844-3.87 3.844h-.935l-.156.649c-.208 1.013-.597 1.818-1.039 2.546-.909 1.428-2.545 3.064-5.922 3.064h-.805c-2.571 0-4.831-.883-6.078-3.195-1.09-2-1.298-4.155-1.298-7.506 0-2.181.857-3.402 3.012-3.714 1.533-.233 3.559-.26 6.39-.26m6.547 2.287c-.416 0-.65.234-.65.546v2.935c0 .311.234.545.65.545 1.324 0 2.051-.754 2.051-2s-.727-2.026-2.052-2.026m-10.39.182c-1.818 0-3.013 1.48-3.013 3.142 0 1.533.858 2.857 1.949 3.897.727.701 1.87 1.429 2.649 1.896a1.47 1.47 0 0 0 1.507 0c.78-.467 1.922-1.195 2.623-1.896 1.117-1.039 1.974-2.364 1.974-3.897 0-1.662-1.247-3.142-3.039-3.142-1.065 0-1.792.545-2.338 1.298-.493-.753-1.246-1.298-2.312-1.298%22/%3E%3C/svg%3E"); }

.back {
  display: inline-block;
  margin-bottom: 20px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.back:hover { text-decoration: underline dotted; text-underline-offset: 0.15em; }

/* ---------- external links ----------
   Any link that opens in a new tab gets a small "arrow out of a box" icon.
   The SVG is used as a mask so the icon takes the link's current color. */
a[target="_blank"]::after {
  content: "";
  display: inline-block;
  width: 0.75em;
  height: 0.75em;
  margin-left: 0.25em;
  vertical-align: -0.05em;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><path d='M14 4h6v6'/><path d='M20 4 10 14'/><path d='M18 13v6a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h6'/></svg>") no-repeat center / contain;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><path d='M14 4h6v6'/><path d='M20 4 10 14'/><path d='M18 13v6a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h6'/></svg>") no-repeat center / contain;
}

/* In-content links */
article a {
  color: var(--accent);
  text-decoration: underline dotted;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 0.15em;
}
article a:visited { color: var(--visited); }
article a:hover { color: var(--accent-hover); text-decoration-color: currentColor; }
article a:active { color: var(--active); }

/* ---------- image lightbox ---------- */
article img { cursor: zoom-in; }

.lightbox {
  border: none;
  padding: 0;
  background: transparent;
  max-width: 100vw;
  max-height: 100vh;
  width: 100vw;
  height: 100vh;
  cursor: zoom-out;
}
.lightbox::backdrop { background: rgba(0, 0, 0, 0.8); }

.lightbox figure {
  margin: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
}
.lightbox img {
  max-width: 100%;
  max-height: calc(100vh - 100px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.lightbox figcaption {
  color: #e8e9ee;
  font-size: 0.95rem;
  text-align: center;
  max-width: 60ch;
}
.lightbox-close {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font: inherit;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.15); }

/* ---------- scrubbable video ---------- */
.scrub { margin: 1.2em 0; }
.scrub video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px 10px 0 0;
  background: var(--video-bg);
  cursor: pointer;
}
.scrub-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--code-bg);
  border-radius: 0 0 10px 10px;
}
.scrub-play {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--toggle-border);
  background: var(--toggle-bg);
  color: var(--ink);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}
.scrub-play:hover { border-color: var(--accent); }
.scrub-play svg { width: 18px; height: 18px; fill: currentColor; }
.scrub-play .icon-play { display: none; }
.scrub.is-paused .scrub-play .icon-play { display: block; }
.scrub.is-paused .scrub-play .icon-pause { display: none; }

/* big, obvious slider: thick track with a progress fill and a large thumb */
.scrub-range {
  --p: 0%;
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 16px;
  margin: 0;
  border-radius: 8px;
  background: linear-gradient(to right, var(--accent) var(--p), var(--rule) var(--p));
  outline: none;
  cursor: grab;
}
.scrub-range:active { cursor: grabbing; }
.scrub-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--card-solid);
  border: 3px solid var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  cursor: grab;
}
.scrub-range::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--card-solid);
  border: 3px solid var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  cursor: grab;
}
.scrub-range:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--accent); outline-offset: 2px; }
.scrub-range:focus-visible::-moz-range-thumb { outline: 2px solid var(--accent); outline-offset: 2px; }

.scrub-hint {
  flex: none;
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}
.scrub figcaption {
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
}
@media (max-width: 520px) { .scrub-hint { display: none; } }

/* ---------- photo gallery ---------- */
.gallery { margin: 1.2em 0; }
.gallery-stage {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--video-bg);
  border-radius: 10px;
  overflow: hidden;
}
.gallery-track img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 0;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.gallery-track img.is-active { opacity: 1; pointer-events: auto; }

.gallery-prev,
.gallery-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.45);   /* fixed: must read over any photo in either theme */
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.gallery-prev { left: 12px; }
.gallery-next { right: 12px; }
.gallery-prev:hover, .gallery-next:hover { background: rgba(0, 0, 0, 0.65); }
.gallery-prev svg, .gallery-next svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }

.gallery-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 8px;
}
.gallery-count { font-size: 0.85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.gallery-dots { display: flex; gap: 8px; }
.gallery-dots button {
  width: 10px;
  height: 10px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--muted);
  background: transparent;
  cursor: pointer;
}
.gallery-dots button.is-active { background: var(--accent); border-color: var(--accent); }
/* 3D model gallery (model-viewer.js): one WebGL canvas fills the stage,
   the .model divs in the track only carry data */
.gallery-3d .gallery-track { display: none; }
.model-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: pan-y;            /* one finger still scrolls the page vertically */
}
.model-canvas.is-dragging { cursor: grabbing; }
.model-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 0 64px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
  pointer-events: none;
}
.model-status:empty { display: none; }
.model-hint {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  font-size: 0.75rem;
  color: var(--muted);
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 0.6s ease;
}
.gallery-3d.is-touched .model-hint, .gallery-3d.is-nogl .model-hint { opacity: 0; }
.gallery-3d:not(.is-armed) .model-hint { opacity: 0; }
.model-load {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 64px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.model-load svg {
  width: 44px;
  height: 44px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
  margin-bottom: 6px;
  transition: transform 0.3s ease;
}
.model-load:hover svg, .model-load:focus-visible svg { transform: translateY(-2px) scale(1.06); }
.model-load-label { font-weight: 600; }
.model-load-meta { font-size: 0.8rem; color: var(--muted); }
.model-load:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; border-radius: 10px; }
.gallery-download {
  font-size: 0.85rem;
  text-decoration: underline dotted;
  text-underline-offset: 0.15em;
}
.gallery-download:not([href]) { display: none; }

.gallery figcaption {
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
  min-height: 1.4em;
}
