:root {
    --bg: #020617;
    --bg-alt: #02081b;
    --fg: #e5e7eb;
    --accent: #38bdf8;
    --accent2: #a855f7;
    --accent-soft: rgba(56, 189, 248, 0.16);
    --muted: #9ca3af;
    --card: #020617;
    --border-subtle: rgba(148, 163, 184, 0.45);
    --shadow-soft: 0 18px 40px rgba(15, 23, 42, 0.6);
    --radius-xl: 20px;
    --radius-2xl: 28px;
    --transition-fast: 0.18s ease-out;
    --transition-med: 0.26s ease-out;
    --font-main: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
      "Helvetica Neue", Arial, sans-serif;
  }
  
  [data-theme="light"] {
    --bg: #f9fafb;
    --bg-alt: #ffffff;
    --fg: #020617;
    --accent: #0ea5e9;
    --accent2: #8b5cf6;
    --accent-soft: rgba(14, 165, 233, 0.08);
    --muted: #6b7280;
    --card: #ffffff;
    --border-subtle: rgba(148, 163, 184, 0.65);
    --shadow-soft: 0 18px 40px rgba(15, 23, 42, 0.08);
  }
  
  * {
    box-sizing: border-box;
  }
  
  html,
  body {
    margin: 0;
    padding: 0;
    font-family: var(--font-main);
    background: radial-gradient(circle at top left, #111827 0, #020617 60%);
    color: var(--fg);
    scroll-behavior: smooth;
  }
  
  body {
    min-height: 100vh;
    background-attachment: fixed;
  }
  
  .noise {
    pointer-events: none;
    position: fixed;
    inset: 0;
    opacity: 0.15;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='noStitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
    mix-blend-mode: soft-light;
    z-index: -1;
  }
  
  header {
    position: sticky;
    top: 0;
    z-index: 40;
    backdrop-filter: blur(18px);
    background: linear-gradient(
      to bottom,
      rgba(15, 23, 42, 0.96),
      rgba(15, 23, 42, 0.76),
      transparent
    );
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  }
  
  .nav-inner {
    max-width: 1060px;
    margin: 0 auto;
    padding: 0.55rem 1.2rem 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
  }
  
  .brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
  }
  
  .brand-avatar {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.7);
    padding: 2px;
    background: conic-gradient(
      from 210deg,
      #38bdf8,
      #22c55e,
      #eab308,
      #f97316,
      #a855f7,
      #38bdf8
    );
    box-shadow: 0 0 30px rgba(56, 189, 248, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .brand-avatar-inner {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: radial-gradient(circle at top left, #1e293b, #020617);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
  }
  
  .brand-text {
    display: flex;
    flex-direction: column;
  }
  
  .brand-name {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.04em;
  }
  
  .brand-tagline {
    font-size: 0.75rem;
    color: var(--muted);
  }
  
  nav ul {
    list-style: none;
    display: flex;
    gap: 0.9rem;
    margin: 0;
    padding: 0;
    font-size: 0.84rem;
  }
  
  nav a {
    text-decoration: none;
    color: var(--muted);
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    border: 1px solid transparent;
    transition: color var(--transition-fast),
      border-color var(--transition-fast),
      background var(--transition-fast),
      transform 0.12s ease-out;
  }
  
  nav a:hover {
    color: var(--fg);
    border-color: rgba(148, 163, 184, 0.6);
    background: rgba(15, 23, 42, 0.9);
    transform: translateY(-1px);
  }
  
  .theme-toggle {
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.7);
    padding: 0.2rem 0.8rem;
    font-size: 0.8rem;
    background: rgba(15, 23, 42, 0.9);
    color: var(--fg);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: background var(--transition-fast),
      border-color var(--transition-fast), transform 0.12s ease-out;
  }
  
  .theme-toggle:hover {
    background: rgba(30, 64, 175, 0.88);
    border-color: rgba(191, 219, 254, 0.9);
    transform: translateY(-1px);
  }
  
  main {
    max-width: 1060px;
    margin: 0 auto;
    padding: 2.4rem 1.2rem 3.2rem;
  }
  
  section {
    margin-bottom: 3.4rem;
  }
  
  .hero {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2.3fr);
    gap: 2.6rem;
    align-items: center;
  }
  
  @media (max-width: 880px) {
    .hero {
      grid-template-columns: minmax(0, 1fr);
    }
  }
  
  .hero-title {
    font-size: clamp(2.1rem, 3.3vw, 2.8rem);
    font-weight: 700;
    line-height: 1.08;
    margin-bottom: 0.4rem;
  }
  
  .hero-highlight {
    background: linear-gradient(to right, #38bdf8, #a855f7, #f97316);
    -webkit-background-clip: text;
    color: transparent;
  }
  
  .hero-roles {
    font-size: 0.92rem;
    color: var(--muted);
    margin-bottom: 0.3rem;
  }
  
  .hero-rotator {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(15, 23, 42, 0.9);
    border-radius: 999px;
    padding: 0.25rem 0.8rem;
    border: 1px solid rgba(148, 163, 184, 0.7);
    font-size: 0.78rem;
    margin-bottom: 1rem;
  }
  
  .hero-rotator-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #22c55e;
    box-shadow: 0 0 12px rgba(22, 163, 74, 0.95);
  }
  
  .hero-subtitle {
    font-size: 0.95rem;
    color: var(--muted);
    line-height: 1.5;
    margin-bottom: 1.2rem;
  }
  
  .hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
  }
  
  .btn-primary,
  .btn-ghost {
    border-radius: 999px;
    padding: 0.55rem 1.2rem;
    font-size: 0.85rem;
    border: 1px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
    transition: transform var(--transition-fast),
      box-shadow var(--transition-fast), background var(--transition-fast),
      border-color var(--transition-fast), color var(--transition-fast);
  }
  
  .btn-primary {
    background: linear-gradient(135deg, #38bdf8, #a855f7);
    color: #020617;
    box-shadow: 0 18px 40px rgba(56, 189, 248, 0.35);
    font-weight: 600;
  }
  
  .btn-primary:hover {
    transform: translateY(-1px) translateX(0.5px);
    box-shadow: 0 20px 45px rgba(56, 189, 248, 0.45);
    background: linear-gradient(135deg, #22c55e, #a855f7);
  }
  
  .btn-ghost {
    border-color: rgba(148, 163, 184, 0.8);
    background: rgba(15, 23, 42, 0.9);
    color: var(--fg);
  }
  
  .btn-ghost:hover {
    background: rgba(30, 64, 175, 0.9);
    border-color: rgba(191, 219, 254, 0.9);
    transform: translateY(-1px);
  }
  
  .hero-meta {
    font-size: 0.78rem;
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
  }
  
  .hero-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px dashed rgba(148, 163, 184, 0.75);
  }
  
  .hero-card {
    border-radius: var(--radius-2xl);
    border: 1px solid rgba(148, 163, 184, 0.45);
    background: radial-gradient(circle at top, #0b1120, #020617);
    padding: 1.1rem;
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
  }
  
  .hero-card-orbit {
    position: absolute;
    inset: -40%;
    background:
      radial-gradient(circle at 10% 0%, rgba(56, 189, 248, 0.18), transparent 60%),
      radial-gradient(circle at 90% 100%, rgba(168, 85, 247, 0.22), transparent 60%);
    opacity: 0.9;
    mix-blend-mode: screen;
    pointer-events: none;
  }
  
  .hero-card-inner {
    position: relative;
    z-index: 2;
  }
  
  .hero-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.7rem;
    gap: 1rem;
  }
  
  .hero-card-title {
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
  }
  
  .hero-card-tagline {
    font-size: 0.75rem;
    color: var(--muted);
  }
  
  .hero-card-pill {
    font-size: 0.7rem;
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: rgba(15, 23, 42, 0.9);
    color: var(--muted);
  }
  
  .constellation {
    margin-top: 0.4rem;
    border-radius: 16px;
    border: 1px dashed rgba(148, 163, 184, 0.7);
    padding: 0.7rem;
    background: rgba(15, 23, 42, 0.96);
    font-size: 0.75rem;
  }
  
  .hero-bottom-text {
    margin: 0.5rem 0 0;
    font-size: 0.75rem;
    color: var(--muted);
  }
  
  .chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.35rem;
  }
  
  .chip {
    font-size: 0.7rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(148, 163, 184, 0.65);
    color: var(--muted);
    white-space: nowrap;
  }
  
  .badge-soft {
    font-size: 0.68rem;
    padding: 0.22rem 0.6rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid rgba(56, 189, 248, 0.6);
  }
  
  .section-kicker {
    font-size: 0.75rem;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.2rem;
  }
  
  .section-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
  }
  
  .section-subtitle {
    font-size: 0.9rem;
    color: var(--muted);
    margin-bottom: 1.2rem;
    max-width: 640px;
  }
  
  /* Experience */
  .experience-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 2.5fr);
    gap: 2.1rem;
  }
  
  @media (max-width: 880px) {
    .experience-grid {
      grid-template-columns: minmax(0, 1fr);
    }
  }
  
  .timeline {
    border-left: 1px solid rgba(148, 163, 184, 0.55);
    padding-left: 1rem;
    position: relative;
  }
  
  .timeline::before {
    content: "";
    position: absolute;
    left: -3px;
    top: 0;
    height: 16px;
    width: 6px;
    border-radius: 999px;
    background: #38bdf8;
    box-shadow: 0 0 18px rgba(56, 189, 248, 0.85);
  }
  
  .timeline-item {
    position: relative;
    padding: 0.45rem 0 0.45rem 0.4rem;
    cursor: pointer;
    border-radius: 10px;
    transition: background var(--transition-fast),
      transform var(--transition-fast);
  }
  
  .timeline-item:hover {
    background: rgba(15, 23, 42, 0.85);
    transform: translateX(2px);
  }
  
  .timeline-item::before {
    content: "";
    position: absolute;
    left: -1.4rem;
    top: 0.7rem;
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #020617;
    border: 2px solid rgba(148, 163, 184, 0.9);
  }
  
  .timeline-item.active::before {
    background: #38bdf8;
    border-color: rgba(56, 189, 248, 0.9);
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.9);
  }
  
  .timeline-role {
    font-size: 0.9rem;
    font-weight: 600;
  }
  
  .timeline-meta {
    font-size: 0.78rem;
    color: var(--muted);
  }
  
  .experience-detail {
    border-radius: var(--radius-xl);
    background: var(--bg-alt);
    border: 1px solid var(--border-subtle);
    padding: 1rem;
    box-shadow: var(--shadow-soft);
    font-size: 0.86rem;
  }
  
  .experience-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.55rem;
  }
  
  .experience-detail-title {
    font-weight: 600;
  }
  
  .experience-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.5rem;
    margin-bottom: 0.4rem;
  }
  
  .experience-detail-list {
    margin: 0.5rem 0 0.2rem;
    padding-left: 1.1rem;
    color: var(--muted);
  }
  
  .experience-detail-list li {
    margin-bottom: 0.3rem;
  }
  
  .pill-award {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.72rem;
    padding: 0.22rem 0.6rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px dashed rgba(248, 250, 252, 0.3);
    margin: 0.1rem 0.1rem 0.1rem 0;
    color: var(--muted);
  }
  
  /* Projects */
  .projects-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.9rem;
    flex-wrap: wrap;
  }
  
  .filter-group {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    font-size: 0.78rem;
  }
  
  .filter-chip {
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.75);
    cursor: pointer;
    color: var(--muted);
    background: rgba(15, 23, 42, 0.92);
    transition: background var(--transition-fast),
      color var(--transition-fast), transform var(--transition-fast),
      border-color var(--transition-fast);
  }
  
  .filter-chip.active {
    background: linear-gradient(to right, #38bdf8, #a855f7);
    color: #020617;
    border-color: transparent;
    transform: translateY(-1px);
  }
  
  .project-grid {
    margin-top: 1.4rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.4rem;
  }
  
  .project-card {
    position: relative;
    perspective: 1000px;
    height: 270px;    /* more room for text */
    overflow: hidden; /* avoids overlap into next section */
  }
  
  .project-inner {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: var(--radius-xl);
    transform-style: preserve-3d;
    transition: transform 0.7s cubic-bezier(0.25, 0.85, 0.45, 1.1);
    cursor: pointer;
  }
  
  .project-card:hover .project-inner {
    transform: rotateY(180deg);
  }
  
  .project-face {
    position: absolute;
    inset: 0;
    border-radius: var(--radius-xl);
    backface-visibility: hidden;
    border: 1px solid var(--border-subtle);
    background: radial-gradient(circle at top, #111827, #020617);
    padding: 0.9rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: var(--shadow-soft);
  }
  
  .project-back {
    transform: rotateY(180deg);
    background: radial-gradient(circle at bottom, #020617, #020617);
  }
  
  .project-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
  }
  
  .project-meta {
    font-size: 0.78rem;
    color: var(--muted);
    margin-bottom: 0.45rem;
  }
  
  .project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.45rem;
  }
  
  .project-tag {
    font-size: 0.68rem;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.8);
    color: var(--muted);
  }
  
  .project-link {
    font-size: 0.75rem;
    color: var(--accent);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.4rem;
  }
  
  /* Skills */
  .skills-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(0, 1.7fr);
    gap: 1.6rem;
  }
  
  @media (max-width: 880px) {
    .skills-grid {
      grid-template-columns: minmax(0, 1fr);
    }
  }
  
  .skill-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
  }
  
  .skill-chip {
    font-size: 0.75rem;
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.8);
    cursor: pointer;
    background: rgba(15, 23, 42, 0.92);
    color: var(--muted);
    transition: background var(--transition-fast),
      color var(--transition-fast), transform var(--transition-fast);
  }
  
  .skill-chip.active {
    background: linear-gradient(135deg, #38bdf8, #a855f7);
    color: #020617;
    transform: translateY(-1px);
  }
  
  .skill-detail {
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-subtle);
    background: var(--bg-alt);
    padding: 0.9rem;
    font-size: 0.85rem;
    box-shadow: var(--shadow-soft);
  }
  
  .skill-detail-title {
    font-weight: 600;
    margin-bottom: 0.35rem;
  }
  
  /* Fun panel */
  .fun-panel {
    border-radius: var(--radius-xl);
    border: 1px dashed var(--border-subtle);
    background: var(--bg-alt);
    padding: 1rem;
    font-size: 0.85rem;
    display: grid;
    grid-template-columns: minmax(0, 2.3fr) minmax(0, 1.7fr);
    gap: 1.3rem;
    align-items: center;
  }
  
  @media (max-width: 800px) {
    .fun-panel {
      grid-template-columns: minmax(0, 1fr);
    }
  }
  
  .fun-fact-display {
    font-size: 0.9rem;
    color: var(--muted);
    margin-bottom: 0.7rem;
    min-height: 1.8em;
  }
  
  .btn-fun {
    margin-top: 0.3rem;
    font-size: 0.8rem;
    padding: 0.45rem 0.95rem;
  }
  
  .fun-aside {
    font-size: 0.8rem;
    color: var(--muted);
  }
  
  /* Contact */
  .contact-card {
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-subtle);
    background: var(--bg-alt);
    padding: 1rem;
    display: grid;
    grid-template-columns: minmax(0, 2.1fr) minmax(0, 1.6fr);
    gap: 1.4rem;
    font-size: 0.85rem;
  }
  
  @media (max-width: 800px) {
    .contact-card {
      grid-template-columns: minmax(0, 1fr);
    }
  }
  
  .contact-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.65rem;
  }
  
  .contact-label {
    font-size: 0.8rem;
    color: var(--muted);
  }
  
  .contact-value {
    font-size: 0.9rem;
  }
  
  .contact-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
  }
  
  .contact-links a {
    font-size: 0.8rem;
    color: var(--accent);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
  }
  
  .contact-cta {
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 0.5rem;
  }
  
  .copy-email {
    font-size: 0.8rem;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.8);
    background: rgba(15, 23, 42, 0.92);
    color: var(--fg);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: background var(--transition-fast),
      border-color var(--transition-fast), transform var(--transition-fast);
  }
  
  .copy-email:hover {
    background: rgba(30, 64, 175, 0.9);
    border-color: rgba(191, 219, 254, 0.9);
    transform: translateY(-1px);
  }
  
  footer {
    border-top: 1px solid rgba(148, 163, 184, 0.3);
    padding: 1.2rem 1.2rem 2rem;
    font-size: 0.75rem;
    color: var(--muted);
    text-align: center;
  }
  
  @media (max-width: 720px) {
    .nav-inner {
      flex-wrap: wrap;
      justify-content: center;
    }
  
    nav ul {
      order: 3;
      justify-content: center;
    }
  
    .brand {
      order: 1;
    }
  
    .theme-toggle {
      order: 2;
    }
  }
  
  @media (max-width: 600px) {
    .project-card {
      height: 320px; /* extra room for wrapped text on mobile */
    }
  }
  
