:root {
  --bg: #ffffff;
  --fg: #2f3437;
  --muted: #6b7378;
  --border: #e3e6e8;
  --accent: #2a6db0;
  --accent-soft: #eaf2fb;
  --card: #f7f8f9;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15181b; --fg: #dde1e4; --muted: #9aa3a9; --border: #2a2f34;
    --accent: #6aa8e8; --accent-soft: #1d2a38; --card: #1b1f23;
  }
}
:root[data-theme="dark"] {
  --bg: #15181b; --fg: #dde1e4; --muted: #9aa3a9; --border: #2a2f34;
  --accent: #6aa8e8; --accent-soft: #1d2a38; --card: #1b1f23;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--sans); font-size: 16px; line-height: 1.65;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Masthead */
.masthead { border-bottom: 1px solid var(--border); background: var(--bg); position: sticky; top: 0; z-index: 10; }
.masthead-inner {
  max-width: 1180px; margin: 0 auto; padding: 14px 16px;
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
}
.site-title { font-weight: 700; color: var(--fg); font-size: 1.05rem; }
.site-title code { font-family: var(--mono); color: var(--accent); font-weight: 600; }
.site-title:hover { text-decoration: none; }
.nav { display: flex; gap: 4px 18px; flex-wrap: wrap; margin-left: auto; }
.nav a { color: var(--muted); font-size: 0.95rem; padding: 2px 0; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--fg); text-decoration: none; }
.nav a.active { color: var(--fg); border-bottom-color: var(--accent); }

/* Layout */
.page {
  max-width: 1180px; margin: 0 auto; padding: 36px 16px 48px;
  display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 48px;
}
@media (max-width: 820px) {
  .page { grid-template-columns: 1fr; gap: 28px; padding-top: 24px; }
  .nav { margin-left: 0; }
}

/* Sidebar */
.sidebar { position: sticky; top: 84px; align-self: start; }
@media (max-width: 820px) { .sidebar { position: static; } }
.avatar {
  object-fit: cover;
  width: 160px; height: 160px; border-radius: 50%; display: block;
  border: 1px solid var(--border); background: var(--card);
}
.author-name { margin: 16px 0 2px; font-size: 1.35rem; }
.author-title { margin: 0; color: var(--muted); }
.author-bio { margin: 6px 0 14px; color: var(--muted); font-size: 0.92rem; }
.follow-label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 14px 0 6px; }
.author-links { list-style: none; margin: 0; padding: 0; font-size: 0.92rem; }
.author-links li { margin: 4px 0; }
.author-links a { color: var(--fg); display: inline-flex; align-items: center; gap: 10px; }
.author-links a:hover { color: var(--accent); }
.author-links svg { width: 16px; height: 16px; flex: none; color: var(--muted); }
@media (max-width: 820px) {
  .sidebar { display: grid; grid-template-columns: 96px 1fr; gap: 0 18px; align-items: center; }
  .avatar { width: 96px; height: 96px; }
  .author-name { margin-top: 0; }
  .sidebar .follow-label, .sidebar .author-links { grid-column: 1 / -1; }
  .author-links { display: flex; flex-wrap: wrap; gap: 4px 18px; }
}

/* Content */
.content h1 { font-size: 1.9rem; margin: 0 0 8px; line-height: 1.25; }
.content h1 code { font-family: var(--mono); color: var(--accent); }
.content h2 { font-size: 1.3rem; margin: 36px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.content h3 { font-size: 1.05rem; margin: 24px 0 6px; }
.content p, .content li { max-width: 72ch; }
.lead { color: var(--muted); margin-top: 0; }

.callout {
  background: var(--accent-soft); border-left: 3px solid var(--accent);
  padding: 12px 16px; border-radius: 4px; font-size: 0.93rem; margin: 20px 0;
}

.traits { list-style: none; padding: 0; }
.traits li { margin: 8px 0; }
.traits strong { display: inline-block; min-width: 64px; }

.news { list-style: none; padding: 0; margin: 0; }
.news li { display: grid; grid-template-columns: 92px 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--border); }
.news time { font-family: var(--mono); font-size: 0.85rem; color: var(--muted); padding-top: 2px; }
@media (max-width: 480px) { .news li { grid-template-columns: 1fr; gap: 0; } }

/* Lists of items (publications, talks...) */
.item { padding: 14px 0; border-bottom: 1px solid var(--border); }
.item:last-child { border-bottom: 0; }
.item-title { font-weight: 600; margin: 0; }
.item-meta { color: var(--muted); font-size: 0.92rem; margin: 2px 0 0; }
.item-meta .me { color: var(--fg); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag {
  font-size: 0.75rem; padding: 1px 8px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted); background: var(--card);
}
.tag.award { border-color: #d8a93a; color: #9a6c00; background: #fff6df; }
:root[data-theme="dark"] .tag.award { color: #f0c560; background: #2c2512; border-color: #6b5520; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tag.award { color: #f0c560; background: #2c2512; border-color: #6b5520; }
}
.year { font-family: var(--mono); color: var(--muted); font-size: 0.95rem; margin: 28px 0 0; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 4px; }
.filters button {
  font: inherit; font-size: 0.85rem; cursor: pointer; padding: 4px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg); color: var(--fg);
}
.filters button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

table { border-collapse: collapse; width: 100%; font-size: 0.93rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.05em; }
.table-wrap { overflow-x: auto; }

.cv-row { display: grid; grid-template-columns: 130px 1fr; gap: 16px; padding: 8px 0; }
.cv-row .when { font-family: var(--mono); color: var(--muted); font-size: 0.88rem; padding-top: 2px; }
@media (max-width: 480px) { .cv-row { grid-template-columns: 1fr; gap: 0; } }

.btn {
  display: inline-block; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--accent);
  color: var(--accent); font-size: 0.92rem;
}
.btn:hover { background: var(--accent); color: #fff; text-decoration: none; }

/* Footer */
.footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 0.85rem; }
.footer-inner { max-width: 1180px; margin: 0 auto; padding: 20px 16px; display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
.footer a { color: var(--muted); }
.theme-toggle { font: inherit; background: none; border: 1px solid var(--border); color: var(--muted); border-radius: 6px; padding: 2px 10px; cursor: pointer; }

/* Review form */
.review-form { display: grid; gap: 16px; max-width: 640px; margin-top: 20px; }
.review-form label { display: grid; gap: 6px; font-weight: 600; font-size: 0.92rem; }
.review-form .form-row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .review-form .form-row.two { grid-template-columns: 1fr; } }
.review-form input[type=text], .review-form input[type=email], .review-form input[type=tel], .review-form select, .review-form textarea, .review-form .date-input {
  font: inherit; font-weight: 400; color: var(--fg); background: var(--bg);
  border: 1px solid var(--border); border-radius: 6px; padding: 9px 11px; width: 100%;
}
.review-form textarea { resize: vertical; }
.review-form :is(input, select, textarea):focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.review-form .req { color: #c0392b; }
.review-form .opt { color: var(--muted); font-weight: 400; }
.review-form .check { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; }
.review-form .check input { margin-top: 5px; }
.review-form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.stars { border: 0; padding: 0; margin: 0; }
.stars legend { font-weight: 600; font-size: 0.92rem; padding: 0; margin-bottom: 4px; }
.stars-input { display: inline-flex; flex-direction: row-reverse; gap: 2px; }
.stars-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.stars-input label { font-size: 2rem; line-height: 1; color: var(--border); cursor: pointer; transition: color 0.15s; }
.stars-input label:hover, .stars-input label:hover ~ label,
.stars-input input:checked ~ label { color: #e5a50a; }
.stars-input input:focus-visible + label { outline: 2px solid var(--accent); border-radius: 4px; }
.form-msg { margin: 0; font-size: 0.92rem; min-height: 1.2em; }
.form-msg.err { color: #c0392b; }
.btn-solid {
  justify-self: start; font: inherit; font-weight: 600; cursor: pointer;
  background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: 10px 20px;
}
.btn-solid:disabled { opacity: 0.55; cursor: not-allowed; }

/* Booking form */
.form-msg.ok { color: #1e6b35; }
.review-form .form-section { font-size: 1rem; margin: 12px 0 -4px; padding: 0; border: 0; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.8rem; }
.review-form label[hidden] { display: none; }

/* Date picker (matches form inputs) */
.review-form .field { display: grid; gap: 6px; align-content: start; }
.review-form .field-label { font-weight: 600; font-size: 0.92rem; }
.date-field { position: relative; }
.review-form .date-input {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  text-align: left; cursor: pointer; line-height: inherit;
}
.date-input .date-text { color: var(--muted); }
.date-input.has-date .date-text { color: var(--fg); }
.date-input svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.review-form .date-input:focus, .review-form .date-input[aria-expanded="true"] { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.review-form .date-input.invalid { border-color: #c0392b; }
.picker {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; width: 290px; max-width: calc(100vw - 32px);
  border: 1px solid var(--border); border-radius: 8px; padding: 10px; background: var(--bg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}
.picker[hidden] { display: none; }
.picker-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.picker-month { font-weight: 600; font-size: 0.92rem; }
.picker-nav {
  font: inherit; width: 30px; height: 30px; border-radius: 6px; cursor: pointer; line-height: 1;
  border: 1px solid var(--border); background: var(--bg); color: var(--fg);
}
.picker-nav:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.picker-nav:disabled { opacity: 0.35; cursor: default; }
.picker-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.picker-dow { font-size: 0.72rem; color: var(--muted); text-align: center; padding-bottom: 2px; }
.picker-day {
  font: inherit; font-size: 0.85rem; aspect-ratio: 1; padding: 0; border-radius: 6px; cursor: pointer;
  border: 1px solid transparent; background: none; color: var(--fg);
}
.picker-day:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent); }
.picker-day:disabled { color: var(--muted); opacity: 0.4; cursor: default; }
.picker-day.today { border-color: var(--border); }
.picker-day.selected, .picker-day.selected:hover { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.picker-day:focus-visible, .picker-nav:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Sidebar "Get in touch" */
.book-btn { display: inline-flex; align-items: center; gap: 8px; font-size: 0.92rem; }
.book-btn:hover { text-decoration: none; filter: brightness(1.08); }
.book-btn svg { width: 16px; height: 16px; }
.book-btn.active { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
@media (max-width: 820px) { .sidebar .book-btn { grid-column: 1 / -1; justify-self: start; } }

/* Language switcher */
.lang-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.lang-switch button {
  font: inherit; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; cursor: pointer;
  padding: 3px 8px; border: 0; background: var(--bg); color: var(--muted);
}
.lang-switch button + button { border-left: 1px solid var(--border); }
.lang-switch button:hover { color: var(--fg); }
.lang-switch button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.lang-switch button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* PWAS diagram: ASCII globe (assets/globe.js) with tool logos linked across it.
   Coordinates share one 100 x 70 grid: the globe sits at (50, 35) with radius 30. */
.pwas-stage {
  position: relative; container-type: inline-size;
  width: 100%; max-width: 720px; aspect-ratio: 100 / 70; margin: 24px 0 8px;
}
.ascii-globe {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  margin: 0; padding: 0; background: none; border: 0;
  font-family: var(--mono); color: var(--accent);
  font-size: 7px; font-size: calc(60cqw / 38.4); line-height: 1.2;
  overflow: hidden; user-select: none;
}
.pwas-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.pwas-lines .link {
  fill: none; stroke: var(--fg); stroke-width: 0.35; stroke-linecap: round;
  stroke-dasharray: 1.2 1.4; animation: pwas-flow 1.6s linear infinite; opacity: 0.8;
}
.pwas-lines .arc { stroke: var(--accent); stroke-width: 0.45; opacity: 1; }
.pwas-lines .pt circle { fill: var(--c); }
.pwas-lines .pt .ring {
  fill: none; stroke: var(--c); stroke-width: 0.3;
  transform-box: fill-box; transform-origin: center; animation: pwas-pulse 2s ease-out infinite;
}
@keyframes pwas-flow { to { stroke-dashoffset: -2.6; } }
@keyframes pwas-pulse { from { transform: scale(1); opacity: 1; } to { transform: scale(3.5); opacity: 0; } }
.pwas-node {
  position: absolute; left: calc(var(--x) * 1%); top: calc(var(--y) / 70 * 100%);
  transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 4px;
}
.pwas-node .badge {
  display: grid; place-items: center; width: clamp(34px, 11cqw, 68px); aspect-ratio: 1;
  border-radius: 50%; background: #fff; border: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}
.pwas-node .badge img { width: 56%; height: 56%; }
.pwas-node .label {
  position: absolute; top: 100%; margin-top: 4px; white-space: nowrap;
  font-size: clamp(11px, 2.2cqw, 14px); font-weight: 600; color: var(--fg);
}

.pwas-flow { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pwas-flow li {
  max-width: none; background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 14px;
  display: grid; grid-template-columns: 28px 1fr; gap: 4px 10px; align-items: center;
}
.pwas-flow li div { display: grid; line-height: 1.3; }
.pwas-flow li div span { color: var(--muted); font-size: 0.85rem; }
.pwas-flow li p { grid-column: 1 / -1; margin: 6px 0 0; font-size: 0.93rem; }
@media (max-width: 640px) { .pwas-flow { grid-template-columns: 1fr; } }
.pwas-prompt {
  margin: 8px 0 16px; padding: 12px 16px; border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: 4px; font-style: italic; max-width: 72ch;
}
.pwas-code {
  font-family: var(--mono); font-size: 0.85rem; background: var(--card); border: 1px solid var(--border);
  border-radius: 6px; padding: 10px 14px; white-space: pre-wrap; overflow-wrap: anywhere;
}
