/* ==========================================================================
   CSLIM BLOG — "Clockwork" palette
   Brand colours (given):  #919599  #F8F8F8  #CDCDCB  #FBA45C  #E56515
   Derived for text (the given grey/orange are too light to carry body text):
     --ink       #26282B  13.9:1 on --bg
     --ink-soft  #585C60   6.4:1 on --bg
     --link      #B4480A   5.1:1 on --bg
   Dark theme: same brand orange and grey, on near-black neutrals (all text pairs >= 4.5:1).
   Theme = the visitor's system setting, unless they use the switch next to the logo
   (stored as data-theme="light|dark" on <html>).
   ========================================================================== */

/* ---------- fonts (self-hosted, from /fonts) ---------- */
@font-face { font-family: "Teko"; font-weight: 300; font-style: normal; font-display: swap; src: url("../../fonts/Teko-Light.ttf") format("truetype"); }
@font-face { font-family: "Teko"; font-weight: 400; font-style: normal; font-display: swap; src: url("../../fonts/Teko-Regular.ttf") format("truetype"); }
@font-face { font-family: "Teko"; font-weight: 500; font-style: normal; font-display: swap; src: url("../../fonts/Teko-Medium.ttf") format("truetype"); }
@font-face { font-family: "Teko"; font-weight: 600; font-style: normal; font-display: swap; src: url("../../fonts/Teko-SemiBold.ttf") format("truetype"); }
@font-face { font-family: "Teko"; font-weight: 700; font-style: normal; font-display: swap; src: url("../../fonts/Teko-Bold.ttf") format("truetype"); }

:root {
  /* palette */
  --bg: #F8F8F8;
  --surface: #FFFFFF;
  --line: #CDCDCB;
  --muted: #919599;        /* decorative only: 2.8:1 on --bg */
  --accent-soft: #FBA45C;
  --accent: #E56515;

  /* text */
  --ink: #26282B;
  --ink-deep: #1B1D1F;
  --ink-soft: #585C60;
  --link: #B4480A;
  --on-accent: #1B1D1F;                 /* text that sits on solid orange (same in both themes) */

  /* dark panels: code blocks, the terminal window, the contact card */
  --strong-bg: #26282B;
  --strong-fg: #F8F8F8;
  --strong-muted: #CDCDCB;
  --strong-edge: transparent;

  /* surfaces and states that differ per theme */
  --hover-bg: rgb(205 205 203 / 0.55);
  --header-bg: rgb(248 248 248 / 0.94);
  --header-shadow: rgb(38 40 43 / 0.5);
  --code-bg: rgb(205 205 203 / 0.5);
  --empty-bg: rgb(255 255 255 / 0.5);
  --error: #B3261E;
  --disc: 0.28;

  /* type */
  --font-head: "Teko", "Arial Narrow", "Segoe UI", system-ui, sans-serif;
  --font-body: "Teko", "Arial Narrow", "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", Consolas, "SF Mono", Menlo, monospace;

  /* rhythm (4/8 scale) */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;
  --s-7: 3rem;
  --s-8: 4rem;
  --s-9: 6rem;

  --radius: 20px;
  --radius-sm: 12px;
  --maxw: 72rem;
  --gutter: clamp(1rem, 4vw, 2rem);

  --shadow: 0 1px 2px rgb(38 40 43 / 0.05), 0 12px 28px -16px rgb(38 40 43 / 0.28);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  color-scheme: light;
}

/* ---------- dark theme: chosen with the switch, or followed from the system ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141517;
  --surface: #1D1F22;
  --line: #34373B;
  --ink: #F8F8F8;
  --ink-deep: #FFFFFF;
  --ink-soft: #B4B8BC;
  --link: #FBA45C;
  --strong-bg: #0D0E10;
  --strong-fg: #F1F1F0;
  --strong-muted: #B4B8BC;
  --strong-edge: rgb(255 255 255 / 0.1);
  --hover-bg: rgb(255 255 255 / 0.09);
  --header-bg: rgb(20 21 23 / 0.92);
  --header-shadow: rgb(0 0 0 / 0.8);
  --code-bg: rgb(255 255 255 / 0.1);
  --empty-bg: rgb(255 255 255 / 0.03);
  --error: #FF8A80;
  --disc: 0.18;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.35), 0 12px 28px -16px rgb(0 0 0 / 0.75);
}
/* no JavaScript (so no data-theme yet): follow the system directly */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #141517;
    --surface: #1D1F22;
    --line: #34373B;
    --ink: #F8F8F8;
    --ink-deep: #FFFFFF;
    --ink-soft: #B4B8BC;
    --link: #FBA45C;
    --strong-bg: #0D0E10;
    --strong-fg: #F1F1F0;
    --strong-muted: #B4B8BC;
    --strong-edge: rgb(255 255 255 / 0.1);
    --hover-bg: rgb(255 255 255 / 0.09);
    --header-bg: rgb(20 21 23 / 0.92);
    --header-shadow: rgb(0 0 0 / 0.8);
    --code-bg: rgb(255 255 255 / 0.1);
    --empty-bg: rgb(255 255 255 / 0.03);
    --error: #FF8A80;
    --disc: 0.18;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.35), 0 12px 28px -16px rgb(0 0 0 / 0.75);
  }
}

/* ---------- reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 6rem; }   /* keeps focused/anchored items clear of the sticky header */
body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.4rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.1; margin: 0; letter-spacing: 0; color: var(--ink); }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: var(--link); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--accent-soft); color: var(--on-accent); }

.wrap { width: min(100% - 2 * var(--gutter), var(--maxw)); margin-inline: auto; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--s-4); top: -4rem; z-index: 100;
  background: var(--ink); color: var(--bg); padding: var(--s-3) var(--s-5);
  border-radius: 999px; font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: var(--s-4); }

/* Social icon buttons: GitHub + LinkedIn (header + footer) */
.social-link {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0;
  border-radius: 50%; color: var(--ink);
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease);
}
.social-link:hover { background: var(--ink); color: var(--bg); transform: translateY(-2px); }
.social { display: flex; align-items: center; justify-content: center; gap: var(--s-1); }
.social-link svg { width: 1.5rem; height: 1.5rem; }
.social-link--linkedin svg { width: 1.35rem; height: 1.35rem; }
/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 60;                 /* stays put while the page scrolls */
  padding-block: var(--s-4);
  background: var(--header-bg); border-bottom: 1px solid transparent;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .site-header { -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
}
.site-header.is-scrolled { border-bottom-color: var(--line); box-shadow: 0 10px 24px -20px var(--header-shadow); }
.site-header .wrap { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--s-4); }
.site-header .brand { justify-self: start; }
.site-header .nav { justify-self: end; }
@media (max-width: 68rem) {
  .site-header .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; }
  .social--header { display: none; }   /* no room next to four links; the footer icons stay */
}
@media (max-width: 47rem) {            /* two rows: logo + light/dark switch on top, then the menu across the full width */
  .site-header .theme-toggle { min-height: 40px; }
  .site-header { padding-block: var(--s-2); }
  .site-header .wrap { row-gap: 0; }
  .nav { flex: 1 1 100%; justify-content: space-between; }
  .site-header .brand { min-height: 36px; }
}
.brand {
  display: inline-flex; align-items: baseline; gap: var(--s-2);
  min-height: 44px; align-items: center; line-height: 1;
  font-family: var(--font-head); font-weight: 700; font-size: 2.188rem; letter-spacing: 0;
  color: var(--ink); text-decoration: none;
}
/* ---------- light / dark switch (next to the logo) ---------- */
.brand-group { display: flex; align-items: center; gap: var(--s-3); justify-self: start; }
.theme-toggle {
  display: none; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0 var(--s-1);
  background: none; border: 0; cursor: pointer; color: var(--ink);
}
.js .theme-toggle { display: inline-flex; }
.theme-toggle__track {
  position: relative; display: block; width: 3.25rem; height: 1.75rem; border-radius: 999px;
  background: var(--line); border: 1px solid var(--muted);
  transition: background-color 0.25s var(--ease), border-color 0.25s var(--ease);
}
.theme-toggle:hover .theme-toggle__track { border-color: var(--ink-soft); }
.theme-toggle__knob {
  position: absolute; top: 2px; left: 3px; display: grid; place-items: center; width: 1.375rem; height: 1.375rem;
  border-radius: 50%; background: var(--accent-soft); color: var(--on-accent);
  transition: transform 0.25s var(--ease);
}
:root[data-theme="dark"] .theme-toggle__knob { transform: translateX(1.375rem); }
.theme-toggle__icon { width: 0.95rem; height: 0.95rem; }
.theme-toggle__icon--moon { display: none; }
:root[data-theme="dark"] .theme-toggle__icon--sun { display: none; }
:root[data-theme="dark"] .theme-toggle__icon--moon { display: block; }

/* fade colours (not layout) for a moment when the switch is used */
html.theme-changing *:not(.theme-toggle__knob), html.theme-changing *:not(.theme-toggle__knob)::before, html.theme-changing *:not(.theme-toggle__knob)::after {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, fill 0.3s ease, stroke 0.3s ease !important;
}
.brand .dot { color: var(--accent); }
.brand small {
  font-family: var(--font-body); font-weight: 600; font-size: 0.945rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ink-soft); transform: translateY(2px);
}
.nav { position: relative; display: flex; align-items: center; gap: var(--s-1); }
.nav__link {
  position: relative; display: inline-flex; align-items: center; min-height: 44px; white-space: nowrap;
  padding-inline: var(--s-4); border-radius: 999px;
  color: var(--ink); font-weight: 500; text-decoration: none;
  transition: background-color 0.2s var(--ease);
}
.nav__link:hover { background: var(--hover-bg); }
.nav__link[aria-current]::after {
  content: ""; position: absolute; left: var(--s-4); right: var(--s-4); bottom: 6px;
  height: 3px; border-radius: 3px; background: var(--accent);
}

/* Blog fold-out: link + chevron form one pill; panel opens below */
.nav__item { display: flex; align-items: center; border-radius: 999px; transition: background-color 0.2s var(--ease); }
.nav__item:hover, .nav__item.is-open { background: var(--hover-bg); }
.nav__item .nav__link { padding-right: var(--s-1); }
.nav__item .nav__link:hover { background: none; }
.nav__item .nav__link[aria-current]::after { right: var(--s-1); }
.nav__toggle {
  display: none; align-items: center; justify-content: center; width: 2.5rem; height: 44px; padding: 0;
  border: 0; border-radius: 999px; background: none; color: var(--ink); cursor: pointer;
}
.js .nav__toggle { display: inline-flex; }
.nav__toggle svg { width: 1rem; height: 1rem; transition: transform 0.2s var(--ease); }
.nav__item.is-open .nav__toggle svg { transform: rotate(180deg); }
/* Special Service: a label that only opens a menu (it is not a link) */
.nav__trigger { font: inherit; font-weight: 500; background: none; border: 0; cursor: pointer; gap: var(--s-1); }
.nav__item .nav__trigger { padding-inline: var(--s-4) var(--s-3); }
.nav__trigger svg { width: 1rem; height: 1rem; transition: transform 0.2s var(--ease); }
.nav__item.is-open .nav__trigger svg { transform: rotate(180deg); }
.nav__menu--links a { gap: var(--s-3); }
.menu-icon { width: 1.25rem; height: 1.25rem; flex: none; color: var(--ink-soft); transition: color 0.2s var(--ease); }
img.menu-icon { object-fit: contain; }   /* the services' own logos (Overseerr, Pingvin Share, Morphos) */
img.menu-icon--round { border-radius: 50%; }   /* Morphos logo is a square image: crop to its circle */
.nav__menu--links a:hover .menu-icon, .nav__menu--links a:focus-visible .menu-icon { color: var(--link); }

.nav__menu {
  display: none; position: absolute; z-index: 50; top: calc(100% + 6px); right: 0;
  width: min(17rem, calc(100vw - 2 * var(--gutter))); padding: var(--s-2);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow);
  max-height: calc(100vh - 8rem); max-height: calc(100dvh - 8rem); overflow-y: auto; overscroll-behavior: contain;   /* a long list scrolls inside the menu instead of running off a short screen */
}
.js .nav__item.is-open .nav__menu { display: block; animation: menu-in 0.18s var(--ease) both; }
.nav__menu a {
  display: flex; align-items: center; min-height: 44px; padding-inline: var(--s-4); border-radius: 8px;
  color: var(--ink); font-weight: 500; text-decoration: none;
}
.nav__menu a:hover { background: var(--bg); }
.nav__menu a[aria-current] { background: rgb(251 164 92 / 0.22); color: var(--ink-deep); }
.nav__menu ul { margin: 0 0 var(--s-1) var(--s-5); padding-left: var(--s-2); border-left: 2px solid var(--line); }
.nav__menu ul a { font-weight: 400; color: var(--ink-soft); padding-inline: var(--s-3); }
.nav__menu ul a:hover { color: var(--ink); }
.nav__menu ul a[aria-current] { color: var(--ink-deep); font-weight: 500; }
@media (min-width: 40rem) {
  .nav__item { position: relative; }
  .nav__menu { right: auto; left: 50%; width: 17rem; margin-left: -8.5rem; }
}

/* ---------- type helpers ---------- */
.display {
  font-weight: 700; letter-spacing: 0; line-height: 0.85;
  font-size: clamp(4.688rem, 11vw, 9rem);
}
.display .dot, .h1 .dot { color: var(--accent); }
.h1 { font-weight: 700; letter-spacing: 0; line-height: 0.95; font-size: clamp(3.125rem, 7vw, 5.625rem); }
.lead {
  font-family: var(--font-head); font-weight: 400; color: var(--ink-soft);
  font-size: clamp(1.75rem, 2.6vw, 2.344rem); line-height: 1.2; max-width: 34ch;
}
.text { max-width: 68ch; }
.eyebrow {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-size: 1.118rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft);
}
.eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.h2 { font-weight: 700; font-size: clamp(2.188rem, 3.6vw, 3.125rem); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 48px; padding: 0 var(--s-5); border-radius: 999px; border: 2px solid transparent;
  font: 500 1.35rem/1 var(--font-body); text-decoration: none; cursor: pointer;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent-soft); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent); color: var(--on-accent); box-shadow: 0 10px 20px -12px var(--accent); }
.btn--ghost { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn--ghost:hover { background: var(--ink); color: var(--bg); }
.btn svg { width: 1.125rem; height: 1.125rem; transition: transform 0.2s var(--ease); }
.btn:hover svg { transform: translateX(3px); }

/* ---------- hero (about) ---------- */
.hero { border-bottom: 1px solid var(--line); overflow-x: clip; }
.hero .wrap {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  align-items: center; gap: clamp(2rem, 6vw, 5rem);
  padding-block: clamp(2rem, 6vw, 4.5rem) clamp(2.5rem, 6vw, 4.5rem);
}
.hero__copy { position: relative; z-index: 1; display: grid; gap: var(--s-5); justify-items: start; }
.hero__copy .lead { margin-top: var(--s-1); }
/* formatted text in the two About parts (written in the admin): links, code, headings, quotes, pictures */
.hero__copy a { color: var(--link); text-decoration: underline; text-underline-offset: 0.18em; }
.hero__copy a:hover { text-decoration-thickness: 2px; }
.hero__copy code { font-family: var(--font-mono); font-size: 0.75em; padding: 0.12em 0.4em; background: var(--code-bg); border-radius: 6px; }
.hero__copy .about-h { margin-top: var(--s-2); font-weight: 700; }
.hero__copy h2.about-h { font-size: clamp(1.75rem, 2.4vw, 2.188rem); }
.hero__copy h3.about-h { font-size: 1.625rem; }
.hero__copy .about-quote {
  margin: 0; padding: var(--s-2) var(--s-5); max-width: 60ch; border-left: 4px solid var(--accent-soft);
  color: var(--ink-soft); font-family: var(--font-head); font-size: 1.562rem; font-weight: 300; line-height: 1.3;
}
.hero__copy .about-figure { margin: var(--s-2) 0; width: 100%; max-width: 68ch; justify-self: start; }
.hero__copy .about-figure img { height: auto; border-radius: var(--radius-sm); }
.hero__copy .about-figure.w-75 { width: 75%; }
.hero__copy .about-figure.w-50 { width: 50%; }
.hero__copy .about-figure.w-25 { width: 25%; }
.hero__copy .about-figure figcaption { margin-top: var(--s-2); font-size: 1.0625rem; line-height: 1.4; color: var(--ink-soft); }
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-2); }

.portrait { position: relative; width: min(100%, 26rem); margin-inline: auto; isolation: isolate; }
.portrait::before {           /* soft warm disc behind the photo */
  content: ""; position: absolute; z-index: -2; inset: -6% -10% 18% 22%;
  border-radius: 50%; background: var(--accent-soft); opacity: var(--disc);
}
.portrait__frame {
  aspect-ratio: 4 / 5; overflow: hidden;
  border-radius: 999px 999px var(--radius) var(--radius);
  background: var(--line); box-shadow: var(--shadow);
}
.portrait__frame img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 24%; }
/* decorative network graph behind the photo */
.portrait__net { position: absolute; z-index: -1; top: -8%; right: -5%; width: 50%; height: auto; overflow: visible; }
.portrait__net path {
  fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; opacity: 0.7;
  stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 0.8s var(--ease) forwards; animation-delay: calc(var(--d, 0) * 1ms);
}
.portrait__net circle {
  fill: var(--surface); stroke: var(--accent); stroke-width: 3.5; opacity: 0;
  animation: fade-in 0.4s var(--ease) forwards; animation-delay: calc(var(--d, 0) * 1ms);
}

/* decorative PowerShell window overlapping the photo */
.portrait__term {
  position: absolute; z-index: 2; left: -14%; bottom: -7%; width: 64%;
  background: var(--strong-bg); color: var(--strong-fg); border-radius: 14px; overflow: hidden;
  font-family: var(--font-mono); font-size: 0.95rem; line-height: 1.5;
  box-shadow: 0 0 0 1px var(--strong-edge), 0 18px 36px -18px rgb(0 0 0 / 0.55), 0 2px 6px rgb(0 0 0 / 0.2);
  animation: rise 0.7s var(--ease) 0.6s both;
}
.term__bar {
  display: flex; align-items: center; gap: 6px; padding: 0.55rem 0.8rem;
  background: rgb(255 255 255 / 0.07); border-bottom: 1px solid rgb(255 255 255 / 0.08);
  font-size: 0.75rem; color: var(--strong-muted);
}
.term__bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.term__bar i:nth-child(2) { background: var(--accent-soft); }
.term__bar i:nth-child(3) { background: var(--accent); }
.term__bar span { margin-left: auto; letter-spacing: 0.04em; }
.term__body { padding: 0.75rem 0.9rem 0.85rem; }
.term__body p { white-space: nowrap; }
.term__line { opacity: 0; animation: type-in 0.4s var(--ease) forwards; animation-delay: var(--t, 0s); }
.term__prompt { color: var(--accent-soft); }
.term__out { color: var(--strong-muted); }
.term__cursor {
  display: inline-block; width: 0.6em; height: 1.05em; vertical-align: -0.18em;
  background: var(--accent-soft); animation: blink 1.1s steps(1) infinite;
}

/* ---------- sections ---------- */
.section { padding-block: clamp(2.5rem, 6vw, 5rem); }
.section--tight { padding-block: clamp(1.5rem, 4vw, 3rem); }
.section__head { display: grid; gap: var(--s-3); margin-bottom: var(--s-6); max-width: 40rem; }
.section__head p { color: var(--ink-soft); }
.section__head--row { max-width: none; display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: var(--s-4); }
.section__head--row > div { display: grid; gap: var(--s-3); }

/* ---------- page header (inner pages) ---------- */
.page-head { display: grid; gap: var(--s-5); padding-block: clamp(1.5rem, 5vw, 3.5rem) clamp(1.5rem, 4vw, 2.5rem); }
.page-head .lead { max-width: 60ch; }
.page-head + .rule, .rule { border: 0; border-top: 1px solid var(--line); margin: 0; }

.crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1) var(--s-2); font-size: 1.289rem; }
.crumbs li { display: inline-flex; align-items: center; gap: var(--s-2); }
.crumbs li + li::before { content: "/"; color: var(--muted); }
.crumbs a { color: var(--ink-soft); padding-block: var(--s-2); }
.crumbs [aria-current] { color: var(--ink); font-weight: 600; }

.pills { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.pills a {
  display: inline-flex; align-items: center; min-height: 44px; padding-inline: var(--s-4);
  border: 1.5px solid var(--line); border-radius: 999px; background: var(--surface);
  color: var(--ink); font-weight: 500; text-decoration: none;
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.pills a:hover { border-color: var(--accent); }
.pills a[aria-current] { background: var(--ink); border-color: var(--ink); color: var(--bg); }

/* ---------- cards ---------- */
.grid { display: grid; gap: var(--s-5); grid-template-columns: repeat(auto-fit, minmax(min(100%, 16.5rem), 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
.grid--fill .card__title { overflow-wrap: anywhere; }
.grid--fill { grid-template-columns: repeat(auto-fill, minmax(min(100%, 16.5rem), 1fr)); }   /* keeps a lone card card-sized */
.card {
  position: relative; display: flex; flex-direction: column; gap: var(--s-3);
  padding: var(--s-6) var(--s-5) var(--s-5);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); }
.card:focus-within { border-color: var(--accent); }
.card__icon {
  display: grid; place-items: center; width: 3rem; height: 3rem; margin-bottom: var(--s-2);
  border-radius: 14px; background: rgb(251 164 92 / 0.22); color: var(--ink-deep);
}
.card__icon svg { width: 1.5rem; height: 1.5rem; }
.card__title { font-size: 1.875rem; font-weight: 700; }
.card__title a { color: var(--ink); text-decoration: none; }
.card__title a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }   /* whole card is the hit area */
.card__title a:focus-visible { outline: none; }
.card:has(.card__title a:focus-visible) { outline: 3px solid var(--ink); outline-offset: 3px; }
.card__text { color: var(--ink-soft); font-size: 1.375rem; line-height: 1.3; }
.card__more {
  margin-top: auto; padding-top: var(--s-3); display: inline-flex; align-items: center; gap: var(--s-2);
  font-weight: 600; color: var(--link);
}
.card__more svg { width: 1.125rem; height: 1.125rem; transition: transform 0.2s var(--ease); }
.card:hover .card__more svg { transform: translateX(4px); }
.card__chips { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-2); }
.chip {
  padding: 0.2rem 0.7rem; border-radius: 999px; background: var(--bg); border: 1px solid var(--line);
  font-size: 1.203rem; color: var(--ink-soft);
}

/* ---------- post list ---------- */
.posts { display: grid; gap: var(--s-4); }
.post {
  position: relative; display: grid; gap: var(--s-2); padding: var(--s-5);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.post:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow); }
.post:has(a:focus-visible) { outline: 3px solid var(--ink); outline-offset: 3px; }
.post__meta { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); font-size: 1.203rem; color: var(--ink-soft); }
.post__tag { font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; font-size: 1.032rem; color: var(--link); }
.post__title { font-size: 1.719rem; font-weight: 700; }
.post__title a { color: var(--ink); text-decoration: none; }
.post__title a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.post__title a:focus-visible { outline: none; }
.post__summary { color: var(--ink-soft); max-width: 80ch; }

.empty {
  padding: var(--s-6) var(--s-5); text-align: center; color: var(--ink-soft);
  border: 1.5px dashed var(--muted); border-radius: var(--radius); background: var(--empty-bg);
}
.empty strong { display: block; font-family: var(--font-head); font-size: 1.562rem; color: var(--ink); margin-bottom: var(--s-1); }

/* ---------- search (the blog page, every category and every subcategory) ---------- */
.search { position: relative; display: flex; align-items: center; max-width: 40rem; }
.search[hidden], .search-results[hidden] { display: none; }
.search__icon { position: absolute; inset-inline-start: var(--s-4); display: grid; place-items: center; color: var(--ink-soft); pointer-events: none; }
.search__icon svg { width: 1.25rem; height: 1.25rem; }
.search__input {
  width: 100%; min-height: 52px; padding: var(--s-3) 3.25rem var(--s-3) 3rem;
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--muted); border-radius: 999px; -webkit-appearance: none; appearance: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background-color 0.2s var(--ease);
}
.search__input::-webkit-search-cancel-button, .search__input::-webkit-search-decoration { -webkit-appearance: none; display: none; }   /* the page has its own clear button */
.search__input::placeholder { color: var(--ink-soft); opacity: 1; }
.search__input:hover { border-color: var(--ink-soft); }
.search__input:focus-visible { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px rgb(251 164 92 / 0.55); }
.search__clear {
  position: absolute; inset-inline-end: var(--s-2); display: grid; place-items: center; width: 2.5rem; height: 2.5rem;
  border: 0; border-radius: 50%; background: transparent; color: var(--ink-soft); cursor: pointer;
}
.search__clear[hidden] { display: none; }
.search__clear svg { width: 1.1rem; height: 1.1rem; }
.search__clear:hover { background: var(--hover-bg); color: var(--ink); }
.search__clear:focus-visible { outline: 3px solid var(--ink); outline-offset: 1px; }
/* while something is typed, the results take the place of the rest of the page (the title, the search bar and the menus stay) */
#main.is-searching > .section:not(.search-results), #main.is-searching > .rule { display: none; }
.search-results__status { margin: 0 0 var(--s-5); font-size: 1.35rem; color: var(--ink-soft); }
.post mark { padding: 0 0.12em; border-radius: 3px; background: rgb(251 164 92 / 0.45); color: inherit; }

/* post cards side by side (About Me page): 5 across on desktop, swipeable row below that */
.posts--cards {
  display: flex; gap: var(--s-4); overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
  margin-inline: calc(-1 * var(--gutter)); padding: var(--s-2) var(--gutter) var(--s-4); scroll-padding-inline: var(--gutter);
}
.posts--cards::-webkit-scrollbar { display: none; }
.posts--cards .post {
  flex: 0 0 min(78%, 16rem); scroll-snap-align: start;
  grid-template-rows: auto auto 1fr auto; align-content: start; gap: var(--s-2); padding: var(--s-5) var(--s-4) var(--s-4);
}
.posts--cards .post__meta { gap: 0 var(--s-3); }
.posts--cards .post__tag { flex-basis: 100%; }
.posts--cards .post__title { font-size: 1.6rem; line-height: 1.05; overflow-wrap: anywhere; }
.posts--cards .post__summary {
  font-size: 1.2rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
}
.post__more { margin-top: var(--s-2); font-weight: 600; color: var(--link); }
.posts--cards .empty { flex: 1 0 100%; }
@media (min-width: 68rem) {
  .posts--cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); overflow: visible; margin-inline: 0; padding: 0; }
  .posts--cards .post { flex: initial; }
  .posts--cards .empty { grid-column: 1 / -1; }
}
/* carousel arrows (shown only while the card row is scrollable) */
.carousel { position: relative; }
.carousel__btn {
  display: none; position: absolute; z-index: 3; top: calc(50% - 4px); transform: translateY(-50%);
  align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0;
  border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow); cursor: pointer;
  transition: opacity 0.2s var(--ease), background-color 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.carousel__btn svg { width: 1.25rem; height: 1.25rem; }
.carousel__btn--prev { left: calc(-1 * var(--gutter) + 8px); }
.carousel__btn--next { right: calc(-1 * var(--gutter) + 8px); }
.carousel__btn:hover { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.carousel__btn:disabled { opacity: 0; pointer-events: none; }
.js .carousel.is-scrollable .carousel__btn { display: inline-flex; }
@media (min-width: 68rem) { .js .carousel.is-scrollable .carousel__btn { display: none; } }
/* ---------- article ---------- */
.article-head { display: grid; gap: var(--s-4); padding-block: clamp(1.5rem, 5vw, 3.5rem) var(--s-6); max-width: 48rem; }
.article-head .post__meta { font-size: 1.289rem; }
.prose { max-width: 84ch; padding-bottom: var(--s-8); }
.prose > * + * { margin-top: var(--s-4); }
.prose h2 { font-size: 2.188rem; font-weight: 700; margin-top: var(--s-7); }
.prose h3 { font-size: 1.625rem; font-weight: 700; margin-top: var(--s-6); }
.prose ul, .prose ol { padding-left: 1.4rem; list-style: revert; }
.prose li + li { margin-top: var(--s-2); }
.prose li::marker { color: var(--accent); }
.prose code {
  font-family: var(--font-mono); font-size: 0.75em; padding: 0.12em 0.4em;
  background: var(--code-bg); border-radius: 6px;
}
.prose pre {
  margin-block: var(--s-5); padding: var(--s-5); overflow-x: auto;
  background: var(--strong-bg); color: var(--strong-fg); border-radius: var(--radius-sm); line-height: 1.6; font-size: 0.9375rem;
  box-shadow: 0 0 0 1px var(--strong-edge);
}
.prose pre code { background: none; padding: 0; font-size: inherit; }
/* syntax colours: c comment, k keyword, s string, n number, f function/command, v variable, a attribute/option.
   The panel is dark in both themes, so these are light colours (all above 7:1 on it). */
.prose pre { --tok-c: #A0A5A9; --tok-k: var(--accent-soft); --tok-s: #A9D9A0; --tok-n: #8EC5F0; --tok-f: #F2D68A; --tok-v: #C9B8F0; --tok-a: #7FD3CF; }
/* pictures: the width/height attributes only reserve space; height:auto keeps the proportions when the picture is
   narrowed to fit the column (without it the picture is squashed). w-75 / w-50 / w-25 are the sizes set in the admin. */
.prose figure { margin: var(--s-6) auto; }
.prose figure img { height: auto; margin-inline: auto; border-radius: var(--radius-sm); }
.prose figure.w-75 { width: 75%; }
.prose figure.w-50 { width: 50%; }
.prose figure.w-25 { width: 25%; }
/* a download link to a file attached in the admin: a small card with the link text, the file type and its size */
.prose .download { margin-block: var(--s-4); }
.prose .download__link {
  display: inline-flex; align-items: center; gap: var(--s-3); max-width: 100%; padding: var(--s-3) var(--s-5) var(--s-3) var(--s-3);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); text-decoration: none;
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.prose .download__link:hover, .prose .download__link:focus-visible { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.download__icon { flex: none; display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 12px; background: rgb(251 164 92 / 0.22); color: var(--link); }
.download__icon svg { width: 1.6rem; height: 1.6rem; }
.download__text { display: grid; gap: 2px; min-width: 0; line-height: 1.15; }
.download__label { font-weight: 600; font-size: 1.4rem; overflow-wrap: anywhere; }
.download__meta { font-size: 1.1rem; color: var(--ink-soft); }
.prose figcaption { margin-top: var(--s-2); font-size: 1.0625rem; line-height: 1.4; text-align: center; color: var(--ink-soft); }
@media (max-width: 40rem) { .prose figure.w-50 { width: 75%; } .prose figure.w-25 { width: 50%; } }   /* keep small pictures usable on phones */
.prose pre .c { color: var(--tok-c); font-style: italic; }
.prose pre .k { color: var(--tok-k); }
.prose pre .s { color: var(--tok-s); }
.prose pre .n { color: var(--tok-n); }
.prose pre .f { color: var(--tok-f); }
.prose pre .v { color: var(--tok-v); }
.prose pre .a { color: var(--tok-a); }
.prose pre[data-lang] { position: relative; padding-top: calc(var(--s-5) + 0.9rem); }
.prose pre[data-lang]::before {
  content: attr(data-lang); position: absolute; top: var(--s-2); right: var(--s-4); pointer-events: none;
  font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--strong-muted);
}
.prose blockquote {
  margin-inline: 0; padding: var(--s-2) var(--s-5); border-left: 4px solid var(--accent-soft);
  color: var(--ink-soft); font-family: var(--font-head); font-size: 1.562rem; font-weight: 300;
}
.callout {
  padding: var(--s-4) var(--s-5); border-radius: var(--radius-sm); background: rgb(251 164 92 / 0.18);
  border-left: 4px solid var(--accent); color: var(--ink);
}

/* ---------- contact ---------- */
.contact { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: clamp(1.5rem, 5vw, 4rem); align-items: stretch; }   /* form box matches the height of the right column */
.form { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto auto; gap: var(--s-5); padding: clamp(1.25rem, 3vw, 2.25rem); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.field { display: grid; gap: var(--s-2); }
.field:has(> textarea) { grid-template-rows: auto minmax(0, 1fr) auto; }   /* message box absorbs any extra height */
.field label { font-weight: 600; }
.field .req { color: var(--link); }
.field .hint { font-size: 1.203rem; color: var(--ink-soft); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 48px; padding: var(--s-3) var(--s-4);
  font: inherit; color: var(--ink); background: var(--bg);
  border: 1.5px solid var(--muted); border-radius: var(--radius-sm);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background-color 0.2s var(--ease);
}
.field textarea { min-height: 9rem; height: 100%; resize: vertical; line-height: 1.4; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--ink-soft); }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible {
  outline: none; border-color: var(--ink); background: var(--surface); box-shadow: 0 0 0 4px rgb(251 164 92 / 0.55);
}
.field input:user-invalid, .field textarea:user-invalid { border-color: var(--error); }
.field .error { display: none; font-size: 1.203rem; color: var(--error); font-weight: 500; }
.field input:user-invalid ~ .error, .field textarea:user-invalid ~ .error { display: block; }
.form__status { min-height: 1.5rem; font-weight: 500; color: var(--ink-soft); }
.form__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-4); }

.aside-card { display: grid; gap: var(--s-4); padding: var(--s-6) var(--s-5); background: var(--strong-bg); color: var(--strong-fg); border-radius: var(--radius); box-shadow: 0 0 0 1px var(--strong-edge); }
.aside-card h2 { color: var(--strong-fg); font-size: 1.875rem; }
.aside-card p { color: var(--strong-muted); }
.aside-card a { color: var(--accent-soft); font-weight: 600; overflow-wrap: anywhere; }
.aside-card a:hover { color: #fff; }
.aside-card :focus-visible { outline-color: var(--accent-soft); }
.contact__side { display: grid; align-content: start; gap: var(--s-5); }
.contact__side figure { margin: 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); background: var(--surface); }
.contact__side figure img { width: 100%; height: auto; }

/* ---------- 404 ---------- */
.notfound { display: grid; gap: var(--s-6); justify-items: center; text-align: center; padding-block: clamp(1.5rem, 5vw, 3.5rem) var(--s-8); }
.notfound .hero__actions { justify-content: center; }
.notfound figure { margin: 0; width: min(100%, 44rem); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line); }
.notfound img { width: 100%; height: auto; }

/* ---------- pet the cat ---------- */
.cat .wrap { display: grid; justify-items: center; gap: var(--s-6); text-align: center; }
.cat .h2 { max-width: 44ch; }
.pet {
  position: relative; display: block; width: min(100%, 24rem); aspect-ratio: 3 / 4; padding: 0; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--line); box-shadow: var(--shadow);
  cursor: grab;                      /* open hand */
  -webkit-tap-highlight-color: transparent;
}
.pet:active { cursor: grab; }        /* keep the palm open while clicking */
.pet__img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transition: opacity 0.5s var(--ease);
}
.pet__img--pet { opacity: 0; }
.pet:focus-visible .pet__img--pet, .pet.is-petted .pet__img--pet { opacity: 1; }
.pet:focus-visible .pet__img--stare, .pet.is-petted .pet__img--stare { opacity: 0; }
@media (hover: hover) {
  .pet:hover .pet__img--pet { opacity: 1; }
  .pet:hover .pet__img--stare { opacity: 0; }
}
/* Christmas: Santa hats on the cat photos (html.is-christmas is set by site.js on 24, 25 and 26 December) */
.pet__hat {
  display: none; position: absolute; height: auto; pointer-events: none;
  filter: drop-shadow(0 3px 5px rgb(0 0 0 / 0.35)); transition: opacity 0.5s var(--ease);
}
.is-christmas .pet__hat { display: block; }
.pet__hat--stare { width: 31%; left: 22%; top: 5.5%; transform: rotate(-8deg); }
.pet__hat--pet { width: 27%; left: 20.5%; top: 22.5%; transform: rotate(-18deg); opacity: 0; }
.pet:focus-visible .pet__hat--pet, .pet.is-petted .pet__hat--pet { opacity: 1; }
.pet:focus-visible .pet__hat--stare, .pet.is-petted .pet__hat--stare { opacity: 0; }
@media (hover: hover) {
  .pet:hover .pet__hat--pet { opacity: 1; }
  .pet:hover .pet__hat--stare { opacity: 0; }
}
/* ---------- footer ---------- */
.site-footer { margin-top: var(--s-8); border-top: 1px solid var(--line); padding-block: var(--s-6); font-size: 1.289rem; color: var(--ink-soft); }
/* copyright on the left, the social icons on the right (stacked and centred on phones) */
.site-footer .wrap { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: var(--s-3) var(--s-6); }
.site-footer p { justify-self: start; }
.site-footer .social { justify-self: end; }
.site-footer a { display: inline-flex; align-items: center; min-height: 44px; padding-inline: var(--s-2); color: var(--ink-soft); }
.site-footer a:hover { color: var(--link); }
.site-footer .social-link { padding: 0; min-height: 44px; color: var(--ink); }
.site-footer .social-link:hover { color: var(--bg); }
@media (max-width: 40rem) {
  .site-footer .wrap { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .site-footer p, .site-footer .social { justify-self: center; }
}

/* ---------- motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade-in { to { opacity: 1; } }
@keyframes type-in { from { opacity: 0; transform: translateX(-4px); } to { opacity: 1; transform: none; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes menu-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.reveal { animation: rise 0.7s var(--ease) both; animation-delay: calc(var(--i, 0) * 90ms); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { animation: none; }
  .js .nav__item.is-open .nav__menu { animation: none; }
  .nav__toggle svg, .nav__trigger svg { transition: none; }
  .pet__img, .pet__hat { transition: none; }
  .carousel__btn { transition: none; }
  .portrait__net path { animation: none; stroke-dashoffset: 0; }
  .portrait__net circle, .term__line { animation: none; opacity: 1; }
  .portrait__term { animation: none; }
  .term__cursor { animation: none; }
  .card, .post, .btn, .btn svg, .card__more svg { transition: none; }
  .card:hover, .post:hover, .social-link:hover, .prose .download__link:hover, .prose .download__link:focus-visible { transform: none; }
  .theme-toggle__knob, .theme-toggle__track { transition: none; }
  html.theme-changing *, html.theme-changing *::before, html.theme-changing *::after { transition: none !important; }
}

/* ---------- responsive ---------- */
@media (max-width: 52rem) {
  .hero .wrap { grid-template-columns: 1fr; }
  .portrait { width: min(80%, 21rem); }
  .contact { grid-template-columns: 1fr; }
}
@media (max-width: 33rem) {            /* phones: compact menu row (the four links must fit one line, or wrap as whole links) */
  .nav { flex-wrap: wrap; }
  .nav__link { padding-inline: 0.375rem; font-size: 1.2rem; }
  .nav__link[aria-current]::after { left: 0.375rem; right: 0.375rem; }
  .nav__item .nav__link { padding-right: 0; }
  .nav__item .nav__link[aria-current]::after { right: 0; }
  .nav__toggle { width: 2rem; }
  .nav__item .nav__trigger { padding-inline: 0.375rem 0.125rem; gap: 0; }
  .nav__trigger svg { width: 0.9rem; height: 0.9rem; }
}
@media (max-width: 30rem) {
  .brand small { display: none; }
  .site-header .wrap { gap: var(--s-2); }
  .brand { font-size: 1.75rem; }
  .hero__actions .btn { flex: 1 1 100%; }
}
@media (max-width: 23rem) {            /* foldable cover displays and other very narrow screens */
  .nav__link { font-size: 1.1rem; padding-inline: 0.3rem; }
  .nav__link[aria-current]::after { left: 0.3rem; right: 0.3rem; }
  .nav__item .nav__trigger { padding-inline: 0.3rem 0.1rem; }
  .h1 { font-size: 2.4rem; }
}
@media (max-width: 20.5rem) {
  .nav { justify-content: center; }
}
