:root {
  --brand: #1e63e9;
  --brand-2: #22b8f0;
  --brand-ink: #1550c0;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef2f8;
  --text: #111827;
  --muted: #5b6474;
  --line: #dde3ec;
  --safe: #0e9f6e;
  --caution: #c76a00;
  --danger: #d12d2d;
  --neutral: #64748b;
  --radius: 20px;
  --radius-s: 12px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 8px 24px rgb(0 0 0 / 0.06);
  --max: 1120px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #5b9bff;
    --brand-2: #67d4ff;
    --brand-ink: #93c5fd;
    --bg: #0b0f17;
    --surface: #131a26;
    --surface-2: #1b2333;
    --text: #eef2f8;
    --muted: #9aa4b5;
    --line: #283246;
    --safe: #34d399;
    --caution: #fbbf24;
    --danger: #f87171;
    --neutral: #94a3b8;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
/* Grid tracks use minmax(0, …) so images with width attributes can't force horizontal overflow. */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
}
img { max-width: 100%; display: block; }
a { color: var(--brand-ink); text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; }
h1, .display { font-family: ui-rounded, "SF Pro Rounded", -apple-system, system-ui, sans-serif; }
h2 { font-size: 1.45rem; margin: 0 0 0.75rem; }
h3 { font-size: 1.1rem; margin: 1.25rem 0 0.4rem; }
p { margin: 0 0 0.9rem; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 20px; height: 60px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--text); text-decoration: none; font-size: 1.05rem; }
.logo img { width: 30px; height: 30px; display: block; }
.nav { display: flex; gap: 18px; margin-left: auto; align-items: center; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.95rem; }
.nav a:hover { color: var(--text); }
.nav a.btn, .nav a.btn:hover { color: #fff; }
@media (max-width: 720px) { .nav a.hide-sm { display: none; } }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-radius: 999px; font-weight: 700; text-decoration: none;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--brand) 35%, transparent);
}
.btn:hover { filter: brightness(1.05); }
.btn.small { padding: 8px 16px; font-size: 0.9rem; box-shadow: none; }
.btn svg { width: 18px; height: 18px; }

/* Breadcrumbs */
.crumbs { font-size: 0.88rem; color: var(--muted); margin: 18px 0 10px; }
.crumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs li + li::before { content: "›"; margin-right: 6px; }
.crumbs a { color: var(--muted); }

/* Species hero */
.hero { display: grid; gap: 28px; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: center; margin: 8px 0 28px; }
@media (max-width: 860px) { .hero { grid-template-columns: minmax(0, 1fr); } .hero figure { order: -1; } }
.hero h1 { font-size: clamp(2.1rem, 5vw, 3.2rem); margin: 0 0 6px; font-weight: 800; }
.hero .sci { font-style: italic; color: var(--muted); font-size: 1.15rem; margin: 0 0 14px; }
.hero .lead { font-size: 1.15rem; }
.hero figure { margin: 0; }
.hero img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); background: var(--surface-2); }
figcaption, .credit { font-size: 0.78rem; color: var(--muted); margin-top: 6px; }

.badges { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 0; }
.badge {
  display: inline-flex; align-items: center; gap: 10px; padding: 8px 16px 8px 8px;
  border-radius: 999px; border: 1.5px solid color-mix(in srgb, var(--tint) 30%, transparent);
  background: color-mix(in srgb, var(--tint) 8%, transparent);
}
.badge .dot { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--tint) 16%, transparent); color: var(--tint); font-weight: 900; }
.badge small { display: block; color: var(--muted); font-size: 0.72rem; line-height: 1.1; }
.badge strong { font-size: 0.95rem; line-height: 1.2; }
.tint-safe { --tint: var(--safe); }
.tint-caution { --tint: var(--caution); }
.tint-danger { --tint: var(--danger); }
.tint-neutral { --tint: var(--neutral); }

/* Layout */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
@media (max-width: 960px) { .layout { grid-template-columns: minmax(0, 1fr); } }
.card { background: var(--surface); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card h2 { display: flex; align-items: center; gap: 10px; }
.card h2 .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--brand) 13%, transparent); color: var(--brand); font-size: 1.05rem; flex: none; }
/* Sticky only when the facts fit on screen; otherwise its bottom would be unreachable. */
@media (min-width: 961px) and (min-height: 900px) { .aside .card { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; } }

/* Answer box: the first thing people and AI assistants read */
.answer { border-left: 4px solid var(--tint); }
.answer p:last-child { margin-bottom: 0; }

/* Facts */
.facts { margin: 0; display: grid; gap: 0; }
.facts div { display: grid; grid-template-columns: 110px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 0.93rem; }
.facts div:last-child { border-bottom: 0; }
.facts dt { color: var(--muted); font-weight: 600; }
.facts dd { margin: 0; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border-radius: 999px; background: var(--surface-2); font-size: 0.85rem; }
.swatch i { width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--line); display: inline-block; }

/* Lists */
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: s; position: relative; padding-left: 40px; margin-bottom: 12px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 1px; width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font-size: 0.8rem; font-weight: 800; display: grid; place-items: center; }
.facts-list { padding-left: 1.1rem; margin: 0; }
.facts-list li { margin-bottom: 8px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 52px 1fr; gap: 14px; position: relative; padding-bottom: 18px; }
.timeline li:not(:last-child)::after { content: ""; position: absolute; left: 25px; top: 54px; bottom: 4px; width: 2px;
  background: linear-gradient(var(--brand), var(--brand-2)); opacity: 0.4; }
.timeline .stage { width: 52px; height: 52px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: 1.5rem;
  border: 2px solid color-mix(in srgb, var(--brand) 35%, transparent); }
.timeline h3 { margin: 4px 0 2px; }
.timeline p { color: var(--muted); margin: 0; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.tile { background: var(--surface-2); border-radius: var(--radius-s); padding: 14px 16px; }
.tile h3 { margin: 0 0 4px; font-size: 0.92rem; color: var(--muted); }
.tile p { margin: 0; }

details { background: var(--surface-2); border-radius: var(--radius-s); margin-bottom: 10px; }
summary { cursor: pointer; padding: 14px 16px; font-weight: 650; list-style: none; display: flex; gap: 12px; align-items: baseline; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; margin-left: auto; color: var(--muted); font-weight: 400; font-size: 1.2rem; }
details[open] summary::after { content: "–"; }
details > div { padding: 0 16px 14px; color: var(--muted); }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-s); background: var(--surface-2); }

/* App CTA */
.cta {
  border-radius: var(--radius); padding: 24px; margin-bottom: 18px; color: #fff;
  background: radial-gradient(120% 140% at 0% 0%, #3aa0ff 0%, #1e5fe6 50%, #0a2e8a 100%);
}
.cta h2 { color: #fff; margin-bottom: 6px; }
.cta p { color: rgb(255 255 255 / 0.85); }
.cta .btn { background: #fff; color: #0a2e8a; box-shadow: none; }
.cta.compact h2 { font-size: 1.15rem; }

/* Cards grid */
.species-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
@media (max-width: 520px) { .species-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .sp-card div { padding: 8px 10px 10px; } .sp-card strong { font-size: 0.92rem; } }
.sp-card { background: var(--surface); border-radius: 16px; overflow: hidden; text-decoration: none; color: var(--text); box-shadow: var(--shadow); display: flex; flex-direction: column; transition: transform .15s ease; }
.sp-card:hover { transform: translateY(-2px); }
.sp-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--surface-2); }
.sp-card div { padding: 10px 14px 14px; }
.sp-card strong { display: block; line-height: 1.25; }
.sp-card em { color: var(--muted); font-size: 0.85rem; }
.sp-card .pill { display: inline-block; margin-top: 6px; font-size: 0.72rem; font-weight: 700; color: var(--tint); }

/* Home */
.home-hero { text-align: center; padding: 64px 0 40px; }
.home-hero h1 { font-size: clamp(2.4rem, 7vw, 4.2rem); margin: 0 0 12px; font-weight: 800;
  background: linear-gradient(135deg, var(--text) 30%, var(--brand)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.home-hero p { font-size: 1.2rem; color: var(--muted); max-width: 620px; margin: 0 auto 26px; }
.search { max-width: 520px; margin: 26px auto 0; }
.search input { width: 100%; padding: 14px 20px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 1rem; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 0 0 34px; }
.chip { padding: 9px 16px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); text-decoration: none; color: var(--text); font-weight: 600; font-size: 0.92rem; }
.chip span { color: var(--muted); font-weight: 500; margin-left: 4px; }
.section-title { margin: 40px 0 16px; font-size: 1.6rem; }

/* Footer */
.site-footer { margin-top: 60px; padding: 34px 0 50px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.88rem; }
.site-footer .cols { display: flex; flex-wrap: wrap; gap: 28px; justify-content: space-between; }
.site-footer a { color: var(--muted); }
.note { font-size: 0.85rem; color: var(--muted); }

/* Privacy Policy, Terms of Use */
.legal { max-width: 72ch; margin: 40px auto 64px; line-height: 1.65; }
.legal h1 { font-size: clamp(2rem, 5vw, 2.6rem); margin: 0 0 4px; font-weight: 800; }
.legal h2 { font-size: 1.2rem; margin: 32px 0 8px; }
.legal ul { padding-left: 1.2em; }
.legal li { margin: 6px 0; }
.legal .muted { color: var(--muted); margin-top: 0; }

/* Calls to action */
.hero-actions, .cta-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.hero-actions { justify-content: center; }
.btn.ghost { background: var(--surface); color: var(--brand-ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.cta .cta-link { color: #fff; font-weight: 600; }

/* Online identifier */
.identify-hero { padding-bottom: 24px; }
.dropzone { max-width: 560px; margin: 0 auto 14px; padding: 34px 20px 18px; border: 2px dashed var(--line); border-radius: var(--radius);
  background: var(--surface); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.dropzone.over { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, var(--surface)); }
.dropzone label { cursor: pointer; }
.dropzone p { margin: 8px 0 0; font-size: 0.95rem; }
.dropzone:focus-within label { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 3px; }
.idf-result { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 22px; align-items: start; margin: 8px 0 28px; scroll-margin-top: 80px; }
@media (max-width: 760px) { .idf-result { grid-template-columns: minmax(0, 1fr); } }
.idf-result > img { width: 100%; border-radius: var(--radius); background: var(--surface-2); }
.idf-result > img:not([src]) { display: none; }
.idf-result .cta { margin: 18px 0 8px; }
.idf-loading { display: flex; align-items: center; gap: 12px; margin: 0; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin 0.8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

/* Comparison pages */
.cmp-title { font-size: clamp(2rem, 5vw, 2.8rem); margin: 6px 0 10px; }
.cmp-lead { max-width: 720px; font-size: 1.1rem; }
.cmp-photos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 20px 0 22px; }
.cmp-photo { margin: 0; }
.cmp-photo img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); background: var(--surface-2); }
.cmp-photo h2 { margin: 10px 0 0; font-size: 1.2rem; }
.cmp-photo .sci { margin: 0; font-style: italic; color: var(--muted); }
.table-scroll { overflow-x: auto; }
.cmp-table { width: 100%; border-collapse: collapse; font-size: 0.93rem; min-width: 480px; }
.cmp-table th, .cmp-table td { text-align: left; vertical-align: top; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); }
.cmp-table thead th { font-size: 1rem; }
.cmp-table tbody th { color: var(--muted); font-weight: 600; width: 110px; }
.cmp-table tr:last-child th, .cmp-table tr:last-child td { border-bottom: 0; }
.pill-tint { color: var(--tint); font-weight: 700; }
.cmp-howto { align-items: start; }
.cmp-howto .card { margin-bottom: 0; }
.cmp-howto + .cta { margin-top: 18px; }
.compare-list { columns: 2 260px; padding-left: 1.1rem; }
.compare-list li { margin-bottom: 6px; break-inside: avoid; }
