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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 64px;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Noto Sans CJK SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI",
    Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  background: #0d1117;
  color: #e6edf3;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: #58a6ff;
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: #79c0ff;
}

ul {
  list-style: none;
}

/* ===== Layout ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== Scroll Reveal Animation ===== */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Stagger children animation */
.reveal-children .card,
.reveal-children .tt-card,
.reveal-children .skill-card,
.reveal-children .project-card,
.reveal-children .idea-card,
.reveal-children .arch-branch {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-children.visible .card,
.reveal-children.visible .tt-card,
.reveal-children.visible .skill-card,
.reveal-children.visible .project-card,
.reveal-children.visible .idea-card,
.reveal-children.visible .arch-branch {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Header ===== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid #21262d;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: #e6edf3;
}

.logo:hover {
  color: #e6edf3;
}

.logo-cn {
  color: #58a6ff;
}

.nav {
  display: flex;
  gap: 32px;
}

.nav-link {
  color: #8b949e;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 4px 0;
  position: relative;
  transition: color 0.2s;
}

.nav-link::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: #58a6ff;
  transition: width 0.25s ease;
}

.nav-link:hover,
.nav-link.active {
  color: #e6edf3;
}

.nav-link.active::after {
  width: 100%;
}

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: #e6edf3;
  border-radius: 1px;
  transition: transform 0.3s, opacity 0.3s;
}

/* ===== Hero ===== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 120px 24px 80px;
  background:
    radial-gradient(ellipse 80% 60% at 50% 40%, rgba(88, 166, 255, 0.08) 0%, transparent 70%),
    radial-gradient(ellipse 60% 50% at 30% 60%, rgba(139, 92, 246, 0.05) 0%, transparent 60%),
    #0d1117;
}

.hero-content {
  max-width: 720px;
}

.hero-title {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 16px;
}

.highlight {
  background: linear-gradient(135deg, #58a6ff, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  color: #8b949e;
  margin-bottom: 20px;
  font-weight: 500;
}

.hero-desc {
  font-size: 1.05rem;
  color: #8b949e;
  line-height: 1.8;
  margin-bottom: 36px;
}

.hero-cta {
  display: inline-block;
  padding: 12px 32px;
  border: 1px solid #30363d;
  border-radius: 8px;
  color: #e6edf3;
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.2s, border-color 0.2s;
}

.hero-cta:hover {
  background: rgba(88, 166, 255, 0.1);
  border-color: #58a6ff;
  color: #e6edf3;
}

/* ===== Sections ===== */
.section {
  padding: 96px 0;
}

.section-alt {
  background: #161b22;
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.section-desc {
  color: #8b949e;
  font-size: 1.1rem;
  max-width: 640px;
  margin-bottom: 48px;
  line-height: 1.7;
}

/* ===== Intro Blocks ===== */
.intro-block {
  margin-bottom: 56px;
}

.intro-block:last-child {
  margin-bottom: 0;
}

.intro-heading {
  font-size: 1.35rem;
  font-weight: 600;
  color: #58a6ff;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

.intro-block .section-desc {
  margin-bottom: 24px;
}

.intro-block .section-desc strong {
  color: #e6edf3;
}

/* ===== Card Grid ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

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

.card {
  background: #0d1117;
  border: 1px solid #21262d;
  border-radius: 12px;
  padding: 28px 24px;
  transition: border-color 0.2s, transform 0.2s;
}

.section-alt .card {
  background: #0d1117;
}

.card:hover {
  border-color: #30363d;
  transform: translateY(-2px);
}

.card-icon {
  font-size: 1.8rem;
  margin-bottom: 12px;
}

.card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: #e6edf3;
}

.card p {
  color: #8b949e;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ===== Architecture Tree ===== */
.arch-tree {
  max-width: 720px;
  margin: 0 auto;
}

.arch-node {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: #0d1117;
  border: 1px solid #21262d;
  border-radius: 8px;
  transition: border-color 0.2s, transform 0.15s;
}

.arch-node:hover {
  border-color: #58a6ff;
  transform: translateX(4px);
}

.arch-root {
  border-color: #58a6ff;
  background: linear-gradient(135deg, rgba(88, 166, 255, 0.08), rgba(139, 92, 246, 0.05));
}

.arch-root .arch-name {
  font-size: 1.15rem;
  color: #58a6ff;
}

.arch-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}

.arch-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: #e6edf3;
  white-space: nowrap;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
}

.arch-desc {
  color: #8b949e;
  font-size: 0.85rem;
  margin-left: 4px;
}

.arch-desc::before {
  content: "\2014\00a0";
  color: #30363d;
}

.arch-children {
  margin-left: 24px;
  padding-left: 20px;
  border-left: 2px solid #21262d;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 6px;
  padding-bottom: 2px;
}

.arch-branch {
  position: relative;
}

.arch-branch::before {
  content: "";
  position: absolute;
  left: -20px;
  top: 20px;
  width: 16px;
  height: 2px;
  background: #21262d;
}

.arch-expandable {
  cursor: pointer;
  user-select: none;
}

.arch-expandable .arch-name::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-right: 2px solid #58a6ff;
  border-bottom: 2px solid #58a6ff;
  transform: rotate(45deg);
  margin-left: 6px;
  opacity: 0.6;
  transition: transform 0.3s ease;
}

.arch-expandable.arch-collapsed .arch-name::after {
  transform: rotate(-45deg);
}

/* Collapsible children animation */
.arch-collapsible {
  overflow: hidden;
  max-height: 600px;
  opacity: 1;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.3s ease,
              padding-top 0.3s ease,
              padding-bottom 0.3s ease;
}

.arch-collapsible.arch-hidden {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.arch-leaf-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-left: 24px;
  padding-left: 20px;
  border-left: 2px solid #21262d;
  padding-top: 6px;
  padding-bottom: 2px;
}

.arch-leaf {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(13, 17, 23, 0.6);
  border: 1px solid #21262d;
  border-radius: 6px;
  font-size: 0.85rem;
  color: #8b949e;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
  transition: border-color 0.2s;
}

.arch-leaf:hover {
  border-color: #30363d;
}

.arch-leaf .arch-icon {
  font-size: 0.95rem;
  width: auto;
}

/* ===== Tech Tree ===== */

/* Legend */
.tt-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 40px;
}

.tt-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: #8b949e;
}

.tt-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tt-dot--done { background: #3fb950; }
.tt-dot--ready { background: #58a6ff; }
.tt-dot--can { background: #d29922; }
.tt-dot--future { background: #484f58; }

/* Group titles */
.tt-group-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 16px;
  margin-top: 8px;
  padding-left: 4px;
}

.tt-group-title--done { color: #3fb950; }
.tt-group-title--ready { color: #58a6ff; }
.tt-group-title--can { color: #d29922; }
.tt-group-title--future { color: #484f58; }

/* Grid */
.tt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 36px;
}

/* Card */
.tt-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid #21262d;
  background: #0d1117;
  transition: transform 0.2s, border-color 0.25s, box-shadow 0.25s;
  cursor: default;
}

.tt-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.tt-card-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}

.tt-card-text {
  font-size: 0.9rem;
  color: #c9d1d9;
  line-height: 1.4;
}

/* Status-specific borders & hover */
.tt-card--done {
  border-color: rgba(63, 185, 80, 0.25);
}
.tt-card--done:hover {
  border-color: rgba(63, 185, 80, 0.6);
  box-shadow: 0 4px 16px rgba(63, 185, 80, 0.1);
}

.tt-card--ready {
  border-color: rgba(88, 166, 255, 0.25);
}
.tt-card--ready:hover {
  border-color: rgba(88, 166, 255, 0.6);
  box-shadow: 0 4px 16px rgba(88, 166, 255, 0.1);
}

.tt-card--can {
  border-color: rgba(210, 153, 34, 0.25);
}
.tt-card--can:hover {
  border-color: rgba(210, 153, 34, 0.6);
  box-shadow: 0 4px 16px rgba(210, 153, 34, 0.1);
}

.tt-card--future {
  border-color: rgba(72, 79, 88, 0.4);
  opacity: 0.65;
}
.tt-card--future:hover {
  opacity: 1;
  border-color: rgba(72, 79, 88, 0.8);
  box-shadow: 0 4px 16px rgba(72, 79, 88, 0.15);
}

/* ===== Skills Grid ===== */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.skill-card {
  background: #0d1117;
  border: 1px solid #21262d;
  border-radius: 12px;
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.2s;
}

.skill-card:hover {
  border-color: #58a6ff;
  box-shadow: 0 0 20px rgba(88, 166, 255, 0.1), 0 0 40px rgba(88, 166, 255, 0.04);
  transform: translateY(-2px);
}

.skill-emoji {
  font-size: 1.6rem;
  line-height: 1;
  margin-bottom: 4px;
}

.skill-name {
  font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
  font-size: 1.05rem;
  font-weight: 600;
  color: #e6edf3;
}

.skill-desc {
  color: #8b949e;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ===== Projects Grid ===== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.project-card {
  background: #0d1117;
  border: 1px solid #21262d;
  border-radius: 12px;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.2s;
}

.project-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.project-card--active {
  border-color: rgba(63, 185, 80, 0.25);
}

.project-card--active:hover {
  border-color: rgba(63, 185, 80, 0.6);
  box-shadow: 0 4px 16px rgba(63, 185, 80, 0.1);
}

.project-card--paused {
  border-color: rgba(210, 153, 34, 0.25);
}

.project-card--paused:hover {
  border-color: rgba(210, 153, 34, 0.6);
  box-shadow: 0 4px 16px rgba(210, 153, 34, 0.1);
}

.project-card--completed {
  border-color: rgba(88, 166, 255, 0.25);
}

.project-card--completed:hover {
  border-color: rgba(88, 166, 255, 0.6);
  box-shadow: 0 4px 16px rgba(88, 166, 255, 0.1);
}

.project-card--archived {
  border-color: rgba(72, 79, 88, 0.4);
  opacity: 0.65;
}

.project-card--archived:hover {
  opacity: 1;
  border-color: rgba(72, 79, 88, 0.8);
}

.project-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.project-emoji {
  font-size: 1.6rem;
  line-height: 1;
}

.project-status {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.project-status--active {
  background: rgba(63, 185, 80, 0.15);
  color: #3fb950;
}

.project-status--paused {
  background: rgba(210, 153, 34, 0.15);
  color: #d29922;
}

.project-status--completed {
  background: rgba(88, 166, 255, 0.15);
  color: #58a6ff;
}

.project-status--archived {
  background: rgba(72, 79, 88, 0.2);
  color: #8b949e;
}

.project-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: #e6edf3;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
}

.project-goal {
  color: #8b949e;
  font-size: 0.95rem;
  line-height: 1.6;
}

.project-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 4px;
  font-size: 0.8rem;
  color: #484f58;
}

.project-horizon::before {
  content: "\23F3\00a0";
}

.project-seats::before {
  content: "\1F4BA\00a0";
}

/* ===== Ideas Pipeline & Cards ===== */

.ideas-pipeline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 48px;
  padding: 24px 0;
}

.pipeline-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 28px;
  border-radius: 12px;
  border: 2px solid #21262d;
  background: #0d1117;
  cursor: default;
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.2s;
  min-width: 110px;
}

.pipeline-stage:hover {
  transform: translateY(-3px);
}

.pipeline-stage--seed { border-color: rgba(210, 153, 34, 0.4); }
.pipeline-stage--seed:hover {
  border-color: rgba(210, 153, 34, 0.8);
  box-shadow: 0 4px 20px rgba(210, 153, 34, 0.15);
}

.pipeline-stage--research { border-color: rgba(88, 166, 255, 0.4); }
.pipeline-stage--research:hover {
  border-color: rgba(88, 166, 255, 0.8);
  box-shadow: 0 4px 20px rgba(88, 166, 255, 0.15);
}

.pipeline-stage--exploring { border-color: rgba(63, 185, 80, 0.4); }
.pipeline-stage--exploring:hover {
  border-color: rgba(63, 185, 80, 0.8);
  box-shadow: 0 4px 20px rgba(63, 185, 80, 0.15);
}

.pipeline-stage--launched { border-color: rgba(167, 139, 250, 0.4); }
.pipeline-stage--launched:hover {
  border-color: rgba(167, 139, 250, 0.8);
  box-shadow: 0 4px 20px rgba(167, 139, 250, 0.15);
}

.pipeline-emoji {
  font-size: 1.6rem;
  line-height: 1;
}

.pipeline-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pipeline-count {
  font-size: 1.1rem;
  font-weight: 700;
  color: #e6edf3;
  background: #21262d;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}

.pipeline-connector {
  width: 40px;
  height: 2px;
  background: #30363d;
  position: relative;
  flex-shrink: 0;
}

.pipeline-connector::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid #30363d;
}

.ideas-group {
  margin-bottom: 32px;
}

.ideas-group-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ideas-group-title--seed { color: #d29922; }
.ideas-group-title--research { color: #58a6ff; }
.ideas-group-title--exploring { color: #3fb950; }
.ideas-group-title--launched { color: #a78bfa; }

.ideas-group-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.idea-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  border-radius: 10px;
  border: 1px solid #21262d;
  background: #161b22;
  transition: border-color 0.25s, transform 0.2s, box-shadow 0.25s;
}

.idea-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.idea-card--seed { border-left: 3px solid #d29922; }
.idea-card--research { border-left: 3px solid #58a6ff; }
.idea-card--exploring { border-left: 3px solid #3fb950; }
.idea-card--launched { border-left: 3px solid #a78bfa; }

.idea-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.idea-card-emoji {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.idea-card-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #e6edf3;
}

.idea-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8rem;
  color: #484f58;
}

.idea-card-source { color: #6e7681; }
.idea-card-date { color: #484f58; }

/* ===== Back to Top Button ===== */
.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid #30363d;
  background: #161b22;
  color: #e6edf3;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.3s, visibility 0.3s, transform 0.3s, background 0.2s, border-color 0.2s;
  z-index: 900;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: #21262d;
  border-color: #58a6ff;
  box-shadow: 0 0 12px rgba(88, 166, 255, 0.15);
}

.back-to-top-arrow {
  display: block;
  width: 12px;
  height: 12px;
  border-left: 2px solid #e6edf3;
  border-top: 2px solid #e6edf3;
  transform: rotate(45deg) translateY(3px);
}

.back-to-top:hover .back-to-top-arrow {
  border-color: #58a6ff;
}

/* ===== Footer ===== */
.footer {
  border-top: 1px solid #21262d;
  padding: 32px 0;
  text-align: center;
  color: #484f58;
  font-size: 0.9rem;
}

/* ===== Responsive ===== */

/* --- Tablet & below (768px): hamburger menu, reduced spacing --- */
@media (max-width: 768px) {
  .nav {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: rgba(13, 17, 23, 0.97);
    padding: 16px 24px;
    gap: 16px;
    border-bottom: 1px solid #21262d;
  }

  .nav.open {
    display: flex;
  }

  .menu-toggle {
    display: flex;
  }

  /* Hamburger animation when open */
  .nav.open ~ .menu-toggle span:nth-child(1),
  .menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }

  .nav.open ~ .menu-toggle span:nth-child(2),
  .menu-toggle.active span:nth-child(2) {
    opacity: 0;
  }

  .nav.open ~ .menu-toggle span:nth-child(3),
  .menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
  }

  .hero {
    min-height: auto;
    padding: 120px 24px 64px;
  }

  .section {
    padding: 64px 0;
  }

  /* Card grids: 2 columns on tablet */
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .section-title {
    font-size: 1.6rem;
  }

  .section-desc {
    font-size: 1rem;
    margin-bottom: 32px;
  }

  /* Architecture tree: scrollable on small screens */
  .arch-tree {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
  }

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

  .arch-node {
    padding: 10px 14px;
    font-size: 0.85rem;
  }

  .arch-desc {
    font-size: 0.75rem;
  }

  .arch-children {
    margin-left: 16px;
    padding-left: 14px;
  }

  /* Tech tree: 2 columns on tablet */
  .tt-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .tt-legend {
    gap: 12px;
  }

  /* Skills: keep 2 columns on tablet */
  .skills-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .skill-card {
    padding: 20px 18px;
  }

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

  /* Ideas: wrap pipeline on tablet */
  .ideas-pipeline {
    flex-wrap: wrap;
    gap: 8px;
  }

  .pipeline-stage {
    padding: 12px 20px;
    min-width: 90px;
  }

  .pipeline-connector {
    width: 24px;
  }

  .intro-block {
    margin-bottom: 40px;
  }
}

/* --- Mobile (480px and below): single column, compact layout --- */
@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }

  .header-inner {
    padding: 0 16px;
  }

  .nav {
    padding: 16px 16px;
  }

  .hero {
    padding: 100px 16px 48px;
  }

  .hero-desc {
    font-size: 0.95rem;
  }

  .section {
    padding: 48px 0;
  }

  /* All card grids: single column */
  .card-grid,
  .card-grid-3 {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 22px 18px;
  }

  /* Architecture: hide descriptions, compact nodes */
  .arch-desc {
    display: none;
  }

  .arch-node {
    padding: 8px 12px;
    font-size: 0.8rem;
    gap: 8px;
  }

  .arch-name {
    font-size: 0.85rem;
  }

  .arch-icon {
    font-size: 1rem;
    width: 24px;
  }

  .arch-children {
    margin-left: 12px;
    padding-left: 10px;
  }

  .arch-leaf-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    margin-left: 12px;
    padding-left: 10px;
  }

  .arch-leaf {
    padding: 6px 8px;
    font-size: 0.8rem;
  }

  /* Tech tree: single column, stacked cards */
  .tt-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .tt-card {
    padding: 12px 14px;
  }

  .tt-legend {
    flex-direction: column;
    gap: 8px;
  }

  /* Skills: single column */
  .skills-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .skill-card {
    padding: 18px 16px;
  }

  /* Projects: single column */
  .projects-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .project-card {
    padding: 22px 18px;
  }

  .section-title {
    font-size: 1.4rem;
  }

  .section-desc {
    font-size: 0.95rem;
    margin-bottom: 24px;
  }

  .intro-heading {
    font-size: 1.15rem;
  }

  .intro-block {
    margin-bottom: 32px;
  }
}

/* --- Small phones (375px, iPhone SE): tightest layout --- */
@media (max-width: 375px) {
  .container {
    padding: 0 12px;
  }

  .header-inner {
    padding: 0 12px;
  }

  .hero {
    padding: 88px 12px 40px;
  }

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

  .hero-subtitle {
    font-size: 1rem;
  }

  .hero-desc {
    font-size: 0.9rem;
    line-height: 1.7;
  }

  .hero-cta {
    padding: 10px 24px;
    font-size: 0.9rem;
  }

  /* Architecture leaf grid: single column on smallest screens */
  .arch-leaf-grid {
    grid-template-columns: 1fr;
  }

  .arch-tree {
    min-width: 0;
  }

  /* Ensure text doesn't overflow */
  .card h3 {
    font-size: 1rem;
    word-break: break-word;
  }

  .card p {
    font-size: 0.9rem;
  }

  .tt-card-text {
    font-size: 0.85rem;
    word-break: break-word;
  }

  .skill-name {
    font-size: 0.95rem;
  }

  .skill-desc {
    font-size: 0.85rem;
  }

  .footer {
    font-size: 0.8rem;
    padding: 24px 0;
  }
}

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

  .reveal-children .card,
  .reveal-children .tt-card,
  .reveal-children .skill-card,
  .reveal-children .project-card,
  .reveal-children .idea-card,
  .reveal-children .arch-branch {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .card:hover,
  .tt-card:hover,
  .skill-card:hover,
  .project-card:hover,
  .idea-card:hover,
  .arch-node:hover {
    transform: none;
  }
}
