/* =============================================
   Design System — wallpaper.com inspired
   ============================================= */
:root {
    --primary:      #0f172a;
    --accent:       #3b82f6;
    --accent-hover: #2563eb;
    --bg:           #f1f5f9;
    --card-bg:      #ffffff;
    --text:         #1e293b;
    --muted:        #64748b;
    --border:       #e2e8f0;
    --radius:       10px;
    --shadow:       0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
    --shadow-lg:    0 10px 15px -3px rgba(0,0,0,.15), 0 4px 6px -2px rgba(0,0,0,.08);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

img { max-width: 100%; }
a { color: inherit; }

/* ── Header ─────────────────────────────────── */
.site-header {
    background: var(--primary);
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,.4);
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    height: 64px;
}

.site-logo img { height: 38px; width: auto; display: block; }

.search-form {
    flex: 1;
    max-width: 520px;
    display: flex;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 50px;
    overflow: hidden;
    transition: background .2s, border-color .2s;
}

.search-form:focus-within {
    background: rgba(255,255,255,.14);
    border-color: var(--accent);
}

.search-form input {
    flex: 1;
    background: none;
    border: none;
    padding: .55rem 1.2rem;
    color: #fff;
    font-size: .9rem;
    outline: none;
    min-width: 0;
}

.search-form input::placeholder { color: rgba(255,255,255,.45); }

.search-form button {
    background: none;
    border: none;
    padding: 0 1.1rem;
    color: rgba(255,255,255,.55);
    cursor: pointer;
    transition: color .2s;
    font-size: .95rem;
}
.search-form button:hover { color: #fff; }

.header-nav { margin-left: auto; display: flex; gap: .25rem; flex-shrink: 0; }
.header-nav a {
    color: rgba(255,255,255,.7);
    text-decoration: none;
    font-size: .85rem;
    padding: .4rem .85rem;
    border-radius: 6px;
    white-space: nowrap;
    transition: all .2s;
}
.header-nav a:hover { color: #fff; background: rgba(255,255,255,.1); }

/* ── Main Wrapper ───────────────────────────── */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.section-title {
    font-size: .88rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: .75rem;
}
.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ── Wallpaper Card Grid ────────────────────── */
.wallpaper-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}

.wall-card {
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--card-bg);
    box-shadow: var(--shadow);
    transition: transform .25s, box-shadow .25s;
}

.wall-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.wall-card > a { display: block; text-decoration: none; }

.thumb-wrap {
    position: relative;
    padding-bottom: 62.5%;
    background: #dde3ec;
    overflow: hidden;
}

.thumb-wrap img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .4s ease;
}

.wall-card:hover .thumb-wrap img { transform: scale(1.06); }

.card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,.72) 0%, rgba(0,0,0,.15) 55%, transparent 100%);
    opacity: 0;
    transition: opacity .25s;
    display: flex;
    align-items: flex-end;
    padding: .85rem;
}

.wall-card:hover .card-overlay { opacity: 1; }

.card-overlay-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.btn-view {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: .38rem .9rem;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background .2s;
    display: inline-block;
}
.btn-view:hover { background: var(--accent-hover); }

.card-title {
    padding: .55rem .75rem;
    font-size: .79rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
    border-top: 1px solid var(--border);
}

/* ── Pagination ─────────────────────────────── */
.pagination-wrap {
    margin-top: 2.5rem;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px;
}
.pagination-wrap a,
.pagination-wrap span {
    display: inline-block;
    padding: .45rem .9rem;
    border-radius: 7px;
    font-size: .85rem;
    text-decoration: none;
    color: var(--text);
    border: 1px solid var(--border);
    background: var(--card-bg);
    transition: all .2s;
}
.pagination-wrap a:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination-wrap .current,
.pagination-wrap span.current { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Footer ─────────────────────────────────── */
.site-footer {
    background: var(--primary);
    color: rgba(255,255,255,.55);
    margin-top: 4rem;
    padding: 3rem 1.5rem 1.5rem;
}

.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.footer-logo img { height: 34px; margin-bottom: .85rem; display: block; }
.footer-desc { font-size: .84rem; line-height: 1.65; }

.footer-heading {
    color: #fff;
    font-size: .78rem;
    font-weight: 700;
    margin-bottom: .85rem;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.footer-links { list-style: none; }
.footer-links li { margin-bottom: .45rem; }
.footer-links a { color: rgba(255,255,255,.5); text-decoration: none; font-size: .84rem; transition: color .2s; }
.footer-links a:hover { color: #fff; }

.social-links { display: flex; gap: .6rem; margin-top: 1rem; }
.social-links a {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,.09);
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,.65);
    text-decoration: none;
    font-size: .82rem;
    transition: all .2s;
}
.social-links a:hover { background: var(--accent); color: #fff; }

.footer-bottom {
    max-width: 1400px;
    margin: 1.5rem auto 0;
    font-size: .78rem;
    text-align: center;
    color: rgba(255,255,255,.3);
}

/* ── Detail / Subpost Page ──────────────────── */
.detail-hero {
    background: var(--primary);
    padding: 2rem 1.5rem;
}

.detail-hero-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 290px;
    gap: 1.75rem;
    align-items: start;
}

.detail-featured-img {
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
    text-align: center;
    line-height: 0;
}

.detail-featured-img img {
    max-width: 100%;
    max-height: 72vh;
    object-fit: contain;
}

.detail-post-title {
    color: #fff;
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: .75rem;
}

.detail-meta {
    color: rgba(255,255,255,.5);
    font-size: .84rem;
    margin-bottom: 1.25rem;
    line-height: 1.6;
}

.btn-download {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: .7rem 1.4rem;
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background .2s;
    margin-bottom: .6rem;
    width: 100%;
}
.btn-download:hover { background: var(--accent-hover); color: #fff; }

.detail-related-heading {
    color: rgba(255,255,255,.4);
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    margin: 1.5rem 0 .75rem;
}

.related-mini-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin-bottom: .55rem;
    text-decoration: none;
}
.related-mini-item img {
    width: 66px;
    height: 44px;
    object-fit: cover;
    border-radius: 5px;
    flex-shrink: 0;
}
.related-mini-item span {
    color: rgba(255,255,255,.6);
    font-size: .78rem;
    line-height: 1.35;
    transition: color .2s;
}
.related-mini-item:hover span { color: #fff; }

/* ── Image Gallery (detail page) ────────────── */
.image-gallery {
    max-width: 1400px;
    margin: 2.5rem auto 0;
    padding: 0 1.5rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
}

.gallery-item {
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--card-bg);
    box-shadow: var(--shadow);
    transition: box-shadow .25s;
}
.gallery-item:hover { box-shadow: var(--shadow-lg); }

.gallery-item img { width: 100%; height: auto; display: block; }

.gallery-item-info {
    padding: .65rem .8rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    flex-wrap: wrap;
}

.resolution-badge {
    font-size: .73rem;
    font-weight: 700;
    color: var(--muted);
    background: var(--bg);
    padding: .22rem .55rem;
    border-radius: 5px;
    flex-shrink: 0;
}

.item-actions { display: flex; gap: .4rem; flex-wrap: wrap; }

.btn-sm {
    display: inline-flex;
    align-items: center;
    gap: .28rem;
    padding: .32rem .65rem;
    border-radius: 6px;
    font-size: .74rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: all .2s;
    white-space: nowrap;
}
.btn-sm-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-sm-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-sm-outline { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-sm-outline:hover { border-color: var(--accent); color: var(--accent); }

/* ── Download modal ─────────────────────────── */
.dl-modal-bg {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.65);
    z-index: 999;
    align-items: center;
    justify-content: center;
}
.dl-modal-bg.open { display: flex; }

.dl-modal-box {
    background: var(--card-bg);
    border-radius: 14px;
    padding: 2rem;
    max-width: 360px;
    width: 90%;
    text-align: center;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,.4);
}
.dl-modal-close {
    position: absolute;
    top: .9rem; right: 1rem;
    background: none; border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--muted);
    line-height: 1;
}
.dl-modal-title { font-size: 1rem; font-weight: 700; margin-bottom: .5rem; }
.dl-countdown { font-size: 2rem; font-weight: 800; color: var(--accent); margin: .75rem 0; }
.dl-share-row { display: flex; justify-content: center; gap: .75rem; margin-top: .85rem; }

/* ── Responsive ─────────────────────────────── */
@media (max-width: 1024px) {
    .detail-hero-inner { grid-template-columns: 1fr 250px; }
}
@media (max-width: 900px) {
    .detail-hero-inner { grid-template-columns: 1fr; }
    .footer-inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
    .wallpaper-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .header-nav { display: none; }
    .footer-inner { grid-template-columns: 1fr; gap: 1.5rem; }
    .gallery-grid { grid-template-columns: 1fr; }
    .detail-hero { padding: 1.25rem 1rem; }
    .main-content { padding: 1.25rem 1rem; }
    .image-gallery { padding: 0 1rem; }
}
