/* ==========================================================================
   smartrics.it: layout and components.
   Colours and fonts come from the active theme (css/themes/*.css).
   ========================================================================== */

@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/inter.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("/assets/fonts/newsreader.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("/assets/fonts/newsreader-italic.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}

/* ---- Section accent: one variable set that follows the page --------------- */
body { --accent: var(--work-accent); --accent-ink: var(--ink); }
body[data-section="work"] { --accent: var(--work-accent); --accent-ink: var(--work-accent-ink); }
body[data-section="life"] { --accent: var(--life-accent); --accent-ink: var(--life-accent-ink); }
body[data-section="projects"] { --accent: var(--proj-accent); --accent-ink: var(--proj-accent-ink); }

/* ---- Base ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.6 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { margin: 0; font-weight: 500; text-wrap: balance; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
[role="list"] { list-style: none; }

.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.wrap-narrow { width: min(700px, 100% - 32px); margin-inline: auto; }
@media (min-width: 720px) {
  .wrap { width: min(1120px, 100% - 64px); }
}

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.skip {
  position: absolute; left: 16px; top: -100px;
  background: var(--ink); color: var(--paper);
  padding: 0.5rem 1rem; border-radius: var(--radius-sm); z-index: 10;
}
.skip:focus { top: 16px; }

.kicker {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---- Header --------------------------------------------------------------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.5rem;
}
.wordmark {
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.04em;
  text-decoration: none;
}
.wordmark .dot { color: var(--work-accent); }
.site-header ul { display: flex; gap: 0.25rem; list-style: none; }
.site-header nav a {
  display: inline-block;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--muted);
  transition: color 0.15s, background-color 0.15s;
}
.site-header nav a:hover { color: var(--ink); background: var(--line); }
.site-header nav a[aria-current="page"] { color: var(--ink); background: var(--line); }
.site-header .nav-work[aria-current="page"] { background: var(--work-accent); color: var(--work-on-accent); }
.site-header .nav-life[aria-current="page"] { background: var(--life-accent); color: var(--life-on-accent); }
.site-header .nav-projects[aria-current="page"] { background: var(--proj-accent); color: #fff; }

/* ---- Hero (landing) ------------------------------------------------------- */
.hero { padding-block: clamp(3rem, 9vw, 7rem) clamp(2rem, 5vw, 3.5rem); }
.hero-title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(2.5rem, 7vw, 5.25rem);
  line-height: 1.02;
  letter-spacing: -0.025em;
  max-width: 15ch;
  margin-top: 1rem;
}
.hero-intro {
  margin-top: 1.5rem;
  max-width: 58ch;
  font-size: clamp(1.0625rem, 1.6vw, 1.1875rem);
  color: var(--muted);
}
.hero-intro a { color: var(--ink); }

/* ---- Post list ------------------------------------------------------------ */
.post-list { list-style: none; }
.post-list li { border-top: 1px solid var(--line); }
.post-list li:last-child { border-bottom: 1px solid var(--line); }
.post-link {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-block: 1rem;
  text-decoration: none;
}
.post-title { font-weight: 500; font-size: 1.0625rem; line-height: 1.35; }
.post-link:hover .post-title { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 0.2em; }
.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--muted);
}
.empty { color: var(--muted); font-style: italic; font-family: var(--font-serif); font-size: 1.125rem; padding-block: 1rem; }

/* ---- Pills & chips -------------------------------------------------------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.15s, background-color 0.15s;
}
.pill:hover { border-color: var(--accent); }
.pill-solid { background: var(--accent); border-color: var(--accent); }
.chip {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.6;
}
.chip-draft { border-style: dashed; }

/* ---- Section pages (Work / Life / About) ---------------------------------- */
.page-head { padding-block: clamp(2.5rem, 7vw, 5rem) 2rem; }
.page-head .kicker { color: var(--accent-ink); }
.page-head h1 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(2.25rem, 5.5vw, 4rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-top: 0.85rem;
  max-width: 18ch;
}
.page-intro { margin-top: 1.25rem; max-width: 60ch; color: var(--muted); font-size: 1.0625rem; }
.page-intro strong { color: var(--ink); font-weight: 600; }
.page-links { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.5rem; }

.list-layout {
  display: grid;
  gap: 3rem;
  padding-bottom: clamp(3rem, 8vw, 6rem);
}
@media (min-width: 860px) {
  .list-layout { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 4rem; }
  .list-layout-single { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
}
.list-heading {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.75rem;
}
.list-layout .post-title { font-family: var(--font-serif); font-size: 1.375rem; font-weight: 400; }
.list-layout .post-link { padding-block: 1.25rem; }

.beliefs {
  align-self: start;
  border-left: 3px solid var(--accent);
  padding: 0.25rem 0 0.25rem 1.5rem;
}
.beliefs h2 {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.beliefs ul { display: grid; gap: 1rem; margin-top: 1.25rem; }
.beliefs li { font-family: var(--font-serif); font-size: 1.25rem; line-height: 1.35; font-style: italic; }

/* ---- Post ----------------------------------------------------------------- */
.post { padding-block: clamp(2.5rem, 7vw, 5rem) clamp(3rem, 8vw, 6rem); }
.post-header { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.section-tag {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--accent-ink);
}
.section-tag::before {
  content: "";
  display: inline-block;
  width: 0.55rem; height: 0.55rem;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 0.45rem;
}
.post-header h1 {
  flex-basis: 100%;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(2.25rem, 5.5vw, 3.5rem);
  line-height: 1.06;
  letter-spacing: -0.02em;
  margin-top: 1rem;
}
.post-lede {
  flex-basis: 100%;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(1.25rem, 2.4vw, 1.5rem);
  line-height: 1.4;
  color: var(--muted);
  margin-top: 1rem;
}
.post-header .post-meta { flex-basis: 100%; margin-top: 1.25rem; padding-bottom: 2rem; border-bottom: 1px solid var(--line); }
.post-footer { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--line); display: grid; gap: 1rem; }

/* ---- Prose (Markdown content) --------------------------------------------- */
.prose {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  line-height: 1.65;
  margin-top: 2rem;
}
.prose > * + * { margin-top: 1.1em; }
.prose h2, .prose h3 {
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.25;
  margin-top: 2.2em;
}
.prose h2 { font-size: 1.375rem; }
.prose h3 { font-size: 1.125rem; }
.prose a { text-decoration-color: var(--accent); text-decoration-thickness: 2px; }
.prose ul, .prose ol { padding-left: 1.25em; }
.prose li + li { margin-top: 0.4em; }
.prose li::marker { color: var(--accent-ink); }
.prose blockquote {
  margin-inline: 0;
  padding-left: 1.25rem;
  border-left: 3px solid var(--accent);
  font-style: italic;
  color: var(--muted);
}
.prose code {
  font-family: var(--font-mono);
  font-size: 0.8em;
  background: var(--line);
  padding: 0.12em 0.35em;
  border-radius: 5px;
}
.prose pre {
  font-size: 0.95rem;
  line-height: 1.5;
  background: var(--work-bg);
  color: var(--work-fg);
  padding: 1.25rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
}
.prose pre code { background: none; padding: 0; font-size: inherit; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin-block: 2.5em; }
.prose img { border-radius: var(--radius-sm); }
.prose figure { margin-inline: 0; }
.prose figcaption { font-family: var(--font-sans); font-size: 0.875rem; color: var(--muted); margin-top: 0.5rem; }
.prose table { width: 100%; border-collapse: collapse; font-family: var(--font-sans); font-size: 0.95rem; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--line); }
.prose strong { font-weight: 600; }

/* ---- Footer --------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 2rem 2.5rem;
  display: grid;
  gap: 1.5rem;
  font-size: 0.875rem;
}
.footer-links { display: flex; flex-wrap: wrap; gap: 2.5rem; }
.footer-label {
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 0.5rem;
}
.footer-links ul { display: flex; flex-wrap: wrap; gap: 1rem; list-style: none; }
.footer-links a { text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }
.footer-meta { color: var(--muted); }

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

/* ---- External entries & summaries ----------------------------------------- */
.ext { font-family: var(--font-sans); font-size: 0.8em; color: var(--accent-ink); }
.post-summary {
  font-size: 0.9875rem;
  line-height: 1.55;
  color: var(--muted);
  max-width: 62ch;
}
.list-heading-gap { margin-top: 3.5rem; }
.list-note { font-size: 0.875rem; color: var(--muted); margin: -0.25rem 0 0.75rem; }

/* ---- Publications (Work page aside) --------------------------------------- */
.beliefs .aside-gap { margin-top: 2.75rem; }
.pubs { display: grid; gap: 1.1rem; margin-top: 1.25rem; }
.pubs a { font-weight: 500; line-height: 1.35; text-decoration: none; display: block; }
.pubs a:hover { text-decoration: underline; text-decoration-color: var(--accent); }
.pub-meta, .pub-authors { display: block; font-size: 0.8125rem; color: var(--muted); margin-top: 0.2rem; }
.pub-authors { font-style: italic; }

/* ==========================================================================
   Home: mind map (bubbles round a focused sphere)
   ========================================================================== */
body[data-section="home"] { --accent: var(--work-accent); --accent-ink: var(--work-accent-ink); }

.mm {
  display: grid;
  gap: 1.5rem;
  padding-bottom: clamp(3rem, 7vw, 5rem);
  overflow-x: clip;
}
@media (min-width: 900px) {
  .mm { grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.85fr); align-items: start; gap: 2rem; min-height: calc(100svh - 170px); }
  /* The map scrolls with the page (not sticky): the whole page moves together. */
}
.mm-overline {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---- Stage ---------------------------------------------------------------- */
.mm-stage {
  position: relative;
  height: min(62vw, 640px);
  min-height: 460px;
  isolation: isolate;
  touch-action: pan-y;
}
.mm-stage::before, .mm-stage::after {
  content: ""; position: absolute; border-radius: 50%; pointer-events: none;
}
.mm-stage::before { inset: 6%; border: 1px solid var(--line); }
.mm-stage::after { inset: 19%; border: 1px dashed var(--line); }
.mm-glow {
  position: absolute; inset: 12%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 40% 35%, color-mix(in srgb, var(--work-accent) 16%, transparent), transparent 66%);
}
.mm-links { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.mm-links line { stroke: var(--muted); stroke-opacity: 0.45; stroke-width: 1.25; stroke-dasharray: 3 5; }

.bubble {
  position: absolute;
  left: 0; top: 0;
  width: clamp(96px, 11vw, 128px);
  height: clamp(96px, 11vw, 128px);
  padding: 10px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 9px 26px rgb(39 35 19 / 0.05);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  text-align: center;
  text-decoration: none;
  color: var(--ink);
  user-select: none;
  will-change: transform, opacity;
  transition: width 0.45s, height 0.45s, background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
}
.b-title { font-size: clamp(0.75rem, 1.1vw, 0.9375rem); font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; }
.b-sub { font-size: 0.625rem; color: var(--muted); line-height: 1.25; }
.bubble:hover { border-color: var(--work-accent); box-shadow: 0 12px 30px rgb(80 61 0 / 0.12); }
.bubble-life:hover { border-color: var(--life-accent); }
.bubble-life .b-title::after { content: ""; display: block; width: 5px; height: 5px; margin: 5px auto 0; border-radius: 50%; background: var(--life-accent); }
.bubble.center {
  width: clamp(150px, 16vw, 204px);
  height: clamp(150px, 16vw, 204px);
  background: var(--work-accent);
  border-color: color-mix(in srgb, var(--work-accent) 80%, var(--ink));
  box-shadow: 0 25px 70px rgb(188 142 0 / 0.18);
  color: #1d1d1b;
}
.bubble.center .b-title { font-size: clamp(1.125rem, 1.9vw, 1.5rem); letter-spacing: -0.04em; }
.bubble.center .b-sub { font-size: 0.6875rem; color: #5d4e21; }
.bubble-life.center { background: var(--life-accent); border-color: var(--life-accent); color: #fff; box-shadow: 0 25px 70px rgb(180 71 46 / 0.2); }
.bubble-life.center .b-sub { color: rgb(255 255 255 / 0.8); }
.bubble-life.center .b-title::after { background: #fff; }
.bubble-root.center { background: var(--ink); border-color: var(--ink); color: var(--paper); box-shadow: 0 25px 70px rgb(29 29 27 / 0.2); }
.bubble-root.center .b-sub { color: color-mix(in srgb, var(--paper) 70%, transparent); }
.bubble-root.center .b-title::after { content: "."; color: var(--work-accent); }
.bubble:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }

/* Before the script runs, and without JavaScript: a plain list of topics. */
.js .mm-stage:not(.is-live) .bubble { visibility: hidden; }
html:not(.js) .mm-stage { height: auto; min-height: 0; }
html:not(.js) .mm-stage::before, html:not(.js) .mm-stage::after, html:not(.js) .mm-glow, html:not(.js) .mm-links { display: none; }
html:not(.js) .mm-nodes { display: flex; flex-wrap: wrap; gap: 0.5rem; padding-top: 1rem; }
html:not(.js) .bubble { position: static; width: auto; height: auto; border-radius: 999px; padding: 0.5rem 1rem; flex-direction: row; }

/* ---- Controls ------------------------------------------------------------- */
.mm-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; position: relative; z-index: 3; margin-top: -0.5rem; }
.mm-back, .mm-surprise {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 999px; padding: 0.55rem 0.95rem; font: inherit; font-size: 0.8125rem;
  text-decoration: none; cursor: pointer;
}
.mm-back:hover, .mm-surprise:hover { border-color: var(--ink); }
.mm-tip { font-size: 0.75rem; color: var(--muted); }

/* ---- Details panel -------------------------------------------------------- */
.mm-details { min-width: 0; padding-top: 0; } /* top line aligns with the map's overline */
.js .mm-details .topic { display: none; }
.js .mm-details .topic.is-current { display: block; animation: d-in 0.45s ease both; }
@keyframes d-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
html:not(.js) .mm-details .topic + .topic { margin-top: 3rem; padding-top: 2.5rem; border-top: 1px solid var(--line); }

.crumb { display: flex; flex-wrap: wrap; gap: 0.45rem; font-size: 0.75rem; color: var(--muted); margin-bottom: 1.5rem; }
.crumb a { text-decoration: none; }
.crumb a:hover { color: var(--ink); text-decoration: underline; }
.crumb [aria-current] { color: var(--ink); }
.topic .mm-overline { margin-bottom: 0.9rem; }
.d-title {
  font-family: var(--font-sans);
  font-size: clamp(2.75rem, 5vw, 4.75rem);
  font-weight: 750;
  letter-spacing: -0.065em;
  line-height: 0.98;
  margin: 0 0 1.25rem;
  text-wrap: balance;
}
.d-title::after { content: "."; color: var(--work-accent-ink); }
.topic-life .d-title::after { color: var(--life-accent); }
.d-desc { font-size: clamp(1rem, 1.3vw, 1.1875rem); line-height: 1.65; color: var(--muted); max-width: 32rem; }
.d-pills { display: flex; flex-wrap: wrap; gap: 0.55rem; margin-top: 1.6rem; }
.d-pill {
  border: 1px solid var(--line); border-radius: 999px; padding: 0.6rem 0.95rem;
  font-size: 0.8125rem; text-decoration: none; color: var(--ink);
  transition: background-color 0.15s, border-color 0.15s;
}
.d-pill:hover { background: color-mix(in srgb, var(--work-accent) 30%, transparent); border-color: var(--work-accent); }
.topic-life .d-pill:hover { background: color-mix(in srgb, var(--life-accent) 15%, transparent); border-color: var(--life-accent); }
.d-pill-back { color: var(--muted); }

.d-beliefs { margin-top: 1.75rem; display: grid; gap: 0.6rem; border-left: 3px solid var(--work-accent); padding-left: 1.1rem; }
.d-beliefs li { font-family: var(--font-serif); font-style: italic; font-size: 1.125rem; line-height: 1.35; }

.d-heading {
  margin-top: 2.25rem; margin-bottom: 0.5rem;
  font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted);
}
.d-items { list-style: none; border-top: 1px solid var(--line); }
.d-items li { padding: 0.85rem 0; border-bottom: 1px solid var(--line); }
.d-items a { font-weight: 600; line-height: 1.35; text-decoration: none; }
.d-items a:hover { text-decoration: underline; text-decoration-color: var(--accent); }
.d-items p { margin-top: 0.35rem; font-size: 0.875rem; line-height: 1.55; color: var(--muted); }
.d-meta { display: block; margin-top: 0.3rem; font-size: 0.75rem; color: var(--muted); }

.d-links { display: flex; flex-wrap: wrap; gap: 1.1rem; margin-top: 2rem; }
.d-links a { font-size: 0.8125rem; color: var(--muted); text-underline-offset: 4px; }
.d-links a:hover { color: var(--ink); }

@media (max-width: 899px) {
  .mm-stage { height: min(100vw, 470px); min-height: 340px; }
  .bubble { width: 78px; height: 78px; padding: 6px; }
  .bubble .b-sub { display: none; }
  .b-title { font-size: 0.6875rem; }
  .bubble.center { width: 132px; height: 132px; }
  .bubble.center .b-sub { display: block; }
  .bubble.center .b-title { font-size: 1.125rem; }
  .mm-tip { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .bubble { transition: none; }
  .js .mm-details .topic.is-current { animation: none; }
}

/* ---- Site search (header) ------------------------------------------------- */
.site-header { flex-wrap: wrap; }
.search { position: relative; flex: 1 1 14rem; max-width: 22rem; margin-left: auto; }
.search-input {
  width: 100%;
  height: 2.5rem;
  padding: 0 2.25rem 0 0.95rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.875rem;
}
.search-input::placeholder { color: var(--muted); }
.search-input:focus { outline: none; border-color: var(--ink); }
.search-input::-webkit-search-cancel-button { display: none; }
.search-key {
  position: absolute; right: 0.6rem; top: 50%; transform: translateY(-50%);
  font: 500 0.6875rem/1 var(--font-mono); color: var(--muted);
  border: 1px solid var(--line); border-radius: 5px; padding: 0.2rem 0.4rem;
  pointer-events: none;
}
.search-input:focus + .search-key, .search-input:not(:placeholder-shown) + .search-key { display: none; }
.search-results {
  position: absolute; z-index: 50; top: calc(100% + 0.4rem); right: 0;
  width: min(28rem, calc(100vw - 32px));
  max-height: min(70vh, 32rem); overflow-y: auto;
  list-style: none; margin: 0; padding: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 50px rgb(29 29 27 / 0.12);
}
.sr a { display: block; padding: 0.6rem 0.75rem; border-radius: 9px; text-decoration: none; border-left: 3px solid transparent; }
.sr-title { display: block; font-weight: 600; font-size: 0.9375rem; line-height: 1.3; }
.sr-meta { display: block; margin-top: 0.2rem; font-size: 0.75rem; color: var(--muted); }
.sr[aria-selected="true"] a, .sr a:hover { background: var(--paper); }
.sr-work[aria-selected="true"] a { border-left-color: var(--work-accent); }
.sr-life[aria-selected="true"] a { border-left-color: var(--life-accent); }
.sr-empty { padding: 0.75rem; font-size: 0.875rem; color: var(--muted); }
@media (max-width: 640px) {
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .search-key { display: none; }
}

/* ---- Projects (third side) ------------------------------------------------ */
.bubble-projects:hover { border-color: var(--proj-accent); }
.bubble-projects .b-title::after { content: ""; display: block; width: 5px; height: 5px; margin: 5px auto 0; border-radius: 50%; background: var(--proj-accent); }
.bubble-projects.center { background: var(--proj-accent); border-color: var(--proj-accent); color: #fff; box-shadow: 0 25px 70px rgb(47 111 143 / 0.22); }
.bubble-projects.center .b-sub { color: rgb(255 255 255 / 0.8); }
.bubble-projects.center .b-title::after { background: #fff; }
.topic-projects { --accent: var(--proj-accent); --accent-ink: var(--proj-accent-ink); }
.topic-projects .d-title::after { color: var(--proj-accent); }
.topic-projects .d-pill:hover { background: color-mix(in srgb, var(--proj-accent) 14%, transparent); border-color: var(--proj-accent); }
.sr-projects[aria-selected="true"] a { border-left-color: var(--proj-accent); }
.d-visit { margin-top: 1.4rem; }
.d-visit-link {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.75rem 1.15rem; border-radius: 999px;
  background: var(--accent); color: #fff; text-decoration: none;
  font-size: 0.9375rem; font-weight: 600;
}
.d-visit-link:hover { filter: brightness(1.08); }

/* Work bubbles get the same small marker dot as Life and Projects (yellow, with a
   hairline so it reads on white), and an ink dot when Work is the yellow centre. */
.bubble-work .b-title::after { content: ""; display: block; width: 5px; height: 5px; margin: 5px auto 0; border-radius: 50%; background: var(--work-accent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--work-accent) 60%, var(--ink)); }
.bubble-work.center .b-title::after { background: #1d1d1b; box-shadow: none; }

/* About: the 30-second pitch */
.prose .pitch {
  margin-top: 1rem;
  padding: 1.4rem 1.6rem;
  border-left: 4px solid var(--work-accent);
  background: var(--surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 1.3125rem;
  line-height: 1.55;
}
.prose .pitch p { margin: 0; }

/* Home "Latest": topic link inside the meta line, coloured by side */
.d-meta .d-topic { font-weight: 600; text-decoration: none; color: var(--ink); }
.d-meta .d-topic:hover { text-decoration: underline; }
.d-item-work .d-topic { color: var(--work-accent-ink); }
.d-item-life .d-topic { color: var(--life-accent-ink); }
.d-item-projects .d-topic { color: var(--proj-accent-ink); }

/* Home "Latest": a fixed-height box on desktop (three items, measured by the
   script into --latest-h) that scrolls inside itself; the page doesn't move
   when the box reaches its end. On narrow screens it's a plain list of five. */
@media (min-width: 900px) {
  .d-latest {
    max-height: var(--latest-h, 17rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-gutter: stable;
    border-bottom: 1px solid var(--line);
  }
  .d-latest li:last-child { border-bottom: 0; }
}
@media (max-width: 899px) {
  .d-latest li:nth-child(n + 6) { display: none; }
}

/* ---- Projects page --------------------------------------------------------- */
.projects { display: grid; gap: 1.25rem; padding-bottom: clamp(3rem, 8vw, 6rem); }
@media (min-width: 860px) { .projects { grid-template-columns: 1fr 1fr; align-items: start; } }
.project {
  border: 1px solid var(--line);
  border-top: 4px solid var(--proj-accent);
  border-radius: var(--radius);
  background: var(--surface);
  padding: clamp(1.5rem, 3.5vw, 2.25rem);
}
.project-code { font: 600 0.75rem/1 var(--font-mono); color: var(--proj-accent-ink); letter-spacing: 0.04em; }
.project h2 {
  font-family: var(--font-sans); font-weight: 750; letter-spacing: -0.05em;
  font-size: clamp(1.9rem, 3vw, 2.5rem); line-height: 1; margin-top: 0.6rem;
}
.project h2::after { content: "."; color: var(--proj-accent); }
.project-blurb { margin-top: 0.9rem; color: var(--muted); line-height: 1.6; }
.project-parts { list-style: none; margin-top: 1.5rem; border-top: 1px solid var(--line); }
.project-parts li { padding: 1rem 0; border-bottom: 1px solid var(--line); }
.project-parts h3 { font-size: 1.125rem; font-weight: 700; letter-spacing: -0.02em; }
.project-parts h3 a { text-decoration: none; }
.project-parts h3 a:hover { text-decoration: underline; text-decoration-color: var(--proj-accent); }
.project-sub { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--proj-accent-ink); margin-top: 0.2rem; }
.project-parts p:last-child { margin-top: 0.45rem; color: var(--muted); font-size: 0.9375rem; line-height: 1.55; }
.project-visit { margin-top: 1.5rem; }
.project .d-visit-link { background: var(--proj-accent); }
