:root {
  --mist: #f4f9fd;
  --surface: #ffffff;
  --sky-100: #e3f1fb;
  --sky-300: #a9d6f3;
  --sky: #5aaee3;
  --sky-deep: #2f86c4;
  --ink: #0e2c45;
  --ink-soft: #52708a;
  --line: #d9eaf6;
  --leaf: #4e9e7e;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background: var(--mist);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--sky-deep); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--sky-deep); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.05; letter-spacing: -0.005em; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

/* Atmosphere: the one signature element. Sky fading into contour lines. */
.atmosphere {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #cfe9fa 0%, #e6f4fd 45%, var(--mist) 100%);
  border-bottom: 1px solid var(--line);
}
.contours {
  position: absolute; inset: auto 0 0 0; height: 70%;
  width: 100%; color: var(--sky-300); pointer-events: none;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 60%);
  mask-image: linear-gradient(180deg, transparent, #000 60%);
}

/* Navigation */
.topnav { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-top: 22px; padding-bottom: 22px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 600; letter-spacing: .01em; }
.brand img { width: 28px; height: 28px; }
.tabs { display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: rgba(255, 255, 255, .65); border: 1px solid var(--line); backdrop-filter: blur(6px); }
.tabs a { padding: 6px 16px; border-radius: 999px; color: var(--ink-soft); font-size: .92rem; font-weight: 500; text-decoration: none; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { background: var(--ink); color: #fff; }

/* Hero */
.hero { position: relative; display: grid; gap: 40px; padding: 72px 24px 96px; }
@media (min-width: 880px) { .hero { grid-template-columns: 1.35fr 1fr; align-items: end; padding-top: 96px; padding-bottom: 120px; } }
.hero h1 { font-size: clamp(3.8rem, 10vw, 6.75rem); font-style: italic; font-weight: 500; letter-spacing: -0.02em; }
.hero .sub { margin-top: 6px; color: var(--ink-soft); font-size: 1rem; }
.hero .statement { margin-top: 24px; max-width: 34ch; font-family: var(--serif); font-weight: 500; font-size: clamp(1.55rem, 2.8vw, 1.95rem); line-height: 1.25; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 20px; border-radius: 999px; font-size: .95rem; font-weight: 600; text-decoration: none; transition: background-color .15s ease, border-color .15s ease; }
.btn svg { width: 17px; height: 17px; }
.btn.primary { background: var(--ink); color: #fff; }
.btn.primary:hover { background: var(--sky-deep); color: #fff; }
.btn.ghost { background: rgba(255, 255, 255, .7); color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--sky); color: var(--ink); }

/* At a glance */
.glance { background: rgba(255, 255, 255, .78); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: 20px; padding: 8px 24px; }
.glance div { display: grid; grid-template-columns: 6.5rem 1fr; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.glance div:first-child { border-top: 0; }
.glance dt { color: var(--ink-soft); font-size: .9rem; }
.glance dd { font-weight: 500; }

/* Sections: title in a left column, content on the right */
.section { display: grid; gap: 24px; padding: 72px 0; border-top: 1px solid var(--line); }
main > .section:first-child { border-top: 0; }
@media (min-width: 880px) { .section { grid-template-columns: 240px 1fr; gap: 48px; } }
.section > h2 { font-size: 2.5rem; font-style: italic; font-weight: 500; }
.section-note { margin-top: 8px; color: var(--ink-soft); font-size: .95rem; font-family: var(--sans); }

/* Focus areas */
.focus { display: grid; gap: 16px; }
@media (min-width: 720px) { .focus { grid-template-columns: repeat(3, 1fr); } }
.focus article { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 22px; }
.focus svg { width: 26px; height: 26px; color: var(--sky-deep); }
.focus h3 { font-size: 1.65rem; margin-top: 14px; }
.focus p { margin-top: 8px; color: var(--ink-soft); font-size: .95rem; }

/* Rows: date on the left, detail on the right (experience, education, recognition) */
.rows { list-style: none; }
.rows > li { display: grid; gap: 4px 24px; padding: 22px 0; border-top: 1px solid var(--line); }
.rows > li:first-child { border-top: 0; padding-top: 0; }
@media (min-width: 640px) { .rows > li { grid-template-columns: 9.5rem 1fr; } }
.rows .when { color: var(--ink-soft); font-size: .92rem; font-variant-numeric: tabular-nums; padding-top: 3px; }
.rows h3 { font-family: var(--sans); font-size: 1.08rem; font-weight: 600; letter-spacing: 0; line-height: 1.4; }
.rows .org { color: var(--sky-deep); font-weight: 500; }
.rows p.detail { margin-top: 6px; color: var(--ink-soft); }
.rows .current .when { color: var(--sky-deep); font-weight: 600; }
.rows cite { font-style: italic; }

/* Projects teaser on the profile page */
.teaser { display: grid; gap: 14px; }
@media (min-width: 720px) { .teaser { grid-template-columns: 1fr 1fr; } }
.teaser a { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 22px; text-decoration: none; color: var(--ink); transition: border-color .15s ease; }
.teaser a:hover { border-color: var(--sky); }
.teaser h3 { font-size: 1.75rem; }
.teaser p { margin-top: 6px; color: var(--ink-soft); font-size: .95rem; }

/* Footer */
footer { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--ink-soft); font-size: .9rem; }
footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }

/* Projects page */
.hero.compact { padding-bottom: 88px; }
@media (min-width: 880px) { .hero.compact { grid-template-columns: 1fr; padding-bottom: 104px; } }
.hero.compact .statement { max-width: 40ch; }
.project { padding: 80px 0; border-top: 1px solid var(--line); }
main > .project:first-child { border-top: 0; }
.project-grid { display: grid; gap: 32px; }
@media (min-width: 880px) { .project-grid { grid-template-columns: 320px 1fr; gap: 56px; } .project-intro { position: sticky; top: 32px; align-self: start; } }
.project-intro h2 { font-size: clamp(2.5rem, 5.5vw, 3.2rem); font-style: italic; font-weight: 500; }
.project-intro p { margin-top: 12px; color: var(--ink-soft); }
.stack { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.stack li { font-size: .85rem; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); }
.block + .block { margin-top: 48px; }
.block > h3 { font-family: var(--sans); font-size: .95rem; font-weight: 600; color: var(--ink-soft); letter-spacing: 0; margin-bottom: 16px; }

.stats { list-style: none; display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stats li { background: var(--surface); padding: 18px 20px; }
.stats strong { display: block; font-family: var(--serif); font-weight: 600; font-size: 2.7rem; line-height: 1; font-variant-numeric: lining-nums; }
.stats span { display: block; margin-top: 6px; color: var(--ink-soft); font-size: .88rem; }

.split { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--sky-100); }
.split span { height: 100%; }
.split .e { background: var(--leaf); }
.split .g { background: var(--sky-deep); }
.split .s { background: var(--sky-300); }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 12px; font-size: .92rem; color: var(--ink-soft); }
.legend li { display: inline-flex; align-items: center; gap: 8px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; }
.asof { margin-top: 8px; font-size: .85rem; color: var(--ink-soft); }

.pipeline { list-style: none; counter-reset: step; }
.pipeline li { counter-increment: step; display: grid; grid-template-columns: 2.25rem 1fr; gap: 2px 14px; padding: 14px 0; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: .95rem; }
.pipeline li:first-child { border-top: 0; padding-top: 0; }
.pipeline li::before { content: counter(step, decimal-leading-zero); grid-row: span 2; font-family: var(--serif); font-style: italic; font-weight: 600; font-size: 1.5rem; line-height: 1.2; color: var(--sky-deep); }
.pipeline b { color: var(--ink); font-weight: 600; }

.report { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 8px 22px; }
.report li { list-style: none; display: grid; grid-template-columns: 3.2rem 1fr; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.report li:first-child { border-top: 0; }
.tag { justify-self: start; align-self: start; margin-top: 2px;font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; line-height: 1.6; }
.tag.e { background: #e1f2ea; color: #2f6f55; }
.tag.g { background: var(--sky-100); color: #1f5f8f; }
.tag.intl { background: #eef1f5; color: var(--ink-soft); }
.report small { display: block; color: var(--ink-soft); font-size: .85rem; margin-top: 2px; }

.tools { display: grid; gap: 14px; }
@media (min-width: 720px) { .tools { grid-template-columns: 1fr 1fr; } }
.tool { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 22px; }
.tool h4 { font-family: var(--serif); font-weight: 600; font-size: 1.7rem; line-height: 1.1; }
.tool p { margin-top: 8px; color: var(--ink-soft); font-size: .95rem; }
.tool .yields { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: .9rem; color: var(--ink); }
.tool .yields b { color: var(--sky-deep); font-weight: 600; }
.facts { list-style: none; display: grid; gap: 10px; }
@media (min-width: 640px) { .facts { grid-template-columns: 1fr 1fr; } }
.facts li { position: relative; padding-left: 20px; color: var(--ink-soft); }
.facts li::before { content: ""; position: absolute; left: 0; top: .7em; width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--sky); }

@media (max-width: 520px) {
  .hero { padding-top: 48px; padding-bottom: 72px; }
  .glance div { grid-template-columns: 5.5rem 1fr; }
  .section, .project { padding: 56px 0; }
}

/* Tools page */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tool-page { padding-top: 56px; padding-bottom: 24px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 28px; }
.panel h2, .results-head h2, .about-data h2 { font-size: 2.1rem; font-style: italic; font-weight: 500; }
.hint { color: var(--ink-soft); font-size: .92rem; }
.form-error { color: #b4442f; font-size: .92rem; min-height: 1.2em; margin-top: 8px; }
.gate { max-width: 520px; }
.gate .hint { margin-top: 6px; }
.gate-row { display: flex; gap: 10px; margin-top: 18px; }
.gate-row input { flex: 1; min-width: 0; }
input[type="password"], textarea, select {
  font: inherit; color: var(--ink); background: var(--mist);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px;
}
input[type="password"]:focus, textarea:focus, select:focus { outline: 2px solid var(--sky); outline-offset: 1px; border-color: var(--sky); }
textarea { width: 100%; resize: vertical; line-height: 1.6; }
.btn { border: 0; cursor: pointer; font-family: inherit; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.setup-grid { display: grid; gap: 28px; }
@media (min-width: 880px) { .setup-grid { grid-template-columns: 1.4fr 1fr; gap: 40px; } }
.field { display: grid; gap: 8px; }
.field > label, .field .label, legend { font-weight: 600; font-size: .95rem; }
.field-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.link-btn { color: var(--sky-deep); font-weight: 600; font-size: .92rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:focus-within { outline: 2px solid var(--sky-deep); outline-offset: 3px; border-radius: 4px; }
.column-pick { display: grid; gap: 6px; font-size: .92rem; }
.options { display: grid; gap: 22px; align-content: start; }
fieldset { border: 0; display: grid; gap: 10px; }
legend { margin-bottom: 8px; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; }
.check:has(input:checked) { border-color: var(--sky); background: var(--sky-100); }
.check input { margin-top: 5px; accent-color: var(--sky-deep); width: 16px; height: 16px; }
.check b { display: block; font-weight: 600; }
.check span { color: var(--ink-soft); font-size: .9rem; }
.check span b { color: var(--ink); font-size: 1rem; }
.year-row { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); }
.setup-actions { margin-top: 28px; display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.setup-actions .form-error { margin: 0; }

.results-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.results-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.results > .hint { margin-top: 6px; }
.sites { list-style: none; margin-top: 24px; display: grid; gap: 14px; }
.site { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 22px 24px; }
.site[data-state="running"] { border-color: var(--sky); }
.site-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.site-head h3 { font-family: var(--sans); font-size: 1.08rem; font-weight: 600; letter-spacing: 0; line-height: 1.4; }
.site-sub { color: var(--ink-soft); font-size: .88rem; margin-top: 2px; }
.pill { flex: none; font-size: .8rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: #eef1f5; color: var(--ink-soft); }
.pill.running { background: var(--sky-100); color: var(--sky-deep); }
.pill.done { background: #e1f2ea; color: #2f6f55; }
.pill.error { background: #fbe9e4; color: #a03c28; }
.site-step { margin-top: 14px; color: var(--ink-soft); font-size: .95rem; display: flex; align-items: center; gap: 10px; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--sky-300); border-top-color: var(--sky-deep); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
.site-error { margin-top: 12px; color: #a03c28; font-size: .95rem; }
.site-note { margin-top: 12px; color: var(--ink-soft); font-size: .88rem; }
.figures { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 12px; margin-top: 18px; }
@media (min-width: 720px) { .figures { grid-template-columns: repeat(6, 1fr); } }
.figures strong { display: block; font-family: var(--serif); font-weight: 600; font-size: 1.9rem; line-height: 1; font-variant-numeric: lining-nums; }
.figures span { font-size: .85rem; color: var(--ink-soft); }
.npp { margin-top: 20px; }
.npp-title { font-size: .92rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 8px; }
.bars { list-style: none; display: grid; gap: 6px; }
.bars li { display: grid; grid-template-columns: 3rem 1fr 6.5rem; gap: 12px; align-items: center; font-size: .9rem; }
.bars .yr { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.bars .bar { height: 10px; background: var(--sky-100); border-radius: 999px; overflow: hidden; }
.bars .bar i { display: block; height: 100%; background: var(--leaf); border-radius: 999px; }
.bars .val { text-align: right; font-variant-numeric: tabular-nums; }
.species-list { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.species-list summary { cursor: pointer; color: var(--sky-deep); font-weight: 600; font-size: .95rem; }
.table-scroll { max-height: 420px; overflow: auto; margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; }
.species-list table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.species-list th { position: sticky; top: 0; background: var(--mist); text-align: left; font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.species-list td { padding: 8px 12px; border-top: 1px solid var(--line); vertical-align: top; }
.species-list .cn { display: block; }
.species-list td i { color: var(--ink-soft); font-size: .85rem; }
.species-list .num { text-align: right; font-variant-numeric: tabular-nums; }
.species-list + .hint, .species-list .hint { margin-top: 8px; }
.badge-s { display: inline-block; font-size: .75rem; font-weight: 600; padding: 1px 7px; border-radius: 6px; margin: 1px 0; white-space: nowrap; }
.badge-s.threat { background: #fbe9e4; color: #a03c28; }
.badge-s.prot { background: var(--sky-100); color: #1f5f8f; }
.badge-s.endemic { background: #e1f2ea; color: #2f6f55; }
.badge-s.intro { background: #eef1f5; color: var(--ink-soft); }

.about-data { margin-top: 64px; padding-top: 48px; border-top: 1px solid var(--line); }
.about-data dl { display: grid; gap: 18px; margin-top: 20px; }
@media (min-width: 880px) { .about-data dl { grid-template-columns: repeat(3, 1fr); gap: 28px; } }
.about-data dt { font-weight: 600; }
.about-data dd { margin-top: 4px; color: var(--ink-soft); font-size: .95rem; }
