@font-face {
    font-family: "SabenciaDisplay";
    src: url("../../Baskerville.otf") format("opentype");
    font-display: swap;
}

@font-face {
    font-family: "SabenciaSans";
    src: url("../../NotoSans-Regular.ttf") format("truetype");
    font-display: swap;
}

:root {
    --bg: #efe7d6;
    --paper: rgba(255, 252, 245, 0.92);
    --paper-strong: #fffdf8;
    --ink: #1d2b2b;
    --muted: #556563;
    --line: rgba(34, 73, 68, 0.16);
    --accent: #174e47;
    --accent-strong: #0f3b36;
    --accent-soft: #d7ebe6;
    --warm: #e8d9be;
    --warm-strong: #d8b980;
    --shadow: 0 20px 50px rgba(14, 39, 36, 0.15);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-sm: 12px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "SabenciaSans", Arial, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(23, 78, 71, 0.16), transparent 26%),
        radial-gradient(circle at 88% 10%, rgba(216, 185, 128, 0.22), transparent 20%),
        linear-gradient(180deg, rgba(249, 244, 234, 0.95) 0%, rgba(239, 231, 214, 0.98) 100%),
        url("../../fondu.jpg");
    background-size: auto, auto, auto, 420px auto;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select {
    font: inherit;
}

.site-shell {
    width: min(1380px, calc(100% - 28px));
    margin: 18px auto 36px;
}

.masthead {
    display: grid;
    gap: 18px;
}

.masthead__panel,
.masthead__bar,
.search-panel,
.results-panel,
.feature-card,
.message-card {
    background: var(--paper);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.masthead__panel {
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.masthead__bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    border-radius: 0;
    border: 0;
    border-bottom: 1px solid var(--line);
    padding: 18px 22px;
}

.brand {
    display: grid;
    gap: 4px;
}

.brand__kicker {
    font-size: 2.34rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--accent);
}

.brand__title {
    font-family: "SabenciaDisplay", Georgia, serif;
    font-size: clamp(1.35rem, 2.7vw, 2.07rem);
    line-height: 0.95;
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.nav-links__item {
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid transparent;
    color: var(--muted);
    transition: 180ms ease;
}

.nav-links__item:hover,
.nav-links__item:focus-visible {
    border-color: var(--line);
    background: rgba(255, 255, 255, 0.5);
    color: var(--accent);
}

.nav-links__item--active {
    background: var(--accent);
    color: #f7fbfa;
}

.hero {
    display: grid;
    grid-template-columns: 1.4fr 0.8fr;
    gap: 22px;
    border-radius: var(--radius-xl);
    overflow: hidden;
    position: relative;
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(120deg, rgba(23, 78, 71, 0.06), transparent 40%),
        radial-gradient(circle at 80% 20%, rgba(216, 185, 128, 0.24), transparent 30%);
    pointer-events: none;
}

.hero__content,
.hero__panel {
    position: relative;
    z-index: 1;
}

.hero__content {
    padding: 34px;
}

.hero__eyebrow,
.section-kicker {
    margin: 0 0 12px;
    font-size: 0.78rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--accent);
}

.hero h1,
.search-panel h2,
.results-panel h2,
.feature-card h2,
.message-card h2,
.message-card h3 {
    margin: 0;
    font-family: "SabenciaDisplay", Georgia, serif;
    line-height: 0.95;
}

.hero h1 {
    max-width: 12ch;
    font-size: clamp(2.9rem, 5vw, 5.2rem);
}

.hero__lead {
    max-width: 64ch;
    margin: 18px 0 0;
    font-size: 1.05rem;
    line-height: 1.75;
    color: var(--muted);
}

.hero__actions,
.hero__share,
.search-form__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.hero__actions {
    margin-top: 24px;
}

.hero__button,
.submit-button,
.chip-button,
.feature-card__link {
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.hero__button,
.submit-button,
.feature-card__link {
    padding: 14px 20px;
}

.hero__button,
.feature-card__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.7);
    color: var(--accent);
    border: 1px solid var(--line);
}

.hero__button--primary,
.submit-button {
    background: linear-gradient(180deg, var(--accent), var(--accent-strong));
    color: #f8fffd;
    box-shadow: 0 10px 24px rgba(15, 59, 54, 0.22);
}

.hero__button:hover,
.submit-button:hover,
.chip-button:hover,
.feature-card__link:hover {
    transform: translateY(-1px);
}

.hero__panel {
    padding: 34px 30px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(231, 246, 242, 0.85));
    border-left: 1px solid var(--line);
    display: grid;
    gap: 18px;
    align-content: space-between;
}

.hero__stat {
    padding: 18px;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.74);
    border: 1px solid rgba(23, 78, 71, 0.08);
}

.hero__stat-label {
    display: inline-block;
    margin-bottom: 8px;
    font-size: 0.78rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent);
}

.hero__stat p {
    margin: 0;
    line-height: 1.7;
    color: var(--muted);
}

.chip-button,
.mini-action {
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--accent);
    border: 1px solid var(--line);
}

.page-layout {
    display: grid;
    gap: 18px;
    margin-top: 12px;
}

.search-panel,
.results-panel,
.message-card {
    border-radius: var(--radius-xl);
    padding: 28px;
}

.search-panel--integrated {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
    background: transparent;
}

.message-card--error {
    border-color: rgba(139, 44, 44, 0.24);
    background: rgba(255, 243, 243, 0.9);
}

.search-panel__heading,
.results-panel__heading {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: end;
    margin-bottom: 22px;
}

.search-form {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(210px, 0.8fr) minmax(210px, 0.8fr) auto;
    gap: 16px;
    align-items: end;
}

.field,
.toggle-field {
    display: grid;
    gap: 8px;
}

.field__label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--muted);
}

.field__control {
    width: 100%;
    min-height: 56px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(23, 78, 71, 0.18);
    background: rgba(255, 255, 255, 0.92);
    color: var(--ink);
}

.field__control:focus,
.submit-button:focus,
.chip-button:focus,
.hero__button:focus,
.feature-card__link:focus,
.species-card__copy-name:focus,
.species-card__copy-scientific:focus,
.nav-links__item:focus {
    outline: 2px solid rgba(23, 78, 71, 0.35);
    outline-offset: 2px;
}

.toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 8px 0;
}

.toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.toggle__track {
    position: relative;
    width: 58px;
    height: 32px;
    border-radius: 999px;
    background: #b8cac7;
    transition: background 180ms ease;
}

.toggle__track::after {
    content: "";
    position: absolute;
    top: 4px;
    left: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
    transition: transform 180ms ease;
}

.toggle input:checked + .toggle__track {
    background: linear-gradient(180deg, var(--accent), var(--accent-strong));
}

.toggle input:checked + .toggle__track::after {
    transform: translateX(26px);
}

.toggle__text {
    font-weight: 700;
    color: var(--accent);
}

.intro-grid {
    display: grid;
    grid-template-columns: 1.15fr 1fr 1fr;
    gap: 18px;
}

.feature-card {
    min-height: 270px;
    padding: 26px;
    border-radius: var(--radius-xl);
    display: grid;
    align-content: space-between;
    gap: 24px;
}

.feature-card p,
.message-card p {
    color: var(--muted);
    line-height: 1.7;
}

.feature-card--primary {
    background:
        linear-gradient(155deg, rgba(23, 78, 71, 0.12), rgba(255, 255, 255, 0.8)),
        var(--paper);
}

.feature-card--image {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    color: #f6faf9;
    background:
        linear-gradient(180deg, rgba(11, 31, 29, 0.18), rgba(11, 31, 29, 0.72)),
        var(--card-image);
    background-size: cover;
    background-position: center;
}

.feature-card--image > * {
    position: relative;
    z-index: 2;
}

.feature-card--image .feature-card__link {
    position: relative;
    z-index: 3;
    background: rgba(248, 252, 250, 0.96);
    box-shadow: 0 10px 24px rgba(8, 24, 22, 0.22);
}

.feature-card--image::before,
.feature-card--image::after {
    content: "";
    position: absolute;
    inset: auto;
    pointer-events: none;
    z-index: 0;
    opacity: 1;
}

.feature-card--lexicos::before {
    inset: -8% auto auto -8%;
    width: 82%;
    height: 98%;
    background:
        radial-gradient(ellipse 18% 42% at 18% 28%, rgba(186, 240, 122, 0.56), transparent 58%),
        radial-gradient(ellipse 16% 40% at 36% 16%, rgba(84, 175, 92, 0.66), transparent 56%),
        radial-gradient(ellipse 20% 48% at 56% 30%, rgba(33, 125, 68, 0.72), transparent 60%),
        radial-gradient(ellipse 15% 38% at 72% 18%, rgba(205, 245, 154, 0.5), transparent 54%),
        radial-gradient(ellipse 14% 34% at 30% 62%, rgba(41, 128, 70, 0.6), transparent 58%),
        radial-gradient(ellipse 16% 40% at 54% 72%, rgba(154, 220, 106, 0.54), transparent 56%);
    filter: blur(0.4px);
    transform: rotate(-12deg);
}

.feature-card--lexicos::after {
    inset: auto -6% -12% auto;
    width: 72%;
    height: 92%;
    background:
        radial-gradient(ellipse 14% 36% at 18% 18%, rgba(217, 251, 165, 0.44), transparent 54%),
        radial-gradient(ellipse 18% 44% at 38% 34%, rgba(71, 161, 84, 0.62), transparent 58%),
        radial-gradient(ellipse 16% 40% at 58% 18%, rgba(24, 101, 54, 0.68), transparent 58%),
        radial-gradient(ellipse 18% 44% at 74% 42%, rgba(123, 198, 99, 0.56), transparent 58%),
        radial-gradient(ellipse 14% 36% at 44% 72%, rgba(47, 121, 66, 0.58), transparent 56%),
        radial-gradient(ellipse 18% 42% at 70% 84%, rgba(204, 244, 145, 0.42), transparent 52%);
    filter: blur(0.55px);
    transform: rotate(14deg);
}

.feature-card--comprendoria::before {
    inset: 6% auto auto 10%;
    width: 70%;
    height: 74%;
    background:
        radial-gradient(circle at 20% 26%, rgba(143, 216, 245, 0.46), transparent 18%),
        radial-gradient(circle at 52% 34%, rgba(111, 181, 236, 0.44), transparent 14%),
        radial-gradient(circle at 78% 20%, rgba(160, 232, 255, 0.4), transparent 16%),
        linear-gradient(110deg, transparent 0 18%, rgba(182, 245, 255, 0.3) 18% 21%, transparent 21% 40%, rgba(128, 203, 255, 0.24) 40% 43%, transparent 43% 100%);
    filter: blur(0.7px);
}

.feature-card--comprendoria::after {
    inset: auto 6% 10% auto;
    width: 54%;
    height: 44%;
    background:
        radial-gradient(circle at 18% 34%, rgba(201, 246, 255, 0.42), transparent 12%),
        radial-gradient(circle at 46% 40%, rgba(142, 213, 255, 0.34), transparent 10%),
        radial-gradient(circle at 74% 36%, rgba(106, 177, 231, 0.28), transparent 12%),
        linear-gradient(180deg, rgba(214, 247, 255, 0.28), rgba(142, 210, 240, 0.12));
    border-radius: 18px 18px 26px 26px;
    box-shadow:
        inset 0 0 0 1px rgba(220, 248, 255, 0.18),
        0 0 0 1px rgba(96, 162, 196, 0.08);
    filter: blur(0);
}

.feature-card--image p,
.feature-card--image .section-kicker {
    color: rgba(247, 255, 253, 0.9);
}

.results-grid {
    display: grid;
    gap: 0;
}

.species-card {
    border: 1px solid var(--line);
    border-radius: 0;
    padding: 22px;
    background: rgba(255, 255, 255, 0.84);
    box-shadow: 0 16px 34px rgba(15, 59, 54, 0.08);
}

.species-card__header {
    margin-bottom: 4px;
}

.species-card__meta,
.species-card__scientific,
.species-card__muted {
    margin: 0;
    color: var(--muted);
}

.search-highlight {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 0.15em;
    text-decoration-color: rgba(184, 92, 56, 0.92);
}

.species-card__meta {
    margin-bottom: 4px;
    font-size: 0.82rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.species-card__names {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    margin-bottom: 14px;
}

.species-card__copy-name,
.species-card__copy-scientific {
    display: inline-block;
    max-width: 100%;
    padding: 0;
    margin: 0;
    color: inherit;
    cursor: pointer;
    user-select: none;
    outline: none;
}

.species-card__copy-name:hover h3,
.species-card__copy-name:focus h3,
.species-card__copy-scientific:hover .species-card__scientific,
.species-card__copy-scientific:focus .species-card__scientific {
    color: var(--accent);
}

.species-card__copy-scientific {
    margin-top: 0;
}

.species-card h3 {
    margin: 0;
    font-family: "SabenciaDisplay", Georgia, serif;
    font-size: clamp(2.35rem, 3.75vw, 3.1rem);
    line-height: 0.95;
}

.species-card__scientific {
    margin-top: 0;
    font-size: 1rem;
    transition: color 0.18s ease;
}

.species-card__body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px minmax(0, 1fr);
    gap: 18px;
}

.species-card__column,
.species-card__media {
    padding: 18px;
    border-radius: var(--radius-lg);
    background: rgba(246, 250, 249, 0.78);
    border: 1px solid rgba(23, 78, 71, 0.08);
}

.species-card__column h4 {
    margin: 0 0 10px;
    font-size: 0.92rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
}

.species-card__column p {
    margin: 0 0 10px;
    line-height: 1.65;
}

.species-card__translations {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px dashed rgba(23, 78, 71, 0.18);
}

.species-card__translations p {
    font-size: 0.92rem;
}

.species-card__note {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed rgba(23, 78, 71, 0.18);
    color: var(--muted);
    line-height: 1.6;
}

.species-card__media {
    display: grid;
    gap: 14px;
    align-content: start;
    grid-column: 2;
}

.species-card__body > .species-card__column:first-child {
    grid-column: 1;
}

.species-card__body > .species-card__column:last-child {
    grid-column: 3;
}

.species-card__thumb {
    display: block;
    overflow: hidden;
    border-radius: 18px;
    aspect-ratio: 1 / 1;
    background: rgba(23, 78, 71, 0.06);
}

.species-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%) translateY(12px);
    padding: 12px 18px;
    border-radius: 999px;
    background: rgba(15, 59, 54, 0.96);
    color: #f7fbfa;
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease, transform 180ms ease;
    z-index: 30;
}

.toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

@media (max-width: 1180px) {
    .hero,
    .intro-grid,
    .species-card__body {
        grid-template-columns: 1fr;
    }

    .hero__panel {
        border-left: 0;
        border-top: 1px solid var(--line);
    }

    .search-form {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 820px) {
    .site-shell {
        width: 100%;
        margin-top: 10px;
    }

    .nav-links {
        flex-wrap: nowrap;
        gap: 4px;
        width: 100%;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .nav-links::-webkit-scrollbar {
        display: none;
    }

    .nav-links__item {
        flex: 0 0 auto;
        padding: 6px 8px;
        font-size: 0.72rem;
        line-height: 1.15;
        white-space: nowrap;
    }

    .search-form {
        grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) auto;
        gap: 10px;
        align-items: end;
    }

    .search-form > .field:first-child {
        grid-column: 1 / -1;
    }

    .search-form > .field:first-child .field__control {
        min-height: 48px;
    }

    .search-form > .field:not(:first-child),
    .search-form > .toggle-field,
    .search-form > .search-form__actions {
        min-width: 0;
    }

    .search-form .field__label {
        font-size: 0.72rem;
        line-height: 1.1;
    }

    .search-form > .field:not(:first-child) .field__control {
        min-height: 42px;
        padding: 8px 10px;
        font-size: 0.8rem;
    }

    .toggle-field {
        gap: 4px;
    }

    .toggle {
        min-height: 42px;
        gap: 8px;
        padding: 0;
    }

    .toggle__track {
        width: 46px;
        height: 26px;
    }

    .toggle__track::after {
        top: 3px;
        left: 3px;
        width: 18px;
        height: 18px;
    }

    .toggle input:checked + .toggle__track::after {
        transform: translateX(20px);
    }

    .toggle__text {
        font-size: 0.78rem;
        line-height: 1.1;
    }

    .search-form__actions {
        align-self: end;
    }

    .search-form__actions .submit-button {
        width: auto;
        min-height: 42px;
        padding: 8px 12px;
        font-size: 0.78rem;
        white-space: nowrap;
    }

    .masthead__bar,
    .hero__content,
    .hero__panel,
    .search-panel,
    .feature-card,
    .message-card,
    .species-card {
        padding-left: 18px;
        padding-right: 18px;
    }

    .search-panel__heading,
    .results-panel__heading,
    .species-card__header {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .hero h1 {
        max-width: none;
    }

    .intro-grid {
        display: none;
    }

    .results-panel {
        padding: 16px 0 0;
        border-left: 0;
        border-right: 0;
        border-radius: 0;
    }

    .results-panel__heading {
        padding: 0 14px 14px;
        margin-bottom: 0;
    }

    .results-panel__heading .section-kicker {
        display: none;
    }

    .results-panel h2 {
        font-size: 90%;
    }

    .species-card {
        width: 100%;
        padding: 14px;
        border-left: 0;
        border-right: 0;
        border-top: 0;
    }

    .species-card:first-child {
        border-top: 1px solid var(--line);
    }

    .species-card__header {
        margin-bottom: 8px;
        padding: 0;
    }

    .species-card__body {
        grid-template-columns: 92px minmax(0, 1fr);
        grid-template-areas:
            "lead lead"
            "media otros"
            "trans trans";
        gap: 0 10px;
    }

    .species-card__body > .species-card__column:first-child {
        display: contents;
    }

    .species-card__names {
        grid-area: lead;
        margin-bottom: 8px;
    }

    .species-card__translations {
        grid-area: trans;
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px dashed rgba(23, 78, 71, 0.18);
    }

    .species-card__media {
        grid-area: media;
        grid-column: auto;
        padding: 0;
        border: 0;
        background: transparent;
        align-self: start;
    }

    .species-card__thumb {
        border-radius: 10px;
        aspect-ratio: 1 / 1;
    }

    .species-card__body > .species-card__column:last-child {
        grid-area: otros;
        grid-column: auto;
        padding: 0;
        border: 0;
        background: transparent;
        align-self: start;
    }

    .species-card__column h4 {
        margin-bottom: 6px;
    }

    .species-card__column p {
        margin-bottom: 8px;
        line-height: 1.5;
    }

    .species-card__column p.is-placeholder {
        display: none;
    }

    .species-card__note {
        margin-top: 10px;
        padding-top: 10px;
    }

    .hero__button,
    .feature-card__link {
        width: 100%;
    }
}
