@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;700&family=Space+Mono:wght@400;700&display=swap');

:root {
    --bg-color: #0a0a0a;
    --bg-elevated: #100f15;
    --text-color: #B388EE;
    --text-dim: #8866CC;
    --accent-color: #D4A5FF;
    --accent-dim: #B388EE;
    --error-color: #DD7777;
    --border-color: #221a2e;
    color-scheme: dark;
}

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

::selection {
    background-color: var(--accent-dim);
    color: var(--bg-color);
}

::-moz-selection {
    background-color: var(--accent-dim);
    color: var(--bg-color);
}

/* Force dark color scheme for form controls */
input, textarea, select, button {
    color-scheme: dark;
}

html {
    background-color: #0a0a0a;
    color-scheme: dark;
    font-size: 100%;
}

/* Custom Scrollbar Styling */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(179, 136, 238, 0.6) var(--bg-color);
}

/* WebKit browsers (Chrome, Safari, Edge) */
*::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

*::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-left: 1px solid var(--border-color);
}

*::-webkit-scrollbar-thumb {
    background: rgba(179, 136, 238, 0.6);
    border: 2px solid var(--bg-color);
    border-radius: 6px;
}

*::-webkit-scrollbar-thumb:hover {
    background: rgba(179, 136, 238, 0.7);
}

*::-webkit-scrollbar-thumb:active {
    background: rgba(179, 136, 238, 0.8);
}

*::-webkit-scrollbar-corner {
    background: var(--bg-color);
}

body {
    font-family: 'Space Grotesk', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.7;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    forced-color-adjust: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--accent-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.header-top {
    padding: 1.5rem 1rem 0.5rem;
}

.header-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.ascii-header {
    font-size: clamp(0.4rem, 2.4vw, 1rem);
    line-height: 1.15;
    color: var(--text-color);
    text-align: center;
    white-space: pre;
    overflow: hidden;
    margin-bottom: 0;
    padding-bottom: 0.5rem;
    font-weight: 700;
}

.ascii-header a {
    color: inherit;
    text-decoration: none;
}

.ascii-header a:hover {
    text-decoration: none;
    color: var(--accent-color);
}

main {
    flex: 1;
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
    width: 100%;
}

/* Login page */
.login-page {
    flex-direction: column;
}

.login-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem;
}

.login-form {
    margin-top: 3rem;
    width: 100%;
    max-width: 600px;
}

.terminal-input-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 2rem;
}

.terminal-input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-color);
    font-family: 'Space Mono', monospace;
    font-size: 1.1rem;
    padding: 0;
    text-align: center;
    width: 100%;
    letter-spacing: 0.3em;
    text-security: disc;
    -webkit-text-security: disc;
    -moz-text-security: disc;
    caret-color: var(--text-color);
}

.terminal-input::placeholder {
    color: transparent;
}

.terminal-cursor {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    color: var(--text-color);
    opacity: 0.3;
    pointer-events: none;
    font-family: 'Space Mono', monospace;
    font-size: 1.1rem;
    letter-spacing: 0.2em;
}

.login-error-container {
    margin-top: 2rem;
    text-align: center;
    min-height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-error {
    font-size: 0.9rem;
    color: var(--error-color);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: translateY(-10px);
    font-family: 'Space Mono', monospace;
    font-weight: 400;
}

.login-error.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Flash messages */
.flash-messages {
    margin-bottom: 1.5rem;
}

.flash {
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    text-align: center;
    font-size: 0.875rem;
    opacity: 0;
    transition: opacity 0.3s;
}

.flash.visible {
    opacity: 1;
}

.flash-error {
    color: var(--error-color);
}

.flash-success {
    color: var(--accent-color);
}

/* Posts list */
.posts-list {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

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

.post-preview h2 a {
    color: var(--accent-color);
    text-decoration: none;
}

.post-preview h2 a:hover {
    text-decoration: underline;
}

.post-meta {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 1.5rem;
    letter-spacing: 0.08em;
}

.post-meta .separator {
    margin: 0 0.75rem;
    opacity: 0.5;
}

.post-excerpt {
    color: var(--text-dim);
    max-height: 10em;
    overflow: clip;
    position: relative;
    line-height: 1.7;
    font-size: 1.1rem;
    text-align: left;
    text-wrap: pretty;
    hyphens: auto;
    word-spacing: 0.1em;
}

.post-excerpt p {
    margin-bottom: 0.5rem;
}

.post-excerpt::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4em;
    background: linear-gradient(transparent, var(--bg-color));
}

.no-posts {
    color: var(--text-dim);
    text-align: center;
    padding: 2rem;
}

/* Single post */
.post-full {
    margin-bottom: 2rem;
}

.post-header {
    margin-bottom: 2rem;
    text-align: center;
}

.post-header h1,
.post-preview h1 {
    color: var(--accent-color);
    margin-bottom: 1rem;
    font-size: 2rem;
}

.post-excerpt h1 {
    color: var(--text-dim);
}

.post-header .post-meta {
    margin-bottom: 0;
}

.post-content {
    margin-bottom: 2rem;
    line-height: 1.7;
    font-size: 1.1rem;
    margin-left: auto;
    margin-right: auto;
    text-wrap: pretty;
    hyphens: auto;
    word-spacing: 0.1em;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
    color: var(--accent-color);
    margin: 2rem 0 1.25rem;
    line-height: 1.4;
}

.post-content h1,
.post-excerpt h1 {
    font-size: 1.6rem;
}

.post-content h2,
.post-excerpt h2 {
    font-size: 1.4rem;
}

.post-content h3,
.post-excerpt h3 {
    font-size: 1.3rem;
}

.post-content h4,
.post-excerpt h4 {
    font-size: 1.25rem;
}

.post-excerpt h1,
.post-excerpt h2,
.post-excerpt h3,
.post-excerpt h4 {
    margin: 2rem 0 1.25rem;
    line-height: 1.4;
}

.post-content p {
    margin-bottom: 1.5rem;
    text-wrap: pretty;
}

.post-content a {
    color: var(--accent-color);
}

.post-content .video-download {
    position: absolute;
    right: 40px;
}

.post-content .audio-download {
    position: absolute;
    right: 0;
}

.post-content code {
    font-family: 'Space Mono', monospace;
    background-color: var(--bg-elevated);
    padding: 0.15rem 0.4rem;
    font-size: 0.95em;
    color: var(--accent-color);
}

.post-content pre {
    background-color: var(--bg-elevated);
    padding: 1rem;
    overflow-x: auto;
    margin: 1rem 0;
}

.post-content pre code {
    font-family: 'Space Mono', monospace;
    padding: 0;
    background: none;
    color: var(--text-color);
}

.post-content img {
    max-width: 100%;
    height: auto;
    margin: 1rem 0;
}

/* Shared Media Player Styles */
/* Progress bar styles shared by audio and video players */
.media-progress {
    flex: 1;
    height: 30px;
    cursor: pointer;
    position: relative;
    touch-action: none;
    display: flex;
    align-items: center;
}

.media-progress::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 6px;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 3px;
}

.media-progress-bar {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 6px;
    background-color: var(--accent-color);
    width: 0%;
    pointer-events: none;
    z-index: 1;
    border-radius: 3px;
}

.media-progress::after {
    content: '';
    position: absolute;
    left: var(--progress-percent, 0%);
    top: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background-color: var(--accent-color);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    z-index: 2;
}

.media-progress:hover::after {
    opacity: 1;
}

/* Volume track styles shared by audio and video players */
.media-volume-track::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 6px;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    pointer-events: none;
    border-radius: 3px;
}

.media-volume-bar {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 6px;
    background-color: var(--accent-color);
    width: 100%;
    pointer-events: none;
    z-index: 1;
    border-radius: 3px;
}

.media-volume-track::after {
    content: '';
    position: absolute;
    left: var(--volume-percent, 100%);
    top: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background-color: var(--accent-color);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    z-index: 3;
}

.media-volume-track:hover::after {
    opacity: 1;
}

/* Volume slider styles shared by audio and video players */
.media-volume-slider {
    position: relative;
    width: 100%;
    height: 100%;
    background: transparent;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    z-index: 2;
}

.media-volume-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 100%;
    background: transparent;
}

.media-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 1px;
    height: 1px;
    background: transparent;
}

.media-volume-slider::-moz-range-track {
    width: 100%;
    height: 100%;
    background: transparent;
}

.media-volume-slider::-moz-range-thumb {
    width: 1px;
    height: 1px;
    background: transparent;
    border: none;
}

/* Custom Audio Player */
.post-content audio {
    display: none;
}

.audio-player {
    width: 100%;
    margin: 2rem 0;
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 1.5rem;
    row-gap: 0.75rem;
    align-items: start;
    grid-auto-flow: dense;
}

.audio-player-info {
    grid-column: 2;
    grid-row: 1;
}

.audio-controls {
    grid-column: 2;
    grid-row: 2;
}

.audio-album-art {
    grid-column: 1;
    grid-row: 1 / -1;
}

.audio-player-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 0;
}

.audio-album-art {
    aspect-ratio: 1;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    overflow: hidden;
    align-self: start;
    justify-self: start;
    min-height: 100%;
    height: 0;
}

.audio-album-art[style*="display: none"] {
    display: none !important;
    width: 0;
    margin: 0;
}

.audio-album-art a {
    display: block;
    width: 100%;
    height: 100%;
    line-height: 0;
    cursor: pointer;
}

.audio-album-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    margin: 0;
    transition: opacity 0.2s ease;
}

.audio-album-art:hover {
    border-color: var(--accent-dim);
    box-shadow: 0 0 8px rgba(179, 136, 238, 0.2);
}

.audio-album-art:hover img {
    opacity: 0.85;
}

.audio-title {
    color: var(--accent-color);
    font-size: 1.05rem;
    margin-bottom: 0.25rem;
    font-weight: 700;
    font-family: 'Space Mono', monospace;
}

.audio-artist {
    color: var(--text-dim);
    font-size: 0.9rem;
    font-family: 'Space Mono', monospace;
}

.audio-controls {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.audio-progress-container {
    width: 100%;
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
}

.audio-time {
    color: var(--text-dim);
    font-size: 0.75rem;
    white-space: nowrap;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    font-family: 'Space Mono', monospace;
}

.audio-buttons {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    position: relative;
}

.audio-button span {
    display: flex;
    align-items: center;
    justify-content: center;
}

.audio-play-pause {
    width: 32px !important;
    height: 32px !important;
}

.audio-volume-container {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    max-width: 120px;
    flex: 1;
    position: absolute;
    left: 0;
}

.audio-volume-track {
    position: relative;
    flex: 1;
    height: 30px;
    display: flex;
    align-items: center;
}

/* Hide volume slider on all screens - show on hover/interaction */
.audio-volume-container {
    position: absolute;
    left: 0;
    max-width: 30px;
    transition: max-width 0.2s ease 0.3s;
    overflow: visible;
}

.audio-volume-container:hover,
.audio-volume-container:focus-within,
.audio-volume-container:active,
.audio-volume-container.volume-revealed {
    max-width: 100px;
    transition: max-width 0.15s ease;
}

.audio-volume-track {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease 0.3s, width 0s ease 0.45s;
    width: 0;
}

.audio-volume-container:hover .audio-volume-track,
.audio-volume-container:has(.audio-volume:focus) .audio-volume-track,
.audio-volume-container:active .audio-volume-track,
.audio-volume-container.volume-revealed .audio-volume-track {
    opacity: 1;
    pointer-events: auto;
    width: auto;
    transition: opacity 0.15s ease, width 0s;
}

/* Keep slider visible when actively being used */
.audio-volume:active ~ .audio-volume-track,
.audio-volume:focus ~ .audio-volume-track {
    opacity: 1;
    pointer-events: auto;
}

/* Hide all visual elements on collapsed slider */
.audio-volume-track::before,
.audio-volume-track::after,
.audio-volume-bar {
    display: none;
}

.audio-volume-container:hover .audio-volume-track::before,
.audio-volume-container:has(.audio-volume:focus) .audio-volume-track::before,
.audio-volume-container:active .audio-volume-track::before,
.audio-volume-container.volume-revealed .audio-volume-track::before,
.audio-volume-container:hover .audio-volume-track::after,
.audio-volume-container:has(.audio-volume:focus) .audio-volume-track::after,
.audio-volume-container:active .audio-volume-track::after,
.audio-volume-container.volume-revealed .audio-volume-track::after,
.audio-volume-container:hover .audio-volume-bar,
.audio-volume-container:has(.audio-volume:focus) .audio-volume-bar,
.audio-volume-container:active .audio-volume-bar,
.audio-volume-container.volume-revealed .audio-volume-bar {
    display: block;
}

/* Adjust layout for smaller screens */
@media (max-width: 600px) {
    .audio-player {
        display: flex;
        flex-wrap: wrap;
        gap: 0;
        align-items: flex-start;
    }

    .audio-album-art {
        width: 60px;
        height: 60px;
        aspect-ratio: 1;
        flex-shrink: 0;
        margin-right: 1rem;
    }

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

    .audio-metadata {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
        min-width: 0;
        justify-content: center;
    }

    .audio-title,
    .audio-artist {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .audio-controls {
        width: 100%;
        flex-basis: 100%;
        margin-top: 1rem;
    }
}

/* Audio Lyrics Display */
.audio-player:has(+ .audio-lyrics-container) {
    margin-bottom: 0;
}

.audio-lyrics-container {
    margin-top: -1px;
    margin-bottom: 2rem;
    background: #0a0a0a;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.audio-lyrics-content {
    height: 195px;
    overflow-y: auto;
    padding: 1rem 1.5rem;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.1rem;
    line-height: 1.7;
    text-align: center;
    position: relative;
}

@media (min-width: 900px) {
    .audio-lyrics-content {
        overscroll-behavior: contain;
    }
}

.audio-lyrics-line {
    color: var(--text-dim);
    padding: 0.25rem 0;
    transition: all 0.3s ease;
}

.audio-lyrics-line.active {
    color: var(--accent-color);
    font-weight: 700;
}

.audio-lyrics-line.lyrics-placeholder {
    color: var(--text-dim);
    font-style: italic;
}

/* Mobile adjustments for lyrics */
@media (max-width: 600px) {
    .audio-lyrics-content {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }
}

/* Custom Video Player */
.post-content video {
    display: none;
}

.video-player {
    width: fit-content;
    max-width: 100%;
    margin: 2rem auto;
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: hidden;
}

.video-player-screen {
    width: fit-content;
    background-color: var(--bg-color);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.video-player-fullscreen-wrapper .video-player-screen {
    position: relative;
}

.video-player-fullscreen-wrapper:not(.is-fullscreen) .video-player-screen video {
    max-height: 800px;
}

.video-player-screen video {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    cursor: pointer;
}

.video-player-title {
    padding: 0.75rem 1.5rem;
    color: var(--accent-color);
    font-size: 0.9rem;
    font-weight: 700;
    font-family: 'Space Mono', monospace;
    border-bottom: 1px solid var(--border-color);
}

.video-controls {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.80) 20%, rgba(0, 0, 0, 0.70) 40%, rgba(0, 0, 0, 0.55) 60%, rgba(0, 0, 0, 0.35) 75%, rgba(0, 0, 0, 0.15) 90%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 10;
    cursor: pointer;
}

.video-controls.active {
    opacity: 1;
    pointer-events: auto;
}

.video-progress-container {
    width: 100%;
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
}

.video-time {
    color: var(--text-dim);
    font-size: 0.75rem;
    white-space: nowrap;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    font-family: 'Space Mono', monospace;
}

.video-buttons {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    position: relative;
}

.video-button span {
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-play-pause {
    width: 32px !important;
    height: 32px !important;
}

.video-play-pause span {
    pointer-events: none;
}

.video-play-pause svg {
    pointer-events: none;
}

.video-fullscreen {
    position: absolute;
    right: 0;
}

.video-volume-container {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    max-width: 120px;
    flex: 1;
    position: absolute;
    left: 0;
}

.video-volume-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.video-volume-track {
    position: relative;
    flex: 1;
    height: 30px;
    display: flex;
    align-items: center;
}

/* Hide volume slider on all screens - show on hover/interaction */
.video-volume-container {
    position: absolute;
    left: 0;
    max-width: 30px;
    transition: max-width 0.2s ease 0.3s;
    overflow: visible;
}

.video-volume-container:hover,
.video-volume-container:focus-within,
.video-volume-container:active,
.video-volume-container.volume-revealed {
    max-width: 100px;
    transition: max-width 0.15s ease;
}

.video-volume-track {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease 0.3s, width 0s ease 0.45s;
    width: 0;
}

.video-volume-container:hover .video-volume-track,
.video-volume-container:has(.video-volume:focus) .video-volume-track,
.video-volume-container:active .video-volume-track,
.video-volume-container.volume-revealed .video-volume-track {
    opacity: 1;
    pointer-events: auto;
    width: auto;
    transition: opacity 0.15s ease, width 0s;
}

/* Keep slider visible when actively being used */
.video-volume:active ~ .video-volume-track,
.video-volume:focus ~ .video-volume-track {
    opacity: 1;
    pointer-events: auto;
}

/* Hide all visual elements on collapsed slider */
.video-volume-track::before,
.video-volume-track::after,
.video-volume-bar {
    display: none;
}

.video-volume-container:hover .video-volume-track::before,
.video-volume-container:has(.video-volume:focus) .video-volume-track::before,
.video-volume-container:active .video-volume-track::before,
.video-volume-container.volume-revealed .video-volume-track::before,
.video-volume-container:hover .video-volume-track::after,
.video-volume-container:has(.video-volume:focus) .video-volume-track::after,
.video-volume-container:active .video-volume-track::after,
.video-volume-container.volume-revealed .video-volume-track::after,
.video-volume-container:hover .video-volume-bar,
.video-volume-container:has(.video-volume:focus) .video-volume-bar,
.video-volume-container:active .video-volume-bar,
.video-volume-container.volume-revealed .video-volume-bar {
    display: block;
}

/* Fullscreen wrapper */
.video-player-fullscreen-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    position: relative;
    max-height: 800px;
    overflow: hidden;
}

/* Fullscreen styles */
.video-player-fullscreen-wrapper.is-fullscreen {
    width: 100vw;
    height: 100vh;
    max-height: none;
    background: black;
    position: relative;
}

/* Video screen takes full space in fullscreen */
.video-player-fullscreen-wrapper.is-fullscreen .video-player-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.video-player-fullscreen-wrapper.is-fullscreen .video-player-screen video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Position controls at bottom in fullscreen - overlay on video */
.video-player-fullscreen-wrapper.is-fullscreen .video-controls {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.90) 0%, rgba(0, 0, 0, 0.85) 20%, rgba(0, 0, 0, 0.75) 40%, rgba(0, 0, 0, 0.60) 60%, rgba(0, 0, 0, 0.40) 75%, rgba(0, 0, 0, 0.20) 90%, transparent 100%);
}

.post-content blockquote {
    border-left: 2px solid var(--accent-color);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--text-dim);
    text-wrap: pretty;
}

.post-content ul,
.post-content ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

.post-content li {
    margin-bottom: 0.5rem;
}

/* Base button styles - consolidated common properties */
.button,
.post-content .button {
    background: transparent;
    border: none;
    cursor: pointer;
    transition: color 0.2s;
    flex-shrink: 0;
    padding: 0;
    margin: 0;
    line-height: 1;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
}

.button:hover,
.post-content .button:hover {
    color: var(--accent-color);
}

.button:active,
.post-content .button:active {
    color: var(--accent-color);
}

/* Prevent stuck focus state on mobile after tap, but keep active state */
@media (hover: none) and (pointer: coarse) {
    .button:focus:not(:active),
    .post-content .button:focus:not(:active) {
        color: var(--text-dim);
    }
}

/* SVG color inheritance from button */
.button svg,
.post-content .button svg {
    color: inherit;
    transition: color 0.2s;
}

/* Specific button type: bordered button with fill on hover */
.button-bordered {
    padding: 0.5rem 1.5rem;
    font-family: inherit;
    font-size: 0.875rem;
    background-color: transparent;
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    transition: all 0.2s;
}

.button-bordered:hover {
    background-color: var(--accent-color);
    color: var(--bg-color);
}

.button-bordered:active {
    background-color: var(--accent-color);
    color: var(--bg-color);
}

@media (hover: none) and (pointer: coarse) {
    .button-bordered:focus:not(:active) {
        background-color: transparent;
        color: var(--accent-color);
    }
}

/* Comments */
.comments {
    margin-top: 3rem;
    padding-top: 2rem;
}

.comments h2 {
    margin-bottom: 1.5rem;
    color: var(--accent-color);
    text-align: center;
}

.comment {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: var(--bg-elevated);
}

.comment-header {
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.comment-author {
    color: var(--accent-color);
    font-weight: bold;
}

.comment-date {
    color: var(--text-dim);
}

.comment-content {
    white-space: pre-wrap;
    color: var(--text-color);
    line-height: 1.7;
}

.comment-form {
    margin-top: 2rem;
}

.comment-form h3 {
    margin-bottom: 1rem;
    color: var(--text-color);
    text-align: center;
}

.comment-form textarea {
    width: 100%;
    padding: 0.75rem;
    font-family: inherit;
    font-size: 1rem;
    background-color: var(--bg-elevated);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    resize: vertical;
    min-height: 100px;
}

.comment-form textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}

.comment-form textarea::placeholder {
    color: var(--text-dim);
    opacity: 0.5;
}

.comment-form textarea:invalid:not(:focus):not(:placeholder-shown) {
    border-color: var(--error-color);
}

.comment-form .form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
}

.comment-form .form-messages {
    min-height: 2rem;
    display: flex;
    align-items: center;
    position: relative;
    flex: 1;
}

.comment-form .form-message,
.comment-form .form-error {
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: translateY(-10px);
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    position: absolute;
    left: 0;
}

.comment-form .form-message {
    color: var(--accent-color);
}

.comment-form .form-error {
    color: var(--error-color);
}

.comment-form .form-message.visible,
.comment-form .form-error.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Error page */
.error-page {
    text-align: center;
    padding: 4rem 1rem;
    font-family: 'Space Mono', monospace;
}

.error-page h1 {
    font-size: 4rem;
    color: var(--accent-color);
    margin-bottom: 1rem;
}

.error-page p {
    margin-bottom: 2rem;
    color: var(--text-dim);
}

/* Footer */
footer {
    padding: 1.5rem 1rem;
    text-align: center;
    color: var(--text-dim);
    font-size: 0.75rem;
    font-family: 'Space Mono', monospace;
}

footer a {
    color: var(--text-dim);
}

footer a:hover {
    color: var(--accent-color);
}

/* Image Gallery */
.gallery-wrapper {
    width: 100%;
    margin: 2rem 0;
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-color);
    padding: 0 1.5rem 1.5rem 1.5rem;
}

.gallery-wrapper:has(.gallery-title) {
    padding-top: 0;
}

.gallery-wrapper:not(:has(.gallery-title)) {
    padding-top: 1.5rem;
}

/* Single image gallery: no padding, fit width to content */
.gallery-wrapper:has(.gallery-item:only-child) {
    padding: 0;
    width: fit-content;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    border: none;
}

.gallery-wrapper:has(.gallery-item:only-child) .gallery-title {
    padding: 0.75rem 1.5rem;
    margin: 0;
    border-top: 1px solid var(--border-color);
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
}

.gallery-title {
    padding: 0.75rem 1.5rem;
    margin: 0 -1.5rem 1.5rem -1.5rem;
    color: var(--accent-color);
    font-size: 0.9rem;
    font-weight: 700;
    font-family: 'Space Mono', monospace;
}

.gallery-wrapper:not(:has(.gallery-item:only-child)) .gallery-title {
    border-bottom: 1px solid var(--border-color);
}

.image-gallery {
    display: grid;
    gap: 1.25rem;
}

/* Dynamic rows based on data-rows attribute */
.image-gallery[data-rows="1"] {
    grid-template-columns: repeat(1, 1fr);
    place-items: center;
}

.image-gallery[data-rows="2"] {
    grid-template-columns: repeat(2, 1fr);
    place-items: center;
}

.image-gallery[data-rows="3"] {
    grid-template-columns: repeat(3, 1fr);
    place-items: center;
}

.image-gallery[data-rows="4"] {
    grid-template-columns: repeat(4, 1fr);
    place-items: center;
}

.image-gallery[data-rows="5"] {
    grid-template-columns: repeat(5, 1fr);
    place-items: center;
}

.image-gallery[data-rows="6"] {
    grid-template-columns: repeat(6, 1fr);
    place-items: center;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    margin: 0;
    padding: 0;
}

.gallery-item:hover {
    border-color: var(--accent-dim);
    box-shadow: 0 0 8px rgba(179, 136, 238, 0.2);
}

.gallery-item a {
    display: block;
    line-height: 0;
    margin: 0;
    padding: 0;
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    cursor: pointer;
    transition: opacity 0.2s ease;
    margin: 0;
    padding: 0;
}

/* Grid layouts with 2+ rows: square items with cropped images */
.image-gallery[data-rows="2"] .gallery-item,
.image-gallery[data-rows="3"] .gallery-item,
.image-gallery[data-rows="4"] .gallery-item,
.image-gallery[data-rows="5"] .gallery-item,
.image-gallery[data-rows="6"] .gallery-item {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
}

.image-gallery[data-rows="2"] .gallery-item a,
.image-gallery[data-rows="3"] .gallery-item a,
.image-gallery[data-rows="4"] .gallery-item a,
.image-gallery[data-rows="5"] .gallery-item a,
.image-gallery[data-rows="6"] .gallery-item a {
    width: 100%;
    height: 100%;
}

.image-gallery[data-rows="2"] .gallery-item img,
.image-gallery[data-rows="3"] .gallery-item img,
.image-gallery[data-rows="4"] .gallery-item img,
.image-gallery[data-rows="5"] .gallery-item img,
.image-gallery[data-rows="6"] .gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* For single column: use natural aspect ratio and fit content */
.image-gallery[data-rows="1"] .gallery-item {
    aspect-ratio: auto;
    width: fit-content;
    height: fit-content;
}

.image-gallery[data-rows="1"] .gallery-item img {
    height: auto;
    object-fit: contain;
}

/* Single image in gallery: max height 800px, width fits image */
.image-gallery .gallery-item:only-child {
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
}

.image-gallery .gallery-item:only-child img {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 800px;
}

.gallery-item:hover img {
    opacity: 0.85;
}

/* Mobile: Force 1 column on small screens */
@media (max-width: 600px) {
    .image-gallery[data-rows="2"],
    .image-gallery[data-rows="3"],
    .image-gallery[data-rows="4"],
    .image-gallery[data-rows="5"],
    .image-gallery[data-rows="6"] {
        grid-template-columns: repeat(1, 1fr);
    }

    /* Switch to natural aspect ratio on mobile */
    .image-gallery[data-rows="2"] .gallery-item,
    .image-gallery[data-rows="3"] .gallery-item,
    .image-gallery[data-rows="4"] .gallery-item,
    .image-gallery[data-rows="5"] .gallery-item,
    .image-gallery[data-rows="6"] .gallery-item {
        width: fit-content;
        height: fit-content;
        aspect-ratio: auto;
    }

    .image-gallery[data-rows="2"] .gallery-item a,
    .image-gallery[data-rows="3"] .gallery-item a,
    .image-gallery[data-rows="4"] .gallery-item a,
    .image-gallery[data-rows="5"] .gallery-item a,
    .image-gallery[data-rows="6"] .gallery-item a {
        width: auto;
        height: auto;
    }

    .image-gallery[data-rows="2"] .gallery-item img,
    .image-gallery[data-rows="3"] .gallery-item img,
    .image-gallery[data-rows="4"] .gallery-item img,
    .image-gallery[data-rows="5"] .gallery-item img,
    .image-gallery[data-rows="6"] .gallery-item img {
        width: 100%;
        height: auto;
        object-fit: contain;
    }
}

/* Tablet: Reduce columns */
@media (min-width: 601px) and (max-width: 900px) {
    .image-gallery[data-rows="4"],
    .image-gallery[data-rows="5"],
    .image-gallery[data-rows="6"] {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* GLightbox Custom Styling */
.gclose svg,
.gnext svg,
.gprev svg {
    filter: invert(1) invert(85%) sepia(13%) saturate(1547%) hue-rotate(215deg) brightness(105%) contrast(89%);
}

.gclose:hover svg,
.gnext:hover svg,
.gprev:hover svg {
    filter: invert(1) invert(95%) sepia(13%) saturate(1547%) hue-rotate(215deg) brightness(110%) contrast(89%);
}

/* Footnotes Styling */
.post-content sup {
    line-height: 0;
    vertical-align: baseline;
    position: relative;
    top: -0.5em;
    font-size: 0.75em;
}

.footnote {
    border-top: 1px solid var(--border-color);
    margin-top: 3rem;
    padding-top: 1.5rem;
    font-size: 0.9em;
}

.footnote hr {
    display: none;
}

.footnote ol {
    padding-left: 1.5rem;
    margin: 0;
}

.footnote li {
    margin-bottom: 0.5rem;
    color: var(--text-dim);
    transition: color 0.6s ease-out;
}

.footnote li.highlight {
    color: var(--accent-color);
}

.footnote li p {
    margin: 0;
    display: inline;
}

.footnote-ref {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: bold;
    padding: 0 0.2em;
}

.footnote-ref:hover {
    color: var(--accent-dim);
    text-decoration: underline;
}

.footnote-backref {
    color: var(--accent-color);
    text-decoration: none;
    margin-left: 0.5em;
}

.footnote-backref:hover {
    color: var(--accent-dim);
    text-decoration: underline;
}

/* Easter Egg - Login Page */
.easter-egg-trigger {
    cursor: default;
    transition: color 0.3s ease;
    display: inline;
    font: inherit;
    letter-spacing: inherit;
    line-height: inherit;
}

.easter-egg-trigger:hover {
    color: var(--accent-color);
}

.ascii-header.visualizing {
    overflow: visible;
}

.login-container {
    overflow: visible;
}

.login-page {
    overflow: visible;
}
