/*
  Mobile Developer Portfolio Styles
  - Mobile-first, accessible, and performant
  - No external font dependency for speed; use system stack
*/
:root {
  --bg: #0b1220;
  --bg-elev: #111827;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --accent: #22d3ee;
  --accent-2: #60a5fa;
  --border: #374151;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  background: #0b1220;
}

/*
  Anchor navigation offsets
  The header is sticky, so default hash-jumps can land with the section's top
  hidden behind the header. These rules add a consistent offset.
*/
:root {
  --anchor-offset: 20px;
}

html {
  scroll-padding-top: var(--anchor-offset);
}

section[id] {
  scroll-margin-top: var(--anchor-offset);
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.6;
  color: var(--text);
  background: radial-gradient(1200px 600px at 10% 0%, #2a0f4f 0%, var(--bg) 60%),
              linear-gradient(180deg, #2a0f4f 0%, #0b1220 100%);
  padding-top: env(safe-area-inset-top);
}


img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }

/* Utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Explore button */
#btn-explore {
  display: inline-block;
  padding: 8px 30px;
  border-radius: 40px;
  background-color: transparent;
  color: #fff;
  font-size: 1.5em;
  z-index: 20;
  text-decoration: none;
  border: 2px solid #bae1ff;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform, opacity;
}
/* Parallax animated state for btn-explore (to be toggled by JS) */
.btn-explore-animate {
  /* Example: move up and fade in as you scroll */
  transform: translateY(0) scale(1.05);
  opacity: 1;
}

/* Explore button hover and active states - purple hue */
#btn-explore:hover,
#btn-explore:active {
  background-color: #9a73dd;
  color: #fff;
  border-color: #805eb9;
}

#btn-explore:active {
  background-color: #9a73dd;
  border-color: #805eb9;
}

/* Experience duration line shown under each Experience h3 (mobile + timeline) */
.experience-duration {
  display: inline-block;
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.95rem;
}

/* Accessibility */
.skip-link { position: absolute; left: -9999px; top: -9999px; }
.skip-link:focus { left: var(--space-4); top: var(--space-4); z-index: 1000; background: var(--accent-2); color: #000; padding: var(--space-2) var(--space-4); border-radius: var(--radius-sm); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm); }

/* Layout */
.container { width: min(1100px, 100% - var(--space-8)); margin-inline: auto; }
.section { padding: var(--space-12) 0; }
.section-header { margin-bottom: var(--space-8); }
.section-header h2 { font-size: clamp(1.25rem, 3.5vw, 2rem); }
.section-header p { color: var(--muted); }

/* Parallax Landing */
.parallax-section { position: relative; height: 100vh; height: 100svh; height: 100dvh; width: 100%; padding: var(--space-8); display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: auto;
  /* Add purple-ish background to closely match original design */
  background: radial-gradient(1200px 600px at 10% 0%, #2a0f4f 0%, #191436 55%),
              linear-gradient(180deg, #180a2e 0%, #0b1220 100%);
}
.parallax-section::before { content: ""; position: absolute; bottom: 0; left: 0; height: 100px; width: 100%; background: linear-gradient(to top, #180a2e, transparent); z-index: 10; }
.parallax-section img { position: absolute; top: 0; left: 0; height: 100%; width: 100%; object-fit: cover; pointer-events: none; transform-origin: top left; }
#moon { mix-blend-mode: screen; }
#mountains_front { z-index: 12; }
#btn-explore { position: relative; z-index: 20; transform: translateY(100px); }
.parallax-section #btn-explore { will-change: transform; }
.webgl { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 11; }
/* Optimize parallax layers for smooth scrolling */
#stars, #moon, #mountains_back, #mountains_front { will-change: transform; backface-visibility: hidden; }

/* Comets container */
.comets { position: absolute; inset: 0; pointer-events: none; z-index: 9; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(17, 24, 39, 0.6); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.header-webgl { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--space-6); padding: var(--space-4) 0; position: relative; z-index: 2; }
.brand { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: 700; }
.brand-logo-img {
  height: 34px;
  width: 34px;
  max-width: 34px;
  max-height: 34px;
  flex: 0 0 34px;
  border-radius: 50%;
  object-fit: cover;
  transition: opacity 300ms ease-in-out;
}

@media (max-width: 768px) {
  .brand-logo-img {
    height: 32px;
    width: 32px;
    max-width: 32px;
    max-height: 32px;
    flex: 0 0 32px;
  }
}
.brand-text { letter-spacing: 0.3px; }

.site-nav .nav { list-style: none; display: flex; gap: var(--space-4); }
.site-nav .nav a { padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); }
.site-nav .nav a:hover { background: #0b1220; }

/* Project detail header back link: match primary nav styling (white + subtle hover) */
.project-top-back {
  margin-left: auto;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--text);
}

.project-top-back:hover {
  background: #0b1220;
}

.nav-toggle { display: none; height: 42px; width: 42px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-elev); color: var(--text); align-items: center; justify-content: center; }
.nav-toggle .icon { display: none; height: 22px; width: 22px; }
.nav-toggle[aria-expanded="false"] .icon-hamburger { display: block; }
.nav-toggle[aria-expanded="true"] .icon-close { display: block; }

/* Hero */
.hero { padding-top: var(--space-12); }
.grid { display: grid; gap: var(--space-8); }
.grid-2 { grid-template-columns: 1fr; }
.hero-title { font-size: clamp(1.75rem, 5vw, 2.6rem); margin: 0 0 var(--space-2); }
.hero-subtitle { color: var(--muted); margin-bottom: var(--space-6); }
.accent { color: var(--accent); }
.hero-cta { display: flex; gap: var(--space-4); flex-wrap: wrap; }

/* Hero: title + about icon row */
.hero-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}

.hero-title-row .hero-title {
  margin: 0;
  flex: 1;
}

.hero-about-icon {
  width: clamp(54px, 14vw, 92px);
  height: auto;
  flex: 0 0 auto;
  align-self: flex-start;
  transform: translateX(-10px);
}

.button { display: inline-flex; align-items: center; justify-content: center; padding: 0.7rem 1.1rem; border-radius: var(--radius-sm); border: 1px solid var(--border); transition: transform 120ms ease, background 120ms ease; }
.button.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #0b1220; border-color: transparent; }
.button.ghost { background: transparent; }
.button.small { padding: 0.5rem 0.9rem; font-size: 0.95rem; }
.button:hover { transform: translateY(-1px); }

/* Link buttons: a unique themed outline/glow that matches the portfolio */
.button.link-accent {
  border: 1px solid transparent;
  background-image:
    linear-gradient(rgba(17, 24, 39, 0.75), rgba(17, 24, 39, 0.75)),
    linear-gradient(135deg, rgba(34, 211, 238, 0.95), rgba(96, 165, 250, 0.95), rgba(255, 138, 0, 0.85));
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.12), 0 10px 22px rgba(0,0,0,0.25);
}

.button.link-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.25), 0 14px 26px rgba(0,0,0,0.35);
}

/* Back buttons on project pages: a bit more pop without being loud */
.button.back-pop {
  border-color: transparent;
  color: #0b1220;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.95), rgba(96, 165, 250, 0.95));
  box-shadow: 0 10px 22px rgba(0,0,0,0.32);
}

.button.back-pop:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(0,0,0,0.42);
}

.button.back-pop:active {
  transform: translateY(0);
}

.device-frame { position: relative; border-radius: 28px; padding: var(--space-4); border: 1px solid var(--border); background: #0b1220; box-shadow: var(--shadow); }
.device-frame::before { content: ""; position: absolute; inset: 0; border-radius: 28px; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05); pointer-events: none; }
.device-frame img { border-radius: 18px; }
.hero-art { max-width: 460px; margin-inline: auto; }

/* Cards */
.project-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-8); }
.card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: grid; grid-template-columns: 1fr; }
.project-grid > .card {
  /* Force the desktop grid cards to be: media on top, content below.
     Without this, the grid can distribute available height and visually “float” text away from the image. */
  grid-template-rows: auto 1fr;
  align-content: start;
}
.card-media img { width: 100%; height: 220px; object-fit: cover; }
.project-detail__hero img,
.project-detail__shot img {
  cursor: zoom-in;
}
.card-body { padding: var(--space-6); }
.project-grid > .card .card-body {
  display: flex;
  flex-direction: column;
}

.project-grid > .card .card-actions {
  margin-top: auto;
}
.card-body h3 { margin: 0 0 var(--space-2); font-size: clamp(1.1rem, 3.2vw, 1.4rem); }
.card-body p { color: var(--muted); margin-bottom: var(--space-6); }
.featured-projects-subtitle { display: block; color: var(--muted); font-size: 0.95rem; margin-bottom: var(--space-3); }

/* App Store-ish rating row (used on select cards) */
.app-rating {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin: calc(var(--space-2) * -1) 0 var(--space-6);
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
}

/* When the rating is a link, give it subtle link affordances without changing layout */
a.app-rating {
  cursor: pointer;
}

a.app-rating:hover {
  border-color: rgba(34, 211, 238, 0.32);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.10), 0 10px 22px rgba(0,0,0,0.18);
}

a.app-rating:active {
  transform: translateY(1px);
}

.app-rating__value {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.2px;
  color: var(--text);
}

.app-rating__outof {
  color: var(--muted);
  font-weight: 700;
}

.app-rating__stars {
  display: inline-flex;
  gap: 0.1rem;
  transform: translateY(-1px);
}

.app-rating__stars .is-on {
  /* Animated gradient fill (matches the skills border vibe) */
  color: transparent;
  background: linear-gradient(90deg, rgb(197, 90, 90), rgb(202, 86, 202), rgb(197, 90, 90));
  background-size: 300% 300%;
  animation: skill-border-flow 3.2s linear infinite;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.app-rating__stars .is-off { color: rgba(255, 255, 255, 0.22); }

/* Partial star (e.g., 4.2/5 => 20% filled last star) */
.app-rating__stars .is-part {
  --fill: 0.2;
  /* Base (unfilled) star should be visible */
  color: rgba(255, 255, 255, 0.22);
  position: relative;
  display: inline-block;
}

.app-rating__stars .is-part::after {
  content: "★";
  position: absolute;
  inset: 0;
  /* Animated gradient overlay */
  color: transparent;
  background: linear-gradient(90deg, rgb(197, 90, 90), rgb(202, 86, 202), rgb(197, 90, 90));
  background-size: 300% 300%;
  background-position: 0% 50%;
  animation: skill-border-flow 3.2s linear infinite;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  /* Only show the filled portion */
  -webkit-mask-image: linear-gradient(90deg, #000 calc(var(--fill) * 100%), transparent 0);
  mask-image: linear-gradient(90deg, #000 calc(var(--fill) * 100%), transparent 0);
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .app-rating__stars .is-on,
  .app-rating__stars .is-part {
    animation: none !important;
  }
}

/* Featured Project: My Health Toolkit image should show the top first */
.mhtk-card-img {
  object-position: top;
}

.app-rating__meta {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

@media (max-width: 420px) {
  .app-rating {
    flex-wrap: wrap;
    gap: 0.35rem 0.5rem;
  }
  .app-rating__meta {
    margin-left: 0;
    width: 100%;
  }
}
.tags { list-style: none; display: flex; gap: var(--space-2); flex-wrap: wrap; margin: 0 0 var(--space-6); padding: 0; }
.tags li {
  display: inline-flex;
  align-items: center;
  font-size: 0.9rem;
  line-height: 1.05;
  padding: 0.25rem 0.55rem;
  box-sizing: border-box;
  vertical-align: middle;
  border-radius: 999px;
  background: #0b1220;
  border: 1px solid transparent;
  /* animated orange border (keeps pill size via transparent border + background-clip) */
  background-image:
    linear-gradient(#0b1220, #0b1220),
    linear-gradient(90deg, #ff8a00, #ff3d81, #ffd000, #ff8a00);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  background-size: auto, 300% 300%;
  animation: tag-border-flow 4.2s linear infinite;
}

/* Nested tags inside Experience: ensure everything uses identical pill sizing */
.timeline .content .bullets .tags li {
  padding: 0.25rem 0.55rem;
  line-height: 1.05;
}

/* About page */
.about-layout {
  display: grid;
  gap: var(--space-8);
  grid-template-columns: 1fr;
}

.about-sidebar .card-body h2,
.about-content .card-body h2 {
  font-size: 1.15rem;
}

.about-grid {
  display: grid;
  gap: var(--space-8);
  margin-top: var(--space-8);
}

.about-cta {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  justify-content: flex-start;
  margin-top: var(--space-10);
}

/* About: hero image should show the top of the photo first (keep current card size/crop) */
.about-hero-img {
  object-position: top;
}

/* About: Pets image should be fully visible (no crop) with a subtle stars background */
.about-pets-media,
.about-content .card-media:has(.about-pets-img) {
  position: relative;
}

.about-pets-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0.22;
  transform: scale(1.08);
  pointer-events: none;
}

.about-pets-img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%; /* use the media container height */
  object-fit: contain;
  object-position: center 65%;
  padding: 0;
}

.about-pets-media {
  height: 220px; /* keep the same media area height as other cards */
}

/* Override global .card-media img sizing/cropping rules specifically for the pets card */
.about-pets-media img {
  height: 100%;
}

.about-pets-media .about-pets-bg {
  object-fit: cover;
}

/* About: on web/desktop only, make the hero image media area taller (2x) while keeping mobile unchanged */
@media (min-width: 900px) {
  .about-hero-media img {
    height: 440px;
  }

  .about-content .card-media:has(.about-hero-img) img {
    height: 440px; /* default card-media img height is 220px */
  }
}

@media (min-width: 900px) {
  .about-layout {
    grid-template-columns: 0.9fr 2.1fr;
    align-items: start;
  }

  .about-sidebar {
    position: sticky;
    top: calc(60px + env(safe-area-inset-top));
    align-self: start;
  }

  .about-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@keyframes tag-border-flow {
  0% { background-position: 0 0, 0% 50%; }
  100% { background-position: 0 0, 300% 50%; }
}
.card-actions { display: flex; gap: var(--space-3); align-items: center; }
.card-actions .note { color: var(--muted); font-size: 0.95rem; }

/* Experience cards: shown on all breakpoints
  - Mobile: horizontal swipe carousel (scroll-snap)
  - Desktop/tablet: grid of cards (see media queries)
*/
.experience-carousel { display: block; }
.experience-carousel__viewport {
  display: flex;
  gap: var(--space-6);
  overflow-x: auto;
  padding-bottom: var(--space-2);
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scroll-behavior: smooth;
  align-items: stretch;
}

.experience-carousel__viewport::-webkit-scrollbar { height: 8px; }
.experience-carousel__viewport::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 999px; }

.experience-carousel__slide {
  flex: 0 0 86%;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  display: flex;
}

.experience-carousel__slide > .card {
  height: 100%;
  width: 100%;
  grid-template-rows: auto 1fr;
  align-content: start;
}

.experience-carousel__slide > .card .card-body {
  display: flex;
  flex-direction: column;
}

.experience-carousel__slide > .card .card-actions {
  margin-top: auto;
}

.experience-carousel__dots {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  margin-top: var(--space-6);
}

.experience-carousel__dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.12);
}

.experience-carousel__dot[aria-current="true"] {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
}

/* Desktop/tablet: show Experience as a grid of cards (same vibe as Featured Projects on web) */
@media (min-width: 769px) {
  .experience-carousel { display: block; }
  .experience-carousel__viewport {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-8);
    overflow: visible;
    padding-bottom: 0;
    scroll-snap-type: none;
  }
  .experience-carousel__slide {
    flex: initial;
    scroll-snap-align: unset;
  }
  .experience-carousel__dots { display: none; }
}

@media (min-width: 900px) {
  .experience-carousel__viewport {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Featured Projects cards: shown on all breakpoints
  - Mobile: horizontal swipe carousel (scroll-snap)
  - Desktop/tablet: grid of cards
*/
.featured-projects-carousel { display: block; }
.featured-projects-carousel__viewport {
  display: flex;
  gap: var(--space-6);
  overflow-x: auto;
  padding-bottom: var(--space-2);
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scroll-behavior: smooth;
  align-items: stretch;
}

.featured-projects-carousel__viewport::-webkit-scrollbar { height: 8px; }
.featured-projects-carousel__viewport::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 999px; }

.featured-projects-carousel__slide {
  flex: 0 0 86%;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  display: flex;
}

.featured-projects-carousel__slide > .card {
  height: 100%;
  width: 100%;
  grid-template-rows: auto 1fr;
  align-content: start;
}

.featured-projects-carousel__slide > .card .card-body {
  display: flex;
  flex-direction: column;
}

.featured-projects-carousel__slide > .card .card-actions {
  margin-top: auto;
}

.featured-projects-carousel__dots {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  margin-top: var(--space-6);
}

.featured-projects-carousel__dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.12);
}

.featured-projects-carousel__dot[aria-current="true"] {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
}

/* Desktop/tablet: show Featured Projects as a grid of cards (same vibe as Experience on web) */
@media (min-width: 769px) {
  .featured-projects-carousel { display: block; }
  .featured-projects-carousel__viewport {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-8);
    overflow: visible;
    padding-bottom: 0;
    scroll-snap-type: none;
  }
  .featured-projects-carousel__slide {
    flex: initial;
    scroll-snap-align: unset;
  }
  .featured-projects-carousel__dots { display: none; }
}

@media (min-width: 900px) {
  .featured-projects-carousel__viewport {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Featured projects grid for desktop/tablet */
.featured-projects-grid { display: none; }

/* Skills */
.skills-grid { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-6); margin: 0; padding: 0; }
.skills-grid.classic { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); justify-items: center; }
.skill-card { display: block; }
.skill-card .module-border-wrap { padding: 3px; border-radius: var(--radius-sm); background: linear-gradient(90deg, rgb(197, 90, 90), rgb(202, 86, 202)); width: 190px; }
.skill-card .module { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-6) var(--space-4); text-align: center; }
.skill-card .module-border-wrap,
.skill-card .module { overflow: visible; }

/* Help mobile animation stay smooth by isolating paint/layout */
.skill-card .module { position: relative; }
.skill-icon { contain: layout paint style; }

/* Ensure popped/floating icons paint above neighboring grid items */
.skill-card { position: relative; isolation: isolate; }
.skill-card .module-border-wrap { position: relative; }
.skill-card.is-active { z-index: 30; }
.skill-card .module-border-wrap:has(.skill-icon.is-popped),
.skill-card .module-border-wrap:has(.skill-icon.is-floating) {
  z-index: 20;
}
.skill-icon {
  height: 64px;
  width: 64px;
  border-radius: 10px;
  margin-inline: auto;
  display: block;
  cursor: pointer;
  transition: transform 260ms cubic-bezier(0.22, 1, 0.36, 1), filter 260ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-font-smoothing: antialiased;
}

.skill-icon:active { transform: scale(0.98); }

.skill-icon.is-popped {
  transform: scale(1.45);
  z-index: 5;
  filter: drop-shadow(0 14px 24px rgba(0,0,0,0.45));
}

/* Mobile: continuous center-and-pop animation (based on whether the icon is left/right in the viewport) */
@media (max-width: 768px) {
  .skill-icon.is-floating {
    /* Use a GPU-friendly transform-only animation (less janky on mobile) */
    animation: skill-float-center 1050ms cubic-bezier(0.22, 1, 0.36, 1) 1;
    filter: drop-shadow(0 14px 24px rgba(0,0,0,0.45));
    z-index: 6;
    will-change: transform;
  }

  /* If the icon starts on the left, shift right toward center */
  .skill-icon.is-floating.to-center-right {
    --skill-float-x: 22vw;
  }
  /* If the icon starts on the right, shift left toward center */
  .skill-icon.is-floating.to-center-left {
    --skill-float-x: -22vw;
  }

  @keyframes skill-float-center {
    0% { transform: translate3d(0, 0, 0) scale(1); }
    50% { transform: translate3d(var(--skill-float-x, 0), 0, 0) scale(1.9); }
    100% { transform: translate3d(0, 0, 0) scale(1); }
  }
}
.skill-label { display: block; margin-top: var(--space-2); font-size: 0.95rem; }

/* Animated gradient border for skills (traveling border effect)
   Uses existing colors; animation disabled for reduced-motion users.
*/
.skill-card .module-border-wrap {
  background: linear-gradient(90deg, rgb(197, 90, 90), rgb(202, 86, 202), rgb(197, 90, 90));
  background-size: 300% 300%;
  animation: skill-border-flow 3.2s linear infinite;
}

@keyframes skill-border-flow {
  0% { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}

/* Skills Categories */
.skills-search-wrapper {
  position: relative;
  margin-bottom: var(--space-8);
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.skills-search-input {
  width: 100%;
  padding: 0.7rem 1.1rem 0.7rem 2.6rem;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-family: inherit;
  transition: all 260ms cubic-bezier(0.22, 1, 0.36, 1);
  /* Prevent iOS zoom on input focus */
  -webkit-text-size-adjust: 100%;
}

.skills-search-input::placeholder {
  color: var(--muted);
}

.skills-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.1);
}

@media (min-width: 769px) {
  .skills-search-input {
    font-size: 0.95rem;
  }
}

.skills-search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 1rem;
}

.skills-search-clear {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(34, 211, 238, 0.15);
  border: none;
  color: var(--accent);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  transition: all 260ms cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  min-width: 38px;
  min-height: 38px;
}

.skills-search-clear:hover {
  color: var(--accent);
  background: rgba(34, 211, 238, 0.2);
}

.skills-search-clear:active {
  transform: translateY(-50%) scale(0.95);
}

.skills-search-clear[hidden] {
  display: none;
}

@media (min-width: 769px) {
  .skills-search-clear {
    font-size: 1.2rem;
    padding: 0.4rem;
    min-width: auto;
    min-height: auto;
  }
}

.skills-carousel-nav {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
  flex-wrap: wrap;
  justify-content: center;
}

.skills-nav-btn {
  padding: 0.6rem 1.2rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 260ms cubic-bezier(0.22, 1, 0.36, 1);
}

.skills-nav-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.skills-nav-btn.active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--bg);
  box-shadow: 0 4px 15px rgba(34, 211, 238, 0.3);
  transform: translateY(-1px);
}

.skills-category {
  margin-bottom: var(--space-12);
}

.skills-category[hidden] {
  display: none;
}

.skills-category h3 {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0 0 var(--space-8) 0;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.skill-card[hidden] {
  display: none;
}

.skills-no-results {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-12);
  min-height: 300px;
}

.skills-no-results[hidden] {
  display: none;
}

.skills-no-results-content {
  text-align: center;
  max-width: 400px;
  padding: var(--space-8);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.05), rgba(168, 85, 247, 0.05));
  border: 1px solid rgba(34, 211, 238, 0.2);
  border-radius: var(--radius-md);
  backdrop-filter: blur(10px);
}

.skills-no-results-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
  display: inline-block;
  animation: bounce-gentle 2s ease-in-out infinite;
}

@keyframes bounce-gentle {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

.skills-no-results-content h3 {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 var(--space-4) 0;
}

.skills-no-results-content p {
  font-size: 0.95rem;
  color: var(--muted);
  margin: var(--space-3) 0;
  line-height: 1.6;
}

.skills-no-results-content strong {
  color: var(--accent);
  font-weight: 600;
}

.skills-no-results {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-12);
  min-height: 300px;
}

.skills-no-results[hidden] {
  display: none;
}

.skills-no-results-content {
  text-align: center;
  max-width: 400px;
  padding: var(--space-8);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.05), rgba(168, 85, 247, 0.05));
  border: 1px solid rgba(34, 211, 238, 0.2);
  border-radius: var(--radius-md);
  backdrop-filter: blur(10px);
}

.skills-no-results-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
  display: inline-block;
  animation: bounce-gentle 2s ease-in-out infinite;
}

@keyframes bounce-gentle {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

.skills-no-results-content h3 {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 var(--space-4) 0;
}

.skills-no-results-content p {
  font-size: 0.95rem;
  color: var(--muted);
  margin: var(--space-3) 0;
  line-height: 1.6;
}

.skills-no-results-content strong {
  color: var(--accent);
  font-weight: 600;
}

.skills-no-results-subtitle {
  font-style: italic;
  font-size: 0.9rem !important;
  margin-top: var(--space-6) !important;
}

/* Mobile: Remove box styling and reduce padding */
@media (max-width: 768px) {
  .skills-no-results {
    padding: var(--space-6) var(--space-4);
    min-height: auto;
  }

  .skills-no-results-content {
    background: transparent;
    border: none;
    backdrop-filter: none;
    padding: var(--space-4);
  }
}

.skill-card.skill-match {
  animation: skill-match-pulse 600ms ease;
}

@keyframes skill-match-pulse {
  0% {
    transform: scale(0.95);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Mobile: Show single category */
@media (max-width: 768px) {
  .skills-carousel-nav {
    display: flex;
  }

  .skills-grid.classic {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: var(--space-6);
  }
}

/* Desktop: Show buttons and tighter grid, but respect hidden attribute */
@media (min-width: 769px) {
  .skills-carousel-nav {
    display: flex;
  }

  .skills-grid.classic {
    grid-template-columns: repeat(5, minmax(140px, 1fr));
    gap: var(--space-4);
  }
}

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-6); }
.timeline li { display: grid; grid-template-columns: 6.2ch 1fr; gap: var(--space-4); align-items: start; }
.timeline .time {
  font-weight: 700;
  color: var(--accent);
  width: 6.2ch;
  max-width: 6.2ch;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.1;
}
.timeline .content h3 { margin: 0 0 var(--space-2); font-size: 1.1rem; line-height: 1.25; }
.timeline .content p { margin: 0; color: var(--muted); }
.timeline .content p + p { margin-top: var(--space-2); }

/* Matches the "clean kicker" style used elsewhere, but with comfortable spacing in the timeline */
.timeline .content .kicker {
  margin: 0 0 var(--space-3);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.35px;
  text-transform: uppercase;
  color: rgba(156, 163, 175, 0.95);
}

/* Timeline bullet lists (Experience details) */
.timeline .content .bullets {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--muted);
}

.timeline .content .bullets li {
  display: block;
  width: auto;
  line-height: 1.6;
}

/* When a bullet contains a nested .tags list, align the label + pills on one wrapped row.
   This avoids the first pill looking taller due to the nested <ul> acting like a block.
*/
.timeline .content .bullets li:has(> .tags) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.timeline .content .bullets li:has(> .tags) > strong {
  margin-right: var(--space-2);
  line-height: 1.2;
}

.timeline .content .bullets li + li {
  margin-top: var(--space-3);
}

.timeline .content .bullets strong { color: var(--text); font-weight: 700; }

/* Experience section now uses cards instead of the timeline (timeline kept in markup as fallback) */
#experience .timeline { display: none; }

/* Skill tags inside Experience (nested .tags inside .bullets) */
.timeline .content .bullets .tags {
  margin: 0;
  display: inline-flex;
  flex-wrap: wrap;
}

.timeline .content .bullets .tags li {
  font-size: 0.85rem;
}

/* Contact */
.contact-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-6); }
.contact-card { display: grid; grid-template-columns: auto 1fr; gap: var(--space-4); align-items: center; padding: var(--space-6); background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); transition: all 200ms ease; }
.contact-card:hover { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.25), 0 10px 22px rgba(0, 0, 0, 0.25); transform: translateY(-2px); }
.contact-card .icon { height: 40px; width: 40px; display: inline-grid; place-items: center; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #0b1220; }
.contact-card.feature-request .icon { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.contact-card .text strong { display: block; }
.contact-card .text span { color: var(--muted); }

/* Contact grid: 2 columns on desktop */
@media (min-width: 768px) {
  .contact-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Payment / Donation Cards */
.payment-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
  margin-bottom: var(--space-10);
}

.payment-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-6);
  align-items: center;
  padding: var(--space-6);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 200ms ease;
  position: relative;
  overflow: hidden;
}

.payment-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.08), rgba(96, 165, 250, 0.08));
  opacity: 0;
  transition: opacity 200ms ease;
  pointer-events: none;
}

.payment-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.25), 0 10px 22px rgba(0, 0, 0, 0.25);
  transform: translateY(-2px);
}

.payment-card:hover::before {
  opacity: 1;
}

.payment-card__icon {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--bg);
}

.payment-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

.payment-card__content {
  position: relative;
  z-index: 1;
  flex: 1;
}

.payment-card__content h3 {
  margin: 0 0 var(--space-2);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

.payment-card__handle {
  margin: 0 0 var(--space-3);
  color: var(--muted);
  font-size: 0.95rem;
  word-break: break-all;
}

.payment-card__link {
  display: inline-block;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0b1220;
  border: none;
  cursor: pointer;
  transition: all 120ms ease;
  text-decoration: none;
}

.payment-card__link:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.payment-card__link:active {
  transform: translateY(0);
}

.donate-message {
  text-align: center;
  padding: var(--space-8);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.08), rgba(96, 165, 250, 0.08));
  border: 1px solid rgba(34, 211, 238, 0.15);
  border-radius: var(--radius);
  color: var(--muted);
}

.donate-message p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Tablet/Desktop: 2 columns for payment cards */
@media (min-width: 768px) {
  .payment-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .payment-card {
    grid-template-columns: auto 1fr;
  }
}

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: rgba(17, 24, 39, 0.8); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--space-6); padding: var(--space-8) 0; }

/* Project detail pages */
.muted { color: var(--muted); }

.project-detail__header {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
  align-items: start;

/* Design-only / disabled project action buttons (dynamic project pages) */
.project-detail__actions .button[aria-disabled="true"],
.project-detail__actions .button[data-disabled="true"] {
  opacity: 0.6;
  cursor: default;
  pointer-events: none;
  filter: grayscale(0.25);
}
  margin-bottom: var(--space-10);
}

.project-detail__kicker {
  margin: 0 0 var(--space-3);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.35px;
  text-transform: uppercase;
  color: rgba(156, 163, 175, 0.95);
}

.project-detail__title {
  margin: 0 0 var(--space-2);
  font-size: clamp(1.6rem, 4.8vw, 2.5rem);
}

.project-detail__subtitle {
  margin: 0 0 var(--space-6);
  color: var(--muted);
  max-width: 64ch;
}

.project-detail__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.project-detail__hero {
  border-radius: 28px;
  border: 1px solid var(--border);
  background: #0b1220;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.project-detail__hero img {
  width: 100%;
  height: auto;
  display: block;
}

.project-detail__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
}

/* Screenshots section (mobile-first): no nested card, just a floating title + carousel */
.project-detail__screenshots {
  min-width: 0;
}

.project-detail__screenshots-title {
  margin: 0 0 var(--space-4);
  font-size: 1.25rem;
}

.project-detail__card h2 {
  margin: 0 0 var(--space-4);
  font-size: 1.25rem;
}

.project-detail__list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  display: grid;
  gap: var(--space-2);
}

.project-detail__gallery {
  display: flex;
  gap: var(--space-6);
  overflow-x: auto;
  padding-bottom: var(--space-2);
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  align-items: stretch;
}

/* Make the carousel feel less "boxed in" on mobile */
.project-detail__gallery-wrap {
  margin-left: calc(var(--space-4) * -1);
  margin-right: calc(var(--space-4) * -1);
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

.project-detail__gallery-wrap {
  position: relative;
}

.project-detail__gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  height: 42px;
  width: 42px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.38);
  color: var(--text);
  display: grid;
  place-items: center;
}

.project-detail__gallery-nav.prev { left: 10px; }
.project-detail__gallery-nav.next { right: 10px; }

.project-detail__gallery-nav[disabled] {
  opacity: 0.35;
  cursor: default;
}

.project-detail__gallery-dots {
  margin-top: var(--space-4);
  display: flex;
  justify-content: center;
  gap: 10px;
}

.project-detail__gallery-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.10);
}

.project-detail__gallery-dot[aria-current="true"] {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
}

.project-detail__shot {
  margin: 0;
  flex: 0 0 100%;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  /* Match the other card surfaces on this page (Overview/Highlights) */
  background: rgba(255,255,255,0.03);
  scroll-snap-align: start;
  display: grid;
  grid-template-rows: auto auto auto;
  max-height: 72vh;
  min-width: 0;
}

.project-detail__shot-title {
  padding: var(--space-4) var(--space-4) var(--space-3);
  font-weight: 700;
  letter-spacing: 0.2px;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.project-detail__shot-desc {
  padding: var(--space-3) var(--space-4) var(--space-4);
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
  max-width: 100%;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
}

@media (min-width: 640px) {
  .project-detail__shot {
    flex-basis: min(520px, 85%);
  }
}

.project-detail__shot img {
  width: 100%;
  height: min(52vh, 440px);
  display: block;
  object-fit: contain;
  background: rgba(255,255,255,0.03);
  align-self: start;
}

/* Lightbox: full-screen image viewer (shared across pages) */
.lightbox[hidden] { display: none; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
}

.lightbox__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  background: rgba(0,0,0,0.78);
}

.lightbox__panel {
  position: relative;
  margin: 0;
  width: min(1100px, calc(100vw - 2rem));
  height: min(740px, calc(100vh - 2rem));
  display: grid;
  place-items: center;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(17, 24, 39, 0.88);
  box-shadow: 0 22px 70px rgba(0,0,0,0.65);
}

.lightbox__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  cursor: zoom-out;
}

.lightbox__close {
  position: absolute;
  top: 10px;
  right: 10px;
  height: 40px;
  width: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.38);
  color: var(--text);
}

.lightbox__close:hover {
  transform: translateY(-1px);
}

@media (prefers-reduced-motion: reduce) {
  .lightbox__close:hover {
    transform: none;
  }
}

.project-detail__footer {
  margin-top: var(--space-10);
  display: flex;
  justify-content: flex-start;
}

@media (min-width: 900px) {
  .project-detail__header {
    grid-template-columns: 1.1fr 0.9fr;
    align-items: center;
  }
  .project-detail__grid {
    grid-template-columns: 1fr 1fr;
  }
  .project-detail__grid .project-detail__card:last-child {
    grid-column: 1 / -1;
  }

  /* Desktop: keep the existing boxed card look for the screenshots section */
  .project-detail__screenshots {
    grid-column: 1 / -1;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.03);
    box-shadow: var(--shadow);
    overflow: hidden;
  }
  .project-detail__screenshots-title {
    margin: 0;
    padding: var(--space-6) var(--space-6) 0;
  }
  .project-detail__screenshots .project-detail__gallery-wrap {
    margin-left: 0;
    margin-right: 0;
    padding-left: var(--space-6);
    padding-right: var(--space-6);
    padding-top: var(--space-4);
  }
  .project-detail__screenshots .project-detail__gallery-dots {
    padding-bottom: var(--space-6);
  }
  .project-detail__gallery {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: visible;
    scroll-snap-type: none;
  }

  .project-detail__shot {
    flex: initial;
    scroll-snap-align: none;
    /* Mobile slider uses a max-height to prevent huge slides; on desktop grid,
       allow the card to grow so figcaption isn't clipped. */
    max-height: none;
  }

  .project-detail__shot img {
    height: auto;
    object-fit: initial;
  }

  /* Desktop: allow full titles/descriptions (no clamp) */
  .project-detail__shot-desc {
    display: block;
    -webkit-line-clamp: unset;
    line-clamp: unset;
    overflow: visible;
  }

  /* A little breathing room in the grid layout */
  .project-detail__shot-title { padding-bottom: var(--space-2); }
  .project-detail__shot-desc { padding-top: var(--space-2); }

  .project-detail__gallery-nav,
  .project-detail__gallery-dots {
    display: none;
  }
}

/* Responsive */
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: 1.1fr 0.9fr; align-items: center; }
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .skills-grid.classic { grid-template-columns: repeat(3, minmax(190px, 1fr)); justify-items: center; }
}
@media (min-width: 900px) {
  .project-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .skills-grid.classic { grid-template-columns: repeat(4, minmax(190px, 1fr)); justify-items: center; }
}

/* Mobile nav */
@media (max-width: 768px) {
  .nav-toggle { display: inline-flex; }
  .site-nav .nav { display: none; position: absolute; top: 60px; right: var(--space-4); padding: var(--space-4); background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); flex-direction: column; gap: var(--space-2); box-shadow: var(--shadow); }
  .site-nav .nav.open { display: flex; }
  /* Ensure hamburger aligns to the right */
  .header-inner { justify-content: flex-start; }
  .nav-toggle { margin-left: auto; }
  /* Mobile Skills: three columns with slightly smaller tiles
     - Add a touch more horizontal spacing than vertical
     - Center incomplete last rows (1 or 2 items) visually
  */
  .skills-grid.classic {
    /* Clamp tile width so 3 columns never overflow the container */
    --skill-tile: clamp(104px, 28vw, 138px);
    grid-template-columns: repeat(3, var(--skill-tile));
    justify-content: center;
    justify-items: center;
    column-gap: var(--space-4);
    row-gap: var(--space-3);
    overflow-x: hidden;
  }
  .skill-card .module-border-wrap { width: var(--skill-tile); }
  .skill-card .module { text-align: center; padding: var(--space-4) var(--space-3); }
  .skill-icon { height: 48px; width: 48px; margin-inline: auto; }

  /* If the last row has only 1 item, place it in the middle column */
  .skills-grid.classic > li:last-child:nth-child(3n + 1) {
    grid-column: 2;
  }

  /* Featured Projects: use swipe carousel instead of stacked cards */
  .project-grid { display: none; }
  .project-carousel { display: block; }

  /* Experience: use swipe carousel instead of the timeline */
  #experience .timeline { display: none; }
  .experience-carousel { display: block; }
}

/* Extra small screens: fallback to compact rows if two columns would overflow */
@media (max-width: 380px) {
  .skills-grid.classic {
    --skill-tile: clamp(108px, 42vw, 140px);
    grid-template-columns: repeat(2, var(--skill-tile));
    justify-content: center;
    justify-items: center;
    column-gap: var(--space-3);
    row-gap: var(--space-3);
  }
  .skill-card .module-border-wrap { background: none; padding: 0; width: auto; }
  .skill-card .module { display: grid; grid-template-columns: auto 1fr; text-align: left; align-items: center; gap: var(--space-4); padding: var(--space-4); }
  .skill-icon { height: 40px; width: 40px; margin: 0; }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .skill-card .module-border-wrap { animation: none !important; }
  .tags li { animation: none !important; }
  .skill-icon { transition: none !important; }
  .skill-icon.is-popped { transform: none !important; filter: none !important; }
  .skill-icon.is-floating { animation: none !important; }
}

/* Shooting stars (parallax decoration) - original style */
.comets .shooting_stars {
  position: absolute;
  width: 2px;
  height: 2px;
  top: 50%;
  left: 50%;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(255,255,255,0.1), 0 0 0 8px rgba(255,255,255,0.1), 0 0 20px rgba(255,255,255,1);
  animation: animate 3s linear infinite;
}
.comets .shooting_stars::before {
  content: "";
  position: absolute;
  top: 50%;
  width: 300px;
  height: 1px;
  background: linear-gradient(90deg, #fff, transparent);
}
@keyframes animate {
  0% { transform: rotate(315deg) translateX(0); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: rotate(315deg) translateX(-1000px); opacity: 0; }
}
/* Scoped nth-child positions/durations to mimic original design */
.comets .shooting_stars:nth-child(1) { top: 10px; right: 0px; left: initial; animation-delay: -0.5s; animation-duration: 1.4s; }
.comets .shooting_stars:nth-child(2) { top: 0px; right: 80px; left: initial; animation-delay: -1.2s; animation-duration: 3s; }
.comets .shooting_stars:nth-child(3) { top: 80px; right: 0px; left: initial; animation-delay: -0.8s; animation-duration: 2s; }
.comets .shooting_stars:nth-child(4) { top: 0px; right: 180px; left: initial; animation-delay: -0.6s; animation-duration: 1.6s; }
.comets .shooting_stars:nth-child(5) { top: 0px; right: 400px; left: initial; animation-delay: -1s; animation-duration: 2.5s; }
.comets .shooting_stars:nth-child(6) { top: 0px; right: 600px; left: initial; animation-delay: -0.7s; animation-duration: 3s; }
.comets .shooting_stars:nth-child(7) { top: 300px; right: 0px; left: initial; animation-delay: -1.4s; animation-duration: 1.75s; }
.comets .shooting_stars:nth-child(8) { top: 20px; right: 700px; left: initial; animation-delay: -0.3s; animation-duration: 1.25s; }
.comets .shooting_stars:nth-child(9) { top: 40px; right: 1000px; left: initial; animation-delay: -2s; animation-duration: 2.25s; }
.comets .shooting_stars:nth-child(10) { top: 60px; right: 450px; left: initial; animation-delay: -1.7s; animation-duration: 2.25s; }
.comets .shooting_stars:nth-child(11) { top: 120px; right: 300px; left: initial; animation-delay: -0.9s; animation-duration: 2.1s; }
.comets .shooting_stars:nth-child(12) { top: 200px; right: 520px; left: initial; animation-delay: -1.1s; animation-duration: 1.9s; }

/* Optional: keep randomized style available but unused */
.shooting_stars_random { position: absolute; width: var(--size, 2px); height: var(--size, 2px); top: var(--top, 50%); left: var(--left, 50%); background: #fff; border-radius: 50%; box-shadow: 0 0 0 4px rgba(255,255,255,0.08), 0 0 0 8px rgba(255,255,255,0.06), 0 0 20px rgba(255,255,255,0.9); filter: blur(var(--blur, 0px)); animation: shooting var(--duration, 3s) linear infinite var(--delay, 0s); z-index: 9; }
.shooting_stars_random::before { content: ""; position: absolute; top: 50%; width: var(--length, 300px); height: 1px; background: linear-gradient(90deg, rgba(255,255,255,1), rgba(255,255,255,0)); }
@keyframes shooting { 0% { transform: rotate(315deg) translateX(0); opacity: 1; } 70% { opacity: 1; } 100% { transform: rotate(315deg) translateX(-1000px); opacity: 0; } }

/* Mobile: maintain full viewport height */
@media (max-width: 768px) {
  .parallax-section { height: 100vh; height: 100svh; height: 100dvh; }
}
