:root {
    --bg: #0b1220;
    --header1: #ffffffbb;
    --header2: #ffffff55;
    --surface: rgba(255, 255, 255, 0.06);
    --surface-2: rgba(255, 255, 255, 0.1);
    --text: #e8eef7;
    --muted: rgba(232, 238, 247, 0.7);
    --accent: #82c7ff;
    --accent-2: #ff99cc;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    --radius: 18px;
    --max: 1100px;
    --sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --bg-gradient: radial-gradient(circle at top, rgba(130, 199, 255, 0.17), transparent 55%),
        radial-gradient(circle at 20% 120%, rgba(255, 153, 204, 0.15), transparent 55%),
        linear-gradient(to bottom, var(--bg) 0%, #05080f 65%, #04060c 100%);
}

.theme-light {
    --bg: #fdfcff;
    --header1: #000000bb;
    --header2: #00000055;
    --surface: rgba(13, 17, 27, 0.08);
    --surface-2: rgba(13, 17, 27, 0.14);
    --text: #0b1220;
    --muted: rgba(11, 18, 32, 0.65);
    --accent: #2b6cff;
    --accent-2: #ff2fc7;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
    --bg-gradient: radial-gradient(circle at top, rgba(43, 108, 255, 0.1), transparent 55%),
        radial-gradient(circle at 20% 120%, rgba(255, 47, 199, 0.08), transparent 55%),
        linear-gradient(to bottom, var(--bg) 0%, #f0f4f8 65%, #e8ecf0 100%);
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: var(--sans);
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text);
    line-height: 1.5;
    transition: background 240ms ease, color 240ms ease;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover,
a:focus {
    text-decoration: underline;
}

header {
    padding: 3.5rem 1.5rem 2.75rem;
    text-align: center;
    position: relative;
}

header h1 {
    font-size: 3rem;
    margin: 0;
    letter-spacing: -0.02em;
    color: var(--header1);
}
header h2 {
    font-size: 1.4rem;
    margin: 0;
    letter-spacing: -0.02em;
    color: var(--header2);
}

header p {
    max-width: 760px;
    margin: 1.25rem auto 0;
    color: var(--muted);
    font-size: 1rem;
}

.header-inner {
    display: flex;
    gap: 1.25rem;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    max-width: 980px;
    margin: 0 auto;
}

.theme-toggle {
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    border-radius: 999px;
    padding: 0.65rem 0.85rem;
    font-size: 1.05rem;
    cursor: pointer;
    transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
    backdrop-filter: blur(10px);
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
}

.search-bar {
    max-width: 400px;
    margin: 0 auto 2rem;
}

.search-bar input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-family: var(--sans);
    font-size: 1rem;
    backdrop-filter: blur(10px);
    transition: border-color 200ms ease;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--accent);
}

.search-bar input::placeholder {
    color: var(--muted);
}

main {
    max-width: var(--max);
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
}

.filter-bar {
    margin-bottom: 2rem;
}

.tag-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.tag-button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--accent);
    background: transparent;
    color: var(--accent);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 200ms ease;
    font-family: var(--sans);
}

.tag-button:hover {
    background: rgba(130, 199, 255, 0.1);
}

.tag-button.active {
    background: var(--accent);
    color: var(--bg);
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 320px));
    gap: 1.4rem;
    justify-content:center;
}

.card {
    position: relative;
    padding: 1.75rem 1.5rem 1.5rem;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: var(--surface);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
    transition: transform 240ms ease, box-shadow 240ms ease, border-color 240ms ease;
    overflow: hidden;
}

.card::after {
    content: "";
    position: absolute;
    inset: -30px;
    background: radial-gradient(circle at top left, rgba(130, 199, 255, 0.25), transparent 60%),
        radial-gradient(circle at bottom right, rgba(255, 153, 204, 0.25), transparent 60%);
    opacity: 0;
    transition: opacity 240ms ease;
    pointer-events: none;
    border-radius: calc(var(--radius) + 30px);
}

.card:hover {
    transform: translateY(-6px);
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 24px 55px rgba(0, 0, 0, 0.45);
}

.card:hover::after {
    opacity: 1;
}

.card-preview {
    margin: -1.75rem -1.5rem 1.25rem;
    border-radius: calc(var(--radius) - 4px) calc(var(--radius) - 4px) 0 0;
    overflow: hidden;
    aspect-ratio: 16 / 9;
}

.card-preview img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(0.92) contrast(1.03);
    transition: transform 260ms ease, filter 260ms ease;
}

.card:hover .card-preview img {
    transform: scale(1.02);
    filter: saturate(1) contrast(1.08);
}

.card h2 {
    /* margin: 0 0 0.4rem; */
    margin: 0;
    font-size: 1.35rem;
}

.card small {
    font-size: 0.8rem;
    color: var(--accent);
}

.card p {
    margin: 1rem 0 2.1rem;
    color: var(--muted);
    font-size: 0.95rem;
}

.card button {
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--accent);
    background: none;
    border: 1px solid var(--accent);
    border-radius: 6px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: background 200ms ease, color 200ms ease;
    position: absolute;
    bottom: 10px;
    left: 20px;
}

.card button:hover {
    background: var(--accent);
    color: var(--bg);
}

.badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
    z-index: 10;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.75rem 0 0.75rem;
}

.tag {
    display: inline-block;
    background: var(--surface-2);
    color: var(--accent);
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid var(--accent);
    opacity: 0.85;
    transition: opacity 200ms ease, background 200ms ease;
}

.tag:hover {
    opacity: 1;
    background: rgba(130, 199, 255, 0.15);
}

footer {
    padding: 2.5rem 1.5rem 2.5rem;
    text-align: center;
    color: rgba(232, 238, 247, 0.6);
    font-size: 0.95rem;
}

footer a {
    color: var(--muted);
    text-decoration: underline;
}
footer p {
    color: var(--muted);
}

@media (max-width: 420px) {
    header p {
        font-size: 1rem;
    }

    .header-inner {
        flex-direction: column;
        gap: 0.75rem;
    }
}