/* ==========================================================================
   Fengxu Yang — Portfolio
   Design system & component styles
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", var(--font-sans);
  --font-serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --container: 1180px;
  --nav-h: 76px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* Dark theme (default) */
  --bg: hsl(226 32% 6%);
  --bg-elev: hsl(226 28% 9%);
  --surface: hsla(226, 30%, 14%, 0.5);
  --surface-strong: hsla(226, 30%, 16%, 0.88);
  --border: hsla(220, 40%, 80%, 0.09);
  --border-strong: hsla(220, 40%, 80%, 0.18);
  --text: hsl(220 30% 95%);
  --text-soft: hsl(222 18% 78%);
  --muted: hsl(222 14% 60%);

  --accent: hsl(168 76% 54%);
  --accent-2: hsl(256 88% 72%);
  --accent-3: hsl(199 92% 62%);
  --warn: hsl(38 95% 62%);

  --accent-soft: hsla(168, 76%, 54%, 0.12);
  --accent-2-soft: hsla(256, 88%, 72%, 0.14);
  --warn-soft: hsla(38, 95%, 62%, 0.14);

  --gradient: linear-gradient(115deg, var(--accent) 0%, var(--accent-3) 45%, var(--accent-2) 100%);
  --on-gradient: hsl(226 40% 8%);
  --shadow: 0 24px 60px -24px hsla(226, 60%, 2%, 0.85);
  --glow: 0 0 0 1px var(--border-strong), 0 24px 60px -24px hsla(190, 90%, 50%, 0.35);
  --spot: hsla(168, 76%, 60%, 0.08);
  --grain: 0.06;

  color-scheme: dark;
}

[data-theme="light"] {
  --bg: hsl(40 33% 97%);
  --bg-elev: hsl(40 24% 93%);
  --surface: hsla(0, 0%, 100%, 0.62);
  --surface-strong: hsla(0, 0%, 100%, 0.94);
  --border: hsla(230, 25%, 20%, 0.10);
  --border-strong: hsla(230, 25%, 20%, 0.18);
  --text: hsl(228 35% 12%);
  --text-soft: hsl(226 18% 28%);
  --muted: hsl(224 10% 43%);

  --accent: hsl(170 82% 30%);
  --accent-2: hsl(256 62% 52%);
  --accent-3: hsl(201 88% 40%);
  --warn: hsl(32 92% 40%);

  --accent-soft: hsla(170, 82%, 30%, 0.10);
  --accent-2-soft: hsla(256, 62%, 52%, 0.10);
  --warn-soft: hsla(32, 92%, 40%, 0.10);

  --on-gradient: #fff;
  --shadow: 0 20px 44px -24px hsla(230, 40%, 25%, 0.32);
  --glow: 0 0 0 1px var(--border-strong), 0 24px 60px -28px hsla(200, 80%, 40%, 0.35);
  --spot: hsla(170, 82%, 30%, 0.06);
  --grain: 0.045;

  color-scheme: light;
}

/* ---------- Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 12px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  overflow-x: clip;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
}

/* Ambient background glow */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(60vw 50vh at 85% -10%, var(--accent-2-soft), transparent 70%),
    radial-gradient(50vw 45vh at -10% 20%, var(--accent-soft), transparent 70%);
}

/* Film grain */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px;
  opacity: var(--grain);
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
figure { margin: 0; }

::selection { background: var(--accent); color: var(--bg); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
  transition: top 0.2s;
}
.skip-link:focus { top: 12px; }

.container {
  width: min(100% - 40px, var(--container));
  margin-inline: auto;
}

.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.mono { font-family: var(--font-mono); }

/* Serif-italic accent words in headlines */
.hero-tagline em,
.section-title em,
.about-lead em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 1.1em;
  letter-spacing: -0.01em;
  padding-right: 0.08em;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 22px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1;
  white-space: nowrap;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s, background 0.3s, color 0.3s;
}
.btn svg { width: 18px; height: 18px; flex-shrink: 0; transition: transform 0.3s var(--ease); }
.btn:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--glow); }
.btn:hover .icon-arrow { transform: translate(2px, -2px); }
.btn:hover .icon-arrow-r { transform: translateX(3px); }

.btn-primary {
  border-color: transparent;
  color: var(--on-gradient);
  background: var(--gradient);
  background-size: 200% 100%;
  background-position: 0% 50%;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), background-position 0.6s var(--ease);
}
.btn-primary:hover { border-color: transparent; background-position: 100% 50%; box-shadow: 0 16px 40px -16px var(--accent-3); }

.btn-sm { padding: 9px 15px; font-size: 0.85rem; gap: 8px; }
.btn-sm svg { width: 16px; height: 16px; }

.btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn[aria-disabled="true"]:hover,

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color 0.3s, transform 0.3s var(--ease), color 0.3s, background 0.3s;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.brand-linkedin { color: #0a66c2; }
.icon-btn .brand-linkedin { width: 18px; height: 18px; }
:root:not([data-theme="light"]) .brand-linkedin { color: #3d8fe0; }
/* Copy button: the icon swaps for a tick once copied */
.copy-btn { padding: 0; }
.copy-btn svg { grid-area: 1 / 1; transition: opacity 0.25s, transform 0.35s var(--ease); }
.copy-btn .icon-done { opacity: 0; transform: scale(0.6); color: var(--accent); }
.copy-btn.copied { border-color: var(--accent); }
.copy-btn.copied .icon-mail { opacity: 0; transform: scale(0.6); }
.copy-btn.copied .icon-done { opacity: 1; transform: none; }

/* ---------- Navigation: a floating glass bar ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  padding-top: 14px;
  pointer-events: none;
}

.nav {
  position: relative;
  display: flex;
  align-items: center;
  height: 58px;
  padding: 0 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 50%, transparent);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  box-shadow: inset 0 1px 0 hsla(0, 0%, 100%, 0.05);
  pointer-events: auto;
  transition: background 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
/* Hairline border that picks up the accent colours at either end */
.nav::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(100deg,
    color-mix(in srgb, var(--accent) 65%, transparent),
    var(--border-strong) 28% 72%,
    color-mix(in srgb, var(--accent-2) 65%, transparent));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.site-header.scrolled .nav {
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  box-shadow: inset 0 1px 0 hsla(0, 0%, 100%, 0.05), var(--shadow);
}

.nav-links { position: relative; display: flex; align-items: center; }
.nav-links a {
  position: relative;
  z-index: 1;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.3s;
}
.nav-links a:hover,
.nav-links a:focus-visible,
.nav-links a.active { color: var(--text); }

/* Each label has a serif-italic twin underneath; hover, or being the current
   section, rolls the twin into view */
.nav-roll { display: inline-block; vertical-align: top; height: 1.4em; overflow: hidden; line-height: 1.4em; }
.nav-label { position: relative; display: block; transition: transform 0.55s var(--ease); }
.nav-label::after {
  content: attr(data-label);
  content: attr(data-label) / "";
  position: absolute;
  inset: 100% 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 1.18em;
  font-style: italic;
  font-weight: 400;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.nav-links a:hover .nav-label,
.nav-links a:focus-visible .nav-label,
.nav-links a.active .nav-label { transform: translateY(-100%); }
/* While another link is hovered, only that one keeps the italic twin */
.nav-links:hover a.active:not(:hover) .nav-label { transform: none; }

/* Glass capsule that glides to the hovered link, or else the current section's */
.nav-glider {
  position: absolute;
  top: 50%;
  left: 0;
  height: 38px;
  margin-top: -19px;
  border-radius: 999px;
  background: linear-gradient(115deg, var(--accent-soft), var(--accent-2-soft));
  box-shadow: inset 0 0 0 1px var(--border-strong), 0 10px 24px -14px var(--accent-3);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.5s var(--ease), width 0.5s var(--ease), opacity 0.3s;
}
.nav-glider.on { opacity: 1; }

.nav-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav-actions .icon-btn { width: 40px; height: 40px; border-radius: 999px; border-color: transparent; background: transparent; }
.nav-actions .icon-btn:hover { border-color: var(--border); background: var(--surface); transform: none; }

/* Theme icons swap with a quarter turn */
.theme-toggle { position: relative; }
.theme-toggle svg {
  position: absolute;
  inset: 0;
  margin: auto;
  transition: transform 0.6s var(--ease), opacity 0.35s;
}
.theme-toggle .icon-sun,
[data-theme="light"] .theme-toggle .icon-moon { opacity: 0; transform: rotate(-90deg) scale(0.6); }
[data-theme="light"] .theme-toggle .icon-sun { opacity: 1; transform: none; }

/* Scroll progress, drawn along the bar's lower edge */
.nav-progress {
  position: absolute;
  left: 28px;
  right: 28px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--gradient);
  transform: scaleX(0);
  transform-origin: 0 50%;
  pointer-events: none;
}

.menu-toggle { display: none; }
.menu-toggle .bar {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.3s var(--ease), opacity 0.2s;
}
.menu-toggle .bars { display: grid; gap: 4px; }
.menu-open .menu-toggle .bar:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-open .menu-toggle .bar:nth-child(2) { opacity: 0; }
.menu-open .menu-toggle .bar:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  padding: calc(var(--nav-h) + 36px) 0 36px;
  overflow: hidden;
  isolation: isolate;
}
.hero-aurora { position: absolute; inset: 0; z-index: -3; pointer-events: none; }
.hero-aurora span {
  position: absolute;
  border-radius: 50%;
  animation: drift 26s ease-in-out infinite alternate;
}
.hero-aurora span:nth-child(1) {
  width: 60vw;
  height: 60vw;
  right: -16vw;
  top: -22vw;
  background: radial-gradient(closest-side, var(--accent-2-soft), transparent);
}
.hero-aurora span:nth-child(2) {
  width: 44vw;
  height: 44vw;
  left: -16vw;
  top: 18vh;
  background: radial-gradient(closest-side, var(--accent-soft), transparent);
  animation-duration: 34s;
  animation-direction: alternate-reverse;
}
@keyframes drift { to { transform: translate3d(-5vw, 6vh, 0) scale(1.1); } }

.hero-inner {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 32px;
  align-items: center;
}

.hero-name {
  font-size: clamp(3rem, 7.4vw, 6.4rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.045em;
}
.hero-name .word { display: inline-block; white-space: nowrap; }
.hero-name .char {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.45em);
  animation: rise 1s var(--ease) forwards;
  animation-delay: calc(120ms + var(--i) * 45ms);
}
@keyframes rise { to { opacity: 1; transform: none; } }

.hero-tagline em { white-space: nowrap; }
.hero-tagline {
  margin-top: 22px;
  max-width: 15em;
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 3vw, 2.35rem);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.03em;
}

.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.hero-social { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 26px; }
/* Location, set off from the icons by a hairline */
.hero-loc {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
  padding-left: 18px;
  border-left: 1px solid var(--border-strong);
  font-size: 0.92rem;
  color: var(--muted);
  white-space: nowrap;
}
.hero-loc svg { width: 16px; height: 16px; color: var(--accent); }

/* Hero figure — a live liquid form */
.hero-figure {
  position: relative;
  justify-self: end;
  width: min(100%, 70svh, 580px);
  aspect-ratio: 1;
}
.hero-figure::before {
  content: "";
  position: absolute;
  inset: 16%;
  z-index: -1;
  border-radius: 50%;
  background:
    radial-gradient(closest-side at 40% 40%, var(--accent-soft), transparent),
    radial-gradient(closest-side, var(--accent-2-soft), transparent);
  filter: blur(28px);
}
#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
/* Without WebGL, a still gradient orb stands in for the live form */
.hero-figure.no-webgl::after {
  content: "";
  position: absolute;
  inset: 21%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, hsla(0, 0%, 100%, 0.55), transparent 22%),
    radial-gradient(circle at 70% 75%, var(--accent-2), transparent 60%),
    linear-gradient(140deg, var(--accent), var(--accent-3) 50%, var(--accent-2));
  box-shadow: 0 0 60px -10px var(--accent-3);
}

/* ---------- Sections ---------- */
.section { position: relative; padding: 100px 0; }
.section-alt {
  background: linear-gradient(180deg, transparent, var(--bg-elev) 10%, var(--bg-elev) 90%, transparent);
}

.section-head { position: relative; isolation: isolate; margin-bottom: 56px; }
.section-head > :not(.section-num) { max-width: 720px; }
.section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.section-kicker::before {
  content: "";
  width: 28px;
  height: 1px;
  background: currentColor;
}
.section-title {
  margin-top: 14px;
  font-size: clamp(2.2rem, 4.6vw, 3.5rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.035em;
}
.section-sub { display: block; margin-top: 16px; max-width: 600px; color: var(--muted); font-size: 1.08rem; }
.section-head .section-sub { max-width: 600px; }

/* Oversized outlined section numerals, kept behind the heading text */
.section-num {
  position: absolute;
  z-index: -1;
  right: 0;
  top: -0.12em;
  font-family: var(--font-display);
  font-size: clamp(5rem, 12vw, 9.5rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.06em;
  color: transparent;
  -webkit-text-stroke: 1px var(--border-strong);
  pointer-events: none;
  user-select: none;
}

/* ---------- Cards ---------- */
.card {
  position: relative;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: border-color 0.35s, transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
/* Gradient hairline that fades in on hover */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  padding: 1px;
  background: var(--gradient);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}
.card:hover { border-color: transparent; }
.card:hover::before { opacity: 0.6; }

/* Cursor-following spotlight */
.spot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(460px circle at var(--mx, 50%) var(--my, 0%), var(--spot), transparent 45%);
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}
.spot:hover::after { opacity: 1; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-soft);
  white-space: nowrap;
}
.tag-accent { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.tag-violet { color: var(--accent-2); background: var(--accent-2-soft); border-color: transparent; }
.tag-warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }

.mini-label {
  margin-top: 32px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 48px;
  align-items: start;
}
.about-bio p { font-size: 1.06rem; color: var(--text-soft); }
.about-bio p + p { margin-top: 18px; }
/* Lead set like a pull quote, with a gradient rule down its left edge */
.about-bio .about-lead {
  position: relative;
  margin-bottom: 30px;
  padding-left: 24px;
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2.1vw, 1.6rem);
  line-height: 1.35;
  letter-spacing: -0.02em;
  color: var(--text);
}
.about-lead::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.2em;
  bottom: 0.2em;
  width: 2px;
  border-radius: 2px;
  background: var(--gradient);
}
.about-bio strong { color: var(--text); font-weight: 600; }
.about-bio a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: text-decoration-color 0.25s;
}
.about-bio a:hover { text-decoration-color: var(--accent); }

.interests { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* Focus areas: four irregular shards cut from one tile, split by leaning
   gutters. JS measures each card and clips it to its shard; without JS they
   stay ordinary cards. */
.focus-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.focus { padding: 24px; overflow: hidden; }
.focus:hover { transform: translateY(-3px); }
.focus-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.focus-verb {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.35s;
}
.focus:hover .focus-verb { color: var(--accent); }
.focus-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: var(--accent-soft);
  color: var(--accent);
  transition: background 0.35s, color 0.35s;
}
/* Teal and violet in a checkerboard across the tile */
.focus:nth-child(2) .focus-icon,
.focus:nth-child(3) .focus-icon { background: var(--accent-2-soft); color: var(--accent-2); }
.focus:hover .focus-icon { background: var(--gradient); color: var(--on-gradient); }
.focus-icon svg { width: 22px; height: 22px; }
.focus h3 { margin-top: 20px; font-size: 1.12rem; font-weight: 600; }
.focus p { margin-top: 8px; font-size: 0.92rem; color: var(--muted); line-height: 1.55; }

/* A shard's outline is an SVG path (a CSS border can't follow a clip-path).
   Negative margins let neighbouring boxes overlap under the cuts, and padding
   grows on each cut side so text stays clear of the slanted edges. The clip-path
   draws the rounded corners, so the box itself must stay square or it trims them. */
.focus.is-shard {
  border: 0;
  border-radius: 0;
  margin: calc(-1 * var(--ov-t)) calc(-1 * var(--ov-r)) calc(-1 * var(--ov-b)) calc(-1 * var(--ov-l));
  padding: calc(24px + var(--cut-t)) calc(24px + var(--cut-r)) calc(24px + var(--cut-b)) calc(24px + var(--cut-l));
}
.focus.is-shard::before { display: none; }
.focus.is-shard:hover { transform: none; }
.shard { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.shard path { fill: none; }
.shard-line { stroke: var(--border-strong); stroke-width: 2; }
.shard-glow { stroke: url(#g-accent); stroke-width: 3; opacity: 0; transition: opacity 0.4s; }
.focus:hover .shard-glow { opacity: 1; }
.g-a { stop-color: var(--accent); }
.g-b { stop-color: var(--accent-3); }
.g-c { stop-color: var(--accent-2); }
/* On reveal, each shard drifts in from outside the tile and settles into place */
.js .focus.is-shard.reveal.in { animation-name: shard-in; animation-duration: 1.1s; }
@keyframes shard-in { from { opacity: 0; transform: translate(var(--fx), var(--fy)) rotate(var(--fr)); } }

/* ---------- Projects ---------- */
.project {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.project:hover { box-shadow: var(--glow); }

/* Feature cards: the live visual on the left, the text on the right */
.project-feature {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
}
.project-feature + .project-feature { margin-top: 22px; }

.project-visual {
  position: relative;
  height: 260px;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 0% 0%, var(--accent-soft), transparent 60%),
    radial-gradient(120% 90% at 100% 100%, var(--accent-2-soft), transparent 60%),
    var(--bg-elev);
}
.project-feature .project-visual {
  order: -1;
  height: auto;
  min-height: 460px;
  border-bottom: 0;
  border-right: 1px solid var(--border);
}

/* QUASAR web-app mock. Sizes and wording follow the real dashboard, scaled
   down to fit the card; it fills the whole panel, like a screenshot of the app.
   Light theme uses the app's colours; dark theme follows the QUASAR portal. */
.qa {
  --qa-ink: #0f172a;
  --qa-ease: cubic-bezier(0.22, 1, 0.36, 1);
  position: absolute;
  inset: 0;
  display: flex;
  gap: 12px;
  padding: 12px;
  background:
    radial-gradient(70% 45% at 40% -6%, rgba(79, 114, 232, 0.13), transparent 72%),
    radial-gradient(55% 50% at 105% 105%, rgba(111, 79, 228, 0.1), transparent 72%),
    linear-gradient(rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0.65)),
    #f5f7ff;
  color: var(--qa-ink);
  font-family: "Geist Sans", "SF Pro Display", "SF Pro Text", "Aptos", "Segoe UI Variable", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-align: left;
}
.qa svg { width: 100%; height: 100%; }

/* The app's "glass-panel" surface */
.qa-rail,
.qa-log,
.qa-banner {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.46)),
    rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.66);
  box-shadow: 0 18px 48px rgba(48, 57, 115, 0.09), 0 1px 4px rgba(99, 102, 241, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* Left rail: logo, tabs, task-progress ring */
.qa-rail {
  flex: 0 0 62px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0 14px;
  border-radius: 20px;
}
.qa-brand { display: flex; flex-direction: column; align-items: center; margin-bottom: 26px; }
.qa-brand > span {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.65);
  box-shadow: 0 10px 15px -3px rgba(199, 210, 254, 0.4);
}
.qa-brand img { width: 30px; height: 30px; }
.qa-brand b {
  margin-top: 6px;
  font-size: 9px;
  font-weight: 700;
  background: linear-gradient(90deg, #4f72e8, #6f4fe4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.qa-nav { display: flex; flex-direction: column; gap: 6px; }
.qa-nav span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 13px; color: #94a3b8; }
.qa-nav span.on {
  color: #4a5fe4;
  border: 1px solid rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 10px 15px -3px rgba(199, 210, 254, 0.5);
}
.qa-nav svg { width: 18px; height: 18px; }
.qa-status {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-top: auto;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.5);
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.5);
}
.qa-status svg,
.qa-dot { grid-area: 1 / 1; }
.qa-status svg { width: 26px; height: 26px; transform: rotate(-90deg); }
.qa-status circle { fill: none; stroke-width: 2.5; }
.qa-ring-bg { stroke: rgba(148, 163, 184, 0.12); }
.qa-ring { stroke: url(#qa-ring-grad); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset 0.5s ease-out; }
.qa-dot { width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; transition: background 0.3s; }
.qa-dot.run { background: #4ade80; animation: qa-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.qa-dot.paused { background: #fbbf24; }
@keyframes qa-pulse { 50% { opacity: 0.5; } }

/* Main column: execution log with the prompt bar floating over its foot */
.qa-main {
  /* The welcome stack is centred on the input, a little above the middle */
  --qa-mid: 46%;
  --qa-input-y: calc(var(--qa-mid) - 22px);
  position: relative;
  display: flex;
  flex: 1;
  min-width: 0;
}
.qa.started .qa-main { --qa-input-y: calc(100% - 60px); }

/* Empty dashboard: title above the input, workflow templates below */
.qa-welcome { position: absolute; inset: 0; transition: opacity 0.4s var(--qa-ease), visibility 0.4s; }
.qa.started .qa-welcome { opacity: 0; visibility: hidden; }
.qa-hello {
  position: absolute;
  inset: 0 12px auto;
  height: calc(var(--qa-mid) - 40px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  text-align: center;
  color: #0f172a;
}
.qa-hello em {
  font-style: normal;
  background: linear-gradient(100deg, #22d3ee 0%, #4f72e8 48%, #6f4fe4 92%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.qa-tpls {
  position: absolute;
  top: calc(var(--qa-mid) + 38px);
  left: 50%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: min(100% - 28px, 400px);
  transform: translateX(-50%);
}
.qa-tpl {
  display: block;
  padding: 9px 10px 10px;
  border-radius: 11px;
  border: 1px solid rgba(226, 232, 240, 0.8);
  background: rgba(255, 255, 255, 0.75);
  box-shadow: 0 1px 2px rgba(224, 231, 255, 0.3);
}
.qa-tpl-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.qa .qa-tpl-top svg { flex-shrink: 0; width: 13px; height: 13px; color: #94a3b8; }
.qa-tag {
  overflow: hidden;
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid;
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  font-size: 8.5px;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}
.qa-tag.em { border-color: rgba(16, 185, 129, 0.25); background: rgba(16, 185, 129, 0.1); color: #047857; }
.qa-tag.in { border-color: rgba(99, 102, 241, 0.25); background: rgba(99, 102, 241, 0.1); color: #4338ca; }
.qa-tag.cy { border-color: rgba(6, 182, 212, 0.25); background: rgba(6, 182, 212, 0.1); color: #0e7490; }
.qa-tag.vi { border-color: rgba(139, 92, 246, 0.25); background: rgba(139, 92, 246, 0.1); color: #6d28d9; }
.qa-tpl b { display: block; margin-top: 7px; font-size: 11.5px; font-weight: 700; line-height: 1.3; letter-spacing: -0.01em; color: #0f172a; }
.qa-log {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border-radius: 16px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s var(--qa-ease), transform 0.5s var(--qa-ease);
}
.qa.started .qa-log { opacity: 1; transform: none; }

/* Agent band */
.qa-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  background: linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.2));
}
.qa-agent {
  --ring: linear-gradient(135deg, #ddd6fe, #e0e7ff, #fff);
  --ring-on: linear-gradient(135deg, #a78bfa, #818cf8, #e879f9);
  --glow: rgba(139, 92, 246, 0.55);
  --wash: linear-gradient(135deg, rgba(245, 243, 255, 0.7), rgba(255, 255, 255, 0.4), transparent);
  --pulse: #a78bfa;
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 9px 11px;
}
.qa-agent + .qa-agent { border-left: 1px solid rgba(255, 255, 255, 0.25); }
.qa-agent[data-agent="operator"] {
  --ring: linear-gradient(135deg, #bae6fd, #dbeafe, #fff);
  --ring-on: linear-gradient(135deg, #38bdf8, #3b82f6, #22d3ee);
  --glow: rgba(59, 130, 246, 0.5);
  --wash: linear-gradient(135deg, rgba(240, 249, 255, 0.7), rgba(255, 255, 255, 0.4), transparent);
  --pulse: #38bdf8;
}
.qa-agent[data-agent="evaluator"] {
  --ring: linear-gradient(135deg, #a7f3d0, #ccfbf1, #fff);
  --ring-on: linear-gradient(135deg, #34d399, #14b8a6, #22d3ee);
  --glow: rgba(16, 185, 129, 0.5);
  --wash: linear-gradient(135deg, rgba(236, 253, 245, 0.7), rgba(255, 255, 255, 0.4), transparent);
  --pulse: #34d399;
}
.qa-agent::before { content: ""; position: absolute; inset: 0; background: var(--wash); opacity: 0; transition: opacity 0.5s var(--qa-ease); }
.qa-agent.on::before { opacity: 1; }
.qa-face { position: relative; flex-shrink: 0; padding: 1.5px; border-radius: 11px; background: var(--ring); transition: transform 0.5s var(--qa-ease), box-shadow 0.5s var(--qa-ease); }
.qa-agent.on .qa-face { background: var(--ring-on); box-shadow: 0 8px 22px -8px var(--glow); transform: scale(1.03); }
.qa-face > span { display: block; width: 28px; height: 28px; overflow: hidden; border-radius: 10px; background: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7); }
.qa-face img { width: 100%; height: 100%; object-fit: cover; object-position: top; opacity: 0.8; filter: saturate(0.75); transition: opacity 0.5s, filter 0.5s; }
.qa-agent.on .qa-face img { opacity: 1; filter: none; }
/* Live status pip */
.qa-face i {
  position: absolute;
  right: -2px;
  bottom: -2px;
  display: grid;
  place-items: center;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.1);
  opacity: 0;
  transform: scale(0.75);
  transition: opacity 0.3s, transform 0.3s;
}
.qa-face i::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--pulse); }
.qa-agent.on .qa-face i::after { animation: qa-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.qa-agent.on .qa-face i { opacity: 1; transform: none; }
.qa-who { position: relative; min-width: 0; }
.qa-who b,
.qa-who small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qa-who b { font-size: 11.5px; font-weight: 600; letter-spacing: -0.01em; color: #475569; transition: color 0.3s; }
.qa-agent.on .qa-who b { color: #1e293b; }
.qa-who small { margin-top: 2px; font-size: 8.5px; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase; color: #94a3b8; }

/* Log rows (status entries and foldable task sections) */
.qa-rows { flex: 1; min-height: 0; overflow: hidden; padding-bottom: 84px; }
.qa-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(248, 250, 252, 0.3);
  animation: qa-in 0.35s var(--qa-ease) backwards;
}
@keyframes qa-in { from { opacity: 0; transform: translateY(4px); } }
.qa-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 21px;
  height: 21px;
  border-radius: 7px;
  color: #fff;
  background: linear-gradient(135deg, #a855f7, #6366f1);
}
.qa-row[data-agent="operator"] .qa-icon { background: linear-gradient(135deg, #3b82f6, #06b6d4); }
.qa-row[data-agent="evaluator"] .qa-icon { background: linear-gradient(135deg, #10b981, #14b8a6); }
.qa-icon svg { width: 12px; height: 12px; }
.qa-row:not(.done) .qa-icon svg { animation: qa-spin 1s linear infinite; }
@keyframes qa-spin { to { transform: rotate(360deg); } }
.qa-status-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #475569;
}
.qa-row.done .qa-status-text { color: #16a34a; }
/* File names are links into the workspace */
.qa-status-text u { padding: 0 1px; font-style: italic; color: #0369a1; text-decoration: underline; text-decoration-color: rgba(56, 189, 248, 0.8); text-underline-offset: 2px; }
.qa .qa-more { flex-shrink: 0; width: 14px; height: 14px; color: #94a3b8; opacity: 0; transition: opacity 0.3s; }
.qa-row.done .qa-more { opacity: 1; }

.qa-task-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  border-block: 1px solid rgba(199, 210, 254, 0.5);
  background: linear-gradient(90deg, rgba(238, 242, 255, 0.8), rgba(250, 245, 255, 0.6), rgba(238, 242, 255, 0.8));
  animation: qa-in 0.35s var(--qa-ease) backwards;
  transition: background 0.5s, border-color 0.5s;
}
.qa-task.passed .qa-task-head {
  border-color: rgba(187, 247, 208, 0.5);
  background: linear-gradient(90deg, rgba(240, 253, 244, 0.8), rgba(236, 253, 245, 0.6), rgba(240, 253, 244, 0.8));
}
.qa-chev { display: grid; flex-shrink: 0; width: 14px; height: 14px; color: #64748b; transition: transform 0.35s var(--qa-ease); }
.qa-task.passed .qa-chev { transform: rotate(-90deg); }
.qa-badge { flex-shrink: 0; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; color: #4f46e5; background: #e0e7ff; transition: color 0.5s, background 0.5s; }
.qa-task.passed .qa-badge { color: #16a34a; background: #dcfce7; }
.qa-task-title { flex: 1; min-width: 0; overflow: hidden; font-size: 12.5px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; color: #334155; }
/* Passed tasks fold away, as in the app */
.qa-task-body { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 0.5s var(--qa-ease); }
.qa-task-body > div { min-height: 0; overflow: hidden; }
.qa-task.passed .qa-task-body { grid-template-rows: 0fr; }

/* Floating prompt bar (the app's "glass-input") */
.qa-input {
  position: absolute;
  left: 50%;
  top: var(--qa-input-y);
  display: flex;
  align-items: center;
  width: min(100% - 28px, 440px);
  min-height: 44px;
  padding: 3px;
  border-radius: 15px;
  border: 1px solid rgba(203, 213, 225, 0.75);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.62)),
    rgba(255, 255, 255, 0.72);
  box-shadow: 0 20px 50px rgba(30, 41, 59, 0.12), 0 4px 12px rgba(79, 114, 232, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.95);
  transform: translateX(-50%);
  transition: top 0.7s var(--qa-ease), box-shadow 0.3s;
}
.qa-input.running { box-shadow: 0 10px 15px -3px rgba(15, 23, 42, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.95); }
.qa-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  padding: 0 12px;
  font-size: 12.5px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #334155;
}
.qa-text .ph { color: #94a3b8; }
.qa-text .caret { display: inline-block; width: 1px; height: 13px; margin-left: 1px; vertical-align: -2px; background: #4a5fe4; animation: qa-pulse 1s infinite; }
.qa-ctx {
  display: none;
  flex-shrink: 0;
  margin-right: 2px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid #a7f3d0;
  background: #ecfdf5;
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  font-size: 9.5px;
  font-weight: 700;
  color: #047857;
  font-variant-numeric: tabular-nums;
}
.qa-input.running .qa-ctx { display: inline-block; }
.qa-btn {
  position: relative;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  margin: 2px;
  border-radius: 11px;
  color: #fff;
  background: #4a5fe4;
  box-shadow: 0 4px 6px -1px rgba(165, 180, 252, 0.4);
  transition: background 0.3s, transform 0.2s;
}
.qa-btn.press { transform: scale(0.9); }
.qa-send { width: 16px !important; height: 16px !important; }
.qa-stop { display: none; width: 13px; height: 13px; border-radius: 3px; background: currentColor; }
.qa-input.running .qa-btn { background: #ef4444; box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.1); }
.qa-input.running .qa-send { display: none; }
.qa-input.running .qa-stop { display: block; }

/* "Run complete · View History" pill */
.qa-banner {
  position: absolute;
  top: 14px;
  left: 50%;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 15px;
  border-radius: 999px;
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 20px 25px -5px rgba(15, 23, 42, 0.1);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  color: #334155;
  opacity: 0;
  transform: translate(-50%, -14px);
  transition: opacity 0.5s var(--qa-ease), transform 0.5s var(--qa-ease);
}
.qa-banner.show { opacity: 1; transform: translate(-50%, 0); }
.qa-banner svg { width: 15px; height: 15px; color: #3b82f6; }
.qa-banner b { font-weight: 600; color: #2563eb; }

/* Dark theme, after the QUASAR portal's own dark palette (the app itself is
   light-only, so these follow its marketing site instead) */
:root:not([data-theme="light"]) .qa {
  background:
    radial-gradient(70% 45% at 40% -6%, rgba(109, 124, 255, 0.16), transparent 72%),
    radial-gradient(55% 50% at 105% 105%, rgba(160, 107, 255, 0.12), transparent 72%),
    #080b16;
  color: #eef1fb;
}
:root:not([data-theme="light"]) .qa-rail, :root:not([data-theme="light"]) .qa-log, :root:not([data-theme="light"]) .qa-banner {
  background: linear-gradient(145deg, rgba(22, 28, 50, 0.82), rgba(12, 16, 30, 0.72));
  border-color: rgba(148, 163, 184, 0.12);
  box-shadow: 0 18px 48px rgba(2, 4, 12, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
:root:not([data-theme="light"]) .qa-brand > span { border-color: rgba(148, 163, 184, 0.14); background: rgba(255, 255, 255, 0.04); box-shadow: 0 10px 15px -3px rgba(2, 4, 12, 0.5); }
:root:not([data-theme="light"]) .qa-brand b { background: linear-gradient(90deg, #6d7cff, #a06bff); -webkit-background-clip: text; background-clip: text; }
:root:not([data-theme="light"]) .qa-nav span { color: #5d6785; }
:root:not([data-theme="light"]) .qa-nav span.on { color: #8b98ff; border-color: rgba(148, 163, 184, 0.16); background: rgba(109, 124, 255, 0.13); box-shadow: 0 10px 15px -3px rgba(2, 4, 12, 0.5); }
:root:not([data-theme="light"]) .qa-status { border-color: rgba(148, 163, 184, 0.12); background: rgba(255, 255, 255, 0.03); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.25); }
:root:not([data-theme="light"]) .qa-ring-bg { stroke: rgba(148, 163, 184, 0.1); }
:root:not([data-theme="light"]) .qa-dot { background: #475069; }
:root:not([data-theme="light"]) .qa-dot.run { background: #4ade80; }
:root:not([data-theme="light"]) .qa-dot.paused { background: #fbbf24; }
:root:not([data-theme="light"]) .qa-hello { color: #eef1fb; }
:root:not([data-theme="light"]) .qa-hello em { background: linear-gradient(100deg, #38d4f5 0%, #6d7cff 48%, #a06bff 92%); -webkit-background-clip: text; background-clip: text; }
:root:not([data-theme="light"]) .qa-tpl { border-color: rgba(148, 163, 184, 0.12); background: rgba(255, 255, 255, 0.035); box-shadow: none; }
:root:not([data-theme="light"]) .qa .qa-tpl-top svg { color: #5d6785; }
:root:not([data-theme="light"]) .qa-tpl b { color: #dfe4f5; }
:root:not([data-theme="light"]) .qa-tag.em { border-color: rgba(16, 185, 129, 0.3); background: rgba(16, 185, 129, 0.12); color: #6ee7b7; }
:root:not([data-theme="light"]) .qa-tag.in { border-color: rgba(129, 140, 248, 0.3); background: rgba(129, 140, 248, 0.12); color: #a5b4fc; }
:root:not([data-theme="light"]) .qa-tag.cy { border-color: rgba(34, 211, 238, 0.3); background: rgba(34, 211, 238, 0.1); color: #67e8f9; }
:root:not([data-theme="light"]) .qa-tag.vi { border-color: rgba(167, 139, 250, 0.3); background: rgba(167, 139, 250, 0.12); color: #c4b5fd; }
:root:not([data-theme="light"]) .qa-band { border-bottom-color: rgba(148, 163, 184, 0.1); background: linear-gradient(rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)); }
:root:not([data-theme="light"]) .qa-agent + .qa-agent { border-left-color: rgba(148, 163, 184, 0.08); }
:root:not([data-theme="light"]) .qa-agent[data-agent="strategist"] { --ring: linear-gradient(135deg, rgba(167, 139, 250, 0.5), rgba(129, 140, 248, 0.25), rgba(255, 255, 255, 0.08)); --wash: linear-gradient(135deg, rgba(139, 92, 246, 0.18), rgba(139, 92, 246, 0.05), transparent); }
:root:not([data-theme="light"]) .qa-agent[data-agent="operator"] { --ring: linear-gradient(135deg, rgba(56, 189, 248, 0.5), rgba(59, 130, 246, 0.25), rgba(255, 255, 255, 0.08)); --wash: linear-gradient(135deg, rgba(59, 130, 246, 0.18), rgba(59, 130, 246, 0.05), transparent); }
:root:not([data-theme="light"]) .qa-agent[data-agent="evaluator"] { --ring: linear-gradient(135deg, rgba(52, 211, 153, 0.5), rgba(20, 184, 166, 0.25), rgba(255, 255, 255, 0.08)); --wash: linear-gradient(135deg, rgba(16, 185, 129, 0.16), rgba(16, 185, 129, 0.05), transparent); }
:root:not([data-theme="light"]) .qa-face > span { background: #e6eaf6; box-shadow: none; }
:root:not([data-theme="light"]) .qa-face i { background: #0d1224; }
:root:not([data-theme="light"]) .qa-who b { color: #aab3cc; }
:root:not([data-theme="light"]) .qa-agent.on .qa-who b { color: #eef1fb; }
:root:not([data-theme="light"]) .qa-who small { color: #5d6785; }
:root:not([data-theme="light"]) .qa-row { border-bottom-color: rgba(148, 163, 184, 0.06); background: rgba(255, 255, 255, 0.015); }
:root:not([data-theme="light"]) .qa-status-text { color: #b6bfd8; }
:root:not([data-theme="light"]) .qa-row.done .qa-status-text { color: #34d399; }
:root:not([data-theme="light"]) .qa-status-text u { color: #67e0f9; text-decoration-color: rgba(56, 212, 245, 0.55); }
:root:not([data-theme="light"]) .qa .qa-more { color: #5d6785; }
:root:not([data-theme="light"]) .qa-task-head { border-color: rgba(109, 124, 255, 0.22); background: linear-gradient(90deg, rgba(109, 124, 255, 0.13), rgba(160, 107, 255, 0.08), rgba(109, 124, 255, 0.13)); }
:root:not([data-theme="light"]) .qa-task.passed .qa-task-head { border-color: rgba(52, 211, 153, 0.2); background: linear-gradient(90deg, rgba(52, 211, 153, 0.1), rgba(20, 184, 166, 0.06), rgba(52, 211, 153, 0.1)); }
:root:not([data-theme="light"]) .qa-chev { color: #7e88a6; }
:root:not([data-theme="light"]) .qa-badge { color: #a5b4fc; background: rgba(109, 124, 255, 0.18); }
:root:not([data-theme="light"]) .qa-task.passed .qa-badge { color: #6ee7b7; background: rgba(52, 211, 153, 0.16); }
:root:not([data-theme="light"]) .qa-task-title { color: #dfe4f5; }
:root:not([data-theme="light"]) .qa-input {
  border-color: rgba(148, 163, 184, 0.18);
  background: linear-gradient(145deg, rgba(26, 32, 56, 0.94), rgba(14, 18, 34, 0.9));
  box-shadow: 0 20px 50px rgba(2, 4, 12, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
:root:not([data-theme="light"]) .qa-input.running { box-shadow: 0 10px 22px -6px rgba(2, 4, 12, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.06); }
:root:not([data-theme="light"]) .qa-text { color: #dfe4f5; }
:root:not([data-theme="light"]) .qa-text .ph { color: #5d6785; }
:root:not([data-theme="light"]) .qa-text .caret { background: #8b98ff; }
:root:not([data-theme="light"]) .qa-ctx { border-color: rgba(52, 211, 153, 0.3); background: rgba(52, 211, 153, 0.1); color: #6ee7b7; }
:root:not([data-theme="light"]) .qa-btn { background: #5d6ef5; box-shadow: 0 6px 18px rgba(93, 110, 245, 0.3); }
:root:not([data-theme="light"]) .qa-input.running .qa-btn { background: #ef4444; box-shadow: 0 4px 10px -2px rgba(2, 4, 12, 0.5); }
:root:not([data-theme="light"]) .qa-banner { border-color: rgba(148, 163, 184, 0.16); box-shadow: 0 20px 25px -5px rgba(2, 4, 12, 0.55); color: #dfe4f5; }
:root:not([data-theme="light"]) .qa-banner svg { color: #6d9cff; }
:root:not([data-theme="light"]) .qa-banner b { color: #8ea2ff; }

.project:hover .app { transform: translateY(-6px); }

/* Window chrome for the app mock (materials search) */
.window-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 15px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
}
.window-bar i { width: 10px; height: 10px; border-radius: 50%; background: hsl(0 70% 62%); }
.window-bar i:nth-child(2) { background: hsl(40 90% 60%); }
.window-bar i:nth-child(3) { background: hsl(140 55% 52%); }
.window-bar span { margin-left: 8px; font-size: 0.72rem; color: var(--muted); }
@keyframes blink { 50% { opacity: 0; } }

/* App-window mock (materials search): runs off the bottom edge */
.visual-app { display: flex; padding: 48px 36px 0; }
.app {
  width: 100%;
  margin-bottom: -24px;
  border-radius: 14px 14px 0 0;
  border: 1px solid var(--border-strong);
  border-bottom: 0;
  background: var(--surface-strong);
  box-shadow: 0 30px 70px -30px hsla(226, 60%, 2%, 0.7);
  transition: transform 0.6s var(--ease);
}
.app-body { display: grid; gap: 16px; padding: 18px 18px 42px; }

.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text);
}
.search-bar svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--accent); }
.search-q { min-width: 0; overflow: hidden; white-space: nowrap; }
.caret { flex-shrink: 0; width: 1.5px; height: 16px; margin-left: -9px; background: var(--accent); animation: blink 1s steps(1) infinite; }
.search-count {
  margin-left: auto;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.68rem;
  white-space: nowrap;
}

/* Element picker: query elements light up teal, elements found in the results violet */
.ptable {
  display: grid;
  grid-template-columns: repeat(18, minmax(0, 1fr));
  gap: 3px;
  container-type: inline-size;
}
.ptable span { aspect-ratio: 1.25; border-radius: 3px; background: var(--border); }
.ptable .el {
  display: grid;
  place-items: center;
  background: var(--border-strong);
  color: var(--muted);
  font: 500 9px/1 var(--font-mono);
  transition: background 0.35s, color 0.35s, box-shadow 0.35s;
}
.ptable .el.on {
  background: color-mix(in srgb, var(--accent) 30%, transparent);
  box-shadow: inset 0 0 0 1px var(--accent);
  color: var(--text);
}
.ptable .el.sub {
  background: var(--accent-2-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-2) 60%, transparent);
  color: var(--accent-2);
}
@container (max-width: 360px) {
  .ptable .el { font-size: 0; }
}

.results { display: grid; gap: 2px; font-size: 0.82rem; }
.results-head,
.result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 7px 10px;
}
.results-head {
  padding-top: 0;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.result { border-radius: 8px; transition: opacity 0.35s, transform 0.35s var(--ease); }
.result:nth-child(even) { background: color-mix(in srgb, var(--bg-elev) 70%, transparent); }
.js .result { opacity: 0; transform: translateY(4px); }
.js .result.show { opacity: 1; transform: none; }
.r-name { font-family: var(--font-display); font-weight: 600; color: var(--text); }
.r-els { font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); white-space: nowrap; }
.r-bar { position: relative; height: 6px; overflow: hidden; border-radius: 999px; background: var(--border); }
.r-bar::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--w) * 100%);
  border-radius: inherit;
  background: var(--gradient);
  transform-origin: 0 50%;
  transition: transform 0.8s var(--ease) 0.1s;
}
.js .r-bar::after { transform: scaleX(0); }
.js .result.show .r-bar::after { transform: none; }

.project-body { display: flex; flex-direction: column; flex: 1; padding: 30px; }
.project-feature .project-body { padding: 40px; }
.project-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.project-title { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.03em; }
.project-feature .project-title { font-size: clamp(2rem, 3.4vw, 2.6rem); letter-spacing: -0.04em; }
.project-subtitle {
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text-soft);
}
.project-feature .project-subtitle { font-size: 1.2rem; color: var(--text); }
.project-desc { margin-top: 12px; color: var(--muted); }
.project-features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; margin-top: 22px; }
.project-features li { display: flex; gap: 10px; font-size: 0.9rem; line-height: 1.45; color: var(--text-soft); }
.project-features svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; color: var(--accent); }
.project-stack { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 22px; }
.project-stack .tag { font-family: var(--font-mono); font-size: 0.72rem; }
.project-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; padding-top: 26px; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.status-live { color: var(--accent); background: var(--accent-soft); }
.status-live .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: live 2s infinite; }
@keyframes live {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 60%, transparent); }
  70% { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.status-industry { color: var(--accent-2); background: var(--accent-2-soft); }
.status-soon { color: var(--warn); background: var(--warn-soft); }

/* LoopMOF method figure, after the figures on loopmof.com: the recipe tokens
   and one sampling step of loops.
   The repeating glows are SVG (SMIL) animations, not CSS: endless CSS
   animations on SVG shapes stop Chrome repainting hover gradients elsewhere. */
.visual-loop { display: grid; padding: 20px; }
.lm {
  --lm-line: color-mix(in srgb, var(--muted) 42%, transparent);
  --lm-dim: color-mix(in srgb, var(--muted) 78%, transparent);
  --lm-accent-line: color-mix(in srgb, var(--accent) 42%, transparent);
  --lm-accent-softer: color-mix(in srgb, var(--accent) 7%, transparent);
  --lm-violet-line: color-mix(in srgb, var(--accent-2) 45%, transparent);
  --lm-chip: color-mix(in srgb, var(--bg-elev) 82%, transparent);
  --lm-fail: #ef6f6c;
  --lm-o: #ef7f70;
  --lm-panel: color-mix(in srgb, var(--bg) 45%, transparent);
  display: grid;
  /* two panels share the full height; the loop diagram gets the larger share */
  grid-template-rows: minmax(0, 1fr) minmax(0, 1.45fr);
  gap: 14px;
  width: 100%;
  height: 100%;
}
[data-theme="light"] .lm { --lm-panel: color-mix(in srgb, #fff 55%, transparent); }
[data-theme="light"] .lm { --lm-fail: #d14b47; --lm-o: #d0564b; --lm-chip: color-mix(in srgb, #fff 80%, transparent); }
/* each step is a framed panel (like the step cards on loopmof.com), its figure centred in the space */
.lm-step {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  min-height: 0;
  padding: 16px 18px 18px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--lm-panel);
}
.lm-tokens,
.lm-loop { align-self: center; justify-self: center; }
.lm-label { display: flex; align-items: baseline; gap: 10px; font-family: var(--font-mono); font-size: 0.74rem; color: var(--text-soft); }
.lm-label b { font-weight: 500; color: var(--accent); }
.lm-label em { margin-left: auto; font-size: 0.64rem; font-style: normal; letter-spacing: 0.08em; color: var(--lm-dim); white-space: nowrap; }

/* 01: the recipe, one token at a time */
.lm-tokens { display: grid; gap: 16px; justify-items: center; }
.lm-row { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: center; gap: 12px 8px; }
.lm-group { display: grid; justify-items: center; gap: 4px; }
.lm-chips { display: flex; gap: 3px; }
.lm-pair { display: flex; gap: 1px; }
.lm-tok {
  display: inline-flex;
  align-items: baseline;
  height: 29px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid var(--border-strong);
  background: var(--lm-chip);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 27px;
  white-space: nowrap;
  color: var(--text);
  transition: opacity 0.35s, transform 0.45s var(--ease);
}
.lm-tok small { margin-left: 2px; font-size: 9.5px; color: var(--muted); }
.lm-pair .lm-tok:first-child { border-radius: 7px 2px 2px 7px; }
.lm-pair .lm-tok:last-child { border-radius: 2px 7px 7px 2px; color: var(--text-soft); }
.lm-tok--el { border-color: var(--lm-accent-line); background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.lm-tok--cell { border-color: var(--lm-violet-line); background: var(--accent-2-soft); color: var(--accent-2); }
.lm-tok--ctl { border-style: dashed; background: transparent; font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--lm-dim); }
.js .lm-tok { opacity: 0; transform: translateY(5px) scale(0.96); }
.js .lm-tok.show { opacity: 1; transform: none; }
.lm-lab { font-family: var(--font-mono); font-size: 9.5px; font-style: normal; letter-spacing: 0.08em; white-space: nowrap; color: var(--lm-dim); }
/* a scale of bins under each binned token, its bin lit */
.lm-bins {
  position: relative;
  width: 100%;
  min-width: 44px;
  height: 7px;
  background: repeating-linear-gradient(90deg, var(--lm-line) 0 1px, transparent 1px 4px);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.lm-bins::after {
  content: "";
  position: absolute;
  top: -2px;
  left: calc(6% + var(--at) * 88%);
  width: 2px;
  height: 11px;
  border-radius: 1px;
  background: var(--accent-2);
  box-shadow: 0 0 8px var(--accent-2);
}
.lm-caret { align-self: flex-start; width: 7px; height: 18px; margin-top: 5px; border-radius: 2px; background: var(--accent); animation: blink 1.1s steps(1) infinite; }
.js .lm-caret:not(.show) { visibility: hidden; }

/* SVG type */
.lm-loop { display: block; width: 100%; max-width: 580px; height: auto; overflow: visible; }
.lm text { font-family: var(--font-mono); font-size: 10.5px; fill: var(--muted); text-anchor: middle; }

/* 02: one sampling step. Head and tail violet (their own weights), loops teal (shared weights) */
.lp-arr { fill: var(--lm-dim); }
.lp-arr-t { fill: var(--accent); }
.lp-flow { fill: none; stroke: var(--lm-dim); stroke-width: 1.3; }
.lp-flow--bond { stroke: var(--accent); stroke-width: 1.6; }
.lp-read { fill: none; stroke: var(--lm-line); stroke-width: 1.1; }
.lp-hand { fill: none; stroke: var(--accent); stroke-width: 1.5; opacity: 0.85; }
.lp-x { fill: none; stroke: var(--lm-dim); stroke-width: 1; }
.lp-brace { fill: none; stroke: var(--lm-accent-line); stroke-width: 1.1; }
.lm .lp-note { font-size: 9.5px; letter-spacing: 0.06em; fill: var(--accent); }
.lm .lp-legend text { font-size: 9.5px; text-anchor: start; fill: var(--lm-dim); }
.lp-frame-r { stroke-width: 1.1; }
.lp-frame--loop .lp-frame-r { fill: var(--lm-accent-softer); stroke: var(--lm-accent-line); }
.lp-frame--ht .lp-frame-r { fill: var(--accent-2-soft); stroke: var(--lm-violet-line); }
/* the light that sweeps head → loops → tail once per cycle (opacity is animated by SMIL) */
.lp-glow { fill: var(--accent); fill-opacity: 0.2; }
.lp-frame--ht .lp-glow { fill: var(--accent-2); fill-opacity: 0.26; }
.lm .lp-frame-t { font-size: 9px; letter-spacing: 0.08em; }
.lp-cell rect { fill: var(--lm-chip); stroke: var(--lm-line); stroke-width: 1; }
.lm .lp-cell text { font-size: 8.5px; fill: var(--text-soft); }
.lp-cell--bond rect { fill: color-mix(in srgb, var(--accent) 14%, var(--bg-elev)); stroke: var(--accent); }
.lm .lp-cell--bond text { fill: var(--accent); }
/* each loop's bond estimate on a schematic Zn-carboxylate fragment */
.motif-tile { fill: var(--lm-chip); stroke: var(--border-strong); stroke-width: 1; }
.motif-bond { stroke: var(--muted); stroke-width: 1.3; stroke-linecap: round; }
.motif-wrong { stroke: var(--lm-fail); stroke-width: 1.2; stroke-dasharray: 2 1.8; stroke-linecap: round; }
.motif-hl { stroke: var(--accent); stroke-width: 6; stroke-linecap: round; }
.motif-atom { stroke: var(--bg-elev); stroke-width: 0.8; }
.motif-atom--c { fill: var(--muted); }
.motif-atom--o { fill: var(--lm-o); }
.motif-atom--m { fill: var(--accent-2); }


/* ---------- Experience ---------- */
/* Roles: an open timeline. Date column | rail with a dot per role | details */
.exp-list {
  --when: 190px;
  --rail: 56px;
  position: relative;
  list-style: none;
}
.exp-list::before {
  content: "";
  position: absolute;
  left: calc(var(--when) + var(--rail) / 2);
  top: 14px;
  bottom: 18px;
  width: 1px;
  background: linear-gradient(var(--accent), var(--accent-2) 70%, color-mix(in srgb, var(--accent-2) 10%, transparent));
  opacity: 0.6;
}
.exp {
  position: relative;
  display: grid;
  grid-template-columns: var(--when) var(--rail) minmax(0, 1fr);
  align-items: start;
}
.exp + .exp { margin-top: 44px; }
.exp-when { display: grid; justify-items: end; gap: 6px; padding-top: 2px; text-align: right; }
.exp-year { font-family: var(--font-display); font-size: 2.1rem; font-weight: 700; line-height: 1; letter-spacing: -0.04em; color: var(--muted); opacity: 0.55; }
.exp.is-now .exp-year {
  opacity: 1;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.exp-range { font-family: var(--font-mono); font-size: 0.74rem; white-space: nowrap; color: var(--muted); }
.exp.is-now .exp-range { color: var(--accent); }
.exp-dot {
  justify-self: center;
  width: 13px;
  height: 13px;
  margin-top: 9px;
  border-radius: 50%;
  border: 2px solid var(--accent-2);
  background: var(--bg);
  transition: transform 0.35s var(--ease);
}
.exp.is-now .exp-dot { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }
.exp:hover .exp-dot { transform: scale(1.25); }
.exp-main { max-width: 760px; }
.exp-role { font-family: var(--font-display); font-size: 1.4rem; font-weight: 600; line-height: 1.25; letter-spacing: -0.02em; }
.exp-org { margin-top: 4px; font-size: 0.95rem; color: var(--text-soft); }
.exp-desc { margin-top: 12px; font-size: 1rem; line-height: 1.65; color: var(--muted); }
.exp-desc em { font-style: italic; color: var(--text-soft); }

/* Talks: a pair of feature cards below the timeline */
.talks { margin-top: 88px; }
.talks-title { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; font-family: var(--font-mono); font-size: 0.78rem; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.talks-title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--border-strong), transparent); }
.talk-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.talk {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 34px;
  min-height: 236px;
  padding: 30px 32px 28px;
  overflow: hidden;
}
.talk:hover { transform: translateY(-4px); }
.talk-mark {
  position: absolute;
  top: 4px;
  right: 16px;
  padding: 0 0.08em 0 0.2em;
  font-family: var(--font-serif);
  font-size: 7.5rem;
  line-height: 1;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  opacity: 0.22;
  pointer-events: none;
  transition: opacity 0.4s;
}
.talk:hover .talk-mark { opacity: 0.4; }
.talk-kind { position: relative; display: block; margin-bottom: 14px; font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.talk-name { position: relative; max-width: 30ch; font-family: var(--font-serif); font-size: 1.72rem; font-style: italic; line-height: 1.22; color: var(--text); }
.talk-event { display: flex; align-items: flex-start; gap: 10px; line-height: 1.5; font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.04em; color: var(--accent); }
.talk + .talk .talk-event { color: var(--accent-2); }
.talk-event svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 2px; }
/* the event link covers the whole card, so anywhere on it opens the event page */
.talk-event::after { content: ""; position: absolute; inset: 0; z-index: 2; border-radius: inherit; }
.talk-event span { text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; transition: text-decoration-color 0.3s; }
.talk:hover .talk-event span { text-decoration-color: currentColor; }
.talk-event .talk-go { width: 13px; height: 13px; margin-top: 3px; opacity: 0.55; transition: transform 0.3s var(--ease), opacity 0.3s; }
.talk:hover .talk-go { opacity: 1; transform: translate(2px, -2px); }

/* ---------- Publications ---------- */
.pub-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.filters {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 5px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.filter-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 999px;
  background: transparent;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--muted);
  transition: background 0.25s, color 0.25s;
}
.filter-btn:hover { color: var(--text); }
.filter-btn[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.filter-count { margin-left: 6px; font-size: 0.8em; opacity: 0.6; }

.pub-sources { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--muted); }
.pub-sources a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-soft);
  font-weight: 500;
  transition: border-color 0.25s, color 0.25s;
}
.pub-sources a:hover { border-color: var(--accent); color: var(--accent); }
.pub-sources svg { width: 14px; height: 14px; }

/* One panel, hairline-separated entries */
.pub-list {
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.pub {
  position: relative;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 28px;
  padding: 28px 34px;
  border-top: 1px solid var(--border);
  transition: background 0.35s;
}
.pub:nth-child(1 of :not(.is-hidden)) { border-top-color: transparent; }
.pub::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--gradient);
  transform: scaleY(0);
  transform-origin: 50% 0;
  transition: transform 0.45s var(--ease);
}
.pub:hover { background: color-mix(in srgb, var(--surface-strong) 45%, transparent); }
.pub:hover::before { transform: none; }
.pub.is-hidden { display: none; }

.pub-year {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--muted);
}
.pub-index { display: block; margin-top: 4px; font-family: var(--font-mono); font-size: 0.75rem; font-weight: 400; letter-spacing: 0; color: var(--muted); opacity: 0.7; }

.pub-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.pub-title { font-family: var(--font-display); font-size: 1.18rem; font-weight: 600; line-height: 1.35; letter-spacing: -0.01em; }
.pub-title a {
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 0 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size 0.4s var(--ease), color 0.25s;
}
.pub-title a:hover { background-size: 100% 1px; color: var(--accent); }
.pub-plain {
  margin-top: 8px;
  max-width: 72ch;
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-style: italic;
  line-height: 1.4;
  color: var(--text-soft);
}
.pub-authors { margin-top: 12px; font-size: 0.9rem; color: var(--muted); }
.pub-authors .me { color: var(--text); font-weight: 600; text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.pub-venue { margin-top: 2px; font-size: 0.9rem; color: var(--text-soft); }
.pub-venue em { font-style: italic; font-weight: 500; }

.pub-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.pub-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-soft);
  transition: border-color 0.25s, color 0.25s, background 0.25s;
}
.pub-link svg { width: 13px; height: 13px; }
.pub-link:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.pub-link.copied { border-color: var(--accent); color: var(--accent); }

/* ---------- Footer ---------- */
.site-footer {
  padding: 32px 0 40px;
  border-top: 1px solid var(--border);
  font-size: 0.86rem;
  color: var(--muted);
}
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.back-top { display: inline-flex; align-items: center; gap: 6px; transition: color 0.25s; }
.back-top:hover { color: var(--accent); }
.back-top svg { width: 16px; height: 16px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 90;
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 0.9rem;
  font-weight: 500;
  transform: translate(-50%, 140%);
  opacity: 0;
  transition: transform 0.4s var(--ease), opacity 0.4s;
  pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- Reveal animation ---------- */
/* Hidden only when JS is running; uses an animation (not a transition) so it
   never fights with each component's own hover transitions. */
.js .reveal { opacity: 0; }
.js .reveal.in {
  opacity: 1;
  animation: reveal 0.9s var(--ease) backwards;
  animation-delay: var(--reveal-delay, 0s);
}
@keyframes reveal { from { opacity: 0; transform: translateY(24px); } }
.reveal-delay-1 { --reveal-delay: 0.08s; }
.reveal-delay-2 { --reveal-delay: 0.16s; }
.reveal-delay-3 { --reveal-delay: 0.24s; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .hero-inner { grid-template-columns: minmax(0, 1fr); }
  /* The liquid form becomes a soft backdrop behind the intro */
  .hero-figure {
    position: absolute;
    z-index: -1;
    top: calc(var(--nav-h) - 30px);
    right: -20vw;
    width: min(66vw, 560px);
    pointer-events: none;
  }
  .hero-figure #hero-canvas,
  .hero-figure.no-webgl::after { opacity: 0.62; }
  [data-theme="light"] .hero-figure #hero-canvas,
  [data-theme="light"] .hero-figure.no-webgl::after { opacity: 0.5; }
  .hero-figure::before { display: none; }

  .about-grid { grid-template-columns: 1fr; }
  .talk-grid { grid-template-columns: 1fr; }
  .project-feature { grid-template-columns: 1fr; }
  .project-feature .project-visual { order: -1; min-height: 470px; border: 0; border-bottom: 1px solid var(--border); }
  .project-feature .visual-loop,
  .project-feature .visual-app { min-height: 0; }
}

@media (max-width: 860px) {
  .menu-toggle { display: inline-grid; }
  .nav-glider { display: none; }
  /* Drop-down panel under the bar; solid so the hero never shows through */
  .nav-links {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 10px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-strong);
    background: var(--bg-elev);
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.98);
    transition: opacity 0.3s var(--ease), transform 0.3s var(--ease), visibility 0.3s;
  }
  .menu-open .nav-links { opacity: 1; visibility: visible; transform: none; }
  .nav-links a { padding: 14px 16px; border-radius: 12px; font-size: 1.05rem; }
  .nav-links a.active { background: var(--surface); }
  .menu-open .site-header .nav { background: color-mix(in srgb, var(--bg) 80%, transparent); }
  .section { padding: 88px 0; }
}

@media (max-width: 640px) {
  /* The location drops onto its own line under the icons */
  .hero-loc { flex-basis: 100%; margin: 6px 0 0; padding-left: 0; border-left: 0; }
  .hero { padding-top: calc(var(--nav-h) + 28px); }
  .hero-figure { right: -16vw; width: 84vw; }
  .hero-cta .btn { flex: 1 1 auto; }
  .section-head { margin-bottom: 40px; }
  .focus-grid { grid-template-columns: 1fr; }
  .project-body,
  .project-feature .project-body { padding: 24px; }
  .project-feature .project-visual { min-height: 290px; }
  .project-feature .visual-loop,
  .project-feature .visual-app { min-height: 0; }
  .visual-loop { padding: 14px; }
  .lm-step { padding: 14px 12px; }
  .lm-label em { display: none; }
  .lm { grid-template-rows: auto auto; height: auto; }
  .lm-row { gap: 10px 5px; }
  .lm-chips { gap: 2px; }
  .lm-tok { height: 24px; padding: 0 5px; font-size: 10.5px; line-height: 22px; }
  .lm-tok--ctl { font-size: 8.5px; letter-spacing: 0.06em; }
  .project-features { grid-template-columns: 1fr; }
  .project-visual { height: 230px; }
  /* QUASAR mock: phones get the app's narrow layout (no rail, names only) */
  .qa { padding: 8px; gap: 0; }
  .qa-rail { display: none; }
  .qa-agent { justify-content: center; gap: 6px; padding: 8px 6px; }
  .qa-face > span { width: 22px; height: 22px; border-radius: 8px; }
  .qa-face { border-radius: 9px; }
  .qa-who small { display: none; }
  .qa-who b { font-size: 11px; }
  .qa-row, .qa-task-head { padding-inline: 10px; gap: 8px; }
  .qa-status-text, .qa-task-title, .qa-text { font-size: 12px; }
  .qa-banner span { display: none; }
  .qa-hello { font-size: 18px; }
  .qa-tpls { gap: 6px; }
  .qa-tpl { padding: 8px; }
  .qa-tpl b { font-size: 10.5px; }
  .visual-app { padding: 26px 16px 0; }
  .app-body { padding: 14px 14px 38px; gap: 14px; }
  .project-actions .btn { flex: 1 1 auto; }
  .filters { display: grid; grid-template-columns: 1fr 1fr; width: 100%; border-radius: 18px; }
  .filter-btn { padding: 9px 12px; border-radius: 13px; }
  .pub { grid-template-columns: 1fr; gap: 8px; padding: 24px 20px; }
  /* phones: rail on the left, dates above each role */
  .exp-list { --rail: 30px; }
  .exp-list::before { left: 15px; }
  .exp { grid-template-columns: var(--rail) minmax(0, 1fr); }
  .exp-when { grid-column: 2; grid-row: 1; display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; text-align: left; }
  .exp-year { font-size: 1.5rem; }
  .exp-dot { grid-column: 1; grid-row: 1; margin-top: 6px; }
  .exp-main { grid-column: 2; }
  .exp + .exp { margin-top: 36px; }
  .exp-role { font-size: 1.22rem; }
  .talks { margin-top: 64px; }
  .talk { min-height: 0; padding: 24px 22px; }
  .talk-name { font-size: 1.45rem; }
  .pub-year { display: flex; align-items: baseline; gap: 10px; font-size: 1.05rem; }
  .pub-index { margin-top: 0; }
  .pub-plain { font-size: 1.12rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .js .reveal { opacity: 1; }
  .js .lm-tok,
  .js .result { opacity: 1; transform: none; }
}

@media print {
  .site-header, .hero-figure, .hero-aurora, .hero-cta, .toast, .pub-toolbar .filters { display: none !important; }
  body::before, body::after { display: none; }
  .js .reveal { opacity: 1; animation: none; }
  .section { padding: 40px 0; }
}
