:root {
  --bg: #080d18;
  --bg-soft: #0e1626;
  --header-height: 74px;
  --surface: #111b2d;
  --surface-strong: #17243a;
  --text: #f4f8ff;
  --muted: #a8b6ce;
  --line: #263653;
  --accent: #63b6ff;
  --accent-strong: #248fe7;
  --accent-soft: rgba(99, 182, 255, 0.14);
  --purple: #9671ff;
  --header-bg: rgba(8, 13, 24, 0.78);
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.34);
  --code-bg: #09111f;
  --success: #45d99a;
}

:root[data-theme="light"] {
  --bg: #f6f8fc;
  --bg-soft: #eef3fa;
  --surface: #ffffff;
  --surface-strong: #f7faff;
  --text: #12203a;
  --muted: #61708b;
  --line: #d8e1ef;
  --accent: #127fd6;
  --accent-strong: #0964b0;
  --accent-soft: rgba(18, 127, 214, 0.1);
  --purple: #6a46d8;
  --header-bg: rgba(246, 248, 252, 0.82);
  --shadow: 0 22px 60px rgba(31, 50, 82, 0.13);
  --code-bg: #101b2d;
  --success: #188a5c;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  line-height: 1.65;
  transition:
    background 180ms ease,
    color 180ms ease;
}

a {
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.container {
  width: min(1120px, calc(100% - 2.5rem));
  margin: 0 auto;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: -100%;
  left: 1rem;
  background: var(--accent);
  color: #06101e;
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  font-weight: 800;
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}

/* Header */

.site-header {
  position: sticky;
  z-index: 50;
  top: 0;
  border-bottom: 1px solid rgba(125, 151, 194, 0.12);
  background: var(--header-bg);
  backdrop-filter: blur(18px);
}

.nav-row {
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.brand {
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: -0.07em;
  text-decoration: none;
}

.brand i {
  color: var(--accent);
  font-style: normal;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 1.4rem;
}

.main-nav a {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  transition: color 160ms ease;
}

.main-nav a:hover,
.main-nav a:focus-visible {
  color: var(--text);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.48rem;
  min-height: 40px;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 800;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.theme-icon {
  color: var(--accent);
}

/* Hero */

.hero {
  position: relative;
  overflow: hidden;
  scroll-margin-top: var(--header-height);
  padding: 7.5rem 0 5rem;
  background:
    linear-gradient(130deg, rgba(99, 182, 255, 0.05), transparent 32%),
    radial-gradient(circle at 70% 15%, rgba(150, 113, 255, 0.12), transparent 28%);
}

.hero::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(126, 155, 204, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(126, 155, 204, 0.06) 1px, transparent 1px);
  background-size: 44px 44px;
  content: "";
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  align-items: center;
  gap: 4rem;
}

.eyebrow,
.section-kicker {
  margin: 0 0 1rem;
  color: var(--accent);
  font-size: 0.79rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.status-dot {
  width: 0.58rem;
  height: 0.58rem;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 6px rgba(69, 217, 154, 0.12);
}

.hero h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(2.7rem, 6vw, 5.7rem);
  line-height: 1.03;
  letter-spacing: -0.07em;
}

.hero h1 span {
  color: var(--accent);
}

.hero-text {
  max-width: 650px;
  margin: 1.7rem 0 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 2rem;
}

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.05rem;
  border: 1px solid transparent;
  border-radius: 0.75rem;
  font-size: 0.92rem;
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
}

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

.button-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #05101e;
  box-shadow: 0 12px 30px rgba(36, 143, 231, 0.24);
}

.button-secondary {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

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

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  margin: 2.7rem 0 0;
  padding: 0;
  list-style: none;
}

.hero-meta li {
  display: grid;
  gap: 0.12rem;
}

.hero-meta span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-meta strong {
  font-size: 0.89rem;
}

/* Hero cards */

.hero-visual {
  position: relative;
  min-height: 500px;
}

.profile-card,
.code-card {
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.profile-card {
  position: absolute;
  z-index: 2;
  top: 2rem;
  right: 0;
  width: min(100%, 360px);
  overflow: hidden;
}

.profile-image-wrap {
  height: 250px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--accent-soft), rgba(150, 113, 255, 0.2));
}

.profile-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  filter: saturate(0.92) contrast(1.03);
}

.profile-card-content {
  padding: 1.35rem;
}

.small-label {
  margin: 0 0 0.5rem;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.profile-card h2 {
  margin: 0;
  font-size: 1.27rem;
  line-height: 1.25;
  letter-spacing: -0.035em;
}

.profile-card p:last-child {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.code-card {
  position: absolute;
  bottom: 0;
  left: 0;
  width: min(100%, 390px);
  overflow: hidden;
  background: var(--code-bg);
  transform: rotate(-3deg);
}

.code-card-header {
  display: flex;
  gap: 0.38rem;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid rgba(169, 191, 231, 0.12);
}

.code-card-header span {
  width: 0.58rem;
  height: 0.58rem;
  border-radius: 50%;
  background: #ff6b6b;
}

.code-card-header span:nth-child(2) {
  background: #ffd166;
}

.code-card-header span:nth-child(3) {
  background: #45d99a;
}

.code-card pre {
  overflow: auto;
  margin: 0;
  padding: 1.25rem;
  color: #d7e8ff;
  font-size: 0.82rem;
  line-height: 1.75;
}

.code-keyword {
  color: #ab8cff;
}

.code-string {
  color: #82e4b4;
}

/* Shared sections */

.section {
  padding: 6.5rem 0;
}

.section-alt {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}

.split-layout,
.section-heading {
  display: grid;
  grid-template-columns: minmax(0, 0.94fr) minmax(0, 1.06fr);
  gap: 4rem;
}

.split-layout h2,
.section-heading h2,
.contact-card h2 {
  max-width: 620px;
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1.08;
  letter-spacing: -0.055em;
}

.section-content {
  max-width: 650px;
}

.section-content p,
.section-heading > p,
.contact-card p {
  margin: 0;
  color: var(--muted);
}

.section-content p + p {
  margin-top: 1.1rem;
}

.inline-links {
  display: flex;
  gap: 1.15rem;
  margin-top: 1.55rem;
}

.inline-links a {
  color: var(--accent);
  font-weight: 850;
  text-decoration: none;
}

.inline-links a:hover {
  text-decoration: underline;
}

/* Skills */

.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 2.25rem;
}

.skill-card {
  min-height: 270px;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--surface);
  transition:
    transform 180ms ease,
    border-color 180ms ease;
}

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

.skill-number {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.skill-card h3 {
  margin: 1.25rem 0 1rem;
  font-size: 1.16rem;
  letter-spacing: -0.025em;
}

.skill-card ul {
  display: grid;
  gap: 0.58rem;
  margin: 0;
  padding: 0;
  color: var(--muted);
  list-style: none;
}

.skill-card li::before {
  margin-right: 0.55rem;
  color: var(--accent);
  content: "→";
}

/* Projects */

.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2.25rem;
}

.project-card {
  display: flex;
  min-height: 325px;
  flex-direction: column;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--surface);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.project-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-5px);
}

.project-card-featured {
  border-color: rgba(99, 182, 255, 0.46);
  background:
    linear-gradient(145deg, var(--surface), rgba(99, 182, 255, 0.08)),
    var(--surface);
}

.project-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.project-topline a {
  display: inline-grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text);
  font-size: 1.1rem;
  text-decoration: none;
}

.project-topline a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.project-icon {
  font-size: 1.2rem;
}

.project-card h3 {
  margin: 2.1rem 0 0;
  font-size: 1.35rem;
  letter-spacing: -0.035em;
}

.project-card p {
  margin: 0.9rem 0 1.5rem;
  color: var(--muted);
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: auto;
}

.project-tags span {
  padding: 0.34rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

/* Contact */

.contact-section {
  padding-top: 4.5rem;
  padding-bottom: 6.5rem;
}

.contact-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2.5rem;
  padding: clamp(1.5rem, 4vw, 3rem);
  border: 1px solid rgba(99, 182, 255, 0.48);
  border-radius: 1.25rem;
  background:
    radial-gradient(circle at 100% 0%, rgba(150, 113, 255, 0.18), transparent 35%),
    linear-gradient(140deg, var(--surface), var(--bg-soft));
}

.contact-card p {
  max-width: 580px;
  margin-top: 1rem;
}

.contact-actions {
  display: grid;
  min-width: min(100%, 270px);
  gap: 0.75rem;
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.5rem 0;
}

.footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.footer-row p {
  margin: 0;
}

.footer-row div {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-row a {
  color: var(--muted);
  font-weight: 750;
  text-decoration: none;
}

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

/* Responsive */

@media (max-width: 900px) {
  .hero {
    padding-top: 5.5rem;
  }

  .hero-grid,
  .split-layout,
  .section-heading {
    grid-template-columns: 1fr;
    gap: 2.2rem;
  }

  .hero-visual {
    min-height: 470px;
    max-width: 560px;
  }

  .skills-grid,
  .projects-grid {
    grid-template-columns: 1fr;
  }

  .skill-card,
  .project-card {
    min-height: auto;
  }

  .contact-card {
    display: grid;
  }
}

@media (max-width: 640px) {
  :root {
    --header-height: 66px;
  }
  
  .container {
    width: min(100% - 1.5rem, 1120px);
  }

  .nav-row {
    min-height: auto;
    flex-wrap: wrap;
    padding: 0.75rem 0;
  }

  .main-nav {
    display: flex;
    order: 3;
    width: 100%;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.25rem;
    padding-top: 0.7rem;
    border-top: 1px solid var(--line);
  }

  .main-nav a {
    font-size: 0.78rem;
  }

  .hero h1 {
    font-size: clamp(2.55rem, 14vw, 4rem);
  }

  .hero-meta {
    display: grid;
    gap: 1rem;
  }

  .profile-card {
    top: 0;
    width: min(100%, 330px);
  }

  .code-card {
    width: min(92%, 340px);
  }

  .section,
  .contact-section {
    padding: 4.5rem 0;
  }

  .footer-row {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
