/* ===== Theme tokens ===== */
:root {
  --bg: #ffffff;
  --bg-alt: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #eef2f8;
  --border: #e3e8ef;
  --text: #0f172a;
  --text-muted: #5b6676;
  --accent: #2563eb;
  --accent-2: #0d9488;
  --accent-hover: #1d4ed8;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.1);
  --radius: 14px;
  --radius-sm: 10px;
  --max-width: 1080px;
  --transition: 0.25s ease;
  --header-h: 67px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Prevent background scroll while the mobile menu is open */
body.nav-open {
  overflow: hidden;
}

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

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

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

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  padding: 12px 26px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform var(--transition), background var(--transition), box-shadow var(--transition);
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.28);
}

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

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

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

.btn-sm {
  padding: 9px 20px;
  font-size: 0.88rem;
}

/* ===== Header / Nav ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.navbar {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06121f;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.brand-name {
  font-size: 1.05rem;
}

.nav-menu {
  list-style: none;
  display: flex;
  gap: 28px;
  align-items: center;
}

.nav-link {
  color: var(--text-muted);
  font-weight: 500;
  position: relative;
  padding: 4px 0;
  transition: color var(--transition);
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width var(--transition);
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}

.nav-toggle .bar {
  width: 26px;
  height: 3px;
  border-radius: 3px;
  background: var(--text);
  transition: transform var(--transition), opacity var(--transition);
}

.nav-toggle.open .bar:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.nav-toggle.open .bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle.open .bar:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* ===== Hero ===== */
.hero {
  position: relative;
  padding: 110px 0 90px;
  background:
    radial-gradient(900px 400px at 80% -10%, rgba(37, 99, 235, 0.1), transparent 60%),
    radial-gradient(700px 380px at 10% 10%, rgba(13, 148, 136, 0.08), transparent 55%);
}

.hero-inner {
  max-width: 760px;
}

.hero-eyebrow {
  color: var(--accent-2);
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 0.85rem;
  margin-bottom: 10px;
}

.hero-title {
  font-size: clamp(2.4rem, 6vw, 4rem);
  line-height: 1.1;
  font-weight: 800;
  background: linear-gradient(135deg, #0f172a, #2563eb);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-tagline {
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  color: var(--accent);
  font-weight: 600;
  margin-top: 8px;
}

.hero-intro {
  color: var(--text-muted);
  margin-top: 18px;
  font-size: 1.05rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 30px;
}

/* ===== Sections ===== */
.section {
  padding: 80px 0;
}

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

.section-title {
  font-size: clamp(1.6rem, 4vw, 2.3rem);
  font-weight: 800;
  margin-bottom: 30px;
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -8px;
  width: 56px;
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.section-lead {
  color: var(--text-muted);
  max-width: 760px;
  font-size: 1.05rem;
}

.section-lead.center {
  margin: 0 auto 36px;
  text-align: center;
}

/* ===== Stats ===== */
.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 36px;
}

.stat {
  flex: 1 1 160px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
}

.stat-num {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.95rem;
}

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

.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: transform var(--transition), border-color var(--transition);
}

.skill-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}

.skill-card h3 {
  margin-bottom: 8px;
  font-size: 1.15rem;
}

.skill-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ===== Projects ===== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition), box-shadow var(--transition);
}

.project-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow);
}

.project-logo {
  background: var(--surface-2);
  display: grid;
  place-items: center;
  padding: 30px;
  border-bottom: 1px solid var(--border);
}

.project-logo img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  border-radius: 18px;
}

.project-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.project-name {
  font-size: 1.3rem;
  font-weight: 700;
}

.project-subtitle {
  color: var(--accent-2);
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 2px;
}

.project-desc {
  color: var(--text-muted);
  margin: 12px 0 22px;
  font-size: 0.96rem;
  flex: 1;
}

.project-card .btn {
  align-self: flex-start;
}

/* ===== Contact ===== */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  max-width: 680px;
  margin: 0 auto;
}

.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform var(--transition), border-color var(--transition);
}

.contact-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}

.contact-label {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.contact-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
  word-break: break-word;
}

/* ===== Footer ===== */
.site-footer {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  padding: 40px 0 30px;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
}

.footer-brand .brand-name {
  font-weight: 700;
  font-size: 1.1rem;
}

.footer-brand p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 22px;
}

.footer-nav a {
  color: var(--text-muted);
  font-size: 0.95rem;
  transition: color var(--transition);
}

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

.copyright {
  color: var(--text-muted);
  font-size: 0.85rem;
}

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

  /* Backdrop behind the drawer (below the sticky header's z-index: 100,
     above regular page content) */
  body.nav-open::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
  }

  .nav-menu {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    height: 100dvh;
    width: min(80%, 320px);
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: calc(var(--header-h) + 16px) 22px 32px;
    background: var(--surface);
    border-left: 1px solid var(--border);
    box-shadow: -12px 0 30px rgba(0, 0, 0, 0.35);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    z-index: 110;
  }

  .nav-menu.open {
    transform: translateX(0);
  }

  .nav-menu li {
    width: 100%;
    position: relative;
    z-index: 1;
  }

  .nav-link {
    display: block;
    width: 100%;
    padding: 14px 6px;
    font-size: 1.1rem;
    border-bottom: 1px solid var(--border);
  }

  .nav-link::after {
    display: none;
  }

  .hero {
    padding: 70px 0 60px;
  }

  .section {
    padding: 60px 0;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }

  .brand-name {
    display: none;
  }

  .hero-actions {
    width: 100%;
  }

  .hero-actions .btn {
    flex: 1 1 100%;
    text-align: center;
  }

  .stats {
    gap: 14px;
  }

  .stat {
    flex: 1 1 100%;
  }

  .skill-card,
  .project-body,
  .contact-card {
    padding: 20px;
  }

  .project-logo {
    padding: 24px;
  }
}

/* ===== Accessibility ===== */
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
