:root {
  --bg-primary: #07090f;
  --bg-secondary: #0c1324;
  --bg-card: rgba(15, 22, 44, 0.54);
  --surface-strong: rgba(13, 19, 38, 0.6);
  --text-main: #ecf3ff;
  --text-muted: #9fb3d6;
  --accent-blue: #2f80ff;
  --accent-cyan: #00d1ff;
  --accent-violet: #8d5bff;
  --border-glow: rgba(83, 149, 255, 0.38);
  --field-bg: rgba(8, 14, 27, 0.8);
  --field-border: rgba(100, 130, 180, 0.35);
  --field-text: #ecf3ff;
  --field-placeholder: #7e91b5;
  --chip-bg: rgba(9, 17, 32, 0.72);
  --chip-text: #ecf3ff;
  --scroll-top-bg: rgba(8, 16, 34, 0.88);
  --scroll-top-text: #ecf3ff;
  --scroll-top-border: rgba(0, 209, 255, 0.52);
  --scroll-top-shadow: 0 8px 16px rgba(0, 12, 30, 0.45);
  --scroll-top-shadow-hover: 0 10px 20px rgba(0, 14, 34, 0.52), 0 0 14px rgba(0, 209, 255, 0.34);
  --shadow-glow: 0 0 30px rgba(47, 128, 255, 0.22);
  --radius: 18px;
}

:root[data-theme="light"] {
  --bg-primary: #edf4ff;
  --bg-secondary: #d8e7ff;
  --bg-card: rgba(255, 255, 255, 0.75);
  --surface-strong: rgba(222, 232, 250, 0.95);
  --text-main: #1a2340;
  --text-muted: #4f6188;
  --accent-blue: #0d63f8;
  --accent-cyan: #0097b8;
  --accent-violet: #6244db;
  --border-glow: rgba(13, 99, 248, 0.23);
  --field-bg: rgba(248, 252, 255, 0.95);
  --field-border: rgba(79, 129, 214, 0.35);
  --field-text: #1a2340;
  --field-placeholder: #6e80a6;
  --chip-bg: rgba(196, 217, 250, 0.96);
  --chip-text: #1a2c56;
  --scroll-top-bg: rgba(230, 238, 255, 0.96);
  --scroll-top-text: #1a2c56;
  --scroll-top-border: rgba(71, 130, 220, 0.56);
  --scroll-top-shadow: 0 10px 20px rgba(76, 117, 186, 0.24);
  --scroll-top-shadow-hover: 0 12px 24px rgba(70, 113, 184, 0.28), 0 0 14px rgba(71, 130, 220, 0.25);
  --shadow-glow: 0 12px 40px rgba(13, 99, 248, 0.2);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Poppins", sans-serif;
  color: var(--text-main);
  background: radial-gradient(circle at 15% 15%, rgba(47, 128, 255, 0.18), transparent 35%),
    radial-gradient(circle at 85% 25%, rgba(141, 91, 255, 0.16), transparent 38%),
    linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

#bgCanvas {
  position: fixed;
  inset: 0;
  z-index: -2;
  opacity: 0.35;
}

.section {
  width: min(1100px, 92vw);
  margin: 0 auto;
  padding: 80px 0;
}

.section-head {
  margin-bottom: 28px;
}

.section-label {
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 0.8rem;
  margin-bottom: 8px;
}

h1, h2, h3, .brand {
  font-family: "Orbitron", sans-serif;
}

h2 {
  font-size: clamp(1.5rem, 2.5vw, 2.2rem);
  line-height: 1.35;
}

.glass {
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  box-shadow: var(--shadow-glow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: var(--radius);
}

.navbar {
  width: min(1200px, 94vw);
  position: sticky;
  top: 14px;
  margin: 14px auto 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
}

.brand {
  color: var(--text-main);
  text-decoration: none;
  font-size: 1.3rem;
}

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

.navbar nav {
  display: flex;
  gap: 16px;
}

.navbar nav a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.92rem;
  transition: color 0.25s ease;
}

.navbar nav a:hover {
  color: var(--text-main);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border-glow);
  background: transparent;
  color: var(--text-main);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.theme-toggle i {
  pointer-events: none;
}

.hero {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  align-items: center;
  gap: 24px;
  padding-top: 110px;
}

.hero-visual {
  display: grid;
  gap: 16px;
}

.eyebrow {
  color: var(--accent-cyan);
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 4.2rem);
  line-height: 1.1;
  margin-bottom: 8px;
}

.hero h2 {
  font-size: clamp(1rem, 2vw, 1.4rem);
  color: var(--text-muted);
  margin-bottom: 14px;
}

.hero h2 span {
  color: var(--accent-blue);
}

.tagline {
  max-width: 560px;
  margin-bottom: 16px;
  line-height: 1.7;
}

.typing-line {
  color: var(--accent-cyan);
  margin-bottom: 24px;
  min-height: 28px;
}

.caret {
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.hero-panel {
  padding: 24px;
}

.profile-photo-shell {
  position: relative;
  width: min(380px, 100%);
  margin-left: auto;
  padding: 6px;
  overflow: hidden;
  transform-style: preserve-3d;
  transition: transform 0.2s ease;
}

.profile-photo-wrap {
  width: min(280px, 82%);
  aspect-ratio: 1 / 1;
  position: relative;
  margin: 0 auto;
  padding: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, rgba(228, 247, 255, 0.45), rgba(141, 91, 255, 0.22) 45%, rgba(0, 209, 255, 0.2) 75%);
  box-shadow: 0 0 34px rgba(0, 209, 255, 0.42);
}

.profile-photo-wrap::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--accent-cyan), var(--accent-violet), #4da2ff, var(--accent-cyan));
  z-index: -1;
  animation: ringRotate 8s linear infinite;
}

.profile-photo-wrap::after {
  content: "";
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 1px solid rgba(133, 180, 255, 0.35);
  box-shadow: 0 0 30px rgba(0, 209, 255, 0.3);
}

.profile-photo {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 26%;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.hero-panel h3 {
  margin-bottom: 16px;
  color: var(--accent-blue);
}

@keyframes ringRotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.hero-seq-item {
  opacity: 0;
  transform: translateY(20px) scale(0.98);
}

.hero-seq-item.in {
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: opacity 0.65s ease, transform 0.65s ease;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 14px;
}

.metric-grid article {
  background: var(--surface-strong);
  border: 1px solid var(--border-glow);
  border-radius: 12px;
  padding: 14px;
}

.metric-grid h4 {
  color: var(--accent-cyan);
  font-size: 1.5rem;
}

.metric-grid p {
  color: var(--text-muted);
  font-size: 0.84rem;
}

.btn {
  border: 1px solid rgba(0, 209, 255, 0.45);
  color: var(--text-main);
  background: linear-gradient(135deg, rgba(47, 128, 255, 0.3), rgba(141, 91, 255, 0.3));
  text-decoration: none;
  padding: 10px 18px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.25s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 24px rgba(0, 209, 255, 0.4);
}

.btn-small {
  padding: 7px 12px;
  font-size: 0.82rem;
}

.btn-ghost {
  background: transparent;
  border-color: rgba(47, 128, 255, 0.5);
}

.hero-cta {
  display: flex;
  gap: 12px;
}

.about-grid,
.skills-grid,
.project-grid,
.cert-grid {
  display: grid;
  gap: 16px;
}

.about-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.about-card,
.skill-card,
.project-card,
.cert-card,
.contact-form,
.contact-info,
.timeline-item {
  padding: 20px;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.about-card:hover,
.skill-card:hover,
.project-card:hover,
.cert-card:hover,
.timeline-item:hover,
.contact-info:hover {
  transform: translateY(-6px);
  border-color: rgba(0, 209, 255, 0.45);
  box-shadow: 0 14px 36px rgba(0, 209, 255, 0.18);
}

.about-card i,
.cert-card i {
  color: var(--accent-cyan);
  font-size: 1.3rem;
  margin-bottom: 10px;
}

.cert-card a {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cert-card {
  cursor: pointer;
}

.cert-card a:hover {
  color: var(--accent-cyan);
}

.about-card p,
.project-card p,
.timeline-item p,
.contact-info p {
  color: var(--text-muted);
  line-height: 1.65;
}

.contact-info a {
  color: inherit;
  text-decoration: none;
}

.contact-info a:hover {
  color: var(--accent-cyan);
}

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

.skill-card h3 {
  font-size: 1rem;
  margin-bottom: 12px;
}

.skill-card i {
  color: var(--accent-blue);
}

.chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-wrap span {
  border: 1px solid var(--border-glow);
  color: var(--chip-text);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  background: var(--chip-bg);
}

.project-grid {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.project-card h3 {
  margin-bottom: 10px;
}

.stack {
  color: var(--accent-cyan);
  font-size: 0.86rem;
  margin: 12px 0 16px;
}

.project-actions {
  display: flex;
  gap: 10px;
}

.timeline {
  position: relative;
  margin-left: 16px;
  padding-left: 20px;
  border-left: 2px solid rgba(47, 128, 255, 0.36);
}

.timeline-item {
  position: relative;
}

.timeline-item .dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 14px rgba(0, 209, 255, 0.65);
  position: absolute;
  left: -29px;
  top: 24px;
}

.timeline-item ul {
  margin-top: 12px;
  padding-left: 16px;
  color: var(--text-muted);
}

.timeline-item li {
  margin-bottom: 8px;
}

.cert-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.cert-card {
  text-align: center;
}

.contact-wrap {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 18px;
}

.contact-form {
  display: grid;
  gap: 10px;
}

label {
  color: var(--text-muted);
  font-size: 0.86rem;
}

input,
textarea {
  width: 100%;
  background: var(--field-bg);
  color: var(--field-text);
  border: 1px solid var(--field-border);
  border-radius: 10px;
  padding: 11px 12px;
  font-family: inherit;
}

input::placeholder,
textarea::placeholder {
  color: var(--field-placeholder);
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 209, 255, 0.16);
}

.socials {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.socials a {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-glow);
  border-radius: 50%;
  color: var(--text-main);
  text-decoration: none;
}

.socials a:hover {
  box-shadow: 0 0 18px rgba(0, 209, 255, 0.4);
}

.is-disabled-link {
  opacity: 0.58;
  cursor: not-allowed;
}

.contact-status {
  min-height: 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.contact-status.success {
  color: #08b977;
}

.contact-status.error {
  color: #d64b65;
}

.assistant-card {
  padding: 16px;
}

.assistant-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  color: var(--text-muted);
}

.assistant-toolbar-actions {
  display: flex;
  gap: 8px;
}

.assistant-messages {
  display: grid;
  gap: 10px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
}

.assistant-msg {
  max-width: min(84%, 760px);
  padding: 10px 12px;
  border-radius: 12px;
  line-height: 1.5;
  border: 1px solid var(--border-glow);
}

.assistant-msg.bot {
  background: var(--surface-strong);
  color: var(--text-main);
}

.assistant-msg.user {
  margin-left: auto;
  background: linear-gradient(135deg, rgba(47, 128, 255, 0.3), rgba(141, 91, 255, 0.3));
  color: var(--text-main);
}

.assistant-form {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.assistant-form input {
  min-height: 42px;
}

.footer {
  text-align: center;
  padding: 28px 16px 40px;
  color: var(--text-muted);
}

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  z-index: 120;
  background: linear-gradient(to right, var(--accent-cyan), var(--accent-violet));
}

.cursor-glow {
  position: fixed;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(0, 209, 255, 0.2) 0%, rgba(0, 209, 255, 0.02) 55%, transparent 70%);
  transform: translate(-50%, -50%);
  z-index: -1;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(2, 5, 11, 0.7);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 200;
}

.modal.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  width: min(560px, 90vw);
  padding: 24px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-size: 1.9rem;
  cursor: pointer;
}

.assistant-popup-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 14, 0.62);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 170;
}

.assistant-popup-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.assistant-popup {
  position: fixed;
  right: 24px;
  bottom: 92px;
  width: min(500px, calc(100vw - 28px));
  max-height: min(78vh, 720px);
  z-index: 180;
  border-radius: 16px;
  overflow: hidden;
  opacity: 0;
  transform: translateY(18px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.assistant-popup.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.assistant-popup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border-glow);
  padding: 14px 16px;
  background: rgba(8, 14, 30, 0.74);
}

.assistant-popup-head h3 {
  font-size: 1rem;
}

.assistant-popup-head .section-label {
  margin-bottom: 4px;
  font-size: 0.7rem;
}

.assistant-popup-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border-glow);
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
}

.assistant-popup .assistant-card {
  padding: 14px 14px 16px;
}

.assistant-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 160;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(0, 209, 255, 0.55);
  background: linear-gradient(135deg, rgba(47, 128, 255, 0.42), rgba(141, 91, 255, 0.42));
  color: var(--text-main);
  padding: 12px 16px;
  border-radius: 999px;
  font-family: "Poppins", sans-serif;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0, 13, 40, 0.48), 0 0 18px rgba(0, 209, 255, 0.35);
  transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
  animation: fabPulse 2.3s ease-in-out infinite;
}

.assistant-fab:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 14px 28px rgba(0, 13, 40, 0.5), 0 0 24px rgba(0, 209, 255, 0.5);
}

.assistant-fab i {
  font-size: 1rem;
}

.assistant-fab.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px) scale(0.96);
}

.scroll-top-btn {
  position: fixed;
  right: 24px;
  bottom: 88px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--scroll-top-border);
  background: var(--scroll-top-bg);
  color: var(--scroll-top-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 158;
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px) scale(0.92);
  transition: opacity 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease;
  box-shadow: var(--scroll-top-shadow);
}

.scroll-top-btn.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.scroll-top-btn:hover {
  box-shadow: var(--scroll-top-shadow-hover);
}

@keyframes fabPulse {
  0%,
  100% {
    box-shadow: 0 10px 24px rgba(0, 13, 40, 0.48), 0 0 18px rgba(0, 209, 255, 0.35);
  }
  50% {
    box-shadow: 0 12px 30px rgba(0, 13, 40, 0.56), 0 0 30px rgba(0, 209, 255, 0.58);
  }
}

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

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

@media (max-width: 980px) {
  .hero,
  .contact-wrap {
    grid-template-columns: 1fr;
  }

  .assistant-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-visual {
    margin-top: 10px;
  }

  .profile-photo-shell {
    width: min(420px, 100%);
    margin: 0 auto;
  }

  .profile-photo-wrap {
    width: min(320px, 82%);
  }

  .navbar nav {
    display: none;
  }

  .section {
    padding: 64px 0;
  }
}

@media (max-width: 560px) {
  .navbar {
    padding: 10px 12px;
  }

  .brand {
    font-size: 1.05rem;
  }

  .btn {
    padding: 9px 12px;
  }

  .hero-cta {
    flex-wrap: wrap;
  }

  .assistant-form {
    grid-template-columns: 1fr;
  }

  .assistant-popup {
    right: 12px;
    bottom: 80px;
    width: calc(100vw - 24px);
    max-height: 72vh;
  }

  .assistant-fab {
    right: 16px;
    bottom: 16px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    justify-content: center;
    padding: 0;
  }

  .assistant-fab span {
    display: none;
  }

  .scroll-top-btn {
    right: 20px;
    bottom: 82px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .assistant-fab {
    animation: none;
  }
}

/* Project action buttons hover glow */
.project-actions .btn {
  transition: transform 0.2s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.project-actions .btn:hover {
  transform: translateY(-2px);
  box-shadow:
    0 0 12px rgba(0, 212, 255, 0.45),
    0 0 28px rgba(0, 212, 255, 0.25);
  border-color: rgba(0, 212, 255, 0.7);
}

/* Slightly distinct glow for ghost-style buttons (GitHub) */
.project-actions .btn.btn-ghost:hover {
  box-shadow:
    0 0 10px rgba(88, 166, 255, 0.45),
    0 0 24px rgba(88, 166, 255, 0.25);
  border-color: rgba(88, 166, 255, 0.75);
}

/* Pop up card effect for project, skill, and experience cards */
.project-card,
.skill-card,
.timeline-item {
  transition: transform 0.35s cubic-bezier(.22,1,.36,1), box-shadow 0.35s cubic-bezier(.22,1,.36,1);
  will-change: transform, box-shadow;
}

.project-card:hover,
.skill-card:hover,
.timeline-item:hover {
  transform: translateY(-12px) scale(1.045) perspective(800px) rotateX(3deg);
  box-shadow: 0 18px 48px rgba(0,209,255,0.22), 0 2px 24px rgba(141,91,255,0.13);
  z-index: 2;
}
