.state--ready { width: min(1040px, 100%); }

#output {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.icon {
    flex: none;
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.icon .fill { fill: currentColor; stroke: none; }

.toolbar {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    min-height: 40px;
    margin-bottom: -16px;
}
.viewing {
    margin: 0 auto 0 0;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 10px;
    color: var(--muted);
    font-size: 0.9rem;
}
.viewing strong {
    color: var(--text);
    font-weight: 600;
    overflow-wrap: anywhere;
}
.viewing a {
    color: var(--accent);
    font-size: 0.85rem;
    text-decoration: none;
}
.viewing a::before { content: "← "; }
.viewing a:hover { text-decoration: underline; }

.search {
    --size: 40px;
    flex: none;
    display: flex;
    align-items: center;
    height: var(--size);
    border: 1px solid transparent;
    border-radius: 999px;
    transition: border-color .25s ease, background-color .25s ease, box-shadow .25s ease;
}
.search input {
    width: 0;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 0.9rem;
    outline: none;
    opacity: 0;
    transition: width .3s ease, padding .3s ease, opacity .2s ease;
}
.search-toggle {
    flex: none;
    display: grid;
    place-items: center;
    width: calc(var(--size) - 2px);
    height: calc(var(--size) - 2px);
    border-radius: 50%;
    color: var(--muted);
    cursor: pointer;
    transition: color .2s ease;
}
.search-toggle svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}
.search-toggle:hover { color: var(--text); }

.search:hover,
.search:focus-within {
    background: var(--surface);
    border-color: var(--border);
    box-shadow: 0 4px 14px -6px rgb(0 0 0 / 0.15);
}
.search:focus-within { border-color: var(--accent); }
.search:hover input,
.search:focus-within input {
    width: min(220px, 60vw);
    padding: 0 4px 0 16px;
    opacity: 1;
}
.search:focus-within .search-toggle { color: var(--accent); }

.search-message {
    margin: 0;
    color: var(--muted);
    text-align: center;
}

.profile {
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 8px 0;
}
.profile-avatar {
    flex: none;
    width: 112px;
    height: 112px;
    padding: 4px;
    border-radius: 50%;
    object-fit: cover;
    background: conic-gradient(from 200deg, var(--accent), var(--accent-2), var(--accent-3), var(--accent));
    box-shadow: 0 14px 36px -14px color-mix(in srgb, var(--accent) 70%, transparent);
}
.profile-avatar--initial {
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    font-size: 2.6rem;
    font-weight: 700;
}
.profile-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.profile h1 {
    margin: 0;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 750;
    line-height: 1.1;
    letter-spacing: -0.03em;
    overflow-wrap: anywhere;
    background: linear-gradient(90deg, var(--text) 30%, var(--accent) 75%, var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.profile-handle {
    margin: -4px 0 0;
    color: var(--muted);
    font-size: 0.95rem;
}
.profile-bio {
    margin: 0;
    max-width: 60ch;
    font-size: 1.05rem;
}
.profile-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 18px;
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--muted);
    font-size: 0.9rem;
}
.profile-facts li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.profile-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}
.profile-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: border-color .15s ease, transform .15s ease;
}
.profile-link .icon { color: var(--accent); }
.profile-link--primary .icon { color: inherit; }
.profile-link:hover {
    border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
    transform: translateY(-1px);
}
.profile-link--primary {
    border-color: transparent;
    background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--accent-2)));
    box-shadow: 0 6px 16px -8px var(--accent);
    color: #fff;
}
.profile-link--primary:hover { border-color: transparent; filter: brightness(1.08); }
button.profile-link {
    position: relative;
    font-family: inherit;
    cursor: pointer;
}
button.profile-link[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 10px;
    border-radius: 6px;
    background: var(--text);
    color: var(--surface);
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
}
.profile-link:focus-visible {
    outline: 3px solid var(--accent-2);
    outline-offset: 2px;
}

@media (max-width: 560px) {
    .profile {
        flex-direction: column;
        text-align: center;
        gap: 18px;
    }
    .profile-text { align-items: center; }
    .profile-facts, .profile-links { justify-content: center; }
}

.projects {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.section-title::before {
    content: "";
    width: 18px;
    height: 3px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.repos {
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.repos--featured { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.repo {
    --repo: hsl(var(--hue, 245) 72% 58%);
    --repo-2: hsl(calc(var(--hue, 245) + 40) 75% 60%);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px;
    --wash: 14%;
    background:
        radial-gradient(130% 90% at 100% 0%, color-mix(in srgb, var(--repo-2) var(--wash), transparent), transparent 65%),
        linear-gradient(160deg, color-mix(in srgb, var(--repo) calc(var(--wash) / 2), var(--surface)), var(--surface) 70%);
    border: 1px solid color-mix(in srgb, var(--repo) 18%, var(--border));
    border-radius: var(--radius);
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.04);
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.repo::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: linear-gradient(90deg, var(--repo), var(--repo-2));
    opacity: 0.55;
    transition: opacity .2s ease;
}
.repo:hover {
    transform: translateY(-3px);
    border-color: color-mix(in srgb, var(--repo) 45%, var(--border));
    box-shadow: 0 14px 30px -10px color-mix(in srgb, var(--repo) 40%, transparent);
}
.repo:hover::before { opacity: 1; }
.repo:has(.repo-title:focus-visible) {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}

.repo--featured {
    padding: 24px;
    gap: 16px;
    --wash: 22%;
    box-shadow: 0 10px 26px -14px color-mix(in srgb, var(--repo) 45%, transparent);
}
.repo--featured::before { opacity: 1; }
.repo--featured .repo-avatar { width: 46px; height: 46px; font-size: 1.25rem; }
.repo--featured h3 { font-size: 1.2rem; }
.repo--featured .repo-desc { font-size: 0.95rem; }

.repo-head {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.repo-avatar {
    flex: none;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--repo), var(--repo-2));
    box-shadow: 0 6px 14px -6px color-mix(in srgb, var(--repo) 70%, transparent);
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
}
.repo h3 {
    margin: 0;
    min-width: 0;
    font-size: 1.05rem;
    font-weight: 650;
    letter-spacing: -0.01em;
    overflow-wrap: anywhere;
}

/* whole card is clickable */
.repo-title {
    color: inherit;
    text-decoration: none;
    outline: none;
}
.repo-title::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
}
.repo-link, .badge { position: relative; z-index: 2; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
    padding: 1px 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0;
    vertical-align: 2px;
    white-space: nowrap;
}
.badge .icon { width: 12px; height: 12px; margin-left: -2px; }

.repo-desc {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
}

.topics {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.topics li {
    padding: 2px 9px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--repo) 13%, transparent);
    color: color-mix(in srgb, var(--repo) 75%, var(--text));
    font-size: 0.75rem;
    font-weight: 500;
}

.lang-bar {
    display: flex;
    gap: 2px;
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    background: var(--border);
}
.lang-bar span {
    width: var(--w);
    min-width: 4px;
    background: var(--c);
}

.lang-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin: -6px 0 0;
    padding: 0;
    list-style: none;
    font-size: 0.8rem;
}
.lang-legend li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.lang-legend li::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--c);
}
.lang-legend li span { color: var(--muted); }

.repo-foot {
    margin-top: auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.repo-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    color: var(--muted);
    font-size: 0.8rem;
}
.repo-meta span:has(.icon) .icon { color: var(--repo); }
.repo-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.repo-link {
    max-width: 100%;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--repo) 13%, transparent);
    color: color-mix(in srgb, var(--repo) 75%, var(--text));
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: background .15s ease;
}
.repo-link span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.repo-link:hover { background: color-mix(in srgb, var(--repo) 22%, transparent); }
.repo-link:focus-visible {
    outline: 3px solid var(--accent-2);
    outline-offset: 2px;
}

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

@media (prefers-reduced-motion: reduce) {
    .repo, .repo::before, .search, .search input, .profile-link { transition: none; }
    .repo:hover, .profile-link:hover { transform: none; }
}
