/* ==========================================================================
   Thinking Grafiti - Clean & Minimal Gallery Stylesheet
   ========================================================================== */

:root {
    --gf-bg: #fbfbfb;
    --gf-surface: #ffffff;
    --gf-text-primary: #18181b;
    --gf-text-secondary: #71717a;
    --gf-text-muted: #a1a1aa;
    --gf-border: #e4e4e7;
    --gf-border-subtle: #f4f4f5;
    --gf-accent: #e11d48; /* Rhodia/Graffiti delicate rose */
    --gf-font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --gf-font-serif: 'Newsreader', 'Noto Serif JP', Georgia, serif;
    --gf-font-jp: 'Noto Sans JP', sans-serif;
    --gf-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --gf-shadow-md: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
    --gf-shadow-lg: 0 20px 40px -15px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --gf-bg: #09090b;
    --gf-surface: #141417;
    --gf-text-primary: #f4f4f5;
    --gf-text-secondary: #a1a1aa;
    --gf-text-muted: #71717a;
    --gf-border: #27272a;
    --gf-border-subtle: #18181b;
    --gf-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --gf-shadow-md: 0 4px 20px -2px rgba(0, 0, 0, 0.3);
    --gf-shadow-lg: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
}

/* Base */
*, *::before, *::after {
    box-sizing: border-box;
}

body.graffiti-body {
    margin: 0;
    padding: 0;
    background-color: var(--gf-bg);
    color: var(--gf-text-primary);
    font-family: var(--gf-font-sans);
    -webkit-font-smoothing: antialiased;
    line-height: 1.6;
    overflow-x: hidden;
    width: 100%;
}

/* Header / Hero */
.graffiti-header {
    padding: 120px 20px 40px;
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
    width: 100%;
}

.graffiti-title {
    font-family: var(--gf-font-serif);
    font-size: clamp(32px, 5vw, 56px);
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin: 0;
    color: var(--gf-text-primary);
    word-break: break-word;
}

/* Container */
.graffiti-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 100px;
    width: 100%;
}

.graffiti-meta-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--gf-border);
    padding-bottom: 16px;
    margin-bottom: 40px;
    width: 100%;
    min-height: 41px;
}

.graffiti-count {
    font-size: 13px;
    color: var(--gf-text-muted);
    font-family: var(--gf-font-sans);
    letter-spacing: 0.05em;
}

/* Grid Gallery */
.graffiti-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
    gap: 32px 24px;
    width: 100%;
}

/* Card */
.graffiti-card {
    background: var(--gf-surface);
    border: 1px solid var(--gf-border);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
}

.graffiti-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--gf-shadow-md);
    border-color: var(--gf-text-muted);
}

.graffiti-card-media {
    position: relative;
    background: var(--gf-border-subtle);
    aspect-ratio: 3 / 4;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--gf-border-subtle);
}

.graffiti-card-img {
    width: 100%;
    height: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.graffiti-card:hover .graffiti-card-img {
    transform: scale(1.02);
}

.graffiti-card-footer {
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--gf-surface);
}

.graffiti-card-no {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--gf-text-secondary);
    font-family: var(--gf-font-sans);
}

.graffiti-card-date {
    font-size: 12px;
    font-weight: 400;
    color: var(--gf-text-muted);
    letter-spacing: 0.04em;
    font-family: var(--gf-font-sans);
}

/* Loading & Empty */
.graffiti-loading {
    display: none; /* Deprecated in favor of Skeleton UI */
    text-align: center;
    padding: 80px 20px;
    color: var(--gf-text-secondary);
}

/* Skeleton UI for CLS Prevention */
.graffiti-skeleton-card {
    pointer-events: none;
    border-color: var(--gf-border-subtle);
    animation: gf-card-fade 0.3s ease;
}

.graffiti-skeleton-media {
    background: linear-gradient(90deg, var(--gf-border-subtle) 25%, var(--gf-surface) 50%, var(--gf-border-subtle) 75%);
    background-size: 200% 100%;
    animation: gf-shimmer 1.8s ease-in-out infinite;
    aspect-ratio: 3 / 4;
    width: 100%;
    border-bottom: 1px solid var(--gf-border-subtle);
}

.graffiti-skeleton-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: var(--gf-surface);
}

.graffiti-skeleton-pill {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--gf-border-subtle) 25%, var(--gf-surface) 50%, var(--gf-border-subtle) 75%);
    background-size: 200% 100%;
    animation: gf-shimmer 1.8s ease-in-out infinite;
    display: inline-block;
}

@keyframes gf-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes gf-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.graffiti-card-fade-in {
    animation: gf-fade-in 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.graffiti-spinner {
    width: 32px;
    height: 32px;
    border: 2px solid var(--gf-border);
    border-top-color: var(--gf-text-primary);
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: gf-spin 0.8s linear infinite;
}

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

.graffiti-empty {
    text-align: center;
    padding: 100px 24px;
    background: var(--gf-surface);
    border: 1px dashed var(--gf-border);
    border-radius: 16px;
    max-width: 560px;
    margin: 0 auto;
}

.graffiti-empty-icon {
    font-size: 48px;
    color: var(--gf-text-muted);
    margin-bottom: 16px;
}

.graffiti-empty-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px;
}

.graffiti-empty-desc {
    font-size: 14px;
    color: var(--gf-text-secondary);
    margin: 0;
    line-height: 1.6;
}

/* Lightbox Modal */
.graffiti-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.graffiti-lightbox[hidden] {
    display: none !important;
}

.graffiti-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 15, 18, 0.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.graffiti-lightbox-close {
    position: absolute;
    top: 24px;
    right: 24px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #ffffff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.graffiti-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.graffiti-lightbox-dialog {
    position: relative;
    z-index: 1;
    background: var(--gf-surface);
    border-radius: 16px;
    max-width: 1040px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--gf-shadow-lg);
    display: flex;
}

.graffiti-lightbox-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    max-height: 90vh;
}

.graffiti-lightbox-image-wrap {
    background: #09090b;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    overflow: auto;
}

.graffiti-lightbox-image-wrap img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.graffiti-lightbox-meta {
    padding: 36px 32px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.graffiti-lightbox-date {
    font-size: 13px;
    font-weight: 500;
    color: var(--gf-text-muted);
    margin-bottom: 12px;
}

.graffiti-lightbox-title {
    font-size: 22px;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 16px;
    color: var(--gf-text-primary);
}

.graffiti-lightbox-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.graffiti-lightbox-text {
    font-size: 14px;
    line-height: 1.8;
    color: var(--gf-text-secondary);
    margin-bottom: 28px;
    white-space: pre-wrap;
    background: var(--gf-border-subtle);
    padding: 16px;
    border-radius: 8px;
}

.graffiti-lightbox-analysis {
    border-top: 1px solid var(--gf-border);
    padding-top: 24px;
    margin-top: auto;
}

.graffiti-lightbox-analysis-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gf-accent);
    margin-bottom: 12px;
}

.graffiti-lightbox-analysis-body {
    font-size: 13px;
    line-height: 1.8;
    color: var(--gf-text-secondary);
}

.graffiti-lightbox-analysis-body p {
    margin: 0 0 10px;
}

/* Responsive */
@media (max-width: 840px) {
    .graffiti-lightbox-content {
        grid-template-columns: 1fr;
        max-height: 85vh;
        overflow-y: auto;
    }
    .graffiti-lightbox-image-wrap {
        padding: 16px;
        min-height: 300px;
    }
    .graffiti-lightbox-image-wrap img {
        max-height: 50vh;
    }
    .graffiti-lightbox-meta {
        padding: 24px;
    }
    .graffiti-header {
        padding: 100px 20px 32px;
    }
}

@media (max-width: 640px) {
    .graffiti-header {
        padding: 96px 16px 24px;
    }
    .graffiti-container {
        padding: 0 16px 80px;
    }
    .graffiti-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .graffiti-meta-bar {
        margin-bottom: 24px;
    }
}
