/* blogvlog - Premium Blog Platform Styles */

/* Press Start 2P Font */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

/* CSS Custom Properties - Premium Light Palette */
:root {
    --bg-dark: #f4f1eb;
    --bg-medium: #ffffff;
    --bg-light: #eae7e0;
    --text-primary: #1a1a2e;
    --text-secondary: #6b6b80;
    --accent-green: #2d6a4f;
    --accent-orange: #c77b3f;
    --accent-blue: #3a7ca5;
    --accent-pink: #c2556e;
    --accent-red: #c0392b;
    --pixel-size: 4px;
    --font-pixel: 'Press Start 2P', cursive;
    --font-body: 'Courier New', monospace;
    /* glass, the macOS 26+ material (light): only on things that float */
    --glass: rgba(255, 255, 255, 0.62);
    --glass-solid: rgba(255, 255, 255, 0.9);
    --blur: blur(24px) saturate(180%);
    --rim: inset 0 0.5px 0 rgba(255, 255, 255, 0.95), inset 0 0 0 0.5px rgba(0, 0, 0, 0.07);
    --drop: 0 10px 30px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
    --hair: inset 0 0 0 0.5px rgba(0, 0, 0, 0.07);
    color-scheme: light;
}

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

/* Base Styles */
html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

:focus-visible {
    outline: 2px solid var(--accent-orange);
    outline-offset: 2px;
}

/* Pixel Border Utility */
.pixel-border {
    border: var(--pixel-size) solid var(--accent-green);
    box-shadow:
        var(--pixel-size) var(--pixel-size) 0 var(--bg-dark),
        calc(var(--pixel-size) * 2) calc(var(--pixel-size) * 2) 0 var(--accent-green);
}

.pixel-border-orange {
    border-color: var(--accent-orange);
    box-shadow:
        var(--pixel-size) var(--pixel-size) 0 var(--bg-dark),
        calc(var(--pixel-size) * 2) calc(var(--pixel-size) * 2) 0 var(--accent-orange);
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
    position: relative;
    z-index: 1;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem;
}

header h1 {
    font-family: var(--font-pixel);
    font-size: 1.5rem;
    color: var(--accent-green);
    text-shadow:
        2px 2px 0 var(--accent-orange);
    margin-bottom: 0.5rem;
    letter-spacing: 2px;
}

header p {
    font-family: var(--font-pixel);
    font-size: 0.5rem;
    color: var(--text-secondary);
}

header .byline {
    font-family: var(--font-pixel);
    font-size: 0.45rem;
    color: var(--accent-orange);
    margin-top: 0.25rem;
    letter-spacing: 1px;
}

/* Navigation */
nav {
    display: flex;
    justify-content: center;
    gap: 2px;
    width: fit-content;
    margin: 1.5rem auto 0;
    padding: 4px;
    border-radius: 999px;
    background: var(--glass);
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
    box-shadow: var(--rim), var(--drop);
}

nav a {
    font-family: var(--font-pixel);
    font-size: 0.6rem;
    color: var(--text-primary);
    text-decoration: none;
    padding: 0.75rem 1.25rem;
    border-radius: 999px;
    transition: background-color 0.15s ease-out, color 0.15s ease-out, transform 0.15s ease-out;
}

nav a:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--accent-green);
}

nav a:active {
    transform: scale(0.97);
}

nav a[aria-current="page"] {
    background: rgba(45, 106, 79, 0.12);
    color: var(--accent-green);
    box-shadow: inset 0 0 0 0.5px rgba(45, 106, 79, 0.3);
}

/* Buttons */
.btn {
    font-family: var(--font-pixel);
    font-size: 0.7rem;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    background: var(--accent-green);
    color: #ffffff;
    box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.45), 0 4px 14px rgba(45, 106, 79, 0.25);
    transition: background-color 0.15s ease-out, transform 0.15s ease-out, box-shadow 0.15s ease-out;
    text-decoration: none;
    display: inline-block;
}

.btn:hover {
    background: var(--accent-orange);
    transform: translateY(-1px);
    box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.45), 0 6px 18px rgba(199, 123, 63, 0.3);
}

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

.btn-secondary {
    background: var(--bg-medium);
    color: var(--text-primary);
    box-shadow: var(--hair), inset 0 0 0 1.5px rgba(45, 106, 79, 0.45), 0 1px 3px rgba(0, 0, 0, 0.06);
}

.btn-secondary:hover {
    background: var(--bg-light);
    box-shadow: var(--hair), inset 0 0 0 1.5px var(--accent-orange), 0 4px 12px rgba(0, 0, 0, 0.08);
}

.btn-danger {
    background: var(--accent-red);
}

.btn-danger:hover {
    background: var(--accent-orange);
}

/* Form Elements */
input[type="text"],
input[type="password"],
textarea {
    font-family: var(--font-body);
    font-size: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-medium);
    border: 0;
    border-radius: 12px;
    box-shadow: inset 0 0 0 1.5px rgba(45, 106, 79, 0.5);
    color: var(--text-primary);
    width: 100%;
    outline: none;
    transition: box-shadow 0.15s ease-out;
}

input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus {
    box-shadow: inset 0 0 0 1.5px var(--accent-orange), 0 0 0 4px rgba(199, 123, 63, 0.2);
}

textarea {
    min-height: 200px;
    resize: vertical;
}

label {
    font-family: var(--font-pixel);
    font-size: 0.6rem;
    color: var(--accent-green);
    display: block;
    margin-bottom: 0.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

/* Post List */
.post-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.post-item {
    position: relative;
    background: var(--bg-medium);
    padding: 1.5rem;
    border-radius: 16px;
    cursor: pointer;
    transition: background-color 0.2s ease-out, transform 0.2s ease-out, box-shadow 0.2s ease-out;
    box-shadow: var(--hair), 0 1px 3px rgba(0, 0, 0, 0.06);
}

.post-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 1.25rem;
    bottom: 1.25rem;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: var(--accent-green);
    transition: background-color 0.2s ease-out;
}

.post-item:hover {
    background: var(--bg-light);
    transform: translateX(4px);
    box-shadow: var(--hair), 0 6px 18px rgba(0, 0, 0, 0.08);
}

.post-item:hover::before {
    background: var(--accent-orange);
}

.post-item h2 {
    font-family: var(--font-pixel);
    font-size: 0.75rem;
    color: var(--accent-green);
    margin-bottom: 0.5rem;
}

.post-item .post-date {
    font-family: var(--font-pixel);
    font-size: 0.5rem;
    color: var(--text-secondary);
}

.post-item .post-preview {
    margin-top: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Single Post */
.post-content {
    background: var(--bg-medium);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: var(--hair), 0 1px 3px rgba(0, 0, 0, 0.06);
}

.post-content h1 {
    font-family: var(--font-pixel);
    font-size: 1rem;
    color: var(--accent-green);
    margin-bottom: 0.5rem;
    line-height: 1.8;
}

.post-content .post-date {
    font-family: var(--font-pixel);
    font-size: 0.5rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    display: block;
}

.post-content .post-body {
    font-size: 1rem;
    line-height: 1.8;
    white-space: pre-wrap;
}

.post-content .post-body p {
    margin-bottom: 1rem;
}

/* Media Elements */
.post-media {
    margin: 2rem 0;
}

.post-media img,
.post-media video {
    max-width: 100%;
    height: auto;
    display: block;
    border: 2px solid var(--accent-green);
    border-radius: 12px;
}

.post-media audio {
    width: 100%;
    margin: 1rem 0;
}

.media-item {
    margin-bottom: 1.5rem;
}

/* Drop Zone */
.drop-zone {
    border: 3px dashed var(--accent-green);
    border-radius: 18px;
    padding: 3rem 2rem;
    text-align: center;
    background: var(--bg-medium);
    transition: all 0.2s;
    cursor: pointer;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--accent-orange);
    background: var(--bg-light);
}

.drop-zone p {
    font-family: var(--font-pixel);
    font-size: 0.6rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.drop-zone .drop-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}

/* Media Preview */
.media-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

.media-preview-item {
    position: relative;
    width: 120px;
    height: 120px;
    background: var(--bg-light);
    border: 2px solid var(--accent-green);
    border-radius: 12px;
    overflow: hidden;
}

.media-preview-item img,
.media-preview-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-preview-item .media-type-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 2rem;
}

.media-preview-item .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: var(--accent-red);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
}

.media-preview-item .remove-btn:hover {
    background: var(--accent-orange);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 46, 0.45);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--glass-solid);
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    border-radius: 26px;
    box-shadow: var(--rim), inset 0 0 0 1.5px rgba(45, 106, 79, 0.35), 0 30px 80px rgba(26, 26, 46, 0.3);
}

.modal-content h2 {
    font-family: var(--font-pixel);
    font-size: 0.8rem;
    color: var(--accent-green);
    margin-bottom: 1.5rem;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 20px;
    background: var(--bg-light);
    border: 2px solid var(--accent-green);
    border-radius: 999px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--accent-green);
    transition: width 0.3s;
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--bg-light);
    border-top-color: var(--accent-green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Blinking Cursor */
.blink {
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

/* Loading State */
.loading {
    text-align: center;
    padding: 3rem;
}

.loading p {
    font-family: var(--font-pixel);
    font-size: 0.7rem;
    color: var(--accent-green);
    margin-top: 1rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    background: var(--bg-medium);
    border-radius: 20px;
    box-shadow: var(--hair);
}

.empty-state p {
    font-family: var(--font-pixel);
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* Error State */
.error-state {
    text-align: center;
    padding: 2rem;
    background: var(--bg-medium);
    border-radius: 20px;
    box-shadow: var(--hair), inset 4px 0 0 var(--accent-red);
}

.error-state p {
    font-family: var(--font-pixel);
    font-size: 0.6rem;
    color: var(--accent-red);
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: var(--glass-solid);
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
    border: 1.5px solid var(--accent-green);
    border-radius: 18px;
    font-family: var(--font-pixel);
    font-size: 0.6rem;
    z-index: 1001;
    animation: slideIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: var(--rim), 0 14px 40px rgba(0, 0, 0, 0.14);
}

.toast.error {
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.toast.success {
    border-color: var(--accent-green);
    color: var(--accent-green);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Back Link */
.back-link {
    display: inline-block;
    font-family: var(--font-pixel);
    font-size: 0.6rem;
    color: var(--accent-green);
    text-decoration: none;
    margin-bottom: 1.5rem;
}

.back-link:hover {
    color: var(--accent-orange);
}

.back-link::before {
    content: '< ';
}

/* Admin Status */
.admin-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg-medium);
    margin-bottom: 2rem;
    font-family: var(--font-pixel);
    font-size: 0.5rem;
    border-radius: 999px;
    box-shadow: var(--hair), 0 1px 3px rgba(0, 0, 0, 0.06);
}

.admin-status .status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.admin-status .status-dot {
    width: 10px;
    height: 10px;
    background: var(--accent-red);
    border-radius: 50%;
}

.admin-status .status-dot.connected {
    background: var(--accent-green);
}

/* Footer */
.site-footer {
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 3rem;
    border-top: 0.5px solid rgba(0, 0, 0, 0.1);
}

.site-footer .footer-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.site-footer .footer-links a {
    font-family: var(--font-pixel);
    font-size: 0.45rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.site-footer .footer-links a:hover {
    color: var(--accent-green);
}

.site-footer .footer-links a svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

/* Side Panel Canvases */
.sidepanel-canvas {
    position: fixed;
    top: 0;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}

.sidepanel-canvas.left {
    left: 0;
}

.sidepanel-canvas.right {
    right: 0;
}

/* Responsive */
@media (max-width: 900px) {
    .sidepanel-canvas {
        display: none;
    }
}

@media (max-width: 600px) {
    header h1 {
        font-size: 1rem;
    }

    .container {
        padding: 1rem;
    }

    .post-content {
        padding: 1rem;
    }

    .btn {
        width: 100%;
        text-align: center;
    }

    .admin-status .btn {
        width: auto;
    }

    .media-preview-item {
        width: 80px;
        height: 80px;
    }
}

/* Reduce Transparency (System Settings > Accessibility > Display): solid surfaces, no blur */
@media (prefers-reduced-transparency: reduce) {
    :root {
        --glass: #ffffff;
        --glass-solid: #ffffff;
    }

    nav,
    .modal,
    .modal-content,
    .toast {
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .btn,
    nav a,
    .post-item,
    .post-item::before {
        transition: none;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
