/*
 * style.css - Browser-facing index for the independent Termux pacman repository.
 *
 * Visual language adapted from Creationsss/void-repository (see
 * https://void.creations.works/): GitHub-inspired light/dark palette,
 * monospace command blocks, accent blue, single column with generous
 * whitespace. Extended with badges, an info <dl>, a counts table, and a
 * copy-to-clipboard button for the pacman.conf snippet.
 *
 * Dark mode is driven by prefers-color-scheme so the page adapts without
 * any user toggle. Mobile viewport handled via the existing
 * <meta name="viewport"> in index.html + the responsive rules below.
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica,
        Arial, sans-serif;
    line-height: 1.6;
    color: #24292f;
    background: #fff;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

/* ----------------------------------------------------------------- header */
.header {
    margin-bottom: 2rem;
}

.header h1 {
    font-size: 1.6rem;
    font-weight: 600;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid #d0d7de;
    margin-bottom: 0.4rem;
}

.subtitle {
    color: #656d76;
    font-size: 0.95rem;
    margin-bottom: 0.8rem;
}

.badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #1f2328;
    background: #ddf4ff;
    border: 1px solid #54aeff;
    border-radius: 999px;
    text-transform: lowercase;
    letter-spacing: 0.02em;
}

/* --------------------------------------------------------------- sections */
.section {
    margin-bottom: 2rem;
}

h2 {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #656d76;
    margin-bottom: 0.6rem;
}

/* ----------------------------------------------------- command + copy ui */
.cmd-label {
    display: block;
    font-size: 0.85rem;
    color: #656d76;
    margin-bottom: 0.2rem;
    margin-top: 0.8rem;
}

.cmd {
    display: block;
    font-family: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas,
        "Liberation Mono", monospace;
    font-size: 0.85rem;
    background: #f6f8fa;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    padding: 0.6rem 0.75rem;
    margin: 0.2rem 0 0.5rem;
    overflow-x: auto;
    white-space: pre;
    word-break: normal;
}

pre.cmd {
    position: relative;
}

.copy-btn {
    font: inherit;
    font-size: 0.75rem;
    padding: 0.18rem 0.55rem;
    background: #fff;
    color: #24292f;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.copy-btn:hover {
    background: #f6f8fa;
    border-color: #0969da;
}

.copy-btn.copied {
    background: #dafbe1;
    border-color: #1a7f37;
    color: #1a7f37;
}

/* --------------------------------------------------------- info dl */
.info-list {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.3rem 1rem;
    font-size: 0.9rem;
}

.info-list dt {
    color: #656d76;
    font-weight: 600;
}

.info-list dd {
    color: #24292f;
    word-break: break-word;
}

.info-list dd code {
    font-family: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas,
        monospace;
    font-size: 0.85rem;
    background: #f6f8fa;
    border: 1px solid #d0d7de;
    border-radius: 4px;
    padding: 0.05rem 0.3rem;
}

/* ----------------------------------------------------- package counts */
.counts {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.counts th,
.counts td {
    text-align: left;
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid #d0d7de;
}

.counts th {
    color: #656d76;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.counts td code {
    font-family: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas,
        monospace;
    font-size: 0.85rem;
}

/* --------------------------------------------------------- packages list */
#search {
    display: block;
    font-family: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas,
        monospace;
    font-size: 0.85rem;
    padding: 0.5rem 0.7rem;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    background: #f6f8fa;
    color: inherit;
    outline: none;
    width: 100%;
    margin-bottom: 0.8rem;
    -webkit-appearance: none;
    appearance: none;
}

#search:focus {
    border-color: #0969da;
    box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.18);
}

.pkglist {
    font-family: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas,
        monospace;
    font-size: 0.85rem;
    line-height: 1.8;
    overflow-x: auto;
}

.pkg {
    display: block;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    padding: 0.1rem 0;
}

.pkg.hidden {
    display: none;
}

.pkg-name {
    color: #24292f;
    font-weight: 600;
}

.pkg-version {
    color: #656d76;
    margin-left: 0.4rem;
    font-size: 0.85em;
}

.pkg-desc {
    color: #656d76;
    margin-left: 0.5rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* --------------------------------------------------------- links */
a {
    color: #0969da;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.source {
    font-size: 0.85rem;
    color: #656d76;
}

/* --------------------------------------------------------- footer */
.footer {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid #d0d7de;
    text-align: center;
}

/* --------------------------------------------------------- responsive */
@media (max-width: 640px) {
    .container {
        padding: 2rem 1rem;
    }
    .header h1 {
        font-size: 1.3rem;
    }
    .info-list {
        grid-template-columns: 1fr;
        gap: 0;
    }
    .info-list dt {
        margin-top: 0.5rem;
    }
    .info-list dd {
        margin-bottom: 0.2rem;
    }
    .counts {
        font-size: 0.85rem;
    }
    #search {
        font-size: 16px; /* avoids iOS zoom on focus */
    }
}

/* --------------------------------------------------------- dark mode */
@media (prefers-color-scheme: dark) {
    body {
        color: #c9d1d9;
        background: #0d1117;
    }
    .header h1 {
        border-bottom-color: #30363d;
    }
    .subtitle,
    h2,
    .cmd-label,
    .source,
    .pkg-version,
    .pkg-desc,
    .info-list dt {
        color: #8b949e;
    }
    .cmd,
    #search {
        background: #161b22;
        border-color: #30363d;
        color: #c9d1d9;
    }
    #search:focus {
        border-color: #58a6ff;
        box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.18);
    }
    .badge {
        color: #c9d1d9;
        background: rgba(56, 139, 253, 0.18);
        border-color: rgba(56, 139, 253, 0.6);
    }
    .counts th,
    .counts td,
    .footer {
        border-color: #30363d;
    }
    .copy-btn {
        background: #161b22;
        color: #c9d1d9;
        border-color: #30363d;
    }
    .copy-btn:hover {
        background: #21262d;
        border-color: #58a6ff;
    }
    .copy-btn.copied {
        background: rgba(46, 160, 67, 0.18);
        border-color: #2ea043;
        color: #3fb950;
    }
    .pkg-name {
        color: #c9d1d9;
    }
    .info-list dd code {
        background: #161b22;
        border-color: #30363d;
    }
    a {
        color: #58a6ff;
    }
}

/* --------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
    .copy-btn {
        transition: none;
    }
}
