:root {
    --bg: #fff;
    --text: #111827;
    --muted: #6b7280;
    --line: #e5e7eb;
    --card: #fff;
    --shadow: 0 10px 28px rgba(17, 24, 39, .10);
    --radius: 16px;
    --max: 1200px;
    --focus: 0 0 0 3px rgba(17, 24, 39, .18);

    --sk: #f3f4f6;
    --skShine: rgba(255, 255, 255, .68);

    --btnPadY: 10px;
    --btnPadX: 14px;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

img {
    max-width: 100%;
    height: auto;
}

.container {
    max-width: var(--max);
    margin: 0 auto;
    padding: 18px 14px 40px;
}

/* HEADER */
header {
    top: 0;
    z-index: 10;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}

.header-inner {
    max-width: var(--max);
    margin: 0 auto;
    padding: 14px 14px 12px;
    display: grid;
    gap: 10px;
    align-items: center;
}

.brand {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.brand h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: .2px;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand p {
    margin: 0;
    font-size: 12.5px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rule {
    height: 1px;
    background: var(--line);
    width: 100%;
    border-radius: 999px;
}

/* Search */
.search-wrap {
    display: flex;
    justify-content: center;
}

.search {
    width: min(760px, 100%);
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 999px;
    padding: 10px 14px;
    transition: box-shadow .15s ease, border-color .15s ease;
}

.search:focus-within {
    border-color: rgba(17, 24, 39, .35);
    box-shadow: var(--focus);
}

.search svg {
    opacity: .65;
    flex: 0 0 auto;
}

.search input {
    width: 100%;
    border: none;
    outline: none;
    font-size: 14px;
    color: var(--text);
    background: transparent;
}

.clear-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 6px;
    border-radius: 10px;
    display: none;
    color: var(--muted);
}

.clear-btn.show {
    display: inline-grid;
    place-items: center;
}

.clear-btn:hover {
    background: #f9fafb;
    color: var(--text);
}

.clear-btn:focus-visible {
    outline: none;
    box-shadow: var(--focus);
}

/* Filters centered, wrap, no scrollbar */
.scroll-menu {
    display: flex;
    justify-content: center;
    width: 100%;
    overflow: hidden;
}

.scroll-menu .inner {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 100%;
}

.chip {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    font-size: 12px;
    padding: 8px 12px;
    border-radius: 999px;
    cursor: pointer;
    user-select: none;
    transition: background .15s ease, border-color .15s ease, transform .12s ease;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
}

.chip:hover {
    background: #f9fafb;
}

.chip:active {
    transform: scale(.99);
}

.chip.active {
    background: #111827;
    border-color: #111827;
    color: #fff;
}

.chip:focus-visible {
    outline: none;
    box-shadow: var(--focus);
}

/* Status */
.status {
    max-width: var(--max);
    margin: 0 auto;
    padding: 10px 14px 0;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 12px;
}

.status strong {
    color: var(--text);
    font-weight: 800;
}

.status .right {
    white-space: nowrap;
}

/* MASONRY */
.masonry {
    column-gap: 14px;
    column-count: 5;
    padding-top: 16px;
}

@media (max-width:1200px) {
    .masonry {
        column-count: 4;
    }
}

@media (max-width:900px) {
    .masonry {
        column-count: 3;
    }

    .brand h1 {
        font-size: 19px;
    }
}

@media (max-width:620px) {
    .masonry {
        column-count: 2;
    }
}

@media (max-width:380px) {
    .masonry {
        column-count: 1;
    }

    .brand h1 {
        font-size: 18px;
    }
}

/* CARD */
.card {
    break-inside: avoid;
    margin: 0 0 14px;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--card);
    border: 1px solid var(--line);
    box-shadow: 0 1px 0 rgba(17, 24, 39, .03);
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease;
    -webkit-tap-highlight-color: transparent;
    will-change: transform;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.card:focus-visible {
    outline: none;
    box-shadow: var(--shadow), var(--focus);
}

.media {
    width: 100%;
    display: block;
    background: #f3f4f6;
    aspect-ratio: var(--ar, 3/4);
    position: relative;
    overflow: hidden;
}

.media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transform: scale(1);
    transition: opacity .22s ease, transform .25s ease;
}

.media img.loaded {
    opacity: 1;
}

.card:hover .media img {
    transform: scale(1.02);
}

.info {
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.title {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.meta {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.dot {
    width: 4px;
    height: 4px;
    border-radius: 99px;
    background: #d1d5db;
    display: inline-block;
}

/* SKELETON */
.skeleton {
    cursor: default;
    pointer-events: none;
}

.sk-box {
    background: var(--sk);
    position: relative;
    overflow: hidden;
}

.sk-box::after {
    content: "";
    position: absolute;
    inset: -40% -60%;
    background: linear-gradient(90deg, transparent, var(--skShine), transparent);
    transform: translateX(-40%);
    animation: shimmer 1.1s linear infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-40%);
    }

    100% {
        transform: translateX(40%);
    }
}

.sk-media {
    width: 100%;
    aspect-ratio: var(--ar, 3/4);
}

.sk-gap {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px 12px;
}

.sk-line {
    height: 10px;
    border-radius: 10px;
}

.sk-line.big {
    height: 12px;
}

.sk-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.sk-pill {
    height: 10px;
    width: 64px;
    border-radius: 999px;
}

.sk-pill.w2 {
    width: 44px;
}

/* Buttons */
.footer-actions {
    display: flex;
    justify-content: center;
    padding-top: 16px;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    border-radius: 12px;
    padding: var(--btnPadY) var(--btnPadX);
    font-weight: 800;
    font-size: 13px;
    cursor: pointer;
    transition: background .15s ease, transform .12s ease, box-shadow .15s ease, border-color .15s ease;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
}

.btn:hover {
    background: #f9fafb;
}

.btn:active {
    transform: scale(.99);
}

.btn:focus-visible {
    outline: none;
    box-shadow: var(--focus);
    border-color: rgba(17, 24, 39, .35);
}

.btn[disabled] {
    opacity: .6;
    cursor: not-allowed;
}

/* Empty / error */
.notice {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px;
    color: var(--muted);
    background: #fff;
}

.notice strong {
    color: var(--text);
}

/* LIGHTBOX */
.lightbox {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 999;
    background: rgba(0, 0, 0, .72);
    padding: clamp(10px, 2vw, 18px);
}

.lightbox.show {
    display: flex;
}

.lb {
    margin: auto;
    width: 100%;
    max-width: 980px;
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1.3fr .7fr;
    min-height: 420px;
    max-height: calc(100dvh - 2*clamp(10px, 2vw, 18px));
    box-shadow: 0 30px 80px rgba(0, 0, 0, .28);
}

@media (max-width:860px) {
    .lb {
        grid-template-columns: 1fr;
        min-height: auto;
    }
}

.lb-media {
    background: #111827;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 260px;
    overflow: hidden;
}

.lb-media img {
    width: 100%;
    height: 100%;
    max-height: calc(100dvh - 140px);
    object-fit: contain;
    display: block;
    background: #111827;
}

@media (max-width:860px) {
    .lb-media img {
        max-height: 55dvh;
    }
}

.lb-info {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: auto;
}

.lb-info h2 {
    margin: 0;
    font-size: 16px;
    line-height: 1.2;
}

.lb-info p {
    margin: 0;
    color: #4b5563;
    font-size: 13px;
    line-height: 1.5;
}

.lb-actions {
    margin-top: 8px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.lb-close {
    position: fixed;
    top: 14px;
    right: 14px;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, .55);
    cursor: pointer;
    background: rgba(255, 255, 255, .90);
    display: grid;
    place-items: center;
    transition: transform .12s ease, background .15s ease;
    -webkit-tap-highlight-color: transparent;
}

.lb-close:hover {
    background: rgba(255, 255, 255, 1);
}

.lb-close:active {
    transform: scale(.98);
}

.lb-close:focus-visible {
    outline: none;
    box-shadow: var(--focus);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* FOOTER */
footer {
    border-top: 1px solid var(--line);
    background: #fff;
}

.footer-inner {
    max-width: var(--max);
    margin: 0 auto;
    padding: 16px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 12px;
}

.footer-inner a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dashed transparent;
}

.footer-inner a:hover {
    color: var(--text);
    border-bottom-color: var(--text);
}

.footer-right {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {

    .card,
    .card:hover,
    .media img,
    .btn,
    .chip {
        transition: none !important;
    }

    .sk-box::after {
        animation: none !important;
    }
}