/* ===== CSS Variables & Reset ===== */
:root {
    --primary: #c4455c;
    --primary-dark: #a83a4e;
    --primary-light: #d66a7d;
    --secondary: #7c3aed;
    --accent: #8b5cf6;
    --bg: #0f0f0f;
    --bg-elevated: #1a1a1a;
    --bg-card: #1f1f1f;
    --surface: #262626;
    --text: #f5f5f5;
    --text-muted: #a3a3a3;
    --text-subtle: #737373;
    --border: #333333;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ===== Navigation ===== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 15, 15, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.nav-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.logo {
    text-decoration: none;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 8px;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text);
    background: var(--surface);
}

.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.mobile-menu-btn span {
    width: 24px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: var(--transition);
}

/* ===== Hero ===== */
.hero {
    padding: 48px 16px 32px;
    text-align: center;
    background: linear-gradient(180deg, rgba(196, 69, 92, 0.1) 0%, transparent 100%);
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    color: var(--text-muted);
    font-size: 1.125rem;
    max-width: 500px;
    margin: 0 auto;
}

/* ===== Controls ===== */
.controls {
    padding: 24px 0;
    position: sticky;
    top: 64px;
    z-index: 50;
    background: var(--bg);
}

.controls::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.search-wrapper {
    position: relative;
    max-width: 600px;
    margin: 0 auto 20px;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-subtle);
    pointer-events: none;
}

#searchInput {
    width: 100%;
    padding: 14px 16px 14px 48px;
    font-size: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    outline: none;
    transition: var(--transition);
}

#searchInput:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(196, 69, 92, 0.15);
}

#searchInput::placeholder {
    color: var(--text-subtle);
}

/* ===== Masonry Grid ===== */
.main-content {
    padding: 24px 0 48px;
    min-height: 50vh;
}

.masonry-grid {
    column-count: 2;
    column-gap: 16px;
}

/* Responsive columns */
@media (min-width: 640px) {
    .masonry-grid { column-count: 3; }
}

@media (min-width: 1024px) {
    .masonry-grid { column-count: 4; }
}

@media (min-width: 1400px) {
    .masonry-grid { column-count: 5; }
}

/* ===== Image Card ===== */
.image-card {
    break-inside: avoid;
    margin-bottom: 16px;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid var(--border);
    position: relative;
}

.image-card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.image-wrapper {
    position: relative;
    overflow: hidden;
    background: var(--surface);
}

.image-wrapper::before {
    content: '';
    display: block;
    padding-bottom: var(--aspect-ratio, 75%);
}

.image-placeholder {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--surface) 0%, var(--bg-elevated) 100%);
}

.image-card img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-card img.loaded {
    opacity: 1;
}

.card-info {
    padding: 12px 14px;
}

.card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.card-category {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: rgba(196, 69, 92, 0.15);
    color: var(--primary-light);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.card-category.nature { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.card-category.abstract { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }
.card-category.minimal { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }
.card-category.dark { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.card-category.anime { background: rgba(236, 72, 153, 0.15); color: #f472b6; }
.card-category.architecture { background: rgba(251, 146, 60, 0.15); color: #fb923c; }
.card-category.space { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.card-category.urban { background: rgba(168, 85, 247, 0.15); color: #c084fc; }
.card-category.food { background: rgba(251, 113, 133, 0.15); color: #fb7185; }
.card-category.interior { background: rgba(45, 212, 191, 0.15); color: #2dd4bf; }
.card-category.water { background: rgba(56, 189, 248, 0.15); color: #38bdf8; }
.card-category.mountain { background: rgba(132, 204, 22, 0.15); color: #a3e635; }

.card-download {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.card-download:hover {
    background: var(--primary);
    color: white;
}

/* ===== Loading & No Results ===== */
.loading-sentinel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px;
    gap: 12px;
    color: var(--text-muted);
}

.loading-sentinel.hidden {
    display: none;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.no-results {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

.no-results svg {
    margin-bottom: 16px;
    color: var(--text-subtle);
}

.no-results p {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

/* ===== Modal ===== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    cursor: pointer;
}

.modal-content {
    position: relative;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.3s ease;
    box-shadow: var(--shadow-lg);
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    z-index: 10;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--primary);
}

.modal-image-wrapper {
    flex: 1;
    overflow: hidden;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.modal-image-wrapper img {
    max-width: 100%;
    max-height: 60vh;
    object-fit: contain;
}

.modal-info {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-info h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
}

.modal-category {
    display: inline-flex;
    align-self: flex-start;
    padding: 6px 14px;
    background: rgba(196, 69, 92, 0.15);
    color: var(--primary-light);
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 8px;
}

.download-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.download-btn:active {
    transform: translateY(0);
}

.download-btn .btn-status {
    display: none;
}

.download-btn.loading {
    pointer-events: none;
    opacity: 0.8;
}

.download-btn.loading .btn-text {
    display: none;
}

.download-btn.loading .btn-status {
    display: inline;
}

/* ===== Footer ===== */
.footer {
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
    padding: 24px 0;
    text-align: center;
}

.footer p {
    color: var(--text-subtle);
    font-size: 0.875rem;
}

/* ===== Static Pages ===== */
.page-header {
    padding: 48px 16px;
    text-align: center;
    background: linear-gradient(180deg, rgba(196, 69, 92, 0.1) 0%, transparent 100%);
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.page-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 32px 16px 64px;
}

.content-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.content-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--primary-light);
}

.content-section p {
    color: var(--text-muted);
    margin-bottom: 12px;
    line-height: 1.7;
}

.content-section ul {
    list-style: none;
    padding-left: 0;
}

.content-section li {
    color: var(--text-muted);
    padding: 8px 0;
    padding-left: 24px;
    position: relative;
}

.content-section li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 16px;
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
}

.contact-link {
    color: var(--primary-light);
    text-decoration: none;
}

.contact-link:hover {
    text-decoration: underline;
}

/* ===== Mobile Responsive ===== */
@media (max-width: 768px) {
    .nav-links {
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--bg);
        flex-direction: column;
        padding: 16px;
        gap: 4px;
        border-bottom: 1px solid var(--border);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: var(--transition);
    }

    .nav-links.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .hero h1 {
        font-size: 1.75rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .modal-content {
        max-height: 95vh;
    }

    .modal-info h2 {
        font-size: 1.125rem;
    }

    .download-btn {
        padding: 12px 20px;
    }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--surface);
    border-radius: 5px;
    border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border);
}
