* {
    box-sizing: border-box;
}

:root {
    --primary: #e60023;
    --text: #1f1f1f;
    --muted: #767676;
    --background: #ffffff;
    --soft: #f5f5f5;
    --border: #e5e5e5;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 22px;
    min-height: 76px;
    padding: 12px 28px;
    background: rgba(255,255,255,.97);
    border-bottom: 1px solid #eee;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 225px;
    font-weight: 800;
    font-size: 18px;
}

.logo-mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-weight: 900;
    font-size: 22px;
}

.search {
    display: flex;
    align-items: center;
    flex: 1;
    max-width: 720px;
    height: 48px;
    background: var(--soft);
    border-radius: 24px;
    overflow: hidden;
}

.search-icon {
    padding-left: 18px;
    font-size: 25px;
    color: var(--muted);
    transform: rotate(-20deg);
}

.search input {
    flex: 1;
    height: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    padding: 0 12px;
    font-size: 15px;
}

.search button {
    height: 100%;
    border: 0;
    padding: 0 18px;
    background: transparent;
    color: #555;
    font-weight: 700;
    cursor: pointer;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-left: auto;
}

.nav-link {
    font-weight: 700;
    white-space: nowrap;
}

.btn-primary {
    padding: 13px 18px;
    background: var(--primary);
    color: white;
    border-radius: 24px;
    font-weight: 800;
    white-space: nowrap;
}

main {
    width: min(1500px, calc(100% - 36px));
    margin: 0 auto;
}

.hero {
    padding: 58px 10px 28px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 1.4px;
}

.hero h1 {
    max-width: 780px;
    margin: 0;
    font-size: clamp(34px, 5vw, 58px);
    line-height: 1.03;
    letter-spacing: -2px;
}

.hero-text {
    max-width: 680px;
    margin: 18px 0 0;
    color: var(--muted);
    font-size: 18px;
    line-height: 1.55;
}

.categories {
    display: flex;
    gap: 9px;
    padding: 10px 0 28px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.category-chip {
    flex: 0 0 auto;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: white;
    font-size: 14px;
    font-weight: 700;
}

.category-chip:hover,
.category-chip.active {
    background: #111;
    border-color: #111;
    color: white;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 15px;
    margin: 12px 0 22px;
}

.section-heading h2 {
    margin: 0;
    font-size: 25px;
}

.section-heading p {
    margin: 7px 0 0;
    color: var(--muted);
}

.count {
    color: var(--muted);
    font-size: 13px;
}

.masonry {
    columns: 5 230px;
    column-gap: 20px;
    width: 100%;
}

.card {
    display: inline-block;
    width: 100%;
    margin: 0 0 20px;
    overflow: hidden;
    border: 1px solid #eeeeee;
    border-radius: 20px;
    background: #ffffff;
    box-shadow: 0 3px 14px rgba(0,0,0,.08);
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
    vertical-align: top;
    transition: transform .18s ease, box-shadow .18s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 28px rgba(0,0,0,.14);
}

.card-image-link {
    display: block;
    overflow: hidden;
    background: #f4f4f4;
}

.card-image {
    display: block;
    width: 100%;
    height: auto;
    max-height: none;
    object-fit: contain;
    transition: transform .25s ease;
}

.card:hover .card-image {
    transform: scale(1.015);
}

.no-image {
    display: flex;
    min-height: 220px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(145deg, #f7f7f7, #eeeeee);
    color: #666;
}

.no-image span {
    font-size: 46px;
}

.card-body {
    padding: 15px 16px 16px;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.card-tags span {
    padding: 5px 9px;
    border-radius: 999px;
    background: #f1f1f1;
    color: #555;
    font-size: 11px;
    font-weight: 700;
}

.card h3 {
    margin: 0;
    font-size: 17px;
    line-height: 1.32;
}

.card h3 a:hover {
    text-decoration: underline;
}

.card p {
    margin: 9px 0 13px;
    color: #666;
    font-size: 13px;
    line-height: 1.5;
}

.card-footer {
    display: flex;
    align-items: center;
    gap: 9px;
    padding-top: 3px;
    color: #777;
    font-size: 11px;
}

.card-footer span:first-child {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.empty {
    max-width: 650px;
    margin: 70px auto 100px;
    padding: 50px 25px;
    text-align: center;
    border: 1px dashed #ccc;
    border-radius: 22px;
}

.empty-icon {
    font-size: 50px;
}

.empty h3 {
    margin: 15px 0 8px;
}

.empty p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.footer {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 70px;
    padding: 35px 20px;
    color: #777;
    border-top: 1px solid #eee;
    font-size: 13px;
}

@media (max-width: 1050px) {
    .topbar {
        flex-wrap: wrap;
    }

    .logo {
        min-width: auto;
    }

    .search {
        order: 3;
        flex-basis: 100%;
        max-width: none;
    }

    .masonry {
        columns: 4 190px;
        column-gap: 16px;
    }
}

@media (max-width: 700px) {
    .topbar {
        padding: 10px 15px;
        gap: 12px;
    }

    .logo span:last-child {
        font-size: 16px;
    }

    .nav-link {
        display: none;
    }

    .btn-primary {
        padding: 10px 14px;
        font-size: 13px;
    }

    main {
        width: min(100% - 22px, 600px);
    }

    .hero {
        padding: 38px 4px 20px;
    }

    .hero h1 {
        letter-spacing: -1px;
    }

    .hero-text {
        font-size: 16px;
    }

    .masonry {
        columns: 2 150px;
        column-gap: 12px;
    }

    .card {
        margin-bottom: 11px;
        border-radius: 13px;
    }

    .card-body {
        padding: 11px;
    }

    .card h3 {
        font-size: 15px;
    }

    .card-footer {
        flex-wrap: wrap;
    }

    .footer {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 420px) {
    .masonry {
        columns: 1;
    }

    .search button {
        display: none;
    }
}
