:root {
    color-scheme: light;
    --gentoo-purple: #54487a;
    --gentoo-purple-light: #61538d;
    --gentoo-purple-light-2: #6e56af;
    --gentoo-purple-soft: #dddfff;
    --gentoo-grey: #dddaec;
    --body-background: #fafafa;
    --surface: #ffffff;
    --text: #252432;
    --muted: #5d5a6a;
    --card-border: #e4e2ec;
    --shadow: 0 4px 14px rgb(28 25 50 / 5%);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 0;
}

body {
    display: flex;
    min-height: 100vh;
    min-width: 0;
    margin: 0;
    flex-direction: column;
    color: var(--text);
    background: var(--body-background);
    font-family:
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    line-height: 1.5;
}

a {
    color: var(--gentoo-purple);
    font-weight: 650;
    text-decoration-color: rgb(84 72 122 / 40%);
    text-underline-offset: 0.2em;
}

a:hover {
    color: var(--gentoo-purple-light-2);
    text-decoration-color: currentColor;
}

a:focus-visible,
summary:focus-visible {
    border-radius: 0.2rem;
    outline: 3px solid rgb(110 86 175 / 45%);
    outline-offset: 3px;
}

.site-header {
    color: #f0eefc;
    background: #2a2440;
    border-bottom: 1px solid #40375d;
}

.header-content {
    display: grid;
    width: 100%;
    min-height: 5rem;
    padding: 0 1.5rem;
    grid-template-columns: minmax(15rem, 1fr) minmax(20rem, 50rem) minmax(15rem, 1fr);
    gap: 2rem;
    align-items: center;
}

.brand {
    display: inline-flex;
    width: fit-content;
    gap: 0.65rem;
    align-items: baseline;
    color: #f0eefc;
    font-family: ui-monospace, "Cascadia Code", "Source Code Pro", monospace;
    text-decoration: none;
}

.brand:hover {
    color: #f0eefc;
}

.brand-prompt {
    color: #b8a9f0;
    font-size: 1.25rem;
    font-weight: 500;
}

.brand-copy {
    display: grid;
    min-width: 0;
}

.brand-name {
    font-size: 1.45rem;
    font-weight: 650;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.brand-subtitle {
    margin-top: 0.35rem;
    color: #d8d2e9;
    font-size: 0.8rem;
    font-weight: 450;
    line-height: 1.35;
}

.search-form {
    min-width: 0;
}

.refresh-status {
    align-self: start;
    margin-top: 2.9rem;
    color: #d8d2e9;
    font-family: ui-monospace, "Cascadia Code", "Source Code Pro", monospace;
    font-size: 0.8rem;
    font-weight: 450;
    line-height: 1.35;
    text-align: right;
    white-space: nowrap;
}

input[type="search"] {
    width: 100%;
    min-height: 3.1rem;
    border: 1px solid transparent;
    border-radius: 0.9rem;
    padding: 0.7rem 1rem;
    color: #514776;
    background: #e8e4f7;
    font: inherit;
    font-size: 0.95rem;
}

input[type="search"]::placeholder {
    color: #756d91;
}

input[type="search"]:hover {
    background: #efedfa;
}

input[type="search"]:focus {
    border-color: #c8bcf2;
    outline: 3px solid #b8a9f0;
    outline-offset: 2px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    border: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.page {
    width: min(74rem, calc(100% - 6rem));
    margin: 0 auto;
    padding: clamp(2.25rem, 5vw, 4rem) 0;
    flex: 1;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

.results-header {
    margin-bottom: 1.4rem;
}

.results-header h1 {
    margin-bottom: 0;
    font-size: clamp(1.45rem, 3vw, 2rem);
    letter-spacing: -0.035em;
    line-height: 1.2;
}

.query-highlight {
    color: var(--gentoo-purple);
}

.result-count {
    margin: 0.35rem 0 0;
    color: var(--muted);
    font-size: 0.95rem;
    white-space: nowrap;
}

.result-list {
    display: grid;
    gap: 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.result-card {
    --metadata-label-width: 5.5rem;

    display: grid;
    min-width: 0;
    border: 1px solid var(--card-border);
    border-radius: 0.65rem;
    padding: 1.5rem;
    gap: 0.8rem;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.result-card-header {
    position: relative;
    min-width: 0;
    padding-right: 17rem;
}

.result-card h2 {
    margin-bottom: 0;
    color: var(--gentoo-purple);
    font-size: 1.35rem;
    letter-spacing: -0.025em;
    overflow-wrap: anywhere;
}

.result-card a {
    text-decoration: none;
}

.result-card-updated {
    margin: 0;
    text-align: right;
    color: var(--muted);
    font-size: 0.85rem;
}

.ebuild-metadata,
.ebuild-versions {
    min-width: 0;
}

.ebuild-description {
    max-width: 72ch;
    margin-bottom: 1rem;
    color: var(--text);
    overflow-wrap: anywhere;
}

.ebuild-metadata-empty {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.ebuild-metadata-list {
    display: grid;
    margin: 0;
    gap: 0.45rem;
}

.ebuild-metadata-list > div {
    display: grid;
    min-width: 0;
    grid-template-columns: var(--metadata-label-width) minmax(0, 1fr);
    gap: 0.75rem;
    align-items: baseline;
}

.ebuild-metadata-list dt {
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 700;
}

.ebuild-metadata-list dd {
    min-width: 0;
    margin: 0;
    font-size: 0.88rem;
    overflow-wrap: anywhere;
}

.metadata-values {
    display: flex;
    min-width: 0;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
    gap: 0.25rem 0.65rem;
    list-style: none;
}

.metadata-values > li {
    min-width: 0;
}

.token-list > li {
    color: #464253;
    font-family: ui-monospace, "Cascadia Code", "Source Code Pro", monospace;
    font-size: 0.84rem;
}

.ebuild-versions {
    display: grid;
    grid-template-columns: var(--metadata-label-width) minmax(0, 1fr);
    gap: 0.75rem;
    align-items: start;
}

.ebuild-versions h3 {
    margin: 0;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1.45;
}

.ebuild-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ebuild-list > li {
    border: 1px solid var(--gentoo-grey);
    border-radius: 0.3rem;
    padding: 0.18rem 0.58rem;
    color: var(--gentoo-purple);
    background: var(--gentoo-purple-soft);
    font-size: 0.84rem;
    font-variant-numeric: tabular-nums;
    line-height: 1.45;
}

.ebuild-list > .ebuild-overflow,
.ebuild-overflow > details {
    display: contents;
}

.ebuild-overflow summary {
    border: 1px dashed var(--gentoo-grey);
    border-radius: 0.3rem;
    padding: 0.18rem 0.58rem;
    color: var(--gentoo-purple-light);
    background: var(--surface);
    cursor: pointer;
    user-select: none;
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1.45;
    list-style-position: inside;
}

.ebuild-overflow-list {
    flex: 0 0 100%;
}

.repo-metadata {
    display: grid;
    position: absolute;
    top: 0;
    right: 0;
    min-width: 0;
    margin: 0;
    grid-template-columns: 14rem 1.4rem;
    gap: 0.45rem;
    align-items: center;
}

.repo-name {
    min-width: 0;
    grid-column: 1;
    grid-row: 1;
    text-align: right;
}

.repo-contact {
    min-width: 0;
    grid-column: 1;
    grid-row: 2;
    text-align: right;
}

.repo-name dd,
.repo-contact dd,
.repo-indicator dd {
    margin: 0;
}

.repo-name dd {
    color: #464253;
    font-size: 0.95rem;
    font-weight: 650;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.repo-contact dd,
.repo-contact a {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.repo-indicator {
    grid-column: 2;
    grid-row: 1;
}

.repo-indicator,
.repo-indicator-value {
    position: relative;
}

.repo-indicator-value {
    display: grid;
    place-items: center;
}

.repo-icon {
    display: inline-grid;
    width: 1.5rem;
    height: 1.5rem;
    place-items: center;
}

.repo-icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.pagination {
    display: flex;
    margin-top: 1.6rem;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
    justify-content: center;
}

.pagination a,
.pagination-current {
    display: inline-flex;
    min-width: 2.55rem;
    min-height: 2.55rem;
    border: 1px solid var(--gentoo-grey);
    border-radius: 0.4rem;
    padding: 0.5rem 0.75rem;
    align-items: center;
    justify-content: center;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.pagination a {
    color: var(--text);
    background: var(--surface);
    box-shadow: var(--shadow);
    text-decoration: none;
}

.pagination a:hover {
    border-color: var(--gentoo-purple-light-2);
    color: var(--gentoo-purple-light);
}

.pagination-current {
    border-color: var(--gentoo-purple);
    color: #ffffff;
    background: var(--gentoo-purple);
    box-shadow: var(--shadow);
}

.pagination-ellipsis {
    display: inline-flex;
    min-width: 2rem;
    min-height: 2.55rem;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 0.85rem;
}

.empty-state {
    border: 1px solid var(--gentoo-grey);
    border-radius: 0.55rem;
    padding: 1.2rem 1.35rem;
    color: var(--muted);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.site-footer {
    width: min(74rem, calc(100% - 6rem));
    margin: 0 auto;
    padding: 1.2rem 0 1.6rem;
    border-top: 1px solid var(--gentoo-grey);
    color: var(--muted);
    font-size: 0.84rem;
    text-align: center;
}

.site-footer p {
    margin-bottom: 0;
}

@media (max-width: 64rem) {
    .page,
    .site-footer {
        width: min(74rem, calc(100% - 3rem));
    }
}

@media (max-width: 60rem) {
    .header-content {
        width: 100%;
        min-height: 0;
        padding: 1.25rem 1.5rem;
        grid-template-columns: 1fr;
        gap: 1.1rem;
    }

    .search-form {
        width: 100%;
    }

    .refresh-status {
        align-self: start;
        margin-top: 0;
        text-align: center;
    }

    .result-card-header {
        padding-right: 0;
    }

    .repo-metadata {
        position: static;
        width: fit-content;
        margin-top: 0.4rem;
        grid-template-columns: minmax(12rem, 14rem) 1.4rem;
    }
}

@media (max-width: 34rem) {
    .header-content {
        width: 100%;
        padding-inline: 1rem;
    }

    .page,
    .site-footer {
        width: min(100% - 2rem, 78rem);
    }

    .result-count {
        white-space: normal;
    }

    .result-card {
        --metadata-label-width: 5rem;

        padding: 1.1rem;
    }
}
