:root {
  --bg: #f7f9fc;
  --bg-soft: #eef4fb;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-solid: #ffffff;
  --text: #142033;
  --muted: #60708a;
  --line: rgba(52, 72, 102, 0.16);
  --primary: #086d7b;
  --primary-2: #0e9f9a;
  --accent: #f5b95f;
  --shadow: 0 22px 70px rgba(20, 32, 51, 0.14);
  --shadow-soft: 0 16px 42px rgba(20, 32, 51, 0.09);
  --radius-xl: 34px;
  --radius-lg: 24px;
  --radius-md: 16px;
  --max: 1160px;
  --header-h: 78px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(14, 159, 154, 0.19), transparent 34rem),
    radial-gradient(circle at 85% 10%, rgba(245, 185, 95, 0.18), transparent 28rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

body.dark {
  --bg: #0b1220;
  --bg-soft: #101b2d;
  --surface: rgba(16, 27, 45, 0.82);
  --surface-solid: #111d30;
  --text: #e7eefc;
  --muted: #a7b6ce;
  --line: rgba(231, 238, 252, 0.15);
  --primary: #17c4bf;
  --primary-2: #76e0d9;
  --accent: #f8cb7c;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  --shadow-soft: 0 16px 44px rgba(0, 0, 0, 0.24);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.36;
  background-image:
    linear-gradient(rgba(96, 112, 138, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(96, 112, 138, 0.08) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 70%);
}

body.dark::before {
  opacity: 0.24;
}

img,
svg {
  max-width: 100%;
}

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

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.skip-link {
  position: fixed;
  left: 16px;
  top: 16px;
  z-index: 1000;
  transform: translateY(-140%);
  border-radius: 999px;
  padding: 0.7rem 1rem;
  color: #07111f;
  background: var(--accent);
  font-weight: 800;
}

.skip-link:focus {
  transform: translateY(0);
}

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

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1100;
  width: 100%;
  height: 4px;
  transform-origin: left;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.container {
  width: min(100% - 40px, var(--max));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  border-bottom: 1px solid transparent;
  transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.site-header.is-scrolled {
  border-color: var(--line);
  background: color-mix(in srgb, var(--surface-solid) 78%, transparent);
  box-shadow: 0 14px 40px rgba(20, 32, 51, 0.08);
  backdrop-filter: blur(18px);
}

.nav {
  width: min(100% - 32px, var(--max));
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-inline: auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 850;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 12px 24px rgba(8, 109, 123, 0.24);
  font-size: 0.86rem;
}

.brand-text {
  white-space: nowrap;
}

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

.nav-menu a,
.theme-toggle {
  border: 0;
  border-radius: 999px;
  padding: 0.68rem 0.85rem;
  color: var(--muted);
  background: transparent;
  font-weight: 700;
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.nav-menu a:hover,
.theme-toggle:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  transform: translateY(-1px);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.menu-toggle {
  display: none;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-solid);
}

.menu-toggle span:not(.sr-only) {
  display: block;
  width: 20px;
  height: 2px;
  margin: 4px auto;
  border-radius: 99px;
  background: var(--text);
}

.section {
  position: relative;
  padding: 96px 0;
  scroll-margin-top: calc(var(--header-h) + 18px);
}

.tinted {
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--bg-soft) 78%, transparent), transparent);
}

.hero {
  min-height: calc(100vh - var(--header-h));
  display: grid;
  align-items: center;
  padding-top: 42px;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.hero-bg::before,
.hero-bg::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  filter: blur(2px);
  opacity: 0.7;
}

.hero-bg::before {
  width: 38vw;
  height: 38vw;
  right: -12vw;
  top: 8vh;
  background: radial-gradient(circle, rgba(14, 159, 154, 0.23), transparent 70%);
}

.hero-bg::after {
  width: 28vw;
  height: 28vw;
  left: -8vw;
  bottom: 4vh;
  background: radial-gradient(circle, rgba(245, 185, 95, 0.22), transparent 70%);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 44px;
  align-items: center;
}

.eyebrow {
  margin: 0 0 0.8rem;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 920px;
  margin-bottom: 1.35rem;
  font-size: clamp(3rem, 8vw, 6.8rem);
  line-height: 0.93;
  letter-spacing: -0.07em;
}

h2 {
  margin-bottom: 1rem;
  font-size: clamp(2rem, 4vw, 3.45rem);
  line-height: 1.04;
  letter-spacing: -0.055em;
}

h3 {
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.hero-lead,
.section-heading p,
.section-body p,
.contact-card p {
  color: var(--muted);
  font-size: 1.08rem;
}

.hero-lead {
  max-width: 720px;
  margin-bottom: 2rem;
  font-size: clamp(1.05rem, 2vw, 1.28rem);
}

.hero-actions,
.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.button,
.ghost-button,
.filter,
.tab {
  border: 0;
  border-radius: 999px;
  font-weight: 850;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.85rem 1.15rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

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

.button.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 16px 32px rgba(8, 109, 123, 0.24);
}

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

.hero-card,
.contact-card,
.project-card,
.skill-card,
.education-card,
.timeline-item,
.modal-card {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.hero-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xl);
  padding: 2rem;
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 8px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.avatar {
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  margin-bottom: 1.4rem;
  border-radius: 28px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.18), transparent),
    linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 22px 40px rgba(8, 109, 123, 0.28);
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -0.05em;
}

.hero-card h2 {
  margin-bottom: 0.25rem;
  font-size: 1.8rem;
}

.hero-card > p {
  color: var(--muted);
  margin-bottom: 1.35rem;
}

.quick-facts {
  display: grid;
  gap: 0.85rem;
  margin: 0 0 1.5rem;
}

.quick-facts div {
  border-left: 3px solid var(--primary);
  padding-left: 0.9rem;
}

.quick-facts dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.11em;
}

.quick-facts dd {
  margin: 0.1rem 0 0;
  font-weight: 750;
}

.social-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.social-row a {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.48rem 0.75rem;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.social-row a:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
}

.split {
  display: grid;
  grid-template-columns: minmax(260px, 0.78fr) minmax(0, 1.22fr);
  gap: 64px;
  align-items: start;
}

.split.reverse {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 1.1fr);
}

.section-heading.centered {
  max-width: 780px;
  margin: 0 auto 2.4rem;
  text-align: center;
}

.section-body p + p {
  margin-top: 1rem;
}

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

.stat-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.2rem;
  background: var(--surface-solid);
}

.stat-card span {
  display: block;
  color: var(--primary);
  font-size: 2.3rem;
  font-weight: 900;
  line-height: 1;
}

.stat-card small {
  color: var(--muted);
  font-weight: 750;
}

.skill-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.tabs,
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.tab,
.filter {
  border: 1px solid var(--line);
  padding: 0.68rem 0.9rem;
  color: var(--muted);
  background: var(--surface-solid);
}

.tab.is-active,
.filter.is-active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
}

.skill-search {
  flex: 0 1 360px;
}

.skill-search input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.78rem 1rem;
  color: var(--text);
  background: var(--surface-solid);
}

.skills-grid,
.project-grid,
.education-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.skill-card,
.project-card,
.education-card {
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.skill-card:hover,
.project-card:hover,
.education-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--primary) 46%, var(--line));
  box-shadow: var(--shadow);
}

.skill-card h3,
.project-card h3,
.education-card h3 {
  margin-bottom: 0.55rem;
  font-size: 1.15rem;
}

.skill-card p,
.project-card p,
.education-card p {
  margin-bottom: 1.1rem;
  color: var(--muted);
  font-size: 0.96rem;
}

.meter {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 18%, transparent);
}

.meter span {
  display: block;
  width: var(--level);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transform-origin: left;
  animation: grow 1.1s ease both;
}

@keyframes grow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.empty-state {
  text-align: center;
  color: var(--muted);
  font-weight: 800;
}

.filters {
  justify-content: center;
  margin-bottom: 2rem;
}

.timeline {
  position: relative;
  display: grid;
  gap: 1rem;
  max-width: 930px;
  margin-inline: auto;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 20px;
  width: 2px;
  background: linear-gradient(var(--primary), var(--accent));
}

.timeline-item {
  position: relative;
  border-radius: var(--radius-lg);
  margin-left: 44px;
  overflow: hidden;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -32px;
  top: 24px;
  width: 14px;
  height: 14px;
  border: 4px solid var(--bg);
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent);
}

.timeline-summary {
  width: 100%;
  display: grid;
  grid-template-columns: 132px 1fr auto;
  gap: 1rem;
  align-items: center;
  border: 0;
  padding: 1.2rem;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.timeline-summary::after {
  content: "+";
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  color: #fff;
  background: var(--primary);
  font-weight: 900;
}

.timeline-summary[aria-expanded="true"]::after {
  content: "−";
}

.time {
  color: var(--primary);
  font-size: 0.84rem;
  font-weight: 900;
}

.role {
  font-weight: 900;
}

.org {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 750;
}

.timeline-details {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.25s ease;
}

.timeline-details > p {
  min-height: 0;
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  padding: 0 1.2rem;
}

.timeline-item.is-open .timeline-details {
  grid-template-rows: 1fr;
}

.timeline-item.is-open .timeline-details > p {
  padding-bottom: 1.2rem;
}

.project-grid {
  grid-template-columns: repeat(4, 1fr);
}

.project-card {
  display: flex;
  min-height: 260px;
  flex-direction: column;
}

.project-tag,
.education-card span {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 1rem;
  border-radius: 999px;
  padding: 0.42rem 0.68rem;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 11%, transparent);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.project-card p {
  flex: 1;
}

.ghost-button {
  width: fit-content;
  border: 1px solid var(--line);
  padding: 0.64rem 0.9rem;
  color: var(--text);
  background: transparent;
}

.ghost-button:hover {
  border-color: transparent;
  color: #fff;
  background: var(--primary);
}

.accordion {
  display: grid;
  gap: 0.75rem;
}

.accordion-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  color: var(--text);
  background: var(--surface-solid);
  font-weight: 900;
  text-align: left;
}

.accordion-panel {
  display: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1rem 1.2rem;
  background: var(--surface);
}

.accordion-panel.is-open {
  display: block;
}

.publication-list {
  display: grid;
  gap: 0.8rem;
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
}

.publication-list strong {
  color: var(--text);
}

.education-grid {
  grid-template-columns: repeat(3, 1fr);
}

.contact {
  padding-top: 70px;
}

.contact-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: center;
  border-radius: var(--radius-xl);
  padding: clamp(1.5rem, 4vw, 3rem);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--primary) 11%, transparent), transparent),
    var(--surface);
}

.contact-card h2 {
  max-width: 760px;
}

.contact-actions {
  justify-content: flex-end;
  min-width: 280px;
}

.footer {
  border-top: 1px solid var(--line);
  padding: 28px 0;
  color: var(--muted);
}

.footer-grid {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.footer a {
  margin-left: 1rem;
  font-weight: 800;
}

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

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  place-items: center;
  padding: 1rem;
}

.modal.is-open {
  display: grid;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 10, 18, 0.66);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(100%, 640px);
  border-radius: var(--radius-xl);
  padding: 2rem;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: var(--surface-solid);
  font-size: 1.7rem;
  line-height: 1;
}

.toast,
.to-top {
  position: fixed;
  z-index: 180;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast {
  left: 50%;
  bottom: 24px;
  border-radius: 999px;
  padding: 0.8rem 1rem;
  color: #fff;
  background: #122033;
  box-shadow: var(--shadow);
  font-weight: 850;
  transform: translate(-50%, 12px);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.to-top {
  right: 20px;
  bottom: 20px;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: var(--shadow-soft);
  font-size: 1.25rem;
  font-weight: 900;
}

.to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

[hidden] {
  display: none !important;
}

@media (max-width: 1040px) {
  .hero-grid,
  .split,
  .split.reverse,
  .contact-card {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .skills-grid,
  .project-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .contact-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 860px) {
  :root {
    --header-h: 68px;
  }

  .brand-text {
    display: none;
  }

  .menu-toggle {
    display: block;
  }

  .nav-menu {
    position: fixed;
    top: calc(var(--header-h) + 10px);
    left: 16px;
    right: 16px;
    display: grid;
    gap: 0.3rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--surface-solid);
    box-shadow: var(--shadow);
    transform: translateY(-16px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  }

  .nav-menu.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .nav-menu a,
  .theme-toggle {
    justify-content: center;
    width: 100%;
    background: color-mix(in srgb, var(--primary) 7%, transparent);
  }

  .section {
    padding: 72px 0;
  }

  .hero-grid {
    gap: 28px;
  }

  .skill-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .skill-search {
    flex-basis: auto;
  }

  .timeline-summary {
    grid-template-columns: 1fr auto;
  }

  .time,
  .org {
    grid-column: 1 / -1;
  }

  .timeline-summary::after {
    grid-row: 1 / 3;
    grid-column: 2;
  }

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

@media (max-width: 640px) {
  .container,
  .nav {
    width: min(100% - 28px, var(--max));
  }

  h1 {
    font-size: clamp(2.7rem, 16vw, 4.6rem);
  }

  .hero-card,
  .contact-card,
  .modal-card {
    border-radius: 24px;
    padding: 1.35rem;
  }

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

  .timeline::before {
    display: none;
  }

  .timeline-item {
    margin-left: 0;
  }

  .timeline-item::before {
    display: none;
  }

  .hero-actions .button,
  .contact-actions .button {
    width: 100%;
  }

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

  .footer a {
    display: inline-block;
    margin: 0 1rem 0.5rem 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
