:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #eef3f8;
  --text: #172033;
  --muted: #667085;
  --line: #dfe6ee;
  --accent: #245fa8;
  --accent-strong: #17487f;
  --accent-soft: #e8f1fb;
  --shadow: 0 20px 60px rgba(27, 48, 75, 0.08);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --container: 1120px;
}

html[data-resolved-theme="dark"] {
  --bg: #0f141c;
  --surface: #161d27;
  --surface-soft: #111821;
  --text: #eef4fb;
  --muted: #a8b3c2;
  --line: #283342;
  --accent: #78b7ff;
  --accent-strong: #a6ceff;
  --accent-soft: #172b42;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 92px; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  transition: background .25s ease, color .25s ease;
}
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
svg { display: block; max-width: 100%; }

.skip-link {
  position: fixed; left: 12px; top: -50px; z-index: 999;
  background: var(--surface); padding: 10px 14px; border-radius: 8px;
}
.skip-link:focus { top: 12px; }

.container { width: min(calc(100% - 40px), var(--container)); margin-inline: auto; }
.section { padding: 112px 0; }
.muted-section { background: var(--surface-soft); }

.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
}
.navbar { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-weight: 700; letter-spacing: -.02em; }
.brand-mark {
  display: grid; place-items: center; width: 36px; height: 36px;
  border-radius: 11px; color: white; background: var(--accent); font-size: 13px;
}
.nav-panel { display: flex; align-items: center; gap: 28px; }
.nav-links { display: flex; align-items: center; gap: 26px; }
.nav-links a { color: var(--muted); font-size: 14px; font-weight: 600; transition: color .2s ease; }
.nav-links a:hover, .nav-links a.active { color: var(--accent); }
.theme-switcher { display: flex; gap: 3px; padding: 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.theme-switcher button {
  width: 31px; height: 31px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  background: transparent; color: var(--muted); line-height: 1;
}
.theme-switcher button.active { background: var(--accent-soft); color: var(--accent); }
.menu-button { display: none; border: 0; background: transparent; padding: 6px; cursor: pointer; }
.menu-button span { display: block; width: 24px; height: 2px; margin: 5px 0; background: var(--text); }

.hero { min-height: calc(100vh - 76px); display: grid; align-items: center; }
.hero-grid { display: grid; grid-template-columns: 1.02fr .98fr; align-items: center; gap: 76px; }
.eyebrow { margin: 0 0 14px; text-transform: uppercase; letter-spacing: .16em; color: var(--accent); font-weight: 700; font-size: 12px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(3rem, 6vw, 5.6rem); line-height: .98; letter-spacing: -.06em; margin-bottom: 26px; }
h1 span { color: var(--accent); }
h2 { font-size: clamp(2.25rem, 4vw, 4rem); line-height: 1.08; letter-spacing: -.045em; margin-bottom: 20px; }
h3 { font-size: 1.35rem; line-height: 1.25; letter-spacing: -.025em; }
.hero-text, .section-heading > p:last-child, .about-copy > p, .contact-card p { color: var(--muted); font-size: 17px; max-width: 680px; }
.hero-text { max-width: 620px; margin-bottom: 34px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 20px; border-radius: 12px; font-weight: 700; font-size: 14px; border: 1px solid transparent; transition: transform .2s ease, background .2s ease, border-color .2s ease; }
.button:hover { transform: translateY(-2px); }
.button.primary { color: white; background: var(--accent); }
.button.primary:hover { background: var(--accent-strong); }
.button.secondary { background: var(--surface); border-color: var(--line); }
.quick-facts { list-style: none; padding: 0; margin: 42px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.quick-facts li { padding: 22px 18px 0 0; }
.quick-facts strong, .quick-facts span { display: block; }
.quick-facts strong { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; margin-bottom: 6px; }
.quick-facts span { color: var(--muted); font-size: 13px; }

.network-card { position: relative; padding: 26px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); }
.network-card svg { width: 100%; }
.network-lines path { fill: none; stroke: var(--line); stroke-width: 3; stroke-dasharray: 8 9; }
.node rect { fill: var(--surface-soft); stroke: var(--line); stroke-width: 2; }
.node path { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.node text { fill: var(--muted); font: 600 14px Inter, sans-serif; }
.node.router rect { fill: var(--accent); stroke: none; }
.node.router path { stroke: white; }
.node.router text { fill: var(--text); }
.status-pill { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); white-space: nowrap; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 9px 14px; font-size: 12px; font-weight: 700; box-shadow: var(--shadow); }
.status-pill span { width: 8px; height: 8px; border-radius: 50%; background: #20b26b; box-shadow: 0 0 0 4px rgba(32,178,107,.12); }

.section-heading { margin-bottom: 42px; }
.section-heading h2 { max-width: 780px; }
.featured-project { display: grid; grid-template-columns: 1.15fr .85fr; min-height: 460px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); }
.project-visual { padding: 24px; background: var(--accent-soft); display: flex; flex-direction: column; }
.browser-bar { height: 34px; display: flex; align-items: center; gap: 7px; padding-left: 4px; }
.browser-bar span { width: 8px; height: 8px; border-radius: 50%; background: color-mix(in srgb, var(--muted) 45%, transparent); }
.project-placeholder { flex: 1; min-height: 330px; display: grid; place-items: center; align-content: center; gap: 16px; border: 1px dashed color-mix(in srgb, var(--accent) 40%, var(--line)); border-radius: 18px; background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 600; }
.project-placeholder svg { width: 180px; fill: none; stroke: var(--accent); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.project-content { display: flex; flex-direction: column; justify-content: center; padding: 50px; }
.project-label { color: var(--accent); text-transform: uppercase; letter-spacing: .12em; font-size: 11px; font-weight: 700; }
.project-content h3 { font-size: 2rem; margin-bottom: 16px; }
.project-content > p:not(.project-label) { color: var(--muted); }
.tags, .skill-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tags { margin: 18px 0 28px; }
.tags span, .skill-list span { border: 1px solid var(--line); border-radius: 999px; padding: 7px 11px; font-size: 12px; font-weight: 600; background: var(--surface); }
.project-links { display: flex; gap: 24px; }
.text-link { color: var(--accent); font-weight: 700; font-size: 14px; }
.text-link span { display: inline-block; transition: transform .2s ease; }
.text-link:hover span { transform: translate(2px, -2px); }
.academic-block { margin-top: 56px; display: grid; grid-template-columns: .7fr 1.3fr; gap: 60px; align-items: start; }
.academic-list { display: grid; gap: 12px; }
.academic-item { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; padding: 20px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); transition: transform .2s ease, border-color .2s ease; }
.academic-item:hover { transform: translateY(-2px); border-color: var(--accent); }
.academic-item strong, .academic-item small { display: block; }
.academic-item small { color: var(--muted); margin-top: 3px; }
.item-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; color: var(--accent); background: var(--accent-soft); font-weight: 700; }

.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 90px; align-items: start; }
.about-copy p { max-width: 630px; }
.skills-panel { display: grid; gap: 30px; padding: 34px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.skill-group h3 { margin-bottom: 16px; }
.skill-list span { background: var(--surface-soft); }

.contact-card { display: grid; grid-template-columns: .8fr 1.2fr; gap: 70px; padding: 48px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.contact-links { display: grid; gap: 10px; }
.contact-links a { display: flex; justify-content: space-between; gap: 20px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.contact-links a:last-child { border-bottom: 0; }
.contact-links span { color: var(--muted); font-size: 13px; }
.contact-links strong { font-size: 14px; text-align: right; }

.cv-section { padding-top: 82px; padding-bottom: 82px; }
.cv-box { display: flex; align-items: center; justify-content: space-between; gap: 30px; padding: 42px 48px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.cv-box h2 { margin-bottom: 0; font-size: clamp(2rem, 4vw, 3.2rem); }

.site-footer { border-top: 1px solid var(--line); }
.footer-row { min-height: 88px; display: flex; align-items: center; justify-content: space-between; gap: 20px; color: var(--muted); font-size: 13px; }
.footer-row p { margin: 0; }
.footer-row a { color: var(--text); font-weight: 600; }

.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

@media (max-width: 900px) {
  .menu-button { display: block; }
  .nav-panel { display: none; position: absolute; left: 20px; right: 20px; top: 68px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
  .nav-panel.open { display: flex; flex-direction: column; align-items: stretch; gap: 18px; }
  .nav-links { flex-direction: column; align-items: stretch; gap: 5px; }
  .nav-links a { padding: 9px 6px; }
  .theme-switcher { width: max-content; }
  .hero { min-height: auto; }
  .hero-grid, .featured-project, .about-grid, .contact-card { grid-template-columns: 1fr; }
  .hero-grid { gap: 52px; }
  .featured-project { min-height: auto; }
  .project-content { padding: 36px; }
  .academic-block { grid-template-columns: 1fr; gap: 24px; }
  .about-grid, .contact-card { gap: 46px; }
}

@media (max-width: 620px) {
  .container { width: min(calc(100% - 28px), var(--container)); }
  .section { padding: 82px 0; }
  h1 { font-size: clamp(2.65rem, 13vw, 4rem); }
  .quick-facts { grid-template-columns: 1fr; }
  .quick-facts li { padding-top: 16px; }
  .network-card { padding: 10px; }
  .status-pill { bottom: 12px; }
  .project-visual { padding: 14px; }
  .project-placeholder { min-height: 270px; }
  .project-content, .skills-panel, .contact-card, .cv-box { padding: 28px; }
  .contact-card { gap: 24px; }
  .contact-links a { display: block; }
  .contact-links strong { display: block; text-align: left; margin-top: 4px; overflow-wrap: anywhere; }
  .cv-box { flex-direction: column; align-items: flex-start; }
  .footer-row { align-items: flex-start; flex-direction: column; justify-content: center; padding: 24px 0; }
}

/* Multi-page layout */
.page-hero {
  padding-top: 118px;
  padding-bottom: 76px;
  border-bottom: 1px solid var(--line);
}
.page-hero .narrow { max-width: 900px; margin-inline: auto; }
.page-hero h1 {
  max-width: 900px;
  margin-bottom: 24px;
  font-size: clamp(3rem, 7vw, 6rem);
}
.page-intro {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 18px;
}
.home-preview-grid {
  display: grid;
  grid-template-columns: 1.08fr .92fr;
  gap: 24px;
}
.preview-card {
  min-height: 350px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.preview-card h2 { font-size: clamp(2rem, 4vw, 3.4rem); }
.preview-card p:not(.eyebrow) { max-width: 620px; color: var(--muted); }
.preview-card .button,
.preview-card .text-link { margin-top: 14px; }
.compact-section { padding-top: 76px; padding-bottom: 76px; }
.page-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 36px;
  padding: 42px 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.page-cta h2 { margin-bottom: 0; font-size: clamp(2rem, 4vw, 3.2rem); }
.project-page-section,
.about-page-section,
.contact-page-section { padding-top: 88px; }
.muted-copy { color: var(--muted); }
.contact-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, .55fr);
  gap: 24px;
  align-items: stretch;
}
.contact-layout .contact-card {
  grid-template-columns: .8fr 1.2fr;
  height: 100%;
}
.simple-note {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.simple-note p:not(.eyebrow) { color: var(--muted); }
.simple-note .button { margin-top: 12px; }

@media (max-width: 900px) {
  .home-preview-grid,
  .contact-layout,
  .contact-layout .contact-card { grid-template-columns: 1fr; }
  .page-hero { padding-top: 92px; padding-bottom: 62px; }
  .preview-card { min-height: auto; }
}

@media (max-width: 620px) {
  .preview-card,
  .page-cta,
  .simple-note { padding: 28px; }
  .page-cta { align-items: flex-start; flex-direction: column; }
  .page-hero h1 { font-size: clamp(2.6rem, 13vw, 4rem); }
}

/* Scalable project collection */
.split-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 36px;
}
.split-heading > div { max-width: 760px; }
.split-heading .button { flex: 0 0 auto; margin-bottom: 8px; }

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}
.project-grid.single-item {
  grid-template-columns: minmax(0, 760px);
}
.project-grid-full { align-items: stretch; }

.project-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.project-card:hover {
  transform: translateY(-5px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: 0 24px 70px rgba(27, 48, 75, 0.12);
}
.project-card-visual {
  min-height: 250px;
  padding: 22px;
  background:
    radial-gradient(circle at 18% 20%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 40%),
    linear-gradient(145deg, var(--accent-soft), var(--surface-soft));
  border-bottom: 1px solid var(--line);
}
.project-card-visual img {
  width: 100%;
  height: 100%;
  min-height: 206px;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.project-art {
  position: relative;
  min-height: 206px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
}
.project-art::before,
.project-art::after {
  content: "";
  position: absolute;
  width: 150px;
  height: 150px;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
  border-radius: 50%;
}
.project-art::before { left: -68px; bottom: -78px; }
.project-art::after { right: -82px; top: -72px; }
.project-art svg {
  width: min(58%, 230px);
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.project-number {
  position: absolute;
  top: 15px;
  right: 17px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
}
.project-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 30px;
}
.project-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
}
.project-card-heading .project-label { margin: 0; }
.featured-badge {
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.project-card h3 {
  margin-bottom: 12px;
  font-size: clamp(1.55rem, 2.5vw, 2rem);
}
.project-card-body > p:not(.project-label) {
  flex: 1;
  margin-bottom: 0;
  color: var(--muted);
}
.project-card .tags { margin: 24px 0 20px; }
.project-card .project-links { min-height: 24px; }
.empty-state {
  padding: 42px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.empty-state h3 { margin-bottom: 7px; }
.empty-state p { margin-bottom: 0; color: var(--muted); }
.academic-item-static { cursor: default; }
.academic-item-static:hover { transform: none; border-color: var(--line); }

/* Professional footer */
.site-footer {
  margin-top: 0;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.footer-main {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(150px, .65fr) minmax(160px, .65fr);
  gap: 70px;
  padding-top: 64px;
  padding-bottom: 54px;
}
.footer-brand { max-width: 480px; }
.footer-brand > p {
  max-width: 430px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 14px;
}
.footer-column {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}
.footer-column h3 {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .14em;
}
.footer-column a {
  color: var(--muted);
  font-size: 14px;
  transition: color .2s ease, transform .2s ease;
}
.footer-column a:hover {
  color: var(--accent);
  transform: translateX(2px);
}
.footer-bottom {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.footer-bottom p { margin: 0; }

@media (max-width: 900px) {
  .split-heading { align-items: flex-start; flex-direction: column; }
  .split-heading .button { margin-bottom: 0; }
  .project-grid,
  .project-grid.single-item { grid-template-columns: 1fr; }
  .footer-main { grid-template-columns: 1.4fr .6fr .6fr; gap: 36px; }
}

@media (max-width: 620px) {
  .project-card-visual { min-height: 220px; padding: 14px; }
  .project-art { min-height: 190px; }
  .project-card-body { padding: 24px; }
  .footer-main { grid-template-columns: 1fr 1fr; gap: 36px 24px; padding-top: 48px; padding-bottom: 42px; }
  .footer-brand { grid-column: 1 / -1; }
  .footer-bottom { align-items: flex-start; flex-direction: column; justify-content: center; padding: 22px 0; }
}
.network-card {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.08);
}

.network-image {
  display: block;
  width: 100%;
  height: 420px;
  object-fit: cover;
  object-position: center;
}

.status-pill {
  position: absolute;
  left: 20px;
  bottom: 20px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 15px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #111827;
  font-size: 0.88rem;
  font-weight: 600;
  backdrop-filter: blur(10px);
}

.status-pill span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #22c55e;
}

[data-theme="dark"] .status-pill {
  background: rgba(17, 24, 39, 0.88);
  color: #f9fafb;
}

@media (max-width: 768px) {
  .network-image {
    height: 320px;
  }
}