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

body {
    font-family: ui-monospace, 'SF Mono', 'Cascadia Code', 'Source Code Pro', Menlo, Monaco, Consolas, 'DejaVu Sans Mono', monospace;
    background-color: #fbf9f4;
    /* Creamy background from screenshot */
    color: #000;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    overflow-y: auto;
}

/* App Layout */
.app-container {
    width: 100%;
}

/* App Header Controls */
.app-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    margin-bottom: 80px;
    text-align: center;
}

.upload-trigger {
    border-bottom: 1px solid #000;
    padding-bottom: 2px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.upload-trigger:hover {
    opacity: 0.5;
}

.shuffle-btn {
    padding: 10px;
}

/* Content Area */
.content-area {
    padding: 100px 40px;
    width: 100%;
    margin: 0 auto;
}

/* Typography */
a,
button,
input {
    font-family: inherit;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: inherit;
    text-decoration: none;
}

/* Upload Section (Popup version) */
.modal .upload-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    opacity: 1;
    /* Reset opacity for popup */
}

#upload-link {
    border-bottom: 1px solid #000;
    padding-bottom: 2px;
    cursor: pointer;
}

#upload-link:hover {
    opacity: 0.5;
}

.caption-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.caption-label {
    font-size: 12px;
    color: #888;
    letter-spacing: 0.2em;
}

.caption-input {
    width: 300px;
    border: none;
    border-bottom: 1px solid #aaa9a9;
    padding: 8px 0;
    text-align: center;
    outline: none;
    background: none;
    text-transform: none;
    font-size: 12px;
    letter-spacing: 0;
}

.caption-input::placeholder {
    color: #888;
}

.caption-input:focus {
    border-bottom-color: #000;
}

.submit-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.2s, opacity 0.2s;
    color: #888;
    /* Grey by default */
}

.submit-btn:not(:disabled) {
    color: #000;
    /* Black when enabled */
}

.submit-btn:not(:disabled):hover {
    opacity: 0.5;
}

.submit-btn:disabled {
    cursor: default;
}

/* Icon Buttons */
.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.icon-btn:hover {
    opacity: 0.5;
}

.icon-btn svg {
    width: 14px;
    height: 14px;
}

/* Error Messages */
.error-message {
    font-size: 12px;
    color: #ff0000;
    margin-top: 4px;
    letter-spacing: 0.1em;
}

.hidden {
    display: none !important;
}

.modal-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 20px;
    font-size: 16px;
    color: #000;
    margin-top: 20px;
    transition: opacity 0.2s;
}

.modal-close-btn:hover {
    opacity: 0.5;
}

/* Image Grid */
.image-grid {
    display: flex;
    justify-content: center;
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto 20px;
}

.grid-column {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.image-card {
    break-inside: avoid;
    margin-bottom: 60px;
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.image-card img {
    width: 100%;
    aspect-ratio: auto;
    display: block;
}

.image-card:hover {
    opacity: 0.85;
}

.image-card-info {
    margin-top: 16px;
    text-align: left;
}

.image-card-caption {
    font-size: 12px;
    font-weight: 400;
    margin-bottom: 4px;
    letter-spacing: 0.02em;
}

.image-card-meta {
    font-size: 10px;
    color: #888;
    letter-spacing: 0.05em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Footer Section */
.refresh-section {
    width: 100%;
    display: flex;
    justify-content: center;
    /* padding: 100px 0; */
}

.refresh-btn svg {
    width: 20px;
    height: 20px;
}

/* Modals (Upload & Lightbox) */
.modal,
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay,
.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #fbf9f4;
    /* Match cream background */
    opacity: 0.95;
}

.modal-content,
.lightbox-content {
    position: relative;
    z-index: 1001;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.05);
}

.lightbox-info {
    margin-top: 32px;
    text-align: center;
    max-width: 400px;
}

.lightbox-caption {
    font-size: 12px;
    margin-bottom: 8px;
    letter-spacing: 0.02em;
}

.lightbox-meta {
    font-size: 10px;
    color: #888;
    margin-bottom: 24px;
}

/* Responsive */
@media (max-width: 1024px) {
    .content-area {
        padding: 60px 40px;
    }

    .image-grid {
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .content-area {
        padding: 60px 20px;
    }

    .app-header {
        flex-direction: row;
        width: 100%;
        justify-content: space-between;
        align-items: center;
        gap: 20px;
        margin-bottom: 40px;
        text-align: left;
    }

    .content-area {
        padding: 40px 20px;
    }

    .image-grid {
        gap: 20px;
    }

    .image-card {
        margin-bottom: 40px;
    }

    .modal-content,
    .lightbox-content {
        width: 95vw;
    }

    .caption-input {
        width: 100%;
        max-width: 280px;
    }
}