:root {
  --bg: #05070a;
  --bg-alt: #0b0f16;
  --fg: #f4f5f7;
  --fg-muted: #a7b0c3;
  --accent: #4f8cff;
  --accent-soft: rgba(79, 140, 255, 0.1);
  --border-subtle: rgba(255, 255, 255, 0.06);
  --card-bg: rgba(13, 18, 30, 0.95);
  --radius-lg: 18px;
  --radius-pill: 999px;
  --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.55);
  --max-width: 980px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #182238 0, #05070a 48%, #000 100%);
  color: var(--fg);
  line-height: 1.6;
}

/* Layout utilities */

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section {
  padding: 4.5rem 0;
}

.section-alt {
  background: radial-gradient(circle at top, #0f1729 0, #05070a 60%);
}

.section-inner {
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
}

.section-header {
  max-width: 720px;
}

.section-header h2 {
  margin: 0 0 0.6rem;
  font-size: 1.8rem;
  letter-spacing: 0.03em;
}

.section-lead {
  margin: 0;
  color: var(--fg-muted);
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.1fr);
  gap: 2rem;
}

/* Header / Nav */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
  background: linear-gradient(
    to bottom,
    rgba(5, 7, 10, 0.96),
    rgba(5, 7, 10, 0.8),
    transparent
  );
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.5rem;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  font-size: 0.96rem;
  text-transform: uppercase;
}

.logo-mark {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: conic-gradient(
    from 220deg,
    #4f8cff,
    #7c5cff,
    #f97316,
    #4f8cff
  );
  box-shadow: 0 0 18px rgba(79, 140, 255, 0.8);
}

.logo-text {
  color: #e5ecff;
}

.nav {
  display: flex;
  gap: 1.1rem;
  font-size: 0.9rem;
}

.nav a {
  color: var(--fg-muted);
  text-decoration: none;
  padding: 0.3rem 0;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
  opacity: 0.9;
}

.nav a:hover {
  color: var(--fg);
  border-color: rgba(255, 255, 255, 0.35);
  opacity: 1;
}

/* Hero */

.hero {
  padding: 4.5rem 0 3.5rem;
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 2.5rem;
  align-items: center;
}

.hero-kicker {
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  margin: 0 0 0.75rem;
  color: var(--fg-muted);
}

.hero h1 {
  margin: 0 0 0.8rem;
  font-size: clamp(2.1rem, 4vw, 2.6rem);
  line-height: 1.2;
}

.hero-subtitle {
  margin: 0 0 1.6rem;
  color: var(--fg-muted);
  max-width: 36rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease,
    border-color 0.18s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #4f8cff, #7c5cff);
  color: #fdfdff;
  box-shadow: 0 12px 30px rgba(51, 102, 204, 0.6);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 40px rgba(51, 102, 204, 0.9);
}

.btn-secondary {
  background: transparent;
  color: var(--fg);
  border-color: rgba(255, 255, 255, 0.28);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.04);
}

/* Hero meta */

.hero-meta {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.meta-card {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-lg);
  background: radial-gradient(circle at top left, #1a2750 0, #0a0f1b 52%, #05070a 100%);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
}

.meta-label {
  margin: 0 0 0.15rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--fg-muted);
}

.meta-value {
  margin: 0;
  font-size: 0.92rem;
}

/* Cards / grids */

.grid {
  display: grid;
  gap: 1.6rem;
}

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

.projects-grid {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.card {
  padding: 1.8rem 2rem;
  border-radius: var(--radius-lg);
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);

  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}

.card h3 {
  margin-top: 0;
  margin-bottom: 0.6rem;
  font-size: 1.05rem;
}

.card ul {
  margin: 0;
  padding-left: 1.1rem;
}

.card p {
  margin: 0;
}

/* Timeline */

.timeline {
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
  border-left: 1px solid rgba(255, 255, 255, 0.16);
  padding-left: 1.4rem;
  margin-left: 0.3rem;
}

.timeline-item {
  position: relative;
  padding-left: 0.1rem;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -1.48rem;
  top: 0.1rem;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 6px var(--accent-soft);
}

.timeline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: baseline;
  margin-bottom: 0.2rem;
}

.timeline-role {
  font-weight: 600;
}

.timeline-time {
  font-size: 0.85rem;
  color: var(--fg-muted);
}

.timeline h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.timeline p {
  margin: 0.2rem 0 0;
  color: var(--fg-muted);
}

/* Publications */

.pub-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.8rem;
}

.pub-list li {
  padding-left: 0.1rem;
  color: var(--fg-muted);
}

/* Contact */

.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 2rem;
}

.contact-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
  color: var(--fg-muted);
}

.contact-list a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.contact-list a:hover {
  border-bottom-color: var(--accent);
}

.pill-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pill-list li {
  padding: 0.25rem 0.8rem;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 0.8rem;
  color: var(--fg-muted);
}

/* Footer */

.site-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1.4rem 0 1.7rem;
  background: #05070a;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
  font-size: 0.8rem;
  color: var(--fg-muted);
}

/* Responsive */

@media (max-width: 840px) {
  .hero-inner {
    grid-template-columns: minmax(0, 1fr);
  }
  .hero-meta {
    order: -1;
  }
  .two-column {
    grid-template-columns: minmax(0, 1fr);
  }
  .contact-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  .nav {
    flex-wrap: wrap;
    gap: 0.7rem;
  }
  .hero {
    padding-top: 3.5rem;
  }
}

/* ---------- PROJECT CAROUSEL ---------- */

.carousel {
  position: relative;
  width: 100%;
  max-width: 650px;
  margin: 0 auto 2rem auto;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: var(--shadow-soft);
}

.carousel-images {
  display: flex;
  transition: transform 0.4s ease;
}

.carousel-images img {
  width: 100%;
  height: auto;
  object-fit: contain;
  background: #000;
  flex-shrink: 0;
}

.carousel-button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.45);
  color: white;
  border: none;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  border-radius: 50%;
  font-size: 1.2rem;
  transition: background 0.15s ease;
}

.carousel-button:hover {
  background: rgba(0,0,0,0.7);
}

.carousel-button.prev {
  left: 12px;
}

.carousel-button.next {
  right: 12px;
}

.project-description {
  text-align: left;
  width: 100%;
  max-width: 100%;
  margin: 1rem 0 0 0;
  color: var(--fg-muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.metrics-cards {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.metrics-card {
  background: rgba(255,255,255,0.05);
  padding: 1.6rem 1.8rem;
  border-radius: 14px;
  width: 190px;
  text-align: center;
  transition: transform 0.15s ease, background 0.15s ease;
}

.metrics-card:hover {
  transform: translateY(-4px);
  background: rgba(255,255,255,0.10);
}

.metrics-card h4 {
  margin: 0 0 0.6rem 0;
  font-size: 1rem;
  color: #E8ECF2;
}

.metric-number {
  font-size: 1.8rem;
  font-weight: 600;
  color: #F6D860;
}

.metrics-github-note {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.95rem;
  color: var(--fg-muted);
}

.metrics-github-note a {
  color: #F6D860;
  text-decoration: underline;
}

#about {
  margin-top: -4rem;
}

.skills-grid {
  margin-bottom: 2.5rem;
}

.carousel {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto 2rem auto;
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  height: auto;
}

.carousel-images {
  display: flex;
  transition: transform 0.4s ease;
}

.carousel-images img {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
}

/* Ensure carousel wrapper is the positioning anchor */
.carousel {
  position: relative;
  overflow: hidden;
  width: 100%;
}

/* Image track */
.carousel-images {
  display: flex;
  transition: transform 0.4s ease-in-out;
}

/* Make sure images scale nicely */
.carousel-images img {
  width: 100%;
  height: auto;
  display: block;
}

/* Fix button alignment */
.carousel-button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;

  /* Style */
  background: rgba(0, 0, 0, 0.4);
  border: none;
  color: white;
  font-size: 2rem;
  padding: 0.3rem 0.6rem;
  border-radius: 50%;
  cursor: pointer;
}

/* Left & right alignment (corrected) */
.carousel-button.prev {
  left: 1rem;
}

.carousel-button.next {
  right: 1rem;
}

/* Keep one row, but shrink cards so all fit without scrolling */
.skills-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 1rem;
  overflow-x: hidden;
}

.skills-grid .card {
  flex: 1 1 auto;
  min-width: 160px;
  padding: 0.8rem 1rem;
}

.skills-grid .card ul li {
  margin-bottom: 0.2rem;
}

.language-bars .lang {
  margin-bottom: 0.4rem;
}

.language-bars span {
  display: inline-block;
  width: 80px;
  font-size: 0.9rem;
  color: #E8ECF2;
}

.language-bars .bar {
  display: inline-block;
  vertical-align: middle;
  width: 100px;
  height: 6px;
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
  margin-left: 0.4rem;
  overflow: hidden;
}

.language-bars .fill {
  height: 100%;
  background: #ffd44b;
  border-radius: 4px;
}

/* Hard-center the entire contact content */
#contact .section-inner {
  max-width: 800px;
  margin: 0 auto;
}

/* Contact grid should not exceed this width */
.contact-grid {
  max-width: 850px;
  margin: 0 auto;
}

#contact .section-inner {
  max-width: 800px;
}

.contact-extras {
  display: flex;
  flex-direction: column;
  justify-content: right;  /* vertically center with left column */
  padding-top: 1rem;       /* micro-adjustment */
}

.project-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;    /* ← THIS CENTERS THEM */
  margin-bottom: 1.5rem;
}

