/* ─── Reset & Base ─────────────────────────────────────────────────────────── */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --text: #1a1a1a;
  --text-secondary: #374151;
  --muted: #6b7280;
  --border: #e5e7eb;
  --bg: #ffffff;
  --bg-alt: #f9fafb;
  --emph: #0d9488;
  --nav-height: 56px;
  --max-width: 850px;
}

[data-theme="dark"] {
  --accent: #60a5fa;
  --accent-hover: #93c5fd;
  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --muted: #94a3b8;
  --border: #2d3748;
  --bg: #111827;
  --bg-alt: #1a2332;
  --emph: #2dd4bf;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  scroll-padding-top: calc(var(--nav-height) + 2.5rem);
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  transition: background 0.2s, color 0.2s;
}

/* ─── Typography ────────────────────────────────────────────────────────────── */

h1 { font-size: 2.25rem; font-weight: 600; letter-spacing: -0.02em; }
h2 { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 1rem; }
h3 { font-size: 1rem; font-weight: 450; }

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

ul {
  padding-left: 1.2rem;
}
li {
  margin-bottom: 0.25rem;
}

/* ─── Navigation ────────────────────────────────────────────────────────────── */

header {
  position: fixed;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  width: calc(100% - 3rem);
  max-width: var(--max-width);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  height: var(--nav-height);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.1);
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

[data-theme="dark"] header {
  background: rgba(18, 18, 24, 0.88);
  border-color: rgba(255, 255, 255, 0.08);
}

nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav-name {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  color: var(--text);
  text-decoration: none;
}

.nav-name:hover {
  color: var(--text);
  text-decoration: none;
}

nav ul {
  list-style: none;
  padding: 0;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

nav ul a {
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 400;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

nav ul a:hover {
  color: var(--text);
  background: var(--bg-alt);
  text-decoration: none;
}

nav ul a.active {
  color: var(--text);
  background: var(--bg-alt);
  text-decoration: none;
}

/* ─── Theme Toggle ──────────────────────────────────────────────────────────── */

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.3rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}

.theme-toggle:hover {
  color: var(--text);
  background: var(--bg-alt);
}

.icon-sun { display: none; }

[data-theme="dark"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun  { display: block; }

/* ─── Main Layout ───────────────────────────────────────────────────────────── */

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3.5rem 1.5rem 5rem;
}

section {
  padding-top: 2.5rem;
  border-top: 1px solid var(--border);
  margin-top: 0;
}


/* ─── Hero / About ──────────────────────────────────────────────────────────── */

.hero {
  border-top: none;
  padding-top: 2.5rem;
  padding-bottom: 0.5rem;
  text-align: center;
}

.hero h1 {
  margin-bottom: 0.35rem;
}

.hero .bio {
  margin-left: auto;
  margin-right: auto;
}

.tagline {
  color: var(--muted);
  font-size: 1rem;
  margin-bottom: 1.1rem;
}

.tagline a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.tagline a:hover {
  color: var(--text);
}

.bio {
  font-size: 0.97rem;
  color: var(--text-secondary);
  max-width: 640px;
  margin-bottom: 1rem;
}

.emph {
  color: var(--emph);
}

/* ─── Entry (Education / Experience / Awards) ───────────────────────────────── */

.entry {
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: 1rem 1.5rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}

.entry:last-child {
  border-bottom: none;
}

.entry-meta {
  padding-top: 0.1rem;
}

.date {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
}

.entry-body h3 {
  margin-bottom: 0.2rem;
  line-height: 1.4;
}

.institution {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.grade {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--muted);
  margin-left: 0.4rem;
}

.entry-body ul {
  font-size: 0.9rem;
  margin-top: 0.3rem;
  color: var(--text-secondary);
}

.entry-body p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.entry-links {
  margin-top: 0.5rem;
}

/* ─── Sub-entry (e.g. Erasmus under MSc) ────────────────────────────────────── */

.sub-entry-meta,
.sub-entry-body {
  margin-top: -0.5rem;
}

.sub-entry-meta {
  border-left: 2px solid var(--emph);
  padding-left: 0.5rem;
}

.sub-entry-title {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.1rem;
}

.sub-entry-body .institution {
  margin-bottom: 0;
}

/* ─── Pills ─────────────────────────────────────────────────────────────────── */

.pill-row {
  display: flex;
  gap: 0.3rem;
  margin-top: 0.35rem;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.pill--lecture       { background: rgba(37,  99,  235, 0.1);  color: #1d4ed8; }
.pill--tutorial      { background: rgba(180, 83,  9,   0.1);  color: #b45309; }
.pill--project-seminar { background: rgba(190, 24, 93,  0.1);  color: #be185d; }
.pill--supportive    { background: rgba(107, 114, 128, 0.1);  color: #6b7280; }
.pill--leading       { background: rgba(5,   150, 105, 0.1);  color: #047857; }

[data-theme="dark"] .pill--lecture        { background: rgba(96,  165, 250, 0.15); color: #60a5fa; }
[data-theme="dark"] .pill--tutorial       { background: rgba(251, 191, 36,  0.15); color: #fbbf24; }
[data-theme="dark"] .pill--project-seminar{ background: rgba(244, 114, 182, 0.15); color: #f472b6; }
[data-theme="dark"] .pill--supportive     { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }
[data-theme="dark"] .pill--leading        { background: rgba(52,  211, 153, 0.15); color: #34d399; }

#teaching .entry-body {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

#teaching .entry-body .pill-row {
  margin-top: 0;
  flex-shrink: 0;
}

/* ─── Clickable entry rows ──────────────────────────────────────────────────── */

.entry--clickable {
  cursor: pointer;
  border-radius: 4px;
  margin-left: -0.6rem;
  margin-right: -0.6rem;
  padding-left: 0.6rem;
  padding-right: 0.6rem;
  transition: background 0.15s;
}

.entry--clickable:hover {
  background: var(--bg-alt);
}

/* ─── Modal ─────────────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 100%;
  max-width: 560px;
  max-height: 82vh;
  overflow-y: auto;
  padding: 1.75rem;
  transform: translateY(10px);
  transition: transform 0.2s;
}

.modal-overlay.is-open .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.8rem;
  border-bottom: 1px solid var(--border);
}

.modal-label {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.modal-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text);
  margin-bottom: 0.35rem;
  letter-spacing: -0.01em;
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}

.modal-close:hover {
  color: var(--text);
  background: var(--bg-alt);
}

.modal-body h3 {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-top: 1rem;
  margin-bottom: 0.4rem;
}

.modal-body h3:first-child {
  margin-top: 0;
}

.modal-body p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.modal-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9rem;
}

.modal-table td {
  padding: 0.2rem 0;
  vertical-align: top;
  color: var(--text-secondary);
  line-height: 1.5;
}

.modal-table td:first-child {
  color: var(--muted);
  white-space: nowrap;
  padding-right: 1.25rem;
  width: 1%;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

.modal-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.modal-btn:hover {
  background: var(--bg-alt);
  color: var(--text);
  text-decoration: none;
}

/* ─── Floating Dock ─────────────────────────────────────────────────────────── */

.dock {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  padding: 0.35rem;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.1);
  white-space: nowrap;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

[data-theme="dark"] .dock {
  background: rgba(18, 18, 24, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

.dock-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 400;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
  letter-spacing: 0.01em;
}

.dock-item--disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.dock-item--disabled:hover {
  color: var(--muted);
  background: none;
}

.dock-item:hover {
  color: var(--text);
  background: var(--bg-alt);
  text-decoration: none;
}

.dock-item svg {
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.dock-item:hover svg {
  opacity: 1;
}

/* ─── Footer ────────────────────────────────────────────────────────────────── */

footer {
  border-top: 1px solid var(--border);
  margin-top: 2.5rem;
  padding: 1.25rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
}

footer a {
  color: var(--muted);
}
footer a:hover {
  color: var(--text);
}

/* ─── Mobile nav elements (hidden on desktop) ───────────────────────────────── */

.mobile-section-btn {
  display: none;
}

.mobile-nav-dropdown {
  display: none;
}

/* ─── Responsive ────────────────────────────────────────────────────────────── */

@media (max-width: 620px) {

  /* Header: flush to top, full-width */
  header {
    top: 0;
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    max-width: none;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
  }

  /* Nav: 3-column grid — name | section | toggle */
  nav {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    padding: 0 1rem;
    gap: 0;
  }

  .nav-name {
    display: block;
    grid-column: 1;
    align-self: center;
  }

  nav > ul {
    display: none;
  }

  /* Mobile section button: centered, styled like an active nav link */
  .mobile-section-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    grid-column: 2;
    align-self: center;
    background: var(--bg-alt);
    border: none;
    cursor: pointer;
    color: var(--text);
    font-size: 0.875rem;
    font-weight: 400;
    font-family: inherit;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
    white-space: nowrap;
  }

  .mobile-chevron {
    flex-shrink: 0;
    transition: transform 0.2s;
  }

  .mobile-section-btn[aria-expanded="true"] .mobile-chevron {
    transform: rotate(180deg);
  }

  .theme-toggle {
    grid-column: 3;
    justify-self: end;
  }

  /* Mobile dropdown panel */
  .mobile-nav-dropdown.is-open {
    display: block;
    position: absolute;
    top: var(--nav-height);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    padding: 0.35rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    z-index: 101;
    min-width: 200px;
  }

  .mobile-nav-dropdown ul {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
  }

  .mobile-nav-dropdown ul a {
    display: block;
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 400;
    padding: 0.35rem 0.7rem;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
    text-decoration: none;
  }

  .mobile-nav-dropdown ul a:hover,
  .mobile-nav-dropdown ul a.active {
    color: var(--text);
    background: var(--bg-alt);
    text-decoration: none;
  }

  /* Dock: flush to bottom, full-width, icons only */
  .dock {
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    max-width: none;
    border-radius: 0;
    border-bottom: none;
    border-left: none;
    border-right: none;
    justify-content: space-around;
    padding: 0 0.5rem;
    height: var(--nav-height);
  }

  .dock-item {
    flex: 1;
    justify-content: center;
    padding: 0.3rem;
  }

  .dock-item span {
    display: none;
  }

  /* Adjust scroll padding and content spacing */
  html {
    scroll-padding-top: calc(var(--nav-height) + 1rem);
  }

  main {
    padding-top: calc(var(--nav-height) + 1.5rem);
    padding-bottom: calc(var(--nav-height) + 2rem);
  }

  .entry {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  .entry-meta {
    padding-top: 0;
  }

  .sub-entry-meta,
  .sub-entry-body {
    margin-top: 0;
  }

  .sub-entry-meta {
    padding-top: 0;
  }

}

/* Dark mode: mobile dropdown panel */
[data-theme="dark"] .mobile-nav-dropdown.is-open {
  background: rgba(18, 18, 24, 0.97);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}
