/* -----Font------ */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500&family=JetBrains+Mono:wght@600&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300..700&display=swap');

/*----------- light theme variables ---------*/

:root {
  --bg: #f9f9fb;
  --fg: #212121;
  --accent: #6717e7; /* Deep Violet */
  --muted: #757575;
  --card-bg: #ffffff;
  --shadow: rgba(0, 0, 0, 0.08);
  --border: #e0e0e0;
  --footer-bg: rgba(255, 255, 255, 0.85);
  --header-bg: rgba(255, 255, 255, 0.85);
  --font-sans: 'DM Sans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  /* Apply JetBrains Mono to headings */
  h1, h2, h3, h4, h5, h6, .header-nav {font-family: 'JetBrains Mono', monospace;}
  --badge-bg: rgba(109, 40, 217, 0.05);

  /* background gradients (light theme) */
  --bg-gradient: radial-gradient(circle at 20% 25%, rgba(103, 23, 231, 0.08), transparent 25%),
                 radial-gradient(circle at 80% 75%, rgba(103, 23, 231, 0.04), transparent 30%),
                 linear-gradient(180deg, #ffffff 0%, #f9f9fb 70%);

  /* blob color presets (light) - UPDATED for 'frosted glass' effect */
  --blob-soft-blue: radial-gradient(circle, rgba(59, 130, 246, 0.25) 0%, transparent 60%);
  --blob-violet:      radial-gradient(circle, rgba(103, 23, 231, 0.3) 0%, transparent 60%);
  --blob-warm:        radial-gradient(circle, rgba(231, 23, 143, 0.2) 0%, transparent 60%);
}

/* --------- dark theme variables --------- */
:root[data-theme="dark"] {
  --bg: #12101b;
  --fg: #ede9fe;
  --accent: #a78bfa; /* Soft Lavender */
  --muted: #a1a1aa;
  --card-bg: #1c192b;
  --shadow: rgba(0, 0, 0, 0.45);
  --border: #2f2b43;
  --footer-bg: rgba(11, 15, 26, 0.85);
  --header-bg: rgba(11, 15, 26, 0.75);
  --badge-bg: rgba(167, 139, 250, 0.1);

  /* background gradients (dark theme) */
  --bg-solid: #0b0f1a;
  --bg-gradient: radial-gradient(circle at 20% 25%, rgba(59,130,246,0.10), transparent 20%),
                 radial-gradient(circle at 80% 75%, rgba(155,89,255,0.06), transparent 25%),
                 linear-gradient(180deg,#030416 0%, #071026 70%);

  /* blob color presets (dark) - UPDATED for 'frosted glass' effect */
  --blob-soft-blue: radial-gradient(circle, rgba(59,130,246,0.30) 0%, transparent 60%);
  --blob-violet:      radial-gradient(circle, rgba(155,89,255,0.28) 0%, transparent 60%);
  --blob-warm:        radial-gradient(circle, rgba(255,165,84,0.25) 0%, transparent 60%);
}

/* ---------- RESET ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  line-height: 1.7;
  overflow-x: hidden;
  padding-top: 60px;
}
html { scroll-behavior: smooth;}

/* ---------- SCROLL PROGRESS ---------- */
#scroll-progress {
  position: fixed; top: 0; left: 0; height: 4px; width: 0%;
  background: linear-gradient(90deg, var(--accent), #9b59ff);
  z-index: 1100;
}

/* ---------- HEADER ---------- */
.site-header {
  position: fixed;
  top: 0; left: 0; width: 100%;
  color: var(--fg);
  background: var(--header-bg, var(--card-bg));
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  z-index: 1;
  backdrop-filter: blur(6px);
  transition: background 0.3s ease;
}

.logo { 
  display: inline-block;
  color: var(--accent);
  font-family: 'Space Grotesk', sans-serif !important;
  font-size: 2rem;
}

.logo:hover {
  color: var(--fg);
  -webkit-text-stroke: 0px;
  transition: color 0.3s ease;
  opacity: 1;
}

@media (max-width: 600px) {
  .site-header .logo { font-size: 1.5rem !important; }
}

.profile-pic {
  width: 3rem; height: 3rem; border-radius: 50%;
  object-fit: cover; border: 2px solid var(--accent);
}

.header-left { 
  display: flex; 
  align-items: center; 
  gap: 0.75rem;
  position: relative;
  isolation: isolate;
}

.header-nav { display: flex; gap: 2rem; align-items:center; }

.header-nav a {
  text-decoration: none; 
  color: var(--fg); position: relative; 
  font-weight: 500;
  padding: 0.25rem 0;
}
.header-nav a::after {
  content: ''; position: absolute; left: 0; bottom: -6px;
  width: 0; height: 2px; background: var(--accent); transition: width 0.25s ease;
}
.header-nav a:hover::after, .header-nav a.active::after { width: 100%; }
.header-nav a.active { color: var(--accent); }

/* ---------- THEME TOGGLE ---------- */
.swap {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  background: var(--card-bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color .25s ease, box-shadow .25s ease, color .25s ease;
}
.swap:hover { color: var(--accent); border-color: var(--accent); box-shadow: 0 4px 10px var(--shadow); }

/* Hide the checkbox but keep it accessible via the label */
.swap input[type="checkbox"] {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
  appearance: none;
  -webkit-appearance: none;
}

/* Icons overlap and animate */
.swap svg {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 22px;
  height: 22px;
  fill: currentColor;
  transition: opacity .35s ease, transform .35s ease;
  will-change: opacity, transform;
}
.swap-off { opacity: 1; transform: rotate(0deg) scale(1); }
.swap-on  { opacity: 0; transform: rotate(-90deg) scale(.9); }

/* Toggle states: show/hide based on checkbox */
.swap input:checked ~ .swap-off { opacity: 0; transform: rotate(90deg) scale(.9); }
.swap input:checked ~ .swap-on  { opacity: 1; transform: rotate(0deg)  scale(1); }

/* ---------- ABOUT SECTION ---------- */

.about-headline {
  font-size: 2rem;
  color: var(--accent);
  margin-bottom: 0.5rem; /* Reduced bottom margin */
}

.about-tagline {
  font-family: 'Space Grotesk' !important;
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 2rem; /* Space before the main text */
  max-width: 600px; /* Keep it from getting too wide */
}

.about-highlights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.highlight-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
}

.highlight-item strong {
  display: block;
  font-size: 0.8rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent);
  margin-bottom: 0.25rem;
  text-transform: uppercase;
}

.highlight-item span {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--fg);
}

.highlight-item:hover {
  border-color: var(--accent);
  box-shadow: 0 6px 18px var(--shadow);
}

/* ---------- SECTIONS ---------- */
.about, .portfolio, .skills, .testimonials {
  max-width: 1024px; margin: 0 auto; padding: 4rem 2rem;
}
.about h2, .portfolio h2, .skills h2, .testimonials h2 {
  font-size: 2rem;
  color: var(--accent);
}
.me { display: grid; gap: 1rem; font-size: 16px; border-bottom: 1px solid var(--border); padding-bottom: 4rem;}

.certs {
  background: var(--header-bg); color: var(--fg);
  border: 1px solid var(--border); border-radius: 8px; padding: 1rem;
  box-shadow: 0 6px 18px var(--shadow); white-space: pre-wrap;
  font-family: 'JetBrains Mono', monospace; font-size: 0.9rem;
  white-space: pre-wrap;
}

/* ---------- PROJECT CARDS ---------- */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  border-bottom: 1px solid var(--border); 
  padding-bottom: 8rem;
  padding-top: 2.5rem;
}

.card {
  background: var(--header-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 30px var(--shadow);
  overflow: hidden;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.card:hover { transform: translateY(-6px); box-shadow: 0 20px 50px var(--shadow); border-color: var(--accent); }
.card-thumb img { width: 100%; height: 160px; object-fit: cover; display:block; }
.card-content { padding: 1rem; }
.card-content h3 { margin-bottom: .5rem; font-size: 1.05rem; }
.tech-badges { margin-top: .4rem; display:flex; gap:.4rem; flex-wrap:wrap; }

.card-actions { 
  margin-top: 1rem;
  margin-left: 0.4rem;
}

.badge {
  background: var(--badge-bg);
  color: var(--fg);
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
}

/* ---------- SKILLS ---------- */
.skills {
  /* Reset to default block flow */
  border-bottom: 1px solid var(--border);
  padding-bottom: 6rem;
  padding-top: 2rem;
  overflow: visible; /* Clear old overflow setting */
}

.skill-categories {
  display: grid;
  gap: 2.5rem; /* Space between "Languages" and "Tools" */
}

.skill-category h3 {
  font-size: 1.25rem;
  color: var(--fg);
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
  font-family: var(--font-sans); /* Use standard font for category title */
  text-align: center;
}

.skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 0; /* No gap, borders will touch */
  margin-top: 2rem;
}

.skill-item {
  background: transparent;
  border-right: 2.5px solid var(--border);
  border-radius: 0;
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  transition: background 0.2s ease, color 0.2s ease;
  color: var(--fg);
}

.skill-item.js {
  border-right: none;
}

.skill-item.git {
  border-right: none;
}

.skill-item:hover {
  color: var(--accent); /* This changes text AND icon color */
}

/* IMPORTANT: We must style the <svg> tag directly now */
.skill-item svg {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.skill-item span {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 0.9rem;
  text-align: center;
}

/* This targets the icon's path *inside* the skill item when hovered */
.skill-item:hover svg path {
  fill: var(--accent);
}

/* Responsive tweaks for smaller screens */
@media (max-width: 680px) {
  .skill-grid {
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 0;
  }
  .skill-item {
    padding: 1rem 0.5rem;
  }
}

/* ---------- TESTIMONIALS ---------- */
.testimonial-grid { 
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); /* Responsive columns */
  gap: 1.5rem;
  padding-bottom: 2rem;
  padding-top: 2rem;
}

.testimonial-card {
  background: var(--header-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 10px 30px var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.testimonial-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.testimonial-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  display: grid;
  place-items: center;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 1.25rem;
}

.testimonial-author strong {
  display: block;
  color: var(--fg);
  font-weight: 600;
  font-family: var(--font-sans);
}

.testimonial-author span {
  font-size: 0.9rem;
  color: var(--muted);
}

.testimonial-quote {
  font-size: 1rem;
  color: var(--fg);
  line-height: 1.7;
  font-style: italic;
}

.testimonial-quote:hover {
  color: var(--accent);
}

/* ---------- FOOTER ---------- */
.site-footer {
  padding: 1rem 3rem 1rem 3rem; /* <-- Reduced padding */
  background: var(--bg); /* Match site bg */
  border-top: 1px solid var(--border);
  font-size: 0.9rem; /* <-- Reduced font size */
  line-height: 1.6;
  margin: 0 auto; /* Center the footer container */
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem; /* <-- Reduced gap */
  padding: 0 4rem;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem; /* <-- Reduced gap */
}
.footer-logo .profile-pic {
  width: 2rem; /* <-- Reduced size (32px) */
  height: 2rem;
  border: none;
  border-radius: 6px;
}
.footer-logo .logo {
  font-size: 1.2rem; /* <-- Reduced font size */
  color: var(--fg);
  font-family: 'JetBrains Mono', monospace;
}

.footer-nav {
  display: flex;
  gap: 2rem; /* <-- Reduced gap */
  flex-wrap: wrap;
}

/* This is the new style for the static links */
.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem; /* <-- Reduced gap */
  text-decoration: none;
  color: var(--fg);
  font-weight: 500;
  transition: color 0.2s ease;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font-size: 0.9rem; /* <-- Reduced font size */
  font-family: var(--font-sans); /* Ensure it's not the mono font */
}
.footer-link:hover {
  color: var(--accent);
}
.footer-link svg {
  /* Set a consistent size */
  width: 16px; /* <-- Reduced icon size */
  height: 16px;
}

/* Copyright line */
.site-footer p { 
  margin-top: 1.5rem; /* <-- Reduced margin */
  padding-top: 1.5rem; /* <-- Reduced padding */
  border-top: 1px solid var(--border);
  color: var(--muted); 
  font-size: 0.85rem; /* <-- Reduced font size */
  text-align: center;
  padding: 1.5rem 2rem 0 2rem;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .footer-content {
    flex-direction: column; /* Stack logo and nav */
    align-items: center; /* Center on mobile */
  }
}

/* ---------- BACK TO TOP ---------- */
#backToTop {
  position: fixed;
  right: calc(16px + env(safe-area-inset-right));
  bottom: calc(20px + env(safe-area-inset-bottom));
  width: 37px;
  height: 37px;
  border-radius: 50%;
  background: var(--border);
  color: #fff;
  border: none;
  font-size: 1.1rem;
  display: grid;
  place-items: center;
  opacity: 0;                     /* hidden until JS adds .show */
  transform: translateY(8px);
  transition: opacity .2s, transform .2s, box-shadow .2s;
  cursor: pointer;
  z-index: 1300;                  /* above bottom-nav (1200) */
  box-shadow: 0 8px 18px var(--shadow);
}

#backToTop.show {
  opacity: 1;
  transform: translateY(0);
}

#backToTop:hover {
  box-shadow: 0 12px 24px var(--shadow);
}

#backToTop:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Keep it above the bottom bar on mobile */
@media (max-width: 768px) {
  #backToTop {
    bottom: calc(80px + env(safe-area-inset-bottom));
    right: calc(16px + env(safe-area-inset-right));
  }
}

/* ---------- BOTTOM NAV (MOBILE) ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; width: 100%;
  background: var(--footer-bg);
  border-top: 1px solid var(--border);
  display: none; /* shown on mobile via media query */
  justify-content: space-around;
  padding: 0.35rem 0.25rem calc(0.35rem + env(safe-area-inset-bottom));
  z-index: 1200;
  backdrop-filter: blur(4px);
}

.bottom-nav .bn-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.78rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.15rem;
  min-width: 64px;
  transition: color 0.2s ease, transform 0.2s ease;
}
.bottom-nav .bn-ico { font-size: 1.2rem; line-height: 1; }
.bottom-nav .bn-link:hover, .bottom-nav .bn-link.active { color: var(--accent); transform: translateY(-1px); }

/* ---------- MODAL ---------- */
.modal { position: fixed; inset: 0; display: none; place-items: center; z-index: 2000; }
.modal.show { display: grid; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(2px); }
.modal-content {
  position: relative; z-index: 2001; width: min(90vw, 900px); background: var(--card-bg);
  border-radius: 12px; padding: 1rem; box-shadow: 0 20px 60px var(--shadow);
  max-height: 85vh; overflow: hidden; display: flex; flex-direction: column;
}
.modal-close { position: absolute; right: 10px; top: 8px; background: transparent; border: none; font-size: 1.2rem; color: var(--muted); cursor: pointer; }
.modal iframe { width: 100%; height: 68vh; border: 1px solid var(--border); border-radius: 8px; }

/* ---------- REVEAL ANIMATIONS ---------- */
.reveal {
  opacity: 0.35;
  transform: translateY(12px);
  transition: opacity 400ms ease, transform 400ms ease;
  will-change: opacity, transform;
}
.reveal--active {
  opacity: 1;
  transform: translateY(0);
}

.reveal-x {
  opacity: 0.35;
  transform: translateX(12px);
  transition: opacity 400ms ease, transform 400ms ease;
}
.reveal-x.reveal--active {
  opacity: 1;
  transform: translateX(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal-x {
    transition: none;
    opacity: 1;
    transform: none;
  }
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 768px) {
  /* Hide header links on mobile, keep theme toggle visible */
  .header-nav a { display: none; }
  .header-nav { gap: 0.5rem; }

  /* Show bottom nav and make room for it */
  .bottom-nav { display: flex; }
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  #backToTop { bottom: 80px; }
}

/* ---------- BACKGROUND LAYERS ---------- */
body {
  position: relative;
  background: var(--bg-solid);
}

/* ---------- Parallax gradient layer (elongated) ---------- */
#bg-gradient-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 220vh;
  pointer-events: none;
  z-index: -2;
  will-change: transform;
  transform: translate3d(0,0,0);

  /* primary: theme-controlled multi-layer gradient (top)
     fallback: background-color from var(--bg-solid) so it never sits above the gradient */
  background-image: var(--bg-gradient);
  background-color: var(--bg-solid);
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 1;
}


/* ---------- Highlight blobs (positioned inside the gradient layer) ---------- */
/* highlight blobs: positioned relative to the fixed gradient layer */
#bg-gradient-layer .bg-blob {
  position: absolute;      /* absolute inside the fixed #bg-gradient-layer */
  left: 50%;
  top: 50%;
  pointer-events: none;
  width: 50vmax;
  height: 30vmax;
  border-radius: 50%;
  /* filter: blur(48px); */
  opacity: 0;
  mix-blend-mode: screen;
  will-change: transform, opacity, left, top;
  transform: translate(-50%, -50%);
}


/* make blobs more vertical/elongated when needed using a class */
#bg-gradient-layer .bg-blob.elongated  { height: 40vmax; transform-origin: center; }

/* light-theme tuning: subtler blobs, normal blend mode */
:root:not([data-theme="dark"]) #bg-gradient-layer .bg-blob {
  mix-blend-mode: multiply;
  /* filter: blur(36px); */
  /* opacity: 0.65; */
}


/* color presets for blobs (pick by data-highlight attr) */
#bg-gradient-layer .bg-blob.soft-blue  { background: var(--blob-soft-blue); }
#bg-gradient-layer .bg-blob.violet     { background: var(--blob-violet); }
#bg-gradient-layer .bg-blob.warm       { background: var(--blob-warm); }