/* ============ Theme tokens ============ */
:root {
  --bg: #f5f6f7;
  --bg-alt: #eceef0;
  --surface: #ffffff;
  --text: #15191e;
  --muted: #5d6671;
  --faint: #8a939d;
  --border: #dde1e5;
  --border-strong: #c5cbd2;
  --accent: #2c5a70;
  --accent-soft: rgba(44, 90, 112, 0.08);
  --radius: 6px;
  --nav-h: 64px;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
}
:root[data-theme="dark"] {
  --bg: #0f1317;
  --bg-alt: #13181d;
  --surface: #171d23;
  --text: #e4e8ec;
  --muted: #9aa4ae;
  --faint: #6f7a85;
  --border: #242c34;
  --border-strong: #34404b;
  --accent: #8db4c7;
  --accent-soft: rgba(141, 180, 199, 0.1);
}

/* ============ Base ============ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: var(--nav-h); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--sans); font-size: 16px; line-height: 1.6;
  background: var(--bg); color: var(--text); overflow-x: hidden;
  -webkit-font-smoothing: antialiased; transition: background 0.25s, color 0.25s;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.01em; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.container { width: min(1080px, 100% - 40px); margin-inline: auto; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.progress { position: fixed; top: 0; left: 0; height: 2px; width: 0; z-index: 200; background: var(--accent); }

/* ============ Nav ============ */
.nav {
  position: fixed; inset: 0 0 auto 0; height: var(--nav-h); z-index: 100;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 max(20px, calc((100% - 1080px) / 2));
  transition: background 0.25s, border-color 0.25s;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom-color: var(--border);
}
.nav__actions { display: flex; gap: 6px; order: -1; }
.nav__logo { order: 1; font-family: var(--mono); font-weight: 500; font-size: 0.95rem; letter-spacing: 0.08em; }
.nav__links { display: flex; gap: 2px; }
.nav__links a {
  padding: 6px 10px; border-radius: 4px; font-size: 0.875rem; color: var(--muted);
  transition: color 0.15s, background 0.15s;
}
.nav__links a:hover { color: var(--text); }
/* Reserve the bold width so neighbouring menu items don't shift on hover */
.nav__links a { display: inline-flex; flex-direction: column; align-items: center; }
.nav__links a::after {
  content: attr(data-text); font-weight: 700; height: 0; overflow: hidden; visibility: hidden;
  user-select: none; pointer-events: none;
}
@media (max-width: 1120px) { .nav__links a { align-items: flex-start; } }
.nav__links a.active { color: var(--text); background: var(--accent-soft); }

.icon-btn {
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.icon-btn:hover { border-color: var(--border-strong); }
/* Language button: both flags share one shape, a 3:2 rectangle with rounded corners */
.lang-flag {
  display: block; width: 24px; height: 16px; object-fit: cover; border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
}

/* Menu icon: border lines are always snapped to whole pixels, so all three render equally thick */
.nav__burger { display: none; flex-direction: column; justify-content: center; align-items: center; gap: 4px; padding: 0; }
.nav__burger span {
  display: block; width: 16px; height: 0; border-top: 2px solid currentColor;
  transition: transform 0.25s, opacity 0.2s;
}
.nav__burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav__burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav__burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 1120px) {
  .nav__burger { display: inline-flex; }
  .nav__links {
    position: fixed; top: var(--nav-h); left: 0; right: 0;
    flex-direction: column; padding: 8px 20px 16px;
    background: var(--surface); border-bottom: 1px solid var(--border);
    transform: translateY(-120%); transition: transform 0.3s; z-index: -1;
  }
  .nav__links.open { transform: translateY(0); }
  .nav__links a { padding: 11px 4px; border-bottom: 1px solid var(--border); border-radius: 0; }
  .nav__links a:last-child { border-bottom: 0; }
}

/* ============ Buttons / tags ============ */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 18px;
  border-radius: var(--radius); font-size: 0.925rem; font-weight: 500; border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: color-mix(in srgb, var(--accent) 85%, #000); }
.btn--ghost { border-color: var(--border-strong); }
.btn--ghost:hover { border-color: var(--text); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 0.78rem;
  color: var(--muted); background: var(--bg-alt); border: 1px solid var(--border);
}
.tag--logo { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px 4px 6px; background: var(--surface); color: var(--text); }
.tag--logo img { height: 20px; width: auto; }
.tag--wordmark { padding: 4px 8px; background: #fff; }
.tag--wordmark img { height: 22px; }
.socials { display: flex; gap: 8px; }

/* ============ Hero (aquarium background) ============ */
.hero {
  position: relative; isolation: isolate; min-height: 100vh; min-height: 100svh; display: flex; align-items: center;
  padding: calc(var(--nav-h) + 24px) 0 96px; overflow: hidden; cursor: crosshair;
  background: #0b3444; color: #eef2f5;
}
.hero .aquarium { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; display: block; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(90deg, rgba(3, 14, 22, 0.62) 0%, rgba(3, 14, 22, 0.3) 50%, rgba(3, 14, 22, 0) 80%);
}
@media (max-width: 800px) { .hero::before { background: rgba(3, 14, 22, 0.45); } }
.hero__inner { position: relative; z-index: 2; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 48px; align-items: center; pointer-events: none; }
.hero__inner a, .hero__inner button, .hero__photo { pointer-events: auto; }
.hero__text { text-shadow: 0 1px 12px rgba(0, 0, 0, 0.35); }
.hero__status {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 20px;
  font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(238, 242, 245, 0.78);
}
.status-dot { width: 7px; height: 7px; border-radius: 1px; background: #7fb89a; }
.hero__name { font-size: clamp(2.4rem, 5.6vw, 4rem); line-height: 1.05; letter-spacing: -0.025em; margin: 0 0 12px; font-weight: 600; }
.hero__role { font-size: clamp(1.1rem, 2.4vw, 1.4rem); font-weight: 400; color: rgba(238, 242, 245, 0.85); margin: 0 0 14px; min-height: 1.6em; }
/* Blinking text cursor of the typing animation */
.caret {
  display: inline-block; width: 2px; height: 1.05em; margin-left: 3px; vertical-align: -0.14em;
  background: #9cc3cf; animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.hero__meta { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 0 0 28px; color: rgba(238, 242, 245, 0.7); font-size: 0.925rem; }
.hero__meta span, .hero__meta a { display: inline-flex; align-items: center; gap: 6px; }
.hero__meta a:hover { color: #fff; }
.hero__meta svg { width: 15px; height: 15px; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }
.hero .btn--primary { background: #eef2f5; color: #0b2a36; text-shadow: none; }
.hero .btn--primary:hover { background: #fff; }
.hero .btn--ghost, .hero .icon-btn { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.25); color: #eef2f5; backdrop-filter: blur(6px); }
.hero .btn--ghost:hover, .hero .icon-btn:hover { border-color: rgba(255, 255, 255, 0.6); }
.hero__photo {
  justify-self: center; width: min(280px, 64vw); aspect-ratio: 1; border-radius: 50%; padding: 4px;
  background: rgba(255, 255, 255, 0.16); box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.7);
}
.hero__photo img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; background: var(--surface); }
.aquarium__hint {
  position: absolute; z-index: 3; left: 20px; bottom: 20px;
  padding: 7px 12px; border-radius: 3px;
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: rgba(226, 212, 184, 0.82);
  background: linear-gradient(180deg, rgba(28, 24, 18, 0.72), rgba(12, 10, 8, 0.72));
  border: 1px solid rgba(168, 134, 76, 0.45); backdrop-filter: blur(3px); pointer-events: none; white-space: nowrap;
}
.aquarium__hint b { color: #e8c07a; font-weight: 500; margin-left: 6px; }
.scroll-hint { position: absolute; z-index: 3; bottom: 26px; left: 50%; translate: -50% 0; width: 22px; height: 36px; border: 1.5px solid rgba(238, 242, 245, 0.45); border-radius: 12px; }
.scroll-hint span { position: absolute; left: 50%; top: 7px; width: 3px; height: 7px; translate: -50% 0; background: rgba(238, 242, 245, 0.7); border-radius: 2px; animation: scroll 1.8s infinite; }
@keyframes scroll { 100% { transform: translateY(12px); opacity: 0; } }

/* Nav sits on the dark water until you scroll */
@media (min-width: 1121px) {
  .nav:not(.scrolled) .nav__logo { color: #fff; }
  .nav:not(.scrolled) .nav__links a { color: rgba(238, 242, 245, 0.72); }
  .nav:not(.scrolled) .nav__links a:hover, .nav:not(.scrolled) .nav__links a.active { color: #fff; background: rgba(255, 255, 255, 0.1); }
}
.nav:not(.scrolled) .nav__logo { color: #fff; }
.nav:not(.scrolled) .icon-btn { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.25); color: #fff; }

@media (max-width: 800px) {
  .hero { padding-bottom: 72px; }
  .hero__inner { grid-template-columns: minmax(0, 1fr); text-align: center; gap: 28px; }
  .hero__photo { width: clamp(140px, 40vw, 190px); }
  .hero__meta, .hero__cta, .hero .socials, .hero__status { justify-content: center; }
  .aquarium__hint { left: 12px; bottom: 12px; max-width: calc(100% - 24px); white-space: normal; }
}
@media (max-width: 600px) {
  .scroll-hint { display: none; }
  .hero__status { font-size: 0.68rem; }
}
/* Short landscape screens (phones turned sideways) */
@media (max-height: 520px) and (orientation: landscape) {
  .hero { min-height: auto; padding-top: calc(var(--nav-h) + 16px); }
  .hero__photo { width: 140px; }
  .scroll-hint { display: none; }
}

/* ============ Sections ============ */
.section { padding: clamp(56px, 9vw, 88px) 0; }
.section--alt { background: var(--bg-alt); }
.section__head {
  display: flex; align-items: baseline; gap: 16px; margin-bottom: 40px;
  padding-bottom: 14px; border-bottom: 1px solid var(--border);
}
.section__index { font-family: var(--mono); font-size: 0.8rem; color: var(--faint); letter-spacing: 0.06em; }
.section__head h2 { margin: 0; font-size: clamp(1.5rem, 3vw, 1.9rem); }
.empty { color: var(--muted); text-align: center; }
/* Lists that start right under a section heading don't need their own top rule */
.section__head + .entries, .section__head + .cert-list { border-top: 0; }

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

/* Institution logos sit on a white plate so they stay legible in dark mode */
.inst-logo, .entry__logo, .logos, .skill__logo { background: #fff; border: 1px solid var(--border); border-radius: 4px; }

/* ============ About ============ */
.about { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 56px; align-items: start; }
.about__text p { margin: 0; font-size: 1.075rem; line-height: 1.75; color: var(--muted); max-width: 62ch; }
.inst-logo { height: 52px; width: auto; padding: 6px 10px; margin-top: 24px; }
.stats {
  margin: 0; display: grid; padding: 4px 22px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
.stat { display: flex; align-items: baseline; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.stat:last-child { border-bottom: 0; }
.stat__value { margin: 0; min-width: 2.4ch; font-family: var(--mono); font-size: 2rem; font-weight: 500; line-height: 1; color: var(--text); }
.stat__label { color: var(--muted); font-size: 0.925rem; }
@media (max-width: 800px) { .about { grid-template-columns: minmax(0, 1fr); gap: 32px; } }

/* ============ Entries (jobs, education, international) ============ */
.entries { border-top: 1px solid var(--border); }
.entry {
  display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 32px;
  padding: 28px 0; border-bottom: 1px solid var(--border);
}
@media (max-width: 960px) { .entry { grid-template-columns: 210px minmax(0, 1fr); gap: 24px; } .logo-link img { max-width: 190px; } }
.entry--link { cursor: pointer; margin: 0 -16px; padding-inline: 16px; border-radius: var(--radius); transition: background 0.15s; }
.entry--link:hover { background: var(--accent-soft); }
.entry__meta { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.entry__num { font-family: var(--mono); font-size: 0.75rem; color: var(--faint); letter-spacing: 0.06em; }
.entry__date { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); line-height: 1.5; }
.entry__dur { font-size: 0.78rem; color: var(--faint); }
.entry__logos { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.entry__logo { height: 38px; width: auto; max-width: 200px; object-fit: contain; padding: 4px 7px; }
.logo-break { flex-basis: 100%; height: 0; }
.entry__when { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }

/* Stacked entry (Education): one centred column, logos side by side, then date · duration, then the text */
.entry--stacked { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; gap: 14px; }
.entry--stacked .entry__meta { align-items: center; gap: 12px; }
.entry--stacked .entry__logos { justify-content: center; margin-top: 0; gap: 12px; }
.entry--stacked .entry__when { justify-content: center; }
.entry--stacked .entry__summary { margin-inline: auto; }
.entry--stacked .entry__list { display: inline-block; text-align: left; }
.entry--stacked .entry__actions { justify-content: center; }
.entry--stacked .logo-link { height: 64px; }
.entry--stacked .logo-link img { height: 40px; max-width: min(320px, 70vw); }
.entry--stacked .logo-link img[src*="auth.png"] { height: 52px; }
/* Clickable logo with a "Click for more info" tooltip on hover */
.logo-link {
  position: relative; display: inline-flex; align-items: center; justify-content: center; padding: 6px 8px;
  background: #fff; border: 1px solid var(--border); border-radius: 4px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.logo-link img { height: 31px; width: auto; max-width: 240px; object-fit: contain; }
.logo-link:hover { border-color: var(--accent); box-shadow: 0 2px 10px -4px rgba(0, 0, 0, 0.25); }
/* Tooltip for [data-tip] elements; positioned by script.js so it always stays inside the window */
.tooltip {
  position: fixed; z-index: 500; top: 0; left: 0; max-width: min(320px, calc(100vw - 16px));
  padding: 5px 9px; border-radius: 4px; pointer-events: none;
  font-size: 0.75rem; font-weight: 500; line-height: 1.4; color: var(--bg); background: var(--text);
  opacity: 0; transition: opacity 0.15s;
}
.tooltip.show { opacity: 1; }
.entry__title { margin: 0; font-size: 1.1rem; }
.entry__org { margin: 2px 0 0; color: var(--accent); font-weight: 500; font-size: 0.95rem; }
.entry__org span { color: var(--muted); font-weight: 400; }
.entry__summary { margin: 10px 0 0; color: var(--muted); max-width: 70ch; }
.entry__details { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.3s ease; }
.entry.open .entry__details { grid-template-rows: 1fr; }
.entry__details > div { overflow: hidden; }
.entry__list { margin: 14px 0; padding-left: 18px; color: var(--text); max-width: 72ch; }
.entry__list li { margin-bottom: 6px; }
.entry__list li::marker { color: var(--faint); }
.entry__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; margin-top: 12px; }
.entry__toggle, .entry__more {
  display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none;
  font: inherit; font-size: 0.85rem; font-weight: 500; color: var(--accent); cursor: pointer;
}
.entry__toggle svg { width: 15px; height: 15px; transition: transform 0.25s; }
.entry.open .entry__toggle svg { transform: rotate(180deg); }
.entry__more svg { width: 14px; height: 14px; }
/* Links turn bold on hover (instead of being underlined), only on devices with a real pointer,
   so the effect doesn't get "stuck" after tapping on a phone */
@media (hover: hover) {
  .entry__toggle:hover span, .entry--link:hover .entry__more,
  .hero__meta a:hover, a.contact__value:hover, .card__link:hover, .cert-row:hover .cert-row__view,
  .nav__links a:hover, .entry__more:hover { font-weight: 700; }
}
@media (max-width: 700px) {
  .entry { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .entry__meta { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
  .entry__logos { margin-top: 4px; flex-basis: 100%; }
}

.logos { display: flex; width: fit-content; max-width: 100%; flex-wrap: wrap; align-items: center; gap: 20px; margin: -16px 0 28px; padding: 8px 14px; }
.logos img { height: 42px; width: auto; }
@media (max-width: 500px) { .logos img { height: 32px; } }

/* ============ Skills ============ */
.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr)); gap: 0 clamp(24px, 4vw, 48px); }
.skill-group { padding: 4px 0 24px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.skill-group h3 { margin: 0 0 14px; font-size: 0.95rem; }
.skill { margin-bottom: 14px; }
.skill__row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 0.9rem; }
.skill__pct { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }
.skill__logo { height: 34px; width: auto; max-width: 70%; object-fit: contain; padding: 4px 8px; }
.bar { height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; }
.bar__fill { height: 100%; width: 0; background: var(--accent); transition: width 1s cubic-bezier(.2, .8, .2, 1); }

/* ============ Projects ============ */
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 24px; }
.chip {
  padding: 6px 12px; border-radius: 4px; border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); font: inherit; font-size: 0.85rem; cursor: pointer;
}
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr)); gap: 16px; }
.card {
  display: flex; flex-direction: column; gap: 10px; padding: 22px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color 0.15s;
}
.card:hover { border-color: var(--border-strong); }
.card.hide { display: none; }
.card h3 { margin: 0; font-size: 1.05rem; }
.card p { margin: 0; color: var(--muted); }
.project__img { margin: -22px -22px 4px; aspect-ratio: 16/9; object-fit: cover; width: calc(100% + 44px); max-width: none; border-radius: var(--radius) var(--radius) 0 0; }
.project__cat { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.card__link { margin-top: auto; color: var(--accent); font-weight: 500; font-size: 0.9rem; display: inline-flex; align-items: center; gap: 6px; }
.card__link svg { width: 15px; height: 15px; }

/* ============ Certifications ============ */
.search {
  display: flex; align-items: center; gap: 10px; max-width: 380px; margin-bottom: 20px;
  padding: 0 12px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface);
}
.search:focus-within { border-color: var(--accent); }
.search svg { color: var(--faint); }
.search input { flex: 1; border: 0; outline: 0; background: none; color: var(--text); font: inherit; padding: 10px 0; }
.cert-list { border-top: 1px solid var(--border); }
.cert-row {
  display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 24px; align-items: center;
  width: 100%; padding: 18px 12px; margin: 0; text-align: left;
  font: inherit; color: inherit; background: none; border: 0; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background 0.15s;
}
.cert-row:hover { background: var(--accent-soft); }
.cert-row.hide { display: none; }
.cert-row__date { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }
.cert-row__main { display: flex; flex-direction: column; }
.cert-row__main strong { font-weight: 500; }
.cert-row__main span { color: var(--muted); font-size: 0.9rem; }
.cert-row__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cert-row__view { display: inline-flex; align-items: center; justify-content: flex-end; gap: 4px; font-size: 0.85rem; font-weight: 500; color: var(--accent); }
.cert-row__view svg { width: 15px; height: 15px; }
@media (max-width: 760px) {
  .cert-row { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; }
  .cert-row__date { grid-column: 1 / -1; }
}

/* ============ Languages ============ */
.langs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 24px 48px; }
.lang { display: flex; align-items: center; gap: 22px; padding: 4px 0 8px; }
/* Circular progress with the flag inside */
.ring { position: relative; width: 112px; height: 112px; flex-shrink: 0; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); stroke-linecap: round; }
.ring__track { fill: none; stroke: var(--border); stroke-width: 5; }
.ring__fill {
  fill: none; stroke: var(--accent); stroke-width: 5;
  stroke-dasharray: 345.58; stroke-dashoffset: 345.58; transition: stroke-dashoffset 1.2s cubic-bezier(.2, .8, .2, 1);
}
.ring__flag {
  position: absolute; inset: 13px; width: calc(100% - 26px); height: calc(100% - 26px);
  border-radius: 50%; box-shadow: 0 0 0 1px var(--border);
}
.lang__info { min-width: 0; }
.lang__head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 2px; }
.lang__head h3 { margin: 0; font-size: 1.05rem; }
.lang__head span { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }
.lang p { margin: 6px 0 0; color: var(--muted); font-size: 0.9rem; }
.lang .lang__note { margin-top: 6px; font-size: 0.85rem; color: var(--faint); }

/* ============ Contact ============ */
.contact__lead { margin: 0 0 24px; color: var(--muted); max-width: 60ch; }
.contact__rows { border-top: 1px solid var(--border); margin-bottom: 24px; }
.contact__row {
  display: grid; grid-template-columns: 140px minmax(0, 1fr) auto; gap: 16px; align-items: center;
  padding: 16px 0; border-bottom: 1px solid var(--border);
}
.contact__label { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.contact__value { font-size: 1.1rem; overflow-wrap: anywhere; }
a.contact__value:hover { color: var(--accent); }
a.contact__value svg { width: 15px; height: 15px; margin-left: 6px; vertical-align: -1px; color: var(--faint); }
.contact__copy {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 4px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  font: inherit; font-size: 0.8rem; cursor: pointer;
}
.contact__copy:hover { color: var(--text); border-color: var(--border-strong); }
.contact__copy svg { width: 14px; height: 14px; }
@media (max-width: 600px) {
  .contact__row { grid-template-columns: minmax(0, 1fr) auto; }
  .contact__label { grid-column: 1 / -1; }
}

/* ============ Footer / to top / toast ============ */
.footer { padding: 28px 0; color: var(--faint); font-size: 0.85rem; border-top: 1px solid var(--border); }
.footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.to-top {
  position: fixed; right: 20px; bottom: 20px; z-index: 90; width: 40px; height: 40px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
  display: grid; place-items: center; opacity: 0; transform: translateY(12px); pointer-events: none; transition: 0.25s;
}
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 400; translate: -50% 0;
  background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 4px; font-size: 0.9rem;
  opacity: 0; transform: translateY(12px); transition: 0.25s; pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }

/* ============ Modal ============ */
.modal { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(5, 8, 12, 0.72); animation: fade 0.2s; }
.modal__box {
  position: relative; width: min(960px, 100%); height: min(88vh, 900px); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  animation: pop 0.2s ease-out;
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }
.modal__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal__head h3 { margin: 0; font-size: 1rem; }
.modal__head p { margin: 2px 0 0; color: var(--muted); font-size: 0.85rem; }
.modal__actions { display: flex; gap: 6px; }
.modal__body { flex: 1; background: var(--bg-alt); display: grid; place-items: center; overflow: auto; }
.modal__body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.modal__body img { max-width: 100%; max-height: 100%; object-fit: contain; padding: 16px; }
.modal__body .empty { padding: 24px; }
.modal__nav {
  position: absolute; top: 50%; width: 40px; height: 40px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); display: grid; place-items: center; cursor: pointer;
}
.modal__nav--prev { left: 12px; }
.modal__nav--next { right: 12px; }
.modal__nav[hidden] { display: none; }

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

/* ============ Phone & touch ============ */
html { -webkit-tap-highlight-color: transparent; }
button, a, .entry--link, .cert-row, .hero { touch-action: manipulation; }

/* Keep content clear of notches and the iPhone home bar */
.nav {
  padding-left: max(20px, env(safe-area-inset-left), calc((100% - 1080px) / 2));
  padding-right: max(20px, env(safe-area-inset-right), calc((100% - 1080px) / 2));
}
.to-top { right: max(20px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom)); }
.footer { padding-bottom: max(28px, env(safe-area-inset-bottom)); }
@media (max-width: 1120px) {
  .nav__links { max-height: calc(100dvh - var(--nav-h)); overflow-y: auto; overscroll-behavior: contain; }
}

/* Finger-sized targets (at least 44×44 px) on touch screens */
@media (hover: none), (pointer: coarse) {
  .icon-btn { width: 44px; height: 44px; }
  .nav__links a { padding-block: 14px; }
  .entry__toggle, .entry__more { padding: 10px 0; }
  .entry__actions { gap: 4px 22px; margin-top: 4px; }
  .contact__copy { padding: 10px 14px; }
  .chip { padding: 10px 14px; }
  .modal__nav { width: 44px; height: 44px; }
  .hero { cursor: default; }
  .entry--link:hover, .cert-row:hover { background: none; }
  .entry--link:active, .cert-row:active { background: var(--accent-soft); }
  .card:hover { border-color: var(--border); }
}

/* Phone layout */
@media (max-width: 600px) {
  .container { width: calc(100% - 32px); }
  .section__head { gap: 12px; margin-bottom: 28px; }
  .entry { padding: 22px 0; }
  .entry--link { margin: 0 -10px; padding-inline: 10px; }
  .hero__name { font-size: clamp(2rem, 10vw, 2.6rem); }
  .stats { padding: 2px 16px; }
  .stat__value { font-size: 1.7rem; }
  .lang { gap: 16px; }
  .ring { width: 92px; height: 92px; }
  .ring__flag { inset: 11px; width: calc(100% - 22px); height: calc(100% - 22px); }
  .contact__value { font-size: 1rem; }
  .toast { bottom: max(24px, env(safe-area-inset-bottom)); max-width: calc(100% - 32px); text-align: center; }
  .aquarium__hint { left: max(12px, env(safe-area-inset-left)); bottom: max(12px, env(safe-area-inset-bottom)); }
  /* Certificate viewer fills the screen */
  .modal { padding: 0; }
  .modal__box { width: 100%; height: 100%; height: 100dvh; border-radius: 0; border: 0; }
  .modal__head { padding-top: max(14px, env(safe-area-inset-top)); }
  .modal__nav { top: auto; bottom: max(16px, env(safe-area-inset-bottom)); }
}
/* Printing gives a clean CV */
@media print {
  .nav, .progress, .to-top, .scroll-hint, .hero__cta, .filters, .search, .entry__toggle, .aquarium, .aquarium__hint, .hero::before { display: none !important; }
  .hero { min-height: auto; background: none; color: #000; padding: 24px 0; }
  .hero__text { text-shadow: none; }
  .entry__details { grid-template-rows: 1fr !important; }
  .reveal { opacity: 1; transform: none; }
  .section { padding: 24px 0; }
}
