:root {
  --bg: #070b14;
  --bg-gradient: radial-gradient(circle at top right, #14203a, #070b14);
  --bg-alt: #0d1322;
  --card: #101a2c;
  --text: #e6ecff;
  --muted: #98a8d3;
  --primary: #71a1ff;
  --primary-strong: #3e7dff;
  --border: #22304f;
  --accent-1: #6c5ce7;
  --accent-2: #00b894;
  --accent-3: #fdcb6e;
  --header-bg: rgba(7, 11, 20, 0.75);
  --header-border: rgba(113, 161, 255, 0.14);
  --section-alt-bg: rgba(8, 13, 25, 0.75);
  --section-alt-border: rgba(113, 161, 255, 0.08);
  --plot-bg: rgba(8, 13, 25, 0.95);
  --plot-grid: rgba(152, 168, 211, 0.15);
  --plot-label: rgba(152, 168, 211, 0.85);
  --plot-setpoint: #fdcb6e;
  --plot-output: #71a1ff;
}

:root[data-theme="light"] {
  --bg: #f3f7ff;
  --bg-gradient: radial-gradient(circle at top right, #dcecff, #f3f7ff);
  --bg-alt: #e9f0ff;
  --card: #ffffff;
  --text: #0f1d3a;
  --muted: #4d6490;
  --primary: #2f6eff;
  --primary-strong: #2659cf;
  --border: #c6d6f2;
  --header-bg: rgba(243, 247, 255, 0.86);
  --header-border: rgba(38, 89, 207, 0.22);
  --section-alt-bg: rgba(220, 236, 255, 0.5);
  --section-alt-border: rgba(38, 89, 207, 0.16);
  --plot-bg: #f7faff;
  --plot-grid: rgba(77, 100, 144, 0.25);
  --plot-label: rgba(50, 76, 122, 0.95);
  --plot-setpoint: #d08a00;
  --plot-output: #2f6eff;
}

:root[data-theme="light"] .org-item {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.97), rgba(233, 240, 255, 0.95));
}

:root[data-theme="light"] .org-item:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 1), rgba(224, 236, 255, 0.98));
}

:root[data-theme="light"] .org-highlights {
  background: rgba(47, 110, 255, 0.08);
  border-left-color: var(--primary-strong);
}

:root[data-theme="light"] .project-card:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(225, 237, 255, 0.94));
}

:root[data-theme="light"] .timeline-item {
  background: rgba(234, 243, 255, 0.92);
}

:root[data-theme="light"] .award-item,
:root[data-theme="light"] .publication-item {
  background: rgba(240, 246, 255, 0.94);
}

:root[data-theme="light"] .award-item:hover,
:root[data-theme="light"] .publication-item:hover {
  background: rgba(232, 241, 255, 0.98);
}

:root[data-theme="light"] .award-item.featured,
:root[data-theme="light"] .publication-item.featured {
  background: linear-gradient(135deg, rgba(255, 255, 255, 1), rgba(220, 235, 255, 0.95));
}

:root[data-theme="light"] .education-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 1), rgba(225, 238, 255, 0.95));
}

:root[data-theme="light"] .contact-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(226, 238, 255, 0.95));
}

:root[data-theme="light"] .profile-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(224, 237, 255, 0.95));
}

:root[data-theme="light"] .project-media-grid img {
  background: rgba(238, 246, 255, 0.95);
}

:root[data-theme="light"] .control-field select {
  background: rgba(245, 249, 255, 0.98);
}

:root[data-theme="light"] .lightbox-close {
  background: rgba(255, 255, 255, 0.98);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg-gradient);
  color: var(--text);
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: min(1120px, 92%);
  margin-inline: auto;
}

.section {
  padding: 5rem 0;
}

.section-alt {
  background: var(--section-alt-bg);
  border-top: 1px solid var(--section-alt-border);
  border-bottom: 1px solid var(--section-alt-border);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(8px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
}

.nav-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 72px;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.2px;
}

.main-nav {
  display: flex;
  gap: 1.5rem;
  color: var(--muted);
  font-weight: 500;
}

.main-nav a:hover {
  color: var(--text);
}

.nav-theme-btn {
  padding: 0.52rem 0.85rem;
  font-size: 0.85rem;
  border-radius: 999px;
  white-space: nowrap;
  color: #ffffff;
}

:root[data-theme="light"] .nav-theme-btn {
  color: var(--text);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 2.5rem;
  align-items: center;
}

.eyebrow {
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 0.8rem;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4.5vw, 3.25rem);
  line-height: 1.12;
}

h2 {
  margin: 0;
}

h3 {
  margin: 0;
}

.lead {
  margin: 1.2rem 0 1.7rem;
  color: var(--muted);
  max-width: 64ch;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid transparent;
  padding: 0.8rem 1.25rem;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #ffffff;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(113, 161, 255, 0.3);
}

.btn-ghost {
  border-color: var(--border);
  background: rgba(113, 161, 255, 0.08);
  transition: all 0.3s ease;
}

.btn-ghost:hover {
  background: rgba(113, 161, 255, 0.15);
  border-color: var(--primary);
}

.projects-toggle {
  min-width: 180px;
}

.quick-facts {
  margin: 1.4rem 0 0;
  padding-left: 1.1rem;
  color: var(--muted);
  line-height: 1.8;
}

.profile-card {
  background: linear-gradient(180deg, rgba(113, 161, 255, 0.18), rgba(16, 26, 44, 0.95));
  border: 1px solid rgba(113, 161, 255, 0.2);
  border-radius: 20px;
  overflow: hidden;
}

.profile-card img {
  width: 100%;
  height: 410px;
  object-fit: cover;
  object-position: top;
}

.profile-meta {
  padding: 1rem 1.2rem 1.3rem;
}

.profile-meta h2 {
  margin: 0;
  font-size: 1.15rem;
}

.profile-meta p {
  margin: 0.45rem 0 0;
  color: var(--muted);
}

.section-title {
  margin: 0 0 1.75rem;
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.section-text {
  color: var(--muted);
  line-height: 1.8;
  max-width: 72ch;
}

.skills-grid,
.projects-grid,
.two-col {
  display: grid;
  gap: 1rem;
}

.skills-grid {
  margin-top: 1.3rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.projects-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.3rem;
}

.projects-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-bottom: 1.2rem;
}

.project-filter-btn {
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  font-size: 0.9rem;
}

.project-filter-btn.is-active {
  border-color: var(--primary);
  background: rgba(113, 161, 255, 0.18);
  color: var(--text);
}

.projects-cta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.4rem;
}

.projects-note {
  margin: 0;
  color: var(--muted);
}

.projects-more {
  margin-top: 1.3rem;
}

.projects-more-grid {
  margin-top: 0;
}

.projects-empty {
  margin-top: 1rem;
  color: var(--muted);
}

.projects-page-head {
  padding-bottom: 0.5rem;
}

.projects-list {
  display: grid;
  gap: 1.2rem;
}

.projects-page-card {
  padding: 1.3rem;
}

.project-media-grid {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
}

.project-media-grid.one-col {
  grid-template-columns: 1fr;
}

.project-media-grid.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.project-media-grid.three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.project-media-grid img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid rgba(113, 161, 255, 0.2);
  background: rgba(16, 26, 44, 0.8);
  cursor: zoom-in;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.project-media-grid img:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.project-links {
  margin-top: 0.9rem;
}

.project-links a {
  color: var(--primary);
  font-weight: 600;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 15, 0.92);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  pointer-events: auto;
}

.lightbox[hidden] {
  display: none !important;
  pointer-events: none;
}

.lightbox img {
  max-width: min(1100px, 96vw);
  max-height: 88vh;
  border-radius: 12px;
  border: 1px solid rgba(113, 161, 255, 0.35);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  object-fit: contain;
  background: rgba(16, 26, 44, 0.9);
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  border: 1px solid var(--border);
  background: rgba(16, 26, 44, 0.9);
  color: var(--text);
  border-radius: 10px;
  padding: 0.55rem 0.8rem;
  cursor: pointer;
}

.lightbox-close:hover {
  border-color: var(--primary);
}

.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 16px;
  padding: 1.1rem 1.1rem 1.2rem;
}

.card h3 {
  margin: 0 0 0.55rem;
}

.card p,
.timeline-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

/* Badge system */
.badge-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.8rem;
}

.badge {
  display: inline-block;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  background: rgba(113, 161, 255, 0.12);
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid rgba(113, 161, 255, 0.25);
}

.badge.tech {
  background: rgba(108, 92, 231, 0.12);
  color: #b19eff;
  border-color: rgba(108, 92, 231, 0.3);
}

/* About highlights */
.about-highlights {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.3rem;
  margin-top: 2rem;
}

.highlight-card {
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(113, 161, 255, 0.05), rgba(108, 92, 231, 0.05));
  border-radius: 16px;
  padding: 1.3rem;
}

.highlight-card h3 {
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.cert-list {
  margin: 0;
  padding-left: 1.1rem;
  list-style: none;
  color: var(--muted);
}

.cert-list li {
  margin-bottom: 0.8rem;
  padding-left: 1.2rem;
  position: relative;
  line-height: 1.6;
}

.cert-list li:before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--primary);
  font-weight: bold;
}

/* Enhanced Project Cards */
.project-card {
  transition: all 0.3s ease;
  border-color: var(--border);
  padding: 1.4rem;
}

.project-card:hover {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(113, 161, 255, 0.08), rgba(16, 26, 44, 0.95));
  transform: translateY(-4px);
}

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.project-header h3 {
  font-size: 1.15rem;
}

.project-type {
  display: inline-block;
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.project-desc {
  color: var(--muted);
  line-height: 1.8;
  margin-bottom: 1rem;
}

.impact-metrics {
  background: rgba(113, 161, 255, 0.06);
  border-radius: 10px;
  padding: 0.9rem;
  margin-bottom: 1rem;
  display: grid;
  gap: 0.6rem;
}

.metric {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.metric strong {
  color: var(--text);
}

.tech-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tech-tag {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  background: rgba(113, 161, 255, 0.1);
  border-radius: 6px;
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid rgba(113, 161, 255, 0.2);
}

/* Timeline */
.timeline {
  display: grid;
  gap: 0.9rem;
}

.timeline-item {
  border-left: 3px solid var(--primary-strong);
  padding: 0.8rem 1rem;
  background: rgba(16, 26, 44, 0.76);
  border-radius: 0 14px 14px 0;
}

.timeline-head {
  display: flex;
  justify-content: space-between;
  gap: 0.9rem;
  align-items: baseline;
  margin-bottom: 0.45rem;
}

.timeline-head h3 {
  margin: 0;
}

.timeline-head span {
  color: var(--primary);
  font-size: 0.92rem;
  white-space: nowrap;
}

/* Awards & Publications */
.awards-publications {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.awards-list,
.publications-list {
  display: grid;
  gap: 1rem;
}

.award-item,
.publication-item {
  display: flex;
  gap: 1rem;
  padding: 1.2rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(16, 26, 44, 0.6);
  transition: all 0.3s ease;
}

.award-item:hover,
.publication-item:hover {
  background: rgba(16, 26, 44, 0.9);
  border-color: var(--primary);
}

.award-item.featured,
.publication-item.featured {
  border: 2px solid var(--primary);
  background: linear-gradient(135deg, rgba(113, 161, 255, 0.1), rgba(16, 26, 44, 0.8));
}

.award-icon {
  font-size: 1.8rem;
  min-width: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.award-item h3,
.publication-item h3 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
}

.award-item p,
.publication-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.pub-status {
  display: inline-block;
  background: rgba(113, 161, 255, 0.2);
  color: var(--primary);
  padding: 0.3rem 0.7rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
}

.pub-link {
  display: inline-block;
  margin-top: 0.6rem;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.pub-link:hover {
  gap: 0.3rem;
}

/* Education Card */
.education-card {
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(113, 161, 255, 0.08), rgba(16, 26, 44, 0.8));
  border-radius: 16px;
  padding: 1.5rem;
}

.education-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1rem;
}

.education-header h3 {
  font-size: 1.2rem;
}

.education-meta {
  color: var(--primary);
  font-size: 0.95rem;
  font-weight: 600;
}

.degree {
  color: var(--primary);
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 1.2rem;
}

.education-details {
  display: grid;
  gap: 1rem;
  color: var(--muted);
}

.cgpa {
  color: var(--text);
  padding: 0.8rem;
  background: rgba(113, 161, 255, 0.1);
  border-radius: 10px;
}

.course-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.6rem;
}

.course-tags span {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  background: rgba(113, 161, 255, 0.08);
  border-radius: 6px;
  border: 1px solid rgba(113, 161, 255, 0.2);
  color: var(--muted);
  font-size: 0.9rem;
}

/* Organization Leadership */
.org-leadership {
  display: grid;
  gap: 1.3rem;
}

.org-item {
  border: 1px solid var(--border);
  background: rgba(16, 26, 44, 0.65);
  border-radius: 14px;
  padding: 1.3rem;
  transition: all 0.3s ease;
}

.org-item:hover {
  border-color: var(--primary);
  background: rgba(16, 26, 44, 0.9);
}

.org-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  margin-bottom: 0.8rem;
}

.org-header h3 {
  font-size: 1.1rem;
}

.org-header span {
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
}

.org-item p {
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 0.9rem;
}

.org-highlights {
  display: grid;
  gap: 0.65rem;
  color: var(--muted);
  padding: 0.9rem;
  background: rgba(113, 161, 255, 0.05);
  border-radius: 10px;
  border-left: 3px solid var(--primary);
}

.org-highlights div {
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Contact Card */
.contact-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(113, 161, 255, 0.08), rgba(16, 26, 44, 0.85));
  padding: 1.3rem;
}

.contact-card p {
  color: var(--muted);
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.8rem;
}

.contact-links a {
  padding: 0.7rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(113, 161, 255, 0.08);
  transition: all 0.3s ease;
}

.contact-links a:hover {
  border-color: var(--primary);
  background: rgba(113, 161, 255, 0.15);
}

.site-footer {
  border-top: 1px solid rgba(113, 161, 255, 0.12);
  padding: 1.2rem 0 2rem;
  color: var(--muted);
}

/* Control Lab */
.control-lab-wrap {
  display: grid;
  grid-template-columns: 1fr 1.45fr;
  gap: 1rem;
  margin-top: 1.2rem;
  align-items: start;
}

.control-lab-panel {
  display: grid;
  gap: 1rem;
}

.control-lab-controls {
  display: grid;
  gap: 0.75rem;
}

.control-field {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.control-field span {
  display: block;
}

.control-field select,
.control-field input[type="range"] {
  width: 100%;
}

.control-field select {
  border: 1px solid var(--border);
  background: rgba(16, 26, 44, 0.9);
  color: var(--text);
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
}

.control-lab-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}

.control-lab-metrics div {
  border: 1px solid var(--border);
  background: rgba(113, 161, 255, 0.06);
  border-radius: 10px;
  padding: 0.6rem;
  display: grid;
  gap: 0.2rem;
}

.control-lab-metrics strong {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

.control-lab-metrics span {
  font-size: 1rem;
  color: var(--text);
  font-weight: 700;
  display: block;
}

.control-lab-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.control-lab-actions .btn {
  flex: 1 1 180px;
}

.control-lab-plot {
  display: grid;
  gap: 0.7rem;
  align-content: start;
}

#control-lab-canvas {
  width: 100%;
  aspect-ratio: 920 / 360;
  height: auto;
  display: block;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--plot-bg);
}

.control-lab-legend {
  display: flex;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.88rem;
  flex-wrap: wrap;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-item i {
  width: 18px;
  height: 4px;
  border-radius: 4px;
  display: inline-block;
}

.legend-setpoint {
  background: #fdcb6e;
}

.legend-output {
  background: var(--primary);
}

/* Responsive */
@media (max-width: 980px) {
  .hero-grid,
  .two-col,
  .awards-publications {
    grid-template-columns: 1fr;
  }

  .control-lab-wrap,
  .control-lab-metrics {
    grid-template-columns: 1fr;
  }

  .profile-card {
    max-width: 420px;
  }

  .skills-grid,
  .projects-grid,
  .about-highlights {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .main-nav {
    display: none;
  }

  .nav-theme-btn {
    font-size: 0.82rem;
    padding: 0.45rem 0.75rem;
  }

  .section {
    padding: 3.5rem 0;
  }

  .timeline-head {
    flex-direction: column;
    gap: 0.25rem;
  }

  .timeline-head span {
    white-space: normal;
  }

  .award-item,
  .publication-item {
    flex-direction: column;
  }

  .project-media-grid.two-col,
  .project-media-grid.three-col {
    grid-template-columns: 1fr;
  }

  .award-icon {
    font-size: 2rem;
    min-width: auto;
  }

  .education-header {
    flex-direction: column;
    gap: 0.3rem;
  }

  .org-header {
    flex-direction: column;
  }
}
