:root {
  /* Dark theme (default) */
  --bg: #0d0d0d;
  --panel: #141414;
  --muted: #9aa3ad;
  --accent: #39d98a;
  --glass: rgba(255, 255, 255, 0.03);
  --text: #dbe6e6;
  --text-strong: #ffffff;
  --radius: 14px;
  --max: 1100px;
  color-scheme: dark;
}

.light-theme {
  /* Light theme */
  --bg: #f9f9f9;
  --panel: #ffffff;
  --muted: #333333;
  --accent: #2ECC71;
  --glass: rgba(0, 0, 0, 0.04);
  --text: #1e1e1e;
  --text-strong: #000000;
  --radius: 14px;
  --max: 1100px;
  color-scheme: light;
}

/* Common card style for dark theme */
.side-card,
.contact-card,
.me-photo {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: var(--radius);
  padding: 20px;
  transition: background 0.3s ease, border-color 0.3s ease;
}

/* Light theme card adjustments */
.light-theme .side-card,
.light-theme .contact-card,
.light-theme .me-photo {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.03), transparent);
  border: 1px solid rgba(0, 0, 0, 0.05);
  color: #000; /* Ensure text is readable */
}

/* Inputs and textarea card style - dark theme */
input,
textarea {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: var(--radius);
  color: #e6efef; /* text color for dark theme */
  transition: all 0.3s ease;
}

/* Hover and focus states */
input:hover,
textarea:hover {
  border-color: rgba(57, 217, 138, 0.3);
  background: rgba(255, 255, 255, 0.02);
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  background: rgba(57, 217, 138, 0.05);
  box-shadow: 0 0 0 3px rgba(57, 217, 138, 0.15);
}

/* Light theme overrides */
.light-theme input,
.light-theme textarea {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.03), transparent);
  border: 1px solid rgba(0, 0, 0, 0.05);
  color: #000; /* text color for light theme */
}

.light-theme input:hover,
.light-theme textarea:hover {
  border-color: var(--accent);
  background: rgba(0, 0, 0, 0.03);
}

.light-theme input:focus,
.light-theme textarea:focus {
  border-color: var(--accent);
  background: rgba(0, 255, 128, 0.05);
  box-shadow: 0 0 0 3px rgba(0, 255, 128, 0.15);
}

/* Dark theme (default) */
.nav-toggle-label svg rect {
  fill: #fff; /* white bars */
  transition: fill 0.3s ease;
}

/* Light theme */
.light-theme .nav-toggle-label svg rect {
  fill: #000; /* black bars */
}

* {
  box-sizing: border-box;
  transition: background-color 0.4s ease, color 0.4s ease,
    border-color 0.4s ease;
}
html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial;
  color: var(--text);
  background: var(--bg); /* Solid black background */
  scroll-behavior: smooth;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}
a {
  color: inherit;
  text-decoration: none;
}

.container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 36px;
}

/* NAV */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  backdrop-filter: blur(10px); /* Glass-like effect */
  z-index: 1000; /* Always on top */
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0px 36px;
  background: transparent;
}

/* Make nav items align center; push theme switch to the end */
.nav { display: flex; align-items: center; }
.nav .navlinks { display: flex; align-items: center; gap: 16px; }
.nav .navlinks .theme-switch { margin-left: auto; display: flex; align-items: center; }

/* Center the switch in the mobile menu (when navlinks stack) */
@media (max-width: 768px) {
  .nav .navlinks { flex-direction: column; align-items: stretch; }
  .nav .navlinks .theme-switch { margin-left: 0; align-self: center; }
  /* Side nav: move theme switch to the left */
  .nav .navlinks .theme-switch {
    align-self: flex-start !important; /* override any centering */
    margin-left: 0 !important;         /* cancel margin-left:auto */
  }
}

.brand {
  font-weight: 700;
  letter-spacing: -0.2px;
  font-size: 1.4rem;
  color: var(--text);
}

.brand {
  font-weight: 700;
  letter-spacing: -0.2px;
  font-size: 1.4rem; /* Make the brand text bigger */
  padding: 24px 28px; /* Add more padding for visual impact */
  margin-left: -28px;
}
.navlinks {
  display: flex;
  gap: 18px;
  align-items: center;
}
.navlinks a {
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 8px;
  position: relative;
  z-index: 50;
}
.navlinks a:hover {
  background: var(--glass);
  color: var(--text);
}

/* Hamburger menu styles */
.nav-toggle {
  display: none;
}

.nav-toggle-label {
  display: none;
  flex-direction: column;
  justify-content: center;
  cursor: pointer;
  width: 32px;
  height: 32px;
  margin-left: auto;
}

.nav-toggle-label span {
  display: block;
  height: 4px;
  width: 100%;
  background: var(--text);
  border-radius: 2px;
  margin: 5px 0;
  transition: 0.3s;
}

/* HERO */
.hero {
  min-height: 76vh;
  display: grid;
  align-items: center;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 36px;
  align-items: center;
  position: relative;
}
.intro h1 {
  margin: 0;
  font-size: 40px;
  line-height: 1.02;
}
.intro h1 .name {
  color: var(--text);
}
.intro p.lead {
  color: var(--muted);
  margin-top: 14px;
  max-width: 60ch;
}

/* Fix side-card overlapping */
.side-card {
  grid-column: 2; /* ensure it stays in the second column */
  grid-row: 1;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
  padding: 22px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  position: relative;
  z-index: 1;
}

.roles {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.role {
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
  display: inline-block;
  padding: 8px 10px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.02);
  position: relative;
  z-index: 10;
}
.cta {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  position: relative;
  z-index: 10;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 700;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--muted);
  cursor: pointer;
  position: relative;
  z-index: 10;
}
.btn.primary {
  background: linear-gradient(
    90deg,
    rgba(57, 217, 138, 0.12),
    rgba(57, 217, 138, 0.06)
  );
  border: 1px solid rgba(57, 217, 138, 0.18);
  color: var(--accent);
}

/* PROJECTS */
section {
  padding: 80px 0;
}
h2.section-title {
  font-size: 20px;
  margin: 0 0 20px;
  color: var(--text);
}
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.project {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.03);
  position: relative;
  z-index: 1;
}
.project .screenshot {
  height: 250px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}
.project .screenshot2 {
  height: 250px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}
.project h3 {
  margin: 12px 0 6px;
  font-size: 16px;
}
.project p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

/* ABOUT */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 30px;
  align-items: start;
  position: relative;
}

.me-photo {
  height: 300px;
  width: auto;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.035);
  margin: 0 auto; /* Center horizontally in its parent */
  margin-top: -100px;
}

/* CONTACT */
.contact-card {
  padding: 20px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.03);
  position: relative;
  z-index: 1;
}
label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}
input,
textarea {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  background: transparent;
  color: #e6efef;
}
.submit {
  margin-top: 10px;
  position: relative;
  z-index: 10;
}

/* FOOTER */
footer {
  padding: 24px 0;
  color: var(--muted);
  text-align: center;
}

/* Footer: cleaner, professional layout & SVG icons */
.site-footer {
  border-top: 1px solid rgba(255,255,255,0.04);
  padding: 28px 0;
  margin-top: 48px;
  color: var(--muted);
  background: transparent;
  font-size: 14px;
}

.footer-grid {
  display: flex;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
}

/* Left */
.footer-left .brand-small {
  font-weight: 700;
  margin-bottom: 6px;
  font-size: 16px;
}

/* Center navigation */
.footer-nav {
  display: flex;
  gap: 18px;
  align-items: center;
}
.footer-nav a {
  color: var(--muted);
  text-decoration: none;
  transition: color 160ms ease, transform 120ms ease;
  font-weight: 500;
}
.footer-nav a:hover {
  color: var(--accent);
  transform: translateY(-1px);
}

/* Right: social icons */
.footer-right .social {
  display: flex;
  gap: 10px;
  align-items: center;
}
.social-link {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  transition: background 180ms ease, color 180ms ease, transform 120ms ease;
}
.social-link svg { display: block; width: 18px; height: 18px; }

.social-link:hover {
  background: rgba(57,217,138,0.10);
  color: var(--accent);
  transform: translateY(-2px);
}

/* Slightly dim icons on small screens for harmony */
@media (max-width: 880px) {
  .site-footer { padding: 22px 0; }
  .footer-grid { gap: 12px; }
  .footer-nav { gap: 12px; }
}

/* Mobile: stacked layout */
@media (max-width: 680px) {
  .footer-grid {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .footer-center { order: 2; }
  .footer-right { order: 3; align-self: flex-start; }
  .footer-left { order: 1; }
  .footer-nav {
    flex-wrap: wrap;
    gap: 10px;
  }
}

/* Small helper */
.site-footer .small { font-size: 13px; opacity: 0.9; }

/* UTIL */
.muted {
  color: var(--muted);
}

/* Responsive */
@media (max-width: 980px) {
  .hero-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 24px !important;
  }
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .nav {
    padding: 0 12px;
  }
  /* CONTACT section responsive layout */
  #contact > div {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
  }
  #contact > div > aside {
    order: 2;
    width: 100% !important;
    max-width: 100% !important;
  }
  #contact > div > div {
    order: 1;
    width: 100% !important;
    max-width: 100% !important;
  }
  /* Responsive about section layout */
  .about-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 24px !important;
    width: 80vw !important;
    max-width: 80vw !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    box-sizing: border-box;
  }
  .me-photo {
    width: 80vw !important;
    max-width: 80vw !important;
    margin-left: auto !important;
    margin-right: auto !important;
    border-radius: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    margin-top: 0px;
  }

  .side-card {
    width: 80vw !important;
    max-width: 80vw !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }
}
@media (max-width: 560px) {
  .projects-grid {
    grid-template-columns: 1fr;
  }
  .brand {
    padding-top: 24px; /* Add extra top padding for mobile view */
    margin-left: -25px;
  }
  .intro h1 {
    font-size: 28px;
  }
}

/* Simple reveal animations */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: all 0.6s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.reveal.show {
  opacity: 1;
  transform: none;
}

.me-photo img {
  width: 220px;
  height: auto;
  border-radius: 8px; /* optional rounded corners */
}

.screenshot img {
  width: auto;
  height: 200px;
  border-radius: 8px; /* optional rounded corners */
}

.screenshot2 img {
  width: auto;
  height: 225px;
  border-radius: 8px; /* optional rounded corners */
}

@media (max-width: 980px) {
  .screenshot img {
    width: auto;
    height: 175px;
    border-radius: 8px; /* optional rounded corners */
  }

  .screenshot2 img {
    width: auto;
    height: 200px;
    border-radius: 8px; /* optional rounded corners */
  }

  /* Responsive nav */
  @media (max-width: 768px) {
    .navlinks {
      position: fixed;
      top: 0;
      right: 0;
      background: var(--panel);
      height: 100vh;
      width: 70vw;
      max-width: 320px;
      box-shadow: -2px 0 16px rgba(0, 0, 0, 0.2);
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      padding: 60px 32px 32px 32px;
      gap: 32px;
      transform: translateX(100%);
      transition: transform 0.3s ease;
      z-index: 100;
    }
    .nav-toggle:checked ~ .navlinks {
      transform: translateX(0);
    }
    .nav-toggle-label {
      display: flex;
      z-index: 101;
      position: absolute;
      top: 24px;
      right: 32px;
      background: transparent;
      padding: 0; /* Remove default padding for consistency */
    }
    .nav-toggle:checked ~ .nav-toggle-label {
      position: fixed;
      top: 24px;
      right: 32px;
      background: transparent;
      z-index: 102;
      padding: 0; /* Ensure same padding when active */
    }
    .nav {
      align-items: center;
      position: relative;
      padding-right: 32px; /* Match sidebar icon position */
      padding-left: 32px; /* Optional: add left padding for symmetry */
    }

    /* Make menu icon fixed when sidebar is open */
    .nav-toggle:checked ~ .nav-toggle-label {
      position: fixed;
      top: 24px;
      right: 32px;
      background: transparent;
      z-index: 102;
    }
  }
}

/* Removes the grey box behind me-photo images */

/* .project .screenshot,
.project .screenshot2,
.me-photo {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
} */

.projects-carousel {
  position: relative;
  max-width: 1100px;
  margin: 0 auto 40px auto;
  text-align: center;
}

.carousel-projects {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 30px;
  margin-bottom: 50px;
}

.carousel-projects .project {
  flex: 1 1 0;
  min-width: 250px;
  max-width: 320px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.02),
    transparent
  ); /* Use your dark panel color */
  color: var(--text); /* Ensure text is visible */
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
  padding: 24px 18px;
  transition: transform 0.4s, box-shadow 0.4s;
}

/* Keep the image and text organized */
.carousel-projects .project .project-icon {
  flex-shrink: 0;
}

.carousel-projects .project h3 {
  margin-top: 12px;
  margin-bottom: 8px;
}

.carousel-projects .project p {
  flex-grow: 1; /* pushes the button to the bottom */
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
}

.carousel-projects .project .btn.primary {
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  justify-content: center;
}

/* On smaller screens, use a slightly smaller height */
@media (max-width: 768px) {
  .carousel-projects .project {
    height: 360px; /* ✅ fixed height for mobile */
  }
}

.project-icon {
  width: 100%;
  height: 160px; /* consistent image box height */
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  margin-bottom: 14px;
}

.project-icon img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain; /* keeps image proportions */
  border-radius: 8px;
  transition: transform 0.3s ease;
}

.carousel-projects .project:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.carousel-projects p {
  margin-bottom: 25px;
}

@media screen and (max-width: 890px) {
  .carousel-projects {
    gap: 0;
  }

  .project {
    margin: 0 auto;
  }
}

/* Contact form fields */
input,
textarea {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  background: transparent;
  color: #e6efef;
  transition: all 0.25s ease;
  outline: none; /* remove default blue outline */
}

/* Hover effect */
input:hover,
textarea:hover {
  border-color: rgba(57, 217, 138, 0.3); /* subtle green glow */
  background: rgba(255, 255, 255, 0.02); /* slight highlight */
}

/* Focus effect (when clicked/active) */
input:focus,
textarea:focus {
  border-color: var(--accent);
  background: rgba(57, 217, 138, 0.05);
  box-shadow: 0 0 0 3px rgba(57, 217, 138, 0.15);
}

/* Placeholder color for better readability */
input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.8;
  transition: color 0.2s ease;
}

input:focus::placeholder,
textarea:focus::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

/* Default link style */
a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.25s ease, transform 0.25s ease;
}

/* ✅ Hover effect: αλλαγή χρώματος σε πιο έντονο πράσινο */
a:hover {
  color: #6effb3; /* φωτεινότερη πράσινη απόχρωση */
  transform: translateY(-1px); /* διακριτική κίνηση */
}

/* Active state (π.χ. tap σε κινητό) */
a:active {
  transform: translateY(0);
  color: var(--accent);
}

/* Base transition for all buttons */
.btn {
  transition: all 0.25s ease;
}

/* Hover effect for normal buttons */
.btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* Hover effect for primary buttons (green accent) */
.btn.primary:hover {
  background: linear-gradient(
    90deg,
    rgba(57, 217, 138, 0.3),
    rgba(57, 217, 138, 0.15)
  );
  border-color: rgba(57, 217, 138, 0.4);
  color: var(--text);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(57, 217, 138, 0.3);
}

/* Optional: small press effect */
.btn:active {
  transform: translateY(0);
  box-shadow: none;
}

/* Carousel container */
.projects-carousel {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
  text-align: center;
}

/* Carousel projects wrapper */
.carousel-projects {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 30px;
  margin-bottom: 0; /* αφαιρούμε το extra space */
  position: relative;
}

/* Circular nav buttons */
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
  color: var(--accent);
  border: 1px solid rgba(57, 217, 138, 0.4);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.25s ease;
  z-index: 10;
}

.carousel-btn:hover {
  background: var(--accent);
  color: #0b0c0f;
  transform: translateY(-50%) scale(1.05);
  box-shadow: 0 0 10px rgba(57, 217, 138, 0.6);
}

.carousel-btn:active {
  transform: translateY(-50%) scale(0.95);
}

/* Positioning */
#prevProject {
  left: -22px; /* προσαρμόζεται ανάλογα με το layout */
}

#nextProject {
  right: -22px;
}

/* Optional: make them bigger on mobile */
@media (max-width: 768px) {
  .carousel-btn {
    width: 38px;
    height: 38px;
  }
}

/* Common card styling */
.carousel-projects .project {
  flex: 1 1 0;
  min-width: 250px;
  max-width: 320px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
  color: var(--text);
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
  padding: 24px 18px;
  transition: transform 0.4s, box-shadow 0.4s;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 400px; /* ✅ fixed height for desktop */
}

/* Keep the image and text organized */
.carousel-projects .project .project-icon {
  flex-shrink: 0;
}

.carousel-projects .project h3 {
  margin-top: 12px;
  margin-bottom: 8px;
}

.carousel-projects .project p {
  flex-grow: 1; /* pushes the button to the bottom */
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 4; /* ✅ limit lines of text */
  -webkit-box-orient: vertical;
}

/* On smaller screens, use a slightly smaller height */
@media (max-width: 768px) {
  .carousel-projects .project {
    height: 360px; /* ✅ fixed height for mobile */
  }

  .carousel-projects .project p {
    -webkit-line-clamp: 5; /* allow a bit more lines on mobile */
  }
}

/* Theme slide switch */
.theme-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto; /* push to right in the nav */
}

.switch-input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  clip-path: inset(50%);
  border: 0;
  padding: 0;
}

.switch {
  --h: 28px;
  --w: 52px;
  --pad: 2px;

  position: relative;
  display: inline-block;
  width: var(--w);
  height: var(--h);
  cursor: pointer;
}

.switch-track {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  transition: background 200ms ease, border-color 200ms ease;
  backdrop-filter: blur(4px);
}

.switch-thumb {
  position: absolute;
  top: var(--pad);
  left: var(--pad);
  width: calc(var(--h) - var(--pad) * 2);
  height: calc(var(--h) - var(--pad) * 2);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
  display: grid;
  place-items: center;
  transition: transform 220ms cubic-bezier(.2,.7,.2,1), background 200ms ease;
}

/* Theme switch: invert thumb color by theme and center icons */
.switch-thumb {
  /* centered icon in the moving dot */
  display: grid;
  place-items: center;
  line-height: 0;
}

/* Icon sizing and centering */
.theme-switch .switch-thumb .thumb-icon {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

/* Hide ghost icons on the track */
.theme-switch .switch-track .icon.ghost {
  display: none !important;
}

/* Optional: clip anything overflowing the track */
.theme-switch .switch-track {
  overflow: hidden;
}

/* Default (dark theme, unchecked): white thumb + moon visible, dark icon */
#theme-toggle + .switch .switch-thumb {
  background: #ffffff;
}
#theme-toggle + .switch .switch-thumb .sun {
  opacity: 0;
  transform: scale(0.9);
}
#theme-toggle + .switch .switch-thumb .moon {
  opacity: 1;
  transform: scale(1);
  color: #111; /* readable on white thumb */
}

/* Light theme (checked): black thumb + sun visible, white icon */
#theme-toggle:checked + .switch .switch-thumb {
  transform: translateX(calc(var(--w) - var(--h)));
  background: #0f0f0f;
}
#theme-toggle:checked + .switch .switch-thumb .sun {
  opacity: 1;
  transform: scale(1);
  color: #ffffff; /* readable on black thumb */
}
#theme-toggle:checked + .switch .switch-thumb .moon {
  opacity: 0;
  transform: scale(0.9);
}

/* Track styling (kept) with clearer contrast per theme */
.switch-track {
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.16);
}
#theme-toggle:checked + .switch .switch-track {
  background: rgba(57, 217, 138, 0.2);
  border-color: rgba(57, 217, 138, 0.35);
}
.light-theme .theme-switch .switch-track {
  background: rgba(0, 0, 0, 0.14);
  border-color: rgba(0, 0, 0, 0.22);
}

/* Mobile centering remains */
.nav .navlinks .theme-switch { margin-left: auto; display: flex; align-items: center; }
@media (max-width: 768px) {
  .nav .navlinks { flex-direction: column; align-items: stretch; }
  .nav .navlinks .theme-switch { margin-left: 0; align-self: center; }
  /* Side nav: move theme switch to the left */
  .nav .navlinks .theme-switch {
    align-self: flex-start !important; /* override any centering */
    margin-left: 10px !important;         /* cancel margin-left:auto */
  }
}

/* === Green slider switch (overrides) === */
.theme-switch .switch {
  --h: 28px;
  --w: 56px;
  --pad: 3px;
  position: relative;
  display: inline-block;
  width: var(--w);
  height: var(--h);
  cursor: pointer;
}

.theme-switch .switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28); /* darker track like the reference */
  border: 1px solid rgba(255,255,255,0.08);
  transition: background 220ms ease, border-color 220ms ease;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.35);
  backdrop-filter: blur(4px);
}

/* Moving thumb: green bubble with centered icon */
.theme-switch .switch-thumb {
  position: absolute;
  top: var(--pad);
  left: var(--pad);
  width: calc(var(--h) - var(--pad) * 2);
  height: calc(var(--h) - var(--pad) * 2);
  border-radius: 50%;
  background: var(--accent);                 /* green like the rest of the site */
  color: #ffffff;                             /* icon color inside thumb */
  display: grid;
  place-items: center;
  line-height: 0;
  box-shadow: 0 3px 10px rgba(0,0,0,0.35), 0 0 0 2px rgba(57,217,138,0.25);
  transition: transform 220ms cubic-bezier(.2,.7,.2,1), background 200ms ease, box-shadow 200ms ease;
}

/* Thumb icons (sun/moon) */
.theme-switch .switch-thumb .thumb-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

/* Subtle appear animation for the icon that becomes active */
#theme-toggle + .switch .switch-thumb .sun { opacity: 0; transform: scale(0.9) rotate(-15deg); }
#theme-toggle + .switch .switch-thumb .moon { opacity: 1; transform: scale(1) rotate(0deg); }

#theme-toggle:checked + .switch .switch-thumb .sun { opacity: 1; transform: scale(1) rotate(0deg); }
#theme-toggle:checked + .switch .switch-thumb .moon { opacity: 0; transform: scale(0.9) rotate(15deg); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .theme-switch .switch-thumb,
  .theme-switch .switch-track { transition: none; }
}

/* Fix: perfectly center sun/moon inside the moving thumb */
.theme-switch .switch-thumb {
  display: block; /* avoid grid alignment side-effects */
  position: absolute;
  top: var(--pad);
  left: var(--pad);
  width: calc(var(--h) - var(--pad) * 2);
  height: calc(var(--h) - var(--pad) * 2);
  border-radius: 50%;
}

/* Center the SVGs with absolute + translate(-50%,-50%) */
.theme-switch .switch-thumb .thumb-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  transform: translate(-50%, -50%) scale(1);
  transform-origin: 50% 50%;
  display: block;
  pointer-events: none;
}

/* State: dark (unchecked) -> show moon; keep translate for centering */
#theme-toggle + .switch .switch-thumb .sun {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.9);
}
#theme-toggle + .switch .switch-thumb .moon {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* State: light (checked) -> show sun; keep translate for centering */
#theme-toggle:checked + .switch .switch-thumb {
  transform: translateX(calc(var(--w) - var(--h)));
}
#theme-toggle:checked + .switch .switch-thumb .sun {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
#theme-toggle:checked + .switch .switch-thumb .moon {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.9);
}

/* Dark (unchecked): show only sun ghost; Light (checked): show only moon ghost */
#theme-toggle + .switch .switch-track .moon-ghost { display: none !important; }
#theme-toggle:checked + .switch .switch-track .sun-ghost { display: none !important; }

/* Nudge theme switch down to align with nav links (desktop) */
.nav .navlinks .theme-switch .switch {
  position: relative;
  top: 3.75px; /* adjust to 3px if you prefer */
}

/* On mobile, reset the nudge (switch sits below Resume) */
@media (max-width: 768px) {
  .nav .navlinks .theme-switch .switch {
    top: 0;
  }
}