:root {
  --ink: #16211d;
  --paper: #f6f5ee;
  --card: #ffffff;
  --muted: #6d7a72;
  --line: #dfe2d8;
  --dragonfly: #0f9bb5;
  --dragonfly-2: #6a5acd;
  --dragonfly-soft: #e2f5f9;
  --sloth: #7a8b3f;
  --sloth-2: #8a6a4a;
  --sloth-soft: #eef0e0;
  --radius: 16px;
  --shadow: 0 6px 22px rgba(22, 33, 29, 0.07);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.65 ui-serif, Georgia, "Iowan Old Style", "Times New Roman", serif;
  -webkit-font-smoothing: antialiased;
}

.wing-glow {
  position: fixed;
  inset: -30vh -20vw auto -20vw;
  height: 70vh;
  background:
    radial-gradient(45% 60% at 20% 40%, rgba(15, 155, 181, 0.18), transparent 70%),
    radial-gradient(40% 55% at 78% 30%, rgba(122, 139, 63, 0.18), transparent 70%),
    radial-gradient(35% 50% at 50% 60%, rgba(106, 90, 205, 0.12), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.wrap { width: min(1080px, 92vw); margin: 0 auto; position: relative; z-index: 1; }

a { color: var(--dragonfly); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- header ---------- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(246, 245, 238, 0.86);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .8rem 0; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .7rem; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-marks { font-size: 1.5rem; letter-spacing: -.15rem; }
.brand-marks .dragonfly { display: inline-block; animation: hover-flit 4s ease-in-out infinite; }
.brand-marks .sloth { display: inline-block; animation: sway 9s ease-in-out infinite; }
@keyframes hover-flit {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(3px, -4px) rotate(8deg); }
  60% { transform: translate(-3px, 2px) rotate(-6deg); }
}
@keyframes sway {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}
.brand-text strong { display: block; font-size: 1.06rem; letter-spacing: .01em; }
.brand-text em { display: block; font-size: .8rem; color: var(--muted); font-style: normal; }

.site-nav { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .93rem; font-family: ui-sans-serif, system-ui, sans-serif; }
.site-nav a { color: var(--ink); padding: .25rem 0; border-bottom: 2px solid transparent; }
.site-nav a:hover { text-decoration: none; border-bottom-color: var(--dragonfly); }
.site-nav .nav-dragonfly:hover { border-bottom-color: var(--dragonfly); }
.site-nav .nav-sloth:hover { border-bottom-color: var(--sloth); }
.site-nav .admin-link {
  border: 1px solid var(--line); border-radius: 999px; padding: .25rem .8rem;
  background: var(--card);
}

/* ---------- hero ---------- */
.hero {
  display: grid; grid-template-columns: 1.6fr 1fr; gap: 2rem; align-items: center;
  padding: 3rem 0 2rem;
}
.hero h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); line-height: 1.05; margin: 0 0 1rem; }
.lede { font-size: 1.1rem; color: #3a4a43; max-width: 62ch; }
.hero-actions { display: flex; gap: .7rem; flex-wrap: wrap; margin-top: 1.4rem; }

.btn {
  display: inline-block; padding: .6rem 1.1rem; border-radius: 999px; color: #fff;
  font-family: ui-sans-serif, system-ui, sans-serif; font-size: .92rem; border: 0; cursor: pointer;
}
.btn:hover { text-decoration: none; filter: brightness(1.07); }
.btn-dragonfly { background: linear-gradient(105deg, var(--dragonfly), var(--dragonfly-2)); }
.btn-sloth { background: linear-gradient(105deg, var(--sloth), var(--sloth-2)); }

.hero-stats, .statgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem; }
.statgrid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 1.5rem 0; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .9rem 1rem; box-shadow: var(--shadow);
}
.stat b { display: block; font-size: 1.7rem; line-height: 1.1; }
.stat span { font-size: .8rem; color: var(--muted); font-family: ui-sans-serif, system-ui, sans-serif; }
.stat.dragonfly b { color: var(--dragonfly); }
.stat.sloth b { color: var(--sloth); }

/* ---------- fact bar ---------- */
.factbar {
  display: flex; gap: .7rem; align-items: baseline; flex-wrap: wrap;
  background: linear-gradient(100deg, var(--dragonfly-soft), var(--sloth-soft));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.2rem; margin: 1.6rem 0;
}
.fact-emoji { font-size: 1.4rem; }
.fact-label { font-family: ui-sans-serif, system-ui, sans-serif; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.fact-body { flex: 1 1 320px; }

/* ---------- sections & cards ---------- */
.section-title {
  font-size: 1.15rem; text-transform: uppercase; letter-spacing: .09em;
  font-family: ui-sans-serif, system-ui, sans-serif; color: var(--muted);
  margin: 2.2rem 0 1rem; border-bottom: 1px solid var(--line); padding-bottom: .4rem;
}
.page-title { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 2rem 0 .5rem; }

.grid { display: grid; gap: 1.1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; box-shadow: var(--shadow);
  display: flex; gap: .9rem; align-items: flex-start; color: var(--ink);
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(22,33,29,.11); text-decoration: none; }
.card-emoji { font-size: 1.9rem; line-height: 1; }
.card-body { flex: 1; }
.card h3 { margin: .35rem 0 .4rem; font-size: 1.18rem; line-height: 1.25; }
.card h3 a { color: var(--ink); }
.post-card.pace-dragonfly { border-left: 4px solid var(--dragonfly); }
.post-card.pace-sloth { border-left: 4px solid var(--sloth); }
.excerpt { margin: .3rem 0 .6rem; color: #43514a; font-size: .97rem; }
.sci { font-style: italic; color: var(--muted); margin: 0; font-size: .9rem; }

.meta, .muted { color: var(--muted); font-size: .84rem; font-family: ui-sans-serif, system-ui, sans-serif; }
.meta .dot { margin: 0 .35rem; }
.sloth-time { color: var(--sloth); }

.pill {
  display: inline-block; font-family: ui-sans-serif, system-ui, sans-serif; font-size: .76rem;
  padding: .2rem .65rem; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; color: var(--muted);
}
.pill.on { outline: 2px solid var(--dragonfly); }
.kind-dragonfly { background: var(--dragonfly-soft); color: #0a6f83; border-color: #bfe6ee; }
.kind-sloth { background: var(--sloth-soft); color: #566326; border-color: #dbe2c0; }
.kind-general { background: #f0eee6; }

.tags { margin: .5rem 0 0; display: flex; flex-wrap: wrap; gap: .35rem; }
.tag {
  font-family: ui-sans-serif, system-ui, sans-serif; font-size: .76rem;
  background: #f0f2ea; border: 1px solid var(--line); border-radius: 999px;
  padding: .15rem .6rem; color: #4d5b52;
}
.tag.on { background: var(--dragonfly); color: #fff; border-color: var(--dragonfly); }
.tag:hover { text-decoration: none; background: var(--dragonfly-soft); }

.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0 1.5rem; }
.tagcloud { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.tagcloud .section-title { width: 100%; }

/* ---------- split columns ---------- */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 1.6rem; }
.split-col { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .2rem 1.2rem 1.2rem; box-shadow: var(--shadow); }
.dragonfly-col { border-top: 4px solid var(--dragonfly); }
.sloth-col { border-top: 4px solid var(--sloth); }
.species-strip { list-style: none; margin: 0; padding: 0; }
.species-strip li { padding: .6rem 0; border-bottom: 1px dashed var(--line); }
.species-strip li:last-child { border-bottom: 0; }
.species-strip a { display: flex; gap: .5rem; align-items: baseline; color: var(--ink); }
.s-emoji { font-size: 1.1rem; }
.s-name { font-weight: 600; }
.s-sci { font-style: italic; color: var(--muted); font-size: .85rem; }

.meter { height: 8px; background: #edefe6; border-radius: 999px; overflow: hidden; margin: .35rem 0 .2rem; }
.meter span { display: block; height: 100%; background: linear-gradient(90deg, var(--dragonfly), var(--dragonfly-2)); }
.meter.big { height: 14px; }

/* ---------- search ---------- */
.searchbar { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: 1rem 0; }
.searchbar input[type="search"] {
  flex: 1 1 280px; padding: .6rem .9rem; border: 1px solid var(--line);
  border-radius: 999px; background: #fff; font: inherit; font-size: .95rem;
}
.searchbar button {
  padding: .6rem 1.2rem; border-radius: 999px; border: 0; cursor: pointer; color: #fff;
  background: linear-gradient(105deg, var(--dragonfly), var(--dragonfly-2));
  font-family: ui-sans-serif, system-ui, sans-serif;
}
.searchbar .clear { font-size: .85rem; color: var(--muted); }

/* ---------- post ---------- */
.crumbs { margin: 1.5rem 0 0; font-size: .88rem; }
.post-header { margin-bottom: 1.5rem; }
.post-emoji { font-size: 3rem; }
.post-header h1 { font-size: clamp(1.9rem, 4.5vw, 3rem); line-height: 1.1; margin: .5rem 0; }
.pace-badge {
  display: inline-block; font-family: ui-sans-serif, system-ui, sans-serif; font-size: .84rem;
  background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: .35rem .9rem;
}
.post.pace-sloth .pace-badge { border-color: #cdd6a8; background: var(--sloth-soft); }
.post.pace-dragonfly .pace-badge { border-color: #bfe6ee; background: var(--dragonfly-soft); }

.prose { max-width: 68ch; font-size: 1.08rem; }
.prose p { margin: 0 0 1.15rem; }
.prose h2 { font-size: 1.35rem; margin: 2rem 0 .6rem; }

.factlist { list-style: none; margin: .6rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .3rem .8rem; font-family: ui-sans-serif, system-ui, sans-serif; font-size: .82rem; }
.factlist li { display: flex; justify-content: space-between; gap: .5rem; border-bottom: 1px dotted var(--line); padding: .15rem 0; }
.factlist span { color: var(--muted); }

.species-full.group-dragonfly { border-left: 4px solid var(--dragonfly); }
.species-full.group-sloth { border-left: 4px solid var(--sloth); }
.species-card.group-dragonfly { border-left: 4px solid var(--dragonfly); }
.species-card.group-sloth { border-left: 4px solid var(--sloth); }
.species-card .card-body { display: flex; flex-direction: column; }
.species-card em { color: var(--muted); font-size: .86rem; }

.species-hero {
  display: flex; gap: 1.4rem; align-items: center; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem;
  box-shadow: var(--shadow); margin-top: 1rem;
}
.species-hero.group-dragonfly { border-top: 5px solid var(--dragonfly); }
.species-hero.group-sloth { border-top: 5px solid var(--sloth); }
.species-hero h1 { margin: .4rem 0 .1rem; font-size: clamp(1.7rem, 4vw, 2.6rem); }
.species-hero-emoji { font-size: 3.6rem; }

.records { display: flex; gap: .8rem; flex-wrap: wrap; margin-bottom: 1.2rem; font-family: ui-sans-serif, system-ui, sans-serif; font-size: .88rem; }
.record { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: .4rem 1rem; }
.record.dragonfly { border-color: #bfe6ee; }
.record.sloth { border-color: #cdd6a8; }
.record b { margin-right: .4rem; }

.status-EN, .status-CR { color: #b3402b; font-weight: 700; }
.status-VU, .status-NT { color: #b3762b; }

/* ---------- comments ---------- */
.comments { margin-top: 2.5rem; }
.comment { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--sloth); border-radius: var(--radius); padding: .8rem 1.1rem; margin-bottom: .8rem; }
.comment-head { margin: 0 0 .3rem; font-size: .9rem; }
.comment p:last-child { margin: 0; }

.comment-form { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; margin-top: 1.2rem; box-shadow: var(--shadow); }
.comment-form h3 { margin: 0 0 .8rem; }
.comment-form label { display: block; margin-bottom: .8rem; font-family: ui-sans-serif, system-ui, sans-serif; font-size: .85rem; color: var(--muted); }
.comment-form input[type="text"], .comment-form input[type="email"], .comment-form textarea {
  width: 100%; padding: .55rem .8rem; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; font-size: .95rem; margin-top: .25rem; background: #fdfdfa;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.comment-form ul.errorlist { color: #b3402b; list-style: none; padding: 0; margin: .3rem 0 0; font-size: .82rem; }

/* ---------- misc ---------- */
.messages { margin-top: 1rem; }
.msg { padding: .7rem 1rem; border-radius: 12px; margin-bottom: .5rem; font-family: ui-sans-serif, system-ui, sans-serif; font-size: .9rem; }
.msg-success { background: var(--sloth-soft); border: 1px solid #cdd6a8; }
.msg-error { background: #fbe6e1; border: 1px solid #eec3b8; }

.pagination { display: flex; gap: 1rem; align-items: center; justify-content: center; margin: 2rem 0; font-family: ui-sans-serif, system-ui, sans-serif; font-size: .9rem; }
.more { margin: 1.2rem 0 0; font-family: ui-sans-serif, system-ui, sans-serif; }

.site-footer { margin-top: 4rem; border-top: 1px solid var(--line); background: rgba(255,255,255,.55); }
.footer-inner { padding: 1.6rem 0; font-size: .88rem; }
.footer-inner p { margin: .2rem 0; }

@media (max-width: 780px) {
  .hero, .split { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .species-hero { flex-direction: column; text-align: center; }
}
