/*
  ============================================================
  FILE: css/style.css
  PURPOSE: All visual styling for the personal profile site.
  ROLE IN PROJECT: Controls layout, colors, typography, buttons,
                   spacing, and responsive behaviour.
                   Designed with CSS variables so the look-and-feel
                   can be changed later without touching HTML or JS.
  ============================================================
*/

/* ---------- CSS VARIABLES (easy to customize later) ---------- */
:root {
  /* Colors – light mode (default) */
  --color-bg: #f1f5f9;
  --color-surface: #f8fafc;
  --color-text: #1a1a1a;
  --color-text-muted: #555;
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-nav-active: #2563eb;           /* selected item in left sidebar */
  --color-border: #e2e8f0;
  --color-sidebar-bg: rgba(241, 245, 249, 0.88);
  --color-topnav-bg: #0f172a;
  --color-topnav-text: #f8fafc;
  --color-details-bg: rgba(255, 255, 255, 0.25);
  --color-details-bg-open: rgba(255, 255, 255, 0.35);
  --color-code-bg: #f1f5f9;
  --color-photo-opacity: 0.18;
  --color-sidebar-hover: rgba(0, 0, 0, 0.05);

  /* Typography */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, monospace;

  /* Spacing & sizing */
  --topnav-height: 56px;
  --topnav-offset: var(--topnav-height);
  --sidebar-width: 240px;
  --radius: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/*
  Dark mode palette: deep blue–aquamarine, soft text, teal accent.
  Applied when:
    - OS/browser is dark AND user has not forced light, OR
    - user forced dark via the theme button (data-theme="dark")
*/
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #0a1628;
    --color-surface: #0d2137;
    --color-text: #e8eef4;
    --color-text-muted: #9db0c4;
    --color-primary: #2dd4bf;
    --color-primary-hover: #5eead4;
    --color-nav-active: #1e6bb8;
    --color-border: #1e3a5f;
    --color-sidebar-bg: rgba(12, 28, 48, 0.92);
    --color-topnav-bg: #060f1a;
    --color-topnav-text: #e8eef4;
    --color-details-bg: rgba(15, 40, 65, 0.55);
    --color-details-bg-open: rgba(15, 40, 65, 0.75);
    --color-code-bg: #12263a;
    --color-photo-opacity: 0.12;
    --color-sidebar-hover: rgba(255, 255, 255, 0.06);
    --shadow: 0 1px 3px rgba(0,0,0,0.35);
  }
}

:root[data-theme="dark"] {
  --color-bg: #0a1628;
  --color-surface: #0d2137;
  --color-text: #e8eef4;
  --color-text-muted: #9db0c4;
  --color-primary: #2dd4bf;
  --color-primary-hover: #5eead4;
  --color-nav-active: #1e6bb8;
  --color-border: #1e3a5f;
  --color-sidebar-bg: rgba(12, 28, 48, 0.92);
  --color-topnav-bg: #060f1a;
  --color-topnav-text: #e8eef4;
  --color-details-bg: rgba(15, 40, 65, 0.55);
  --color-details-bg-open: rgba(15, 40, 65, 0.75);
  --color-code-bg: #12263a;
  --color-photo-opacity: 0.12;
  --color-sidebar-hover: rgba(255, 255, 255, 0.06);
  --shadow: 0 1px 3px rgba(0,0,0,0.35);
}

/* ---------- RESET & BASE ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  /* Custom sci-fi pointer; hotspot sits at its bright arrow tip. */
  cursor: url("/assets/pointer/scifi-pointer.svg") 2 1, url("/assets/pointer/scifi-pointer.png") 2 1, auto;
}

/* Keep the custom pointer consistent across the main page regions. */
#top-nav,
#sidebar,
#main-layout,
#content {
  cursor: url("/assets/pointer/scifi-pointer.svg") 2 1, url("/assets/pointer/scifi-pointer.png") 2 1, auto;
}

/* Clickable elements keep the same visual pointer and semantic fallback. */
a,
button,
.nav-btn,
.sidebar-btn,
summary,
.lang-btn,
#menu-toggle {
  cursor: url("/assets/pointer/scifi-pointer.svg") 2 1, url("/assets/pointer/scifi-pointer.png") 2 1, pointer !important;
}

/* The pressed sprite adds a brief energy pulse at the pointer tip. */
html.cursor-pressed,
html.cursor-pressed body,
html.cursor-pressed #top-nav,
html.cursor-pressed #sidebar,
html.cursor-pressed #main-layout,
html.cursor-pressed #content,
html.cursor-pressed a,
html.cursor-pressed button,
html.cursor-pressed .nav-btn,
html.cursor-pressed .sidebar-btn,
html.cursor-pressed summary,
html.cursor-pressed .lang-btn,
html.cursor-pressed #menu-toggle {
  cursor: url("/assets/pointer/scifi-pointer-click.svg") 2 1, url("/assets/pointer/scifi-pointer-click.png") 2 1, pointer !important;
}

/* Keep the custom pointer visible on cards and other controls with local cursor rules. */
@media (hover: hover) and (pointer: fine) {
  html,
  html * {
    cursor: url("/assets/pointer/scifi-pointer.svg") 2 1, url("/assets/pointer/scifi-pointer.png") 2 1, auto !important;
  }

  html.cursor-pressed,
  html.cursor-pressed * {
    cursor: url("/assets/pointer/scifi-pointer-click.svg") 2 1, url("/assets/pointer/scifi-pointer-click.png") 2 1, auto !important;
  }

  input,
  textarea,
  [contenteditable="true"] {
    cursor: text !important;
  }
}

/* DOM cursor layer lets the violet signal mote travel behind and across the pointer. */
.scifi-cursor {
  position: fixed;
  inset: 0 auto auto 0;
  width: 32px;
  height: 32px;
  z-index: 2147483647;
  pointer-events: none;
  opacity: 0;
  transition: opacity 100ms ease-out;
}

.scifi-cursor.is-visible { opacity: 1; }
.scifi-cursor.is-over-text { opacity: 0; }

.scifi-cursor-pointer {
  position: absolute;
  inset: 0;
  width: 32px;
  height: 32px;
  z-index: 2;
}

.scifi-cursor-pointer--click { display: none; }
html.cursor-pressed .scifi-cursor-pointer--idle { display: none; }
html.cursor-pressed .scifi-cursor-pointer--click { display: block; }

.scifi-orbit-speck {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #b49bff;
  box-shadow: 0 0 5px 2px rgb(153 125 255 / 72%);
  offset-path: path("M 10 0 C 18 1 20 9 16 15 C 11 23 2 19 0 11 C -2 4 2 -1 10 0");
  offset-rotate: 0deg;
  z-index: 3;
  animation: scifi-pointer-orbit 2s linear infinite,
             scifi-pointer-depth 2s steps(1, end) infinite;
}

@keyframes scifi-pointer-orbit {
  /* A closed path keeps the mote moving smoothly through the loop restart. */
  0% { offset-distance: 0%; }
  22% { offset-distance: 22%; }
  52% { offset-distance: 52%; }
  55% { offset-distance: 55%; }
  82% { offset-distance: 82%; }
  100% { offset-distance: 100%; }
}

@keyframes scifi-pointer-depth {
  /* Keep depth changes instantaneous so the mote never flickers through the pointer layer. */
  0%, 22% { z-index: 3; }
  22.01%, 55% { z-index: 1; }
  55.01%, 100% { z-index: 3; }
}

@media (hover: hover) and (pointer: fine) {
  html.has-sci-fi-cursor,
  html.has-sci-fi-cursor * { cursor: none !important; }

  html.has-sci-fi-cursor input,
  html.has-sci-fi-cursor textarea,
  html.has-sci-fi-cursor [contenteditable="true"] { cursor: text !important; }
}

@media (prefers-reduced-motion: reduce) {
  .scifi-orbit-speck {
    animation: none;
    offset-distance: 0%;
    opacity: 1;
    z-index: 3;
  }
}

a {
  color: var(--color-primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* ---------- TOP NAVIGATION BAR ---------- */
#top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topnav-height);
  background-color: var(--color-topnav-bg);
  color: var(--color-topnav-text);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  gap: 1.5rem;
  z-index: 100;
  box-shadow: var(--shadow);
}

.nav-brand a {
  color: var(--color-topnav-text);
  font-weight: 600;
  font-size: 1.1rem;
  text-decoration: none;
  white-space: nowrap;
}
.nav-brand a:hover {
  opacity: 0.9;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.nav-brand .nav-resume {
  display: inline-flex;
  align-items: center;
  padding: 0.27rem 0.55rem;
  border: 1px solid rgba(85, 219, 201, 0.55);
  border-radius: 4px;
  color: #8cebdd;
  font-size: 0.73rem;
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
}

.nav-brand .nav-resume:hover {
  border-color: #8cebdd;
  background: rgba(85, 219, 201, 0.1);
  opacity: 1;
}

.nav-links {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--color-topnav-text);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  opacity: 0.85;
  transition: background 0.15s, opacity 0.15s;
}
.nav-btn:hover {
  background: rgba(255,255,255,0.1);
  opacity: 1;
}
.nav-btn.active {
  background: rgba(255,255,255,0.18);
  opacity: 1;
  font-weight: 600;
}

/* Theme + language controls (right side of top bar) */
.top-controls {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.theme-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  color: var(--color-topnav-text);
  width: 2rem;
  height: 1.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  opacity: 0.85;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.theme-btn:hover {
  opacity: 1;
  background: rgba(255,255,255,0.15);
}

.lang-switcher {
  display: flex;
  gap: 0.25rem;
}
.lang-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  color: var(--color-topnav-text);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.75rem;
  opacity: 0.7;
}
.lang-btn:hover,
.lang-btn.active {
  opacity: 1;
  background: rgba(255,255,255,0.15);
}

/* ---------- FIRST-IMPRESSION HERO ---------- */
.hero {
  --hero-bg: #071321;
  --hero-text: #f4f8fc;
  --hero-muted: #a9bbcc;
  --hero-accent: #55dbc9;
  position: fixed;
  top: var(--topnav-offset);
  right: 0;
  bottom: 0;
  left: 0;
  min-height: 0;
  margin-top: 0;
  overflow: hidden;
  display: grid;
  align-items: center;
  color: var(--hero-text);
  background:
    radial-gradient(ellipse at 76% 49%, rgba(43, 113, 137, 0.16), transparent 36%),
    linear-gradient(125deg, #071321 0%, #0a1b2d 55%, #10192c 100%);
  z-index: 90;
  transform: translateX(0);
  transition: transform 0.56s cubic-bezier(0.76, 0, 0.24, 1);
  will-change: transform;
}

body.site-entered .hero {
  transform: translateX(-105%);
  pointer-events: none;
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.hero::before {
  inset: 0;
  opacity: 0.18;
  background-image: linear-gradient(rgba(119, 164, 188, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(119, 164, 188, 0.12) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(90deg, transparent 15%, #000 100%);
}

.hero::after {
  width: 32rem;
  height: 32rem;
  right: -10rem;
  bottom: 0;
  clip-path: inset(0 0 24rem 0);
  border: 1px solid rgba(85, 219, 201, 0.2);
  border-radius: 50%;
  box-shadow: 0 0 0 40px rgba(85, 219, 201, 0.025), 0 0 0 80px rgba(85, 219, 201, 0.02);
}

.hero-inner {
  position: relative;
  z-index: 1;
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 5rem 4rem 5.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(400px, 0.98fr);
  align-items: center;
  gap: 2.5rem;
}

.hero-copy {
  max-width: 660px;
  animation: hero-copy-in 0.75s ease-out both;
}

.hero-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1.4rem;
  color: #b2c5d5;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  line-height: 1.4;
  text-transform: uppercase;
}

.hero-eyebrow-dot,
.caption-dot {
  width: 0.48rem;
  height: 0.48rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--hero-accent);
  box-shadow: 0 0 16px rgba(85, 219, 201, 0.8);
}

.hero h1 {
  max-width: 720px;
  margin: 0;
  color: var(--hero-text);
  font-size: clamp(3rem, 5.4vw, 5.35rem);
  font-weight: 720;
  letter-spacing: -0.065em;
  line-height: 0.98;
}

.hero h1 .hero-title-main,
.hero h1 .hero-title-accent {
  display: block;
}

.hero h1 .hero-title-main {
  color: var(--hero-text);
}

.hero h1 .hero-title-accent {
  margin-top: 0.12em;
  color: var(--hero-accent);
}

html[lang="ja"] .hero h1 {
  font-size: clamp(2.45rem, 4.6vw, 4.3rem);
  letter-spacing: -0.04em;
}

.hero-lede {
  max-width: 590px;
  margin: 1.7rem 0 1.5rem;
  color: var(--hero-muted);
  font-size: clamp(1.05rem, 1.5vw, 1.22rem);
  line-height: 1.75;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.hero-tags span {
  padding: 0.38rem 0.72rem;
  border: 1px solid rgba(162, 191, 211, 0.2);
  border-radius: 999px;
  background: rgba(22, 45, 64, 0.62);
  color: #d4e1eb;
  font-size: 0.78rem;
  letter-spacing: 0.01em;
}

.hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.35rem;
  margin-top: 2rem;
}

.hero-primary,
.hero-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 48px;
  font-size: 0.94rem;
  font-weight: 650;
  text-decoration: none;
}

.hero-primary {
  padding: 0.7rem 1.05rem;
  border: 1px solid var(--hero-accent);
  border-radius: 5px;
  background: var(--hero-accent);
  color: #05202a;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.hero-primary:hover {
  transform: translateY(-2px);
  background: #76eadb;
  box-shadow: 0 8px 30px rgba(85, 219, 201, 0.2);
  text-decoration: none;
}

.hero-secondary {
  color: #d7e5ee;
}

.hero-secondary:hover {
  color: var(--hero-accent);
  text-decoration: none;
}

.hero-visual {
  position: relative;
  min-width: 0;
  animation: hero-visual-in 1s 0.12s ease-out both;
}

.systems-graphic {
  display: block;
  width: 100%;
  overflow: visible;
  filter: drop-shadow(0 12px 36px rgba(0, 0, 0, 0.2));
}

.chip-body {
  fill: rgba(15, 42, 58, 0.94);
  stroke: #55dbc9;
  stroke-width: 2;
}

.chip-core {
  fill: rgba(44, 135, 143, 0.17);
  stroke: rgba(85, 219, 201, 0.75);
  stroke-width: 1.5;
}

.chip-mark,
.chip-pins {
  fill: none;
  stroke: #78e8d9;
  stroke-width: 3;
  stroke-linecap: round;
}

.chip-pins {
  stroke-width: 2;
  opacity: 0.7;
}

.trace-lines {
  stroke: rgba(85, 219, 201, 0.48);
  stroke-width: 2;
  stroke-dasharray: 5 7;
  animation: trace-flow 3s linear infinite;
}

.network {
  stroke-width: 1.5;
  opacity: 0.82;
}

.nodes circle {
  fill: #101e33;
  stroke: #9b8aff;
  stroke-width: 2;
  animation: node-pulse 2.8s ease-in-out infinite alternate;
}

.nodes circle:nth-child(3n) { animation-delay: -1.1s; }
.nodes circle:nth-child(3n + 1) { animation-delay: -2s; }

.flight-path {
  fill: none;
  stroke: url(#signal-gradient);
  stroke-width: 1;
  stroke-dasharray: 3 10;
  opacity: 0.4;
}

.signal-packet {
  filter: drop-shadow(0 0 7px #55dbc9);
}

.signal-packet-late {
  filter: drop-shadow(0 0 6px #9b8aff);
}

.hero-visual-label {
  position: absolute;
  top: 50%;
  color: rgba(205, 224, 235, 0.54);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.16em;
  writing-mode: vertical-rl;
}

.hero-visual-label-left {
  left: -0.5rem;
  transform: translateY(-50%) rotate(180deg);
}

.hero-visual-label-right {
  right: -0.5rem;
  transform: translateY(-50%);
}

.hero-visual-caption {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  margin-top: -1rem;
  color: rgba(205, 224, 235, 0.7);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.035em;
}

.caption-dot {
  width: 0.35rem;
  height: 0.35rem;
}

@keyframes hero-copy-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes hero-visual-in {
  from { opacity: 0; transform: translateX(18px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes trace-flow { to { stroke-dashoffset: -48; } }
@keyframes node-pulse { to { opacity: 0.48; } }
/* ---------- MAIN LAYOUT (sidebar + content) ---------- */
#main-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr) minmax(250px, 300px);
  margin-top: var(--topnav-offset);
  min-height: calc(100vh - var(--topnav-offset));
  scroll-margin-top: var(--topnav-offset);
}

#main-layout:not([data-mode="profile"]) {
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

/* Left sidebar */
#sidebar {
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  flex-shrink: 0;
  background-color: var(--color-sidebar-bg);
  border-right: 1px solid var(--color-border);
  padding: 1.5rem 1rem;
  overflow-y: auto;
}

.sidebar-copyright {
  margin-top: auto;
  padding: 1.25rem 0.5rem 0.25rem;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 0.7rem;
  line-height: 1.5;
}

#sidebar-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: 0.75rem;
  padding-left: 0.5rem;
}

#sidebar-menu {
  list-style: none;
}

#sidebar-menu li {
  margin-bottom: 0.15rem;
}

.sidebar-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--color-text);
  transition: background 0.15s;
}
.sidebar-btn:hover {
  background: var(--color-sidebar-hover);
}
.sidebar-btn.active {
  background: var(--color-nav-active);
  color: white;
  font-weight: 500;
}

/* Nested sidebar items (e.g. Skills → Technical / Other) */
.sidebar-child {
  margin-left: 0.75rem;
}

.sidebar-btn-child {
  font-size: 0.85rem;
  opacity: 0.9;
  padding-left: 1rem;
}

.sidebar-btn-child::before {
  content: "↳ ";
  opacity: 0.5;
}

/* Main content area – graph-paper + optional photo background */
#content {
  min-width: 0;
  padding: 2rem 2.5rem;
  overflow-y: auto;
  position: relative;
  background-color: var(--color-surface);
}

/* The profile's right-side illustration connects the About text to the work. */
#profile-visual {
  position: sticky;
  top: calc(var(--topnav-offset) + 1rem);
  align-self: start;
  min-width: 0;
  padding: 2rem 1.25rem 1.5rem;
  overflow: hidden;
  border-left: 1px solid var(--color-border);
  background: linear-gradient(180deg, var(--color-surface), var(--color-bg));
}

#main-layout:not([data-mode="profile"]) #profile-visual {
  display: none;
}

.profile-visual-heading {
  padding: 0 0.3rem;
}

.visual-kicker {
  margin-bottom: 0.45rem;
  color: var(--color-primary);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

#profile-visual h2 {
  margin: 0;
  color: var(--color-text);
  font-size: 1.18rem;
  line-height: 1.3;
}

.about-flow {
  display: block;
  width: 100%;
  max-width: 320px;
  height: auto;
  margin: 1.15rem auto 0.5rem;
  overflow: visible;
  color: var(--color-text-muted);
}

.flow-grid {
  fill: url(#panel-grid);
  stroke: var(--color-border);
  stroke-opacity: 0.8;
}

.flow-trace {
  fill: none;
  stroke: url(#flow-gradient);
  stroke-width: 2;
  stroke-dasharray: 4 7;
  stroke-linecap: round;
  animation: flow-dash 2.6s linear infinite;
}

.flow-trace-branch {
  stroke-width: 1.2;
  opacity: 0.38;
  animation-duration: 5s;
}

.flow-card-body {
  fill: var(--color-surface);
  stroke: var(--color-border);
  stroke-width: 1.25;
  filter: drop-shadow(0 5px 12px rgba(0, 0, 0, 0.08));
}

.flow-icon-well {
  fill: var(--color-bg);
  stroke: var(--color-border);
  stroke-width: 1;
}

.code-icon,
.chip-icon-pins,
.network-icon-lines {
  fill: none;
  stroke: var(--color-primary);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chip-icon {
  fill: var(--color-code-bg);
  stroke: var(--color-primary);
  stroke-width: 1.5;
}

.chip-icon-pins { stroke-width: 1.5; }

.network-icon-nodes circle {
  fill: var(--color-surface);
  stroke: var(--color-primary);
  stroke-width: 1.5;
}

.flow-label {
  fill: var(--color-text);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
}

.flow-subtitle {
  fill: var(--color-text-muted);
  font-family: var(--font-sans);
  font-size: 9px;
}

.flow-status {
  fill: var(--color-primary);
  animation: status-pulse 1.8s ease-in-out infinite alternate;
}

.flow-packet {
  fill: var(--color-primary);
  filter: drop-shadow(0 0 4px var(--color-primary));
}

.flow-packet-secondary {
  fill: #a78bfa;
  filter: drop-shadow(0 0 4px #a78bfa);
}

.profile-visual-summary {
  margin: 0.2rem 0.3rem 1rem;
  color: var(--color-text-muted);
  font-size: 0.8rem;
  line-height: 1.6;
}

.visual-signal {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0.3rem;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.04em;
}

.visual-signal span:first-child {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--color-primary);
  box-shadow: 0 0 10px var(--color-primary);
  animation: status-pulse 1.8s ease-in-out infinite alternate;
}

@keyframes flow-dash { to { stroke-dashoffset: -44; } }
@keyframes status-pulse { to { opacity: 0.38; } }

@media (max-width: 1080px) and (min-width: 769px) {
  #main-layout[data-mode="profile"] {
    grid-template-columns: 200px minmax(0, 1fr) 225px;
  }

  #main-layout:not([data-mode="profile"]) {
    grid-template-columns: 200px minmax(0, 1fr);
  }

  #sidebar { width: auto; }
  #content { padding: 1.5rem; }
  #profile-visual { padding: 1.5rem 0.85rem; }
}

@media (max-width: 900px) and (min-width: 769px) {
  #main-layout[data-mode="profile"] {
    grid-template-columns: 200px minmax(0, 1fr);
  }

  #main-layout[data-mode="profile"] #profile-visual { display: none; }
}

/* Photo background layer (semi-transparent, behind the grid) */
#content::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: var(--color-photo-opacity);
  transition: background-image 0.4s ease, opacity 0.4s ease;
}

/* Per-mode background images */
#content[data-bg="transceiver"]::after {
  background-image: url("/assets/background/transceiver.jpeg");
}
#content[data-bg="neural-network"]::after {
  background-image: url("/assets/background/neural-network.jpeg");
}
#content[data-bg="himeji-jo"]::after {
  background-image: url("/assets/background/himeji-jo.jpeg");
}
#content[data-bg="lagrange-point"]::after {
  background-image: url("/assets/background/lagrange-point.jpeg");
}
#content[data-bg="energy-levels"]::after {
  background-image: url("/assets/background/energy-levels.jpeg");
}

/* Rotated millimeter-style graph paper – only shown when .show-graph-paper is set */
#content.show-graph-paper::before {
  content: "";
  position: absolute;
  top: -40%;
  left: -40%;
  width: 180%;
  height: 180%;
  z-index: 1; /* grid above the photo */
  pointer-events: none;
  opacity: 0.40;
  transform: rotate(12deg);
  /* Four layers: fine horizontal, fine vertical, major horizontal, major vertical */
  background-image:
    /* fine horizontal lines (~1 mm look) */
    linear-gradient(rgba(34, 197, 94, 0.28) 1px, transparent 1px),
    /* fine vertical lines */
    linear-gradient(90deg, rgba(34, 197, 94, 0.28) 1px, transparent 1px),
    /* major horizontal lines (every 10 fine lines ≈ 1 cm) */
    linear-gradient(rgba(22, 163, 74, 0.55) 1.5px, transparent 1.5px),
    /* major vertical lines */
    linear-gradient(90deg, rgba(22, 163, 74, 0.55) 1.5px, transparent 1.5px);
  background-size:
    10px 10px,    /* fine grid */
    10px 10px,
    100px 100px,  /* major grid (10 × fine) */
    100px 100px;
}

/* Keep actual text/content above the grid and photo */
#content-body {
  position: relative;
  z-index: 2;
  max-width: 820px;
  margin: 0 auto;
  opacity: 1;
  transition: opacity 0.28s ease;
}

#content-body.is-fading {
  opacity: 0;
}

/* ---------- MARKDOWN CONTENT STYLING ---------- */

/* Organization / school logos – consistent size controlled here */
#content-body img {
  height: 28px;           /* uniform display height */
  width: auto;            /* keep original aspect ratio */
  max-width: 120px;       /* safety limit */
  vertical-align: middle;
  margin-right: 8px;
  margin-bottom: 2px;
  object-fit: contain;
}

/* Collapsible sections (Read more) */
#content-body details {
  margin: 0.75rem 0 1.25rem 0;
  padding: 0.6rem 0.9rem;
  background: var(--color-details-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

#content-body details[open] {
  background: var(--color-details-bg-open);
}

#content-body summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--color-primary);
  list-style: none;          /* hide default triangle in some browsers */
  user-select: none;
}

#content-body summary::-webkit-details-marker {
  display: none;             /* hide default triangle in Chrome/Safari */
}

#content-body summary::before {
  content: "▸ ";
  display: inline-block;
  transition: transform 0.15s;
}

#content-body details[open] summary::before {
  transform: rotate(90deg);
}

#content-body details p,
#content-body details ul {
  margin-top: 0.75rem;
}

#content-body h1 {
  font-size: 1.9rem;
  margin-bottom: 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--color-border);
}

#content-body h2 {
  font-size: 1.4rem;
  margin-top: 2rem;
  margin-bottom: 0.6rem;
  color: var(--color-text);
}

#content-body h3 {
  font-size: 1.15rem;
  margin-top: 1.5rem;
  margin-bottom: 0.4rem;
}

#content-body p {
  margin-bottom: 1rem;
}

#content-body ul, #content-body ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

#content-body li {
  margin-bottom: 0.3rem;
}

#content-body a {
  color: var(--color-primary);
}

#content-body strong {
  font-weight: 600;
}

#content-body code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-code-bg);
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

#content-body pre {
  background: var(--color-code-bg);
  padding: 1rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin-bottom: 1rem;
}

#content-body blockquote {
  border-left: 4px solid var(--color-primary);
  padding-left: 1rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}

/* Academic credentials read as a compact portfolio rather than a career timeline. */
#content-body .academic-layout {
  display: grid;
  margin: 0.25rem 0 1.5rem;
}

#content-body[data-page="academic"] {
  width: 100%;
  max-width: 1160px;
  container-type: inline-size;
}

#content-body .academic-degrees {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 740px;
  gap: 0.9rem;
}

#content-body .academic-degree {
  position: relative;
  min-width: 0;
  padding: 1.1rem 1.15rem 1rem;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: calc(var(--radius) + 2px);
  background: linear-gradient(145deg, var(--color-surface), var(--color-bg));
  box-shadow: var(--shadow);
  animation: academic-card-in 500ms ease-out both;
  animation-delay: var(--academic-delay, 0ms);
  transform-origin: left center;
  transition: transform 180ms ease, scale 190ms cubic-bezier(0.2, 0.8, 0.2, 1), border-color 180ms ease, box-shadow 180ms ease;
}

#content-body .academic-degree:nth-child(even) {
  transform-origin: right center;
}

#content-body .academic-degree::before {
  position: absolute;
  top: 0;
  left: 1.15rem;
  width: 2.5rem;
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary), color-mix(in srgb, var(--color-primary) 15%, transparent));
  content: "";
}

#content-body .academic-degree-advanced {
  min-height: 14rem;
  background: linear-gradient(145deg, color-mix(in srgb, var(--color-primary) 9%, var(--color-surface)), var(--color-bg));
}

#content-body .academic-degree h2 {
  margin: 0.25rem 0 0.7rem;
  font-size: 1.12rem;
  line-height: 1.4;
}

#content-body .academic-institution {
  min-height: 2.3rem;
  margin: 0 0 0.7rem;
  color: var(--color-text-muted);
  font-size: 0.88rem;
  line-height: 1.75;
}

#content-body .academic-institution img {
  height: 2.2rem;
  max-width: 3.1rem;
  padding: 0.2rem;
  border-radius: 0.4rem;
  background: #fff;
  object-fit: contain;
}

#content-body .academic-institution strong {
  color: var(--color-text);
  font-size: 0.78rem;
}

#content-body .academic-thesis {
  margin: 0.7rem 0 0;
  padding: 0.6rem 0.75rem;
  border-left: 2px solid var(--color-primary);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: color-mix(in srgb, var(--color-primary) 7%, transparent);
  color: var(--color-text-muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

#content-body .academic-thesis strong {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--color-primary);
  font-family: var(--font-mono);
  font-size: 0.67rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#content-body .academic-awards {
  position: relative;
  z-index: 1;
  width: 64%;
  margin-top: -7rem;
  margin-left: 36%;
  padding: 1.2rem 1.3rem 1.3rem;
  border: 1px solid color-mix(in srgb, var(--color-primary) 48%, var(--color-border));
  border-radius: calc(var(--radius) + 2px);
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--color-primary) 14%, var(--color-surface)),
    color-mix(in srgb, var(--color-surface) 94%, var(--color-bg)));
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}

#content-body .academic-awards h2 {
  margin: 0 0 0.8rem;
  font-size: 1.08rem;
}

#content-body .academic-awards ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

#content-body .academic-awards li {
  margin: 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid color-mix(in srgb, var(--color-primary) 22%, var(--color-border));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--color-primary) 6%, var(--color-bg));
  color: var(--color-text-muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

#content-body .academic-awards li::before {
  margin-right: 0.45rem;
  color: var(--color-primary);
  content: "✦";
}

#content-body .academic-degree:hover,
#content-body .academic-degree:focus-within {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--color-primary) 50%, var(--color-border));
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
}

#content-body .academic-awards {
  transform-origin: right center;
  transition: scale 190ms cubic-bezier(0.2, 0.8, 0.2, 1), border-color 180ms ease, box-shadow 180ms ease;
}

@media (min-width: 1200px) {
  #content-body .academic-degree.is-pointer-active,
  #content-body .academic-awards.is-pointer-active {
    z-index: 20;
    border-color: color-mix(in srgb, var(--color-primary) 60%, var(--color-border));
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.26);
  }

  #content-body .academic-degree.is-pointer-active {
    scale: 1.5;
  }

  #content-body .academic-awards.is-pointer-active {
    scale: 1.3;
  }
}

@container (max-width: 999px) {
  #content-body .academic-awards {
    transform-origin: center center;
  }

  #content-body .academic-awards.is-pointer-active {
    scale: 1.08;
  }
}

@keyframes academic-card-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 640px) {
  #content-body .academic-awards {
    width: 100%;
    margin: 1rem 0 0;
  }

  #content-body .academic-degrees,
  #content-body .academic-awards ul {
    grid-template-columns: 1fr;
  }

  #content-body .academic-degree-advanced {
    min-height: 0;
  }
}

@media (min-width: 641px) and (max-width: 980px) {
  #content-body .academic-awards {
    width: 74%;
    margin-left: 26%;
  }
}

@container (max-width: 999px) {
  #content-body .academic-awards {
    width: 100%;
    margin: 1rem 0 0;
  }
}

/* Skills landing page: two clear categories and a quiet circuit signal animation. */
#content-body[data-page="skills"] {
  max-width: 900px;
}

#content-body .skills-overview {
  display: grid;
  gap: 1.1rem;
  padding: 0.25rem 0 1.5rem;
}

#content-body .skills-overview > p {
  max-width: 62rem;
  margin: 0;
  color: var(--color-text-muted);
}

#content-body .skills-overview > p:first-child {
  color: var(--color-text);
  font-size: 1.08rem;
}

#content-body .skills-category-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

#content-body .skills-category-grid > li {
  min-width: 0;
  list-style: none;
}

#content-body .skills-category-card {
  min-height: 112px;
  width: 100%;
  padding: 1rem 1.15rem;
  border: 1px solid color-mix(in srgb, var(--color-primary) 28%, var(--color-border));
  border-left: 3px solid var(--color-primary);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--color-surface) 82%, transparent);
  color: var(--color-text-muted);
  font: inherit;
  line-height: 1.6;
  text-align: left;
  cursor: pointer;
  transition: border-color 180ms ease, background-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

#content-body .skills-category-card:hover,
#content-body .skills-category-card:focus-visible {
  border-color: color-mix(in srgb, var(--color-primary) 72%, var(--color-border));
  background: color-mix(in srgb, var(--color-primary) 10%, var(--color-surface));
  box-shadow: 0 10px 28px color-mix(in srgb, var(--color-primary) 12%, transparent);
  transform: translateY(-2px);
}

#content-body .skills-category-card:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

#content-body .skills-category-card strong {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--color-text);
  font-size: 1rem;
}

#content-body .skills-signal-art {
  position: relative;
  display: grid;
  place-items: center;
  width: min(100%, 820px);
  min-height: 190px;
  margin: 0.35rem auto 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--color-primary) 28%, var(--color-border));
  border-radius: calc(var(--radius) + 4px);
  background:
    linear-gradient(rgba(93, 143, 176, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(93, 143, 176, 0.055) 1px, transparent 1px),
    radial-gradient(ellipse at center, color-mix(in srgb, var(--color-primary) 11%, var(--color-bg)), var(--color-bg) 72%);
  background-size: 22px 22px, 22px 22px, auto;
}

#content-body .skills-signal-art svg {
  display: block;
  width: 100%;
  height: auto;
  max-width: none;
  margin: 0;
}

#content-body .skills-wire-base,
#content-body .skills-wire-flow {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#content-body .skills-wire-base {
  stroke: color-mix(in srgb, var(--color-primary) 26%, var(--color-border));
  stroke-width: 2;
}

#content-body .skills-wire-flow {
  stroke: url("#skills-signal-gradient");
  stroke-dasharray: 8 13;
  stroke-width: 3;
  animation: skills-signal-flow 2.8s linear infinite;
}

#content-body .skills-chip-aura {
  fill: url("#skills-chip-glow");
  transform-box: fill-box;
  transform-origin: center;
  animation: skills-chip-breathe 3.4s ease-in-out infinite;
}

#content-body .skills-io-box {
  fill: color-mix(in srgb, var(--color-surface) 90%, var(--color-bg));
  stroke: color-mix(in srgb, var(--color-primary) 76%, var(--color-border));
  stroke-width: 1.5;
}

#content-body .skills-io-label {
  fill: var(--color-text);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.045em;
}

#content-body .skills-chip-body {
  fill: color-mix(in srgb, var(--color-surface) 90%, #071321);
  stroke: color-mix(in srgb, var(--color-primary) 76%, var(--color-border));
  stroke-width: 1.5;
}

#content-body .skills-chip-core {
  fill: color-mix(in srgb, var(--color-primary) 12%, var(--color-surface));
  stroke: color-mix(in srgb, var(--color-primary) 62%, var(--color-border));
  stroke-width: 1;
}

#content-body .skills-chip-pins,
#content-body .skills-chip-circuit {
  fill: none;
  stroke: color-mix(in srgb, var(--color-primary) 80%, white);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

#content-body .skills-chip-core-dot,
#content-body .skills-circuit-junctions circle,
#content-body .skills-signal-travel circle {
  fill: var(--color-primary);
  filter: drop-shadow(0 0 5px color-mix(in srgb, var(--color-primary) 78%, transparent));
}

#content-body .skills-circuit-junctions circle:nth-child(3n) {
  fill: #a78bfa;
}

#content-body .skills-signal-travel circle {
  filter: drop-shadow(0 0 7px var(--color-primary));
}

#content-body .skills-svg-label {
  fill: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

@keyframes skills-signal-flow {
  to { stroke-dashoffset: -42; }
}

@keyframes skills-chip-breathe {
  0%, 100% { opacity: 0.48; transform: scale(0.92); }
  50% { opacity: 1; transform: scale(1.08); }
}

@media (max-width: 680px) {
  #content-body .skills-category-grid {
    grid-template-columns: 1fr;
  }

  #content-body .skills-signal-art {
    min-height: 125px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #content-body .skills-wire-flow,
  #content-body .skills-chip-aura,
  #content-body .skills-signal-travel {
    animation: none;
  }

  #content-body .skills-signal-travel {
    display: none;
  }
}

/* Technical Skills: a connected system stack with support modules. */
#content-body[data-page="technical"] {
  max-width: 980px;
}

#content-body .technical-stack-map {
  display: grid;
  gap: 1rem;
  padding: 0.25rem 0 1.5rem;
}

#content-body .technical-stack-kicker {
  margin: 0;
  color: var(--color-primary);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}

#content-body .technical-stack-core {
  position: relative;
  display: grid;
  gap: 0.8rem;
  padding-left: 2.25rem;
}

#content-body .technical-stack-core::before {
  position: absolute;
  top: 1.4rem;
  bottom: 1.4rem;
  left: 0.52rem;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(var(--color-primary), color-mix(in srgb, var(--color-primary) 18%, #a78bfa));
  content: "";
  opacity: 0.68;
}

#content-body .technical-stack-layer {
  min-width: 0;
  padding: 1rem 1.1rem 1.05rem;
  border: 1px solid color-mix(in srgb, var(--color-primary) 25%, var(--color-border));
  border-left: 3px solid color-mix(in srgb, var(--color-primary) 76%, var(--color-border));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--color-surface) 88%, transparent);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.08);
}

#content-body .technical-stack-layer-core {
  position: relative;
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

#content-body .technical-stack-layer-core::before {
  position: absolute;
  top: 1.25rem;
  left: -2.04rem;
  width: 0.68rem;
  height: 0.68rem;
  border: 2px solid var(--color-primary);
  border-radius: 50%;
  background: var(--color-bg);
  box-shadow: 0 0 12px color-mix(in srgb, var(--color-primary) 55%, transparent);
  content: "";
}

#content-body .technical-stack-layer-core:hover {
  border-color: color-mix(in srgb, var(--color-primary) 56%, var(--color-border));
  box-shadow: 0 12px 28px color-mix(in srgb, var(--color-primary) 9%, transparent);
  transform: translateX(3px);
}

#content-body .technical-stack-layer h2 {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0 0 0.8rem;
  font-size: 1.08rem;
}

#content-body .technical-layer-index {
  display: inline-grid;
  width: 1.8rem;
  height: 1.8rem;
  flex: 0 0 1.8rem;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--color-primary) 45%, var(--color-border));
  border-radius: 0.45rem;
  color: var(--color-primary);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
}

#content-body .technical-skill-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

#content-body .technical-skill-chips > li {
  min-width: 0;
  flex: 1 1 190px;
  padding: 0.48rem 0.65rem;
  border: 1px solid color-mix(in srgb, var(--color-border) 76%, var(--color-primary));
  border-radius: 0.5rem;
  background: color-mix(in srgb, var(--color-bg) 62%, transparent);
  color: var(--color-text-muted);
  font-size: 0.88rem;
  line-height: 1.45;
  list-style: none;
}

#content-body .technical-skill-emphasis {
  color: var(--color-primary);
  font-size: 1.04em;
  font-weight: 800;
}

#content-body .technical-stack-support {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  padding-left: 2.25rem;
}

#content-body .technical-stack-layer-support {
  border-left-color: color-mix(in srgb, #a78bfa 66%, var(--color-border));
}

#content-body .technical-stack-layer-support .technical-skill-chips > li {
  flex-basis: 100%;
}

#content-body .technical-stack-layer-learning {
  grid-column: 1 / -1;
  border-color: color-mix(in srgb, #a78bfa 40%, var(--color-border));
  border-left: 3px solid #a78bfa;
  background: color-mix(in srgb, #a78bfa 7%, var(--color-surface));
}

#content-body .technical-stack-layer-learning > p {
  margin: -0.25rem 0 0.75rem;
  color: var(--color-text-muted);
}

@media (max-width: 680px) {
  #content-body .technical-stack-support {
    grid-template-columns: 1fr;
  }

  #content-body .technical-stack-layer-learning {
    grid-column: auto;
  }
}

/* Other Skills: a personal mosaic with independent interest cards. */
#content-body[data-page="other"] {
  max-width: 1040px;
}

#content-body .other-interests-mosaic {
  --interest-accent: var(--color-primary);
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-auto-flow: dense;
  align-items: start;
  gap: 0.8rem;
  padding: 0.25rem 0 1.5rem;
}

#content-body .other-interests-kicker {
  grid-column: 1 / -1;
  margin: 0 0 0.15rem;
  color: var(--color-primary);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.13em;
}

#content-body .other-interest-card {
  min-width: 0;
  padding: 1rem;
  border: 1px solid color-mix(in srgb, var(--interest-accent) 30%, var(--color-border));
  border-top: 2px solid color-mix(in srgb, var(--interest-accent) 72%, var(--color-border));
  border-radius: var(--radius);
  background:
    radial-gradient(ellipse at 100% 0%, color-mix(in srgb, var(--interest-accent) 9%, transparent), transparent 68%),
    color-mix(in srgb, var(--color-surface) 89%, transparent);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

#content-body .other-interest-card:hover {
  border-color: color-mix(in srgb, var(--interest-accent) 56%, var(--color-border));
  box-shadow: 0 10px 26px color-mix(in srgb, var(--interest-accent) 9%, transparent);
  transform: translateY(-2px);
}

#content-body .other-interest-card h2 {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0 0 0.8rem;
  font-size: 1rem;
}

#content-body .other-interest-marker {
  display: inline-grid;
  min-width: 2.25rem;
  height: 1.8rem;
  padding: 0 0.3rem;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--interest-accent) 48%, var(--color-border));
  border-radius: 0.45rem;
  color: var(--interest-accent);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

#content-body .other-interest-title {
  min-width: 0;
  flex: 1 1 auto;
}

#content-body .other-interest-pictogram {
  display: grid;
  width: 2.2rem;
  height: 2.2rem;
  flex: 0 0 auto;
  place-items: center;
  margin-left: auto;
  border: 1px solid color-mix(in srgb, var(--interest-accent) 38%, var(--color-border));
  border-radius: 0.6rem;
  color: var(--interest-accent);
  background: color-mix(in srgb, var(--interest-accent) 9%, transparent);
}

#content-body .other-interest-pictogram svg {
  display: block;
  width: 1.3rem;
  height: 1.3rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#content-body .other-interest-items {
  display: grid;
  gap: 0.38rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

#content-body .other-interest-items > li {
  position: relative;
  padding: 0.48rem 0.55rem 0.48rem 1rem;
  border: 1px solid color-mix(in srgb, var(--color-border) 75%, var(--interest-accent));
  border-radius: 0.5rem;
  background: color-mix(in srgb, var(--color-bg) 56%, transparent);
  color: var(--color-text-muted);
  font-size: 0.86rem;
  line-height: 1.45;
  list-style: none;
}

#content-body .other-interest-items > li::before {
  position: absolute;
  top: 0.95em;
  left: 0.42rem;
  width: 0.28rem;
  height: 0.28rem;
  border-radius: 50%;
  background: var(--interest-accent);
  box-shadow: 0 0 8px color-mix(in srgb, var(--interest-accent) 55%, transparent);
  content: "";
}

#content-body .other-interest-card p {
  margin: 0 0 0.65rem;
  color: var(--color-text-muted);
  font-size: 0.86rem;
}

#content-body .other-interest-languages { grid-column: span 3; --interest-accent: #41d6c4; }
#content-body .other-interest-mobility { grid-column: span 3; --interest-accent: #62b7f2; }
#content-body .other-interest-food { grid-column: span 2; --interest-accent: #f0ad67; }
#content-body .other-interest-hands-on { grid-column: span 4; --interest-accent: #61c99b; }
#content-body .other-interest-outdoors { grid-column: span 3; --interest-accent: #8ccc72; }
#content-body .other-interest-creative { grid-column: span 3; --interest-accent: #b69afa; }
#content-body .other-interest-reading { grid-column: span 3; --interest-accent: #e6bc72; }
#content-body .other-interest-lifestyle { grid-column: span 3; --interest-accent: #d3ba6f; }
#content-body .other-interest-gaming { grid-column: span 4; --interest-accent: #b391fa; }
#content-body .other-interest-travel { grid-column: span 2; --interest-accent: #6abde0; }
#content-body .other-interest-ai { grid-column: 1 / -1; --interest-accent: var(--color-primary); }

@media (max-width: 900px) {
  #content-body .other-interests-mosaic {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  #content-body .other-interest-card {
    grid-column: span 2;
  }

  #content-body .other-interest-ai {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  #content-body .other-interests-mosaic {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
  }

  #content-body .other-interest-card {
    grid-column: span 2;
    padding: 0.85rem;
  }
}

/* Personal Interests: connected bubbles rooted in curiosity. */
#content-body[data-page="interests"] {
  width: 100%;
  max-width: 1120px;
}

#content-body .personal-interest-tree {
  --interest-accent: var(--color-primary);
  padding: 0.25rem 0 1.5rem;
}

#content-body .interest-tree-kicker {
  margin: 0 0 0.3rem;
  color: var(--color-primary);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.13em;
}

#content-body .interest-tree-canvas {
  position: relative;
  width: min(100%, 1000px);
  aspect-ratio: 10 / 7;
  margin: 0 auto;
  isolation: isolate;
}

#content-body .interest-tree-wires {
  position: absolute;
  z-index: -1;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  color: var(--color-primary);
  pointer-events: none;
}

#content-body .interest-tree-wires path {
  fill: none;
  stroke: color-mix(in srgb, currentColor 55%, #8097b8);
  stroke-width: 2;
  stroke-dasharray: 4 7;
  opacity: 0.68;
  vector-effect: non-scaling-stroke;
}

#content-body .interest-tree-root {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  display: grid;
  width: clamp(130px, 19%, 190px);
  aspect-ratio: 1;
  align-content: center;
  justify-items: center;
  gap: 0.45rem;
  padding: 1rem;
  border: 1px solid color-mix(in srgb, var(--color-primary) 58%, var(--color-border));
  border-radius: 50%;
  color: var(--color-text);
  background:
    radial-gradient(circle, color-mix(in srgb, var(--color-primary) 18%, var(--color-surface)), color-mix(in srgb, var(--color-bg) 95%, transparent) 72%);
  box-shadow: 0 0 34px color-mix(in srgb, var(--color-primary) 19%, transparent), inset 0 0 20px color-mix(in srgb, var(--color-primary) 9%, transparent);
  text-align: center;
  transform: translate(-50%, -50%);
}

#content-body .interest-root-orbit {
  position: absolute;
  inset: -0.45rem;
  border: 1px solid color-mix(in srgb, var(--color-primary) 23%, transparent);
  border-radius: 50%;
  animation: interest-orbit 18s linear infinite;
}

#content-body .interest-root-orbit::before,
#content-body .interest-root-orbit::after {
  position: absolute;
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: var(--color-primary);
  box-shadow: 0 0 10px color-mix(in srgb, var(--color-primary) 70%, transparent);
  content: "";
}

#content-body .interest-root-orbit::before { top: 12%; left: 18%; }
#content-body .interest-root-orbit::after { right: 7%; bottom: 33%; width: 0.28rem; height: 0.28rem; }

@keyframes interest-orbit { to { transform: rotate(360deg); } }

#content-body .interest-root-label {
  color: var(--color-primary);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

#content-body .interest-tree-root strong {
  max-width: 8.5rem;
  font-size: clamp(0.9rem, 1.7vw, 1.12rem);
  line-height: 1.2;
}

#content-body .interest-tree-node {
  position: absolute;
  z-index: 2;
  top: var(--node-y);
  left: var(--node-x);
  width: clamp(155px, 23%, 235px);
  min-width: 0;
  border: 1px solid color-mix(in srgb, var(--interest-node-accent) 42%, var(--color-border));
  border-radius: 4.5rem;
  background:
    radial-gradient(ellipse at 100% 0%, color-mix(in srgb, var(--interest-node-accent) 12%, transparent), transparent 72%),
    color-mix(in srgb, var(--color-surface) 94%, transparent);
  box-shadow: 0 8px 20px color-mix(in srgb, #020817 20%, transparent);
  transform: translate(-50%, -50%);
  transition: width 220ms ease, border-radius 220ms ease, border-color 220ms ease, box-shadow 220ms ease, transform 220ms ease;
}

#content-body .interest-node-toggle {
  display: grid;
  width: 100%;
  min-height: 7.8rem;
  align-content: center;
  justify-items: stretch;
  gap: 0.55rem;
  padding: 1.05rem 1.2rem;
  border: 0;
  border-radius: inherit;
  color: var(--color-text);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

#content-body .interest-node-heading {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
}

#content-body .interest-node-toggle:focus-visible {
  outline: 2px solid var(--interest-node-accent);
  outline-offset: 3px;
}

#content-body .interest-node-title {
  min-width: 0;
  flex: 1 1 auto;
  color: var(--interest-node-accent);
  font-size: 0.98rem;
  font-weight: 750;
  line-height: 1.2;
}

#content-body .interest-node-icon {
  display: grid;
  width: 2.15rem;
  height: 2.15rem;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--interest-node-accent) 45%, var(--color-border));
  border-radius: 0.62rem;
  color: var(--interest-node-accent);
  background: color-mix(in srgb, var(--interest-node-accent) 9%, transparent);
}

#content-body .interest-node-icon svg {
  display: block;
  width: 1.28rem;
  height: 1.28rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#content-body .interest-node-preview {
  display: -webkit-box;
  overflow: hidden;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

#content-body .interest-node-details {
  max-height: min(48vh, 27rem);
  overflow: auto;
  padding: 0 1.15rem 1.05rem;
  color: var(--color-text-muted);
  font-size: 0.84rem;
  line-height: 1.5;
  scrollbar-color: color-mix(in srgb, var(--interest-node-accent) 45%, var(--color-border)) transparent;
}

#content-body .interest-node-details p { margin: 0 0 0.5rem; }
#content-body .interest-node-details ul { display: grid; gap: 0.4rem; margin: 0; padding-left: 1.1rem; }
#content-body .interest-node-details li { padding-left: 0.12rem; }
#content-body .interest-tree-node.is-active {
  z-index: 8;
  width: min(36%, 355px);
  border-radius: 1.15rem;
  border-color: color-mix(in srgb, var(--interest-node-accent) 78%, white);
  box-shadow: 0 18px 46px color-mix(in srgb, #020817 45%, transparent), 0 0 24px color-mix(in srgb, var(--interest-node-accent) 18%, transparent);
  transform: translate(-50%, -50%) scale(1.04);
}

#content-body .interest-tree-node.is-active .interest-node-toggle {
  min-height: 0;
  align-content: start;
  padding-bottom: 0.55rem;
}

#content-body .interest-tree-node.is-active .interest-node-heading {
  align-items: flex-start;
}

#content-body .interest-tree-node-1 { --interest-node-accent: #41d6c4; }
#content-body .interest-tree-node-2 { --interest-node-accent: #f0ad67; }
#content-body .interest-tree-node-3 { --interest-node-accent: #8ccc72; }
#content-body .interest-tree-node-4 { --interest-node-accent: #b391fa; }
#content-body .interest-tree-node-5 { --interest-node-accent: #b69afa; }
#content-body .interest-tree-node-6 { --interest-node-accent: #6abde0; }
#content-body .interest-tree-node-7 { --interest-node-accent: #61c99b; }

@media (max-width: 850px) {
  #content-body .interest-tree-canvas {
    display: grid;
    aspect-ratio: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 0.7rem;
    padding: 0.65rem 0 1.2rem;
  }

  #content-body .interest-tree-wires { display: none; }

  #content-body .interest-tree-root {
    position: relative;
    top: auto;
    left: auto;
    width: min(12rem, 70%);
    grid-column: 1 / -1;
    justify-self: center;
    transform: none;
  }

  #content-body .interest-tree-node {
    position: relative;
    top: auto;
    left: auto;
    width: auto;
    min-height: 100%;
    border-radius: 1.2rem;
    transform: none;
  }

  #content-body .interest-node-toggle { min-height: 8.5rem; }

  #content-body .interest-tree-node.is-active {
    width: auto;
    transform: translateY(-2px);
  }
}

@media (max-width: 560px) {
  #content-body .interest-tree-canvas { grid-template-columns: 1fr; }
  #content-body .interest-tree-root { grid-column: auto; width: 9rem; }
}

@media (prefers-reduced-motion: reduce) {
  #content-body .interest-root-orbit { animation: none; }
  #content-body .interest-tree-node,
  #content-body .interest-root-orbit { transition: none; }
}

#content-body[data-page="contact"] {
  width: 100%;
  max-width: 1080px;
}

#content-body .contact-directory {
  --contact-accent: var(--color-primary);
  padding: 0.2rem 0 1.5rem;
}

#content-body .contact-kicker {
  margin: 0 0 0.35rem;
  color: var(--contact-accent);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.13em;
}

#content-body .contact-directory-lede {
  max-width: 56rem;
  margin: 0 0 1.4rem;
  color: var(--color-text-muted);
  font-size: 1.08rem;
  line-height: 1.55;
}

#content-body .contact-direct-section {
  margin: 0 0 2rem;
  padding: 1.2rem;
  border: 1px solid color-mix(in srgb, var(--contact-accent) 40%, var(--color-border));
  border-radius: calc(var(--radius) * 1.8);
  background:
    radial-gradient(ellipse at 0% 0%, color-mix(in srgb, var(--contact-accent) 12%, transparent), transparent 58%),
    color-mix(in srgb, var(--color-surface) 80%, transparent);
  box-shadow: 0 14px 40px color-mix(in srgb, #020817 15%, transparent);
}

#content-body .contact-direct-section > h2,
#content-body .contact-section-title {
  margin: 0 0 0.85rem;
  font-size: 1.15rem;
}

#content-body .contact-direct-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr;
  gap: 0.7rem;
}

#content-body .contact-direct-card {
  display: flex;
  min-width: 0;
  min-height: 6.4rem;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem;
  border: 1px solid color-mix(in srgb, var(--contact-accent) 26%, var(--color-border));
  border-radius: 0.8rem;
  background: color-mix(in srgb, var(--color-bg) 65%, transparent);
  transition: border-color 180ms ease, transform 180ms ease, background-color 180ms ease;
}

#content-body .contact-direct-card:hover {
  border-color: color-mix(in srgb, var(--contact-accent) 62%, var(--color-border));
  background: color-mix(in srgb, var(--color-surface) 86%, transparent);
  transform: translateY(-2px);
}

#content-body .contact-direct-card-1 {
  border-color: color-mix(in srgb, var(--contact-accent) 48%, var(--color-border));
  background: color-mix(in srgb, var(--contact-accent) 8%, var(--color-bg));
}

#content-body .contact-direct-icon {
  display: grid;
  width: 2.8rem;
  height: 2.8rem;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--contact-accent) 38%, var(--color-border));
  border-radius: 0.8rem;
  color: var(--contact-accent);
  background: color-mix(in srgb, var(--contact-accent) 10%, transparent);
}

#content-body .contact-direct-icon svg {
  width: 1.45rem;
  height: 1.45rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#content-body .contact-direct-text,
#content-body .contact-direct-value {
  display: grid;
  min-width: 0;
  gap: 0.25rem;
}

#content-body .contact-direct-label {
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#content-body .contact-direct-value {
  overflow-wrap: anywhere;
  font-size: 0.9rem;
  font-weight: 650;
}

#content-body .contact-direct-value a {
  color: var(--color-text);
  text-decoration: none;
}

#content-body .contact-direct-value a:hover { color: var(--contact-accent); }

#content-body .contact-profile-section {
  margin: 0 0 1.8rem;
}

#content-body .contact-profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

#content-body .contact-profile-card {
  display: grid;
  min-width: 0;
  min-height: 6.4rem;
  align-content: center;
  gap: 0.55rem;
  padding: 0.8rem;
  border: 1px solid color-mix(in srgb, var(--color-border) 88%, var(--profile-accent));
  border-left: 3px solid var(--profile-accent);
  border-radius: 0.8rem;
  color: var(--color-text);
  background:
    radial-gradient(ellipse at 0% 0%, color-mix(in srgb, var(--profile-accent) 8%, transparent), transparent 58%),
    color-mix(in srgb, var(--color-surface) 82%, transparent);
  text-decoration: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

#content-body .contact-profile-card:hover,
#content-body .contact-profile-card:focus-visible {
  border-color: color-mix(in srgb, var(--profile-accent) 60%, var(--color-border));
  box-shadow: 0 10px 26px color-mix(in srgb, var(--profile-accent) 10%, transparent);
  transform: translateY(-2px);
}

#content-body .contact-profile-card:focus-visible {
  outline: 2px solid var(--profile-accent);
  outline-offset: 2px;
}

#content-body .contact-profile-topline {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.75rem;
}

#content-body .contact-profile-logo {
  display: grid;
  width: 6rem;
  height: 6rem;
  flex: 0 0 auto;
  place-items: center;
  padding: 0.55rem;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 0.65rem;
  background: #f8fafc;
}

#content-body .contact-profile-logo img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  object-fit: contain;
}

#content-body .contact-profile-name-block {
  display: grid;
  min-width: 0;
  flex: 1 1 auto;
  gap: 0.2rem;
}

#content-body .contact-profile-name-block strong {
  font-size: 0.92rem;
  line-height: 1.3;
}

#content-body .contact-profile-url {
  overflow: hidden;
  color: var(--color-primary);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#content-body .contact-profile-arrow {
  flex: 0 0 auto;
  color: var(--profile-accent);
  font-size: 1.2rem;
}

#content-body .contact-profile-description {
  padding-left: 6.75rem;
  color: var(--color-text-muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

#content-body .contact-profile-section-1 { --profile-accent: #41d6c4; }
#content-body .contact-profile-section-2 { --profile-accent: #b69afa; }

@media (max-width: 820px) {
  #content-body .contact-direct-grid { grid-template-columns: 1fr; }
  #content-body .contact-direct-card { min-height: 5.4rem; }
}

@media (max-width: 560px) {
  #content-body .contact-profile-grid { grid-template-columns: 1fr; }
  #content-body .contact-direct-section { padding: 0.9rem; }
  #content-body .contact-profile-description { padding-left: 0; }
}

/* Publications use a media-library view: paper pages above a year ribbon. */
#content-body[data-page="publications"] {
  width: 100%;
  max-width: 1160px;
}

#content-body .publication-intro {
  max-width: 58rem;
  margin: 0.25rem 0 1rem;
  color: var(--color-text-muted);
}

#content-body .publication-intro p {
  margin-bottom: 0.55rem;
}

#content-body .publication-intro img {
  height: 1.5rem;
  max-width: 5rem;
  vertical-align: middle;
}

#content-body .publication-gallery {
  display: grid;
  gap: 1rem;
  transition: opacity 160ms ease;
}

#content-body .publication-gallery.is-changing {
  opacity: 0.55;
}

#content-body .publication-stage {
  display: grid;
  grid-template-columns: minmax(200px, 0.72fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(1.4rem, 4vw, 3.5rem);
  min-height: 390px;
  padding: 0.5rem clamp(0.25rem, 3vw, 2rem) 0.75rem;
}

#content-body .publication-cover {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  width: min(100%, 520px);
  aspect-ratio: 696 / 450;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 0.35rem;
  background: #f7f7f5;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.38), 0 3px 10px rgba(0, 0, 0, 0.26);
  transform: scale(1);
  transform-origin: center;
  transition: transform 240ms ease, box-shadow 240ms ease;
}

@media (hover: hover) and (pointer: fine) {
  #content-body .publication-cover:hover {
    z-index: 10;
    transform: scale(2);
    box-shadow: 0 28px 64px rgba(0, 0, 0, 0.5), 0 4px 14px rgba(0, 0, 0, 0.32);
  }
}

@media (prefers-reduced-motion: reduce) {
  #content-body .publication-cover {
    transition: none;
  }
}

#content-body .publication-cover img {
  display: block;
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  object-fit: cover;
}

#content-body .publication-cover-placeholder {
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.6rem;
  color: #effbff;
  background:
    radial-gradient(circle at 82% 20%, rgba(86, 231, 216, 0.42), transparent 26%),
    linear-gradient(155deg, #163855, #071727 72%);
}

#content-body .publication-cover-placeholder strong {
  max-width: 10ch;
  color: #fff;
  font-size: clamp(1.6rem, 3vw, 2.5rem);
  line-height: 1.08;
}

#content-body .publication-cover-kicker {
  color: #72e4dc;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
}

#content-body .publication-cover-placeholder > span:last-child {
  color: #c4d4e2;
  font-size: 0.82rem;
}

#content-body .publication-details {
  max-width: 42rem;
  animation: publication-copy-in 320ms ease-out both;
}

#content-body .publication-year-label {
  margin-bottom: 0.55rem;
  color: var(--color-primary);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.13em;
}

#content-body .publication-details h2 {
  margin: 0 0 0.9rem;
  font-size: clamp(1.35rem, 2.2vw, 2rem);
  line-height: 1.3;
}

#content-body .publication-authors {
  margin-bottom: 0.5rem;
  color: var(--color-text);
  font-size: 1rem;
}

#content-body .publication-venue {
  margin-bottom: 1.25rem;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

#content-body .publication-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

#content-body .publication-links a {
  display: inline-flex;
  align-items: center;
  min-height: 2.35rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid color-mix(in srgb, var(--color-primary) 35%, var(--color-border));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--color-primary) 8%, var(--color-surface));
  font-size: 0.87rem;
}

#content-body .publication-ribbon {
  position: sticky;
  bottom: 0.25rem;
  z-index: 5;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--color-primary) 24%, var(--color-border));
  border-radius: calc(var(--radius) + 2px);
  background: color-mix(in srgb, var(--color-bg) 89%, transparent);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(14px);
}

#content-body .publication-timeline {
  position: relative;
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding: 1.2rem 0.65rem 0.55rem;
  scrollbar-color: var(--color-border) transparent;
  scrollbar-width: thin;
}

#content-body .publication-timeline::before {
  position: absolute;
  top: 0.66rem;
  right: 1rem;
  left: 1rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-primary), var(--color-border), transparent);
  content: "";
  pointer-events: none;
}

#content-body .publication-selector {
  position: relative;
  display: grid;
  flex: 0 0 166px;
  grid-template-columns: 42px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  align-items: start;
  column-gap: 0.55rem;
  min-height: 72px;
  padding: 0.2rem 0.45rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--color-text);
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

#content-body .publication-selector::before {
  position: absolute;
  top: -0.88rem;
  left: 1.02rem;
  width: 0.52rem;
  height: 0.52rem;
  border: 2px solid var(--color-bg);
  border-radius: 50%;
  background: var(--color-border);
  box-shadow: 0 0 0 1px var(--color-border);
  content: "";
  transition: background 160ms ease, box-shadow 160ms ease;
}

#content-body .publication-selector:hover,
#content-body .publication-selector.is-selected {
  border-color: color-mix(in srgb, var(--color-primary) 34%, var(--color-border));
  background: color-mix(in srgb, var(--color-primary) 9%, var(--color-surface));
}

#content-body .publication-selector:hover {
  transform: translateY(-2px);
}

#content-body .publication-selector.is-selected::before {
  background: var(--color-primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary) 25%, transparent), 0 0 12px var(--color-primary);
}

#content-body .publication-mini-cover {
  display: flex;
  grid-row: 1 / span 2;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 58px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 2px;
  background: #eef0f1;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.24);
}

#content-body .publication-mini-cover img {
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: cover;
}

#content-body .publication-mini-placeholder {
  color: #183751;
  background: linear-gradient(150deg, #b7e6e2, #eef4f0 60%, #77b8b6);
  font-family: var(--font-mono);
  font-size: 0.67rem;
  font-weight: 700;
}

#content-body .publication-selector-year {
  color: var(--color-primary);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
}

#content-body .publication-selector-title {
  display: -webkit-box;
  overflow: hidden;
  color: var(--color-text-muted);
  font-size: 0.7rem;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

@keyframes publication-copy-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 760px) {
  #content-body .publication-stage {
    grid-template-columns: 1fr;
    gap: 1.4rem;
    min-height: 0;
    padding: 0.5rem 0 1rem;
  }

  #content-body .publication-cover {
    width: min(90vw, 520px);
  }

  #content-body .publication-details {
    width: 100%;
  }

  #content-body .publication-ribbon {
    bottom: 0;
  }
}

/* Turn the Markdown work history into a scannable career timeline. */
#content-body[data-page="experience"] .experience-timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin: 0.35rem 0 1.5rem;
  padding-left: 1.2rem;
}

#content-body .experience-column {
  display: contents;
}

#content-body[data-page="experience"] .experience-timeline::before {
  position: absolute;
  top: 0.8rem;
  bottom: 0.8rem;
  left: 0.35rem;
  width: 1px;
  background: linear-gradient(180deg, var(--color-primary), color-mix(in srgb, var(--color-primary) 12%, transparent));
  content: "";
}

#content-body .experience-entry {
  position: relative;
  z-index: 0;
  min-width: 0;
  padding: 1rem 1.1rem 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: calc(var(--radius) + 2px);
  background: linear-gradient(145deg, var(--color-surface), var(--color-bg));
  box-shadow: var(--shadow);
  animation: experience-entry-in 540ms ease-out both;
  scale: 1;
  transform-origin: left center;
  transition: scale 190ms cubic-bezier(0.2, 0.8, 0.2, 1), border-color 190ms ease, box-shadow 190ms ease;
}

#content-body .experience-entry::before {
  position: absolute;
  top: 1.25rem;
  left: -1.22rem;
  width: 0.65rem;
  height: 0.65rem;
  border: 2px solid var(--color-surface);
  border-radius: 50%;
  background: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary), 0 0 12px color-mix(in srgb, var(--color-primary) 55%, transparent);
  content: "";
}

#content-body .experience-entry:nth-child(2) { animation-delay: 110ms; }
#content-body .experience-entry:nth-child(3) { animation-delay: 220ms; }
#content-body .experience-entry:nth-child(4) { animation-delay: 330ms; }
#content-body .experience-entry:nth-child(5) { animation-delay: 440ms; }
#content-body .experience-entry:nth-child(6) { animation-delay: 550ms; }
#content-body .experience-entry:nth-child(7) { animation-delay: 660ms; }
#content-body .experience-entry:nth-child(8) { animation-delay: 770ms; }

#content-body .experience-entry > h2 {
  margin: 0 0 0.55rem;
  padding: 0;
  color: var(--color-text);
  font-size: 1.16rem;
  line-height: 1.35;
}

#content-body .experience-entry > p {
  margin-bottom: 0.55rem;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

#content-body .experience-entry > p strong {
  color: var(--color-text);
}

#content-body .experience-entry img {
  height: 24px;
}

#content-body .experience-entry details {
  margin: 0.65rem 0 0;
}

#content-body .experience-entry:hover,
#content-body .experience-entry:focus-within {
  z-index: 3;
  border-color: color-mix(in srgb, var(--color-primary) 52%, var(--color-border));
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.14);
  scale: 1.06;
}

/* On wide screens, alternate each role across a straight central timeline. */
@media (min-width: 1200px) {
  #content-body[data-page="experience"] .experience-timeline {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    row-gap: 1.5rem;
    align-items: start;
    padding: 0 0 1rem;
  }

  #content-body[data-page="experience"] .experience-timeline::before {
    top: 0.2rem;
    bottom: 0.5rem;
    left: 50%;
    width: 2px;
    transform: translateX(-50%);
  }

  #content-body .experience-entry {
    width: calc(50% - 1rem);
  }

  #content-body .experience-entry-left {
    justify-self: start;
    transform-origin: left center;
  }

  #content-body .experience-entry-right {
    justify-self: end;
    transform-origin: right center;
  }

  #content-body .experience-entry-left::before {
    right: -1.325rem;
    left: auto;
  }

  #content-body .experience-entry-right::before {
    right: auto;
    left: -1.325rem;
  }

  #content-body .experience-entry:hover {
    scale: 1;
  }

  #content-body .experience-entry.is-pointer-active {
    z-index: 20;
    scale: 2;
  }

  /* Retained focus after a click must not keep the card zoomed after mouse exit. */
  #content-body .experience-entry:focus-within:not(.is-pointer-active) {
    scale: 1;
  }
}

@keyframes experience-entry-in {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: translateY(0); }
}

/* A more scannable opening for the About page. The small numbered cards
   turn the long technical introduction into a quiet, animated signal path. */
#content-body .about-overview {
  margin: 0.25rem 0 2rem;
}

#content-body .about-lede {
  max-width: 48rem;
  margin: 0 0 0.55rem;
  color: var(--color-text);
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  font-weight: 650;
  line-height: 1.4;
  letter-spacing: -0.025em;
}

#content-body .about-summary {
  max-width: 48rem;
  margin-bottom: 1.25rem;
  color: var(--color-text-muted);
}

#content-body .about-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  counter-reset: overview-card;
}

#content-body .about-card {
  position: relative;
  min-width: 0;
  padding: 0.9rem 1rem 0.85rem;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: calc(var(--radius) + 2px);
  background: linear-gradient(145deg, var(--color-surface), var(--color-bg));
  box-shadow: var(--shadow);
  animation: about-card-in 560ms ease-out both;
}

#content-body .about-card::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--color-primary), #8b7cf6);
  content: "";
  transform: scaleY(0.25);
  transform-origin: top;
  transition: transform 260ms ease;
}

#content-body .about-card:hover::before {
  transform: scaleY(1);
}

#content-body .about-card:nth-child(2) { animation-delay: 190ms; }
#content-body .about-card:nth-child(3) { animation-delay: 380ms; }
#content-body .about-card:nth-child(4) { animation-delay: 570ms; }

#content-body .about-card-index {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--color-primary);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.075em;
}

#content-body .about-card h3 {
  margin: 0 0 0.3rem;
  font-size: 0.98rem;
  line-height: 1.35;
}

#content-body .about-card p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

#content-body .about-resume {
  margin: 1rem 0 0;
}

#content-body .about-resume a {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid color-mix(in srgb, var(--color-primary) 48%, var(--color-border));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--color-primary) 9%, var(--color-surface));
  font-size: 0.88rem;
  font-weight: 650;
  text-decoration: none;
  transition: background 180ms ease, transform 180ms ease;
}

#content-body .about-resume a:hover {
  background: color-mix(in srgb, var(--color-primary) 16%, var(--color-surface));
  transform: translateY(-1px);
}

@keyframes about-card-in {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 560px) {
  #content-body .about-cards { grid-template-columns: 1fr; }
}

/* ---------- HAMBURGER BUTTON (hidden on desktop) ---------- */
#menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  margin-left: auto;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: var(--radius);
  cursor: pointer;
}

.hamburger-line {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--color-topnav-text);
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}

/* Animate to X when menu is open */
#top-nav.menu-open .hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
#top-nav.menu-open .hamburger-line:nth-child(2) {
  opacity: 0;
}
#top-nav.menu-open .hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 768px) {
  .hero {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: none;
  }

  .hero::-webkit-scrollbar {
    display: none;
  }

  .hero-inner {
    grid-template-columns: 1fr;
    min-height: max(720px, calc(100svh - var(--topnav-offset)));
    gap: 0.25rem;
    padding: 3rem 1.5rem 4.5rem;
  }

  .hero-copy { max-width: 620px; }

  .hero h1 { font-size: clamp(2.8rem, 11vw, 4.5rem); }

  .hero-lede {
    margin-top: 1.25rem;
    font-size: 1rem;
  }

  .hero-visual {
    width: min(100%, 540px);
    margin: -0.4rem auto 0;
  }

  .hero-visual-caption { margin-top: -1.25rem; }

  #top-nav {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand menu"
      "controls controls";
    align-items: center;
    justify-items: stretch;
    height: auto;
    min-height: var(--topnav-height);
    padding: 0.5rem 1rem;
    gap: 0.5rem 0.75rem;
  }

  .nav-brand {
    grid-area: brand;
    min-width: 0;
    overflow: hidden;
  }

  .nav-brand a {
    font-size: 1rem;
  }

  .nav-brand > a:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .nav-brand { gap: 0.5rem; }

  .nav-brand .nav-resume {
    padding: 0.25rem 0.42rem;
    font-size: 0.67rem;
    white-space: nowrap;
  }

  /* Keep the menu button beside the name; controls sit on their own row. */
  #menu-toggle {
    display: flex;
    grid-area: menu;
    margin-left: 0;
    justify-self: end;
  }

  .top-controls {
    grid-area: controls;
    margin-left: 0;
    justify-content: flex-end;
    justify-self: end;
    width: 100%;
  }

  /* Mode links become a full-width dropdown under the top bar */
  .nav-links {
    display: none;
    grid-area: nav;
    flex-direction: column;
    width: 100%;
    gap: 0.25rem;
    padding: 0.5rem 0 0.25rem 0;
    border-top: 1px solid rgba(255,255,255,0.15);
  }

  #top-nav.menu-open .nav-links {
    display: flex;
  }

  #top-nav.menu-open {
    grid-template-areas:
      "brand menu"
      "controls controls"
      "nav nav";
  }

  .nav-btn {
    width: 100%;
    text-align: left;
    padding: 0.75rem 0.85rem;
    font-size: 1rem;
  }

  /* Stack sidebar above content */
  #main-layout {
    display: flex;
    flex-direction: column;
  }

  #sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
    padding: 0.75rem 1rem;
    max-height: none;
  }

  .sidebar-copyright {
    margin-top: 0.75rem;
    padding: 0.65rem 0 0.1rem;
  }

  /* Sidebar items as horizontal scroll chips on mobile */
  #sidebar-menu {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.4rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.25rem;
  }

  #sidebar-menu li {
    margin-bottom: 0;
    flex-shrink: 0;
  }

  .sidebar-btn {
    white-space: nowrap;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
  }

  #sidebar-title {
    margin-bottom: 0.5rem;
  }

  #content {
    padding: 1.25rem 1rem;
  }

  #main-layout[data-mode="profile"] #profile-visual {
    position: relative;
    top: auto;
    align-self: stretch;
    display: block;
    padding: 1.5rem 1rem;
    border-top: 1px solid var(--color-border);
    border-left: none;
  }

  #content-body {
    max-width: 100%;
  }

  #content-body h1 {
    font-size: 1.5rem;
  }

  #content-body h2 {
    font-size: 1.2rem;
  }
}

@media (max-width: 430px) {
  .hero-inner {
    padding-right: 1.15rem;
    padding-left: 1.15rem;
  }

  .hero-eyebrow {
    max-width: 300px;
    font-size: 0.66rem;
  }

  .hero-tags { gap: 0.4rem; }
  .hero-tags span { font-size: 0.7rem; }
  .hero-actions { gap: 0.8rem; margin-top: 1.4rem; }
  .hero-primary, .hero-secondary { font-size: 0.85rem; }
  .hero-visual-label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .systems-graphic animateMotion { display: none; }
  .about-flow animateMotion { display: none; }
  .hero { transition: none; }
}

/* Software projects: a featured archive build, an AI lab, and finished work. */
#content-body[data-page="software"] {
  width: 100%;
  max-width: 1200px;
}

#content-body .software-project-board {
  --software-accent: #43d9c4;
  padding: 0.15rem 0 2rem;
}

#content-body .software-project-kicker {
  margin: 0 0 0.35rem;
  color: var(--software-accent);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.15em;
}

#content-body .software-project-lede {
  max-width: 52rem;
  margin: 0 0 1.5rem;
  color: var(--color-text-muted);
  font-size: 1.05rem;
  line-height: 1.55;
}

#content-body .software-project-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1rem;
  align-items: stretch;
}

#content-body .software-project-card {
  position: relative;
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 0.8rem;
  overflow: hidden;
  padding: 1.2rem;
  border: 1px solid color-mix(in srgb, var(--project-accent) 32%, var(--color-border));
  border-radius: calc(var(--radius) * 1.6);
  color: var(--color-text);
  background:
    radial-gradient(ellipse at 100% 0%, color-mix(in srgb, var(--project-accent) 12%, transparent), transparent 56%),
    color-mix(in srgb, var(--color-surface) 87%, transparent);
  box-shadow: 0 12px 32px rgba(1, 8, 20, 0.13);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

#content-body .software-project-card:hover,
#content-body .software-project-card:focus-within {
  z-index: 1;
  border-color: color-mix(in srgb, var(--project-accent) 66%, var(--color-border));
  box-shadow: 0 18px 42px color-mix(in srgb, var(--project-accent) 11%, transparent);
  transform: translateY(-3px);
}

#content-body .software-project-chronovault {
  --project-accent: #42dbc5;
  grid-column: span 7;
  grid-template-columns: minmax(0, 1.1fr) minmax(210px, 0.9fr);
  grid-template-rows: auto auto 1fr;
  min-height: 22rem;
}

#content-body .software-project-ai-server {
  --project-accent: #ae93ff;
  grid-column: span 5;
  min-height: 22rem;
}

#content-body .software-project-vlc,
#content-body .software-project-mods {
  --project-accent: #72a7d6;
  grid-column: span 6;
  min-height: 11rem;
}

#content-body .software-project-card-header {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

#content-body .software-project-chronovault .software-project-card-header,
#content-body .software-project-chronovault > h2 {
  grid-column: 1 / -1;
}

#content-body .software-project-eyebrow,
#content-body .software-project-status {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

#content-body .software-project-eyebrow { color: var(--project-accent); }

#content-body .software-project-status {
  flex: 0 0 auto;
  padding: 0.34rem 0.55rem;
  border: 1px solid color-mix(in srgb, var(--project-accent) 42%, transparent);
  border-radius: 999px;
  color: var(--project-accent);
  background: color-mix(in srgb, var(--project-accent) 9%, transparent);
  letter-spacing: 0.02em;
  text-transform: none;
}

#content-body .software-project-status.is-complete {
  color: var(--color-text-muted);
  border-color: var(--color-border);
  background: color-mix(in srgb, var(--color-bg) 48%, transparent);
}

#content-body .software-project-card > h2 {
  margin: 0;
  font-size: clamp(1.15rem, 1.6vw, 1.55rem);
  line-height: 1.25;
}

#content-body .software-project-copy {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 0.75rem;
}

#content-body .software-project-copy > p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

#content-body .software-project-visual {
  position: relative;
  display: grid;
  align-content: center;
  gap: 0.55rem;
  min-width: 0;
  min-height: 12rem;
  overflow: hidden;
  padding: 1rem;
  border: 1px solid color-mix(in srgb, var(--project-accent) 24%, var(--color-border));
  border-radius: 1rem;
  background:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px),
    color-mix(in srgb, var(--color-bg) 64%, transparent);
  background-size: 22px 22px;
}

#content-body .software-project-visual-chronovault { grid-column: 2; grid-row: 3; }
#content-body .software-project-visual-ai-server { min-height: 8rem; margin-top: auto; }

#content-body .software-flow-track {
  position: absolute;
  top: 19%;
  bottom: 19%;
  left: 1.8rem;
  width: 1px;
  background: linear-gradient(transparent, var(--project-accent), transparent);
  opacity: 0.55;
}

#content-body .software-flow-pulse {
  position: absolute;
  left: -3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--project-accent);
  box-shadow: 0 0 12px var(--project-accent);
  animation: software-flow-drift 3.2s ease-in-out infinite;
}

#content-body .software-flow-pulse:nth-child(2) { animation-delay: -1.6s; }

@keyframes software-flow-drift {
  0%, 100% { top: 0; opacity: 0.4; }
  50% { top: calc(100% - 7px); opacity: 1; }
}

#content-body .software-flow-step {
  position: relative;
  display: grid;
  gap: 0.15rem;
  min-height: 3.2rem;
  align-content: center;
  padding: 0.55rem 0.65rem 0.55rem 1.25rem;
  border: 1px solid color-mix(in srgb, var(--project-accent) 22%, var(--color-border));
  border-radius: 0.7rem;
  background: color-mix(in srgb, var(--color-surface) 86%, transparent);
}

#content-body .software-flow-index {
  color: var(--project-accent);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
}

#content-body .software-flow-step strong { font-size: 0.8rem; line-height: 1.3; }

#content-body .software-project-tools { display: grid; gap: 0.45rem; }

#content-body .software-project-tools-title {
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#content-body .software-tool-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

#content-body .software-tool-chips > span {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 0.34rem 0.55rem;
  border: 1px solid color-mix(in srgb, var(--project-accent) 28%, var(--color-border));
  border-radius: 999px;
  color: var(--color-text);
  background: color-mix(in srgb, var(--project-accent) 7%, var(--color-bg));
  font-size: 0.7rem;
  line-height: 1.35;
}

#content-body .software-project-details {
  margin: 0;
  padding-top: 0.6rem;
  border-top: 1px solid var(--color-border);
}

#content-body .software-project-details summary {
  color: var(--project-accent);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 650;
}

#content-body .software-project-details p,
#content-body .software-project-details ul {
  color: var(--color-text-muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

#content-body .software-project-repo {
  justify-self: start;
  padding: 0.52rem 0.75rem;
  border: 1px solid color-mix(in srgb, var(--project-accent) 38%, var(--color-border));
  border-radius: 0.65rem;
  color: var(--project-accent);
  background: color-mix(in srgb, var(--project-accent) 8%, var(--color-bg));
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
}

#content-body .software-project-repo:hover { background: color-mix(in srgb, var(--project-accent) 15%, var(--color-bg)); }

@media (max-width: 1050px) {
  #content-body .software-project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #content-body .software-project-chronovault,
  #content-body .software-project-ai-server { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  #content-body .software-project-grid { grid-template-columns: 1fr; }
  #content-body .software-project-chronovault,
  #content-body .software-project-ai-server,
  #content-body .software-project-vlc,
  #content-body .software-project-mods { grid-column: 1; }
  #content-body .software-project-card { min-height: 0; }
  #content-body .software-project-chronovault { grid-template-columns: 1fr; }
  #content-body .software-project-visual-chronovault { grid-column: 1; grid-row: auto; }
}

/* Hardware projects use a workbench layout with signal-path cards. */
#content-body[data-page="hardware"] {
  width: 100%;
  max-width: 1200px;
}

#content-body .hardware-project-board {
  --hardware-accent: #43d9c4;
  padding: 0.15rem 0 2rem;
}

#content-body .hardware-project-kicker {
  margin: 0 0 0.35rem;
  color: var(--hardware-accent);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.13em;
}

#content-body .hardware-project-lede {
  max-width: 56rem;
  margin: 0 0 1.5rem;
  color: var(--color-text-muted);
  font-size: 1.05rem;
  line-height: 1.55;
}

#content-body .hardware-project-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1rem;
  align-items: stretch;
}

#content-body .hardware-project-card {
  --project-accent: #43d9c4;
  position: relative;
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 0.75rem;
  overflow: hidden;
  padding: 1.15rem;
  border: 1px solid color-mix(in srgb, var(--project-accent) 32%, var(--color-border));
  border-radius: calc(var(--radius) * 1.6);
  color: var(--color-text);
  background:
    radial-gradient(ellipse at 100% 0%, color-mix(in srgb, var(--project-accent) 12%, transparent), transparent 55%),
    color-mix(in srgb, var(--color-surface) 87%, transparent);
  box-shadow: 0 12px 32px rgba(1, 8, 20, 0.13);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

#content-body .hardware-card-icon {
  position: absolute;
  z-index: 1;
  top: 0.85rem;
  right: 0.9rem;
  display: grid;
  width: 2.65rem;
  height: 2.65rem;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--project-accent) 38%, var(--color-border));
  border-radius: 0.8rem;
  color: var(--project-accent);
  background: color-mix(in srgb, var(--project-accent) 9%, var(--color-bg));
  box-shadow: inset 0 0 18px color-mix(in srgb, var(--project-accent) 8%, transparent);
}

#content-body .hardware-card-icon svg {
  display: block;
  width: 1.8rem;
  height: 1.8rem;
}

#content-body .hardware-project-card:hover {
  border-color: color-mix(in srgb, var(--project-accent) 64%, var(--color-border));
  box-shadow: 0 18px 42px color-mix(in srgb, var(--project-accent) 11%, transparent);
  transform: translateY(-3px);
}

#content-body .hardware-project-imu {
  --project-accent: #43d9c4;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1.3fr) minmax(250px, 0.8fr);
  grid-template-rows: auto auto 1fr auto;
  min-height: 19rem;
}

#content-body .hardware-project-mcu {
  --project-accent: #b69afa;
  grid-column: span 6;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 0.72fr);
  grid-template-rows: auto auto 1fr;
  min-height: 17rem;
}

#content-body .hardware-project-asic,
#content-body .hardware-project-sbc,
#content-body .hardware-project-transceiver {
  grid-column: span 6;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 0.7fr);
  grid-template-rows: auto auto 1fr;
  min-height: 16rem;
}

#content-body .hardware-project-asic { --project-accent: #78b7ff; }
#content-body .hardware-project-sbc { --project-accent: #b3d86b; }
#content-body .hardware-project-transceiver { --project-accent: #43d9c4; }

#content-body .hardware-project-bench {
  --project-accent: #edbd75;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 1fr);
  align-items: center;
}

#content-body .hardware-project-label {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--project-accent);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

#content-body .hardware-project-card > h2 {
  grid-column: 1 / -1;
  margin: 0;
  padding-right: 3.3rem;
  font-size: clamp(1.1rem, 1.5vw, 1.45rem);
  line-height: 1.25;
}

#content-body .hardware-project-imu .hardware-project-description {
  grid-column: 1;
  grid-row: 3;
  align-self: start;
  font-size: 0.98rem;
}

#content-body .hardware-project-imu .hardware-project-visual {
  grid-column: 2;
  grid-row: 3 / span 2;
  min-height: 12rem;
}

#content-body .hardware-project-imu .hardware-project-tags {
  grid-column: 1;
  grid-row: 4;
}

#content-body .hardware-project-description {
  min-width: 0;
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

#content-body .hardware-project-tags {
  display: flex;
  flex-wrap: wrap;
  align-content: start;
  gap: 0.42rem;
}

#content-body .hardware-project-tags > span {
  padding: 0.38rem 0.58rem;
  border: 1px solid color-mix(in srgb, var(--project-accent) 30%, var(--color-border));
  border-radius: 999px;
  color: var(--color-text);
  background: color-mix(in srgb, var(--project-accent) 8%, var(--color-bg));
  font-size: 0.72rem;
  line-height: 1.35;
}

#content-body .hardware-project-visual {
  position: relative;
  display: grid;
  grid-column: 2;
  grid-row: 3;
  align-content: center;
  gap: 0.55rem;
  min-width: 0;
  min-height: 9rem;
  overflow: hidden;
  padding: 0.8rem;
  border: 1px solid color-mix(in srgb, var(--project-accent) 25%, var(--color-border));
  border-radius: 0.9rem;
  background:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px),
    color-mix(in srgb, var(--color-bg) 64%, transparent);
  background-size: 20px 20px;
}

#content-body .hardware-flow-node {
  position: relative;
  display: grid;
  gap: 0.1rem;
  min-width: 0;
  padding: 0.48rem 0.58rem;
  border: 1px solid color-mix(in srgb, var(--project-accent) 24%, var(--color-border));
  border-radius: 0.65rem;
  background: color-mix(in srgb, var(--color-surface) 88%, transparent);
}

#content-body .hardware-flow-node small {
  color: var(--project-accent);
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.08em;
}

#content-body .hardware-flow-node strong {
  overflow-wrap: anywhere;
  font-size: 0.75rem;
  line-height: 1.3;
}

#content-body .hardware-project-visual::before {
  position: absolute;
  top: 15%;
  bottom: 15%;
  left: 1.35rem;
  width: 1px;
  background: linear-gradient(transparent, var(--project-accent), transparent);
  content: "";
  opacity: 0.65;
}

#content-body .hardware-project-visual::after {
  position: absolute;
  top: 14%;
  left: calc(1.35rem - 3px);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--project-accent);
  box-shadow: 0 0 12px var(--project-accent);
  content: "";
  animation: hardware-signal-travel 3.6s ease-in-out infinite;
}

@keyframes hardware-signal-travel {
  0%, 100% { top: 14%; opacity: 0.45; }
  50% { top: 84%; opacity: 1; }
}

#content-body .hardware-project-sbc .hardware-project-tags {
  grid-column: 1;
}

#content-body .hardware-project-sbc .hardware-project-visual {
  grid-column: 2;
}

#content-body .hardware-project-bench .hardware-project-description { grid-column: 1; }
#content-body .hardware-project-bench .hardware-project-tags { grid-column: 2; }

@media (max-width: 1050px) {
  #content-body .hardware-project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #content-body .hardware-project-imu,
  #content-body .hardware-project-transceiver,
  #content-body .hardware-project-mcu,
  #content-body .hardware-project-bench { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  #content-body .hardware-project-grid { grid-template-columns: 1fr; }
  #content-body .hardware-project-card,
  #content-body .hardware-project-imu,
  #content-body .hardware-project-transceiver,
  #content-body .hardware-project-mcu,
  #content-body .hardware-project-asic,
  #content-body .hardware-project-sbc,
  #content-body .hardware-project-bench { grid-column: 1; min-height: 0; }
  #content-body .hardware-project-card { grid-template-columns: 1fr; }
  #content-body .hardware-project-visual { grid-column: 1; grid-row: auto; }
  #content-body .hardware-project-imu .hardware-project-description,
  #content-body .hardware-project-imu .hardware-project-visual,
  #content-body .hardware-project-imu .hardware-project-tags { grid-column: 1; grid-row: auto; }
  #content-body .hardware-project-bench .hardware-project-description,
  #content-body .hardware-project-bench .hardware-project-tags { grid-column: 1; }
}
