/* ===========================================================
   CNElab — Laboratory for Computational NeuroErgonomics
   Shared stylesheet
   Visual language inspired by UTS (uts.edu.au): bold uppercase
   headlines, eyebrow + rule section headers, strong blue accent,
   full-bleed hero, high-contrast alternating section backgrounds,
   circular accent-color arrow CTAs. Lab's own teal/purple gradient
   (from the logo) is kept as a secondary accent.
   =========================================================== */

:root {
  --color-bg: #ffffff;
  --color-surface: #ffffff;
  --color-surface-alt: #f2f4f7;
  --color-text: #0a0a0a;
  --color-text-muted: #4b5560;
  --color-border: #e2e5ea;

  --color-primary: #0f4beb;        /* UTS-style strong blue — new primary accent */
  --color-primary-dark: #0a34ad;
  --color-primary-tint: #e8eefe;

  --color-accent: #1b9e8f;         /* teal — secondary accent, from the lab logo */
  --color-accent-light: #e4f5f2;
  --color-purple: #7a2fd6;         /* purple — secondary accent, from the lab logo */

  --color-link: var(--color-primary);

  /* Fixed-value colors for solid accent-color blocks: stay constant
     across light/dark so white text on them always has enough contrast. */
  --color-block: #0f4beb;
  --color-ink: #000000;
  --color-paper: #ffffff;

  --shadow-sm: 0 1px 2px rgba(10, 15, 30, 0.06), 0 1px 1px rgba(10, 15, 30, 0.04);
  --shadow-md: 0 10px 30px rgba(10, 15, 30, 0.10);

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
    Arial, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;

  --max-width: 1160px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #06080b;
    --color-surface: #0e1117;
    --color-surface-alt: #12161d;
    --color-text: #f4f6f8;
    --color-text-muted: #a9b2bc;
    --color-border: #262b33;

    --color-primary: #5b8bff;
    --color-primary-dark: #86a8ff;
    --color-primary-tint: #131c33;

    --color-accent: #3fd6c2;
    --color-accent-light: #10302c;
    --color-purple: #b58bff;

    --color-link: var(--color-primary);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.55);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--color-link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--color-block);
  color: #fff;
  padding: 10px 16px;
  z-index: 1000;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus {
  left: 0;
}

/* ---------- Header / nav ---------- */
/* Fixed dark theme regardless of light/dark mode — matches the dark
   hero and footer so the header doesn't flip to a jarring white bar
   in light mode. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-ink);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  max-width: var(--max-width);
  margin: 0 auto;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 1.05rem;
  color: #fff;
}

.brand:hover {
  text-decoration: none;
}

/* Logo mark: the source file (assets/img/logo.png, 1280x1024) stacks a
   triangle mark above a "cnelab" wordmark. At compact nav height we only
   want the triangle, so it's cropped with background-image/position
   instead of squishing an <img> — this keeps the mark's proportions. */
.brand-mark {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  background-image: url('../img/logo.png');
  background-repeat: no-repeat;
  background-size: 80px 64px;
  background-position: -20px 0;
}

.brand-text {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  line-height: 1.15;
  letter-spacing: 0.02em;
  font-weight: 800;
}

/* Ocean-wave wordmark: a soft blue/teal gradient that drifts back and
   forth (not a one-way sweep) like light moving across water. Applied to
   both the "CNElab" line and the Chinese subtitle so they wave together. */
.shine {
  display: block;
  background: linear-gradient(
    100deg,
    #0a3d62 0%,
    #1b9e8f 22%,
    #3fd6c2 40%,
    #a8e6ef 52%,
    #3fd6c2 64%,
    #1b9e8f 82%,
    #0a3d62 100%
  );
  background-size: 260% auto;
  background-position: 0% center;
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  animation: brand-wave 6s ease-in-out infinite;
  /* iOS Safari can smear/ghost an animated background-clip:text element
     during scroll unless it's promoted to its own compositing layer. */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  will-change: background-position;
}

.brand-text-sep {
  color: rgba(255, 255, 255, 0.35);
  font-weight: 400;
}

/* On narrow phones, "CNElab | 智慧神經人因工程實驗室" at full size doesn't
   fit next to the hamburger button and pushes it off-screen. Shrink the
   wordmark and nav padding rather than dropping back to a stacked layout. */
@media (max-width: 480px) {
  .nav-bar {
    padding-left: 14px;
    padding-right: 14px;
    gap: 8px;
  }

  .brand {
    gap: 8px;
    font-size: 0.92rem;
    min-width: 0;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    background-size: 68px 54px;
    background-position: -17px 0;
  }

  .brand-text {
    gap: 5px;
    min-width: 0;
  }

  .brand-text-zh {
    font-size: 0.8rem;
  }
}

.brand-text-zh {
  font-size: inherit;
  font-weight: 600;
  letter-spacing: 0;
  white-space: nowrap;
  /* Out of phase with the English line so the two read as two independent
     waves rather than one gradient flowing across from English to Chinese. */
  animation-delay: -3s;
}

@keyframes brand-wave {
  0%,
  100% {
    background-position: 0% center;
  }
  50% {
    background-position: 100% center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .shine {
    animation: none;
    background-position: 45% center;
  }
}

.brand-text small {
  display: block;
  font-weight: 500;
  font-size: 0.68rem;
  letter-spacing: 0;
  text-transform: none;
  color: rgba(255, 255, 255, 0.65);
  margin-top: 2px;
}

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  padding: 0;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: #fff;
  flex-shrink: 0;
}

.nav-toggle svg {
  display: block;
}

.nav-toggle .icon-close {
  display: none;
}

.nav-toggle[aria-expanded="true"] .icon-menu {
  display: none;
}

.nav-toggle[aria-expanded="true"] .icon-close {
  display: block;
}

.nav-links {
  display: flex;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.nav-links a {
  position: relative;
  display: inline-block;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* MIT-style hover underline: a thin bar that grows in from the left. */
.nav-links a::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 6px;
  height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.nav-links a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  text-decoration: none;
}

.nav-links a:hover::after,
.nav-links a:focus-visible::after {
  transform: scaleX(1);
}

.nav-links a[aria-current="page"] {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
}

.nav-links a[aria-current="page"]::after {
  transform: scaleX(1);
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  color: #fff;
  background: linear-gradient(165deg, #05070c 0%, #0a1530 45%, var(--color-block) 130%);
  overflow: hidden;
  min-height: 85vh;
  display: flex;
  align-items: center;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 30%;
  opacity: 0.62;
}

/* Background video: a self-hosted, muted, looping <video> covering the
   hero. No third-party player UI to fight with (unlike a YouTube embed),
   and no cross-origin postMessage plumbing needed — the custom
   .video-ctrl buttons call the native video API directly (see main.js). */
.hero-video-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: 0.62;
}

.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
}

@media (max-width: 600px) {
  .hero-video {
    /* Narrow mobile viewports crop a lot of width off a 16:9 video;
       favor the left side of the frame instead of a dead-center crop. */
    object-position: 10% center;
  }
}

.hero-video-controls {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 10px;
  margin-top: 28px;
  padding-left: 20px;
}

.video-ctrl {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.video-ctrl:hover {
  background: rgba(255, 255, 255, 0.18);
}

.video-ctrl svg {
  display: none;
}

#video-toggle-play .icon-pause,
#video-toggle-play.is-paused .icon-play {
  display: block;
}
#video-toggle-play.is-paused .icon-pause {
  display: none;
}

#video-toggle-mute .icon-muted,
#video-toggle-mute.is-unmuted .icon-unmuted {
  display: block;
}
#video-toggle-mute.is-unmuted .icon-muted {
  display: none;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(3, 6, 14, 0.28) 0%, rgba(3, 6, 14, 0.48) 70%, rgba(3, 6, 14, 0.72) 100%);
}

.hero-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 96px 24px 76px;
  border-left: 5px solid var(--color-block);
}

.hero-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.8rem;
  font-weight: 800;
  color: #fff;
  opacity: 0.85;
  margin: 0 0 18px;
  padding-left: 20px;
}

.hero h1 {
  font-size: clamp(1.9rem, 4.8vw, 3.4rem);
  line-height: 1.04;
  margin: 0 0 18px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  padding-left: 20px;
}

.hero p.lead {
  font-size: 1.2rem;
  max-width: 640px;
  margin: 0 0 6px;
  color: rgba(238, 244, 255, 0.7);
  padding-left: 20px;
  font-weight: 300;
}

.hero p.lead-zh {
  font-size: 1.05rem;
  color: #b9c8ea;
  margin: 0 0 28px;
  padding-left: 20px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
  padding-left: 20px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
  cursor: pointer;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: #fff;
  color: var(--color-block);
}
.btn-primary:hover {
  background: #eaf0ff;
}

.btn-outline {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.55);
}
.btn-outline:hover {
  background: rgba(255, 255, 255, 0.18);
}

.btn-accent {
  background: var(--color-accent);
  color: #06231f;
}
.btn-accent:hover {
  filter: brightness(1.05);
}

/* ---------- Round accent-color arrow CTA ---------- */
.arrow-link {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.86rem;
  color: var(--color-text);
}

.arrow-link:hover {
  text-decoration: none;
}

.btn-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-block);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.25s ease, background 0.25s ease;
}

.btn-circle svg {
  display: block;
}

.arrow-link:hover .btn-circle {
  transform: translateX(6px);
  background: var(--color-primary-dark);
}

.section-blue .arrow-link,
.section-invert .arrow-link {
  color: #fff;
}
.section-blue .btn-circle,
.section-invert .btn-circle {
  background: #fff;
  color: var(--color-block);
}
.section-blue .arrow-link:hover .btn-circle,
.section-invert .arrow-link:hover .btn-circle {
  background: #eaf0ff;
}

/* ---------- Page header (non-home) ---------- */
.page-header {
  position: relative;
  overflow: hidden;
  background: linear-gradient(165deg, #05070c 0%, #0a1530 55%, var(--color-block) 145%);
  color: #fff;
  padding: 64px 24px 52px;
}

.page-header .container {
  position: relative;
  z-index: 1;
  max-width: var(--max-width);
}

.page-header .eyebrow {
  color: #fff;
  opacity: 0.85;
}

.page-header h1 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 4.6vw, 3.1rem);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  line-height: 1.05;
  border-left: 5px solid var(--color-block);
  padding-left: 20px;
}

.page-header p {
  margin: 0 0 0 25px;
  color: #dbe4fb;
  max-width: 700px;
}

/* ---------- Eyebrow + rule section header pattern ---------- */
.section-head {
  margin: 0 0 40px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--color-block);
  margin: 0 0 14px;
}

.section-heading {
  border-left: 5px solid var(--color-block);
  padding-left: 20px;
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  line-height: 1.08;
}

.section-head .section-sub {
  margin-left: 25px;
  margin-top: 14px;
}

/* ---------- Sections ---------- */
main {
  display: block;
}

.section {
  padding: 64px 0;
}

.section + .section {
  border-top: 1px solid var(--color-border);
}

.section-alt {
  background: var(--color-surface-alt);
}

/* Solid accent-color block section — part of the alternating
   black / white / blue rhythm across the page. */
.section-blue {
  background: var(--color-block);
  color: #fff;
}
.section-blue .section-heading,
.section-blue h1,
.section-blue h2,
.section-blue h3,
.section-blue p {
  color: #fff;
}
.section-blue .eyebrow {
  color: #fff;
  opacity: 0.85;
}
.section-blue .section-sub {
  color: rgba(255, 255, 255, 0.85);
}
.section-blue a:not(.btn):not(.arrow-link) {
  color: #fff;
  text-decoration: underline;
}

.keyword-line {
  margin: 22px 0 0;
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.75);
}

/* Solid near-black block section — the "black" end of the rhythm. */
.section-invert {
  background: var(--color-ink);
  color: #fff;
}
.section-invert .section-heading,
.section-invert h1,
.section-invert h2,
.section-invert h3,
.section-invert p {
  color: #fff;
}
.section-invert .eyebrow {
  color: var(--color-block);
}
.section-invert .section-sub {
  color: rgba(255, 255, 255, 0.75);
}

.section-title {
  font-size: 1.5rem;
  margin: 0 0 6px;
  font-weight: 800;
}

.section-sub {
  color: var(--color-text-muted);
  margin: 0 0 32px;
  max-width: 700px;
}

/* ---------- Cards / grids ---------- */
.grid {
  display: grid;
  gap: 22px;
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 860px) {
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.card:hover {
  border-color: var(--color-block);
  transform: translateY(-2px);
}

.card h3 {
  margin: 0 0 10px;
  font-size: 1.05rem;
  font-weight: 800;
}

.card p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

.icon-badge {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--color-primary-tint);
  color: var(--color-block);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  font-size: 1.25rem;
}

/* ---------- Team grid ---------- */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 22px;
}

.team-card {
  text-align: center;
}

.team-photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--color-surface);
  box-shadow: var(--shadow-sm);
  background: var(--color-surface-alt);
  margin: 0 auto 12px;
}

.team-name {
  font-weight: 700;
  font-size: 0.95rem;
  margin: 0 0 2px;
}

.team-meta {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin: 0;
}

.role-heading {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: 52px 0 26px;
  border-left: 4px solid var(--color-block);
  padding-left: 16px;
}

.role-heading:first-child {
  margin-top: 0;
}

.role-heading h2 {
  font-size: 1.05rem;
  margin: 0;
  white-space: nowrap;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.role-heading .rule {
  height: 1px;
  background: var(--color-border);
  flex: 1;
}

.pi-card {
  display: flex;
  gap: 28px;
  align-items: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 8px;
}

.pi-card img {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.pi-card h3 {
  margin: 0 0 4px;
  font-size: 1.3rem;
  font-weight: 800;
}

.pi-card .pi-title {
  color: var(--color-accent);
  font-weight: 700;
  font-size: 0.9rem;
  margin: 0 0 10px;
}

.pi-card p {
  margin: 0;
  color: var(--color-text-muted);
}

@media (max-width: 560px) {
  .pi-card {
    flex-direction: column;
    text-align: center;
  }
}

.group-photos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 8px;
}

.group-photos figure {
  margin: 0;
}

.group-photos img {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.group-photos figcaption {
  margin-top: 8px;
  font-size: 0.88rem;
  color: var(--color-text-muted);
  text-align: center;
}

/* ---------- Lists (publications, research, teaching) ---------- */
.pub-list,
.plain-list {
  list-style: none;
  margin: 0 0 32px;
  padding: 0;
}

.pub-list li,
.plain-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.95rem;
}

.pub-list li:last-child,
.plain-list li:last-child {
  border-bottom: none;
}

.pub-list a {
  font-weight: 600;
}

.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-accent);
  background: var(--color-accent-light);
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: middle;
}

.subsection-title {
  font-size: 1.1rem;
  font-weight: 800;
  margin: 40px 0 6px;
  color: var(--color-block);
  border-left: 3px solid var(--color-block);
  padding-left: 12px;
}

.subsection-title:first-of-type {
  margin-top: 0;
}

.subsection-note {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  margin: 0 0 14px;
}

/* ---------- Timeline (teaching) ---------- */
.timeline-block {
  margin-bottom: 30px;
}

.timeline-block h3 {
  font-size: 1.05rem;
  margin: 0 0 12px;
  color: var(--color-block);
  font-weight: 800;
}

.timeline-block .period {
  font-weight: 700;
  margin: 16px 0 6px;
  font-size: 0.92rem;
}

/* ---------- Profile links (Google Scholar / ORCID) ---------- */
.profile-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-weight: 600;
  font-size: 0.86rem;
}

.profile-badge:hover {
  border-color: var(--color-block);
  text-decoration: none;
}

.profile-badge svg {
  flex-shrink: 0;
}

.page-header .profile-badge {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
}

.page-header .profile-badge:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* ---------- Link cards (join/external) ---------- */
.link-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin: 24px 0;
}

.link-card {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.link-card:hover {
  border-color: var(--color-block);
  text-decoration: none;
  transform: translateY(-2px);
}

.link-card .link-title {
  font-weight: 700;
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.link-card .link-desc {
  color: var(--color-text-muted);
  font-size: 0.88rem;
  margin-top: 6px;
}

.badge-internal {
  font-size: 0.68rem;
  font-weight: 700;
  color: #9a6b00;
  background: #fff3d6;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

@media (prefers-color-scheme: dark) {
  .badge-internal {
    color: #ffd479;
    background: #3a2c05;
  }
}

/* ---------- Callout box ---------- */
.callout {
  background: var(--color-primary-tint);
  border: 1px solid var(--color-block);
  border-radius: var(--radius-md);
  padding: 22px 26px;
  margin: 24px 0;
}

.callout p {
  margin: 0 0 8px;
}
.callout p:last-child {
  margin-bottom: 0;
}

/* ---------- News / Padlet embed ---------- */
.news-frame-wrap {
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background: var(--color-surface-alt);
}

.news-fallback {
  margin: 14px 0 0;
  font-size: 0.86rem;
  color: var(--color-text-muted);
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--color-ink);
  color: #c7d0da;
  padding: 48px 0 28px;
  margin-top: 40px;
  font-size: 0.9rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 28px;
  margin-bottom: 24px;
}

@media (max-width: 700px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

.site-footer h4 {
  color: #fff;
  margin: 0 0 14px;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.site-footer a {
  color: #c7d0da;
}

.site-footer a:hover {
  color: #fff;
}

.site-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer li {
  margin-bottom: 8px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.footer-brand .brand-mark {
  width: 44px;
  height: 44px;
  background-size: 88px 70.4px;
  background-position: -22px 0;
}

.footer-brand span {
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #fff;
  font-size: 1.1rem;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  color: #8a95a1;
  font-size: 0.82rem;
}

/* ---------- Utility ---------- */
.text-center {
  text-align: center;
}

.mt-0 {
  margin-top: 0;
}

/* ---------- Responsive nav ---------- */
@media (max-width: 860px) {
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-ink);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    flex-direction: column;
    padding: 8px 16px 16px;
    box-shadow: var(--shadow-md);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    padding: 12px 8px;
    width: 100%;
  }

  .site-header {
    position: sticky;
  }

  .nav-bar {
    position: relative;
  }
}

/* ---------- Scroll-reveal ---------- */
/* Sections start faded/offset and ease into place once they enter the
   viewport (see the IntersectionObserver in main.js) — the same idea as
   Apple's product pages, kept subtle rather than flashy. */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger individual text lines within a revealed section so the words
   cascade in one after another instead of the whole block popping at once. */
.reveal-delay-1 {
  transition-delay: 0.08s;
}
.reveal-delay-2 {
  transition-delay: 0.16s;
}
.reveal-delay-3 {
  transition-delay: 0.24s;
}
.reveal-delay-4 {
  transition-delay: 0.32s;
}
.reveal-delay-5 {
  transition-delay: 0.4s;
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---------- Year rail ---------- */
/* A sticky vertical list of years running alongside a long chronological
   list — e.g. Publications' "Journal Papers" or Research's project lists.
   A real column in the layout (not floating in the page margin), so it
   still fits on an un-maximized laptop window. Highlights the year
   currently in view and jumps to it on click. Reused across pages, so the
   content column (.year-rail-content) can hold one <ul> or several. */
.year-rail-layout {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.year-rail-layout .year-rail-content {
  flex: 1;
  min-width: 0;
}

.year-rail {
  display: none;
}

@media (min-width: 860px) {
  .year-rail {
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: sticky;
    top: 100px;
    flex-shrink: 0;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    padding: 4px 2px;
  }

  .year-rail:empty {
    display: none;
  }
}

.year-rail-link {
  appearance: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text-muted);
  border-left: 2px solid transparent;
  text-align: left;
  transition: color 0.2s ease, border-color 0.2s ease, font-size 0.2s ease;
}

.year-rail-link:hover {
  color: var(--color-primary);
}

.year-rail-link.active {
  color: var(--color-primary);
  border-left-color: var(--color-primary);
  font-size: 0.92rem;
}
