.codex-hero {
    background: linear-gradient(90deg, #173b30 5%, #173b30ef 28%, #173b3070 67%, #173b3036), url("forest.webp") center 55% / cover;
    color: #fffaf0;
    padding: clamp(2.6rem, 6vw, 5rem) 0;
}
.codex-hero h1 { font-size: clamp(2.5rem, 5vw, 4.5rem); margin: 0; line-height: 1.13; }
.codex-hero p { margin: .8rem 0 0; color: #ffdf9f; font-weight: 600; }
.codex-body { padding-bottom: 5rem; }
.codex-tabs { display: flex; flex-wrap: wrap; gap: .35rem 1.7rem; border-bottom: 1px solid #cbd6c9; padding-top: .7rem; }
.codex-tabs a { display: inline-flex; align-items: baseline; gap: .45rem; padding: .8rem 0; border-bottom: 3px solid transparent; font-weight: 620; }
.codex-tabs a[aria-current], .codex-tabs a:hover { color: var(--green); border-color: var(--green); }
.codex-tabs a span { font-size: .8rem; font-variant-numeric: tabular-nums; color: #556c5e; }
.codex-heading { font-size: clamp(1.8rem, 3vw, 2.65rem); margin: 2rem 0 1rem; }
.codex-filters { display: flex; flex-wrap: wrap; gap: .85rem; align-items: flex-end; margin-bottom: 1.5rem; }
.codex-filters label { display: grid; gap: .25rem; font-size: .87rem; font-weight: 600; min-width: 0; }
.codex-filters label:first-of-type { width: min(100%, 21rem); }
.codex-filters input[type="search"], .codex-filters select, .codex-filters button {
    height: 2.8rem; border: 1px solid #a8b8aa; border-radius: .45rem; background: #fff; color: var(--ink); padding: 0 .75rem; font: 1rem var(--sans);
}
.codex-filters button { background: var(--green); color: white; border-color: var(--green); padding-inline: 1.25rem; cursor: pointer; }
.codex-filters a { align-self: flex-end; line-height: 2.8rem; text-decoration: underline; color: var(--green); }
.codex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); gap: 1rem; }
.codex-card { padding: 1.25rem; background: #fffefa; border: 1px solid var(--line); border-radius: .65rem; min-width: 0; overflow-wrap: anywhere; }
.codex-card:target { outline: 2px solid var(--green); outline-offset: 2px; }
.codex-card header, .codex-tree > header { display: flex; align-items: center; gap: .75rem; }
.codex-art { flex: none; height: 3rem; width: 3rem; overflow: hidden; }
.codex-art img { height: 100%; width: auto; max-width: none; display: block; }
.codex-kind, .codex-tree > header span { font-size: .82rem; color: #546b5e; }
.codex-card h3, .codex-card h5 { margin: 0; font: 650 1.28rem/1.35 var(--serif); }
.codex-card p { margin: .75rem 0 0; font-size: .95rem; }
.codex-card dl { margin: .85rem 0 0; border-top: 1px solid var(--line); padding-top: .5rem; }
.codex-card dl > div { display: grid; grid-template-columns: minmax(4.2rem, 37%) minmax(0, 1fr); gap: .65rem; padding: .22rem 0; font-size: .88rem; }
.codex-card dt { color: #53695d; }
.codex-card dd { margin: 0; }
.codex-refs { display: flex; flex-direction: column; align-items: flex-start; }
.codex-refs a { color: var(--green); text-decoration: underline; text-underline-offset: .17em; }
.codex-tree { margin-top: 2.2rem; }
.codex-tree > header h3 { margin: 0; font: 650 1.65rem var(--serif); }
.codex-levels { list-style: none; margin: 1.2rem 0 0 .35rem; padding: 0 0 0 1.3rem; border-left: 2px solid #b7cbb9; }
.codex-levels li { position: relative; padding-bottom: 1.2rem; }
.codex-levels li::before { content: ""; position: absolute; left: -1.67rem; top: .5rem; width: .6rem; height: .6rem; border-radius: 100%; background: var(--green); }
.codex-levels h4 { margin: 0 0 .65rem; color: var(--green); font-size: 1rem; }
.codex-empty { padding: 2.5rem 0; }
@media (max-width: 620px) {
    .codex-tabs { gap: 0 1.2rem; }
    .codex-tabs a { padding: .55rem 0; }
    .codex-filters label:first-of-type { width: 100%; }
    .codex-levels { padding-left: .9rem; }
    .codex-levels li::before { left: -1.27rem; }
}
