@font-face {
    font-family: "Fraunces";
    src: url("./fonts/Fraunces.woff2") format("woff2");
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
}

@font-face {
    font-family: "Atkinson Hyperlegible Next";
    src: url("./fonts/AtkinsonHyperlegibleNext.woff2") format("woff2");
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
}

:root {
    color-scheme: light;
    --page-bg: #eef3f3;
    --paper: #eef3f3;
    --paper-light: #f9fcfb;
    --paper-line: #c9d7d8;
    --ink: #192d33;
    --ink-soft: #314950;
    --ink-muted: #4d6269;
    --botanical-green: #1d665c;
    --rust: #94412d;
    --violet-ink: #585283;
    --header-surface: #f9fcfb;
    --panel-surface: #f9fcfb;
    --tooltip-surface: #f9fcfb;
    --field-surface: #e5eeee;
    --subtle-surface: #edf4f3;
    --hover-surface: #dcebe9;
    --atlas-glow: #f9fcfb;
    --layout-glow: #f9fcfb;
    --panel-shadow: 0 10px 32px #182e3a24;
    --control-shadow: 0 4px 16px #182e3a24;
    --scroll-thumb: #859da2;
    --focus-ring: #8c541b;
    --family-node: #266e63;
    --family-fill: #dceee8;
    --species-node: #385c80;
    --species-fill: #deebf5;
    --extinct-node: #94412d;
    --extinct-fill: #f5e3db;
    --font-display: "Fraunces", Georgia, serif;
    --font-body: "Atkinson Hyperlegible Next", "Segoe UI", sans-serif;
    --font-mono: "Cascadia Mono", Consolas, monospace;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --page-bg: #111c25;
    --paper: #111c25;
    --paper-light: #243641;
    --paper-line: #405561;
    --ink: #eff7f8;
    --ink-soft: #d6e5e9;
    --ink-muted: #adc1c9;
    --botanical-green: #99ddce;
    --rust: #ffb59c;
    --violet-ink: #ccc9ef;
    --header-surface: #192a35;
    --panel-surface: #1d303c;
    --tooltip-surface: #213641;
    --field-surface: #293e49;
    --subtle-surface: #263b46;
    --hover-surface: #324b57;
    --atlas-glow: #1a2b37;
    --layout-glow: #1a2b37;
    --panel-shadow: 0 10px 32px #050a1266;
    --control-shadow: 0 4px 16px #050a1266;
    --scroll-thumb: #637e8a;
    --focus-ring: #fac778;
    --family-node: #99ddce;
    --family-fill: #234642;
    --species-node: #b0d5fa;
    --species-fill: #264259;
    --extinct-node: #ffb59c;
    --extinct-fill: #4b3235;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--page-bg);
    scroll-behavior: smooth;
}

body {
    min-width: 320px;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    background: var(--page-bg);
    color: var(--ink);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

details > summary {
    display: block;
    list-style: none;
}

summary::marker {
    content: "";
}

summary::-webkit-details-marker {
    display: none;
}

.external-link-icon {
    flex: none;
    vertical-align: -0.12em;
}

select {
    -webkit-appearance: none;
    appearance: none;
}

body,
.site-header,
.atlas-stage,
.floating-panel,
.tree-tooltip,
.tree-controls {
    transition: background-color 240ms ease, border-color 240ms ease, color 240ms ease, box-shadow 240ms ease;
}

.theme-toggle .sun-icon {
    display: none;
}

:root[data-theme="dark"] .theme-toggle .sun-icon {
    display: block;
}

:root[data-theme="dark"] .theme-toggle .moon-icon {
    display: none;
}

button,
input {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    cursor: pointer;
}

::selection {
    background: var(--hover-surface);
    color: var(--ink);
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.blazor-error-boundary {
    margin: 1rem;
    padding: 1rem;
    border: 1px solid rgba(154, 77, 47, 0.4);
    border-radius: 0.75rem;
    background: rgba(154, 77, 47, 0.1);
    color: #642e1d;
}

.blazor-error-boundary::after {
    content: "The interactive explorer encountered an error.";
}

@media (prefers-reduced-motion: reduce) {
    body,
    .site-header,
    .atlas-stage,
    .floating-panel,
    .tree-tooltip,
    .tree-controls {
        transition: none;
    }
}


.taxon-glyph {
    position: relative;
    display: inline-block;
    width: 1.35em;
    height: 1.35em;
    color: var(--ink-soft);
}

.taxon-glyph.branch::before {
    position: absolute;
    inset: 24%;
    border: 2px solid currentColor;
    border-radius: 20%;
    content: "";
    transform: rotate(45deg);
}

.taxon-glyph.family {
    color: var(--family-node);
    background:
        radial-gradient(circle at 50% 28%, currentColor 0 13%, transparent 15%),
        radial-gradient(circle at 24% 70%, currentColor 0 13%, transparent 15%),
        radial-gradient(circle at 76% 70%, currentColor 0 13%, transparent 15%);
}

.taxon-glyph.species {
    color: var(--species-node);
    background: radial-gradient(circle, currentColor 0 21%, transparent 24%);
}

.taxon-glyph.species::before {
    position: absolute;
    inset: 13%;
    border: 1.5px solid currentColor;
    border-radius: 50%;
    content: "";
}
.node-contributions,
.community-discussion {
    margin-block: 1rem;
    padding-block-start: 0.75rem;
    border-top: 1px solid var(--paper-line);
}

.community-dashboard {
    width: min(46rem, calc(100% - 2rem));
    margin: 1.5rem auto;
    padding: clamp(1rem, 4vw, 2rem);
    border: 1px solid var(--paper-line);
    border-radius: 1rem;
    background: var(--panel-surface);
    color: var(--ink);
}

.community-dashboard section { margin-block: 1.5rem; }
.community-dashboard h1 { margin-block: 0.6rem; }
.community-ui h3 { font-size: 1.05rem; }
.community-ui a { color: var(--botanical-green); overflow-wrap: anywhere; }
.community-ui summary, .community-discussion summary { cursor: pointer; font-weight: 700; }
.community-ui .community-message:empty { display: none; }
.community-account-label { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; }

.community-form {
    display: grid;
    gap: 0.55rem;
    margin-block: 0.65rem;
}

.community-form label {
    display: grid;
    gap: 0.2rem;
}

.community-form input:not([type="checkbox"]),
.community-form select,
.community-form textarea {
    width: 100%;
    min-width: 0;
    padding: 0.3rem 0.45rem;
    border: 1px solid var(--paper-line);
    border-radius: 0.35rem;
    background: var(--field-surface);
    color: var(--ink);
}

.community-form .community-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
}

.community-ui button,
.community-comment-action {
    justify-self: start;
    padding: 0.25rem 0.55rem;
    border: 1px solid var(--paper-line);
    border-radius: 0.35rem;
    background: var(--field-surface);
    color: var(--ink);
}

.community-ui button:hover:not(:disabled), .community-comment-action:hover { background: var(--hover-surface); }
.community-ui button:disabled { opacity: 0.6; }

.community-card {
    padding: 0.6rem;
    margin-block: 0.6rem;
    border: 1px solid var(--paper-line);
    border-radius: 0.5rem;
    overflow-wrap: anywhere;
}

.community-card h4 { font-size: 1rem; margin-block: 0.4rem; }
.community-card p { margin-block: 0.35rem; }
.community-card header, .community-review-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.community-card img { display: block; max-width: 100%; max-height: 14rem; margin-block: 0.35rem; object-fit: contain; }
.community-review-actions { margin-top: 0.5rem; }

.community-badge {
    display: inline-block;
    padding: 0.05rem 0.32rem;
    font-size: 0.75em;
    border: 1px solid var(--paper-line);
    border-radius: 0.3rem;
    color: var(--botanical-green);
}

.community-contest {
    display: inline-grid;
    place-items: center;
    width: 1.45rem;
    height: 1.45rem;
    margin-inline-start: 0.25rem;
    border: 1px solid var(--rust);
    border-radius: 50%;
    background: transparent;
    color: var(--rust);
    font-weight: 800;
    line-height: 1;
    vertical-align: middle;
}

.community-contest.contested {
    background: var(--rust);
    color: var(--panel-surface);
}

summary { list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::marker { content: ""; }
select { -webkit-appearance: none; appearance: none; }

.node-editor-heading, .block-editor > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
}
.editor-eyebrow { font-size: .65rem; letter-spacing: .13em; color: var(--botanical-green); margin: .25rem 0; font-weight: 700; }
.node-editor-heading h3 { font-size: 1.35rem; margin: .2rem 0; }
.node-editor-intro, .research-data-hint, .editor-review-note { color: var(--ink-soft); font-size: .85rem; line-height: 1.6; }
.node-contributions > details { padding: .8rem; border: 1px solid var(--paper-line); border-radius: .8rem; margin-block: .7rem; }
.node-contributions summary { display: flex; gap: .65rem; align-items: center; }
.node-contributions summary > span { color: var(--botanical-green); }
.node-contributions details[open] > summary { margin-bottom: .8rem; }
.node-contributions fieldset { border: 0; padding: 0; min-width: 0; }
.node-contributions .community-form { gap: 1rem; }
.node-contributions .community-form label { font-size: .85rem; font-weight: 600; gap: .4rem; }
.node-contributions .community-form input:not([type="checkbox"]),
.node-contributions .community-form select, .node-contributions .community-form textarea { padding: .7rem; border-radius: .55rem; font-weight: 400; }
.community-form select { padding-right: 2.25rem !important; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23717e70' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .65rem center; }
.community-form textarea { resize: vertical; }
.community-ui :is(button, input, select, textarea, summary):focus-visible { outline: 2px solid var(--botanical-green); outline-offset: 3px; }
.editor-toolbar { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; }
.community-ui .editor-toolbar button { padding: .5rem .7rem; }
.community-ui .editor-submit { background: var(--botanical-green); color: var(--panel-surface); border-color: var(--botanical-green); }
.image-source-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.community-ui .image-source-choice { display: flex; flex-wrap: wrap; gap: .4rem; text-align: left; padding: .9rem; border-radius: .7rem; width: 100%; }
.image-source-choice small { display: block; width: 100%; line-height: 1.5; color: var(--ink-soft); }
.community-ui .image-source-choice.selected { border-color: var(--botanical-green); background: color-mix(in srgb, var(--botanical-green) 9%, var(--panel-surface)); box-shadow: 0 0 0 1px var(--botanical-green); }
.image-upload-zone { border: 1px dashed var(--botanical-green); border-radius: .75rem; padding: 1.2rem; text-align: center; background: var(--field-surface); }
.image-link-preview { margin: 0; border-radius: .65rem; overflow: hidden; background: var(--field-surface); }
.image-link-preview img { width: 100%; max-height: 16rem; object-fit: contain; }
.image-link-preview figcaption { font-size: .75rem; padding: .6rem; color: var(--ink-soft); }
.collection-builder { display: grid; gap: .8rem; }
.block-editor { padding: .85rem; border: 1px solid var(--paper-line); background: var(--field-surface); border-radius: .7rem; display: grid; gap: .75rem; }
.block-editor header strong { font-size: .85rem; }
.collection-preview { padding: .75rem; border: 1px dashed var(--paper-line); border-radius: .6rem; }
.node-content-block { margin-block: 1rem; min-width: 0; }
.node-content-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.node-content-columns p, .node-block-text { white-space: pre-wrap; }
.node-table-scroll { max-width: 100%; overflow: auto; }
.node-content-block table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.node-content-block :is(th, td) { padding: .6rem; border: 1px solid var(--paper-line); text-align: left; min-width: 6rem; }
.node-content-block th { background: var(--field-surface); }
.editable-record { margin: 0; }
.editable-record > div { padding-block: .7rem; border-bottom: 1px solid var(--paper-line); }
.editable-record dt { font-size: .7rem; color: var(--ink-soft); margin-bottom: .25rem; }
.editable-record dd { display: flex; gap: .5rem; flex-wrap: wrap; align-items: start; margin: 0; font-size: .85rem; overflow-wrap: anywhere; }
.editable-record dd > span { flex: 1; min-width: 7rem; white-space: pre-wrap; }
@media (max-width: 600px) {
    .image-source-options, .node-content-columns { grid-template-columns: 1fr; }
}

.verification-badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .75rem; font-weight: 600; vertical-align: middle; }
.verification-badge svg { width: 1rem; height: 1rem; flex: none; }
.verification-badge.is-verified { color: #168454; }
.verification-badge.is-unverified { color: #7c8389; }
.domain-options { display: flex; flex-wrap: wrap; gap: .6rem 1rem; }
.profile-credentials { white-space: pre-wrap; }
.signin-page > details { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--paper-line); }
.admin-signin { width: min(26rem, calc(100% - 2rem)); margin-block: clamp(2rem, 9vh, 6rem); padding: clamp(1.5rem, 5vw, 2.5rem); border-radius: 1.25rem; box-shadow: 0 1rem 4rem #00000012; }
.admin-back { font-size: .8rem; }
.admin-signin-heading { margin-block: 2rem 1.75rem; }
.admin-signin-symbol { display: grid; place-items: center; width: 3rem; height: 3rem; margin-bottom: 1.25rem; border: 1px solid var(--paper-line); border-radius: .85rem; color: var(--botanical-green); font-size: 1.75rem; }
.admin-signin-heading h1 { margin-block: .5rem; font-size: 2rem; letter-spacing: -.04em; }
.admin-signin-heading > p:last-child { color: var(--ink-soft); line-height: 1.6; }
.admin-signin .community-form { gap: 1.25rem; }
.admin-signin .community-form input { min-height: 2.9rem; padding: .75rem; border-radius: .6rem; }
.admin-signin .editor-submit { width: 100%; min-height: 2.9rem; padding: .75rem 1rem; border-radius: .6rem; }
.admin-signin-error { padding: .85rem; border: 1px solid var(--rust); border-radius: .6rem; font-size: .85rem; }
.community-form fieldset { border: 0; padding: 0; display: grid; gap: 1rem; min-width: 0; }
