/* reporecon - shares gitwho's palette so the two tools feel like siblings. Accent is Grinx yellow. */

:root[data-theme="dark"] {
    --bg: #0d1117;
    --bg-2: #161b22;
    --bg-3: #21262d;
    --bg-hover: #30363d;
    --text: #e6edf3;
    --text-2: #8b949e;
    --muted: #6e7681;
    --accent: #f5c518;
    --accent-fill: #f5c518;
    --on-accent: #0d1117;
    --green: #3fb950;
    --yellow: #d29922;
    --red: #f85149;
    --purple: #bc8cff;
    --border: #30363d;
    --shadow: rgba(0, 0, 0, 0.3);
}

:root[data-theme="light"] {
    --bg: #ffffff;
    --bg-2: #f6f8fa;
    --bg-3: #eaeef2;
    --bg-hover: #d0d7de;
    --text: #1f2328;
    --text-2: #656d76;
    --muted: #8b949e;
    --accent: #8a6a00;
    --accent-fill: #f5c518;
    --on-accent: #1f2328;
    --green: #1a7f37;
    --yellow: #9a6700;
    --red: #cf222e;
    --purple: #8250df;
    --border: #d0d7de;
    --shadow: rgba(0, 0, 0, 0.08);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85em; }
.muted { color: var(--text-2); font-size: 0.85rem; }
.accent { color: var(--accent); }
[hidden] { display: none !important; }

button {
    font: inherit;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--accent-fill);
    color: var(--on-accent);
    border-radius: 6px;
    padding: 0 16px;
    font-weight: 600;
}
button.ghost { background: transparent; color: var(--text); }
button:hover { filter: brightness(1.1); }

input[type="text"], input[type="password"] {
    font: inherit;
    background: var(--bg-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 12px;
    min-width: 0;
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* Top bar */
.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-2);
    position: sticky;
    top: 0;
    z-index: 10;
}
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1rem; color: var(--text); }
.logo:hover { text-decoration: none; }
.top-form { display: flex; gap: 8px; flex: 1; max-width: 520px; }
.top-form input { flex: 1; padding: 6px 10px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.rate { font-size: 0.8rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.rate.low { color: var(--red); }
.icon-btn {
    background: transparent;
    color: var(--text-2);
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 1rem;
}
.icon-btn:hover { background: var(--bg-3); color: var(--text); }

/* Settings */
.settings {
    max-width: 720px;
    margin: 16px auto 0;
    padding: 16px 20px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-2);
    width: calc(100% - 32px);
}
.settings h2 { font-size: 1rem; margin-bottom: 6px; }
.settings p { font-size: 0.875rem; color: var(--text-2); margin-bottom: 10px; }
.token-form { display: flex; gap: 8px; }
.token-form input { flex: 1; }

/* Landing */
.landing {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12vh 16px 48px;
    text-align: center;
}
.hero { display: inline-flex; align-items: center; gap: 14px; font-size: clamp(2.6rem, 7vw, 3.6rem); font-weight: 800; letter-spacing: -0.02em; }
.tagline { color: var(--text-2); margin: 4px 0 28px; }
.hero-form { display: flex; gap: 8px; width: 100%; max-width: 560px; }
.hero-form input { flex: 1; padding: 12px 16px; font-size: 1rem; }
.hero-form button { padding: 0 22px; }
.examples { margin-top: 14px; font-size: 0.875rem; color: var(--text-2); }
.examples a { margin-left: 10px; }
.error { color: var(--red); margin-top: 12px; font-size: 0.9rem; }

.bookmarklet-box {
    margin-top: 56px;
    max-width: 560px;
    padding: 20px;
    border: 1px dashed var(--border);
    border-radius: 8px;
}
.bookmarklet-box h2 { font-size: 1rem; margin-bottom: 4px; }
.bookmarklet-box p { font-size: 0.875rem; color: var(--text-2); margin-bottom: 14px; }
.bookmarklet {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 999px;
    background: var(--bg-3);
    border: 1px solid var(--border);
    color: var(--text);
    font-weight: 600;
    cursor: grab;
}
.bookmarklet:hover { text-decoration: none; border-color: var(--accent); }

/* Results */
.results { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: 24px; }
.status {
    padding: 12px 16px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-2);
    margin-bottom: 20px;
    font-size: 0.9rem;
}
.status.error { border-color: var(--red); color: var(--text); }
.status .spinner {
    display: inline-block;
    width: 12px; height: 12px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: -1px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.repo-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 28px; }
.repo-head img { width: 56px; height: 56px; border-radius: 8px; border: 1px solid var(--border); flex-shrink: 0; background: #fff; }
.repo-head h1 { font-size: 1.5rem; font-weight: 600; word-break: break-word; }
.repo-head h1 .owner { font-weight: 400; color: var(--text-2); }
.repo-head .desc { color: var(--text-2); margin-top: 2px; }
.repo-head .meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 0.85rem; color: var(--text-2); }
.repo-head .meta strong { color: var(--text); font-variant-numeric: tabular-nums; }

.flag {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: 999px;
    border: 1px solid currentColor;
    margin-left: 6px;
    vertical-align: 3px;
}
.flag.warn { color: var(--yellow); }
.flag.bad { color: var(--red); }
.flag.info { color: var(--purple); }

.topics { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.topic {
    font-size: 0.75rem;
    padding: 2px 10px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 15%, transparent);
    color: var(--accent);
}

.block { margin-bottom: 28px; }
.block-title { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.block-title h2 { font-size: 1.1rem; }

.lenses { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.lens-group h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-2);
    margin-bottom: 8px;
}
.lens {
    display: block;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-2);
    margin-bottom: 6px;
    color: var(--text);
}
.lens:hover { text-decoration: none; border-color: var(--accent); background: var(--bg-3); }
.lens .name { font-weight: 600; font-size: 0.9rem; }
.lens .name::after { content: " ↗"; color: var(--muted); font-weight: 400; }
.lens .what { display: block; font-size: 0.78rem; color: var(--text-2); }

/* Masonry-ish: cards of uneven height pack into columns instead of stretching rows */
.stack { columns: 3 340px; column-gap: 16px; }
.stack .card { break-inside: avoid; }
.card {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-2);
    padding: 16px;
    min-width: 0;
    margin-bottom: 16px;
    display: block;
}
.card h3 { font-size: 0.95rem; margin-bottom: 12px; }
.card .body { font-size: 0.875rem; }
.card .note { color: var(--text-2); font-size: 0.8rem; margin-top: 10px; }
.card .loading { color: var(--muted); }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; }
.facts dt { color: var(--text-2); }
.facts dd { min-width: 0; overflow-wrap: anywhere; }

/* Languages */
.lang-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--bg-3); margin-bottom: 12px; gap: 2px; }
.lang-bar span { height: 100%; }
.lang-list { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; }
.lang-list li { display: flex; align-items: center; gap: 6px; min-width: 0; }
.lang-list .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.lang-list .pct { color: var(--text-2); margin-left: auto; font-variant-numeric: tabular-nums; }

/* Scorecard */
.score-top { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.score-big { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.checks { list-style: none; }
.checks li { display: flex; align-items: center; gap: 10px; padding: 3px 0; border-bottom: 1px solid var(--border); }
.checks li:last-child { border-bottom: 0; }
.chip {
    min-width: 34px;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 4px;
    padding: 1px 6px;
    font-variant-numeric: tabular-nums;
    color: #fff;
}
.chip.bad { background: var(--red); }
.chip.mid { background: var(--yellow); }
.chip.good { background: var(--green); }
.chip.na { background: var(--bg-hover); color: var(--text-2); }
.checks details { flex: 1; min-width: 0; }
.checks summary { cursor: pointer; }
.checks .reason { color: var(--text-2); font-size: 0.8rem; margin: 2px 0 4px; }

/* People */
.people { list-style: none; }
.people li { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.people img { width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; }
.people .login { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people .count { margin-left: auto; color: var(--text-2); font-variant-numeric: tabular-nums; }
.people .who { font-size: 0.75rem; }
.share-bar { height: 6px; border-radius: 3px; background: var(--bg-3); overflow: hidden; margin: 6px 0 12px; }
.share-bar span { display: block; height: 100%; background: var(--accent); }

/* Surface */
.surface { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.surface h4 { font-size: 0.85rem; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.surface h4 .n { font-size: 0.75rem; color: var(--text-2); font-weight: 400; }
.surface h4.danger { color: var(--red); }
.surface ul { list-style: none; }
.surface li { padding: 1px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.surface details summary { cursor: pointer; color: var(--text-2); font-size: 0.8rem; padding-top: 2px; }
.surface .empty { color: var(--muted); font-size: 0.8rem; }
.tree-top { margin-bottom: 14px; color: var(--text-2); }
.tree-top code { color: var(--text); background: var(--bg-3); padding: 1px 6px; border-radius: 4px; margin: 0 4px 4px 0; display: inline-block; }

/* Commits & releases */
.rows { list-style: none; }
.rows li { padding: 6px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.rows li:last-child { border-bottom: 0; }
.rows .line1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows .line2 { color: var(--text-2); font-size: 0.78rem; }
.rows .line2 a { color: var(--text-2); text-decoration: underline; }

/* Dorks */
.dorks { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 16px; }
.dorks a { display: flex; gap: 8px; align-items: baseline; padding: 3px 0; color: var(--text); }
.dorks a code { color: var(--accent); }
.dorks a:hover code { text-decoration: underline; }
.dorks .kind { font-size: 0.7rem; color: var(--text-2); flex-shrink: 0; width: 52px; }

.footer {
    padding: 20px 24px;
    text-align: center;
    color: var(--muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
}
.footer .sep { margin: 0 8px; }

@media (max-width: 640px) {
    .topbar { padding: 10px 16px; gap: 10px; flex-wrap: wrap; }
    .top-form { order: 3; flex-basis: 100%; max-width: none; }
    .results { padding: 16px; }
    .hero-form { flex-direction: column; }
    .hero-form button { padding: 10px; }
    .repo-head img { width: 44px; height: 44px; }
    .lang-list { grid-template-columns: 1fr; }
}

/* The avatar stands in for the "o" in recon, sized to the lowercase letters. */
.logo .o, .hero .o { display: inline-block; width: 0.66em; height: 0.66em; border-radius: 50%; vertical-align: -0.05em; margin: 0 0.03em; }

/* Grinx companion, docked bottom right. app.js swaps his face and line as the recon runs. */
.footer { padding-bottom: 120px; }
.buddy {
    position: fixed;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 30;
    display: flex;
    align-items: flex-end;
    gap: 10px;
}
.buddy .say {
    background: var(--bg-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 12px 12px 2px 12px;
    padding: 10px 12px;
    font-size: 0.88rem;
    max-width: 250px;
    box-shadow: 0 6px 20px var(--shadow);
    transition: opacity 0.2s, transform 0.2s;
}
.buddy .say.gone { opacity: 0; transform: translateY(6px); pointer-events: none; }
.buddy .face {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--accent-fill);
    background: #0c0d0f;
    padding: 0;
    box-shadow: 0 6px 20px var(--shadow);
    transition: transform 0.2s;
}
.buddy .face:hover { transform: rotate(-8deg) scale(1.05); filter: none; }
.buddy .face img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; transform: scale(1.15); }
.buddy.bob .face { animation: bob 1s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(4deg); } }
@media (max-width: 560px) {
    .buddy .face { width: 60px; height: 60px; }
    .buddy .say { max-width: 190px; font-size: 0.8rem; }
}
@media (prefers-reduced-motion: reduce) {
    .buddy .face, .buddy .say { animation: none !important; transition: none !important; }
}
