/* ─── CSS Variables ─────────────────────────── */
:root {
  --accent: #7A5230;
  --accent-light: #96673F;
  --accent-hover: #643F22;
  --accent-glow: rgba(122, 82, 48, 0.10);
  --text-primary: #2C2420;
  --text-secondary: #5C4E43;
  --text-muted: #7A6D62;
  --bg-primary: #FAF7F2;
  --bg-secondary: #F0EBE3;
  --border-color: #C9B89E;
  --border-light: #DDD4C6;
  --sidebar-bg: linear-gradient(180deg, rgba(250, 247, 242, 0.92), rgba(237, 229, 216, 0.92));
  --sidebar-width: 160px;
  --font-heading: 'Satoshi', 'Source Sans 3', Arial, Helvetica, sans-serif;
  --font-body: 'Source Sans 3', Arial, Helvetica, sans-serif;
  --radius: 6px;
  --shadow-sm: 0 1px 3px rgba(44, 36, 32, 0.06);
  --shadow-md: 0 4px 16px rgba(44, 36, 32, 0.08);
  --transition: 0.25s ease;
  --space-sm: 16px;
  --space-md: 28px;
  --space-lg: 48px;
  --space-xl: 72px;
}

/* ─── Scroll Progress ─────────────────────────── */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: var(--accent);
  z-index: 1000;
  transition: width 0.1s linear;
  will-change: width;
}

/* ─── Reset & Base ─────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg-primary);
  line-height: 1.7;
  font-weight: 400;
}

/* ─── Sidebar ──────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-right: 1px solid var(--border-color);
  z-index: 100;
  display: flex;
  align-items: center;
}

.sidebar-inner {
  padding: 0 24px;
  width: 100%;
}

.sidebar-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 12px;
  margin-bottom: 12px;
}

.sidebar-links {
  list-style: none;
}

.sidebar-links li {
  margin-bottom: 2px;
}

.nav-link {
  display: block;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius);
  border-left: 2px solid transparent;
  transition: color var(--transition),
              background var(--transition),
              border-left-color 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              font-weight 0s;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--accent-glow);
}

.nav-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.nav-link.active {
  color: var(--accent);
  background: rgba(122, 82, 48, 0.10);
  border-left-color: var(--accent);
  font-weight: 600;
}

/* ─── Mobile Nav Toggle ────────────────────── */
.mobile-nav-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  width: 40px;
  height: 40px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  box-shadow: var(--shadow-sm);
}

.mobile-nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 1px;
  transition: all var(--transition);
}

/* ─── Main Content ─────────────────────────── */
.content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

/* ─── Hero / Title Section ─────────────────── */
.hero {
  padding: var(--space-xl) 60px var(--space-lg);
  text-align: center;
  border-bottom: 1px solid var(--border-light);
  background:
    radial-gradient(ellipse at 20% 0%, rgba(166, 123, 91, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 100%, rgba(139, 94, 60, 0.08) 0%, transparent 50%),
    linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.hero-inner {
  max-width: 840px;
  margin: 0 auto;
}

.hero-tag {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-sm);
}

.hero-title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 3.2rem;
  line-height: 1.15;
  color: var(--text-primary);
  margin-bottom: 24px;
  letter-spacing: -0.01em;
}

.hero-team {
  display: block;
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--accent-light);
  margin-top: 8px;
  letter-spacing: 0;
}

.hero-description {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: var(--space-md);
}

.hero-authors {
  margin-bottom: 12px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
}

.author-sep {
  margin: 0 8px;
  color: var(--text-muted);
}

.hero-equal {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 12px;
}

.hero-affiliation {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}

.hero-links {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ─── Buttons ──────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius);
  transition: all var(--transition);
}

.btn svg {
  flex-shrink: 0;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: 1.5px solid var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 4px 18px rgba(139, 94, 60, 0.35), 0 0 0 3px rgba(122, 82, 48, 0.08);
}

.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}

.btn-secondary:hover {
  background: var(--accent-glow);
  border-color: var(--accent-hover);
  box-shadow: 0 4px 18px rgba(139, 94, 60, 0.18);
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ─── Sections ─────────────────────────────── */
.section {
  max-width: 960px;
  margin: 0 auto;
  padding: var(--space-xl) 60px;
  border-bottom: 1px solid var(--border-light);
}

.section-header {
  margin-bottom: var(--space-md);
}

.task-label {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
  padding: 4px 10px;
  background: var(--accent-glow);
  border: 1px solid rgba(122, 82, 48, 0.18);
  border-radius: 3px;
}

.section-header h2 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.8rem;
  color: var(--text-primary);
}

.section-text {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: var(--space-md);
}

/* ─── Self-hosted Video Player ────────────── */
.video-player {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1.5px solid var(--border-light);
  display: block;
}

/* ─── Video Link (clickable YouTube thumbnail) */
.video-link {
  display: block;
  position: relative;
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1.5px solid var(--border-light);
  margin-bottom: var(--space-sm);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.video-link:hover {
  border-color: var(--accent-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.video-link img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--bg-secondary);
}

.video-link-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(44, 36, 32, 0.35);
  transition: background var(--transition);
}

.video-link:hover .video-link-play {
  background: rgba(44, 36, 32, 0.5);
}

.video-link-play svg {
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
  transition: transform var(--transition);
}

.video-link:hover .video-link-play svg {
  transform: scale(1.15);
}

/* ─── Video Embed ──────────────────────────── */
.video-embed {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-secondary);
  border: 1.5px solid var(--border-light);
  box-shadow: inset 0 2px 8px rgba(44, 36, 32, 0.04);
  margin-bottom: var(--space-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.video-embed:hover {
  border-color: var(--border-color);
  box-shadow: var(--shadow-md);
}

.video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ─── Video Placeholder ────────────────────── */
.video-placeholder {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  background: var(--bg-secondary);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: inset 0 2px 8px rgba(44, 36, 32, 0.04);
  overflow: hidden;
  margin-bottom: var(--space-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.video-placeholder:hover {
  border-color: var(--border-color);
  box-shadow: inset 0 2px 8px rgba(44, 36, 32, 0.04), var(--shadow-sm);
}

.video-placeholder .placeholder-icon,
.video-placeholder .placeholder-label {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.video-placeholder .placeholder-icon {
  top: calc(50% - 36px);
  color: var(--text-muted);
  opacity: 0.4;
  transition: opacity var(--transition), transform var(--transition);
}

.video-placeholder:hover .placeholder-icon {
  opacity: 0.6;
  transform: translateX(-50%) scale(1.05);
}

.video-placeholder .placeholder-label {
  top: calc(50% + 20px);
}

.main-video {
  border-color: var(--accent-light);
  background:
    radial-gradient(ellipse at center, rgba(139, 94, 60, 0.04) 0%, transparent 70%),
    var(--bg-secondary);
}

/* ─── Figure Placeholders ──────────────────── */
.figure-placeholder {
  background: var(--bg-secondary);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: inset 0 2px 8px rgba(44, 36, 32, 0.04);
  padding: var(--space-lg) 24px;
  text-align: center;
  margin-bottom: 10px;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.figure-placeholder:hover {
  border-color: var(--border-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.figure-wide {
  min-height: 220px;
  border-color: var(--border-color);
  background:
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 20px,
      rgba(212, 197, 178, 0.08) 20px,
      rgba(212, 197, 178, 0.08) 40px
    ),
    var(--bg-secondary);
}

.placeholder-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.placeholder-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  opacity: 0.7;
  margin-top: 6px;
}

/* ─── Figures Grid ─────────────────────────── */
.figures-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: var(--space-lg);
}

.figures-row + .figures-row {
  margin-top: 24px;
}

.figures-row .figure-full {
  grid-column: 1 / -1;
}

/* Wide video row: breaks out of content margin, stays centered */
.videos-wide {
  display: grid;
  gap: 24px;
  margin-top: var(--space-lg);
  width: 125%;
  margin-left: -12.5%;
  padding: 0 6px;
}

.videos-wide.proportional {
  grid-template-columns: 1.778fr 0.5625fr;
}

.figure {
  min-width: 0;
}

.figure > img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1.5px solid var(--border-light);
  margin-bottom: 10px;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.figure > img:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-color);
}

/* Equalize mismatched image heights with white-space padding */
/* Gallery image that bleeds past section margins */
.gallery-wide {
  width: 120%;
  margin-left: -10%;
  margin-top: var(--space-lg);
}

.gallery-wide img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1.5px solid var(--border-light);
  margin-bottom: 10px;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.gallery-wide img:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-color);
}

@media (max-width: 900px) {
  .gallery-wide {
    width: 100%;
    margin-left: 0;
  }
}

.img-equalize {
  aspect-ratio: 4 / 3;
  background: #fff;
  border-radius: var(--radius);
  border: 1.5px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.img-equalize:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-color);
}

.img-equalize img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border: none;
  margin: 0;
}

.section:last-of-type {
  border-bottom: none;
}

/* ─── Captions ─────────────────────────────── */
.caption {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 8px;
}

.caption strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* ─── Footer ───────────────────────────────── */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  text-align: center;
  padding: var(--space-lg) 60px;
  margin-left: var(--sidebar-width);
}

.footer-inner {
  max-width: 720px;
  margin: 0 auto;
}

.footer-rule {
  width: 40px;
  height: 2px;
  background: var(--border-color);
  border: none;
  margin: 0 auto var(--space-md);
}

.footer-affiliation {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.footer-course {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.footer-logo {
  display: block;
  height: 80px;
  width: auto;
  margin: 0 auto;
  opacity: 1;
}

/* ─── Responsive ───────────────────────────── */
@media (max-width: 1024px) {
  .hero {
    padding: 64px 40px var(--space-lg);
  }

  .section {
    padding: var(--space-lg) 40px;
  }

  .footer {
    padding: 40px;
  }

  .videos-wide {
    width: 115%;
    margin-left: -7.5%;
  }
}

@media (max-width: 900px) {
  .videos-wide {
    width: 100%;
    margin-left: 0;
  }

  .videos-wide.proportional {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: none;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(44, 36, 32, 0.15);
  }

  .sidebar-scrim {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(44, 36, 32, 0.3);
    z-index: 99;
  }

  .sidebar-scrim.visible {
    display: block;
  }

  .mobile-nav-toggle {
    display: flex;
  }

  .content {
    margin-left: 0;
  }

  .hero {
    padding: 72px 24px 40px;
  }

  .hero-title {
    font-size: 2.2rem;
  }

  .hero-team {
    font-size: 1.1rem;
  }

  .section {
    padding: 40px 24px;
  }

  .section-header h2 {
    font-size: 1.5rem;
  }

  .figures-row {
    grid-template-columns: 1fr;
  }

  .videos-wide {
    width: 100%;
    margin-left: 0;
  }

  .videos-wide.proportional {
    grid-template-columns: 1fr;
  }

  .flowchart,
  .flowchart-row {
    flex-direction: column;
  }

  .flowchart-arrow {
    transform: rotate(90deg);
    padding: 4px 0;
  }

  .flowchart-row--reverse {
    flex-direction: column-reverse;
  }

  .flowchart-row--reverse .flowchart-arrow {
    transform: rotate(-90deg);
  }

  .arch-layer-tag {
    min-width: auto;
    width: 100%;
    justify-content: flex-start;
    padding-bottom: 4px;
  }

  .arch-layer {
    flex-direction: column;
    gap: 4px;
    padding: 8px 10px;
  }

  .arch-arrows {
    margin-left: 0;
  }

  .arch-arrows::before {
    transform: translateX(-50%);
  }

  .arch-arrows::after {
    left: 50%;
  }

  .arch-arrow-label {
    margin-left: 0;
  }

  .arch-arrows-spacer {
    display: none;
  }

  .arch-arrows--multi {
    flex-wrap: wrap;
    gap: 0;
    justify-content: center;
  }

  .arch-arrow-pair {
    flex: 1 1 50%;
    max-width: none;
  }

  .arch-node {
    max-width: none;
  }

  .arch-node--controller {
    max-width: none;
  }

  .arch-evolution-arrow {
    transform: rotate(90deg);
    padding: 4px 0;
  }

  .flowchart-step--connector::after {
    position: static;
    transform: rotate(90deg);
    display: block;
    text-align: center;
    padding: 4px 0;
  }

  .flowchart-step {
    max-width: 100%;
    width: 100%;
  }

  .tools-grid {
    grid-template-columns: 1fr;
  }

  .footer {
    margin-left: 0;
    padding: var(--space-md) 24px;
  }

  .hero-links {
    flex-direction: column;
    align-items: center;
  }
}

/* ─── Flowcharts ──────────────────────────── */
.flowchart-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
  margin-top: var(--space-md);
}

.flowchart {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: center;
  gap: 0;
  margin-bottom: var(--space-md);
}

.flowchart-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 14px 18px;
  background: var(--bg-secondary);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius);
  min-width: 0;
  flex: 1 1 120px;
  max-width: 180px;
  transition: transform var(--transition), box-shadow var(--transition);
}

.flowchart-step:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.flowchart-step--highlight {
  border-color: var(--accent);
  background: rgba(122, 82, 48, 0.06);
}

.step-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.step-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border-radius: 50%;
  margin-bottom: 6px;
}

.flowchart-arrow {
  font-size: 1.4rem;
  color: var(--accent-light);
  padding: 0 8px;
  user-select: none;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

/* U-shape flowchart */
.flowchart-u {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 44px;
  width: fit-content;
  margin: 0 auto var(--space-md);
}

.flowchart-row {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 0;
}

.flowchart-row--reverse {
  /* visual only — HTML order already matches reading direction */
}

.flowchart-u .flowchart-step {
  justify-content: flex-start;
  min-height: 90px;
}

.flowchart--detailed .flowchart-step {
  justify-content: flex-start;
}

.flowchart-step--connector {
  position: relative;
}

.flowchart-step--connector::after {
  content: "→";
  position: absolute;
  top: calc(100% + 11px);
  left: 50%;
  transform: translateX(-50%) rotate(90deg);
  font-size: 1.41rem;
  color: var(--accent-light);
  line-height: 1;
}

/* ─── Tools Grid ──────────────────────────── */
.tools-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: var(--space-sm);
}

.tools-grid img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1.5px solid var(--border-light);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.tools-grid img:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-color);
}

/* ─── Highlights Box ──────────────────────── */
.highlights-box {
  background: rgba(122, 82, 48, 0.05);
  border: 1.5px solid rgba(122, 82, 48, 0.18);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-top: var(--space-md);
  margin-bottom: var(--space-md);
}

.highlights-box h3 {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 10px;
}

.highlights-box ul {
  list-style: none;
  padding: 0;
}

.highlights-box li {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.7;
  padding-left: 18px;
  position: relative;
  margin-bottom: 4px;
}

.highlights-box li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--accent-light);
  font-size: 0.85rem;
}

/* ─── Architecture Graph ─────────────────────── */
.arch-graph {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--space-md);
  width: 100%;
}

.arch-layer {
  display: flex;
  align-items: stretch;
  gap: 12px;
  width: 100%;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--bg-primary);
}

.arch-layer-tag {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  min-width: 68px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
  padding-right: 4px;
}

.arch-nodes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  justify-content: center;
}

.arch-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius);
  flex: 1 1 90px;
  max-width: 150px;
  min-width: 80px;
  transition: transform var(--transition), box-shadow var(--transition);
}

.arch-node:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.arch-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.25;
}

.arch-detail {
  font-size: 0.67rem;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.2;
}

.arch-node--external {
  border-color: var(--accent-light);
  background: rgba(122, 82, 48, 0.05);
}

.arch-node--controller {
  max-width: 260px;
  flex: 1 1 200px;
}

.arch-nodes--evolution {
  align-items: center;
}

.arch-evolution-arrow {
  font-size: 1.3rem;
  color: var(--accent);
  font-weight: 700;
  flex-shrink: 0;
  padding: 0 6px;
  user-select: none;
}

.arch-node--hw {
  border-style: dashed;
  border-color: var(--border-light);
}

.arch-arrows {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 0;
  position: relative;
  width: 100%;
}

.arch-arrows::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1.5px;
  background: var(--border-color);
  transform: translateX(calc(-50% + 40px));
}

.arch-arrows::after {
  content: '';
  position: absolute;
  left: calc(50% + 40px);
  bottom: -1px;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--border-color);
  border-bottom: 1.5px solid var(--border-color);
  transform: translateX(-50%) rotate(45deg);
}

.arch-arrow-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  background: var(--bg-primary);
  padding: 0 6px;
  position: relative;
  z-index: 1;
  letter-spacing: 0.03em;
  margin-left: 80px;
}

/* Multi-arrow row between External and Perception */
.arch-arrows--multi {
  display: flex;
  padding: 2px 0;
  margin-left: 0;
  overflow: visible;
}

.arch-arrows--multi::before,
.arch-arrows--multi::after {
  display: none;
}

.arch-arrows-spacer {
  min-width: 68px;
  flex-shrink: 0;
  margin-right: 12px;
}

.arch-arrow-pair {
  flex: 2 1 180px;
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: 306px;
}

.arch-arrow-vert {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  height: 36px;
  width: 1.5px;
  background: var(--border-color);
}

.arch-arrow-vert::after {
  content: '';
  position: absolute;
  bottom: -1px;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--border-color);
  border-bottom: 1.5px solid var(--border-color);
  transform: translateX(-0.25px) rotate(45deg);
}

.arch-arrow-vert-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.68rem;
  color: var(--text-muted);
  background: var(--bg-primary);
  padding: 0 6px;
  white-space: nowrap;
  letter-spacing: 0.03em;
}

/* ─── Animations ───────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  .section {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .section.visible {
    opacity: 1;
    transform: translateY(0);
  }

  /* Staggered reveals for child elements within visible sections */
  .section .section-header,
  .section .section-text,
  .section .video-placeholder,
  .section .video-embed,
  .section .video-link,
  .section .caption,
  .section .figures-row,
  .section .flowchart-label,
  .section .flowchart,
  .section .flowchart-u,
  .section .tools-grid,
  .section .highlights-box,
  .section .arch-graph {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .section.visible .section-header   { opacity: 1; transform: translateY(0); transition-delay: 0.08s; }
  .section.visible .section-text     { opacity: 1; transform: translateY(0); transition-delay: 0.16s; }
  .section.visible .video-placeholder { opacity: 1; transform: translateY(0); transition-delay: 0.24s; }
  .section.visible .video-embed      { opacity: 1; transform: translateY(0); transition-delay: 0.24s; }
  .section.visible .video-link       { opacity: 1; transform: translateY(0); transition-delay: 0.24s; }
  .section.visible .caption          { opacity: 1; transform: translateY(0); transition-delay: 0.28s; }
  .section.visible .figures-row      { opacity: 1; transform: translateY(0); transition-delay: 0.32s; }
  .section.visible .figures-row + .figures-row { transition-delay: 0.40s; }
  .section.visible .flowchart-label  { opacity: 1; transform: translateY(0); transition-delay: 0.20s; }
  .section.visible .flowchart        { opacity: 1; transform: translateY(0); transition-delay: 0.28s; }
  .section.visible .flowchart-u      { opacity: 1; transform: translateY(0); transition-delay: 0.28s; }
  .section.visible .tools-grid       { opacity: 1; transform: translateY(0); transition-delay: 0.24s; }
  .section.visible .highlights-box   { opacity: 1; transform: translateY(0); transition-delay: 0.36s; }
  .section.visible .arch-graph       { opacity: 1; transform: translateY(0); transition-delay: 0.36s; }

  /* Hero entrance: staggered children */
  .hero {
    animation: fadeIn 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .hero-tag,
  .hero-title,
  .hero-description,
  .hero-authors,
  .hero-equal,
  .hero-links {
    opacity: 0;
    animation: fadeInUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .hero-tag         { animation-delay: 0.15s; }
  .hero-title       { animation-delay: 0.25s; }
  .hero-description { animation-delay: 0.35s; }
  .hero-authors     { animation-delay: 0.45s; }
  .hero-equal       { animation-delay: 0.50s; }
  .hero-links       { animation-delay: 0.55s; }

  @keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
  }

  @keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* Footer reveal */
  .footer {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .footer.visible {
    opacity: 1;
    transform: translateY(0);
  }
}

/* For users who prefer reduced motion or as fallback */
@media (prefers-reduced-motion: reduce) {
  .section,
  .section .section-header,
  .section .section-text,
  .section .video-placeholder,
  .section .video-embed,
  .section .video-link,
  .section .caption,
  .section .figures-row,
  .section .flowchart-label,
  .section .flowchart,
  .section .flowchart-u,
  .section .tools-grid,
  .section .highlights-box,
  .section .arch-graph,
  .footer {
    opacity: 1;
    transform: none;
    transition: none;
    animation: none;
  }

  .hero-tag,
  .hero-title,
  .hero-description,
  .hero-authors,
  .hero-equal,
  .hero-links {
    opacity: 1;
    animation: none;
  }
}
