/*
 * crocodiles — site stylesheet
 * Hand-written, local only: no framework, no @import, no external url().
 * Light background, dark ink, warm earthy palette.
 */

:root {
    --bg: #eef2e2;          /* pale reed */
    --paper: #f6f8ee;       /* card / table background */
    --ink: #1f2b1c;         /* main dark brown text */
    --muted: #4f5d48;       /* secondary text */
    --line: #c3cfae;        /* borders */
    --sand: #dbe5c3;        /* header band / row header */
    --accent: #2f6a2a;      /* terracotta, links and focus */
    --accent-soft: #6f9a5a;
    --nav-bg: #24402a;      /* dark brown navigation bar */
    --nav-ink: #eef2e2;
    --danger-crit: #7c1d10; /* "critically endangered" badge */
    --danger: #8a4a10;      /* "endangered" badge */
}

/* ---------- Base ---------- */

* {
    box-sizing: border-box;
}

html {
    font-size: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.65;
}

main,
footer,
nav ul,
.site-header {
    max-width: 62rem;
    margin-inline: auto;
}

main {
    padding: 2rem max(1rem, 4vw) 3rem;
}

p,
li,
dd {
    max-width: 68ch;
}

a {
    color: var(--accent);
    text-decoration-thickness: from-font;
    text-underline-offset: 0.15em;
}

a:hover {
    color: #17421a;
}

h1,
h2,
h3 {
    line-height: 1.25;
    color: #18261a;
}

h2 {
    font-size: clamp(1.35rem, 3vw, 1.8rem);
    margin: 2.6rem 0 0.8rem;
    padding-bottom: 0.3rem;
    border-bottom: 2px solid var(--line);
}

h3 {
    font-size: clamp(1.1rem, 2.5vw, 1.3rem);
    margin: 1.6rem 0 0.5rem;
}

ul {
    padding-left: 1.4rem;
}

li {
    margin-block: 0.4rem;
}

li::marker {
    color: var(--accent-soft);
}

/* ---------- Accessibility helpers ---------- */

.skip {
    position: absolute;
    left: 1rem;
    top: -3rem;
    z-index: 10;
    padding: 0.5rem 1rem;
    background: var(--nav-bg);
    color: var(--nav-ink);
    border-radius: 0 0 0.4rem 0.4rem;
    transition: top 0.15s ease-out;
}

.skip:focus-visible {
    top: 0;
}

:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

/* ---------- Header (decorative water-ripple motif, CSS only) ---------- */

.site-header {
    position: relative;
    overflow: hidden;
    padding: 2.5rem max(1rem, 4vw) 1.6rem;
    background: linear-gradient(180deg, #e3ecd0 0%, #cddcb3 100%);
    border-bottom: 1px solid var(--line);
}

.site-header::before,
.site-header::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

/* large floating dust clouds, purely decorative */
.site-header::before {
    width: 22rem;
    height: 22rem;
    right: -6rem;
    bottom: -9rem;
    background: radial-gradient(circle at 35% 35%,
        rgba(60, 120, 90, 0.30), rgba(176, 113, 74, 0) 65%);
}

.site-header::after {
    width: 14rem;
    height: 14rem;
    right: 9rem;
    bottom: -60%;
    background: radial-gradient(circle at 55% 40%,
        rgba(40, 90, 50, 0.16), rgba(138, 63, 14, 0) 70%);
}

.site-kicker {
    margin: 0;
    font-size: 0.8rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
}

.site-title {
    margin: 0.2rem 0 0.4rem;
    font-size: clamp(2rem, 6vw, 3rem);
    font-weight: 700;
}

.site-lede {
    margin: 0;
    max-width: 42rem;
    font-size: clamp(1rem, 2.4vw, 1.2rem);
    color: var(--muted);
    position: relative;
}

/* ---------- Navigation ---------- */

nav {
    background: var(--nav-bg);
}

.site-nav {
    list-style: none;
    max-width: 62rem;
    margin: 0 auto;
    padding: 0.4rem max(1rem, 4vw);
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem;
}

.site-nav a {
    display: inline-block;
    padding: 0.45rem 0.9rem;
    border-radius: 0.4rem;
    color: var(--nav-ink);
    text-decoration: none;
    transition: background-color 0.15s ease-out;
}

.site-nav a:hover,
.site-nav a:focus-visible {
    background: rgba(238, 242, 226, 0.15);
    color: #fff;
    outline-offset: -2px;
}

.site-nav a[aria-current="page"] {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}

/* ---------- Sections ---------- */

section {
    margin-bottom: 2.2rem;
}

/* ---------- Species identity cards ---------- */

.fiche {
    margin: 1rem 0;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 0.6rem;
    overflow: hidden;
}

.fiche-line {
    display: flex;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--line);
}

.fiche-line:last-child {
    border-bottom: none;
}

.fiche dt {
    flex: 0 0 11rem;
    padding: 0.55rem 1rem;
    font-weight: 600;
    background: var(--sand);
    border-right: 1px solid var(--line);
}

.fiche dd {
    flex: 1 1 16rem;
    margin: 0;
    padding: 0.55rem 1rem;
}

@media (max-width: 40rem) {
    .fiche-line {
        flex-direction: column;
    }

    .fiche dt {
        flex-basis: auto;
        border-right: none;
        border-bottom: 1px dotted var(--line);
    }
}

/* ---------- Conservation status badges ---------- */

.badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 0.8rem;
    background: var(--danger);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge--crit {
    background: var(--danger-crit);
}

/* ---------- Table ---------- */

.table-wrap {
    overflow-x: auto;
    margin-block: 1.2rem;
    border: 1px solid var(--line);
    border-radius: 0.6rem;
    background: var(--paper);
}

table {
    border-collapse: collapse;
    width: 100%;
    min-width: 46rem;
}

caption {
    caption-side: top;
    text-align: left;
    padding: 0.9rem 1rem 0.6rem;
    font-weight: 600;
    color: var(--muted);
}

th,
td {
    border: 1px solid var(--line);
    padding: 0.55rem 0.8rem;
    text-align: left;
    vertical-align: top;
}

thead th {
    background: var(--sand);
    font-weight: 700;
}

tbody th {
    background: #e4ecd2;
    font-weight: 600;
}

tbody tr:nth-child(even) td,
tbody tr:nth-child(even) th {
    background: #eef3e0;
}

/* ---------- Footer ---------- */

footer {
    margin-top: 2rem;
    padding: 1.4rem max(1rem, 4vw) 2.5rem;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.9rem;
}

footer p {
    margin: 0.2rem 0;
    max-width: none;
}

/* ---------- Small screens ---------- */

@media (max-width: 40rem) {
    .site-header {
        padding-block: 2rem 1.3rem;
    }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* ---------- Pictures ---------- */

figure.photo {
    margin: 1rem 0 1.5rem;
    padding: 0;
}

figure.photo img {
    display: block;
    width: 100%;
    max-width: 640px;
    height: auto;
    border: 1px solid var(--line);
    border-radius: 6px;
}

figure.photo figcaption {
    margin-top: 0.4rem;
    font-size: 0.9rem;
    color: var(--muted);
}
