:root {
  color-scheme: dark;
  --bg: #0a0f18;
  --bg-elevated: rgba(15, 22, 34, 0.82);
  --surface: rgba(14, 21, 33, 0.88);
  --surface-strong: #121b2a;
  --surface-soft: rgba(255, 255, 255, 0.04);
  --border: rgba(181, 198, 255, 0.14);
  --border-strong: rgba(181, 198, 255, 0.22);
  --text: #e9eefc;
  --text-muted: #a8b3cc;
  --accent: #7ee7d8;
  --accent-strong: #61cfd6;
  --accent-alt: #a4b8ff;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  --hero-glow: radial-gradient(circle at top right, rgba(126, 231, 216, 0.2), transparent 42%), radial-gradient(circle at left center, rgba(164, 184, 255, 0.15), transparent 30%);
}

html[data-theme="light"],
body[data-theme="light"] {
  color-scheme: light;
  --bg: #eef2f7;
  --bg-elevated: rgba(255, 255, 255, 0.84);
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #ffffff;
  --surface-soft: rgba(14, 22, 36, 0.04);
  --border: rgba(19, 31, 48, 0.12);
  --border-strong: rgba(19, 31, 48, 0.18);
  --text: #10192a;
  --text-muted: #516176;
  --accent: #0f766e;
  --accent-strong: #155e75;
  --accent-alt: #3b82f6;
  --shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
  --hero-glow: radial-gradient(circle at top right, rgba(59, 130, 246, 0.16), transparent 40%), radial-gradient(circle at left center, rgba(15, 118, 110, 0.14), transparent 30%);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 24%),
    var(--hero-glow),
    var(--bg);
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 58px 58px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.28), transparent 85%);
  opacity: 0.5;
}

body[data-theme="light"]::before {
  background-image: linear-gradient(rgba(15, 23, 42, 0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(15, 23, 42, 0.03) 1px, transparent 1px);
}

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

button {
  font: inherit;
}

.page-shell {
  position: relative;
  margin: 0 auto;
  width: calc(100% - 48px);
  padding: 24px 0 56px;
}

.topbar {
  position: sticky;
  top: 16px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  margin-bottom: 28px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-elevated);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  margin-left: 16px;
  margin-right: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 64px;
  height: 42px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(126, 231, 216, 0.18), rgba(164, 184, 255, 0.18));
  border: 1px solid var(--border-strong);
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.brand-text {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toggle-group {
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
}

.toggle {
  min-width: 46px;
  padding: 9px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.toggle:hover,
.toggle:focus-visible,
.theme-toggle:hover,
.theme-toggle:focus-visible,
.primary-button:hover,
.primary-button:focus-visible,
.secondary-button:hover,
.secondary-button:focus-visible {
  transform: translateY(-1px);
}

.toggle.is-active {
  background: linear-gradient(135deg, rgba(126, 231, 216, 0.18), rgba(164, 184, 255, 0.18));
  color: var(--text);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
  transition: border-color 180ms ease, transform 180ms ease, background-color 180ms ease;
}

.theme-toggle-icon {
  font-size: 0.95rem;
}

main {
  display: grid;
  gap: 26px;
}

.section {
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent), var(--bg-elevated);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
  gap: clamp(28px, 4vw, 48px);
  align-items: stretch;
  min-height: clamp(520px, 72vh, 760px);
  padding: clamp(34px, 4vw, 54px);
}

.hero-copy,
.contact-card,
.section-heading,
.card-grid,
.skills-layout,
.timeline {
  position: relative;
  z-index: 1;
}

.hero-copy {
  align-self: center;
  justify-self: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: min(100%, 900px);
  padding-block: clamp(6px, 1.2vw, 24px);
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero h1,
.section-heading h2,
.profile-card h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  line-height: 1.03;
  letter-spacing: -0.04em;
}

.hero h1 {
  max-width: 16ch;
  font-size: clamp(3rem, 5.8vw, 5.3rem);
}

.hero-text,
.section-heading p,
.skill-group p,
.timeline-item p,
.contact-note,
.contact-callout p,
.project-card p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.7;
}

.hero-text {
  max-width: 42ch;
  margin-top: 18px;
  font-size: 1.08rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.hero-visual {
  align-self: stretch;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: end;
}

.hero-visual img {
  display: block;
  width: min(100%, 460px);
  height: auto;
  max-height: 100%;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 24px 42px rgba(0, 0, 0, 0.28));
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease, color 180ms ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-alt));
  color: #07111d;
  font-weight: 800;
}

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

.profile-stats li,
.card-kicker,
.timeline-date,
.contact-list li,
.skill-group,
.project-card {
  border: 1px solid var(--border);
  background: var(--surface-soft);
}

.contact-card,
.project-card,
.skill-group,
.timeline-item {
  border: 1px solid var(--border);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01)), var(--surface);
}

.section-heading {
  max-width: 760px;
  margin-bottom: 22px;
}

.section-heading h2 {
  font-size: clamp(1.9rem, 4vw, 3rem);
}

.section-heading p {
  margin-top: 12px;
}

.card-grid,
.skills-layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.project-card,
.skill-group,
.timeline-item,
.contact-card {
  padding: 20px;
}

.project-card h3,
.skill-group h3,
.timeline-item h3,
.contact-card p,
.contact-list a {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.02em;
}

.project-card h3,
.skill-group h3,
.timeline-item h3 {
  margin-top: 10px;
  font-size: 1.2rem;
}

.card-kicker,
.timeline-date {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.timeline {
  display: grid;
  gap: 14px;
}

.timeline-item {
  position: relative;
  padding-left: 22px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 26px;
  bottom: 18px;
  width: 1px;
  background: linear-gradient(180deg, var(--accent), transparent);
}

.timeline-item::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 26px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-alt));
  box-shadow: 0 0 0 4px rgba(126, 231, 216, 0.12);
}

.timeline-item h3 {
  margin-top: 12px;
}

.timeline-item p {
  margin-top: 8px;
}

.contact-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
  padding: 24px;
  max-width: 500px;
}

.contact-note {
  font-size: 1.08rem;
  margin-bottom: 18px;
  max-width: 42ch;
}

.contact-list {
  display: grid;
  gap: 14px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.contact-list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 18px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02)), var(--surface-soft);
}

.contact-list span {
  color: var(--text-muted);
  font-size: 0.88rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
}

.contact-list a {
  color: var(--text);
  font-weight: 500;
}

.contact-copy {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

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

.social-links {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.social-link svg {
  display: block;
  width: 20px;
  height: 20px;
  color: var(--text);
}

.social-link:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(2,6,23,0.12);
  background: linear-gradient(135deg, rgba(126,231,216,0.06), rgba(164,184,255,0.04));
}

@media (max-width: 980px) {
  .hero,
  .contact-card,
  .card-grid,
  .skills-layout {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    padding: 28px;
  }

  .hero-copy {
    width: 100%;
  }

  .hero h1 {
    max-width: 14ch;
  }

  .hero-visual {
    justify-content: center;
  }

  .hero-visual img {
    width: min(100%, 380px);
  }

  .contact-card {
    padding: 20px;
  }
}

@media (max-width: 700px) {
  .page-shell {
    width: min(100% - 18px, 1180px);
    padding-top: 10px;
  }

  .topbar,
  .section {
    border-radius: 22px;
  }

  .topbar {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
  }

  /* On mobile, hide the full name and place controls next to the BM mark */
  .brand-text {
    display: none;
  }

  .controls {
    margin-left: 6px;
    gap: 8px;
  }

  .controls {
    width: 100%;
    justify-content: space-between;
  }

  .section {
    padding: 20px;
  }

  .hero {
    padding: 22px;
  }

  .hero h1 {
    max-width: 100%;
    font-size: clamp(2.4rem, 12vw, 3.7rem);
  }

  .profile-stats li,
  .contact-list li {
    flex-direction: column;
    align-items: flex-start;
  }

  .contact-card {
    gap: 14px;
  }

  .timeline-item {
    padding-left: 18px;
  }
}

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

[data-i18n] {
  transition: opacity 140ms ease;
}

body.is-switching [data-i18n] {
  opacity: 0.55;
}
