:root {
    color-scheme: dark;

    --bg-deep: #0b0c10;
    --blue-digital: #2d6bff;
    --blue-light: #5b8cff;
    --blue-glow: rgba(45, 107, 255, 0.35);
    --text-primary: #f4f4f5;
    --text-muted: #9ca3af;
    --text-subtle: #6b7280;
    --surface: rgba(255, 255, 255, 0.04);
    --surface-hover: rgba(255, 255, 255, 0.07);
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(45, 107, 255, 0.45);
    --success: #34d399;
    --radius: 16px;
    --radius-sm: 10px;
    --font-display: "Instrument Serif", Georgia, "Times New Roman", serif;
    --font-ui: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --anim-in: 0.45s var(--ease-out) both;
    --anim-stagger: 24ms;
    --max-width: 1120px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: clip;
}

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: clip;
    background-color: var(--bg-deep);
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.05;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 180px 180px;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.55) 100%);
}

.bg-gradient {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 80% 60% at 20% 10%, rgba(45, 107, 255, 0.22) 0%, transparent 60%),
        radial-gradient(ellipse 70% 50% at 80% 20%, rgba(91, 140, 255, 0.14) 0%, transparent 55%),
        radial-gradient(ellipse 60% 70% at 50% 90%, rgba(45, 107, 255, 0.1) 0%, transparent 50%),
        var(--bg-deep);
    background-size: 120% 120%, 120% 120%, 120% 120%, 100% 100%;
    animation: drift 40s var(--ease-smooth) infinite alternate;
}

@keyframes drift {
    0% {
        background-position: 0% 0%, 100% 0%, 50% 100%, 0% 0%;
    }
    100% {
        background-position: 40% 30%, 60% 40%, 50% 70%, 0% 0%;
    }
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page {
    position: relative;
    z-index: 1;
    max-width: var(--max-width);
    width: 100%;
    margin: 0 auto;
    padding: 56px 24px 80px;
}

.hero {
    margin-bottom: 48px;
}

.hero__title {
    margin: 0 0 12px;
    font-family: var(--font-display);
    font-size: clamp(2.25rem, 5vw, 3.5rem);
    font-weight: 400;
    line-height: 1.1;
    letter-spacing: -0.02em;
    animation: fadeUp var(--anim-in);
}

.hero__subtitle {
    margin: 0 0 24px;
    max-width: 540px;
    color: var(--text-muted);
    font-size: 1.05rem;
    animation: fadeUp var(--anim-in);
    animation-delay: 0.04s;
    overflow-wrap: anywhere;
}

.hero__stats {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    animation: fadeUp var(--anim-in);
    animation-delay: 0.08s;
}

.hero__stat {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-muted);
    font-size: 0.875rem;
}

.hero__staging-link {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border: 1px solid var(--border-hover);
    border-radius: 999px;
    background: rgba(45, 107, 255, 0.12);
    color: var(--blue-light);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.hero__staging-link:hover {
    background: rgba(45, 107, 255, 0.2);
    color: #8fb4ff;
}

.hero__staging-link:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(45, 107, 255, 0.15);
}

.hero__stat strong {
    color: var(--blue-light);
    font-weight: 600;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
    animation: fadeUp var(--anim-in);
    animation-delay: 0.1s;
}

.search-wrap {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
}

.search-wrap svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-subtle);
    pointer-events: none;
}

.search-input {
    width: 100%;
    min-width: 0;
    padding: 12px 16px 12px 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input::placeholder {
    color: var(--text-subtle);
}

.search-input:focus {
    outline: none;
    border-color: var(--border-hover);
    box-shadow: 0 0 0 3px rgba(45, 107, 255, 0.15);
}

.search-input:focus-visible {
    outline: none;
    border-color: var(--border-hover);
    box-shadow: 0 0 0 3px rgba(45, 107, 255, 0.15);
}

.result-count {
    color: var(--text-subtle);
    font-size: 0.875rem;
    white-space: nowrap;
}

.toolbar__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    flex: 0 0 auto;
}

.sort-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.sort-control__label {
    color: var(--text-subtle);
    font-size: 0.875rem;
    white-space: nowrap;
}

.sort-select {
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 14px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    cursor: pointer;
    appearance: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.sort-select:focus,
.sort-select:focus-visible {
    outline: none;
    border-color: var(--border-hover);
    box-shadow: 0 0 0 3px rgba(45, 107, 255, 0.15);
}

.view-toggle {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    overflow: hidden;
}

.view-toggle__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text-subtle);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.view-toggle__btn + .view-toggle__btn {
    border-left: 1px solid var(--border);
}

.view-toggle__btn svg {
    width: 16px;
    height: 16px;
}

.view-toggle__btn:hover {
    color: var(--text-primary);
    background: var(--surface-hover);
}

.view-toggle__btn.is-active {
    color: var(--blue-light);
    background: rgba(45, 107, 255, 0.12);
}

.view-toggle__btn:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 2px rgba(45, 107, 255, 0.35);
}

.card-grid {
    width: 100%;
    min-width: 0;
}

.card-grid--list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card-grid--grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: 16px;
}

.feature-card {
    --i: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
    transition:
        transform 0.2s var(--ease-smooth),
        border-color 0.2s var(--ease-smooth),
        box-shadow 0.2s var(--ease-smooth),
        opacity 0.25s var(--ease-smooth),
        max-height 0.3s var(--ease-smooth),
        margin 0.3s var(--ease-smooth),
        padding 0.3s var(--ease-smooth);
    animation: cardIn var(--anim-in);
    animation-delay: calc(var(--i) * var(--anim-stagger) + 0.12s);
}

.feature-card.is-hidden {
    opacity: 0;
    transform: translateY(4px);
    max-height: 0;
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-width: 0;
    pointer-events: none;
    overflow: hidden;
}

.feature-card:hover,
.feature-card:focus-within {
    border-color: var(--border-hover);
    box-shadow: 0 4px 16px rgba(45, 107, 255, 0.2);
    transform: translateY(-2px);
}

.feature-card--pinned {
    border-color: rgba(45, 107, 255, 0.35);
    background: rgba(45, 107, 255, 0.08);
}

.card-grid--list .feature-card {
    flex-direction: row;
    align-items: stretch;
}

.card-grid--list .feature-card__link {
    flex: 1 1 auto;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    min-width: 0;
}

.card-grid--list .feature-card__header {
    margin-bottom: 0;
    flex: 0 0 auto;
    min-width: 140px;
    max-width: 220px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 12px;
    row-gap: 4px;
}

.card-grid--list .feature-card__title-group {
    display: contents;
}

.card-grid--list .feature-card__badge {
    grid-column: 1;
    grid-row: 1;
}

.card-grid--list .feature-card__slug {
    grid-column: 1;
    grid-row: 2;
    font-size: 0.9375rem;
}

.card-grid--list .feature-card__icon {
    grid-column: 2;
    grid-row: 2;
    align-self: center;
}

.card-grid--list .feature-card__header:not(:has(.feature-card__badge)) .feature-card__slug,
.card-grid--list .feature-card__header:not(:has(.feature-card__badge)) .feature-card__icon {
    grid-row: 1;
}

.card-grid--list .feature-card__url {
    flex: 1 1 auto;
    min-width: 0;
}

.card-grid--list .feature-card__footer {
    flex: 0 0 auto;
    align-self: center;
    gap: 16px;
    padding: 12px 16px 12px 0;
    border-top: 0;
}

.card-grid--list .feature-card__updated {
    flex: 0 1 auto;
    white-space: nowrap;
}

.feature-card__link {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    padding: 20px 20px 12px;
    color: inherit;
    text-decoration: none;
}

.feature-card__link:focus-visible {
    outline: none;
}

.feature-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    min-width: 0;
}

.feature-card__title-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.feature-card__badge {
    align-self: flex-start;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(45, 107, 255, 0.18);
    color: var(--blue-light);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.feature-card__slug {
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    overflow-wrap: anywhere;
}

.feature-card__icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    color: var(--text-subtle);
    transition: transform 0.2s var(--ease-smooth), color 0.2s var(--ease-smooth);
}

.feature-card:hover .feature-card__icon,
.feature-card:focus-within .feature-card__icon {
    color: var(--blue-light);
    transform: translate(2px, -2px);
}

.feature-card__url {
    color: var(--text-muted);
    font-size: 0.8125rem;
    overflow-wrap: anywhere;
    line-height: 1.4;
}

.feature-card__footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 20px 16px;
    border-top: 1px solid var(--border);
}

.feature-card__updated {
    flex: 1 1 auto;
    min-width: 0;
    color: var(--text-subtle);
    font-size: 0.8125rem;
    overflow-wrap: anywhere;
}

.copy-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.copy-btn:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
    background: var(--surface-hover);
}

.copy-btn:focus-visible {
    outline: none;
    border-color: var(--border-hover);
    box-shadow: 0 0 0 3px rgba(45, 107, 255, 0.15);
}

.copy-btn.is-copied {
    border-color: rgba(52, 211, 153, 0.4);
    color: var(--success);
}

.copy-btn svg {
    width: 14px;
    height: 14px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 64px 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    animation: fadeUp var(--anim-in);
    animation-delay: 0.12s;
}

.empty-state__orb {
    width: 80px;
    height: 80px;
    margin-bottom: 24px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, var(--blue-light), var(--blue-digital));
    opacity: 0.35;
    filter: blur(1px);
}

.empty-state__title {
    margin: 0 0 8px;
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 400;
}

.empty-state__text {
    margin: 0 0 20px;
    max-width: 360px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.empty-state[hidden],
.no-results[hidden] {
    display: none !important;
}

.no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 48px 32px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.no-results__title {
    margin: 0 0 8px;
    font-size: 1.125rem;
    font-weight: 600;
}

.no-results__text {
    margin: 0 0 20px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.btn-clear {
    padding: 10px 20px;
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--blue-light);
    font-family: inherit;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.btn-clear:hover {
    background: rgba(45, 107, 255, 0.1);
}

.btn-clear:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(45, 107, 255, 0.15);
}

.page-footer {
    margin-top: 64px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    text-align: center;
    animation: fadeUp var(--anim-in);
    animation-delay: 0.16s;
}

.page-footer a {
    color: var(--text-subtle);
    font-size: 0.8125rem;
    text-decoration: none;
    transition: color 0.2s;
}

.page-footer a:hover {
    color: var(--text-muted);
}

.page-footer a:focus-visible {
    outline: 2px solid var(--blue-digital);
    outline-offset: 4px;
    border-radius: 2px;
}

@media (max-width: 640px) {
    .page {
        padding: 32px 16px 56px;
    }

    .hero {
        margin-bottom: 32px;
    }

    .hero__title {
        font-size: clamp(1.875rem, 8vw, 2.5rem);
    }

    .hero__subtitle {
        font-size: 0.95rem;
        margin-bottom: 16px;
    }

    .hero__stats {
        flex-direction: column;
        align-items: stretch;
    }

    .hero__stat,
    .hero__staging-link {
        justify-content: center;
        text-align: center;
    }

    .card-grid--grid {
        grid-template-columns: 1fr;
    }

    .card-grid--list .feature-card {
        flex-direction: column;
    }

    .card-grid--list .feature-card__link {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 16px 16px 10px;
    }

    .card-grid--list .feature-card__header {
        min-width: 0;
        max-width: none;
    }

    .card-grid--list .feature-card__footer {
        align-self: stretch;
        flex-direction: column;
        padding: 12px 16px 16px;
        border-top: 1px solid var(--border);
    }

    .card-grid--list .feature-card__updated {
        white-space: normal;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 20px;
    }

    .toolbar__actions {
        justify-content: space-between;
        width: 100%;
    }

    .result-count {
        text-align: right;
    }

    .feature-card__link {
        padding: 16px 16px 10px;
    }

    .feature-card__footer {
        flex-direction: column;
        align-items: stretch;
        padding: 12px 16px 16px;
    }

    .copy-btn {
        justify-content: center;
        width: 100%;
    }

    .empty-state,
    .no-results {
        padding: 40px 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .bg-gradient {
        animation: none;
    }

    .hero__title,
    .hero__subtitle,
    .hero__stats,
    .toolbar,
    .feature-card,
    .empty-state,
    .page-footer {
        animation: none;
    }

    .feature-card {
        transition: border-color 0.2s, box-shadow 0.2s;
    }

    .feature-card:hover,
    .feature-card:focus-within {
        transform: none;
    }

    .feature-card.is-hidden {
        transition: opacity 0.15s;
    }
}
