/* cryobase — modern, simple, readable theme
   Cool "cryo" palette, Inter typography, card-based layout. */

:root {
  --bg: #f5f8fa;
  --surface: #ffffff;
  --border: #e3e9ee;
  --ink: #14303d;
  --ink-soft: #4a6472;
  --muted: #6b8190;
  --accent: #0e8aa8;        /* cool cyan */
  --accent-dark: #0a6a83;
  --accent-soft: #e6f3f7;
  --shadow: 0 1px 2px rgba(16, 42, 56, .06), 0 6px 20px rgba(16, 42, 56, .06);
  --radius: 12px;
}

* { box-sizing: border-box; }

html { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 { color: var(--ink); font-weight: 700; line-height: 1.25; letter-spacing: -.01em; }
p { margin: 0 0 1rem; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }
main { flex: 1 0 auto; padding: 40px 0 64px; }
.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: 28px; margin: 0 0 6px; }
.page-head .sub { color: var(--muted); margin: 0; }

/* ---------- Navbar ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.nav .container { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; color: var(--ink); letter-spacing: -.02em; }
.brand:hover { text-decoration: none; color: var(--ink); }
.brand .dot { width: 12px; height: 12px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), #5ec8df); box-shadow: 0 0 0 4px var(--accent-soft); }
.nav-links { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  display: block; padding: 8px 14px; border-radius: 8px;
  color: var(--ink-soft); font-weight: 500; font-size: 15px;
}
.nav-links a:hover { background: var(--accent-soft); color: var(--accent-dark); text-decoration: none; }
.nav-links a.active { color: var(--accent-dark); background: var(--accent-soft); }
.nav-toggle { display: none; background: none; border: 0; cursor: pointer; padding: 8px; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--ink); margin: 4px 0; border-radius: 2px; }

@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 10px 16px; box-shadow: var(--shadow);
    display: none;
  }
  .nav-links.open { display: flex; }
}

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, #0a6a83 0%, #0e8aa8 55%, #17a8c4 100%);
  color: #fff; padding: 96px 0; position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -120px; top: -120px;
  width: 420px; height: 420px; border-radius: 50%;
  background: rgba(255, 255, 255, .08);
}
.hero .container { position: relative; z-index: 1; }
.hero h1 { color: #fff; font-size: 46px; margin: 0 0 16px; max-width: 16ch; }
.hero p { font-size: 19px; color: rgba(255, 255, 255, .92); max-width: 60ch; margin: 0 0 28px; }
.hero .actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: 10px; font-weight: 600; font-size: 15px;
  border: 1px solid transparent; cursor: pointer; transition: all .15s ease;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); color: #fff; text-decoration: none; }
.btn-light { background: #fff; color: var(--accent-dark); }
.btn-light:hover { background: #eef7fa; color: var(--accent-dark); text-decoration: none; }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.6); }
.btn-ghost:hover { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 28px;
}
.card + .card { margin-top: 20px; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 720px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.tile { display: block; }
.tile h3 { font-size: 17px; margin: 0 0 6px; }
.tile p { color: var(--muted); margin: 0; font-size: 14px; }
a.tile:hover { text-decoration: none; }
a.tile:hover h3 { color: var(--accent-dark); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%; border-collapse: collapse; background: var(--surface);
  font-size: 15px;
}
table.data thead th {
  text-align: left; padding: 12px 16px; font-size: 12px; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted); font-weight: 600;
  border-bottom: 1px solid var(--border);
}
table.data tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: top; color: var(--ink-soft); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr.clickable-row { cursor: pointer; transition: background .12s ease; }
table.data tbody tr.clickable-row:hover { background: var(--accent-soft); }
table.data td .yr { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }
table.data td .ttl { color: var(--ink); font-weight: 500; }

/* ---------- Detail (definition) table ---------- */
.detail { width: 100%; border-collapse: collapse; }
.detail th {
  text-align: left; width: 180px; padding: 12px 16px; vertical-align: top;
  color: var(--muted); font-weight: 600; font-size: 14px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.detail td { padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--ink); }
.detail tr:last-child th, .detail tr:last-child td { border-bottom: 0; }

/* ---------- Search box ---------- */
.searchbar { display: flex; gap: 10px; flex-wrap: wrap; }
.searchbar input[type=text] {
  flex: 1 1 320px; min-width: 0; padding: 12px 16px; font-size: 16px;
  border: 1px solid var(--border); border-radius: 10px; background: #fff; color: var(--ink);
  font-family: inherit;
}
.searchbar input[type=text]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- Lists & misc ---------- */
.linklist { list-style: none; margin: 0; padding: 0; }
.linklist li { border-bottom: 1px solid var(--border); }
.linklist li:last-child { border-bottom: 0; }
.linklist a { display: block; padding: 13px 4px; color: var(--ink); font-weight: 500; }
.linklist a:hover { color: var(--accent-dark); padding-left: 10px; transition: padding .12s ease; text-decoration: none; }
.linklist a::before { content: "→"; color: var(--accent); margin-right: 10px; opacity: .6; }

.chip {
  display: inline-block; padding: 4px 11px; margin: 0 6px 6px 0;
  background: var(--accent-soft); color: var(--accent-dark);
  border-radius: 999px; font-size: 13px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.muted { color: var(--muted); }
.center { text-align: center; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }

/* Accordion (about) */
.accordion details {
  border: 1px solid var(--border); border-radius: 10px; background: #fff;
  margin-bottom: 12px; padding: 0 18px;
}
.accordion summary {
  cursor: pointer; padding: 16px 0; font-weight: 600; color: var(--ink); list-style: none;
  display: flex; justify-content: space-between; align-items: center;
}
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary::after { content: "+"; color: var(--accent); font-size: 22px; font-weight: 400; }
.accordion details[open] summary::after { content: "−"; }
.accordion details[open] summary { border-bottom: 1px solid var(--border); }
.accordion .body { padding: 14px 0; color: var(--ink-soft); }

/* ---------- Stats dashboard ---------- */
.stat-grid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-top: -56px;
  position: relative; z-index: 2;
}
@media (max-width: 900px) { .stat-grid { grid-template-columns: repeat(2, 1fr); margin-top: 24px; } }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px 20px; text-align: center; display: block;
}
a.stat-card:hover { text-decoration: none; transform: translateY(-2px); transition: transform .12s ease; border-color: #cfe6ee; }
.stat-num { font-size: 30px; font-weight: 800; color: var(--accent-dark); letter-spacing: -.02em; line-height: 1.1; }
.stat-dash { color: var(--muted); margin: 0 2px; font-weight: 600; }
.stat-label { margin-top: 6px; color: var(--muted); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

.card-title { font-size: 16px; margin: 0 0 18px; }

/* horizontal bar chart */
.barchart { display: flex; flex-direction: column; gap: 11px; }
.bar-row { display: grid; grid-template-columns: 150px 1fr 38px; align-items: center; gap: 12px; }
a.bar-row:hover { text-decoration: none; }
a.bar-row:hover .bar-fill { background: var(--accent-dark); }
.bar-label { font-size: 13px; color: var(--ink-soft); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-label.species { font-style: italic; }
.bar-track { height: 12px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; min-width: 3px; transition: width .3s ease; }
.bar-fill.alt { background: linear-gradient(90deg, #17a8c4, #5ec8df); }
.bar-val { font-size: 13px; font-weight: 700; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }

/* year histogram */
.histogram { display: flex; align-items: flex-end; gap: 3px; height: 140px; padding-top: 8px; }
.hbar { flex: 1 1 0; display: flex; align-items: flex-end; height: 100%; min-width: 4px; }
.hbar-fill { display: block; width: 100%; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85; }
.hbar:hover .hbar-fill { background: var(--accent-dark); opacity: 1; }
.histogram-axis { display: flex; justify-content: space-between; margin-top: 8px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

/* ---------- Pager ---------- */
.pager { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 24px; }
.pager .pg {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 38px; height: 38px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 9px; background: var(--surface);
  color: var(--ink-soft); font-weight: 600; font-size: 14px;
}
.pager .pg:hover { background: var(--accent-soft); color: var(--accent-dark); text-decoration: none; border-color: var(--accent-soft); }
.pager .pg.current { background: var(--accent); color: #fff; border-color: var(--accent); }
.pager .pg.disabled { opacity: .4; pointer-events: none; }
.pager .pg-gap { display: inline-flex; align-items: center; padding: 0 4px; color: var(--muted); }

/* ---------- Footer ---------- */
.footer {
  flex-shrink: 0; background: var(--surface); border-top: 1px solid var(--border);
  padding: 22px 0; margin-top: auto;
}
.footer .container { text-align: center; color: var(--muted); font-size: 14px; }
