/*
Theme Name: Pinterest Clone
Theme URI: https://idea.thuc.me
Author: Antigravity
Description: A premium Pinterest-style WordPress theme with a masonry layout.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: pinterest-clone
*/

:root {
    --primary-color: #e60023;
    --bg-color: #ffffff;
    --text-color: #111111;
    --gray-light: #efefef;
    --gray-dark: #767676;
    --border-radius: 16px;
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    padding-top: 80px; /* Space for fixed header */
}

/* Adjust for Admin Bar */
body.admin-bar header {
    top: 32px;
}

@media screen and (max-width: 782px) {
    body.admin-bar header {
        top: 46px;
    }
}

/* Header */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1000;
    box-shadow: 0 1px 0 rgba(0,0,0,0.05);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo img {
    height: 32px;
    width: auto;
    display: block;
}

.logo {
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.logo:hover {
    background: var(--gray-light);
}

.primary-nav {
    display: flex;
    align-items: center;
}

.nav-links {
    list-style: none !important;
    display: flex !important;
    align-items: center;
    gap: 4px;
    padding: 0 !important;
    margin: 0 !important;
}

.nav-links li {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
}

.nav-links li a {
    text-decoration: none !important;
    color: var(--text-color);
    font-weight: 600;
    font-size: 16px;
    padding: 12px 16px;
    border-radius: 24px;
    transition: background 0.3s ease;
    display: block;
    white-space: nowrap;
}

.nav-links li a:hover {
    background: var(--gray-light);
}

.nav-links li.current-menu-item a {
    background: var(--text-color);
    color: white;
}

.search-bar {
    flex-grow: 1;
    margin: 0 16px;
    background: var(--gray-light);
    border-radius: 24px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    border: none;
}

.search-bar input {
    background: transparent;
    border: none;
    outline: none;
    width: 100%;
    font-size: 16px;
    color: var(--text-color);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    padding: 12px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
    color: var(--gray-dark);
}

.icon-btn:hover {
    background: var(--gray-light);
}

.icon-btn svg {
    fill: currentColor;
}

/* Grid Layout */
.container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 0 16px;
}

.grid {
    margin: 0 auto;
}

.grid-item {
    width: calc(20% - 16px); /* 5 columns */
    margin-bottom: 16px;
    border-radius: var(--border-radius);
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@media (max-width: 1400px) { .grid-item { width: calc(25% - 16px); } }
@media (max-width: 1100px) { .grid-item { width: calc(33.333% - 16px); } }
@media (max-width: 800px) { .grid-item { width: calc(50% - 16px); } }
@media (max-width: 500px) { .grid-item { width: 100%; } }

.grid-item:hover {
    transform: scale(1.02);
}

.card-link {
    display: block;
    position: relative;
    text-decoration: none;
    color: inherit;
}

.grid-item img {
    width: 100%;
    display: block;
    border-radius: var(--border-radius);
    transition: filter 0.3s ease;
}

.grid-item:hover img {
    filter: brightness(0.85);
}

/* Card Overlay */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 16px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.2) 0%, transparent 40%, transparent 60%, rgba(0,0,0,0.4) 100%);
}

.grid-item:hover .overlay {
    opacity: 1;
}

.save-btn {
    align-self: flex-end;
    background: var(--primary-color);
    color: white;
    padding: 12px 20px;
    border-radius: 24px;
    font-weight: 600;
    text-decoration: none;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(230, 0, 35, 0.3);
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.card-title {
    display: block;
    margin-top: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    padding: 0 4px;
    text-decoration: none;
}

.card-title:hover {
    color: var(--primary-color);
}

.card-author {
    font-size: 12px;
    color: var(--gray-dark);
    padding: 0 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ddd;
}

.load-more-wrap {
    display: flex;
    justify-content: center;
    padding: 24px 0 40px;
}

.load-more-btn {
    border: none;
    background: var(--text-color);
    color: #ffffff;
    padding: 14px 28px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}

.load-more-btn:hover {
    transform: translateY(-1px);
    background: #2a2a2a;
}

.load-more-btn.is-loading,
.load-more-btn:disabled {
    opacity: 0.7;
    cursor: wait;
    transform: none;
}

.single-post-page {
    padding-top: 24px;
    padding-bottom: 48px;
}

.single-post-card {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
    gap: 32px;
    align-items: start;
    background: #ffffff;
    border-radius: 32px;
}

.single-media-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.single-primary-media {
    margin: 0;
    background: #f7f7f7;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

.single-primary-media img {
    width: 100%;
    height: auto;
    display: block;
}

.single-primary-media figcaption,
.single-gallery-card figcaption {
    padding: 12px 16px 16px;
    font-size: 14px;
    color: var(--gray-dark);
}

.single-gallery-strip {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.single-gallery-card {
    margin: 0;
    background: #ffffff;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

.single-gallery-card a {
    display: block;
}

.single-gallery-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
}

.single-media-empty {
    min-height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border-radius: 28px;
    color: var(--gray-dark);
    font-size: 18px;
    box-shadow: var(--card-shadow);
}

.single-content-panel {
    position: sticky;
    top: 112px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px;
    border-radius: 28px;
    background: #ffffff;
    box-shadow: var(--card-shadow);
}

.single-post-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.single-back-link {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 600;
}

.single-back-link:hover {
    color: var(--primary-color);
}

.single-post-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.single-post-title {
    font-size: clamp(32px, 4vw, 52px);
    line-height: 1.05;
}

.single-post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    color: var(--gray-dark);
    font-size: 14px;
}

.single-post-excerpt {
    font-size: 18px;
    color: #333333;
    line-height: 1.7;
}

.single-post-body {
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-color);
}

.single-post-body > * + * {
    margin-top: 16px;
}

.single-post-body img {
    max-width: 100%;
    height: auto;
    border-radius: 20px;
}

@media (max-width: 1024px) {
    .single-post-card {
        grid-template-columns: 1fr;
    }

    .single-content-panel {
        position: static;
    }
}

@media (max-width: 640px) {
    .single-post-card {
        gap: 20px;
    }

    .single-content-panel {
        padding: 20px;
    }

    .single-gallery-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .single-gallery-card img {
        height: 160px;
    }
}
