/* =========================================================
   VARIABLES & RESET
   ========================================================= */
:root {
  --bg-start: #0f1116;
  --bg-end: #0b0d12;
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.14);
  --accent: #64b5ff;
  --text: #e7ebff;
  --muted: #a7b2d1;
  --danger: #ff6b6b;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  font-family: "Poppins", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background: linear-gradient(120deg, var(--bg-start), var(--bg-end));
}

/* =========================================================
   GLOBAL LAYERS (background, starfield, grain, progress)
   ========================================================= */
#background {
  position: fixed;
  inset: 0;
  z-index: -3;
  background:
    radial-gradient(circle at 18% 28%, #4f9cff33, transparent 55%),
    radial-gradient(circle at 82% 72%, #ff66c433, transparent 55%);
  transition: background 4s ease-in-out;
  animation: moveBackground 16s infinite alternate ease-in-out;
}

@keyframes moveBackground {
  from {
    background-position: 0 0, 100% 100%;
  }

  to {
    background-position: 100% 50%, 0 50%;
  }
}

#sparkles {
  position: fixed;
  inset: 0;
  z-index: -2;
}

#grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  mix-blend-mode: soft-light;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="140" height="140" viewBox="0 0 140 140"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency="0.8" numOctaves="2" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23n)" opacity=".04"/></svg>');
}

#scrollProgress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, #5aa3ff, #8b6cff, #ff66c4);
  box-shadow: 0 0 12px rgba(100, 181, 255, .75);
}

/* Helpers */
.visually-hidden {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.container {
  width: min(1100px, 90%);
  margin-inline: auto;
}

/* =========================================================
   TYPOGRAPHY & LINKS
   ========================================================= */
h1,
h2,
h3 {
  font-weight: 700;
  letter-spacing: .2px;
}

h1 span,
.timeline h3,
.projects-grid h3 {
  color: var(--accent);
}

a {
  color: #70a0ff;
  text-decoration: none;
  transition: color .3s ease;
}

a:hover {
  color: #a7c8ff;
  text-decoration: underline;
}

/* =========================================================
   GLASS UI
   ========================================================= */
.glass-card,
.glass-header,
.glass-footer {
  backdrop-filter: blur(16px) saturate(180%);
  background-color: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, .25);
}

.glass-header {
  margin-top: 2.25rem;
  padding: 1rem;
}

.glass-card {
  margin: 2rem auto;
  padding: 2rem;
}

.glass-footer {
  margin: 3rem auto;
  padding: 2rem;
  text-align: center;
}

/* =========================================================
   TOP NAV (desktop default)
   ========================================================= */
.topnav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: .5rem 1rem 1rem;
}

.topnav .brand {
  font-weight: 700;
  font-size: 1.25rem;
  opacity: .9;
}

.topnav .brand span {
  color: var(--accent);
}

.topnav .links {
  display: flex;
  gap: .6rem;
  justify-content: center;
  flex-wrap: wrap;
}

.topnav .actions {
  display: flex;
  gap: .5rem;
  justify-self: end;
}

.topnav a {
  color: var(--text);
  opacity: .85;
  padding: .25rem .5rem;
  border-radius: 8px;
  transition: .25s;
}

.topnav a:hover {
  opacity: 1;
  background: rgba(255, 255, 255, .06);
}

#themeToggle {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text);
  border-radius: 10px;
  padding: .45rem .6rem;
  cursor: pointer;
}

/* Buttons */
.button {
  display: inline-block;
  padding: .65rem 1.05rem;
  border-radius: 12px;
  color: #fff;
  background: rgba(100, 181, 255, .25);
  border: 1px solid rgba(255, 255, 255, .15);
  transition: transform .2s, background .2s, box-shadow .2s;
}

.button:hover {
  transform: translateY(-2px);
  background: rgba(100, 181, 255, .45);
  box-shadow: 0 8px 20px rgba(90, 163, 255, .25);
}

.button.primary {
  background: linear-gradient(135deg, #5aa3ff, #8b6cff);
}

.button.ghost {
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .25);
  color: #fff;
}

/* Magnetic / click-through safety */
.magnet {
  position: relative;
  will-change: transform;
}

.magnet::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 16px;
  pointer-events: none;
}

/* Ensure hero CTAs are clickable */
.hero,
.hero-text,
.cta {
  position: relative;
  z-index: 5;
}

.liquid-orb,
.liquid-orb *,
.glass-card::before,
.glass-card::after {
  pointer-events: none !important;
}

/* =========================================================
   HERO
   ========================================================= */
.hero {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 2rem;
  align-items: center;
  padding: 1.25rem 1rem 2rem;
}

.hero .bullets {
  margin: .75rem 0 0 .5rem;
  color: var(--muted);
}

.hero .bullets li {
  margin: .25rem 0;
}

.cta {
  display: flex;
  gap: .75rem;
  margin-top: .9rem;
  flex-wrap: wrap;
}

.light .primary {
  color: #fff !important;
}


/* =========================================================
   LIQUID ORB
   ========================================================= */
.liquid-orb {
  display: grid;
  place-items: center;
  width: clamp(260px, 40vw, 440px);
  height: clamp(260px, 40vw, 440px);
  margin-inline: auto;
  filter: url(#goo);
}

.liquid {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background:
    radial-gradient(120px 120px at 42% 38%, rgba(255, 255, 255, .16), rgba(255, 255, 255, 0) 60%),
    radial-gradient(180px 180px at 58% 62%, rgba(100, 181, 255, .22), rgba(100, 181, 255, 0) 60%);
  overflow: hidden;
  animation: slowMorph 18s ease-in-out infinite;
}

@keyframes slowMorph {

  0%,
  100% {
    border-radius: 46% 54% 49% 51% / 52% 44% 56% 48%;
  }

  50% {
    border-radius: 58% 42% 61% 39% / 43% 57% 43% 57%;
  }
}

.drop {
  position: absolute;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, #9fbfff, #6aa8ff);
  opacity: .95;
  mix-blend-mode: screen;
  animation: float 8s ease-in-out infinite;
  box-shadow: 0 8px 30px rgba(100, 181, 255, .35);
}

.drop:nth-child(1) {
  top: 10%;
  left: 15%;
  animation-duration: 9s;
}

.drop:nth-child(2) {
  top: 20%;
  right: 15%;
  animation-duration: 7.5s;
}

.drop:nth-child(3) {
  bottom: 15%;
  left: 18%;
  width: 120px;
  height: 120px;
  animation-duration: 8.5s;
}

.drop:nth-child(4) {
  bottom: 22%;
  right: 18%;
  width: 78px;
  height: 78px;
  animation-duration: 7.2s;
}

.drop:nth-child(5) {
  top: 45%;
  left: 45%;
  width: 64px;
  height: 64px;
  animation-duration: 6.8s;
}

.halo {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 80px rgba(138, 108, 255, .25);
  pointer-events: none;
}

@keyframes float {
  0% {
    transform: translate(0, 0) scale(1);
  }

  50% {
    transform: translate(22px, -25px) scale(1.1);
  }

  100% {
    transform: translate(0, 0) scale(1);
  }
}

/* =========================================================
   SECTIONS
   ========================================================= */
.skills-grid {
  display: grid;
  gap: .6rem;
  margin-top: 1rem;
  text-align: center;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.skills-grid span {
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 12px;
  padding: .6rem .8rem;
  transition: transform .2s, background .2s;
}

.skills-grid span:hover {
  transform: translateY(-2px);
  background: rgba(100, 181, 255, .22);
}

.skill-notes {
  margin-top: .75rem;
  opacity: .85;
  font-size: .95rem;
}

.icon-wall {
  margin-top: 1rem;
  display: grid;
  place-items: center;
}

.projects-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.project {
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 16px;
  padding: 1rem;
  transition: transform .2s;
}

.project:hover {
  transform: translateY(-4px);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .6rem;
}

.tags span {
  background: rgba(255, 255, 255, .12);
  border-radius: 999px;
  padding: .25rem .6rem;
  font-size: .85rem;
}

.timeline .job {
  margin-bottom: 1.2rem;
}

.timeline ul {
  margin-left: 1rem;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* GitHub section */
.github-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  align-items: stretch;
  justify-items: center;
}

.gitcard {
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 16px;
  padding: .5rem;
  display: grid;
  place-items: center;
}

.gitcard img {
  width: 100%;
  max-width: 280px;
  border-radius: 12px;
  object-fit: cover;
}

/* Footer / Contact */
.socials img {
  width: 38px;
  margin: .4rem;
  filter: brightness(0) invert(1);
  opacity: .95;
  transition: transform .25s, filter .25s, opacity .25s;
}

.socials img:hover {
  transform: scale(1.12);
  opacity: 1;
}

.contact-form {
  margin-top: 1rem;
  display: grid;
  gap: .6rem;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: .8rem 1rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .15);
  color: var(--text);
}

.contact-form button {
  justify-self: center;
}

.copyright {
  margin-top: 1rem;
  opacity: .8;
}

/* Reveal & tilt */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: .6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.tilt {
  will-change: transform;
  transform-style: preserve-3d;
  perspective: 600px;
}

/* Divider */
.divider svg {
  display: block;
  width: 100%;
  height: 60px;
}

.divider path {
  fill: rgba(255, 255, 255, .06);
}

/* =========================================================
   MOBILE NAV & DRAWER
   ========================================================= */
/* Hidden by default (desktop) */
.hamburger {
  display: none;
}

/* Scrim */
#scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  backdrop-filter: blur(2px);
  z-index: 999;
}

/* Drawer base (right side) */
#mobileMenu {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 1000;
  width: 100%;
  max-width: 100%;
  transform: translate3d(104%, 0, 0);
  transition: transform .28s ease;
}

#mobileMenu[data-open="true"] {
  transform: translate3d(0, 0, 0);
  right: 0;
}

#mobileMenu:not([data-open="true"]) {
  border-left: 0;
  box-shadow: none;
}

#mobileMenu .mobile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid var(--glass-border);
}

#mobileMenu .close {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text);
  border-radius: 10px;
  padding: .45rem .6rem;
}

#mobileMenu .mobile-links {
  overflow-y: auto;
  padding: .75rem 1rem 1rem;
  display: grid;
  gap: .25rem;
}

#mobileMenu .mobile-links a {
  display: block;
  padding: .9rem .9rem;
  border-radius: 12px;
  color: var(--text);
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .10);
}

#mobileMenu .mobile-links a:hover {
  background: rgba(255, 255, 255, .10);
}

#mobileMenu .mobile-cta {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 2fr 1fr;
  padding: .9rem 1rem calc(1rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--glass-border);
  background: var(--glass-bg);
}

body.menu-open {
  overflow: hidden;
}

/* =========================================================
   LIGHT THEME OVERRIDES
   ========================================================= */
.light {
  --bg-start: #f4f7ff;
  --bg-end: #ebeffa;
  --glass-bg: rgba(255, 255, 255, .7);
  --glass-border: rgba(0, 0, 0, .08);
  --text: #1b1f2a;
  --muted: #45506f;
}

.light #background {
  background:
    radial-gradient(circle at 18% 28%, #cde3ff, transparent 55%),
    radial-gradient(circle at 82% 72%, #ffd0ea, transparent 55%);
}

.light a {
  color: #0056d6;
}

.light a:hover {
  color: #003c9e;
}

.light .button.ghost {
  background: rgba(0, 0, 0, .05);
  border: 1px solid rgba(0, 0, 0, .15);
  color: #222;
}

.light .button.ghost:hover {
  background: rgba(0, 0, 0, .1);
}

.light .skills-grid span,
.light .project,
.light .service,
.light .gitcard,
.light .ref,
.light .contact-form input,
.light .contact-form textarea {
  background: rgba(255, 255, 255, .95);
  border-color: rgba(0, 0, 0, .08);
}

.light .divider path {
  fill: rgba(0, 0, 0, .06);
}

.light .socials img {
  filter: brightness(0) invert(0);
  opacity: .85;
}

.light .socials img:hover {
  filter: brightness(0) invert(.3);
  opacity: 1;
}

/* =========================================================
   BREAKPOINTS
   ========================================================= */
/* Desktop reset (≥901px): show desktop nav, hide mobile UI */
@media (min-width:901px) {

  #mobileMenu,
  #scrim,
  .hamburger {
    display: none !important;
  }

  .topnav .links {
    display: flex !important;
  }

  .topnav .actions .button {
    display: inline-flex !important;
  }

  .topnav {
    justify-content: center;
    align-items: center;
  }
}

/* Tablet/phone (≤900px): show hamburger, adjust hero/layout */
@media (max-width:900px) {
  .topnav {
    justify-content: space-between !important;
    align-items: center;
  }

  .topnav .links,
  .topnav .actions .button {
    display: none !important;
  }

  .hamburger {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 36px;
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    transition: all .3s ease;
  }

  .hamburger:hover {
    background: rgba(255, 255, 255, .08);
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .liquid-orb {
    order: -1;
    margin-top: .5rem;
  }

  .two-col {
    grid-template-columns: 1fr;
  }
}

/* Small phones (≤600px): tighten glass blur; skills wrap fix */
@media (max-width:600px) {

  .glass-card,
  .glass-header,
  .glass-footer {
    backdrop-filter: blur(10px) saturate(140%);
  }

  .skills-grid {
    grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
    gap: .5rem;
  }

  .skills-grid span {
    display: block;
    text-align: center;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .icon-wall img {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
  }

  .skills-grid,
  .icon-wall,
  #skills.glass-card {
    max-width: 100%;
    overflow-x: hidden;
  }

  .github-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width:1000px) {
  .github-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* =========================================================
   PREFERENCES / ACCESSIBILITY
   ========================================================= */
@media (prefers-reduced-motion: reduce) {

  .glass-card,
  .glass-header,
  .glass-footer {
    backdrop-filter: none;
    background-color: rgba(255, 255, 255, 0.06);
  }
}


.ios-btn {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.7rem 1.4rem;
  background: linear-gradient(180deg, #007aff, #005ecb);
  color: #fff;
  font-weight: 500;
  font-size: 0.95rem;
  border: none;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0, 122, 255, 0.4);
  text-decoration: none;
  transition: all 0.25s ease;
  backdrop-filter: blur(8px);
}

.ios-btn:hover {
  background: linear-gradient(180deg, #3395ff, #007aff);
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.5);
  transform: translateY(-2px);
}

.ios-btn:active {
  transform: scale(0.97);
  box-shadow: 0 2px 6px rgba(0, 122, 255, 0.3);
}

/* --- iOS Button Fix (Light Theme Text Always White) --- */
.ios-btn,
.ios-btn:visited,
.ios-btn:focus,
.ios-btn:hover,
.ios-btn:active {
  color: #fff !important;
  /* Force white text in all states */
  text-decoration: none;
}

/* Optional: Dark mode tweak (if you use .dark/.light classes) */
.light .ios-btn {
  color: #fff !important;
}


/* Modal background */
.modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
}

/* Modal box */
.modal-content {
  margin: 12% auto;
  padding: 30px;
  width: 90%;
  max-width: 400px;
  text-align: center;
  border-radius: 20px;
  animation: popIn 0.3s ease;
}

/* Close button */
.close {
  position: absolute;
  top: 10px;
  right: 16px;
  font-size: 28px;
  cursor: pointer;
  color: #007aff;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.close:hover {
  transform: scale(1.15);
  opacity: 0.8;
}


.modal a {
  display: block;
  margin: 10px 0;
  padding: 12px;
  border-radius: 12px;
  text-decoration: none;
  background: #007aff;
  color: white;
  font-weight: 600;
  transition: 0.3s;
}

.modal a:hover {
  background: #005ecb;
}

@keyframes popIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}