/* =========================================================================
   v1-polish: layered on top of style.css. Layout is v1's; this file only
   re-tunes colour, type and motion.
   Motion vocabulary borrowed from the references:
   - Letter: expo-out reveals (0.75s, cubic-bezier(0.19,1,0.22,1)), 1rem rise
   - Shelby: word-by-word headline reveal, section colour shift, hide-on-scroll bar
   - Luro:   coloured glow stacks (never grey shadows), stroke draw-on, slow breathing
   ========================================================================= */

:root {
  /* surfaces */
  --bg: #0e0e11;
  --page-bg: var(--bg);
  --surface: #17151c;
  --surface-2: #1d1a24;
  --bg-rgb: 14, 14, 17;
  --mint-rgb: 119, 226, 195;
  --violet-rgb: 193, 143, 252;
  --pink-rgb: 243, 148, 200;
  --scroll: #2a2733;
  --tint: #131119;
  --tint-a: #16131d; --tint-b: #0e1619; --tint-c: #1b1217;   /* per-section background shift */
  --btn-paper: var(--violet); --btn-code: var(--mint); --btn-site: #92c2f7; --btn-model: #f0c27a; --btn-pkg: #e2cfa8;
  --logo-filter: grayscale(1) brightness(0.72) contrast(1.05);
  --hair: rgba(255, 255, 255, 0.12);
  --hair-faint: rgba(255, 255, 255, 0.06);

  /* text */
  --text: #f0eff4;   /* cool, same hue family as the greys */
  --text-2: #d6d5dc;
  --muted: #a3a2ad;
  --dim: #85848f;   /* 5.2:1 on --bg */

  /* the v1 palette, reduced to three jobs */
  /* evened out in OKLCH: similar lightness, less chroma, same hues */
  --mint: #77e2c3;     /* code keywords, hover, underlines */
  --violet: #c18ffc;   /* types, primary accent */
  --pink: #f394c8;     /* strings + whatever is current ("now"), nothing else */

  /* quieter glow: hover feedback only */
  --glow-violet: 0 0 28px 0 rgba(var(--violet-rgb), 0.26), 0 0 80px -24px rgba(var(--violet-rgb), 0.3);
  --glow-hover: 0 0 24px -8px rgba(var(--violet-rgb), 0.45);

  /* type */
  --sans: "Cereal", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* motion */
  --ease-expo: cubic-bezier(0.19, 1, 0.22, 1);
  --ease-soft: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-shelby: cubic-bezier(0.59, 0.06, 0.1, 1);
}

/* ---------- base ---------------------------------------------------------- */
html, body { background-color: var(--page-bg); }
body {
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* background follows scroll position (see v1-polish.js), no time-based transition */
}
html.lenis, html.lenis body { height: auto; }
html.lenis { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }
::selection { background: rgba(var(--violet-rgb), 0.35); color: #fff; }
html { scrollbar-color: var(--scroll) var(--bg); caret-color: var(--mint); }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; border-radius: 4px; }
[id] { scroll-margin-top: 84px; }

/* ---------- links -------------------------------------------------------- */
a:link, a:visited { color: var(--text); }
a:hover { color: var(--mint); }
.work-title a, .work-text a, .pub-title a, #description a, .card-text a {
  text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--text) 30%, transparent);
  text-decoration-thickness: 1px; text-underline-offset: 0.2em;
  transition: color 0.3s var(--ease-shelby), text-decoration-color 0.3s var(--ease-shelby);
}
.work-title a:hover, .work-text a:hover, .pub-title a:hover, #description a:hover, .card-text a:hover { color: var(--mint); text-decoration-color: var(--mint); }

/* ---------- hero --------------------------------------------------------- */
.open { background-color: var(--bg); }
#gradient-canvas {   /* hero gradient rebuilt from the palette: deep mint-teal + muted violet */
  --gradient-color-1: #0e0e11; --gradient-color-2: #033633; --gradient-color-3: #311852; --gradient-color-4: #1a1923;
}
.open::after {   /* fade the hero into the page: no seam into About */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 24vh; z-index: 1; pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--page-bg));
}
.code-snippet { text-shadow: none; }
.hero-link, .hero-link:link, .hero-link:visited, .hero-link:hover { color: var(--text); display: block; width: fit-content; }


.code {
  margin: 0;
  overflow: visible;
  font-family: var(--mono);
  font-size: clamp(1.25rem, 3vw, 2.45rem);
  font-weight: 400;
  line-height: 1.38;
  letter-spacing: -0.01em;
  color: var(--text);
  white-space: pre;
}
.code[hidden], .variant-file[hidden] { display: none !important; }
.code .line { display: block; }
.code .line + .line { margin-top: 0.06em; }
.tk-kw  { color: var(--mint); font-weight: 500; }
.tk-fn  { color: var(--text); font-weight: 700; }
.tk-ty  { color: var(--violet); }
.tk-str { color: var(--pink); }
.tk-com { color: var(--dim); font-style: italic; }
.nb { white-space: nowrap; }

/* the return value: the name (h1) and the ways to reach him */
.hero-out { margin-top: 1.9rem; font-family: var(--mono); }
.out-call { margin: 0 0 0.35rem; font-size: clamp(0.85rem, 1.1vw, 1rem); color: var(--muted); }
.out-prompt { color: var(--dim); margin-right: 0.5rem; }
.hero-name {
  margin: 0;
  font-family: var(--mono); font-weight: 500;
  font-size: clamp(1.05rem, 1.75vw, 1.5rem);
  line-height: 1.4; letter-spacing: -0.01em;
  color: var(--pink);
  text-wrap: balance;
}
.hero-name .q { color: var(--pink); }
.hero-links { display: flex; flex-wrap: wrap; gap: 0.4rem 1.6rem; margin: 1.1rem 0 0; font-size: 0.9rem; }
.hero-links a:link, .hero-links a:visited {
  display: inline-flex; align-items: center; min-height: 44px;
  color: var(--text);
  text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--text) 30%, transparent);
  text-decoration-thickness: 1px; text-underline-offset: 0.35em;
  transition: color 0.3s var(--ease-shelby), text-decoration-color 0.3s var(--ease-shelby);
}
.hero-links a:hover { color: var(--mint); text-decoration-color: var(--mint); }

/* typewriter (wide screens, motion allowed): each line's width steps from 0 to its char count */
html.js.motion.can-type .code .line {
  width: 0; overflow: hidden;
  box-sizing: content-box;
  border-right: 0.08em solid transparent;
}
html.js.motion.can-type .code .line.typing {
  width: calc(var(--ch) * 1ch);
  transition: width calc(var(--ch) * 26ms) steps(var(--ch), end);
  border-right-color: var(--mint);
}
html.js.motion.can-type .code .line.done { width: calc(var(--ch) * 1ch); border-right-color: transparent; }
html.js.motion.can-type .code .line.done.caret { border-right-color: var(--mint); }
html.fx-lines.motion .code .line.done.caret { animation: caret 1.05s steps(1) infinite; }
html:not(.fx-lines) .code .line.done.caret { border-right-color: transparent; }

/* narrow screens: lines wrap with a hanging indent and fade in instead */
@media (max-width: 639.98px) {
  .code { white-space: pre-wrap; font-size: 1.12rem; }
  .code .line { padding-left: 2ch; text-indent: -2ch; }
  html.js.motion .code .line { opacity: 0; transform: translateY(0.5rem); transition: opacity 0.6s var(--ease-soft), transform 0.75s var(--ease-expo); }
  html.js.motion .code .line.done { opacity: 1; transform: none; }
}

html.js.motion .hero-out { opacity: 0; transform: translateY(0.6rem); transition: opacity 0.8s var(--ease-soft), transform 0.9s var(--ease-expo); }
html.js.motion .hero-out.is-in { opacity: 1; transform: none; }

.scroll-cue, .scroll-cue:link, .scroll-cue:visited {
  position: absolute; left: 50%; bottom: 2rem; z-index: 3;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
  font-family: var(--mono); font-size: 0.56rem; letter-spacing: 0.14em; text-transform: lowercase;
  color: var(--dim);
  transition: color 0.3s var(--ease-shelby);
}
.scroll-cue:hover { color: var(--mint); }
.scroll-cue svg { width: 8px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1; }
html.fx-lines.motion .scroll-cue path { stroke-dasharray: 24; stroke-dashoffset: 24; animation: cue-draw 2.6s var(--ease-expo) 2.2s infinite; }

/* ---------- top bar (appears once you leave the hero) ------------------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  height: 60px; padding: 0 clamp(16px, 4vw, 48px);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg);
  border-bottom: 1px solid var(--hair-faint);
  font-family: var(--mono); font-size: 0.8rem;
  transform: translateY(-101%); visibility: hidden;
  transition: transform 0.55s var(--ease-expo), visibility 0s linear 0.55s, background-color 0.4s var(--ease-shelby), border-color 0.4s;
}
.topbar.is-visible { transform: none; visibility: visible; transition: transform 0.55s var(--ease-expo), visibility 0s, background-color 0.4s var(--ease-shelby), border-color 0.4s; }
/* scrolling down with "scroll feel" on: the bar tucks away but CV stays pinned */
.topbar:focus-within { transform: none; visibility: visible; }
.topbar a:link, .topbar a:visited { color: var(--muted); }
.topbar a:hover, .topbar a[aria-current="true"] { color: var(--mint); }
.topbar-name:link, .topbar-name:visited { color: var(--text) !important; font-weight: 500; }
.topbar-nav { display: flex; align-items: center; gap: clamp(0.9rem, 2vw, 1.8rem); }
.topbar-nav a { display: inline-flex; align-items: center; min-height: 44px; }
.topbar-cv:link, .topbar-cv:visited {
  min-height: 36px !important;
  color: var(--text) !important;
  border: 1px solid var(--hair); border-radius: 999px; padding: 0.35rem 0.9rem;
  transition: border-color 0.4s ease-in-out, box-shadow 0.4s ease-in-out, color 0.3s, background-color 0.4s;
}
.topbar-cv:hover { border-color: var(--violet); box-shadow: var(--glow-hover); }
@media (max-width: 720px) { .topbar-nav a:not(.topbar-cv) { display: none; } }

/* ---------- section heads ---------------------------------------------- */
.title, .sub-title {
  margin-top: 0;
  font-family: var(--sans);
  font-weight: 700;
  font-size: clamp(2.4rem, 4.8vw, 3.75rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
  color: var(--text);
  text-wrap: balance;
}
.title { margin-top: 4.5rem; }
.sub-title { font-size: clamp(1.8rem, 3vw, 2.5rem); letter-spacing: -0.028em; }

/* ---------- about ------------------------------------------------------- */
#description {
  margin-top: 2rem;
  font-family: var(--sans);
  font-weight: 400;
  font-size: clamp(1.3rem, 2.1vw, 1.75rem);
  line-height: 1.42;
  letter-spacing: -0.012em;
  color: var(--text);
}
.kw { font-family: var(--mono); font-weight: 500; letter-spacing: -0.02em; }
.kw-a { color: var(--violet); }
.kw-b { color: var(--mint); }

/* About: intro + contacts on the left, a small "at a glance" readout on the right.
   The readout is the output of ro.basic_info(), the call the hero makes. */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 1fr);
  grid-template-rows: auto 1fr;
  column-gap: clamp(2.5rem, 7vw, 7rem);
  margin: 0;
  align-items: start;
}
.about-grid > [class*="col-"] { width: auto; max-width: none; flex: none; padding: 0; margin: 0; }
.about-text { grid-column: 1; grid-row: 1; }
.about-contacts { grid-column: 1; grid-row: 2; align-self: start; margin-top: 2.25rem !important; letter-spacing: normal; }
.about-photo { grid-column: 2; grid-row: 1 / span 2; align-self: start; margin-top: 2.3rem !important; }
.about-contacts .fa-icon { margin-top: 0.75rem !important; }
.about-contacts .sub-title { margin-top: 0; }

#description { font-size: clamp(1.6rem, 3vw, 2.5rem); line-height: 1.3; letter-spacing: -0.02em; max-width: 24ch; }

/* the small photo, inside the sentence; it grows on hover */
.inline-me {
  display: inline-block;
  width: 1.45em; height: 1.45em; border-radius: 50%;
  vertical-align: -0.36em; margin: 0 0.14em 0 0.02em;
  background: url(../img/me.jpg) 50% 40% / 155% no-repeat;
  box-shadow: 0 0 0 2px var(--page-bg), 0 0 0 3px rgba(255, 255, 255, 0.14);
  transition: transform 0.5s var(--ease-expo);
}
.inline-me:hover { transform: scale(2.2) rotate(-4deg); }

/* at a glance */
.glance { font-family: var(--mono); }
.glance-call { margin: 0 0 0.9rem; font-size: 0.85rem; color: var(--muted); }
.glance dl { margin: 0; border-top: 1px solid var(--hair-faint); }
.glance dl > div {
  display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 1rem;
  padding: 0.8rem 0; border-bottom: 1px solid var(--hair-faint);
}
.glance dt { font-weight: 400; font-size: 0.78rem; letter-spacing: 0.04em; color: var(--dim); padding-top: 0.15rem; }
.glance dt::after { content: ":"; }
.glance dd { margin: 0; font-family: var(--sans); font-size: 1rem; line-height: 1.4; color: var(--text-2); }
.glance dd a:link, .glance dd a:visited { color: var(--text); background-image: linear-gradient(currentColor, currentColor); background-size: 0% 1px; background-position: 0 100%; background-repeat: no-repeat; transition: color 0.3s var(--ease-shelby), background-size 0.6s var(--ease-expo); }
.glance dd a:hover { color: var(--mint); background-size: 100% 1px; }
html.js.motion .glance dl > div { opacity: 0; transform: translateY(0.5rem); }
html.js.motion .glance.is-in dl > div { opacity: 1; transform: none; transition: opacity 0.6s var(--ease-soft), transform 0.75s var(--ease-expo); }
html.js.motion .glance.is-in dl > div:nth-child(2) { transition-delay: 60ms; }
html.js.motion .glance.is-in dl > div:nth-child(3) { transition-delay: 120ms; }
html.js.motion .glance.is-in dl > div:nth-child(4) { transition-delay: 180ms; }
html.js.motion .glance.is-in dl > div:nth-child(5) { transition-delay: 240ms; }
html.js.motion .glance.is-in dl > div:nth-child(6) { transition-delay: 300ms; }

@media (max-width: 767.98px) {
  .about-grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; }
  .about-text, .about-contacts, .about-photo { grid-column: 1; grid-row: auto; }
  .about-photo { order: 3; margin-top: 2.5rem !important; }
  .glance dl > div { grid-template-columns: 5.5rem minmax(0, 1fr); }
}
}

.fa-icon a.fa-icon-link { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; margin: 0 0.15rem; }
.fa-icon a.fa-icon-link i {
  font-size: 2rem !important; line-height: 1; width: 1.15em; text-align: center; vertical-align: middle;
  color: var(--text-2) !important;
  transition: color 0.3s var(--ease-shelby), transform 0.45s var(--ease-expo);
}
.fa-icon a.fa-icon-link:hover i, .fa-icon a.fa-icon-link:focus-visible i { color: var(--mint) !important; transform: translateY(-2px); }

/* ---------- rows: now / news / pubs / past ----------------------------- */
.work-title, .pub-title, .card-title { font-family: var(--sans); letter-spacing: -0.018em; color: var(--text); }
.work-title { font-weight: 700; font-size: 1.45rem; text-wrap: balance; }
.pub-title { font-weight: 700; font-size: 1.35rem; line-height: 1.25; text-wrap: balance; }
.work-text, .pub-text, .card-text, #pj_start { font-family: var(--sans); }
.work-text { color: var(--text-2); font-size: 1.12rem; line-height: 1.55; }
.pub-text { color: var(--text-2); font-weight: 400; font-size: 1.02rem; line-height: 1.5; }
.work-place, .pub-conf { font-family: var(--sans); font-style: normal; color: var(--muted); font-size: 1rem; font-weight: 400; }
.pub-conf { font-family: var(--mono); font-size: 0.82rem; letter-spacing: 0.02em; }
.work-place::before { content: "@ "; color: var(--dim); font-family: var(--mono); font-size: 0.85em; }
.me { color: var(--text); font-weight: 700; }
.proj { font-family: var(--mono); font-weight: 500; font-size: 0.94em; color: var(--mint); letter-spacing: -0.02em; }

.work-date, .pub-date, .pub-date-left {
  font-family: var(--mono); font-weight: 500;
  font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); line-height: 1.6;
}
.pub-date-left { font-size: 0.85rem; color: var(--text-2); }
.work-date, .pub-date, .pub-date-left { margin-left: auto; margin-bottom: 0; }
.fa-icon { font-size: 1.5rem; margin-top: 1.5rem !important; }
#description { margin-bottom: 0; }
/* the current item wears the "now" colour */
.container:has(#now) .work-date,
#principled-intelligence .pub-date-left { color: var(--pink); }

.work-pic, .pub-pic {
  filter: var(--logo-filter);
  transition: filter 0.5s var(--ease-soft);
  border: 1px solid var(--hair);
  background: var(--surface);
  box-shadow: none;
}

/* other people's logos stay quiet until you point at the row */
.work-row:hover .work-pic, .work-row:hover .pub-pic, .work-row:focus-within .work-pic, .work-row:focus-within .pub-pic { filter: none; }

/* logo rings drawn by JS (wrapped in .logo) */
.logo { position: relative; display: block; margin: 0 auto; aspect-ratio: 1; }
.logo > img { width: 100%; max-width: 100% !important; height: 100%; object-fit: contain; margin: 0 !important; }
.logo .ring { position: absolute; inset: -6px; width: calc(100% + 12px); height: calc(100% + 12px); transform: rotate(-90deg); fill: none; stroke: var(--mint); stroke-width: 0.75; opacity: 0; pointer-events: none; }
.logo .ring circle { stroke-dasharray: 100; stroke-dashoffset: 100; }
/* quieter: rings draw only when you point at a row */
html.fx-lines .logo .ring { opacity: 0.6; }
html.fx-lines .work-row:hover .logo .ring circle,
html.fx-lines .work-row:focus-within .logo .ring circle { stroke-dashoffset: 0; transition: stroke-dashoffset 1.1s var(--ease-expo); }
html.fx-lines .logo .ring circle { transition: stroke-dashoffset 0.6s var(--ease-soft); }

/* dividers draw from the left */
hr { margin-top: 3rem; border: 0; height: 1px; opacity: 1; background: var(--hair); transform-origin: left center; }
html.js.motion.fx-lines hr { transform: scaleX(0); }
html.js.motion.fx-lines hr.is-in { transform: none; transition: transform 1.4s var(--ease-expo); }

/* ---------- link buttons: one hairline pill, type colour on hover ----- */
/* one colour per link type, set per palette (--btn-*) */
.btn-outline-paper   { --c: var(--btn-paper); }
.btn-outline-website { --c: var(--btn-site); }
.btn-outline-repo    { --c: var(--btn-code); }
.btn-outline-hf      { --c: var(--btn-model); }
.btn-outline-pypi    { --c: var(--btn-pkg); }
a.btn.btn-outline-primary {
  display: inline-flex; align-items: center; gap: 0.5rem;
  margin: 0.5rem 0.35rem 0 0;
  padding: 0.38rem 0.95rem;
  font-family: var(--mono); font-size: 0.76rem; font-weight: 500; letter-spacing: 0.04em;
  color: var(--text-2);
  background: transparent;
  border: 1px solid var(--hair);
  box-shadow: none;
  transition: border-color 0.4s ease-in-out, box-shadow 0.4s ease-in-out, background-color 0.4s ease-in-out, color 0.3s, transform 0.5s var(--ease-expo);
}
a.btn.btn-outline-primary::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--c, var(--violet)); }
a.btn.btn-outline-primary:hover,
a.btn.btn-outline-primary:focus-visible {
  color: #fff;
  border-color: var(--c);
  background-color: color-mix(in srgb, var(--c) 10%, transparent);
  box-shadow: 0 0 18px -6px color-mix(in srgb, var(--c) 75%, transparent);
}

/* ---------- projects --------------------------------------------------- */
#pj_start { color: var(--muted); font-weight: 400; font-size: clamp(1.1rem, 1.8vw, 1.4rem); }
.card.bg-dark {
  background: var(--surface) !important;
  border: 1px solid var(--hair-faint) !important;
  border-radius: 20px;
  box-shadow: none;
  transition: box-shadow 0.4s ease-in-out, border-color 0.4s ease-in-out, transform 0.6s var(--ease-expo), background-color 0.4s;
}
.card.bg-dark:hover, .card.bg-dark:focus-within { border-color: rgba(var(--violet-rgb), 0.35) !important; box-shadow: var(--glow-hover); }
.card-body { padding: 1.5rem 1.5rem 0.5rem; }
.card-title { font-weight: 700; font-size: 1.25rem; }
.card-text { color: var(--muted); font-size: 0.98rem; line-height: 1.5; text-wrap: pretty; }
.card-footer { display: flex; align-items: center; gap: 0.15rem; padding: 0 1.5rem 1.2rem calc(1.5rem - 9px); }
.card-link, .card-link + .card-link { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; margin: 0 !important; border-radius: 8px; transition: background-color 0.3s var(--ease-shelby); }
.card-link:hover { background-color: color-mix(in srgb, var(--text) 6%, transparent); }
.card-link i { color: var(--muted) !important; font-size: 1.1rem; transition: color 0.3s var(--ease-shelby); }
.card-link:hover i { color: var(--mint) !important; }

/* ---------- footer ----------------------------------------------------- */
.footer { background: transparent; border-top: 1px solid var(--hair-faint); }
html.js .footer { padding-bottom: 4.5rem; height: auto; }
.foot-cont .foot-line { margin: 0 0 0.4rem; text-align: center; font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.02em; color: var(--muted); }
.foot-cont .heart { color: var(--pink); }

/* ---------- reveals (always on when motion is allowed) ----------------- */
.reveal-words .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.12em; margin-bottom: -0.12em; }
.reveal-words .w > span { display: inline-block; }
html.js.motion .reveal-words .w > span { transform: translateY(105%); transition: transform 1s var(--ease-expo); }
html.js.motion .reveal-words.is-in .w > span { transform: none; }

html.js.motion .reveal { opacity: 0; transform: translateY(1rem); }
html.js.motion .reveal.is-in {
  opacity: 1; transform: none;
  transition: opacity 0.75s var(--ease-soft), transform 0.75s var(--ease-expo);
  transition-delay: var(--d, 0ms);
}
/* ---------- motion toggle panel (preview only) ------------------------- */
.fx-panel {
  position: fixed; right: 16px; bottom: 16px; z-index: 1001;
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.4rem 0.45rem 0.4rem 0.8rem;
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.06em;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--hair);
  border-radius: 999px;
}
.fx-panel button {
  appearance: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.35rem 0.7rem;
  font: inherit; color: var(--dim);
  background: transparent;
  border: 1px solid var(--hair-faint); border-radius: 999px;
  transition: color 0.3s var(--ease-shelby), border-color 0.3s, box-shadow 0.4s ease-in-out;
}
.fx-panel button::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--dim); transition: background 0.3s, box-shadow 0.3s; }
.fx-panel button[aria-pressed="true"] { color: var(--text); border-color: rgba(var(--mint-rgb), 0.45); }
.fx-panel button[aria-pressed="true"]::before { background: var(--mint); box-shadow: 0 0 10px rgba(var(--mint-rgb), 0.8); }

/* ---------- keyframes -------------------------------------------------- */
@keyframes breathe-soft { 0%, 100% { opacity: 1; } 50% { opacity: 0.8; } }
@keyframes glow-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes caret { 0%, 100% { border-right-color: var(--mint); } 50% { border-right-color: transparent; } }
@keyframes cue-draw { 0% { stroke-dashoffset: 24; } 55% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -24; } }

/* ---------- mobile tweaks ---------------------------------------------- */
@media (max-width: 500px) {
  .code-snippet { padding-left: 1.25rem; padding-right: 1.25rem; }
  .title { font-size: 2.3rem; }
  .title { margin-top: 3rem; }
  .pub-date-left { margin-right: auto; }
  .fa-icon { font-size: 1.35rem; padding-left: 0.6rem; }
  .hero-links { gap: 0 1.2rem; }
  .about-text, .about-contacts, .about-photo { padding: 0 1rem !important; }
  .fx-panel { right: 10px; bottom: 10px; padding: 0.25rem; gap: 0.25rem; }
  .fx-panel > span { display: none; }
  .fx-panel button { padding: 0.3rem 0.55rem; font-size: 0.66rem; }
  .work-date { margin-left: 1.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

img[data-logo-pad] { padding: 1.75rem; aspect-ratio: 1; object-fit: contain; }
.logo.is-work { width: 65%; }
.logo.is-pub { width: 50%; }
@media (max-width: 500px) { .logo.is-work { width: 40%; } }
.fx-panel { flex-wrap: wrap; justify-content: flex-end; max-width: calc(100vw - 20px); border-radius: 20px; }

/* ===== Prism: from the chromatic-dispersion reference (cobalt -> teal -> sand -> amber -> rose on near-black) ===== */
html:is([data-palette="prism"], [data-palette="liquid"]) {
  --bg: #0f110f; --bg-rgb: 15, 17, 15; --surface: #171916; --surface-2: #1e201d;
  --text: #ecefed; --text-2: #ced2cf; --muted: #9da3a0; --dim: #848986;
  /* "Full Spectrum": every token class takes a different band of the prism */
  --mint: #73b6fa; --mint-rgb: 115, 182, 250;      /* keywords: cobalt */
  --violet: #78d7d6; --violet-rgb: 120, 215, 214;  /* types: aqua */
  --pink: #f19d9d; --pink-rgb: 241, 157, 157;      /* strings + "now": coral */
  --amber: #fab36d;                                /* function names */
  --tint-a: #11161a; --tint-b: #171410; --tint-c: #181312;
  --btn-paper: #73b6fa; --btn-code: #78d7d6; --btn-site: #fab36d; --btn-model: #f19d9d; --btn-pkg: #bbaceb;
  --now: #ff7d52; --now-rgb: 255, 125, 82;         /* the orange-red splash: only what is current, and the CV */
  --scroll: #2f3431; --tint: #111417;
}
html:is([data-palette="prism"], [data-palette="liquid"]) #gradient-canvas { --gradient-color-1: #0f110f; --gradient-color-2: #004673; --gradient-color-3: #816243; --gradient-color-4: #273030; }
html:is([data-palette="prism"], [data-palette="liquid"]) ::selection { background: rgba(111, 193, 246, 0.3); }
#prism-canvas { display: none; }
html:is([data-palette="prism"], [data-palette="liquid"]) #prism-canvas { display: block; position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
html:is([data-palette="prism"], [data-palette="liquid"]) #gradient-canvas { visibility: hidden; }
html:is([data-palette="prism"], [data-palette="liquid"]) #prism-canvas.prism-fallback {
  background: radial-gradient(120% 90% at 100% 100%, #c9b79f 0%, #6f6a62 30%, #e9ebe9 34%, #0f110f 36%);
}
html:is([data-palette="prism"], [data-palette="liquid"]) .tk-fn { color: var(--amber); }
html:is([data-palette="prism"], [data-palette="liquid"]) ::selection { background: rgba(115, 182, 250, 0.3); }
/* orange-red splash: current items and the CV */
html:is([data-palette="prism"], [data-palette="liquid"]) .container:has(#now) .work-date,
html:is([data-palette="prism"], [data-palette="liquid"]) #principled-intelligence .pub-date-left { color: var(--now); }
html:is([data-palette="prism"], [data-palette="liquid"]) .topbar-cv:hover { border-color: var(--now); box-shadow: 0 0 24px -8px rgba(var(--now-rgb), 0.5); }

/* ===== Liquid: dark flowing glass (second reference). Same text colours as Prism, deeper black. ===== */
html[data-palette="liquid"] {
  --bg: #050507; --bg-rgb: 5, 5, 7; --surface: #0e0e12; --surface-2: #15151a;
  --text: #eceef2; --text-2: #c9ccd3; --muted: #9a9ea8; --dim: #80848e;
  --scroll: #24252b; --tint: #08080c;
  --tint-a: #0e151f; --tint-b: #16131d; --tint-c: #0c1616;
  /* text sampled from the glass fringes: ice blue, lilac, pale gold, silver, with a muted coral for "now" */
  --mint: #accdf8; --mint-rgb: 172, 205, 248;
  --violet: #cbbaeb; --violet-rgb: 203, 186, 235;
  --pink: #e9b7cd; --pink-rgb: 233, 183, 205;   /* strings: soft rose */
  --amber: #e4ecf5;
  --now: #f48e74; --now-rgb: 244, 142, 116;
  --btn-paper: #accdf8; --btn-code: #cbbaeb; --btn-site: #71d0d5; --btn-model: #e6d39c; --btn-pkg: #e4ecf5;
}
html[data-palette="liquid"] ::selection { background: rgba(172, 205, 248, 0.25); }

/* the button row sits under the entry text and gets the same width (v1 gave it a narrow 4/12 column) */
@media (min-width: 768px) {
  .work-row > .col-md-4:has(> .paper-buttons) { flex: 0 0 66.666%; max-width: 66.666%; }
}
.paper-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; padding-top: 0.25rem; }
.paper-buttons a.btn.btn-outline-primary { margin: 0; }

/* phones: the org / venue logo becomes a small mark to the left of the entry */
@media (max-width: 767.98px) {
  .work-row:has(.logo) {
    display: grid; grid-template-columns: 44px minmax(0, 1fr); column-gap: 0.9rem; align-items: start;
    margin-left: 0; margin-right: 0; padding: 0 1rem;
  }
  .work-row:has(.logo) > [class*="col-"] { grid-column: 2; width: auto; max-width: none; flex: none; padding: 0; margin: 0; }
  .work-row:has(.logo) > #pub-pic, .work-row:has(.logo) > [class*="col-"]:has(> .logo) { grid-column: 1; grid-row: 1 / span 4; display: block !important; visibility: visible !important; padding-top: 0.15rem; }
  .work-row:has(.logo) > [class*="col-"]:not(:has(*)) { display: none; }
  .work-row:has(.logo) .logo.is-work, .work-row:has(.logo) .logo.is-pub { width: 44px; margin: 0; }
  .work-row:has(.logo) .logo > img { border-width: 1px; }
  .work-row:has(.logo) img[data-logo-pad] { padding: 0.45rem; }
  .work-row:has(.logo) .work-body, .work-row:has(.logo) .pub-body { padding: 0; }
  .work-row:has(.logo) .work-title, .work-row:has(.logo) .pub-title { padding-bottom: 0.5rem; }
  .work-row:has(.logo) .work-date, .work-row:has(.logo) .pub-date { margin: 0.35rem 0 0 !important; padding: 0 !important; text-align: left !important; }
  .work-row:has(.logo) .work-col { justify-content: flex-start; }
  .work-row:has(.logo) .paper-buttons { padding-left: 0; }
}

/* social icons: one 44px box each; glyph sizes tuned so the marks look the same size
   (Font Awesome and Academicons draw at different scales) */
.fa-icon { display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }
.fa-icon a.fa-icon-link { display: inline-flex !important; width: 44px; height: 44px; margin: 0 !important; align-items: center; justify-content: center; }
.fa-icon a.fa-icon-link i { width: auto !important; line-height: 1 !important; }
.fa-icon a.fa-icon-link i.fa-github { font-size: 26px !important; }
.fa-icon a.fa-icon-link i.ai-google-scholar,
.fa-icon a.fa-icon-link i.ai-researchgate { font-size: 30px !important; }
.fa-icon a.fa-icon-link i.fa-linkedin-in { font-size: 25px !important; }
.fa-icon a.fa-icon-link i.ai-cv { font-size: 40px !important; }
.about-contacts .fa-icon { margin-left: -9px; }
@media (max-width: 500px) {
  .fa-icon { padding-left: 0 !important; }
  #description { margin-left: 0 !important; margin-right: 0 !important; }
  .about-contacts .contacts { padding-left: 0 !important; }
}
