:root {
  --bg: #090d16;
  --bg-elev: #0f172a;
  --bg-card: rgba(17, 24, 39, 0.72);
  --bg-card-hover: rgba(26, 36, 56, 0.88);
  --bg-soft: #162033;
  --bg-input: rgba(15, 23, 42, 0.75);
  --line: rgba(148, 163, 184, 0.14);
  --line-strong: rgba(148, 163, 184, 0.28);
  --line-highlight: rgba(129, 140, 248, 0.45);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-faint: #64748b;
  --brand: #6366f1;
  --brand-light: #818cf8;
  --brand-2: #06b6d4;
  --brand-2-light: #22d3ee;
  --accent-purple: #a855f7;
  --ok: #10b981;
  --warn: #f59e0b;
  --radius: 16px;
  --radius-lg: 24px;
  --radius-sm: 8px;
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow: 0 20px 45px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 35px rgba(99, 102, 241, 0.18);
  --max: 1180px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 16px; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 600px at 15% -10%, rgba(99, 102, 241, 0.22), transparent 60%),
    radial-gradient(900px 520px at 85% 5%, rgba(6, 182, 212, 0.14), transparent 55%),
    radial-gradient(800px 600px at 50% 45%, rgba(168, 85, 247, 0.06), transparent 65%);
  background-attachment: fixed;
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--brand-light);
  text-decoration: none;
  transition: color 0.18s ease;
}
a:hover { color: #c7d2fe; }
img, video { max-width: 100%; display: block; }

.container {
  width: min(100% - 2.5rem, var(--max));
  margin-inline: auto;
}

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  background: rgba(9, 13, 22, 0.78);
  border-bottom: 1px solid var(--line);
  transition: border-color 0.2s;
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.2rem; padding: 0.85rem 0;
}
.brand {
  display: flex; align-items: center; gap: 0.75rem;
  color: var(--text); font-weight: 700; letter-spacing: 0.01em;
}
.brand img {
  width: 32px; height: 32px;
  filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.45));
}
.brand span { font-size: 1rem; font-weight: 700; }
.brand .badge {
  font-size: 0.75rem; font-weight: 500;
  padding: 0.2rem 0.55rem; border-radius: 999px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(129, 140, 248, 0.3);
  color: #c7d2fe;
}
.nav-links {
  display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end;
}
.nav-links a {
  color: var(--text-muted); padding: 0.42rem 0.75rem; border-radius: 999px;
  font-size: 0.9rem; font-weight: 500; transition: all 0.16s ease;
}
.nav-links a:hover, .nav-links a.active {
  color: var(--text);
  background: rgba(129, 140, 248, 0.14);
}
.nav-actions {
  display: flex; align-items: center; gap: 0.6rem;
}

/* Status Pill */
.status-pill {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-size: 0.78rem; font-weight: 600;
  color: #34d399; background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 0.25rem 0.65rem; border-radius: 999px;
}
.status-pill .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulse-dot 2s infinite ease-in-out;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* Hero Section */
.hero {
  padding: 4.5rem 0 3.2rem;
  position: relative;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.85fr;
  gap: 3rem;
  align-items: center;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 0.5rem;
  color: var(--brand-2-light); font-size: 0.86rem; font-weight: 600;
  background: rgba(6, 182, 212, 0.1); border: 1px solid rgba(34, 211, 238, 0.28);
  padding: 0.35rem 0.85rem; border-radius: 999px; margin-bottom: 1.2rem;
  letter-spacing: 0.01em;
}
.hero h1 {
  font-size: clamp(2.1rem, 3.8vw, 3.1rem);
  line-height: 1.22;
  margin: 0 0 1.1rem;
  letter-spacing: -0.025em;
  font-weight: 800;
  color: #ffffff;
}
.gradient-text {
  background: linear-gradient(130deg, #818cf8 15%, #22d3ee 85%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: inline-block;
}
.lead {
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.7;
  margin: 0 0 1.6rem;
  max-width: 42rem;
}
.lead strong {
  color: #e2e8f0;
}
.hero-actions {
  display: flex; flex-wrap: wrap; gap: 0.85rem; margin-bottom: 1.8rem;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  padding: 0.72rem 1.25rem; border-radius: 999px; font-weight: 600; font-size: 0.94rem;
  border: 1px solid transparent; transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer; user-select: none;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-primary {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(79, 70, 229, 0.35);
}
.btn-primary:hover {
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(79, 70, 229, 0.45);
  filter: brightness(1.08);
}
.btn-ghost {
  background: rgba(15, 23, 42, 0.6);
  color: var(--text);
  border-color: var(--line-strong);
  backdrop-filter: blur(10px);
}
.btn-ghost:hover {
  border-color: var(--brand-light);
  color: #ffffff;
  background: rgba(129, 140, 248, 0.12);
  transform: translateY(-2px);
}
.btn-sm {
  padding: 0.45rem 0.9rem; font-size: 0.84rem;
}

/* Meta Info Row */
.meta-chips {
  display: flex; flex-wrap: wrap; gap: 0.55rem;
}
.meta-chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--line);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.83rem;
  color: var(--text-muted);
}
.meta-chip strong {
  color: #e2e8f0; font-weight: 600;
}
.meta-chip a {
  color: inherit;
}
.meta-chip a:hover {
  color: var(--brand-light);
}

/* Hero Profile Card */
.hero-card {
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.65) 0%, rgba(15, 23, 42, 0.88) 100%);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  box-shadow: var(--shadow), var(--shadow-glow);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
}
.hero-card::before {
  content: "";
  position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
  background: radial-gradient(circle at 50% 20%, rgba(99, 102, 241, 0.12), transparent 50%);
  pointer-events: none;
}
.avatar-wrap {
  display: flex; align-items: center; gap: 1.1rem; margin-bottom: 1.4rem;
  position: relative;
}
.avatar-wrap img {
  width: 72px; height: 72px; border-radius: 20px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  border: 2px solid rgba(129, 140, 248, 0.35);
}
.avatar-wrap h2 {
  margin: 0; font-size: 1.4rem; font-weight: 700; color: #fff;
}
.avatar-wrap p {
  margin: 0.25rem 0 0; color: var(--text-muted); font-size: 0.88rem;
}
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
  position: relative;
}
.stat {
  background: rgba(11, 18, 33, 0.7);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.85rem 0.95rem;
  transition: all 0.2s ease;
}
.stat:hover {
  border-color: rgba(129, 140, 248, 0.4);
  background: rgba(17, 27, 49, 0.85);
  transform: translateY(-2px);
}
.stat-top {
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.4rem;
}
.stat b {
  display: block; font-size: 1.35rem; color: #ffffff;
  letter-spacing: -0.02em; font-weight: 700;
  line-height: 1.2;
}
.stat .badge-mini {
  font-size: 0.68rem; font-weight: 600;
  padding: 0.12rem 0.42rem; border-radius: 999px;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
}
.stat .badge-mini.ok {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
}
.stat .badge-mini.warn {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
}
.stat .badge-mini.cyan {
  background: rgba(6, 182, 212, 0.15);
  color: #67e8f9;
}
.stat span {
  display: block;
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-top: 0.3rem;
  line-height: 1.35;
}

/* Sections */
section { padding: 3.8rem 0; position: relative; }
.section-head {
  margin-bottom: 2rem;
  position: relative;
}
.section-eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand-light);
  margin-bottom: 0.35rem;
}
.section-head h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.6rem, 2.6vw, 2.1rem);
  letter-spacing: -0.02em;
  font-weight: 700;
  color: #ffffff;
}
.section-head p {
  margin: 0; color: var(--text-muted); max-width: 44rem;
  font-size: 0.98rem;
}
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
  border: 0; margin: 0;
}

/* Core Strengths (Pillars) */
.strengths-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
}
.strength-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem 1.4rem;
  position: relative;
  transition: all 0.22s ease;
  display: flex;
  flex-direction: column;
}
.strength-card::before {
  content: "";
  position: absolute; top: 0; left: 15%; right: 15%; height: 2px;
  background: linear-gradient(90deg, transparent, var(--brand-light), transparent);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.strength-card:hover {
  border-color: rgba(129, 140, 248, 0.45);
  background: var(--bg-card-hover);
  transform: translateY(-4px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
}
.strength-card:hover::before { opacity: 1; }
.strength-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(129, 140, 248, 0.25);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1.1rem;
  color: #a5b4fc;
}
.strength-card:nth-child(2) .strength-icon {
  background: rgba(6, 182, 212, 0.12);
  border-color: rgba(34, 211, 238, 0.25);
  color: #67e8f9;
}
.strength-card:nth-child(3) .strength-icon {
  background: rgba(168, 85, 247, 0.12);
  border-color: rgba(192, 132, 252, 0.25);
  color: #d8b4fe;
}
.strength-icon svg { width: 22px; height: 22px; }
.strength-card h3 {
  margin: 0 0 0.55rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
}
.strength-card p {
  margin: 0 0 1.1rem;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.6;
  flex-grow: 1;
}
.strength-tags {
  display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: auto;
}
.tech-pill {
  font-size: 0.72rem; font-weight: 500;
  padding: 0.2rem 0.55rem; border-radius: 999px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--line);
  color: #cbd5e1;
}

/* Featured Projects */
.project-tier-title {
  display: flex; align-items: center; gap: 0.6rem;
  font-size: 1.15rem; font-weight: 700; color: #e2e8f0;
  margin: 2.2rem 0 1.2rem;
}
.project-tier-title:first-of-type { margin-top: 0; }
.project-tier-title span.tag-pill {
  font-size: 0.72rem; font-weight: 600;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(129, 140, 248, 0.25);
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
}

/* Flagship Cards (Grid of 3) */
.flagship-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}
.flagship-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
}
.flagship-card:hover {
  border-color: rgba(129, 140, 248, 0.45);
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45), 0 0 25px rgba(99, 102, 241, 0.12);
}
.project-thumb {
  position: relative;
  aspect-ratio: 16 / 9.5;
  background: #020617;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.project-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: transform 0.35s ease;
}
.flagship-card:hover .project-thumb img {
  transform: scale(1.04);
}
.thumb-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(9, 13, 22, 0.1) 0%, rgba(9, 13, 22, 0.75) 100%);
  pointer-events: none;
}
.thumb-tag {
  position: absolute; top: 0.75rem; left: 0.75rem;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.03em;
  padding: 0.22rem 0.55rem; border-radius: 999px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.thumb-tag.purple {
  background: rgba(99, 102, 241, 0.85); color: #fff;
}
.thumb-tag.cyan {
  background: rgba(6, 182, 212, 0.85); color: #fff;
}
.thumb-tag.amber {
  background: rgba(217, 119, 6, 0.85); color: #fff;
}

.flagship-body {
  padding: 1.25rem 1.25rem 1.4rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}
.flagship-meta {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem; margin-bottom: 0.45rem;
}
.flagship-meta time {
  font-size: 0.78rem; font-family: var(--mono); color: var(--text-faint);
}
.flagship-body h3 {
  margin: 0 0 0.3rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: #ffffff;
}
.flagship-role {
  color: var(--brand-light);
  font-size: 0.85rem;
  font-weight: 500;
  margin: 0 0 0.85rem;
}
.highlight-badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(129, 140, 248, 0.25);
  border-radius: 8px;
  padding: 0.4rem 0.65rem;
  font-size: 0.82rem;
  color: #c7d2fe;
  font-weight: 600;
  margin-bottom: 0.9rem;
}
.highlight-badge.cyan {
  background: rgba(6, 182, 212, 0.1);
  border-color: rgba(34, 211, 238, 0.25);
  color: #a5f3fc;
}
.highlight-badge.amber {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(251, 191, 36, 0.25);
  color: #fde68a;
}
.project-points {
  margin: 0 0 1.1rem;
  padding-left: 1.15rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.6;
  flex-grow: 1;
}
.project-points li { margin: 0.35rem 0; }
.project-points strong { color: #f1f5f9; }

.tech-stack-row {
  display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 1.1rem;
}
.card-actions {
  display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: auto;
}

/* Secondary Projects (Grid of 2) */
.secondary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}
.secondary-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  transition: all 0.22s ease;
  box-shadow: var(--shadow-sm);
}
.secondary-card:hover {
  border-color: rgba(129, 140, 248, 0.45);
  transform: translateY(-3px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
}
.secondary-thumb {
  position: relative;
  background: #020617;
  overflow: hidden;
  border-right: 1px solid var(--line);
  height: 100%; min-height: 200px;
}
.secondary-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  object-position: top center;
  transition: transform 0.35s ease;
}
.secondary-card:hover .secondary-thumb img {
  transform: scale(1.04);
}
.secondary-body {
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
}
.secondary-body h3 {
  margin: 0 0 0.25rem;
  font-size: 1.12rem;
  font-weight: 700;
  color: #fff;
}
.secondary-body .flagship-role {
  margin-bottom: 0.6rem;
}
.secondary-body .project-points {
  font-size: 0.85rem;
  margin-bottom: 0.9rem;
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 2rem;
  margin-left: 0.5rem;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 6px; top: 0.8rem; bottom: 1.2rem;
  width: 2px;
  background: linear-gradient(180deg, var(--brand-light) 0%, rgba(99, 102, 241, 0.15) 90%, transparent 100%);
}
.tl-item {
  position: relative;
  padding: 0 0 2.2rem 1.4rem;
}
.tl-item:last-child {
  padding-bottom: 0.5rem;
}
.tl-item::before {
  content: "";
  position: absolute;
  left: -2rem; top: 0.35rem;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--brand-light);
  box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.2);
  transition: all 0.2s ease;
}
.tl-item.current::before {
  background: #10b981;
  border-color: #34d399;
  box-shadow: 0 0 0 5px rgba(16, 185, 129, 0.25);
  animation: pulse-dot 2s infinite ease-in-out;
}
.tl-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.tl-org {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
}
.tl-role {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--brand-light);
  margin-left: 0.5rem;
}
.tl-date {
  font-size: 0.82rem;
  font-family: var(--mono);
  color: var(--text-faint);
  background: rgba(15, 23, 42, 0.65);
  padding: 0.18rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--line);
}
.tl-body {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.65;
}
.tl-body p { margin: 0 0 0.5rem; }
.tl-projects-ref {
  display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.6rem;
}
.tl-projects-ref a {
  font-size: 0.78rem; font-weight: 500;
  padding: 0.2rem 0.55rem; border-radius: 6px;
  background: rgba(129, 140, 248, 0.1);
  border: 1px solid rgba(129, 140, 248, 0.2);
  color: #c7d2fe;
}
.tl-projects-ref a:hover {
  background: rgba(129, 140, 248, 0.2);
  border-color: var(--brand-light);
}

/* Skills Matrix */
.skills-categories {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}
.skill-category-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem;
  transition: all 0.2s ease;
}
.skill-category-card:hover {
  border-color: rgba(129, 140, 248, 0.35);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}
.skill-category-head {
  display: flex; align-items: center; gap: 0.6rem;
  margin-bottom: 0.9rem;
}
.skill-category-head h3 {
  margin: 0; font-size: 1.05rem; font-weight: 700; color: #ffffff;
}
.skill-category-head .cat-icon {
  width: 28px; height: 28px; border-radius: 8px;
  background: rgba(99, 102, 241, 0.15);
  display: flex; align-items: center; justify-content: center;
  color: #818cf8; font-size: 0.9rem;
}
.skill-pills-wrap {
  display: flex; flex-wrap: wrap; gap: 0.45rem;
}
.skill-pill {
  display: inline-flex; align-items: center; gap: 0.35rem;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--line);
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
  font-size: 0.84rem;
  color: #e2e8f0;
  transition: all 0.15s ease;
}
.skill-pill:hover {
  border-color: var(--brand-light);
  color: #ffffff;
  background: rgba(99, 102, 241, 0.12);
}
.skill-pill.featured {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(129, 140, 248, 0.3);
  color: #c7d2fe;
  font-weight: 600;
}

/* Open Source Card */
.open-source-card {
  margin-top: 1.25rem;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.85));
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: var(--radius);
  padding: 1.4rem;
}
.open-source-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap;
}
.open-source-head h3 {
  margin: 0; font-size: 1.1rem; font-weight: 700; color: #fff;
  display: flex; align-items: center; gap: 0.5rem;
}
.open-source-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.os-item {
  background: rgba(11, 18, 33, 0.75);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.95rem 1rem;
  transition: all 0.2s ease;
}
.os-item:hover {
  border-color: rgba(129, 140, 248, 0.4);
  transform: translateY(-2px);
}
.os-item h4 {
  margin: 0 0 0.35rem; font-size: 0.94rem; color: #ffffff;
  display: flex; align-items: center; justify-content: space-between;
}
.os-item p {
  margin: 0; color: var(--text-muted); font-size: 0.82rem; line-height: 1.5;
}

/* Contact & CTA Section */
.cta-box {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(6, 182, 212, 0.08));
  border: 1px solid rgba(129, 140, 248, 0.25);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-glow);
}
.cta-box h2 {
  font-size: 1.8rem; margin: 0 0 0.6rem; color: #fff;
}
.cta-box p {
  color: var(--text-muted); max-width: 38rem; margin: 0 auto 1.8rem;
  font-size: 1rem;
}
.cta-contacts {
  display: flex; justify-content: center; flex-wrap: wrap; gap: 0.8rem;
  margin-bottom: 1.8rem;
}
.contact-badge {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.55rem 1rem; border-radius: 999px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--line-strong);
  color: #e2e8f0; font-size: 0.9rem;
  transition: all 0.18s ease;
  cursor: pointer;
}
.contact-badge:hover {
  border-color: var(--brand-light);
  color: #ffffff;
  background: rgba(99, 102, 241, 0.15);
  transform: translateY(-2px);
}
.cta-actions {
  display: flex; justify-content: center; gap: 0.85rem; flex-wrap: wrap;
}

/* Copy Toast */
#toast {
  position: fixed; bottom: 2rem; right: 2rem; z-index: 100;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399; padding: 0.65rem 1.15rem;
  border-radius: 999px; font-size: 0.88rem; font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  opacity: 0; pointer-events: none;
  transform: translateY(10px);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
#toast.show {
  opacity: 1; pointer-events: auto; transform: translateY(0);
}

/* Project subpage styles (retained & polished) */
.page-hero { padding: 2.6rem 0 1.4rem; }
.page-hero .crumbs { color: var(--text-faint); font-size: 0.85rem; margin-bottom: 0.8rem; }
.page-hero .crumbs a { color: var(--text-muted); }
.page-hero h1 { margin: 0 0 0.5rem; font-size: clamp(1.6rem, 3vw, 2.2rem); color: #fff; }
.page-hero .lead { margin-bottom: 1rem; }
.metrics { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1rem 0 0; }
.metric {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px;
  padding: 0.65rem 0.9rem; min-width: 7.5rem;
}
.metric b { display: block; font-size: 1.15rem; color: #fff; }
.metric span { color: var(--text-faint); font-size: 0.75rem; }

.panel {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem; margin: 1rem 0 1.5rem; box-shadow: var(--shadow);
}
.panel-head { display: flex; justify-content: space-between; gap: 1rem; align-items: center; margin-bottom: 0.8rem; flex-wrap: wrap; }
.panel-head h2 { margin: 0; font-size: 1.15rem; color: #fff; }
.note {
  color: var(--text-faint); font-size: 0.82rem; background: rgba(148, 163, 184, 0.06);
  border: 1px dashed var(--line); border-radius: 10px; padding: 0.65rem 0.8rem; margin: 0.6rem 0 0;
}

/* iframe frames */
.frame-desktop {
  width: 100%; height: min(78vh, 820px); border: 0; border-radius: 12px; background: #020617;
}
.phone-wrap { display: flex; justify-content: center; padding: 0.5rem 0 0.2rem; }
.phone {
  width: 390px; max-width: 100%; background: #020617; border-radius: 36px; padding: 12px;
  border: 2px solid #334155; box-shadow: var(--shadow); position: relative;
}
.phone::before {
  content: ""; position: absolute; top: 18px; left: 50%; transform: translateX(-50%);
  width: 96px; height: 18px; background: #0f172a; border-radius: 999px; z-index: 2;
}
.phone iframe { width: 100%; height: 760px; border: 0; border-radius: 26px; background: #fff; }
.phone video {
  display: block; width: 100%; height: 760px; border: 0; border-radius: 26px;
  background: #000; object-fit: contain; object-position: center top;
}
.phone-media .phone-figure { margin: 0; text-align: center; }
.phone-media .phone-figure figcaption {
  margin-top: 0.7rem; color: var(--text-muted); font-size: 0.82rem;
}

/* Gallery */
.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.9rem; align-items: start; }
.gallery figure {
  margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  align-self: start;
}
.gallery img, .gallery video { display: block; width: 100%; height: auto; }
.gallery figcaption { padding: 0.55rem 0.75rem; color: #475569; font-size: 0.8rem; border-top: 1px solid #e2e8f0; background: #fff; }
.gallery.wide { grid-template-columns: 1fr; }
.gallery.triple { grid-template-columns: repeat(3, 1fr); }
.gallery.phones { grid-template-columns: repeat(3, 1fr); }
.gallery.phones figure img {
  max-height: 440px; width: 100%; object-fit: contain; object-position: top center; background: #f8fafc;
}

.tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.9rem; }
.tab {
  border: 1px solid var(--line); background: transparent; color: var(--text-muted);
  border-radius: 999px; padding: 0.4rem 0.85rem; cursor: pointer; font: inherit; font-size: 0.88rem;
}
.tab.active, .tab:hover { color: var(--text); border-color: var(--brand); background: rgba(129, 140, 248, 0.12); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.prose { color: var(--text-muted); }
.prose h3 { color: #fff; margin: 1.4rem 0 0.5rem; font-size: 1.05rem; }
.prose ul { padding-left: 1.15rem; }
.prose li { margin: 0.3rem 0; }

footer {
  border-top: 1px solid var(--line); padding: 2.5rem 0 3.2rem; margin-top: 2rem;
  color: var(--text-faint); font-size: 0.86rem;
}
footer .footer-grid { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: center; }
footer a { color: var(--text-muted); }
footer a:hover { color: var(--brand-light); }

/* Responsive */
@media (max-width: 1024px) {
  .hero-grid { grid-template-columns: 1fr; gap: 2.5rem; }
  .flagship-grid { grid-template-columns: 1fr; }
  .strengths-grid { grid-template-columns: 1fr; }
  .skills-categories { grid-template-columns: 1fr; }
  .open-source-grid { grid-template-columns: 1fr; }
  .secondary-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .secondary-card { grid-template-columns: 1fr; }
  .secondary-thumb { min-height: 180px; border-right: 0; border-bottom: 1px solid var(--line); }
  .gallery, .gallery.triple, .gallery.phones { grid-template-columns: 1fr; }
  .hero { padding: 3rem 0 2rem; }
  .phone iframe, .phone video { height: 600px; }
  .frame-desktop { height: 65vh; }
  .nav-links { display: none; }
}

@media (max-width: 640px) {
  .brand .badge { display: none; }
  .nav-actions button { display: none; }
  .status-pill { font-size: 0.72rem; padding: 0.2rem 0.5rem; }
  .hero-actions .btn { width: 100%; }
}

/* Print Optimization (Clean A4 Paper Output for Ctrl+P) */
@media print {
  body {
    background: #ffffff !important;
    color: #1f2328 !important;
    font-size: 10pt;
    line-height: 1.45;
  }
  .nav, footer, .hero-actions, .cta-box, .card-actions, .status-pill, .thumb-overlay {
    display: none !important;
  }
  .container { width: 100% !important; max-width: none !important; padding: 0 !important; }
  .hero-card, .strength-card, .flagship-card, .secondary-card, .skill-category-card, .os-item {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: none !important;
    break-inside: avoid;
    color: #1f2328 !important;
  }
  h1, h2, h3, h4, .stat b, .tl-org { color: #0f172a !important; }
  .lead, .tl-body, p, li { color: #334155 !important; }
  .gradient-text { -webkit-text-fill-color: initial !important; color: #1e3a8a !important; }
  .tech-pill, .skill-pill, .meta-chip {
    border: 1px solid #cbd5e1 !important;
    background: #f8fafc !important;
    color: #334155 !important;
  }
}
