:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #ffffff;
  --bg-alt: #f8fafc;
  --text: #0f172a;
  --text-2: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  --space: clamp(3.5rem, 7vw, 5.5rem);
  --font: "Inter", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  scroll-behavior: smooth;
  scroll-padding-top: 4.5rem;
}
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  overflow-x: hidden;
}
img {
  max-width: 100%;
  display: block;
}
ul,
ol {
  list-style-position: inside;
}

.container {
  width: min(1120px, 92%);
  margin-inline: auto;
}
.container-narrow {
  max-width: 760px;
}
.section {
  padding-block: var(--space);
}
.section-alt {
  background: var(--bg-alt);
}
.text-center {
  text-align: center;
}
.center {
  justify-content: center;
}

/* Type */
h1,
h2,
h3 {
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.section-label {
  color: var(--primary);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 0.5rem;
}
.section-title {
  font-size: clamp(1.6rem, 3.5vw, 2.25rem);
  margin-bottom: 1.5rem;
}
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  margin-bottom: 0.5rem;
}
.lead {
  font-size: 1.1rem;
}
.muted,
.muted-inline {
  color: var(--text-2);
}
.muted-inline {
  font-weight: 400;
  font-size: 0.9em;
}
.text-primary {
  color: var(--primary);
}
.text-link {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}
.text-link:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.skip-link {
  position: absolute;
  left: -999px;
  background: var(--primary);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  z-index: 100;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.4rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition:
    transform 0.2s,
    box-shadow 0.2s,
    background 0.2s,
    color 0.2s;
}
.btn-sm {
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.btn-outline {
  border-color: var(--border);
  color: var(--text);
  background: #fff;
}
.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
}
.btn:focus-visible,
a:focus-visible,
button:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.45);
  outline-offset: 2px;
}
.btn[aria-disabled="true"] {
  opacity: 0.55;
}

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition:
    border-color 0.25s,
    box-shadow 0.25s;
}
.navbar.scrolled {
  border-color: var(--border);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
}
.logo {
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.logo-mark {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  font-size: 1rem;
}
.logo-dot {
  color: var(--primary);
}
.nav-menu {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  list-style: none;
}
.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-alt);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    border-color 0.2s,
    transform 0.2s;
}
.lang-toggle:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}
.lang-opt {
  color: var(--text-2);
}
.lang-opt.active {
  color: var(--primary);
}
.lang-sep {
  color: var(--border);
}
.nav-link {
  color: var(--text-2);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s;
}
.nav-link:hover,
.nav-link.active {
  color: var(--primary);
}
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0.5rem;
}
.nav-toggle span {
  width: 24px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition:
    transform 0.25s,
    opacity 0.25s;
}

/* Hero */
.hero {
  position: relative;
  padding: clamp(4rem, 9vw, 7rem) 0;
  background:
    radial-gradient(
      600px 300px at 85% 10%,
      rgba(37, 99, 235, 0.12),
      transparent 70%
    ),
    linear-gradient(#f8fafc 1px, transparent 1px),
    linear-gradient(90deg, #f8fafc 1px, transparent 1px);
  background-size:
    auto,
    36px 36px,
    36px 36px;
  overflow: hidden;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 3rem;
  align-items: center;
}
.hero-greeting {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #eff6ff;
  color: var(--primary-dark);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  margin-bottom: 1rem;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
}
.hero-title {
  font-size: clamp(2.2rem, 5.5vw, 3.5rem);
  font-weight: 800;
  margin-bottom: 0.75rem;
}
.hero-role {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}
.hero-desc {
  color: var(--text-2);
  margin: 0.75rem 0 1.75rem;
  max-width: 34rem;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.hero-meta {
  display: flex;
  gap: 2.5rem;
  margin-top: 2rem;
}
.hero-meta dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-2);
}
.hero-meta dd {
  font-weight: 600;
  font-size: 0.95rem;
}

.code-card {
  background: var(--text);
  color: #e2e8f0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.code-dots {
  display: flex;
  gap: 6px;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.code-dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #475569;
}
.code-dots i:first-child {
  background: #f87171;
}
.code-dots i:nth-child(2) {
  background: #fbbf24;
}
.code-dots i:last-child {
  background: #34d399;
}
.code-card pre {
  padding: 1.25rem;
  font-size: 0.85rem;
  line-height: 1.7;
  overflow-x: auto;
}
.k {
  color: #93c5fd;
}
.v {
  color: #e2e8f0;
}
.s {
  color: #86efac;
}
.b {
  color: #fbbf24;
}

/* Overview */
.overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}
.overview-grid .lead {
  margin-bottom: 1rem;
}
.overview-grid .muted {
  margin-bottom: 1.25rem;
}
.highlight-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  list-style: none;
}
.highlight-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  background: #fff;
  transition:
    transform 0.2s,
    box-shadow 0.2s,
    border-color 0.2s;
}
.highlight-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: var(--primary);
}
.highlight-card h3 {
  font-size: 1rem;
  margin: 0.5rem 0 0.25rem;
}
.highlight-card p {
  color: var(--text-2);
  font-size: 0.9rem;
}
.h-icon {
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 10px;
  background: #eff6ff;
  color: var(--primary);
  font-weight: 800;
}

/* Cards */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition:
    transform 0.25s,
    box-shadow 0.25s;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}
.card-body {
  padding: 1.5rem;
}
.card-body h3 {
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
}
.card-body p {
  color: var(--text-2);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.1rem;
}
.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
}
.badges li {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary-dark);
  background: #eff6ff;
  border: 1px solid #dbeafe;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
}

/* Projects */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-top: 1rem;
}
.project-card {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
}
.project-card .card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.project-card .card-body p {
  flex: 1;
}
.project-card .card-actions {
  margin-top: auto;
  padding-top: 1.1rem;
}
.project-card .card-actions .btn {
  flex: 1;
}
.project-img {
  width: 100%;
  height: 300px;
  object-fit: cover;
  object-position: top;
  border-bottom: 1px solid var(--border);
  display: block;
}
.project-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}
.project-card-link .project-img {
  transition: transform 0.3s ease;
}
.project-card-link:hover .project-img {
  transform: scale(1.03);
}

/* Gallery (project detail pages) */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}
.gallery-item {
  overflow: hidden;
  cursor: zoom-in;
}
.gallery-item img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: top;
  display: block;
  border-bottom: 1px solid var(--border);
  transition: transform 0.3s ease;
}
.gallery-item:hover img {
  transform: scale(1.02);
}
.gallery-item figcaption {
  padding: 0.6rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-2);
}
.gallery-item.figure-sm {
  max-width: 560px;
}
.gallery-item.figure-xs {
  max-width: 420px;
}

/* Split layout: text beside image (project detail pages) */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
  margin-top: 1rem;
}
.split > .timeline,
.split > .highlight-grid {
  margin-top: 0;
}
.split-media {
  margin: 0;
}
.split-media img {
  aspect-ratio: auto;
  max-height: 360px;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.9);
  display: grid;
  place-items: center;
  padding: 2rem;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.25s ease,
    visibility 0.25s;
  z-index: 100;
  cursor: zoom-out;
}
.lightbox.open {
  opacity: 1;
  visibility: visible;
}
.lightbox img {
  max-width: min(1100px, 100%);
  max-height: 88vh;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Timeline */
.timeline {
  list-style: none;
  position: relative;
  margin-top: 1rem;
  padding-left: 1.75rem;
  border-left: 2px solid var(--border);
  display: grid;
  gap: 1.25rem;
}
.timeline-item {
  position: relative;
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: -1.75rem;
  top: 1.4rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  transform: translateX(-50%);
  box-shadow: 0 0 0 4px #dbeafe;
}
.timeline .card {
  padding: 1.1rem 1.25rem;
}
.timeline-compact h3 {
  font-size: 1rem;
  margin: 0.2rem 0 0.25rem;
}
.timeline-compact p {
  color: var(--text-2);
  font-size: 0.92rem;
}
.timeline h3 {
  font-size: 1.1rem;
  margin: 0.25rem 0 0.6rem;
}
.timeline ul {
  color: var(--text-2);
  font-size: 0.95rem;
  display: grid;
  gap: 0.3rem;
}
.timeline-date {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Skills / Education */
.skill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 0.5rem;
  list-style: none;
  margin-top: 1.5rem;
  justify-content: center;
}
.skill-list li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  min-width: 4.5rem;
  transition: transform 0.2s;
}
.skill-list li:hover {
  transform: translateY(-4px);
}
.skill-list img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
}
.skill-list span {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
}
.skill-list li:hover span {
  color: var(--primary);
}
.edu-card {
  display: flex;
  gap: 1.25rem;
  padding: 1.75rem;
  align-items: flex-start;
}
.edu-icon {
  font-size: 2rem;
  background: #eff6ff;
  border-radius: 12px;
  padding: 0.5rem 0.75rem;
}
.edu-degree {
  font-weight: 600;
}
.edu-card .timeline-date {
  margin: 0.25rem 0 0.5rem;
}

/* Contact / Footer */
.contact {
  background: linear-gradient(180deg, #fff, #eff6ff);
}
.contact .muted {
  max-width: 36rem;
  margin: 0 auto 1.75rem;
}
.footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  background: #fff;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  align-items: center;
  justify-content: space-between;
}
.social {
  display: flex;
  gap: 1.25rem;
}
.social a {
  color: var(--text-2);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}
.social a:hover {
  color: var(--primary);
}

/* Reveal animation */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.6s ease,
    transform 0.6s ease;
}
.reveal.visible {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  * {
    transition-duration: 0.01ms !important;
  }
}

/* Responsive */
@media (max-width: 900px) {
  .hero-grid,
  .overview-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .hero-visual {
    max-width: 480px;
  }
  .project-grid {
    grid-template-columns: 1fr;
  }
  .split {
    grid-template-columns: 1fr;
  }
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 640px) {
  .nav-toggle {
    display: flex;
  }
  .nav-toggle.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .nav-toggle.open span:nth-child(2) {
    opacity: 0;
  }
  .nav-toggle.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
  .nav-menu {
    position: absolute;
    top: 4rem;
    left: 0;
    right: 0;
    background: #fff;
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.5rem 4%;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition:
      max-height 0.3s ease,
      opacity 0.3s,
      padding 0.3s;
  }
  .nav-menu.open {
    max-height: 320px;
    opacity: 1;
    padding-bottom: 1rem;
  }
  .nav-menu li {
    border-top: 1px solid var(--border);
  }
  .nav-menu li:first-child {
    border-top: 0;
  }
  .nav-link,
  .nav-cta {
    display: block;
    padding: 0.8rem 0;
  }
  .nav-menu .btn {
    margin-top: 0.5rem;
  }
  .nav-actions {
    border-top: 1px solid var(--border);
    padding-top: 0.8rem;
    justify-content: space-between;
  }
  .highlight-grid {
    grid-template-columns: 1fr;
  }
  .hero-meta {
    gap: 1.5rem;
  }
  .footer-inner {
    flex-direction: column;
    text-align: center;
    justify-content: center;
  }
}
