/* ==========================================================================
   Design tokens
   ========================================================================== */
:root {
  --color-bg: #0A0F1E;
  --color-surface: #1C2333;
  --color-accent: #38B6FF;
  --color-text: #E2E8F0;
  --color-muted: #64748B;
  --color-danger: #EB5757;
  --color-success: #27AE60;
  --font-heading: 'Space Grotesk', sans-serif;
  --font-mono: ui-monospace, 'SFMono-Regular', 'Menlo', 'Consolas', monospace;
  --font-body: 'Inter', sans-serif;
  --nav-height: 72px;
  --content-max: 1100px;
}

/* ==========================================================================
   Reset
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ==========================================================================
   Shared layout
   ========================================================================== */
.section-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 4rem 1.5rem;
}

.section-title {
  font-size: clamp(1.5rem, 1.1rem + 1.5vw, 2.25rem);
  margin-bottom: 2rem;
}

#about,
#projects,
#mini-projects,
#certifications,
#skills,
#contact {
  scroll-margin-top: var(--nav-height);
}

.pill {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  background: rgb(56 182 255 / 12%);
  color: var(--color-accent);
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1.75rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.btn-primary {
  background: var(--color-accent);
  color: var(--color-bg);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px -10px rgb(56 182 255 / 60%);
}

.btn-secondary {
  border: 1px solid var(--color-muted);
  color: var(--color-text);
}

.btn-secondary:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* ==========================================================================
   Nav
   ========================================================================== */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: rgb(28 35 51 / 75%);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgb(255 255 255 / 6%);
}

.nav-inner {
  max-width: var(--content-max);
  height: 100%;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.nav-brand {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  color: var(--color-text);
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.nav-link {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-muted);
  transition: color 0.2s ease;
}

.nav-link:hover {
  color: var(--color-accent);
}

.nav-social {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--color-muted);
}

.nav-social a {
  display: inline-flex;
  transition: color 0.2s ease;
}

.nav-social a:hover {
  color: var(--color-accent);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
}

.nav-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  padding: calc(var(--nav-height) + 2rem) 1.5rem 4rem;
  background:
    radial-gradient(circle at 20% 20%, rgb(56 182 255 / 18%), transparent 45%),
    radial-gradient(circle at 80% 30%, rgb(56 182 255 / 12%), transparent 50%),
    radial-gradient(circle at 50% 90%, rgb(56 182 255 / 10%), transparent 55%),
    var(--color-bg);
  background-size: 200% 200%;
  animation: hero-gradient 18s ease-in-out infinite;
}

@keyframes hero-gradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 720px;
}

.hero-name {
  font-size: clamp(2.25rem, 1.5rem + 3.2vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  margin-top: 1rem;
  font-size: clamp(1rem, 0.9rem + 0.5vw, 1.25rem);
  color: var(--color-muted);
}

.hero-actions {
  margin-top: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   About
   ========================================================================== */
#about .section-inner {
  padding-top: 2.5rem;
  padding-bottom: 2.5rem;
}

.about-grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 3rem;
  align-items: center;
}

.about-bio p {
  color: var(--color-text);
  font-size: 1.05rem;
  line-height: 1.7;
}

.about-photo {
  max-width: 260px;
  margin: 0 auto;
}

.profile-photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid rgb(255 255 255 / 8%);
}

/* ==========================================================================
   Filter bar
   ========================================================================== */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.filter-btn {
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  border: 1px solid rgb(255 255 255 / 12%);
  color: var(--color-muted);
  font-size: 0.85rem;
  font-weight: 500;
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.filter-btn:hover {
  color: var(--color-text);
  border-color: var(--color-accent);
}

.filter-btn.is-active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-bg);
}

/* ==========================================================================
   Card grid
   ========================================================================== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
}

.card-grid-compact {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.28rem 0.75rem;
  border-radius: 999px;
  background: rgb(10 15 30 / 85%);
  border: 1px solid rgb(255 255 255 / 15%);
  color: var(--color-text);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.status-badge::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-muted);
}

.status-badge.status-ongoing::before {
  background: var(--color-success);
  animation: status-pulse 2s ease-out infinite;
}

@keyframes status-pulse {
  0% {
    box-shadow: 0 0 0 0 rgb(39 174 96 / 60%);
  }

  70% {
    box-shadow: 0 0 0 7px rgb(39 174 96 / 0%);
  }

  100% {
    box-shadow: 0 0 0 0 rgb(39 174 96 / 0%);
  }
}

.card .status-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
}

.card {
  position: relative;
  display: block;
  background: var(--color-surface);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 6%);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgb(56 182 255 / 40%);
  box-shadow: 0 20px 40px -20px rgb(0 0 0 / 50%);
}

.card.is-hidden {
  display: none;
}

.card-cover {
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgb(56 182 255 / 25%), rgb(28 35 51 / 60%));
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  color: rgb(226 232 240 / 50%);
  overflow: hidden;
}

.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-body {
  padding: 1.25rem;
}

.card-title {
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
}

.card-context {
  color: var(--color-muted);
  font-size: 0.85rem;
  margin-bottom: 0.9rem;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ==========================================================================
   Certifications
   ========================================================================== */
.cert-row {
  overflow: auto hidden;
  scroll-behavior: auto;
  scrollbar-width: none;
  mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
}

.cert-row::-webkit-scrollbar {
  display: none;
}

.cert-track {
  display: flex;
  gap: 1.25rem;
  width: max-content;
}

.cert-card {
  display: block;
  flex: 0 0 auto;
  width: 240px;
  background: var(--color-surface);
  border: 1px solid rgb(255 255 255 / 6%);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.cert-card:hover {
  transform: translateY(-4px);
  border-color: rgb(56 182 255 / 30%);
}

.cert-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: #fff;
}

.cert-body {
  padding: 1rem 1.25rem 1.25rem;
}

.cert-name {
  font-size: 0.95rem;
  margin-bottom: 0.3rem;
}

.cert-issuer {
  color: var(--color-muted);
  font-size: 0.8rem;
}

.cert-date {
  color: var(--color-muted);
  font-size: 0.75rem;
  margin-top: 0.5rem;
}

/* ==========================================================================
   Skills
   ========================================================================== */
.skills-groups {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.skills-group-title {
  font-size: 0.95rem;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.9rem;
}

.skills-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

/* ==========================================================================
   Contact & footer
   ========================================================================== */
.contact {
  border-top: 1px solid rgb(255 255 255 / 6%);
  background: var(--color-surface);
}

.contact-inner {
  text-align: center;
  padding: 3.5rem 1.5rem;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1.75rem;
  margin-bottom: 1.5rem;
}

.contact-link {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text);
  transition: color 0.2s ease;
}

.contact-link:hover {
  color: var(--color-accent);
}

.contact-credit {
  color: var(--color-muted);
  font-size: 0.85rem;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (width <= 768px) {
  .nav-toggle {
    display: flex;
  }

  .nav-menu {
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: rgb(20 26 40 / 98%);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgb(255 255 255 / 6%);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  .nav-menu.is-open {
    max-height: 320px;
  }

  .nav-menu .nav-link {
    width: 100%;
    padding: 1rem 1.5rem;
  }

  .about-grid {
    grid-template-columns: 1fr;
  }

  .section-inner {
    padding: 3rem 1.25rem;
  }
}
