:root {
  --ink: #111;
  --ink-soft: #333;
  --muted: #6b6b6b;
  --line: #e5e5e5;
  --accent: #0a4d8c;
  --accent-soft: #e8f0f8;
  --bg: #ffffff;
  --max: 880px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease;
}
a:hover { border-bottom-color: var(--accent); }

/* ---------- Top nav ---------- */
nav.topbar {
  position: sticky;
  top: 0;
  background: rgba(255,255,255,0.92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
  z-index: 100;
}
nav.topbar .inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}
nav.topbar .brand {
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
}
nav.topbar .brand a { color: var(--ink); border: none; }
nav.topbar ul {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  gap: 22px;
}
nav.topbar ul a {
  color: var(--ink-soft);
  border: none;
}
nav.topbar ul a:hover { color: var(--accent); }
nav.topbar ul a.active { color: var(--ink); border-bottom: 1px solid var(--line); padding-bottom: 2px; }

/* Hamburger toggle (hidden visually but accessible; the <label> triggers it) */
nav.topbar .nav-toggle {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
nav.topbar .nav-burger {
  display: none;
  cursor: pointer;
  width: 24px;
  height: 18px;
  position: relative;
  user-select: none;
}
nav.topbar .nav-burger span {
  display: block;
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--ink);
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease, top 0.2s ease;
}
nav.topbar .nav-burger span:nth-child(1) { top: 2px; }
nav.topbar .nav-burger span:nth-child(2) { top: 8px; }
nav.topbar .nav-burger span:nth-child(3) { top: 14px; }

/* ---------- Layout ---------- */
main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
}
section {
  padding: 56px 0 24px;
  border-bottom: 1px solid var(--line);
}
section:last-of-type { border-bottom: none; }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.01em; }
h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0 0 24px;
  font-weight: 600;
}
p { margin: 0 0 14px; color: var(--ink-soft); }

/* Page header (for sub-pages: title + lead paragraph) */
.page-header {
  padding: 72px 0 40px;
  border-bottom: 1px solid var(--line);
}
.page-header h1 {
  font-size: 38px;
  line-height: 1.15;
  margin: 0 0 14px;
  letter-spacing: -0.02em;
}
.page-header .lead {
  font-size: 16px;
  line-height: 1.7;
  color: var(--muted);
  max-width: 640px;
  margin: 0;
}

/* See-more link at bottom of a teaser section */
.see-more {
  margin-top: 18px;
  font-size: 13px;
}
.see-more a {
  color: var(--accent);
  border-bottom: 1px solid transparent;
}
.see-more a:hover { border-bottom-color: var(--accent); }

/* ---------- Home page: single fixed viewport, no scroll, no footer ---------- */
body.home {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
body.home .home-main {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  padding: 0 0 8vh 0;
  position: relative;
  z-index: 2;
  max-width: none;   /* override global `main { max-width: var(--max) }` */
  margin: 0;         /* override global `margin: 0 auto` centering */
  width: 100%;
}
body.home .hero {
  /* Left edge aligns with the nav's brand text, using the same centering math */
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
  border-bottom: none;
}
body.home .hero-content {
  /* Content fills the left half of the 880px container; right half stays empty for the bg animation */
  width: 100%;
  max-width: 560px;
  margin: 0;
}
body.home nav.topbar { position: sticky; z-index: 10; }

/* ---------- Floating background animation ---------- */
.bg-float {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

/* Two extra radial halos drifting around the viewport */
.bg-halo {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(20px);
  will-change: transform, opacity;
}
.bg-halo-1 {
  width: clamp(320px, 32vw, 520px);
  height: clamp(320px, 32vw, 520px);
  top: 4%;
  right: 6%;
  background: radial-gradient(circle at center,
    rgba(138, 163, 194, 0.13) 0%,
    rgba(138, 163, 194, 0.06) 45%,
    rgba(138, 163, 194, 0) 75%);
  animation: halo-drift-1 26s ease-in-out infinite;
}
.bg-halo-2 {
  width: clamp(280px, 28vw, 460px);
  height: clamp(280px, 28vw, 460px);
  bottom: 4%;
  right: 18%;
  background: radial-gradient(circle at center,
    rgba(138, 163, 194, 0.10) 0%,
    rgba(138, 163, 194, 0.045) 45%,
    rgba(138, 163, 194, 0) 75%);
  animation: halo-drift-2 32s ease-in-out infinite;
}
@keyframes halo-drift-1 {
  0%, 100% { transform: translate(0, 0) scale(1);    opacity: 0.9; }
  33%      { transform: translate(60px, -40px) scale(1.1); opacity: 0.7; }
  66%      { transform: translate(-50px, 50px) scale(0.95); opacity: 1; }
}
@keyframes halo-drift-2 {
  0%, 100% { transform: translate(0, 0) scale(1);    opacity: 0.85; }
  40%      { transform: translate(-70px, -30px) scale(0.9); opacity: 1; }
  75%      { transform: translate(40px, 60px) scale(1.12); opacity: 0.7; }
}

/* Giant R/E/A/L drifting letters */
.bg-letter {
  position: absolute;
  font-family: "Rubik", -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 800;
  color: var(--accent);
  opacity: 0.06;
  line-height: 1;
  user-select: none;
  letter-spacing: -0.04em;
  will-change: transform;
}
/* Four letters clustered tighter around the orbit center (~72% x, 50% y).
   Smaller gaps between letters — they should feel like one group, not spread to corners. */
.bg-letter-r {
  font-size: 210px;
  top: 13%;
  right: 32%;                 /* top-left of orbit */
  animation: drift-r 22s ease-in-out infinite;
}
.bg-letter-e {
  font-size: 165px;
  top: 17%;
  right: 7%;                  /* top-right of orbit */
  animation: drift-e 26s ease-in-out infinite;
}
.bg-letter-a {
  font-size: 190px;
  bottom: 13%;
  right: 6%;                  /* bottom-right of orbit */
  animation: drift-a 30s ease-in-out infinite;
}
.bg-letter-l {
  font-size: 155px;
  bottom: 17%;
  right: 28%;                 /* bottom-left of orbit */
  animation: drift-l 24s ease-in-out infinite;
}

/* Larger drift amplitude — 40-50px translation, ±6deg rotation */
@keyframes drift-r {
  0%, 100% { transform: rotate(-12deg) translate(0, 0); }
  25%      { transform: rotate(-18deg) translate(-42px, 28px); }
  50%      { transform: rotate(-6deg)  translate(32px, 44px); }
  75%      { transform: rotate(-15deg) translate(-26px, -34px); }
}
@keyframes drift-e {
  0%, 100% { transform: rotate(8deg) translate(0, 0); }
  33%      { transform: rotate(14deg) translate(40px, -38px); }
  66%      { transform: rotate(3deg)  translate(-36px, 30px); }
}
@keyframes drift-a {
  0%, 100% { transform: rotate(-14deg) translate(0, 0); }
  30%      { transform: rotate(-20deg) translate(-34px, -42px); }
  60%      { transform: rotate(-8deg)  translate(44px, 28px); }
}
@keyframes drift-l {
  0%, 100% { transform: rotate(6deg) translate(0, 0); }
  40%      { transform: rotate(12deg) translate(38px, 44px); }
  80%      { transform: rotate(1deg)  translate(-30px, -32px); }
}

/* Soft gradient halos — sized to overlap the four floating letters */
.bg-orbit {
  position: absolute;
  width: clamp(440px, 42vw, 720px);
  height: clamp(440px, 42vw, 720px);
  top: 50%;
  /* Center the halo at ~75% of viewport width (where the letters cluster) */
  left: 75%;
  transform: translate(-50%, -50%);
  z-index: 2;           /* robot + scene on top of bg-halo and bg-particles */
}
.bg-halo   { z-index: 0; }
.bg-particles { z-index: 1; }
.bg-orbit .orbit-halo {
  transform-box: fill-box;
  transform-origin: center;
}
.bg-orbit .orbit-halo-outer {
  animation: halo-pulse 10s ease-in-out infinite;
}
.bg-orbit .orbit-halo-inner {
  animation: halo-pulse 7s ease-in-out infinite;
  animation-delay: -2s;
}
@keyframes halo-pulse {
  0%, 100% { transform: scale(1);    opacity: 1; }
  50%      { transform: scale(1.08); opacity: 0.85; }
}

/* Scene wrapper: scale to fit inside the halo.
   Scene spans x=148 (robot left) to x=540 (envs right), center ~344. Shift left so scene center aligns with viewBox center. */
.bg-orbit .peek-scene {
  transform: translateX(-44px) scale(0.6);
  transform-origin: 300px 300px;
}

.bg-orbit .peek-robot {
  opacity: 0.32;
}
.bg-orbit .peek-robot-body {
  transform-origin: 220px 294px;   /* head's bottom-center (robot shifted left) */
  animation: robot-tilt 11s ease-in-out infinite;
}
@keyframes robot-tilt {
  0%, 100%   { transform: rotate(0deg); }
  12%        { transform: rotate(-10deg); }
  26%        { transform: rotate(0deg); }
  40%        { transform: rotate(4deg); }
  55%        { transform: rotate(0deg); }
  70%        { transform: rotate(8deg); }
  85%        { transform: rotate(-3deg); }
}

/* ZJU Qiushi Eagle on the robot's head (inherits head tilt via .peek-robot-body ancestor) */
.bg-orbit .zju-eagle path {
  fill: #004EA2;
}

.bg-orbit .robot-head,
.bg-orbit .robot-antenna,
.bg-orbit .robot-antenna-tip {
  fill: var(--accent);
  stroke: none;
}

.bg-orbit .robot-antenna-tip {
  animation: robot-antenna-blink 1.4s ease-in-out infinite;
}
.bg-orbit .peek-robot-body > .robot-antenna-tip:nth-of-type(2) { animation-delay: 0.4s; }
@keyframes robot-antenna-blink {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}

/* Mouth: small white pill punched into the silhouette */
.bg-orbit .robot-mouth {
  fill: none;
  stroke: #ffffff;
  stroke-width: 4;
  stroke-linecap: round;
}

/* Eyes: white ellipse punched into the silhouette, filled pupil on top */
.bg-orbit .robot-eye {
  fill: #ffffff;
  stroke: none;
  transform-box: fill-box;
  transform-origin: center;
  animation: robot-blink 4s ease-in-out infinite;
}
.bg-orbit .robot-pupil {
  fill: var(--accent);
  stroke: none;
  transform-box: fill-box;
  transform-origin: center;
  animation: robot-blink 4s ease-in-out infinite;
}
@keyframes robot-blink {
  0%, 92%, 100% { transform: scaleY(1); }
  95%, 97%      { transform: scaleY(0.15); }
}

/* ---- Shared env styles ---- */
.bg-orbit .peek-env {
  opacity: 0.42;
  animation: env-pulse 3s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
.bg-orbit .peek-env-code { animation-delay: -1s; }
.bg-orbit .scene-shrink {
  transform: scale(0.88);
  transform-origin: 475px 460px;   /* scene center in viewBox units */
}
.bg-orbit .peek-env-gui  { animation-delay: -2s; }
.bg-orbit .env-frame {
  fill: var(--accent);
  fill-opacity: 0.1;
  stroke: none;
}
/* Window title bar (code + GUI share this look) */
.bg-orbit .env-titlebar {
  fill: var(--accent);
  fill-opacity: 0.25;
}
.bg-orbit .env-titlebar-fill {
  fill: var(--accent);
  fill-opacity: 0.25;
}
.bg-orbit .env-tl-r { fill: #e06c6c; }
.bg-orbit .env-tl-y { fill: #e0b36c; }
.bg-orbit .env-tl-g { fill: #6cc08a; }

/* Code lines */
.bg-orbit .env-code-line {
  fill: var(--accent);
  fill-opacity: 0.55;
}
.bg-orbit .env-cursor {
  fill: var(--accent);
  animation: env-cursor-blink 1s step-end infinite;
}
@keyframes env-cursor-blink {
  0%, 50%   { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* Phone env */
.bg-orbit .phone-body {
  fill: var(--accent);
  fill-opacity: 0.85;
}
.bg-orbit .phone-screen {
  fill: #f9fafb;
}
.bg-orbit .phone-notch {
  fill: var(--accent);
}
.bg-orbit .phone-home {
  fill: var(--accent);
  fill-opacity: 0.6;
}
.bg-orbit .phone-app {
  fill: var(--accent);
  fill-opacity: 0.35;
}
.bg-orbit .phone-app-active {
  fill-opacity: 0.85;
  animation: phone-app-pulse 2.4s ease-in-out infinite;
}
.bg-orbit .phone-bar {
  fill: var(--accent);
  fill-opacity: 0.55;
}
.bg-orbit .phone-bar-dim { fill-opacity: 0.28; }
.bg-orbit .phone-tap {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  transform-box: fill-box;
  transform-origin: center;
  animation: phone-tap-ring 2.4s ease-in-out infinite;
}
@keyframes phone-app-pulse {
  0%, 100% { fill-opacity: 0.85; }
  50%      { fill-opacity: 0.5; }
}
@keyframes phone-tap-ring {
  0%       { transform: scale(0.3); opacity: 0.9; }
  60%      { transform: scale(1.8); opacity: 0; }
  100%     { transform: scale(1.8); opacity: 0; }
}

/* Finger pointer tapping the active app */
.bg-orbit .phone-pointer {
  fill: var(--accent);
  animation: phone-pointer-tap 2.4s ease-in-out infinite;
}
@keyframes phone-pointer-tap {
  0%, 100%  { transform: translate(497px, 269px); }
  45%       { transform: translate(493px, 263px); }   /* press down toward app */
  55%       { transform: translate(493px, 263px); }
}

/* 3D scene env — isometric walls + floor + cube + bed + agent */
.bg-orbit .scene-wall {
  fill: var(--accent);
}
.bg-orbit .scene-wall-left  { fill-opacity: 0.18; }
.bg-orbit .scene-wall-right { fill-opacity: 0.12; }

.bg-orbit .scene-floor {
  fill: var(--accent);
  fill-opacity: 0.22;
}
.bg-orbit .scene-floor-grid line {
  stroke: var(--accent);
  stroke-width: 1;
  stroke-dasharray: 2 3;
  opacity: 0.35;
}

/* Cube (object / target) — iso shading: top bright, right mid, left dim */
.bg-orbit .scene-cube-top   { fill: var(--accent); fill-opacity: 0.9; }
.bg-orbit .scene-cube-left  { fill: var(--accent); fill-opacity: 0.55; }
.bg-orbit .scene-cube-right { fill: var(--accent); fill-opacity: 0.75; }

/* Bed */
.bg-orbit .bed-top       { fill: var(--accent); fill-opacity: 0.55; }
.bg-orbit .bed-side-l    { fill: var(--accent); fill-opacity: 0.35; }
.bg-orbit .bed-side-r    { fill: var(--accent); fill-opacity: 0.48; }
.bg-orbit .bed-headboard { fill: var(--accent); fill-opacity: 0.85; }

/* Agent dot */
.bg-orbit .scene-agent-dot  { fill: #ffffff; }
.bg-orbit .scene-agent-halo {
  fill: var(--accent);
  fill-opacity: 0.4;
  transform-box: fill-box;
  transform-origin: center;
  animation: scene-agent-pulse 2.2s ease-in-out infinite;
}
@keyframes scene-agent-pulse {
  0%, 100% { transform: scale(1);   opacity: 0.4; }
  50%      { transform: scale(1.5); opacity: 0.1; }
}

/* Wall clock: white face, light-blue ring, hour + minute hands */
.bg-orbit .wall-clock { opacity: 1 !important; }
/* Clock colors are set inline on the SVG elements (see index.html) so they can be tuned per-file without CSS conflict */
/* Hour and minute hands stay static (point to 12 o'clock direction). */
.bg-orbit .clock-hour,
.bg-orbit .clock-minute {
  animation: none;
}
/* Second hand uses SVG-native <animateTransform> inside the element — no CSS animation needed here. */
.bg-orbit .clock-center { fill: var(--accent); }
@keyframes clock-hour {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
@keyframes clock-minute {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes env-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.03); }
}
@keyframes env-goal-pulse {
  0%, 100% { transform: scale(1);   opacity: 0.35; }
  50%      { transform: scale(1.4); opacity: 0.1; }
}

/* ---- Flow streams: three paths (code/GUI/map) with bidirectional particles ---- */
.bg-orbit .flow-path {
  stroke: var(--accent);
  stroke-width: 1.2;
  stroke-dasharray: 3 4;
  opacity: 0.22;
  fill: none;
}
.bg-orbit .flow-dot {
  fill: var(--accent);
  opacity: 0.7;
}

/* Code stream: robot → code (one-way) */
.bg-orbit .flow-code-out-1 {
  offset-path: path("M 292 270 C 340 240, 370 180, 410 140");
  animation: flow-fwd 4.5s linear infinite;
}

/* Phone stream: robot → phone (one-way) */
.bg-orbit .flow-gui-out-1 {
  offset-path: path("M 292 294 C 350 294, 380 294, 438 294");
  animation: flow-fwd 4.5s linear infinite;
  animation-delay: -1.5s;
}

/* 3D scene stream: robot → scene (one-way) */
.bg-orbit .flow-map-out-1 {
  offset-path: path("M 292 318 C 340 350, 370 410, 410 450");
  animation: flow-fwd 4.5s linear infinite;
  animation-delay: -3s;
}

@keyframes flow-fwd {
  0%   { offset-distance: 0%;   opacity: 0; }
  12%  { opacity: 0.7; }
  88%  { opacity: 0.7; }
  100% { offset-distance: 100%; opacity: 0; }
}

/* Small geometric particles */
.bg-particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.bg-particles .p {
  fill: var(--accent);
  stroke: var(--accent);
  stroke-width: 1;
  opacity: 0.22;
  transform-box: fill-box;
  transform-origin: center;
  will-change: transform;
}
.bg-particles line.p { fill: none; stroke: var(--accent); stroke-width: 1.5; opacity: 0.18; }
.bg-particles polygon.p { fill: none; stroke: var(--accent); stroke-width: 1.2; opacity: 0.2; }

.bg-particles .p-1 { animation: p-float-1 14s ease-in-out infinite; }
.bg-particles .p-2 { animation: p-float-2 18s ease-in-out infinite; }
.bg-particles .p-3 { animation: p-float-3 16s ease-in-out infinite; }
.bg-particles .p-4 { animation: p-float-4 20s ease-in-out infinite; }
.bg-particles .p-5 { animation: p-float-1 17s ease-in-out infinite reverse; }
.bg-particles .p-6 { animation: p-float-2 13s ease-in-out infinite reverse; }
.bg-particles .p-7 { animation: p-float-3 15s ease-in-out infinite reverse; }
.bg-particles .p-8 { animation: p-float-4 19s ease-in-out infinite; }

@keyframes p-float-1 {
  0%, 100% { transform: translate(0, 0); opacity: 0.22; }
  50%      { transform: translate(40px, -30px); opacity: 0.35; }
}
@keyframes p-float-2 {
  0%, 100% { transform: translate(0, 0) rotate(0deg); opacity: 0.22; }
  50%      { transform: translate(-50px, 28px) rotate(180deg); opacity: 0.3; }
}
@keyframes p-float-3 {
  0%, 100% { transform: translate(0, 0); opacity: 0.22; }
  50%      { transform: translate(30px, 40px); opacity: 0.15; }
}
@keyframes p-float-4 {
  0%, 100% { transform: translate(0, 0) rotate(0deg); opacity: 0.22; }
  50%      { transform: translate(-35px, -40px) rotate(-180deg); opacity: 0.32; }
}

@media (prefers-reduced-motion: reduce) {
  .bg-letter, .bg-particles .p, .bg-halo,
  .bg-orbit .orbit-halo,
  .bg-orbit .peek-robot-body, .bg-orbit .robot-eye,
  .bg-orbit .robot-pupil, .bg-orbit .robot-antenna-tip,
  .bg-orbit .peek-env, .bg-orbit .flow-dot,
  .bg-orbit .env-cursor,
  .bg-orbit .phone-app-active, .bg-orbit .phone-tap,
  .bg-orbit .scene-agent-halo,
  .bg-orbit .clock-hour, .bg-orbit .clock-minute, .bg-orbit .clock-second { animation: none !important; }
}

/* ---------- Hero (stacked R·E·A·L lines, full-width single column) ---------- */
.hero {
  padding: 72px 0 64px;
  border-bottom: 1px solid var(--line);
}
.hero-content {
  max-width: 640px;
}
.hero .headline-stack {
  font-family: "Rubik", -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
  font-size: 44px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 32px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hero .headline-stack .line {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}
.hero .headline-stack .badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1em;
  height: 1.1em;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  border-radius: 6px;
  font-size: 0.8em;
  line-height: 1;
  flex-shrink: 0;
}
.hero .headline-stack .sep {
  color: var(--line);
  font-weight: 500;
  font-size: 0.65em;
}
.hero .headline-stack .word { color: var(--ink); }
.hero .headline-stack .ai {
  color: var(--accent);
  font-weight: 800;
  margin-left: 6px;
}
.hero .mission {
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink-soft);
  margin: 0 0 28px;
  max-width: 560px;
}
.hero .social {
  display: flex;
  gap: 10px;
  font-size: 13px;
  flex-wrap: wrap;
}
.hero .social a {
  color: var(--ink-soft);
  border: 1px solid var(--line);
  padding: 6px 14px;
  border-radius: 999px;
  transition: all 0.15s ease;
}
.hero .social a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- About ---------- */
.about p {
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink-soft);
}

/* ---------- Research pillars ---------- */
.pillars {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px 36px;
}
.pillar {
  padding: 0;
}
.pillar .letter-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 8px;
  border-radius: 3px;
  margin-bottom: 10px;
}
.pillar h3 {
  font-size: 17px;
  margin: 0 0 8px;
  color: var(--ink);
}
.pillar p {
  font-size: 14px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

/* Expanded pillar block (research.html) */
.pillar-block {
  padding: 32px 0;
  border-top: 1px solid var(--line);
}
.pillar-block:first-of-type { border-top: none; padding-top: 8px; }
.pillar-block .letter-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 8px;
  border-radius: 3px;
  margin-bottom: 12px;
}
.pillar-block h3 {
  font-size: 22px;
  margin: 0 0 12px;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.pillar-block p {
  font-size: 15px;
  line-height: 1.75;
  color: var(--ink-soft);
  margin: 0 0 12px;
}
.pillar-block ul {
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.75;
}
.pillar-block ul li { margin-bottom: 4px; }

/* ---------- News ---------- */
.news-list {
  list-style: none;
  margin: 0; padding: 0;
}
.news-list li {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 20px;
  padding: 10px 0;
  font-size: 14px;
  border-top: 1px solid var(--line);
}
.news-list li:first-child { border-top: none; }
.news-list .date {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  padding-top: 1px;
}
.news-list .content { color: var(--ink-soft); }
.news-list .tag {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 3px;
  margin-right: 6px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

/* ---------- Publications ---------- */
.year-group { margin-bottom: 28px; }
.year-group .year {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 14px;
  letter-spacing: 0.05em;
}
.pub {
  padding: 12px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.6;
}
.pub:first-child { border-top: none; }
/* Pubs with a thumbnail: flex row, thumb on the left, content vertically centered */
.pub-with-thumb {
  display: flex;
  align-items: center;
  gap: 20px;
}
.pub-with-thumb .thumb {
  flex: 0 0 auto;
  width: 180px;
  height: 120px;
  object-fit: cover;
  border-radius: 4px;
  background: #f2f2f2;
  border: 1px solid var(--line);
}
.pub-with-thumb .pub-body {
  flex: 1 1 auto;
  min-width: 0;    /* allow long author strings to wrap */
}
/* Thumb-button icon (inside .title; shown only on mobile) */
.pub-with-thumb .thumb-btn {
  display: none;
  background: var(--accent-soft);
  color: var(--accent);
  border: none;
  border-radius: 3px;
  padding: 2px 4px;
  cursor: pointer;
  vertical-align: -2px;
  margin-right: 6px;
  transition: background 0.15s ease;
}
.pub-with-thumb .thumb-btn:hover { background: #d8e6f3; }
.pub-with-thumb .thumb-btn svg { display: block; }

/* Lightbox: full-screen overlay showing the clicked thumbnail at large size */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 32, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 32px;
  cursor: zoom-out;
}
.lightbox.is-open { display: flex; }
.lightbox-img {
  max-width: 95vw;
  max-height: 90vh;
  width: auto;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  cursor: default;
}
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease;
}
.lightbox-close:hover { background: rgba(255,255,255,0.28); }
.pub .title {
  color: var(--ink);
  font-weight: 500;
  margin-bottom: 3px;
}
.pub .authors {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 3px;
}
.pub .venue {
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
}
.pub .venue .badge {
  font-style: normal;
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  background: var(--accent);
  color: #fff;
  border-radius: 2px;
  margin-left: 6px;
  letter-spacing: 0.05em;
  vertical-align: 1px;
}
.pub .links { font-size: 12px; margin-top: 3px; }
.pub .links a { margin-right: 12px; }

/* ---------- Lab photo slideshow (fade, aligned with page content) ---------- */
.lab-slideshow {
  position: relative;
  width: calc(100% - 48px);
  max-width: var(--max);    /* match nav and main content container (880px) */
  margin: 32px auto 0;
  aspect-ratio: 16 / 8;
  overflow: hidden;
  background: #f2f2f2;
  border-radius: 4px;
}
.lab-slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 16px 20px;
  color: rgba(255,255,255,0.75);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  opacity: 0;
  transition: opacity 0.9s ease-in-out;
  background-size: cover;
  background-position: center;
}
.lab-slide.is-active { opacity: 1; }
/* Placeholder gradients — replace each rule's `background` with `background-image: url(…)` for real photos */
.lab-slide-1 { background: linear-gradient(135deg, #4a6d92 0%, #7a9ec0 60%, #9fbedb 100%); }
.lab-slide-2 { background: linear-gradient(135deg, #7a6a50 0%, #a89272 60%, #c9b99a 100%); }
.lab-slide-3 { background: linear-gradient(135deg, #4d6d4f 0%, #7ca37f 60%, #9cbba3 100%); }
.lab-slide-4 { background: linear-gradient(135deg, #5e4a6c 0%, #8c71a1 60%, #b29ac4 100%); }
.lab-slide-5 { background: linear-gradient(135deg, #4a6770 0%, #6d8e97 60%, #8fb0b8 100%); }
.lab-slide-6 { background: linear-gradient(135deg, #7a5a4e 0%, #a88271 60%, #c2a595 100%); }

@media (prefers-reduced-motion: reduce) {
  .lab-slide { transition: none; }
}

/* ---------- People ---------- */
.people-group { margin-bottom: 24px; }
.people-group .role {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 14px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.people-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px 16px;
}
.person {
  text-align: center;
}
.person .avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #f2f2f2;
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #bbb;
  font-size: 22px;
  font-weight: 600;
  overflow: hidden;
}
.person .name {
  font-size: 13px;
  color: var(--ink);
  font-weight: 500;
  margin-bottom: 2px;
}
.person .sub {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}
.pi-card {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 22px;
  align-items: center;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-bottom: 28px;
}
.pi-card .avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: #f2f2f2;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #bbb;
  font-size: 28px;
  font-weight: 600;
}
.pi-card .info .name {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}
.pi-card .info .role {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: none;
  letter-spacing: normal;
}
.pi-card .info .meta {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
}
.pi-card .info .meta a { color: var(--accent); }

/* ---------- Join Us ---------- */
.join p {
  font-size: 15px;
  line-height: 1.7;
}
.join .callout {
  margin-top: 16px;
  padding: 16px 18px;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 4px 4px 0;
  font-size: 14px;
  color: var(--ink-soft);
}
.join .callout strong { color: var(--accent); }

/* ---------- Footer ---------- */
footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px 24px 48px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  border-top: 1px solid var(--line);
  margin-top: 24px;
}
footer a { color: var(--muted); }
footer a:hover { color: var(--accent); }

/* ---------- Mobile ---------- */
/* ---------- Tablet (≤ 860px) ---------- */
@media (max-width: 860px) {
  /* Shrink the robot/orbit scene so it doesn't dominate a narrow viewport */
  .bg-orbit {
    width: clamp(320px, 60vw, 480px);
    height: clamp(320px, 60vw, 480px);
    left: 80%;
  }
}

/* ---------- Mobile (≤ 640px) ---------- */
@media (max-width: 640px) {
  /* Nav becomes a hamburger dropdown */
  nav.topbar .inner { padding: 12px 16px; position: relative; }
  nav.topbar .brand { font-size: 14px; }
  nav.topbar .nav-burger { display: block; }
  nav.topbar ul {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    background: rgba(255,255,255,0.98);
    backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    gap: 0;
    padding: 8px 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease, padding 0.25s ease;
    padding-top: 0;
    padding-bottom: 0;
  }
  nav.topbar .nav-toggle:checked ~ ul {
    max-height: 400px;
    padding-top: 8px;
    padding-bottom: 8px;
  }
  nav.topbar ul li { width: 100%; }
  nav.topbar ul a {
    display: block;
    padding: 12px 20px;
    font-size: 14px;
    border-bottom: none;
  }
  nav.topbar ul a.active {
    color: var(--accent);
    border-bottom: none;
    padding-bottom: 12px;
  }
  /* Animate hamburger into X when menu open */
  nav.topbar .nav-toggle:checked ~ .nav-burger span:nth-child(1) { top: 8px; transform: rotate(45deg); }
  nav.topbar .nav-toggle:checked ~ .nav-burger span:nth-child(2) { opacity: 0; }
  nav.topbar .nav-toggle:checked ~ .nav-burger span:nth-child(3) { top: 8px; transform: rotate(-45deg); }

  /* Main container */
  main { padding: 0 20px; }

  /* Hero on mobile: simpler layout */
  .hero { padding: 48px 0 40px; }
  .hero .headline-stack { font-size: 26px; gap: 6px; margin-bottom: 20px; }
  .hero .headline-stack .line { gap: 10px; }
  .hero .mission { font-size: 15px; }

  /* Home page behavior on mobile: release the 100vh lock so content can scroll */
  body.home { height: auto; overflow: auto; }
  body.home .home-main {
    padding: 0 0 32px 0;
    align-items: flex-start;
    padding-top: 32px;
  }
  body.home .hero {
    padding: 0 20px;
    max-width: 100%;
    margin: 0;
  }
  body.home .hero-content { max-width: 100%; }

  /* Background animation on mobile — enlarged further; slight overflow is fine (bg-float clips it) */
  .bg-orbit {
    width: clamp(480px, 120vw, 720px);
    height: clamp(480px, 120vw, 720px);
    left: 50%;
    top: 75%;              /* place in the lower half of the viewport on mobile */
    opacity: 0.5;
  }
  .bg-letter-r, .bg-letter-e, .bg-letter-a, .bg-letter-l { font-size: 110px; }

  /* Sub-page headers */
  .page-header { padding: 40px 0 28px; }
  .page-header h1 { font-size: 26px; }
  .page-header .lead { font-size: 15px; }

  /* Research pillars */
  .pillars { grid-template-columns: 1fr; gap: 24px; }
  .pillar-block { padding: 24px 0; }
  .pillar-block h3 { font-size: 19px; }

  /* News: collapse date + content into single column */
  .news-list li { grid-template-columns: 1fr; gap: 4px; }

  /* Publications: tighten padding, allow long author strings to wrap cleanly */
  .year-group { margin-bottom: 22px; }
  .pub { padding: 10px 0; }
  .pub .title { font-size: 14px; line-height: 1.45; }
  .pub .authors { font-size: 12.5px; word-break: break-word; }
  .pub .venue { font-size: 12.5px; }
  .pub .links a { margin-right: 10px; }
  /* Mobile: hide the inline thumbnail; icon-button sits left of the TITLE only (centered vs title lines) */
  .pub-with-thumb { display: block; }
  .pub-with-thumb .thumb { display: none; }
  .pub-with-thumb .pub-body { display: block; }
  .pub-with-thumb .title {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .pub-with-thumb .thumb-btn {
    display: inline-flex;
    flex: 0 0 auto;
    padding: 8px;
    margin: 0;
    align-items: center;
    justify-content: center;
  }
  .pub-with-thumb .title-text { flex: 1 1 auto; min-width: 0; }

  /* People grid: 3 columns on phone */
  .people-grid { grid-template-columns: repeat(3, 1fr); gap: 14px 10px; }
  .person .avatar { width: 60px; height: 60px; font-size: 18px; }
  .person .name { font-size: 12px; }
  .person .sub { font-size: 10.5px; }

  /* PI card: stack vertically and center */
  .pi-card { grid-template-columns: 1fr; text-align: center; padding: 16px; }
  .pi-card .avatar { margin: 0 auto; }

  /* Join page callout wraps long URLs */
  .join .callout { padding: 14px 16px; font-size: 13.5px; word-break: break-word; }
  .join .callout a { word-break: break-all; }

  /* Footer stacks, both halves left-aligned */
  footer {
    flex-direction: column;
    padding: 24px 20px 36px;
    gap: 10px;
  }

  /* Lab slideshow: taller aspect ratio on phones so horizontal photos still read well */
  .lab-slideshow {
    margin-top: 20px;
    aspect-ratio: 4 / 3;
    border-radius: 0;
    max-width: 100%;
  }

  /* Sections narrower padding */
  section { padding: 40px 0 20px; }
}

/* ---------- Extra small (≤ 380px) ---------- */
@media (max-width: 380px) {
  .hero .headline-stack { font-size: 22px; }
  .hero .mission { font-size: 14px; }
  .people-grid { grid-template-columns: repeat(2, 1fr); }
  nav.topbar ul a { font-size: 11.5px; }
  nav.topbar ul { gap: 10px; }
}
