:root {
  color-scheme: dark;
  --font-condensed: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
  --page-bg: #0a0d16;
  --surface: rgba(18, 24, 40, .72);
  --surface-solid: #121828;
  --header-bg: rgba(10, 13, 22, .78);
  --text: #f2f4fa;
  --muted: #aab3c8;
  --line: rgba(255, 255, 255, .12);
  --link: #ff9a5c;
  --accent: #ff6b2c;
  --on-accent: #0a0d16;
  --focus: #7dd3fc;
  --particle-rgb: 255, 140, 80;
  --particle-label-rgb: 255, 176, 128;
  --particle-label-alpha: .14;
  --particle-core-rgb: 255, 255, 255;
  --glow-a: rgba(255, 107, 44, .18);
  --glow-b: rgba(99, 84, 255, .16);
  --season-accent: transparent;
  --font-display: "Segoe UI Variable Display", "Segoe UI", "Helvetica Neue", Arial, system-ui, sans-serif;
  font-family: var(--font-display);
  color: var(--text);
  background: var(--page-bg);
  scroll-behavior: smooth;
}

:root[data-theme="light"] {
  color-scheme: light;
  --page-bg: #f7f4ee;
  --surface: rgba(255, 255, 255, .8);
  --surface-solid: #fff;
  --header-bg: rgba(247, 244, 238, .82);
  --text: #14161f;
  --muted: #4a5163;
  --line: rgba(20, 22, 31, .14);
  --link: #b43c00;
  --accent: #c2410c;
  --on-accent: #fff;
  --focus: #0a58ff;
  --particle-rgb: 194, 65, 12;
  --particle-label-rgb: 154, 52, 0;
  --particle-label-alpha: .6;
  --particle-core-rgb: 124, 29, 0;
  --glow-a: rgba(255, 140, 80, .22);
  --glow-b: rgba(99, 84, 255, .1);
}

:root[data-calendar-layer="christmas"] { --season-accent: #ff6b2c; }
:root[data-calendar-layer="new-year"] { --season-accent: #7dd3fc; }
:root[data-theme="light"][data-calendar-layer="christmas"] { --season-accent: #c2410c; }
:root[data-theme="light"][data-calendar-layer="new-year"] { --season-accent: #0a58ff; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  line-height: 1.65;
  background: var(--page-bg);
  color: var(--text);
  overflow-x: clip;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60rem 40rem at 12% -10%, var(--glow-a), transparent 65%),
    radial-gradient(50rem 36rem at 100% 25%, var(--glow-b), transparent 65%);
}

#constellation-field {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* The constellation moves behind the copy and must stay readable (WCAG 1.4.3) while still showing through faintly:
   cards and free-standing text sit on a mostly opaque surface, sticky bars are fully opaque. The surface list
   mirrors SURFACE_SELECTOR in constellation-engine.ts. */
:root, :root[data-theme="light"] {
  --surface: color-mix(in srgb, var(--surface-solid) 78%, transparent);
  --veil: color-mix(in srgb, var(--page-bg) 58%, transparent);
  --header-bg: var(--page-bg);
}
main :is(h1, h2, h3, h4, p, dl, ul, .breadcrumb, .tech-count, .page-hero-actions):not(:is(.project-card, .assignment, .skill-group, .contact-card, .git-graph, .cv-figures > div, .page-hero-panel, .practical > div, .project-facts > div, .project-detail > section, .service-cv-cta, .cv-toc) *):not(:is(.project-card, .assignment, .skill-group, .contact-card, .git-graph, .cv-figures > div, .page-hero-panel, .practical > div, .project-facts > div, .project-detail > section, .service-cv-cta, .cv-toc)),
footer {
  background: var(--veil);
  box-shadow: 0 0 1.75rem 1.25rem var(--veil);
}
/* The footer is transparent: its text is a measured obstacle for the constellation instead. */
footer { background: none; box-shadow: none; }

/* A heading's surface only hugs its words, so the constellation stays visible in the empty space beside it. The
   section rule above an h2 still spans the whole column. */
main :is(h1, h2, h3, h4):not(.visually-hidden):not(:is(.project-card, .assignment, .skill-group, .contact-card, .git-graph, .cv-figures > div, .page-hero-panel, .practical > div, .project-facts > div, .project-detail > section, .service-cv-cta, .cv-toc) *) {
  width: fit-content;
  max-width: 100%;
}
main :has(> h2:not(.visually-hidden):not(:is(.project-card, .assignment, .skill-group, .contact-card, .git-graph, .cv-figures > div, .page-hero-panel, .practical > div, .project-facts > div, .project-detail > section, .service-cv-cta, .cv-toc) *)) { container-type: inline-size; }
main h2:not(.visually-hidden):not(:is(.project-card, .assignment, .skill-group, .contact-card, .git-graph, .cv-figures > div, .page-hero-panel, .practical > div, .project-facts > div, .project-detail > section, .service-cv-cta, .cv-toc) *) { position: relative; border-top: 0; }
main h2:not(.visually-hidden):not(:is(.project-card, .assignment, .skill-group, .contact-card, .git-graph, .cv-figures > div, .page-hero-panel, .practical > div, .project-facts > div, .project-detail > section, .service-cv-cta, .cv-toc) *)::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100cqi;
  border-top: 1px solid var(--line);
}

/* Narrow screens (matches NARROW_VIEWPORT in constellation-engine.ts): the constellation is subdued as well. */
@media (max-width: 699.98px) {
  #constellation-field { opacity: .55; }
}

header, main, footer { position: relative; z-index: 1; width: min(100% - 2rem, 72rem); margin-inline: auto; }

a { color: var(--link); text-underline-offset: .2em; }
a:hover { color: var(--text); }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

button {
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .45rem 1.1rem;
  cursor: pointer;
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
button:hover { border-color: var(--accent); box-shadow: 0 0 1.5rem -.25rem var(--accent); transform: translateY(-1px); }

.motion-toggle {
  flex: 0 0 2.75rem;
  width: 2.75rem;
  height: 2.75rem;
  min-height: 2.75rem;
  padding: 0;
  display: inline-grid;
  place-items: center;
}
.motion-toggle[hidden] { display: none; }
.motion-toggle-icon { display: block; width: .8rem; height: 1rem; border-inline: .2rem solid currentColor; }
.motion-toggle[aria-pressed="true"] .motion-toggle-icon {
  width: 0;
  height: 0;
  border: .5rem solid transparent;
  border-right: 0;
  border-left: .8rem solid currentColor;
  transform: translateX(.1rem);
}

.skip-link { position: absolute; left: 1rem; top: -5rem; z-index: 60; padding: .5rem 1rem; background: var(--surface-solid); border-radius: .5rem; }
.skip-link:focus { top: 1rem; }
.skip-link:focus + .site-header { margin-top: 3rem; }

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem 1.5rem;
  padding-block: 1.25rem;
  border-top: .2rem solid var(--season-accent);
  background: var(--header-bg);
  box-shadow: 0 0 1.75rem 1.25rem var(--header-bg);
}
.brand-wrap { display: flex; align-items: center; gap: .75rem; }
.brand { display: inline-flex; align-items: center; min-width: 1.5rem; min-height: 1.5rem; font-size: 1.15rem; font-weight: 800; letter-spacing: -.02em; text-decoration: none; color: var(--text); }
/* The mark is a tiny constellation (three linked nodes); it is also the trigger of the hidden easter egg. */
.brand-mark { display: inline-flex; width: 1.5rem; height: 1.5rem; user-select: none; }
.brand-mark svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 0 .4rem var(--accent)); animation: brand-glow 3.2s ease-in-out infinite; }
.brand-mark-links { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: .55; }
.brand-mark circle { fill: var(--accent); }
nav { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; }
nav a { color: var(--muted); font-weight: 600; text-decoration: none; padding-block: .25rem; border-bottom: 2px solid transparent; transition: color .2s, border-color .2s; }
nav a:hover, nav a:focus-visible { color: var(--text); border-bottom-color: var(--accent); }

main { min-height: 65vh; padding-block: clamp(2rem, 7vw, 5rem); animation: rise .8s cubic-bezier(.2, .7, .2, 1) both; }
.page-layout { display: block; }
article { max-width: 56rem; min-width: 0; }

/* Start page: a quiet title so the constellation behind it is the focus. */
main.home { min-height: calc(100svh - 11rem); display: grid; align-content: center; }
main.home h1 { font-size: clamp(2.75rem, 8vw, 5.5rem); margin-inline: auto; margin-bottom: 1.25rem; }
main.home article:not(.cv) > h1 + p {
  margin: 1rem auto 0;
  font-family: var(--font-display);
  font-size: clamp(1rem, 2.4vw, 1.5rem);
  line-height: 1.25;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 600;
  color: var(--muted);
  text-shadow: none;
}
main.home .cv-actions { margin-top: 2rem; justify-content: center; }
main.home article { margin-inline: auto; text-align: center; }
main.home article > p { margin-inline: auto; text-align: center; }
main.home h1::after { margin-inline: auto; background: linear-gradient(90deg, transparent, var(--accent), transparent); }
:root:has(main.home) .site-header { flex-direction: column; align-items: center; justify-content: center; text-align: center; }
:root:has(main.home) .brand-wrap,
:root:has(main.home) nav { justify-content: center; }
/* Sub pages: centered column and hero (title, accent rule, lead), left-aligned body text for readability. */
main:not(.home) article:not(.cv) { margin-inline: auto; }
main:not(.home) article:not(.cv) > h1 { margin-inline: auto; text-align: center; }
main:not(.home) article:not(.cv) > h1::after { margin-inline: auto; background: linear-gradient(90deg, transparent, var(--accent), transparent); }
main:not(.home) article:not(.cv) > h1 + p { margin-inline: auto; text-align: center; }
main:not(.home) .contact-card { margin-inline: auto; }
:root:has(main.home) { --particle-label-alpha: .42; }
:root[data-theme="light"]:has(main.home) { --particle-label-alpha: .7; }

h1 {
  margin: 0 0 1.5rem;
  font-family: var(--font-condensed);
  font-size: clamp(3rem, 11vw, 7rem);
  line-height: .9;
  letter-spacing: .005em;
  text-transform: uppercase;
  font-weight: 800;
  overflow-wrap: anywhere;
  text-shadow: 0 0 4rem rgba(var(--particle-rgb), .35);
}
h1::after { content: ""; display: block; width: 5rem; height: .35rem; margin-top: 1.5rem; border-radius: 999px; background: linear-gradient(90deg, var(--accent), transparent); }
.cv-tagline {
  display: block;
  margin-top: 1rem;
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 3.2vw, 1.75rem);
  line-height: 1.25;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 600;
  color: var(--muted);
  text-shadow: none;
}
h2 {
  margin: 4.5rem 0 1.25rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-family: var(--font-condensed);
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: .95;
  letter-spacing: .01em;
  text-transform: uppercase;
  font-weight: 800;
  hyphens: auto;
  overflow-wrap: anywhere;
  scroll-margin-top: 6rem;
}
h3 { margin: 2.5rem 0 .5rem; padding-left: 1rem; border-left: .25rem solid var(--accent); font-family: var(--font-condensed); font-size: 1.8rem; line-height: 1.1; letter-spacing: .01em; font-weight: 700; hyphens: auto; overflow-wrap: anywhere; scroll-margin-top: 6rem; }
p, li { max-width: 68ch; }
article:not(.cv) > p:first-of-type { font-size: 1.2rem; color: var(--muted); }
article strong { color: var(--text); }
hr { border: 0; border-top: 1px solid var(--line); margin-block: 2.5rem; }

footer { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; padding-block: 2.5rem 6rem; color: var(--muted); border-top: 1px solid var(--line); }

.cv-toc-title { margin: 0 0 .75rem; font-size: .8rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.cv-toc ol { margin: 0; padding: 0; list-style: none; }
.cv-toc a { display: block; padding: .35rem .75rem; color: var(--muted); font-weight: 600; text-decoration: none; border-left: 2px solid var(--line); transition: color .2s, border-color .2s, background .2s; }
.cv-toc a:hover { color: var(--text); }
.cv-toc a[aria-current="location"] { color: var(--text); border-left-color: var(--accent); background: linear-gradient(90deg, rgba(var(--particle-rgb), .14), transparent); }

.cv-search { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 30; display: flex; flex-direction: column; align-items: flex-end; gap: .75rem; }
#cv-search-toggle { display: inline-flex; align-items: center; gap: .6rem; padding: .7rem 1.2rem; background: var(--surface-solid); border-color: var(--accent); box-shadow: 0 .5rem 2rem -.5rem rgba(0, 0, 0, .6), 0 0 1.5rem -.5rem var(--accent); }
#cv-search-toggle kbd { font: inherit; font-size: .75rem; color: var(--muted); border: 1px solid var(--line); border-radius: .35rem; padding: .05rem .4rem; }
.cv-search-panel { order: -1; width: min(26rem, 100vw - 2.5rem); max-height: min(30rem, 65vh); overflow-y: auto; padding: 1rem; background: var(--surface-solid); border: 1px solid var(--line); border-radius: 1.25rem; box-shadow: 0 1.5rem 4rem -1rem rgba(0, 0, 0, .7); }
.cv-search-panel label { display: block; margin-bottom: .5rem; font-weight: 700; }
.cv-search-panel input { width: 100%; font: inherit; color: var(--text); background: transparent; border: 1px solid var(--line); border-radius: .75rem; padding: .65rem .85rem; }
.cv-search-panel input::placeholder { color: var(--muted); }
#cv-search-results { margin: .75rem 0 0; padding: 0; list-style: none; }
#cv-search-results li { padding: .6rem .25rem; border-top: 1px solid var(--line); }
#cv-search-results a { display: block; font-weight: 700; }
#cv-search-results span, .cv-search-empty { display: block; color: var(--muted); font-size: .9rem; }
#cv-search-results mark { color: var(--text); background: color-mix(in srgb, var(--accent) 35%, transparent); border-radius: .2rem; padding: 0 .1rem; }
.cv-search-hit { animation: cv-search-hit 2.5s ease-out; }
@keyframes cv-search-hit { 0%, 40% { background: color-mix(in srgb, var(--accent) 30%, transparent); } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .cv-search-hit { animation: none; outline: 2px solid var(--accent); } }

.easter-egg {
  position: fixed;
  left: 50%;
  bottom: 5.5rem;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: calc(100vw - 2rem);
  padding: .9rem 1.25rem;
  background: var(--surface-solid);
  border: 1px solid var(--accent);
  border-radius: 1rem;
  box-shadow: 0 0 3rem -.5rem var(--accent);
  transform: translateX(-50%);
  animation: pop .5s cubic-bezier(.2, 1.4, .4, 1) both;
}
.easter-egg p { margin: 0; }

@media (min-width: 64rem) {
  .site-header { position: sticky; top: 0; z-index: 20; width: 100%; padding-inline: max(1rem, calc((100% - 72rem) / 2)); background: var(--header-bg); box-shadow: none; backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
  .page-layout:has(#cv-toc:not([hidden])) { display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: 4rem; }
  .cv-toc { position: sticky; top: 7rem; align-self: start; padding: 1rem 1rem 1rem .5rem; border: 1px solid var(--line); border-radius: 1.1rem; background: var(--surface); backdrop-filter: blur(10px); }
}

@media (max-width: 63.99rem) {
  .cv-toc { position: sticky; top: 0; z-index: 15; margin: 0 -1rem 1.5rem; padding: .6rem 1rem; background: var(--header-bg); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
  .cv-toc-title { display: none; }
  .cv-toc ol { display: flex; gap: .5rem; overflow-x: auto; scrollbar-width: none; }
  .cv-toc a { white-space: nowrap; border: 1px solid var(--line); border-radius: 999px; }
  .cv-toc a[aria-current="location"] { border-color: var(--accent); }
  h2, h3 { scroll-margin-top: 5rem; }
}

.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---------- CV hero ---------- */
:root { --lane-0: var(--muted); --lane-1: #ff9a5c; --lane-2: #7dd3fc; --lane-3: #c4a5ff; --lane-4: #6ee7b7; --lane-5: #fda4af; }
:root[data-theme="light"] { --lane-1: #c2410c; --lane-2: #0369a1; --lane-3: #7e22ce; --lane-4: #047857; --lane-5: #be123c; }

.cv-hero { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem; align-items: end; margin-bottom: 2.5rem; }
.cv-hero:has(.cv-photo) { grid-template-columns: minmax(0, 1fr) minmax(0, 20rem); }
.cv-hero-copy > * { animation: rise .8s cubic-bezier(.2, .7, .2, 1) both; }
.cv-hero-copy > :nth-child(2) { animation-delay: .06s; }
.cv-hero-copy > :nth-child(3) { animation-delay: .12s; }
.cv-hero-copy > :nth-child(4) { animation-delay: .18s; }
.cv-hero-copy > :nth-child(5) { animation-delay: .24s; }
.cv-hero h1 { font-size: clamp(4rem, 17vw, 10.5rem); line-height: .84; margin-bottom: 1.25rem; }
.cv-hero h1::after { margin-top: 1.25rem; }
.cv-kicker { margin: 0 0 1rem; font-family: var(--font-mono); font-size: clamp(.55rem, 2.6vw, .85rem); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; overflow-wrap: anywhere; color: var(--link); }
.cv-roles { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1.25rem; padding: 0; list-style: none; }
.cv-roles li { padding: .3rem .85rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-weight: 600; backdrop-filter: blur(8px); }
.cv-summary { max-width: 46ch; margin: 0 0 1.5rem; font-size: clamp(1.1rem, 2vw, 1.45rem); line-height: 1.45; color: var(--text); text-shadow: 0 0 1.5rem var(--veil); }
.cv-actions { display: flex; flex-wrap: wrap; gap: .75rem; max-width: none; margin: 0; }
.button-link { display: inline-flex; align-items: center; padding: .7rem 1.4rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-solid); color: var(--text); font-weight: 700; text-decoration: none; transition: border-color .2s, transform .2s, box-shadow .2s; }
.button-link:hover { color: var(--text); border-color: var(--accent); box-shadow: 0 0 1.5rem -.25rem var(--accent); transform: translateY(-1px); }
.button-link.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.button-link.primary:hover { color: var(--on-accent); }

.contact-card { position: relative; max-width: 40rem; margin-top: 2.5rem; padding: clamp(1.5rem, 4vw, 2.5rem); border: 1px solid var(--line); border-radius: 1.5rem; background: var(--surface-solid); box-shadow: 0 1.5rem 4rem -2rem rgba(0, 0, 0, .6); }
.contact-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: .25rem; border-radius: 1.5rem 0 0 1.5rem; background: linear-gradient(var(--accent), var(--focus)); }
.contact-card h2 { margin: 0 0 1rem; padding: 0; border: 0; font-size: clamp(1.8rem, 5vw, 2.8rem); line-height: .95; }
.contact-card p { margin: 0 0 1.25rem; }
.contact-eyebrow { margin: 0 0 .5rem; font-family: var(--font-mono); font-size: .8rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--link); }
.contact-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
.contact-field { display: grid; gap: .4rem; }
.contact-field label { font-weight: 700; }
.contact-field input, .contact-field textarea { width: 100%; box-sizing: border-box; font: inherit; color: var(--text); background: var(--surface-solid); border: 1px solid var(--line); border-radius: .75rem; padding: .7rem .9rem; }
.contact-field textarea { resize: vertical; min-height: 9rem; }
.contact-field input:focus-visible, .contact-field textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.contact-field [aria-invalid="true"] { border-color: var(--accent); }
.contact-error { margin: 0; color: var(--link); font-size: .95rem; }
.contact-notice { margin: 0 0 1.25rem; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: .75rem; background: var(--surface-solid); }
.contact-notice p { margin: 0; }
.contact-alert { border-color: var(--accent); }
.contact-alert:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.contact-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin: 0; }
.contact-submit { padding: .7rem 1.4rem; font-weight: 700; background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.contact-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
/* The Turnstile widget is a fixed 300px wide; scale it down so it fits the card on very narrow screens. */
@media (max-width: 25rem) {
  .contact-card { padding: 1.25rem; }
  .cf-turnstile { transform: scale(.8); transform-origin: 0 0; height: 3.3rem; }
}
.cv-photo { display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 1.5rem; border: 1px solid var(--line); box-shadow: 0 0 5rem -1.5rem var(--accent); }

.cv-figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 1rem; margin: 0 0 3rem; padding: 0; }
.cv-figures > div { position: relative; overflow: hidden; padding: 1.1rem 1.25rem; border: 1px solid var(--line); border-radius: 1.25rem; background: var(--surface); backdrop-filter: blur(10px); }
.cv-figures dt { order: 2; font-family: var(--font-mono); font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.cv-figures dd { margin: 0; font-family: var(--font-condensed); font-size: clamp(3rem, 6vw, 4.5rem); font-weight: 800; line-height: .95; color: var(--link); }
.cv-figures > div { display: flex; flex-direction: column; }

/* ---------- Skill chips ---------- */
.skill-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: 1rem; margin-block: 1.5rem; }
.skill-groups-title { grid-column: 1 / -1; margin: 0; font-family: var(--font-mono); font-size: .8rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.skill-group { position: relative; overflow: hidden; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: 1.1rem; background: var(--surface); backdrop-filter: blur(10px); transition: border-color .25s; }
.skill-group:hover, .skill-group:focus-within { border-color: rgba(var(--particle-rgb), .6); }
.skill-group-name { margin: 0 0 .6rem; font-family: var(--font-condensed); font-size: 1.35rem; font-weight: 700; color: var(--link); }
.skill-group-btn {
  display: inline-flex;
  align-items: baseline;
  gap: .5rem;
  min-height: 2.75rem;
  margin-inline-start: -.55rem;
  padding: .2rem .55rem;
  border: 1px solid transparent;
  border-radius: .7rem;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  cursor: pointer;
}
.skill-group-btn:hover { border-color: var(--line); background: none; box-shadow: none; transform: none; }
.skill-group-btn[aria-pressed="true"] { border-color: var(--accent); background: rgba(var(--particle-rgb), .16); }
.skill-group-count { font-family: var(--font-mono); font-size: .78rem; font-weight: 400; color: var(--muted); }
.skill-group:has(.skill-group-btn[aria-pressed="true"]) { border-color: var(--accent); }
.chips, .tags { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; padding: 0; list-style: none; }
.chips li, .tags li { max-width: none; padding: .2rem .7rem; border: 1px solid var(--line); border-radius: 999px; background: rgba(var(--particle-rgb), .06); font-size: .9rem; line-height: 1.5; transition: border-color .2s, background .2s, color .2s; }
.chips li:hover { border-color: var(--accent); background: rgba(var(--particle-rgb), .18); }
.tags li { font-family: var(--font-mono); font-size: .78rem; color: var(--muted); }

/* ---------- Assignment cards ---------- */
.assignment { position: relative; overflow: hidden; margin-block: 1.5rem; padding: clamp(1.25rem, 3vw, 2rem); border: 1px solid var(--line); border-radius: 1.5rem; background: var(--surface); backdrop-filter: blur(12px); scroll-margin-top: 6rem; transition: border-color .25s; }
.assignment:hover, .assignment:focus-within { border-color: rgba(var(--particle-rgb), .6); }
.assignment::before, .cv-figures > div::before, .skill-group::before { content: ""; position: absolute; inset: 0; opacity: 0; pointer-events: none; background: radial-gradient(20rem circle at var(--mx, 50%) var(--my, 0%), rgba(var(--particle-rgb), .14), transparent 65%); transition: opacity .3s; }
.assignment:hover::before, .cv-figures > div:hover::before, .skill-group:hover::before { opacity: 1; }
.assignment h3 { margin: 0 0 .5rem; padding: 0; border: 0; font-size: clamp(1.7rem, 4vw, 2.9rem); line-height: .95; text-transform: uppercase; }
.assignment-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem 1rem; max-width: none; margin: 0 0 1rem; }
.assignment-period { padding: .1rem .6rem; border: 1px solid var(--accent); border-radius: .4rem; font-family: var(--font-mono); font-size: .82rem; font-weight: 700; color: var(--link); }
.assignment-role { color: var(--muted); font-weight: 600; }
.assignment-tags { margin-bottom: 1.25rem; }
.assignment h4:not(.visually-hidden) { margin: 1.5rem 0 .25rem; font-family: var(--font-mono); font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--link); }
.assignment > p, .assignment > ul { color: var(--text); }
.assignment > ul { padding-left: 1.2rem; }

/* ---------- Git log ---------- */
.git-graph { margin-block: 1.5rem 2.5rem; padding: 1rem 1.25rem; border: 1px solid var(--line); border-radius: 1.25rem; background: var(--surface); backdrop-filter: blur(12px); font-family: var(--font-mono); font-size: .86rem; }
.git-graph-title { margin: 0 0 .5rem; color: var(--link); font-weight: 700; }
.git-log { margin: 0; padding: 0; list-style: none; }
.git-row { display: flex; align-items: center; max-width: none; min-height: 30px; border-radius: .4rem; transition: background .2s; }
.git-row:hover, .git-row:focus-within { background: rgba(var(--particle-rgb), .1); }
.git-lanes { flex: none; }
.lane-0 { --lane: var(--lane-0); } .lane-1 { --lane: var(--lane-1); } .lane-2 { --lane: var(--lane-2); }
.lane-3 { --lane: var(--lane-3); } .lane-4 { --lane: var(--lane-4); } .lane-5 { --lane: var(--lane-5); }
line.lane { stroke: var(--lane); stroke-width: 2; stroke-linecap: round; fill: none; opacity: .8; }
.dot { stroke: var(--lane); stroke-width: 2; fill: var(--lane); }
.dot.merge { fill: var(--page-bg); }
.git-text { flex: 1; min-width: 0; padding-left: .4rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 30px; }
.git-hash { margin-right: .6rem; color: var(--muted); }
.git-year { margin-right: .6rem; color: var(--link); font-weight: 700; }
.git-msg { color: var(--text); font-weight: 700; }
a.git-msg { text-decoration-color: rgba(var(--particle-rgb), .5); }
.git-role { margin-left: .6rem; color: var(--muted); }
.git-text.muted .git-msg { color: var(--muted); font-weight: 400; }
.git-ref { padding: .05rem .5rem; border: 1px solid var(--accent); border-radius: .35rem; background: rgba(var(--particle-rgb), .14); font-weight: 700; }

@media (max-width: 47.99rem) {
  .cv-hero:has(.cv-photo) { grid-template-columns: minmax(0, 1fr); }
  .cv-photo { max-width: 18rem; }
  .git-hash { display: none; }
  .git-role { display: none; }
}

@keyframes brand-glow { 0%, 100% { filter: drop-shadow(0 0 .25rem var(--accent)); } 50% { filter: drop-shadow(0 0 .7rem var(--accent)); } }
@keyframes rise { from { opacity: 0; transform: translateY(1.5rem); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateX(-50%) scale(.85); } to { opacity: 1; transform: translateX(-50%) scale(1); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}


/* Editorial project cards and detail sections keep generated content scannable. */
.project-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: 1rem; margin-top: 2rem; }
.project-card { min-width: 0; padding: 1.25rem; border: 1px solid var(--line); border-radius: 1rem; background: var(--surface); }
.project-card h2 { margin: 0; padding: 0; border: 0; font-size: clamp(1.6rem, 3vw, 2.2rem); }
.project-card h2 a { color: var(--text); text-decoration-color: var(--accent); }
.project-card-description { margin-bottom: 0; color: var(--muted); }
.project-detail { display: grid; gap: 1.5rem; }
.project-detail > section, .project-detail > .project-intro { min-width: 0; }
.project-detail > section { padding: clamp(1rem, 3vw, 1.5rem); border: 1px solid var(--line); border-radius: 1rem; background: var(--surface); }
.project-detail > section h2 { margin-top: 0; }
.project-detail > section.project-technologies ul { display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; list-style: none; }
.project-detail > section.project-technologies li { padding: .25rem .7rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-solid); }
.project-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.service-cv-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .5rem 1rem; margin-top: 3rem; padding: 1.5rem; border: 1px solid var(--line); border-radius: 1rem; background: var(--surface); }
.service-cv-cta p { margin: 0; }

/* ---------- v3 design: navigation, technology buttons, projects, contact and print ---------- */
nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

/* Technology chips as buttons */
.skill-chips { display: flex; flex-wrap: wrap; gap: .45rem; margin: 0; padding: 0; list-style: none; }
.chips li:has(> .skill-btn),
.project-detail > section.project-technologies li:has(> .skill-btn) { padding: 0; border: 0; background: none; }
.skill-btn {
  appearance: none; cursor: pointer; font: inherit; font-size: .9rem; line-height: 1.5; color: var(--text);
  padding: .25rem .8rem; border: 1px solid var(--line); border-radius: 999px;
  background: rgba(var(--particle-rgb), .06);
  transition: border-color .2s, background .2s, color .2s, transform .2s, box-shadow .2s;
}
.skill-btn:hover { border-color: var(--accent); background: rgba(var(--particle-rgb), .18); transform: translateY(-1px); }
.skill-btn[aria-pressed="true"] {
  background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700;
  box-shadow: 0 0 1.25rem -.15rem var(--accent);
}
.skill-btn[hidden], [data-tech-item][hidden] { display: none; }

@media (max-width: 699.98px) {
  .skill-btn { display: inline-flex; align-items: center; min-height: 2.75rem; }
}

.tech-hint { margin: 0; font-size: .85rem; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--muted); }
.tech-status { min-height: 1.6em; margin: .25rem 0 .75rem; color: var(--link); font-family: var(--font-mono); font-size: .85rem; }
.skill-groups > .tech-status { grid-column: 1 / -1; margin: 0; }
.tech-status:empty::before { content: "Inget markerat"; color: var(--muted); }
.tech-panel { margin-top: 1rem; }
.tech-filter { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.tech-filter input {
  flex: 1 1 14rem; max-width: 24rem; font: inherit; color: var(--text); background: var(--surface-solid);
  border: 1px solid var(--line); border-radius: 999px; padding: .6rem 1rem;
}
.tech-count { color: var(--muted); font-size: .9rem; }
.tech-empty { color: var(--muted); }
.cv-hero h1 { font-size: clamp(3rem, 9vw, 7.5rem); overflow-wrap: normal; }
.skill-group-name { margin-bottom: .6rem; }

/* Project list and detail */
.project-card { display: flex; flex-direction: column; gap: .6rem; transition: border-color .2s, transform .2s; }
.project-card:hover, .project-card:focus-within { border-color: var(--accent); transform: translateY(-2px); }
.project-card .project-card-meta { margin: 0; font-family: var(--font-mono); font-size: .74rem; letter-spacing: .08em; line-height: 1.4; text-transform: uppercase; color: var(--link); }
.project-card h2 { font-size: clamp(1.3rem, 2vw, 1.55rem); overflow-wrap: anywhere; }
.project-card .tags { margin-top: auto; }
.tags [data-tags-more] { border-style: dashed; color: var(--link); font-weight: 700; cursor: help; }
.project-card-link { margin: 0; font-weight: 700; }
.project-card-link a { color: var(--link); text-decoration: none; }
.assignment-link { margin: 1.25rem 0 0; font-weight: 700; }
.assignment-link a { color: var(--link); text-decoration: none; }
.assignment-link a:hover, .project-card-link a:hover { text-decoration: underline; }

/* On wider screens the assignment cards are narrower and take turns on the left and the right, so the history reads
   as a staggered timeline instead of a column of very wide boxes. They never overlap: each one sits on its own row. */
@media (min-width: 48rem) {
  .assignment { width: min(100%, 36rem); }
  .assignment:nth-of-type(odd) { margin-right: auto; }
  .assignment:nth-of-type(even) { margin-left: auto; }
}
.project-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .75rem; margin: 0; }
.project-facts > div { padding: .9rem 1.1rem; border: 1px solid var(--line); border-radius: 1rem; background: var(--surface); }
.project-facts dt { font-family: var(--font-mono); font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.project-facts dd { margin: .25rem 0 0; font-weight: 700; }
.breadcrumb { margin-bottom: 1rem; font-size: .9rem; color: var(--muted); }
.breadcrumb a { color: var(--link); }
.project-detail section ul { padding-left: 1.2rem; }
.project-detail h1 { font-size: clamp(2.4rem, 7vw, 4.2rem); overflow-wrap: anywhere; }
.project-detail > section h2 { border-top: 0; padding-top: 0; font-size: clamp(1.6rem, 3.5vw, 2.2rem); }

/* Contact and CV extras */
.contact-note { color: var(--muted); font-size: .9rem; }
.contact-card .contact-actions { margin-top: 1.25rem; }
button.button-link { font: inherit; font-weight: 700; cursor: pointer; }
.practical { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .75rem; margin: 1.5rem 0 0; }
.practical > div { padding: .9rem 1.1rem; border: 1px solid var(--line); border-radius: 1rem; background: var(--surface); }
.practical dt { font-family: var(--font-mono); font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.practical dd { margin: .25rem 0 0; font-weight: 700; }

/* Two-column page hero: headline and lead on the left, a panel with short items on the right. */
article.wide { max-width: none; }
.page-hero { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(18rem, 1fr); gap: clamp(2rem, 5vw, 4.5rem); align-items: center; }
/* Tabs change the panel height; top alignment keeps the headline from moving when the tab changes. */
.page-hero:has(.hero-tabs) { align-items: start; }
@media (min-width: 64rem) { .page-hero:has(.hero-tabs) .page-hero-copy { padding-top: 3.5rem; } }
.page-hero-kicker { margin: 0 0 1rem; font-family: var(--font-mono); font-size: .8rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--link); }
.page-hero h1 { margin-bottom: 1.25rem; font-size: clamp(2.8rem, 6.5vw, 5.5rem); line-height: .92; }
.page-hero-lead p { max-width: 38ch; margin: 0 0 1.75rem; font-size: clamp(1.1rem, 2vw, 1.4rem); line-height: 1.5; color: var(--muted); }
.page-hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin: 0; }
.page-hero-actions .button-link { gap: .5rem; }
.page-hero-panel { padding: clamp(1.5rem, 3vw, 2.25rem); border: 1px solid var(--line); border-left: .25rem solid var(--accent); border-radius: 1.25rem; background: var(--surface); backdrop-filter: blur(12px); }
.page-hero-panel-title { margin: 0 0 1.25rem; font-family: var(--font-condensed); font-size: clamp(1.9rem, 3.4vw, 2.6rem); font-weight: 800; line-height: 1; text-transform: uppercase; }
.page-hero-list { margin: 0; padding: 0; list-style: none; }
.page-hero-list li { max-width: none; padding: 1rem 0; border-top: 1px solid var(--line); }
.page-hero-list li:last-child { padding-bottom: 0; }
.page-hero-list strong { display: block; font-family: var(--font-condensed); font-size: 1.5rem; font-weight: 700; line-height: 1.15; color: var(--link); }
.page-hero-item-text p { margin: .25rem 0 0; color: var(--muted); }

/* Panel with tabs. Without scripts every group is shown in turn under its own heading. */
.hero-tabs .hero-tab-panel + .hero-tab-panel { margin-top: 1.5rem; }
.hero-tabs .hero-tab-heading { margin: 0 0 .5rem; padding: 0; border: 0; font-size: 1.75rem; line-height: 1; }
.hero-tab-lead p { margin: 0 0 .25rem; color: var(--muted); font-size: .95rem; }
.hero-tabs .page-hero-list li { padding: .7rem 0; }
.hero-tabs .page-hero-list li:first-child { border-top: 0; }
.hero-tabs .page-hero-list li:last-child { padding-bottom: 0; }
.hero-tabs .page-hero-list strong { font-size: 1.35rem; }
.hero-tablist { display: flex; flex-wrap: wrap; gap: .25rem; margin-bottom: 1rem; padding: .25rem; border: 1px solid var(--line); border-radius: 1.5rem; background: var(--surface-solid); }
.hero-tab { flex: 1 1 auto; min-width: 0; padding: .5rem .75rem; font-size: .9rem; font-weight: 700; white-space: nowrap; color: var(--muted); background: none; border-color: transparent; transition: background .2s, color .2s; }
.hero-tab:hover:not([aria-selected="true"]) { color: var(--text); border-color: transparent; box-shadow: none; transform: none; }
.hero-tab[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.hero-tab[aria-selected="true"]:hover { box-shadow: none; transform: none; }
.hero-tabs[data-enhanced] .hero-tab-heading { display: none; }
.hero-tabs[data-enhanced] .hero-tab-panel + .hero-tab-panel { margin-top: 0; }
.hero-tabs[data-enhanced] .hero-tab-panel[hidden] { display: none; }
.cv-competence-panel { margin: 1.5rem 0 2rem; }
.hero-tab-panel:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; border-radius: .5rem; }
@media (max-width: 63.99rem) { .page-hero { grid-template-columns: minmax(0, 1fr); } }

/* The start page shares the sub-page header (logo left, navigation centred, theme toggle right). */
:root:has(main.home) .site-header { flex-direction: row; align-items: center; justify-content: space-between; text-align: left; }
:root:has(main.home) .brand-wrap { justify-content: flex-start; }
:root:has(main.home) nav { justify-content: center; }
main.home { min-height: calc(100svh - 12rem); }

@media print {
  :root, :root[data-theme="dark"] { --page-bg: #fff; --text: #111; --muted: #444; --link: #9a3412; --line: #ccc; --surface: #fff; --surface-solid: #fff; --accent: #c2410c; --on-accent: #fff; }
  html, body { background: #fff !important; color: #111; }
  body::before, #constellation-field, .site-header, .motion-toggle, footer, #cv-toc, #cv-search, #easter-egg, .cv-actions, .skip-link, .tech-hint { display: none !important; }
  main { padding: 0; max-width: none; }
  main * { box-shadow: none !important; }
  .page-layout { display: block !important; }
  .assignment, .skill-group, .cv-figures > div, .practical > div { break-inside: avoid; box-shadow: none; backdrop-filter: none; background: #fff; }
  .assignment { padding: .7rem 1rem; margin: .5rem 0; width: auto; }
  .assignment h3 { margin-top: 0; font-size: 1.3rem; }
  .cv-hero h1 { font-size: 2.6rem; }
  h2 { margin-top: 1.5rem; padding-top: 1rem; font-size: 1.8rem; }
  .cv-figures { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cv-figures dt { font-size: .6rem; letter-spacing: .06em; overflow-wrap: anywhere; }
  .cv-figures dd { font-size: 1.8rem; }
  .practical { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .practical dt { font-size: .6rem; letter-spacing: .06em; }
  .practical dd { font-size: .85rem; }
  .skill-btn { color: #111; border-color: #aaa; background: #fff; }
  .hero-tablist { display: none !important; }
  .hero-tabs[data-enhanced] .hero-tab-heading { display: block; }
  .hero-tabs[data-enhanced] .hero-tab-panel[hidden] { display: block; }
  a { color: #111; text-decoration: none; }
  @page { size: A4; margin: 14mm; }
}
