:root {
  color-scheme: light dark;
  --bg: #F9F8F6;
  --alt: #F3EFEA;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --surface: #ffffff;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.10);
  --link: #0071e3;
  --ring: rgba(0, 113, 227, 0.35);
  --pill: rgba(0, 0, 0, 0.04);
  --pill-hover: rgba(0, 0, 0, 0.06);
  --avatar-bg: rgba(0, 0, 0, 0.06);
  --skip-bg: rgba(255, 255, 255, 0.92);
}

@media (prefers-color-scheme: dark) {
  /* System dark mode (unless explicitly overridden by data-theme="light"). */
  :root:not([data-theme="light"]) {
    /* Softer, Apple-like charcoal dark (avoid pure black). */
    --bg: #2F2D36;
    --alt: #3C3C46;
    --surface: #3C3C46;
    --text: rgba(255, 255, 255, 0.88);
    --muted: rgba(255, 255, 255, 0.60);
    --shadow: 0 18px 80px rgba(0, 0, 0, 0.28);
    --link: rgba(141, 198, 255, 0.92);
    --ring: rgba(41, 151, 255, 0.40);
    --pill: rgba(255, 255, 255, 0.10);
    --pill-hover: rgba(255, 255, 255, 0.14);
    --avatar-bg: rgba(255, 255, 255, 0.10);
    --skip-bg: rgba(60, 60, 70, 0.88);
  }
}

/* Explicit theme override (set by src/theme.ts -> public/theme.js). */
:root[data-theme="dark"] {
  --bg: #2F2D36;
  --alt: #3C3C46;
  --surface: #3C3C46;
  --text: rgba(255, 255, 255, 0.88);
  --muted: rgba(255, 255, 255, 0.60);
  --shadow: 0 18px 80px rgba(0, 0, 0, 0.28);
  --link: rgba(141, 198, 255, 0.92);
  --ring: rgba(41, 151, 255, 0.40);
  --pill: rgba(255, 255, 255, 0.10);
  --pill-hover: rgba(255, 255, 255, 0.14);
  --avatar-bg: rgba(255, 255, 255, 0.10);
  --skip-bg: rgba(60, 60, 70, 0.88);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.012em;
}

a {
  color: var(--link);
  text-decoration: none;
  text-underline-offset: 0.18em;
}
a:hover { text-decoration: underline; }
a:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 3px;
  border-radius: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--pill);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
  background: var(--pill-hover);
}

.btn:active { transform: translateY(0); }

.btn-primary {
  background: rgba(0, 113, 227, 0.10);
  border-color: rgba(0, 113, 227, 0.22);
  color: var(--link);
}

.btn-primary:hover {
  background: rgba(0, 113, 227, 0.14);
}

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

.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;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--skip-bg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  transform: translateY(-150%);
  transition: transform 160ms ease;
}
.skip-link:focus-visible { transform: translateY(0); }

/* Full-width bands with an inner max-width container (Apple-like layout). */
.band {
  width: 100%;
  padding: 44px 0;
  background: var(--bg);
}
.band-alt { background: var(--alt); }
.band-hero { padding: 76px 0 34px; }

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 22px;
}

.theme-toggle-fab {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top));
  right: calc(14px + env(safe-area-inset-right));
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 0;
  background: var(--pill);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 160ms ease, background 160ms ease;
  z-index: 50;
}
.theme-toggle-fab:hover {
  transform: translateY(-1px);
  background: var(--pill-hover);
}
.theme-toggle-fab:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 3px;
}

.theme-toggle-fab::before {
  content: "☾";
  font-size: 18px;
  line-height: 1;
  position: relative;
  top: -2px;
}
:root[data-theme="dark"] .theme-toggle-fab::before { content: "☀︎"; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle-fab::before { content: "☀︎"; }
}

.hero {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 18px;
  align-items: center;
}

.avatar {
  width: 130px;
  height: 130px;
  border-radius: 16px;
  object-fit: cover;
  background: var(--avatar-bg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  margin-left: -50px;
}

@media (max-width: 520px) {
  .hero {
    grid-template-columns: 1fr;
    justify-items: start;
  }
  .avatar { margin-left: 0; }
}

header {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
}

.title {
  display: grid;
  gap: 8px;
  min-width: 240px;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 3.2vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.03em;
  font-weight: 600;
}

.tagline {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
}

.pillrow {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  margin-top: 14px;
}

.social-btn {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: var(--pill);
  color: var(--text);
  transition: transform 160ms ease, background 160ms ease;
}
.social-btn:hover {
  transform: translateY(-1px);
  background: var(--pill-hover);
  text-decoration: none;
}
.social-btn:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 3px;
}

/* Use SVG files as masks so icon color follows currentColor in light/dark mode. */
.social-btn::before {
  content: "";
  width: 19px;
  height: 19px;
  background: currentColor;
  -webkit-mask: var(--icon) no-repeat center / contain;
  mask: var(--icon) no-repeat center / contain;
}

.social-github { --icon: url("/assets/icons/github.svg"); }
.social-linkedin { --icon: url("/assets/icons/linkedin.svg"); }
/* You currently have protonmail.svg, so we point email to that by default. */
.social-email { --icon: url("/assets/icons/protonmail.svg"); }
.social-resume { --icon: url("/assets/icons/cv.svg"); }
.social-resume::before {
  width: 30px;
  height: 30px;
  transform: translateX(-1px);
}
main { display: block; }

.about {
  margin: 0;
  color: var(--text);
  font-size: 17px;
}

.section-title {
  margin: 0 0 6px 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

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

.pub-list {
  margin: 14px 0 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 14px;
}

.pub-item {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 14px;
  align-items: start;
}

.pub-date {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.01em;
  padding-top: 2px;
  white-space: nowrap;
}

.pub-title {
  display: inline-block;
}

.pub-meta {
  margin-top: 6px;
}

@media (max-width: 520px) {
  .pub-item { grid-template-columns: 1fr; gap: 6px; }
  .pub-date { padding-top: 0; }
}

.contact-block {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 18px;
  align-items: start;
}

@media (max-width: 720px) {
  .contact-block { grid-template-columns: 1fr; }
}

.map-embed {
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.12);
  background: var(--surface);
}

.map-embed iframe {
  display: block;
  width: 100%;
  height: 260px;
  border: 0;
}

.links {
  margin: 12px 0 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  list-style: none;
  color: var(--muted);
}

.links a {
  display: inline-flex;
  gap: 8px;
  align-items: baseline;
}

.links .hint {
  font-size: 12px;
  opacity: 0.9;
  letter-spacing: 0.01em;
}

footer {
  color: var(--muted);
  font-size: 13px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.sep { opacity: 0.6; }

::selection { background: rgba(0, 113, 227, 0.20); }
@media (prefers-color-scheme: dark) {
  ::selection { background: rgba(41, 151, 255, 0.28); }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

