/* ============================================
   MillyBee Blog — Design System
   A warm, modern personal blog theme
   ============================================ */

/* --- Design Tokens --- */
:root {
    --color-bg: #FDFAF6;
    --color-surface: #FFFFFF;
    --color-surface-warm: #FFF8EE;
    --color-text: #2D2A27;
    --color-text-muted: #7A746D;
    --color-text-light: #A89F96;
    --color-accent: #D4883E;
    --color-accent-hover: #BE7832;
    --color-accent-light: #FEF3E2;
    --color-accent-subtle: #F5EBE0;
    --color-border: #E8E2DA;
    --color-border-light: #F0EBE4;
    --color-success: #5A9E6F;
    --color-success-bg: #EDF7F0;
    --color-danger: #C0392B;
    --color-danger-bg: #FDECEB;
    --font-heading: 'Lora', Georgia, 'Times New Roman', serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
    --shadow-xs: 0 1px 2px rgba(45,42,39,0.04);
    --shadow-sm: 0 1px 3px rgba(45,42,39,0.06), 0 1px 2px rgba(45,42,39,0.04);
    --shadow-md: 0 4px 12px rgba(45,42,39,0.08);
    --shadow-lg: 0 8px 24px rgba(45,42,39,0.1);
    --transition: 200ms ease;
    --container-max: 1100px;
    --header-height: 3.75rem;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.65;
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100dvh;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--color-accent-hover);
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.3;
    color: var(--color-text);
}

h1 { font-size: clamp(2rem, 5vw, 2.75rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2rem); }
h3 { font-size: clamp(1.25rem, 3vw, 1.5rem); }
h1:focus { outline: none; }

/* --- Container --- */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* ============================================
   Site Wrapper (sticky footer)
   ============================================ */
.site-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

.site-main {
    flex: 1;
}

/* ============================================
   Header & Navigation
   ============================================ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(253, 250, 246, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border-light);
    height: var(--header-height);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    position: relative;
}

.nav-brand {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    z-index: 10;
}

.nav-brand:hover {
    color: var(--color-accent);
}

.nav-brand-icon {
    font-size: 1.4rem;
    line-height: 1;
}

/* Checkbox hack for mobile nav */
.nav-toggle-input {
    display: none;
}

.nav-toggle-label {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    z-index: 10;
    padding: 0.5rem;
    margin-right: -0.5rem;
}

.nav-toggle-label span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--color-text);
    border-radius: 2px;
    transition: all var(--transition);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-links a {
    padding: 0.5rem 0.875rem;
    color: var(--color-text-muted);
    font-size: 0.925rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all var(--transition);
}

.nav-links a:hover {
    color: var(--color-text);
    background: var(--color-accent-subtle);
}

@media (max-width: 640px) {
    .nav-toggle-label {
        display: flex;
    }

    .nav-links {
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        background: var(--color-surface);
        border-bottom: 1px solid var(--color-border);
        flex-direction: column;
        padding: 0.5rem 1rem;
        gap: 0;
        box-shadow: var(--shadow-md);
        display: none;
    }

    .nav-links a {
        display: block;
        padding: 0.75rem 0.875rem;
        width: 100%;
    }

    .nav-toggle-input:checked ~ .nav-links {
        display: flex;
    }

    .nav-toggle-input:checked ~ .nav-toggle-label span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .nav-toggle-input:checked ~ .nav-toggle-label span:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle-input:checked ~ .nav-toggle-label span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }
}

/* ============================================
   Hero Section
   ============================================ */
.hero {
    background: linear-gradient(135deg, var(--color-surface-warm) 0%, var(--color-accent-light) 100%);
    padding: 4rem 0 3.5rem;
    text-align: center;
    border-bottom: 1px solid var(--color-border-light);
}

.hero-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.hero h1 {
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-size: clamp(1.05rem, 2.5vw, 1.2rem);
    color: var(--color-text-muted);
    max-width: 540px;
    margin: 0 auto 1.75rem;
    line-height: 1.6;
}

.hero-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.925rem;
    font-weight: 500;
    color: var(--color-accent);
    padding-bottom: 2px;
    border-bottom: 1.5px solid currentColor;
    transition: all var(--transition);
}

.hero-cta:hover {
    color: var(--color-accent-hover);
    gap: 0.65rem;
}

/* ============================================
   Section Headers
   ============================================ */
.section-header {
    margin-bottom: 2rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--color-border-light);
}

.section-header h2 {
    font-size: 1.35rem;
    letter-spacing: -0.01em;
}

/* ============================================
   Blog Card Grid
   ============================================ */
.card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 960px) {
    .card-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* --- Blog Card --- */
.blog-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border-light);
    overflow: hidden;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
}

.blog-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--color-border);
    transform: translateY(-2px);
}

.card-image {
    aspect-ratio: 16 / 10;
    overflow: hidden;
    position: relative;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 400ms ease;
}

.blog-card:hover .card-image img {
    transform: scale(1.03);
}

.card-image-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #F5EBE0 0%, #FCEBD4 50%, #FEF3E2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
}

.card-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--color-text-light);
    margin-bottom: 0.6rem;
}

.card-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.35;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.card-title a {
    color: inherit;
}

.card-title a:hover {
    color: var(--color-accent);
}

.card-excerpt {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    line-height: 1.6;
    flex: 1;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border-light);
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.tag {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--color-accent);
    background: var(--color-accent-light);
    border-radius: var(--radius-full);
    text-transform: lowercase;
}

.card-read-more {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-accent);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: gap var(--transition);
}

.card-read-more:hover {
    gap: 0.45rem;
}

/* ============================================
   Post Detail
   ============================================ */
.post-detail {
    max-width: 720px;
    margin: 0 auto;
    padding: 2.5rem 1.25rem 4rem;
}

.post-back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-muted);
    margin-bottom: 2rem;
    transition: color var(--transition);
}

.post-back:hover {
    color: var(--color-accent);
}

.post-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border-light);
}

.post-header h1 {
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.post-meta-divider {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--color-text-light);
}

.post-cover {
    margin-bottom: 2rem;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.post-cover img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.post-content {
    font-size: 1.075rem;
    line-height: 1.8;
    color: var(--color-text);
}

.post-content p {
    margin-bottom: 1.5rem;
}

.post-content p:last-child {
    margin-bottom: 0;
}

.post-inline-image {
    margin: 2rem 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.post-inline-image img {
    width: 100%;
    height: auto;
    display: block;
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border-light);
}

/* ============================================
   Gallery
   ============================================ */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 2.5rem;
}

@media (min-width: 640px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.gallery-item {
    margin: 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    transition: all var(--transition);
}

.gallery-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.gallery-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
    transition: transform 400ms ease;
}

.gallery-item:hover img {
    transform: scale(1.03);
}

.gallery-item figcaption {
    padding: 0.6rem 0.75rem;
    font-size: 0.825rem;
    color: var(--color-text-muted);
    line-height: 1.4;
    border-top: 1px solid var(--color-border-light);
}

/* --- Gallery editor list --- */
.gallery-editor-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.gallery-editor-item {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding: 0.5rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
}

.gallery-editor-thumb {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
}

.gallery-editor-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-editor-fields {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
}

.gallery-editor-fields input {
    padding: 0.45rem 0.65rem;
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--color-text);
    background: var(--color-bg);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    width: 100%;
}

.gallery-editor-fields input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--color-accent-light);
}

.gallery-editor-fields input::placeholder {
    color: var(--color-text-light);
}

.gallery-editor-actions {
    display: flex;
    gap: 0.25rem;
}

.gallery-editor-actions .btn {
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    min-width: 0;
}

@media (max-width: 480px) {
    .gallery-editor-thumb {
        width: 56px;
        height: 56px;
    }
}

/* ============================================
   Admin Page
   ============================================ */
.admin-page {
    padding: 2rem 0 4rem;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}

.admin-header h1 {
    font-size: 1.75rem;
}

.post-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.post-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    transition: all var(--transition);
}

.post-list-item:hover {
    border-color: var(--color-border);
    box-shadow: var(--shadow-xs);
}

.post-list-info {
    flex: 1;
    min-width: 0;
}

.post-list-title {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.post-list-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: var(--color-text-light);
}

.post-list-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-radius: var(--radius-full);
}

.badge-published {
    color: var(--color-success);
    background: var(--color-success-bg);
}

.badge-draft {
    color: var(--color-text-light);
    background: var(--color-accent-subtle);
}

.badge-gallery {
    color: var(--color-accent);
    background: var(--color-accent-light);
}

@media (max-width: 640px) {
    .post-list-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .post-list-actions {
        width: 100%;
        padding-top: 0.75rem;
        border-top: 1px solid var(--color-border-light);
    }
}

/* ============================================
   Editor Page
   ============================================ */
.editor-page {
    padding: 2rem 0 4rem;
}

.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}

.editor-header h1 {
    font-size: 1.75rem;
}

.editor-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 960px) {
    .editor-layout {
        grid-template-columns: 1fr 1fr;
    }
}

.editor-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* --- Forms --- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 0.65rem 0.875rem;
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: all var(--transition);
    width: 100%;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--color-accent-light);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--color-text-light);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.form-group textarea.content-area {
    min-height: 300px;
    font-size: 0.9rem;
    line-height: 1.7;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* --- Toggle switch --- */
.toggle-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toggle {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-track {
    position: absolute;
    inset: 0;
    background: var(--color-border);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: background var(--transition);
}

.toggle-track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition);
}

.toggle input:checked + .toggle-track {
    background: var(--color-success);
}

.toggle input:checked + .toggle-track::after {
    transform: translateX(20px);
}

.toggle-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text-muted);
}

/* --- Image preview --- */
.image-preview {
    margin-top: 0.5rem;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--color-border-light);
}

.image-preview img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

/* --- Drop zone --- */
.drop-zone {
    position: relative;
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    transition: all var(--transition);
    background: var(--color-surface);
    overflow: hidden;
}

.drop-zone:hover {
    border-color: var(--color-accent);
    background: var(--color-accent-light);
}

.drop-zone-active {
    border-color: var(--color-accent);
    background: var(--color-accent-light);
    box-shadow: 0 0 0 3px rgba(212, 136, 62, 0.15);
}

.drop-zone-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.drop-zone-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 2rem 1rem;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.875rem;
    pointer-events: none;
}

.drop-zone-prompt-compact {
    padding: 0.875rem 1rem;
    flex-direction: row;
    font-size: 0.8rem;
}

.drop-zone-icon {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

.drop-zone-hint {
    font-size: 0.75rem;
    color: var(--color-text-light);
}

.drop-zone-browse {
    color: var(--color-accent);
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 2px;
    position: relative;
}

.drop-zone-browse .drop-zone-input {
    position: absolute;
}

.drop-zone-browse-text {
    color: var(--color-accent);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 2px;
}

.drop-zone-preview {
    position: relative;
}

.drop-zone-preview img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
}

.drop-zone-remove {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 0.75rem;
    cursor: pointer;
    z-index: 5;
    transition: background var(--transition);
    line-height: 1;
}

.drop-zone-remove:hover {
    background: var(--color-danger);
}

.drop-zone-uploading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem 1rem;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.drop-zone-spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.drop-zone-inline {
    margin-top: 0.5rem;
}

.drop-zone-or {
    text-align: center;
    font-size: 0.75rem;
    color: var(--color-text-light);
    padding: 0.4rem 0;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
}

/* --- Editor preview panel --- */
.preview-panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    max-height: calc(100vh - 8rem);
    overflow-y: auto;
    position: sticky;
    top: calc(var(--header-height) + 1.5rem);
}

.preview-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-light);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--color-border-light);
}

.preview-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.75rem;
}

.preview-meta {
    font-size: 0.825rem;
    color: var(--color-text-light);
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border-light);
}

.preview-content {
    font-size: 0.95rem;
    line-height: 1.75;
    color: var(--color-text);
}

.preview-content p {
    margin-bottom: 1rem;
}

.preview-content .post-inline-image {
    margin: 1rem 0;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.preview-content .post-inline-image img {
    width: 100%;
    height: auto;
}

.preview-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-text-light);
    font-style: italic;
}

/* --- Mobile preview tabs --- */
.editor-tabs {
    display: none;
}

@media (max-width: 959px) {
    .editor-tabs {
        display: flex;
        gap: 0;
        margin-bottom: 1.5rem;
        border-bottom: 2px solid var(--color-border-light);
    }

    .editor-tab {
        padding: 0.65rem 1.25rem;
        font-family: var(--font-body);
        font-size: 0.875rem;
        font-weight: 600;
        color: var(--color-text-muted);
        background: none;
        border: none;
        cursor: pointer;
        position: relative;
        transition: color var(--transition);
    }

    .editor-tab.active {
        color: var(--color-accent);
    }

    .editor-tab.active::after {
        content: '';
        position: absolute;
        bottom: -2px;
        left: 0;
        right: 0;
        height: 2px;
        background: var(--color-accent);
    }

    .editor-panel {
        display: none;
    }

    .editor-panel.active {
        display: block;
    }
}

@media (min-width: 960px) {
    .editor-panel {
        display: block !important;
    }
}

/* ============================================
   Login Page
   ============================================ */
.login-page {
    min-height: calc(100dvh - var(--header-height) - 8rem);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-xl);
    padding: 2.5rem 2rem;
    box-shadow: var(--shadow-md);
}

.login-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.75rem;
}

.login-card h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.login-card > p {
    color: var(--color-text-muted);
    font-size: 0.925rem;
    margin-bottom: 1.75rem;
}

.login-card .form-group {
    margin-bottom: 1.25rem;
}

.login-card .alert {
    margin-bottom: 1.25rem;
}

.login-btn {
    width: 100%;
    margin-top: 0.5rem;
}

.login-home-link {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.85rem;
}

.login-home-link a {
    color: var(--color-text-muted);
}

.login-home-link a:hover {
    color: var(--color-accent);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.25rem;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.4;
    border: 1.5px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.btn-primary {
    color: white;
    background: var(--color-accent);
    border-color: var(--color-accent);
}

.btn-primary:hover {
    background: var(--color-accent-hover);
    border-color: var(--color-accent-hover);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    color: var(--color-text-muted);
    background: var(--color-surface);
    border-color: var(--color-border);
}

.btn-secondary:hover {
    border-color: var(--color-text-light);
    color: var(--color-text);
}

.btn-danger {
    color: var(--color-danger);
    background: transparent;
    border-color: transparent;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
}

.btn-danger:hover {
    background: var(--color-danger-bg);
}

.btn-ghost {
    color: var(--color-text-muted);
    background: transparent;
    border-color: transparent;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
}

.btn-ghost:hover {
    background: var(--color-accent-subtle);
    color: var(--color-text);
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.75rem 1.75rem;
    font-size: 1rem;
}

/* ============================================
   Alerts & States
   ============================================ */
.alert {
    padding: 0.875rem 1.125rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-success {
    color: var(--color-success);
    background: var(--color-success-bg);
}

.alert-danger {
    color: var(--color-danger);
    background: var(--color-danger-bg);
}

.empty-state {
    text-align: center;
    padding: 4rem 1.5rem;
    color: var(--color-text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
    opacity: 0.6;
}

.empty-state h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.empty-state p {
    font-size: 0.95rem;
    max-width: 360px;
    margin: 0 auto 1.5rem;
    line-height: 1.6;
}

/* ============================================
   Footer
   ============================================ */
.site-footer {
    border-top: 1px solid var(--color-border-light);
    padding: 2rem 0;
    margin-top: auto;
    text-align: center;
    color: var(--color-text-light);
    font-size: 0.85rem;
}

.site-footer a {
    color: var(--color-text-muted);
}

.site-footer a:hover {
    color: var(--color-accent);
}

/* ============================================
   Page Sections
   ============================================ */
.page-section {
    padding: 2.5rem 0 4rem;
}

/* ============================================
   Not Found & Error Pages
   ============================================ */
.error-page {
    text-align: center;
    padding: 5rem 1.5rem;
    min-height: calc(100dvh - var(--header-height) - 8rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.error-page-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    display: block;
}

.error-page h1 {
    margin-bottom: 0.75rem;
}

.error-page p {
    color: var(--color-text-muted);
    font-size: 1.05rem;
    max-width: 420px;
    margin: 0 auto 2rem;
    line-height: 1.6;
}

/* ============================================
   Loading
   ============================================ */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--color-text-light);
    font-size: 0.95rem;
}

/* ============================================
   Confirm Delete (inline)
   ============================================ */
.confirm-delete {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--color-danger);
}

/* ============================================
   Validation
   ============================================ */
.valid.modified:not([type=checkbox]) {
    outline: none;
    border-color: var(--color-success);
}

.invalid {
    outline: none;
    border-color: var(--color-danger) !important;
    box-shadow: 0 0 0 3px var(--color-danger-bg) !important;
}

.validation-message {
    color: var(--color-danger);
    font-size: 0.8rem;
}

/* ============================================
   Blazor Error UI
   ============================================ */
.blazor-error-boundary {
    background: var(--color-danger);
    padding: 1rem 1rem 1rem 1.5rem;
    color: white;
    border-radius: var(--radius-md);
}

.blazor-error-boundary::after {
    content: "Something went wrong. Please try refreshing.";
}

/* ============================================
   Scrollbar
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-light);
}

/* ============================================
   Selection
   ============================================ */
::selection {
    background: var(--color-accent-light);
    color: var(--color-text);
}

/* ============================================
   Legacy compat (from template)
   ============================================ */
.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}