/* === Reset & Base === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 400;
    color: #2c2c2c;
    background-color: #fafaf8;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: #5a7a6a;
    text-decoration: none;
}

a:hover {
    color: #3d5a4a;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* === Banner & Header === */
.site-header {
    background: #fff;
    border-bottom: 1px solid #e8e5e0;
}

.banner-link {
    display: block;
    line-height: 0;
}

.banner-image {
    width: 100%;
    height: auto;
    display: block;
}

.main-nav {
    display: flex;
    justify-content: center;
    gap: 40px;
    padding: 16px 20px;
    border-top: 1px solid #f0ede8;
}

.main-nav a {
    font-size: 1rem;
    font-weight: 500;
    color: #666;
    text-decoration: none;
    padding: 6px 0;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-size: 0.85rem;
}

.main-nav a:hover {
    color: #2c2c2c;
}

.main-nav a.active {
    color: #2c2c2c;
    border-bottom-color: #2c2c2c;
}

/* === Flash Messages === */
.flash {
    max-width: 800px;
    margin: 20px auto;
    padding: 14px 20px;
    border-radius: 8px;
    font-size: 0.95rem;
}

.flash-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.flash-error {
    background: #fce4ec;
    color: #c62828;
    border: 1px solid #f8bbd0;
}

/* === Content === */
.content {
    flex: 1;
    padding: 40px 20px 60px;
}

/* === Gallery === */
.gallery {
    max-width: 560px;
    margin: 0 auto;
}

.gallery-item {
    margin-bottom: 60px;
}

.gallery-image {
    width: 100%;
    border-radius: 4px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.30), 0 4px 12px rgba(0, 0, 0, 0.15);
}

.gallery-caption {
    margin-top: 16px;
    text-align: center;
}

.painting-title {
    display: block;
    font-size: 1.1rem;
    font-weight: 500;
    color: #2c2c2c;
}

.painting-description {
    display: block;
    font-size: 0.9rem;
    font-weight: 300;
    color: #888;
    margin-top: 2px;
}

.empty-message {
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 60px 0;
}

/* === Page Content (Info & Links) === */
.page-content {
    max-width: 700px;
    margin: 0 auto;
}

.page-content h2 {
    font-size: 1.8rem;
    font-weight: 500;
    color: #2c2c2c;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e8e5e0;
}

.page-body {
    font-size: 1.05rem;
    line-height: 1.8;
    color: #444;
}

.page-body p {
    margin-bottom: 16px;
}

.page-body a {
    color: #5a7a6a;
    text-decoration: underline;
}

/* === Story page (magazine layout) === */
.page-content.story {
    max-width: 780px;
}

.story-portrait {
    float: left;
    width: 42%;
    max-width: 320px;
    margin: 6px 28px 16px 0;
    border-radius: 4px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.30), 0 4px 12px rgba(0, 0, 0, 0.15);
}

.story .page-body .story-lead {
    font-size: 1.35rem;
    font-style: italic;
    font-weight: 300;
    color: #555;
    margin-bottom: 28px;
    line-height: 1.5;
}

.story .page-body h3 {
    font-weight: 700;
    font-size: 1.2rem;
    color: #2c2c2c;
    margin-top: 32px;
    margin-bottom: 12px;
    line-height: 1.4;
    clear: none;
}

.story .page-body p:last-child::after {
    content: "";
    display: block;
    clear: both;
}

@media (max-width: 600px) {
    .story-portrait {
        float: none;
        width: 100%;
        max-width: 100%;
        margin: 0 0 24px 0;
    }
}

/* === Footer === */
.site-footer {
    text-align: center;
    padding: 24px 20px;
    color: #aaa;
    font-size: 0.85rem;
    border-top: 1px solid #e8e5e0;
}

/* === Login Page === */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #f5f3f0;
}

.login-container {
    background: #fff;
    padding: 48px 40px;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-container h1 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.login-subtitle {
    color: #888;
    margin-bottom: 32px;
}

.login-container label {
    display: block;
    text-align: left;
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 1rem;
}

.login-container input[type="password"] {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1.1rem;
    margin-bottom: 20px;
    font-family: inherit;
}

.login-container input:focus {
    outline: none;
    border-color: #5a7a6a;
    box-shadow: 0 0 0 3px rgba(90, 122, 106, 0.1);
}

.back-link {
    display: inline-block;
    margin-top: 24px;
    color: #888;
    font-size: 0.9rem;
}

/* === Buttons === */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.1s;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: #5a7a6a;
    color: #fff;
}

.btn-primary:hover {
    background: #4a6a5a;
    color: #fff;
}

.btn-secondary {
    background: #e8e5e0;
    color: #444;
}

.btn-secondary:hover {
    background: #ddd9d2;
    color: #444;
}

.btn-large {
    padding: 14px 32px;
    font-size: 1.1rem;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn-edit {
    background: #e3eee8;
    color: #3d6b50;
}

.btn-edit:hover {
    background: #d0e4d8;
    color: #3d6b50;
}

.btn-delete {
    background: #fce4ec;
    color: #c62828;
}

.btn-delete:hover {
    background: #f8bbd0;
    color: #c62828;
}

/* === Admin === */
.admin-body {
    background: #f5f3f0;
}

.admin-header {
    background: #fff;
    border-bottom: 1px solid #e8e5e0;
    padding: 16px 24px;
}

.admin-header-inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.admin-title {
    font-size: 1.4rem;
    font-weight: 600;
}

.admin-nav {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.admin-nav-link {
    font-size: 0.95rem;
    font-weight: 500;
    color: #666;
}

.admin-nav-link:hover {
    color: #2c2c2c;
}

.admin-nav-sep {
    color: #ddd;
}

.admin-logout {
    color: #c62828;
}

.admin-content {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 24px 60px;
}

.admin-section {
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.admin-section h2 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: #2c2c2c;
}

.help-text {
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 16px;
}

/* === Forms === */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 1rem;
    color: #444;
}

.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1.05rem;
    font-family: inherit;
}

.form-group input:focus {
    outline: none;
    border-color: #5a7a6a;
    box-shadow: 0 0 0 3px rgba(90, 122, 106, 0.1);
}

.form-group input[type="file"] {
    font-size: 1.05rem;
    padding: 10px 0;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-buttons {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.inline-form {
    display: inline;
}

/* === Image Preview === */
.image-preview {
    margin-top: 12px;
}

.image-preview img {
    max-width: 300px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.current-image img {
    max-width: 400px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* === Painting List (Admin) === */
.painting-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.painting-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: #fafaf8;
    border-radius: 8px;
    border: 1px solid #e8e5e0;
    transition: box-shadow 0.2s;
}

.painting-row:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.painting-row.sortable-ghost {
    opacity: 0.4;
    background: #e3eee8;
}

.painting-row.sortable-chosen {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.drag-handle {
    cursor: grab;
    font-size: 1.5rem;
    color: #bbb;
    padding: 8px;
    user-select: none;
    flex-shrink: 0;
}

.drag-handle:active {
    cursor: grabbing;
}

.painting-thumb {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.painting-info {
    flex: 1;
    min-width: 0;
}

.painting-info strong {
    font-size: 1rem;
}

.painting-info small {
    color: #888;
}

.painting-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* === Rich Editor === */
.rich-editor {
    width: 100%;
    min-height: 300px;
}

/* === Password Form === */
.password-form {
    max-width: 400px;
}

/* === Responsive === */
@media (max-width: 600px) {
    .banner {
        padding: 32px 16px 16px;
    }

    .artist-name {
        font-size: 2.4rem;
    }

    .main-nav {
        gap: 24px;
    }

    .content {
        padding: 24px 16px 40px;
    }

    .gallery-item {
        margin-bottom: 40px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .admin-header-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-nav {
        gap: 10px;
    }

    .admin-section {
        padding: 20px;
    }

    .painting-row {
        flex-wrap: wrap;
    }

    .painting-actions {
        width: 100%;
        justify-content: flex-end;
    }
}
