:root {
    --bg: #f9fafb;
    --text: #1f2937;
    --accent: #6366f1;
    --card: #ffffff;
    --shadow: rgba(0, 0, 0, 0.06);
    --container-max-width: 400px;
    --container-min-width: 220px;
    --container-padding: 1.5rem;
    --section-max-width: 900px;
    --gap: 2rem;
    --nav-bg: rgba(255,255,255,0.65);
    --nav-blur: blur(18px);
    --nav-radius: 14px;
    --nav-shadow: 0 2px 16px 0 rgba(0,0,0,0.13);
    --nav-height: 64px;
    --nav-padding: 0.25rem 2rem;
    --toggle-bg-light: #e5e7eb;
    --toggle-icon: #6366f1;
    --wrapper-max-width: 900px;
    --blue-accent: #2596be;
    --divider-light: #e5e7eb;
    --divider-dark: #888;
    --footer-bg-light: #f9fafb;
    --footer-bg-dark: #181a20;
    --footer-text: #fff;
    --footer-divider: #888;
    --footer-created-light: #111;
    --footer-github-light: #222;
  }
  [data-theme="dark"] {
    --bg: #181a20;
    --text: #f3f4f6;
    --accent: #8b5cf6;
    --card: #232b3a;
    --shadow: rgba(0,0,0,0.25);
    --nav-bg: rgba(36, 41, 54, 0.55);
    --toggle-bg-light: #232b3a;
    --toggle-icon: #fbbf24;
    --footer-bg-light: #181a20;
    --footer-bg-dark: #181a20;
    --footer-text: #fff;
    --footer-divider: #888;
    --footer-created-light: #fff;
    --footer-github-light: #fff;
    --divider-dark: #888;
  }
  * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }
  html, body {
    height: 100%;
  }
  body {
    font-family: 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
    transition: background 0.3s, color 0.3s;
  }
  .wrapper {
    max-width: var(--section-max-width);
    margin: 0 auto;
    padding: 0 1rem;
    width: 100%;
  }
  /* --- Navigation Bar --- */
  .nav-sticky-outer {
    height: 88px; /* Space for sticky nav to rest at the top */
    width: 100%;
    position: relative;
    z-index: 101;
  }
  .nav-sticky-inner {
    position: fixed;
    top: 24px;
    left: 0;
    width: 100vw;
    z-index: 1001;
    display: flex;
    justify-content: center;
    background: transparent;
    pointer-events: none;
  }
  .nav-resting {
    width: 100%;
    background: var(--nav-bg);
    box-shadow: var(--nav-shadow);
    border-radius: var(--nav-radius);
    max-width: var(--section-max-width);
    transition: background 0.3s;
    margin: 0 auto;
    backdrop-filter: var(--nav-blur);
    -webkit-backdrop-filter: var(--nav-blur);
    border: 1.5px solid rgba(120,120,120,0.13);
    pointer-events: auto;
  }
  .nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-width: 0;
    height: var(--nav-height);
    background: transparent;
    border-radius: var(--nav-radius);
    padding: var(--nav-padding);
    gap: 0.5rem;
  }
  .nav-logo {
    cursor: pointer;
  }
  .nav-logo img {
    height: 40px;
    width: 40px;
    border-radius: 8px;
    background: #fff;
    object-fit: cover;
    box-shadow: 0 2px 8px var(--shadow);
    display: block;
  }
  .theme-toggle-btn {
    background: var(--toggle-bg-light);
    border: none;
    outline: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px var(--shadow);
    transition: background 0.2s;
    position: relative;
  }
  .theme-toggle-btn:hover {
    background: var(--accent);
  }
  .theme-toggle-btn svg {
    width: 24px;
    height: 24px;
    fill: var(--toggle-icon);
    transition: fill 0.2s;
  }
  @media (max-width: 1000px) {
    .nav-resting {
      max-width: 98vw;
    }
    .nav-bar {
      padding: 0.25rem 0.5rem;
    }
  }
  @media (max-width: 600px) {
    .nav-resting {
      margin-left: 8px;
      margin-right: 8px;
    }
    .nav-sticky-inner {
      left: 0;
    }
  }
  /* --- End Navigation Bar --- */
  
  h1, h2 {
    text-align: center;
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
    width: 100%;
  }
  
  p, em {
    text-align: center;
    margin: 0.5rem auto 1.5rem;
    max-width: 800px;
  }
  
  a {
    color: var(--accent);
    text-decoration: none;
  }
  
  .social-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
  }
  
  .divider {
    border: none;
    border-top: 2px solid var(--divider-light);
    margin: 2.5rem auto;
    width: 90%;
    max-width: var(--section-max-width);
    transition: border-color 0.3s;
    display: block;
  }
  [data-theme="dark"] .divider {
    border-top: 2px solid var(--divider-dark) !important;
  }
  
  .section {
    padding: 0 1.5rem;
    width: 100%;
    max-width: var(--section-max-width);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  
  /* Consistent card/box style */
  .fact-card,
  .project-card,
  .tech-box,
  .github-card {
    background: var(--card);
    border-radius: 16px;
    box-shadow: 0 4px 16px var(--shadow);
    padding: var(--container-padding);
    width: 100%;
    max-width: var(--container-max-width);
    min-width: var(--container-min-width);
    margin: 0;
    transition:
      transform 0.25s cubic-bezier(.4,2,.6,1),
      box-shadow 0.25s cubic-bezier(.4,2,.6,1),
      background 0.25s;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  
  .fact-card:hover,
  .project-card:hover,
  .tech-box:hover,
  .github-card:hover {
    transform: scale(1.035);
    box-shadow: 0 0 24px 4px #6366f133, 0 8px 24px var(--shadow);
    background: #f3f4f6;
    z-index: 2;
  }
  
  /* Quick Facts */
  .quick-facts {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--gap);
    margin-top: 2rem;
    width: 100%;
    max-width: var(--section-max-width);
  }
  
  .fact-card {
    font-size: 1.1rem;
    min-height: 150px;
    justify-content: center;
  }
  
  /* Light mode: black for quick facts */
  .fact-card span,
  .fact-card p {
    display: block;
    font-size: 2.2rem;
    margin-bottom: 0.7rem;
    font-weight: 700;
    color: #111 !important;
    transition: color 0.3s;
  }
  .fact-card p {
    font-size: 1.15rem;
    color: #111 !important;
    margin: 0;
    font-weight: 500;
    letter-spacing: 0.01em;
    transition: color 0.3s;
  }
  
  /* Dark mode: white for quick facts */
  [data-theme="dark"] .fact-card span,
  [data-theme="dark"] .fact-card p {
    color: #fff !important;
  }
  /* On hover, dark mode: blue accent */
  [data-theme="dark"] .fact-card:hover span,
  [data-theme="dark"] .fact-card:hover p {
    color: var(--blue-accent) !important;
  }
  
  /* Tech Stack */
  .tech-stack-flex {
    display: flex;
    flex-wrap: nowrap;
    gap: var(--gap);
    margin-top: 1.5rem;
    width: 100%;
    max-width: var(--section-max-width);
    justify-content: center;
    align-items: stretch;
  }
  
  .tech-box {
    flex: 1 1 0;
    min-width: var(--container-min-width);
    max-width: var(--container-max-width);
    margin: 0;
    padding: var(--container-padding);
  }
  
  /* Light mode: black for tech h3 */
  .tech-box h3 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
    color: #111 !important;
    text-align: center;
    width: 100%;
    transition: color 0.3s;
  }
  /* Dark mode: white for tech h3 */
  [data-theme="dark"] .tech-box h3 {
    color: #fff !important;
  }
  /* On hover, dark mode: blue accent */
  [data-theme="dark"] .tech-box:hover h3 {
    color: var(--blue-accent) !important;
  }
  
  .badge-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
    width: 100%;
  }
  
  /* Projects Grid */
  .project-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: var(--gap);
    width: 100%;
    max-width: var(--section-max-width);
    padding: 2.5rem 0;
    justify-items: center;
    align-items: stretch;
  }
  
  .project-card {
    min-height: 340px;
    justify-content: flex-start;
    max-width: var(--container-max-width);
    min-width: var(--container-min-width);
    width: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: color 0.3s;
  }
  
  .project-card img {
    width: 100%;
    border-radius: 12px;
    margin-bottom: 1.2rem;
    object-fit: cover;
    max-height: 180px;
    min-height: 120px;
    background: #f3f4f6;
    box-shadow: 0 2px 8px var(--shadow);
  }
  
  /* Light mode: black for project h3 and p */
  .project-card h3 {
    font-size: 1.18rem;
    margin: 0.5rem 0;
    color: #111 !important;
    width: 100%;
    transition: color 0.3s;
  }
  .project-card p {
    font-size: 1.02rem;
    color: #111 !important;
    width: 100%;
    transition: color 0.3s;
  }
  /* Dark mode: white for project h3 and p */
  [data-theme="dark"] .project-card h3,
  [data-theme="dark"] .project-card p {
    color: #fff !important;
  }
  /* On hover, dark mode: blue accent */
  [data-theme="dark"] .project-card:hover h3,
  [data-theme="dark"] .project-card:hover p {
    color: var(--blue-accent) !important;
  }
  
  /* GitHub Stats */
  .github-card {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
    margin-bottom: 0;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    padding: 1rem;
  }
  
  .github-card img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    border-radius: 8px;
    object-fit: contain;
  }
  
  .github-stats-wrapper {
    width: 100%;
    max-width: var(--section-max-width);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--gap);
    align-items: center;
  }
  
  .github-card.full-width {
    width: 100%;
    max-width: calc(2 * var(--container-max-width) + var(--gap));
    min-width: 0;
    margin: 0 auto;
    padding: 1rem;
  }
  
  .github-stats-pair {
    display: flex;
    flex-direction: row;
    gap: var(--gap);
    width: 100%;
    max-width: calc(2 * var(--container-max-width) + var(--gap));
    justify-content: center;
    align-items: stretch;
  }
  
  .github-stats-pair .github-card {
    flex: 1 1 0;
    min-width: var(--container-min-width);
    max-width: var(--container-max-width);
    margin-bottom: 0;
    padding: 1rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Responsive Styles */
  @media (max-width: 1100px) {
    .section,
    .quick-facts,
    .project-grid,
    .github-stats-wrapper,
    .tech-stack-flex {
      max-width: 98vw;
    }
    .github-card.full-width,
    .github-stats-pair {
      max-width: calc(2 * var(--container-max-width) + var(--gap));
    }
    .nav-resting {
      max-width: 98vw;
    }
  }
  
  @media (max-width: 900px) {
    .quick-facts,
    .project-grid,
    .github-stats-wrapper,
    .tech-stack-flex {
      gap: 1.2rem;
      max-width: 98vw;
    }
    .github-stats-pair {
      gap: 1.2rem;
    }
  }
  
  /* Stack GitHub stats cards below 850px and fill wrapper */
  @media (max-width: 850px) {
    .tech-stack-flex,
    .project-grid,
    .quick-facts {
      flex-wrap: wrap;
      flex-direction: column;
      align-items: center;
      gap: 1.2rem;
      display: flex !important;
    }
    .github-stats-pair {
      flex-direction: column !important;
      gap: 1.2rem;
      width: 100%;
      max-width: var(--section-max-width);
      padding-left: 0;
      padding-right: 0;
      box-sizing: border-box;
      justify-content: flex-start;
      align-items: stretch;
    }
    .github-stats-pair .github-card {
      min-width: 0;
      max-width: 100%;
      flex: 1 1 100%;
      width: 100%;
    }
    .github-card.full-width {
      max-width: 100%;
    }
    .tech-box,
    .project-card,
    .fact-card {
      max-width: 100%;
      min-width: 0;
    }
    .nav-resting {
      max-width: 99vw;
    }
  }
  
  @media (max-width: 540px) {
    .section {
      padding: 0 0.2rem;
    }
    .quick-facts,
    .project-grid,
    .github-stats-wrapper,
    .tech-stack-flex {
      gap: 0.8rem;
      max-width: 99vw;
      align-items: center;
    }
    .fact-card,
    .project-card,
    .tech-box,
    .github-card {
      max-width: 99vw;
      min-width: 0;
      width: 100%;
      padding: 1rem;
    }
    .project-card {
      min-height: 0;
    }
    .project-card img {
      min-height: 80px;
      max-height: 120px;
    }
    .github-card.full-width {
      max-width: 100vw;
    }
    .github-stats-pair {
      gap: 0.5rem;
    }
    .github-stats-pair .github-card {
      min-width: 0;
      max-width: 100%;
      flex: 1 1 100%;
      width: 100%;
    }
    .project-grid {
      grid-template-columns: 1fr;
      grid-template-rows: none;
    }
    .nav-resting {
      max-width: 99vw;
    }
    .nav-sticky-inner {
      left: 0;
    }
  }
  
  /* --- Footer Styles --- */
  .footer-divider {
    border: none;
    border-top: 1.5px solid var(--footer-divider);
    margin: 0 auto;
    width: 90%;
    max-width: var(--section-max-width);
    display: block;
  }
  .footer {
    background: var(--footer-bg-light);
    color: var(--footer-text);
    width: 100%;
    padding: 2.5rem 0 1.5rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100vw;
    min-height: 90px;
    font-size: 1.1rem;
    transition: background 0.3s, color 0.3s;
    margin-top: auto;
  }
  [data-theme="dark"] .footer {
    background: var(--footer-bg-dark);
    color: var(--footer-text);
  }
  .footer .wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0 1rem;
    max-width: var(--section-max-width);
  }
  .footer-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    margin-left: 0;
  }
  .footer .footer-github {
    margin-right: 0;
    display: flex;
    align-items: center;
  }
  .footer .footer-github a {
    display: flex;
    align-items: center;
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
  }
  .footer .footer-github a:hover {
    color: var(--blue-accent);
  }
  .footer .footer-github svg {
    width: 32px;
    height: 32px;
    fill: var(--footer-github-light);
    transition: fill 0.2s;
  }
  [data-theme="dark"] .footer .footer-github svg {
    fill: #fff;
  }
  [data-theme="light"] .footer .footer-github svg {
    fill: #222;
  }
  .footer .footer-name {
    color: var(--blue-accent);
    font-weight: 600;
    margin-left: 0.2rem;
  }
  .footer .footer-created {
    font-weight: 400;
    color: var(--footer-created-light);
  }
  [data-theme="dark"] .footer .footer-created {
    color: #fff;
  }
  .footer .footer-copyright {
    font-size: 0.98rem;
    color: #ccc;
    margin-top: 0.1rem;
  }
  [data-theme="light"] .footer .footer-copyright {
    color: #444;
  }
  @media (max-width: 700px) {
    .footer .wrapper {
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 0.7rem;
    }
    .footer-content {
      align-items: center;
      text-align: center;
    }
    .footer .footer-github {
      margin-top: 0.7rem;
    }
  }