/* ===========================================================================
   01. Base / reset
   =========================================================================== */

:root {
  color-scheme: light dark;

  /* Color palette (light defaults) */
  --bg: #f5f7f9;
  --bg-gradient-start: #f5f7f9;
  --surface: #fff;
  --surface-alt: #f1f4f8;
  --text: #152033;
  --muted: #5c6b7f;
  --primary: #2563eb;
  --primary-dark: #133d91;
  --primary-soft: rgb(37 99 235 / 10%);
  --primary-glow: rgb(37 99 235 / 15%);
  --primary-shadow: rgb(37 99 235 / 20%);
  --primary-shadow-hover: rgb(37 99 235 / 28%);
  --border: #dbe3ee;
  --shadow: 0 20px 45px rgb(21 32 51 / 8%);
  --shadow-sm: 0 10px 24px rgb(21 32 51 / 6%);

  /* Spacing scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 2.5rem;
  --space-3xl: 3rem;
  --space-4xl: 5rem;

  /* Radius scale */
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 0.75rem;
  --radius-pill: 999px;

  /* Typography scale */
  --text-xs: 0.75rem;
  --text-sm: 0.85rem;
  --text-base: 1rem;
  --text-lg: 1.05rem;
  --text-xl: 1.3rem;
  --text-2xl: clamp(2.2rem, 3.8vw, 3.5rem);
  --font: 'Inter', 'Segoe UI', 'Roboto', 'Arial', sans-serif;
}

:root:has(#theme-toggle-checkbox:checked) {
  color-scheme: dark;

  --bg: #101821;
  --bg-gradient-start: #101821;
  --surface: #141d2a;
  --surface-alt: #101821;
  --text: #e6edf6;
  --muted: #9aa9bd;
  --primary: #4f86ff;
  --primary-dark: #93b4ff;
  --primary-soft: rgb(79 134 255 / 15%);
  --primary-glow: rgb(79 134 255 / 15%);
  --primary-shadow: rgb(79 134 255 / 20%);
  --primary-shadow-hover: rgb(79 134 255 / 28%);
  --border: #2a3548;
  --shadow: 0 20px 45px rgb(0 0 0 / 45%);
  --shadow-sm: 0 10px 24px rgb(0 0 0 / 35%);
}

:root:has(#theme-toggle-checkbox:checked) .site-header {
  background: rgb(15 21 33 / 92%);
}

@media (prefers-color-scheme: dark) {
  :root:not(:has(#theme-toggle-checkbox:checked)) {
    color-scheme: dark;
    --bg: #0f1521;
    --bg-gradient-start: #0b1019;
    --surface: #18202e;
    --surface-alt: #131b27;
    --text: #e6edf6;
    --muted: #9aa9bd;
    --primary: #4f86ff;
    --primary-dark: #93b4ff;
    --primary-soft: rgb(79 134 255 / 15%);
    --primary-glow: rgb(79 134 255 / 15%);
    --primary-shadow: rgb(79 134 255 / 20%);
    --primary-shadow-hover: rgb(79 134 255 / 28%);
    --border: #2a3548;
    --shadow: 0 20px 45px rgb(0 0 0 / 45%);
    --shadow-sm: 0 10px 24px rgb(0 0 0 / 35%);
  }

  :root:has(#theme-toggle-checkbox:checked) {
    color-scheme: light;
    --bg: #f4f7fb;
    --bg-gradient-start: #f8fbff;
    --surface: #fff;
    --surface-alt: #eef3f9;
    --text: #152033;
    --muted: #5c6b7f;
    --primary: #2563eb;
    --primary-dark: #133d91;
    --primary-soft: rgb(37 99 235 / 10%);
    --primary-glow: rgb(37 99 235 / 15%);
    --primary-shadow: rgb(37 99 235 / 20%);
    --primary-shadow-hover: rgb(37 99 235 / 28%);
    --border: #dbe3ee;
    --shadow: 0 20px 45px rgb(21 32 51 / 8%);
    --shadow-sm: 0 10px 24px rgb(21 32 51 / 6%);
  }

  :root:not(:has(#theme-toggle-checkbox:checked)) .site-header {
    background: rgb(15 21 33 / 92%);
  }

  :root:has(#theme-toggle-checkbox:checked) .site-header {
    background: rgb(255 255 255 / 95%);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    animation: none !important;
    transition: none !important;
  }
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  font-size: var(--text-base);
}

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

/* ===========================================================================
   02. Typography
   =========================================================================== */

h1,
h2,
h3 {
  line-height: 1.2;
  font-family: Georgia, 'Times New Roman', serif;
}

h1 {
  font-size: var(--text-2xl);
  margin: 0 0 var(--space-md);
  letter-spacing: -0.02em;
}

h2 {
  font-size: var(--text-xl);
  font-weight: 700;
}

h3 {
  font-size: var(--text-lg);
  font-weight: 700;
}

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

a:focus-visible,
button:focus-visible,
summary:focus-visible,
.nav-toggle-checkbox:focus-visible + .nav-toggle,
:root:has(#theme-toggle-checkbox:focus-visible) .theme-toggle {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

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

/* ===========================================================================
   03. Layout
   =========================================================================== */

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

section {
  padding: clamp(2.5rem, 5vw, 4rem) 0;
}

section + section {
  border-top: 1px solid rgba(148, 163, 184, 0.18);
}

#cv,
#contact {
  background: transparent;
}

/* ===========================================================================
   04. Skip link
   =========================================================================== */

.skip-link {
  position: fixed;
  top: 0;
  left: 0;
  transform: translateY(-100%);
  background: var(--primary);
  color: #fff;
  padding: var(--space-sm) var(--space-md);
  z-index: 100;
  border-radius: 0 0 var(--radius-md) 0;
  transition: transform 0.2s;
}

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

/* ===========================================================================
   05. Header / Navigation
   =========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgb(255 255 255 / 88%);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  position: relative;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  align-items: center;
}

.nav-links a {
  color: var(--muted);
  font-weight: 600;
  padding: var(--space-xs) 0;
  border-bottom: 2px solid transparent;
  transition:
    color 0.2s ease,
    border-color 0.2s ease;
}

.nav-links a:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.language-toggle {
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

.language-toggle:hover {
  transform: translateY(-1px);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 8px 18px var(--primary-glow);
}

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 8px 18px var(--primary-glow);
}

.theme-toggle-icon .icon-sun {
  display: none;
}

:root:has(#theme-toggle-checkbox:checked) .theme-toggle-icon .icon-moon {
  display: none;
}

:root:has(#theme-toggle-checkbox:checked) .theme-toggle-icon .icon-sun {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not(:has(#theme-toggle-checkbox:checked)) .theme-toggle-icon .icon-moon {
    display: none;
  }

  :root:not(:has(#theme-toggle-checkbox:checked)) .theme-toggle-icon .icon-sun {
    display: block;
  }

  :root:has(#theme-toggle-checkbox:checked) .theme-toggle-icon .icon-moon {
    display: block;
  }

  :root:has(#theme-toggle-checkbox:checked) .theme-toggle-icon .icon-sun {
    display: none;
  }
}

/* Hamburger menu toggle (hidden on desktop) */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.nav-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 8px 18px var(--primary-glow);
}

.nav-toggle-bar {
  display: block;
  width: 1.1rem;
  height: 2px;
  margin: 0 auto;
  border-radius: var(--radius-pill);
  background: currentcolor;
  transition:
    transform 0.25s ease,
    opacity 0.2s ease;
}

.nav-toggle-checkbox:checked + .nav-toggle .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

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

.nav-toggle-checkbox:checked + .nav-toggle .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ===========================================================================
   06. Hero
   =========================================================================== */

.hero {
  padding: var(--space-4xl) 0 var(--space-3xl);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
  text-align: center;
  justify-items: center;
}

.hero-text {
  max-width: 720px;
}

.hero-text p {
  max-width: 62ch;
}

.hero .hero-role {
  margin: calc(var(--space-sm) * -1) 0 var(--space-sm);
  color: var(--text);
  font-size: var(--text-base);
  font-weight: 700;
}

.hero .hero-focus {
  display: inline-block;
  margin: 0 0 var(--space-md);
  padding-left: var(--space-sm);
  border-left: 2px solid var(--primary);
  background: transparent;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero p {
  color: var(--muted);
  font-size: var(--text-lg);
}

.hero-card {
  text-align: center;
  max-width: 340px;
  margin: 0 auto;
}

.hero-card img {
  width: 280px;
  height: 280px;
  margin: 0 auto var(--space-lg);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 50%;
  object-fit: cover;
  object-position: 30% center;
  box-shadow: none;
}

/* ===========================================================================
   07. Buttons
   =========================================================================== */

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin: var(--space-lg) 0 var(--space-md);
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-pill);
  font-weight: 700;
  border: 1px solid transparent;
  transition: transform 0.2s ease;
}

@media (prefers-reduced-motion: reduce) {
  .btn {
    transition: none;
  }
}

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

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: none;
}

.btn-primary:hover {
  box-shadow: none;
}

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

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ===========================================================================
   08. Cards
   =========================================================================== */

.section-card,
.collapsible-block,
.publication-item {
  background: transparent;
  border: 0;
}

.section-card {
  padding: clamp(2rem, 4vw, 3rem);
}

.section-kicker {
  margin: 0 0 var(--space-sm);
  color: var(--primary-dark);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: var(--text-xs);
  font-weight: 700;
}

.contact-card {
  text-align: center;
  padding: var(--space-2xl);
}

.contact-card .btn-row,
.contact-card .profile-links {
  justify-content: center;
}

.contact-card h2 {
  margin: 0 0 var(--space-xs);
}

.section-accent {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--primary-dark);
  padding-left: var(--space-md);
  border-left: 3px solid var(--primary);
  letter-spacing: -0.02em;
}

.publication-item,
.timeline-item,
.education-collapsible {
  transition: transform 0.2s ease;
}

.publication-item:hover,
.timeline-item:hover,
.education-collapsible:hover {
  transform: translateX(2px);
}

.section-heading {
  margin-bottom: var(--space-xl);
}

.section-heading h2 {
  margin: 0 0 var(--space-xs);
  letter-spacing: -0.01em;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
}

.about-text {
  max-width: 70rem;
  color: var(--muted);
  font-size: var(--text-lg);
  line-height: 1.8;
}

.about-text strong {
  color: var(--text);
  font-weight: 700;
}

.about-text p {
  margin: 0 0 var(--space-lg);
}

.about-text p:last-child {
  margin-bottom: 0;
}

.about-text a {
  color: var(--primary-dark);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.2em;
}

/* ===========================================================================
   09. Timeline (shared by education, experience, conferences)
   =========================================================================== */

.timeline {
  display: grid;
  gap: var(--space-md);
}

.timeline-item {
  padding: var(--space-md) var(--space-lg);
  border: 0;
  border-left: 3px solid var(--primary);
  background: transparent;
}

.timeline-item h3 {
  margin: 0 0 var(--space-xs);
  font-size: var(--text-lg);
}

.timeline-item p {
  margin: var(--space-xs) 0;
  color: var(--muted);
}

.timeline-item strong {
  color: var(--text);
}

.timeline-item [aria-hidden='true'] {
  color: var(--muted);
}

.event-status {
  display: inline-block;
  vertical-align: middle;
  margin-left: var(--space-xs);
  padding: 0 var(--space-sm);
  border: 1px solid var(--primary);
  border-radius: var(--radius-pill);
  color: var(--primary-dark);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

@media (width <= 480px) {
  .event-status {
    display: table;
    margin: var(--space-xs) 0 0;
  }
}

/* ===========================================================================
   10. Publications
   =========================================================================== */

.publications-group {
  margin-bottom: var(--space-xl);
}

.publications-group:last-child {
  margin-bottom: 0;
}

.publications-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--space-md);
}

.publication-item {
  padding: var(--space-md) var(--space-lg);
  display: grid;
  gap: var(--space-xs);
  border: 0;
  border-left: 3px solid var(--primary);
  background: transparent;
}

.publication-title {
  font-weight: 700;
  color: var(--text);
}

.publication-authors {
  color: var(--muted);
}

.publication-meta {
  color: var(--muted);
  font-style: italic;
}

.publication-link,
.publication-link a {
  color: var(--primary);
  font-weight: 700;
}

/* ===========================================================================
   11. Collapsibles (details)
   =========================================================================== */

.collapsible-block {
  padding: var(--space-md) var(--space-lg);
}

.collapsible-summary {
  list-style: none;
  cursor: pointer;
  color: var(--primary-dark);
  font-weight: 600;
  font-size: var(--text-base);
  padding: var(--space-xs) 0;
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
}

.collapsible-summary::-webkit-details-marker {
  display: none;
}

.collapsible-summary::marker {
  display: none;
  content: '';
}

.collapsible-summary::after {
  content: '\25BE';
  font-size: var(--text-xs);
  transition: transform 0.2s ease;
}

@media (prefers-reduced-motion: reduce) {
  .collapsible-summary::after {
    transition: none;
  }
}

details[open] > .collapsible-summary::after {
  transform: rotate(180deg);
}

.collapsible-content {
  padding: var(--space-sm) var(--space-xs) 0;
  margin-top: var(--space-sm);
  border-top: 1px solid var(--border);
}

.education-collapsible {
  margin-top: var(--space-sm);
  background: transparent;
  border: 0;
  padding: var(--space-xs) 0;
}

.education-collapsible .collapsible-content {
  border-top: none;
  padding: var(--space-sm) 0 var(--space-xs);
  margin-top: var(--space-xs);
}

.other-experience-collapsible {
  margin-top: var(--space-lg);
}

/* ===========================================================================
    12. Conferences
    =========================================================================== */

    .conferences-group {
      margin-bottom: var(--space-xl);
    }

    .conferences-group:last-child {
      margin-bottom: 0;
    }

    /* ===========================================================================
    13. Profile links
   =========================================================================== */

.profile-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.contact-card .profile-links {
  margin-top: var(--space-lg);
}

.profile-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--primary-dark);
  font-weight: 600;
  font-size: var(--text-sm);
  transition:
    transform 0.2s ease,
    border-color 0.2s ease;
}

.profile-link-icon {
  flex-shrink: 0;
}

.profile-link:hover {
  transform: translateY(-1px);
  border-color: var(--primary);
  box-shadow: none;
}

/* ===========================================================================
   14. Footer
   =========================================================================== */

footer {
  border-top: 1px solid var(--border);
  padding: var(--space-lg) 0;
  color: var(--muted);
  font-size: var(--text-sm);
  text-align: center;
}

.footer-name {
  color: var(--text);
  font-weight: 700;
}

/* ===========================================================================
   15. Responsive
   =========================================================================== */

@media (width <= 900px) {
  .nav {
    flex-wrap: wrap;
  }
}

@media (width <= 768px) {
  .nav-actions {
    order: 2;
    margin-left: auto;
  }

  .nav-toggle {
    display: inline-flex;
    order: 3;
  }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 0 var(--space-md);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition:
      max-height 0.3s ease,
      opacity 0.25s ease,
      padding 0.3s ease;
  }

  .nav-toggle-checkbox:checked ~ .nav-links {
    max-height: 30rem;
    opacity: 1;
    pointer-events: auto;
    padding: var(--space-sm) var(--space-md) var(--space-md);
  }

  .nav-links a {
    padding: var(--space-sm) var(--space-xs);
    border-bottom: 1px solid var(--border);
  }

  .nav-links a:last-child {
    border-bottom: none;
  }

  .nav-links a:hover {
    border-color: transparent;
    border-bottom-color: var(--border);
    background: var(--surface-alt);
  }
}

@media (width >= 769px) {
  .hero-grid {
    grid-template-columns: minmax(240px, 0.7fr) minmax(0, 1.3fr);
    align-items: center;
    text-align: left;
  }

  .hero-card {
    margin: 0;
  }

  .hero-card img {
    margin-bottom: 0;
  }

  .btn-row,
  .profile-links {
    justify-content: flex-start;
  }
}

@media (width <= 640px) {
  :root {
    --space-4xl: 3rem;
    --space-3xl: 2.25rem;
  }

  .hero {
    padding-top: var(--space-3xl);
  }

  .hero .btn-row {
    flex-direction: column;
    align-items: center;
    width: 100%;
  }

  .hero .btn {
    width: min(100%, 20rem);
  }

  .hero .profile-links {
    justify-content: center;
  }

  .section-accent {
    padding-left: var(--space-sm);
  }
}

/* ===========================================================================
   16. Print
   =========================================================================== */

@media print {
  .site-header,
  .hero .btn-row,
  .section-card {
    box-shadow: none;
    border: none;
  }

  body {
    background: #fff;
    color: #000;
  }

  a {
    text-decoration: underline;
    color: #000;
  }

  .btn {
    border: 1px solid #000;
    background: #fff;
    color: #000;
  }

  section + section {
    border-top: 1px solid #ccc;
  }
}
