:root {
  --bg: #0e0f12;
  --bg-alt: #14161b;
  --text: #e6e7eb;
  --muted: #a9afbd;
  --accent: #6aa9ff;
  --accent-hover: #7db8ff;
  --card: #171a20;
  --modal-bg: #1b1d24;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  --radius: 16px;
  --border-subtle: rgba(255, 255, 255, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ===============================
   Typography
   =============================== */
h2 {
  font-size: clamp(22px, 3vw, 30px);
  margin: 0 0 18px;
}

h3 {
  margin: 8px 0 10px;
}

/* ===============================
   Header
   =============================== */
.site-header {
  padding: 48px 0 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .02), transparent);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  backdrop-filter: blur(8px);
  z-index: 10;
  transition: all 0.4s ease;
}

.site-header.shrunk {
  padding: 20px 0 8px;
}

.site-title {
  font-size: clamp(28px, 4vw, 40px);
  margin: 0 0 18px;
  transition: all 0.4s ease;
}

.site-header.shrunk .site-title {
  font-size: clamp(20px, 3vw, 28px);
  margin-bottom: 0;
  transform: translateY(-6px);
}

.site-tagline {
  margin: 0 0 18px;
  padding-bottom: 4px;
  color: var(--muted);
  opacity: 1;
  max-height: 40px;
  overflow: visible;
  transition: opacity 0.25s ease, max-height 0.25s ease, margin 0.25s ease, transform 0.25s ease;
}

.site-tagline.hidden,
.site-header.shrunk .site-tagline {
  opacity: 0;
  transform: translateY(-8px);
  height: 0;
  margin: 0;
  padding: 0;
  pointer-events: none;
}

.site-tagline.hidden {
  max-height: 0;
}

/* ===============================
   Navigation
   =============================== */
.nav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 12px;
  transition: all 0.4s ease;
}

.site-header.shrunk .nav {
  margin-top: 0;
  transform: translateY(-4px);
}

.nav a {
  color: var(--text);
  text-decoration: none;
  opacity: 0.85;
}

.nav a:hover {
  opacity: 1;
  text-decoration: underline;
}

.nav .btn {
  background: var(--accent);
  color: #08111f;
  padding: 10px 14px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 600;
  box-shadow: 0 0 0 rgba(106, 169, 255, 0);
  transition: box-shadow 0.3s ease, transform 0.3s ease, background 0.3s ease;
}

.nav .btn:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 12px rgba(106, 169, 255, 0.6);
  transform: translateY(-2px);
}

.nav .btn:active {
  transform: translateY(0);
  box-shadow: 0 0 6px rgba(106, 169, 255, 0.4);
}

/* ===============================
   Sections
   =============================== */
.section {
  padding: 64px 0;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeUp 0.6s ease forwards;
}

.section-alt {
  background: var(--bg-alt);
}

@keyframes fadeUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===============================
   About Section
   =============================== */
.about-section {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
  text-align: left;
  max-width: 900px;
  margin: 0 auto;
}

.profile-pic {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}

.about-text {
  max-width: 600px;
}

/* ===============================
   Grids
   =============================== */
.skills-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

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

/* ===============================
   Cards
   =============================== */
.card {
  background: var(--card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: #0b0c0f;
}

.card-body {
  padding: 16px;
}

.card-placeholder {
  visibility: hidden;
}

/* ===============================
   Links
   =============================== */
.link {
  color: var(--accent);
  text-decoration: none;
}

.link:hover {
  color: #89c2ff;
  text-decoration: underline;
}

/* ===============================
   Tech Stack
   =============================== */
.tech-stack {
  margin-top: 40px;
  text-align: center;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
  margin-top: 10px;
}

.badge-row img {
  width: 48px;
  height: 48px;
  filter: brightness(0.9);
  transition: transform 0.2s ease, filter 0.2s ease;
}

.badge-row img:hover {
  transform: scale(1.1);
  filter: brightness(1.2);
}

/* ===============================
   Dev Log
   =============================== */
.devlog-scroll {
  max-height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-right: 10px;
  scrollbar-width: thin;
}

.devlog-scroll::-webkit-scrollbar {
  width: 6px;
}

.devlog-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
}

.post {
  background: var(--card);
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.post .meta {
  color: var(--muted);
  font-size: 0.9em;
  margin-bottom: 8px;
}

.post h3 {
  margin-top: 0;
}

/* ===============================
   Project Modal Overlay
   =============================== */
.project-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.project-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* ===============================
   Expanded Project Card
   =============================== */
.card-expanded {
  display: none;
}

.card.expanded-desktop {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 120;
  width: min(95vw, 1400px);
  max-height: 90vh;
  background: var(--modal-bg);
  border-radius: 18px;
  box-shadow: 0 8px 60px rgba(0, 0, 0, 0.75);
  overflow-y: auto;
  padding: 36px 32px;
  animation: modalPop 0.3s ease;
  isolation: isolate;
}

.card.expanded-desktop .card-expanded {
  display: block;
}

.card.expanded-desktop .card-body,
.card.expanded-desktop>img {
  display: none;
}

@keyframes modalPop {
  from {
    transform: translate(-50%, -45%) scale(0.96);
    opacity: 0;
  }

  to {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

.expanded-title {
  font-size: clamp(20px, 3vw, 28px);
  margin: 0 0 20px;
  text-align: center;
  font-weight: 600;
  color: #f0f1f4;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 10px;
}

/* ===============================
   Expanded Media
   =============================== */
.expanded-media-single {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  margin: 28px 0 40px;
}

.expanded-media-single iframe,
.expanded-media-single video {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.expanded-media-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin: 32px 0 40px;
}

.expanded-media-grid img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 14px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.55);
}

.expanded-media-grid img.landscape-gif {
  aspect-ratio: 16 / 9;
  object-fit: contain;
}

.expanded-media-grid.double-media {
  grid-template-columns: repeat(2, 1fr);
  max-width: 1300px;
  margin: 36px auto 44px;
  gap: 40px;
}

.expanded-media-grid.double-media img {
  width: 100%;
  height: auto;
  max-width: none;
  aspect-ratio: auto;
  object-fit: initial;
  margin: 0 auto;
}

/* ===============================
   Footer
   =============================== */
.site-footer {
  padding: 40px 0;
  border-top: 1px solid var(--border-subtle);
  color: var(--muted);
}

/* ===============================
   Mobile Optimization
   =============================== */
@media (max-width: 900px) {
  .expanded-media-grid {
    grid-template-columns: 1fr;
  }

  .expanded-media-grid.double-media {
    grid-template-columns: repeat(2, 1fr);
  }

  .card.expanded-desktop {
    padding: 28px 22px;
  }
}

@media (max-width: 700px) {
  .site-header {
    padding: 20px 0 12px;
  }

  .site-header h1 {
    font-size: 1.5rem;
    margin-bottom: 4px;
  }

  .site-header p {
    font-size: 0.9rem;
    margin-bottom: 8px;
  }

  .nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    justify-items: center;
    align-items: center;
    gap: 8px 0;
    text-align: center;
  }

  .nav a:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
  }

  .nav a:nth-child(4) {
    grid-column: 2;
    grid-row: 1;
  }

  .nav a:nth-child(2) {
    grid-column: 1;
    grid-row: 2;
  }

  .nav a:nth-child(5) {
    grid-column: 2;
    grid-row: 2;
  }

  .nav a:nth-child(3) {
    grid-column: 1;
    grid-row: 3;
  }

  .nav a:nth-child(6) {
    grid-column: 2;
    grid-row: 3;
  }

  .nav a {
    font-size: 0.95rem;
    padding: 6px 10px;
    display: block;
    border-radius: 8px;
    transition: background 0.2s ease, transform 0.2s ease;
  }

  .nav a:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
  }

  .nav .btn {
    justify-self: center;
    padding: 8px 14px;
    font-size: 0.9rem;
  }

  .about-section {
    flex-direction: column;
    text-align: center;
  }

  .profile-pic {
    width: 90px;
    height: 90px;
  }

  .badge-row img {
    width: 40px;
    height: 40px;
  }

  .section {
    padding: 40px 0;
  }
}