/* æthera Branding - Cyberpunk Schematic Aesthetic
 * Palette derived from banner.png circuit schematic art
 * Dark theme optimized for the crimson-accented technical imagery
 */

/* ============================================
   Custom Fonts
   ============================================ */
@font-face {
    font-family: 'Libertinus Mono';
    src: url('/static/fonts/LibertinusMono-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* ============================================
   CSS Custom Properties (Design Tokens)
   ============================================ */
:root {
    /* Backgrounds - pure black */
    --bg: #000000;
    --bg-soft: #0a0a0a;
    --bg-elevated: #111111;

    /* Text - white */
    --text: #ffffff;
    --text-muted: #888888;

    /* Accent - neutral for now, will add color later */
    --accent: #ffffff;
    --accent-hover: #cccccc;
    --accent-soft: #1a1a1a;

    /* Code/Technical elements */
    --code-bg: #0a0a0a;
    --border-color: #222222;

    /* Disabled for now */
    --circuit-line: transparent;
}

/* ============================================
   Tailwind-style Utility Classes
   (Since we're using prebuilt Tailwind)
   ============================================ */

/* Background utilities */
.bg-bg { background-color: var(--bg) !important; }
.bg-bg-soft { background-color: var(--bg-soft) !important; }
.bg-bg-elevated { background-color: var(--bg-elevated) !important; }

/* Visibility utilities */
.hidden { display: none !important; }

/* Text utilities */
.text-text { color: var(--text) !important; }
.text-text-muted { color: var(--text-muted) !important; }
.text-accent { color: var(--accent) !important; }

/* Border utilities */
.border-accent-soft { border-color: var(--accent-soft) !important; }

/* ============================================
   Base Styles
   ============================================ */
html {
    scroll-behavior: smooth;
    background-color: transparent;
    overflow-x: hidden;
    scrollbar-width: none; /* Firefox */
}

html::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
}

header {
    overflow: visible;
}

html {
    height: 100%;
}

body {
    background-color: transparent !important;
    color: var(--text) !important;
    font-family: "Libertinus Mono", "JetBrains Mono", "Fira Code", monospace;
    line-height: 1.7;
    font-size: 17px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.01em;
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

/* Animated video background */
.video-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    z-index: -1;
    pointer-events: none;
}


/* ============================================
   Typography
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-family: "Libertinus Mono", "JetBrains Mono", "Fira Code", monospace;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text);
}

h1 { font-size: 2.25rem; margin-top: 0; margin-bottom: 1rem; }
h2 { font-size: 1.75rem; margin-top: 1.5rem; margin-bottom: 1rem; }
h3 { font-size: 1.375rem; margin-top: 1.5rem; margin-bottom: 1rem; }

/* ============================================
   Links
   ============================================ */
a {
    color: var(--text);
    text-decoration: none;
}

a:hover, a:focus {
    color: var(--text-muted);
}

/* ============================================
   Header
   ============================================ */

/* Header content container */
.header-content {
    width: 100%;
    max-width: 64rem;
    margin: 0 auto;
    padding: 1rem;
    padding-top: 0.5rem;
    box-sizing: border-box;
    background: transparent;
    border: none;
    text-align: center;
    position: relative;
}

/* Logo container with caustics canvas */
.logo-container {
    position: relative;
    display: inline-block;
    width: 28rem;
    height: 6rem;
}

#caustics-canvas {
    position: absolute;
    top: -8rem;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 20rem;
    pointer-events: none;
}

@media (min-width: 1024px) {
    .header-content {
        max-width: 70rem;
    }
}

/* Site Logo */
.site-logo {
    display: block;
    position: absolute;
    top: 0.5rem;
    left: 50%;
    transform: translateX(-50%);
}

.site-logo-img {
    height: 48px;
    width: auto;
    display: block;
    filter: brightness(0) invert(0);
}

@media (min-width: 640px) {
    .site-logo-img {
        height: 56px;
    }
}

@media (min-width: 1024px) {
    .site-logo-img {
        height: 64px;
    }
}

/* ============================================
   Main Content Area
   ============================================ */
main {
    width: 100%;
    max-width: 64rem;
    margin: 0 auto;
    padding: 0;
    padding-bottom: 2rem;
    flex: 1;
    box-sizing: border-box;
    background: transparent;
    border: none;
    overflow: visible;
}

/* Ensure content doesn't overflow on mobile */
.post-content, .prose {
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.post-content p, .prose p {
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Force horizontal scroll on any overflow elements */
article {
    max-width: 100%;
    overflow-x: auto;
}


@media (min-width: 1024px) {
    main {
        max-width: 70rem;
    }
}

/* ============================================
   Post Content (Prose)
   ============================================ */
.post-content, .prose {
    color: var(--text);
}

.post-content p, .prose p {
    margin-top: 0;
    margin-bottom: 1rem;
}

.post-content strong, .prose strong {
    color: var(--text);
    font-weight: 700;
}

.post-content em, .prose em {
    font-style: italic;
}

.post-content ul, .post-content ol,
.prose ul, .prose ol {
    margin: 0 0 1rem 1.5rem !important;
    padding: 0;
}

.post-content li, .prose li {
    margin-bottom: 0.5rem;
    margin-top: 1rem;
}

article.post-body .post-content ul,
article.post-body .post-content ol {
    color: #000;
}

article.post-body .post-content ul {
    list-style-type: disc;
}

article.post-body .post-content ol {
    list-style-type: decimal;
}

article.post-body .post-content li::marker {
    color: #000;
}

.post-content blockquote, .prose blockquote {
    border-left: 3px solid var(--accent);
    margin: 1rem 0;
    color: var(--text-muted);
    font-style: italic;
    background: var(--bg-soft);
    padding: 1rem 1.25rem;
    border-radius: 0;
}

.post-content hr, .prose hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 2rem 0;
}

/* Tables */
.post-content table, .prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9em;
}

.post-content th, .prose th,
.post-content td, .prose td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border: 1px solid var(--border-color);
}

.post-content th, .prose th {
    font-weight: 700;
    background-color: var(--bg-soft);
}

.post-content tr:nth-child(even), .prose tr:nth-child(even) {
    background-color: var(--bg-soft);
}

/* Tables inside post body (light theme) */
article.post-body table {
    border-color: #ccc;
}

article.post-body th,
article.post-body td {
    border-color: #ccc;
}

article.post-body th {
    background-color: rgba(0,0,0,0.05);
}

article.post-body tr:nth-child(even) {
    background-color: rgba(0,0,0,0.02);
}

/* ============================================
   Code Blocks
   ============================================ */
pre, code {
    font-family: "Libertinus Mono", "JetBrains Mono", "Fira Code", "Source Code Pro", monospace;
    font-size: 0.9em;
}

code {
    background-color: var(--code-bg);
    color: #dcdcff;
    padding: 0.15em 0.4em;
    border-radius: 0;
    word-break: break-word;
}

pre {
    background-color: var(--code-bg) !important;
    color: #dcdcff;
    padding: 0.75rem 1rem;
    overflow-x: auto;
    border-radius: 0;
    border: 1px solid var(--border-color);
    margin: 1rem 0;
    max-width: 100%;
    white-space: pre-wrap;
    word-wrap: break-word;
}

pre code.hljs {
    background: transparent !important;
    padding: 0 !important;
    margin: 0;
}

.hljs {
    background: transparent !important;
    padding: 0 !important;
}

@media (max-width: 640px) {
    pre {
        padding: 1rem;
        font-size: 0.8em;
    }
}

pre code {
    background: none;
    padding: 0;
    word-break: normal;
}

/* ============================================
   Tags
   ============================================ */
.post-content + div span,
article header span[class*="bg-accent"] {
    font-size: 0.8rem;
    padding: 0.25rem 0.75rem;
    background-color: var(--accent-soft);
    color: var(--text-muted);
    border-radius: 3px;
    font-family: "Libertinus Mono", monospace;
}

/* ============================================
   Comments Section
   ============================================ */
   
/* Circuit-box styling - tight netting pattern */
.circuit-box {
    position: relative;
    padding: 1.5rem;
    border-radius: 6px;
    background: 
        linear-gradient(var(--circuit-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--circuit-line) 1px, transparent 1px),
        var(--bg-soft);
    background-size: 12px 12px, 12px 12px, 100% 100%;
    border: 1px solid var(--border-color);
}

/* Comment form */
.comment-form form {
    background-color: var(--bg-elevated);
    border-left: 2px solid var(--accent);
    padding: 1.25rem;
}

/* Form row - horizontal layout on desktop */
.comment-form .form-row {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (min-width: 640px) {
    .comment-form .form-row {
        flex-direction: row;
    }
    
    .comment-form .form-row .form-field {
        flex: 1;
    }
}

.comment-form .form-field {
    margin-bottom: 0.75rem;
}

.comment-form .form-field:last-child {
    margin-bottom: 1rem;
}

.comment-form label {
    display: block;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
}

.comment-form input,
.comment-form textarea {
    width: 100%;
    background-color: var(--bg);
    border: 1px solid var(--border-color);
    color: var(--text);
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.comment-form textarea {
    font-family: "Libertinus Mono", "JetBrains Mono", "Fira Code", monospace;
    font-size: 0.85rem;
    resize: vertical;
    min-height: 5rem;
}

.comment-form input:focus,
.comment-form textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-soft);
    outline: none;
}

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

/* Post Comment button */
.comment-form button[type="submit"] {
    background-color: var(--accent);
    color: var(--text);
    font-weight: 700;
    padding: 0.6rem 1.25rem;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.8rem;
}

.comment-form button[type="submit"]:hover {
    background-color: var(--accent-hover);
}

.comment-form button[type="submit"]:active {
    transform: translateY(1px);
}

/* Individual comments */
.comment {
    background-color: var(--bg-soft);
    border-left: 2px solid var(--accent-soft);
    transition: border-color 0.2s ease;
}

.comment:hover {
    border-left-color: var(--accent);
}

.comment:target {
    border-left-color: var(--accent);
    border-left-width: 4px;
    background-color: var(--bg-elevated);
    animation: highlight-pulse 4s ease-out;
}

@keyframes highlight-pulse {
    0%, 50% { 
        box-shadow: 0 0 0 3px var(--accent);
        border-left-color: var(--accent);
    }
    100% { 
        box-shadow: 0 0 0 0px transparent;
    }
}

/* Comment content */
.comment-content {
    color: var(--text);
    line-height: 1.6;
}

.comment-content p {
    margin-bottom: 0.75rem;
}

.comment-content p:last-child {
    margin-bottom: 0;
}

/* Comment references */
.comment-reference {
    color: var(--accent);
    font-weight: 600;
    border-bottom: 1px dotted var(--accent);
}

.comment-reference:hover {
    color: var(--accent-hover);
    border-bottom-style: solid;
}

/* Tripcode */
.tripcode {
    font-family: monospace;
    font-size: 0.85em;
}

/* ============================================
   Comment Preview Popup (Hover)
   ============================================ */
.comment-preview {
    position: absolute;
    z-index: 1000;
    max-width: 500px;
    min-width: 300px;
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--accent);
    border-radius: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    pointer-events: auto;
}

.comment-preview .comment {
    margin: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.comment-preview-inner {
    padding: 0.75rem 1rem;
}

.comment-preview-header {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.comment-preview-header .font-semibold {
    color: var(--text);
}

.comment-preview-header .comment-id {
    opacity: 0.7;
}

.comment-preview-content {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text);
    max-height: 300px;
    overflow-y: auto;
}

.comment-preview-content p {
    margin-bottom: 0.5rem;
}

.comment-preview-content p:last-child {
    margin-bottom: 0;
}

.preview-post-link {
    font-style: italic;
    opacity: 0.8;
}

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

/* ============================================
   Quote Selection Button
   ============================================ */
.quote-selection-btn {
    position: absolute;
    z-index: 1001;
    background-color: var(--accent);
    color: var(--text);
    border: none;
    border-radius: 4px;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.quote-selection-btn:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
}

.quote-selection-btn:active {
    transform: translateY(0);
}

/* ============================================
   Reply Modal
   ============================================ */
.reply-modal {
    position: fixed;
    z-index: 1002;
    width: 400px;
    min-width: 280px;
    max-width: calc(100vw - 20px);
    min-height: 280px;
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: visible;
}

.reply-modal-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: se-resize;
    z-index: 10;
}

.reply-modal-resize-handle::before,
.reply-modal-resize-handle::after {
    content: '';
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 10px;
    height: 10px;
    border-right: 2px solid rgba(255,255,255,0.7);
    border-bottom: 2px solid rgba(255,255,255,0.7);
}

.reply-modal-resize-handle::after {
    bottom: 3px;
    right: 3px;
    border-color: rgba(0,0,0,0.5);
}

.reply-modal-bg-canvas {
    position: absolute;
    top: -30px;
    left: -30px;
    width: calc(100% + 60px);
    height: calc(100% + 60px);
    z-index: 0;
    pointer-events: none;
}

.reply-modal-header,
.reply-modal-body {
    position: relative;
    z-index: 1;
}

.reply-modal::before {
    content: '';
    position: absolute;
    top: -30px;
    left: -30px;
    right: -30px;
    bottom: -30px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 0;
    pointer-events: none;
    -webkit-mask-image: linear-gradient(to right, transparent, black 40px, black calc(100% - 40px), transparent),
                        linear-gradient(to bottom, transparent, black 40px, black calc(100% - 40px), transparent);
    -webkit-mask-composite: source-in;
    mask-image: linear-gradient(to right, transparent, black 40px, black calc(100% - 40px), transparent),
                linear-gradient(to bottom, transparent, black 40px, black calc(100% - 40px), transparent);
    mask-composite: intersect;
}

.reply-modal.dragging {
    cursor: grabbing;
}

.reply-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem 0 2rem;
    background: transparent;
    border: none;
    cursor: grab;
    user-select: none;
}

.reply-modal-header:active {
    cursor: grabbing;
}

.reply-modal-title {
    font-weight: normal;
    font-size: 1rem;
    color: #fff;
    text-transform: lowercase;
}

.reply-modal-body .form-field label {
    text-transform: lowercase;
}


.reply-modal-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.8rem;
    line-height: 0;
    cursor: pointer;
    padding: 0;
    transition: opacity 0.15s ease;
    transform: translateY(-3px);
}

.reply-modal-close:hover {
    opacity: 0.7;
}

.reply-modal-body {
    padding: 1rem 2rem 1rem 2rem;
    display: flex;
    flex-direction: column;
    height: calc(100% - 42px); /* Account for header height */
    overflow: visible;
}

.reply-modal-body form {
    background: none;
    border: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: visible;
}

.reply-modal-body .form-row {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}

.reply-modal-body .form-row .form-field {
    flex: 1 1 120px;
    min-width: 100px;
    max-width: 100%;
}

.reply-modal-body .form-field {
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.reply-modal-body .form-field label {
    color: #fff;
}

/* Keep name/tripcode inputs compact */
.reply-modal-body .form-row input {
    width: 100%;
    box-sizing: border-box;
}

/* Comment field container - grows to fill space */
.reply-modal-body .form-field:has(textarea) {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Hide the Comment label in modal - cleaner look */
.reply-modal-body .form-field:has(textarea) label {
    display: none;
}

.reply-modal-body textarea {
    min-height: 80px;
    flex: 1;
    resize: none;
}

/* Modal form inputs - ensure proper text color */
.reply-modal-body input,
.reply-modal-body textarea {
    background-color: rgba(0, 0, 0, 0.3);
    color: #fff;
    border: 1px solid #444;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: 0;
    font-size: 0.9rem;
}

.reply-modal-body input::placeholder,
.reply-modal-body textarea::placeholder {
    color: #888;
}

.reply-modal-body input:focus,
.reply-modal-body textarea:focus {
    border-color: #888;
    box-shadow: none;
    outline: none;
}

/* Post Comment button in modal - ellipse style like reply button */
.reply-modal-body button[type="submit"] {
    position: relative;
    background: transparent;
    color: #000;
    font-weight: normal;
    padding: 0.5rem 1.5rem;
    border-radius: 0;
    border: none;
    cursor: pointer;
    transition: color 0.2s ease;
    text-transform: lowercase;
    font-size: 0.9rem;
    margin-top: 0.75rem;
    flex-shrink: 0;
    align-self: center;
}

.reply-modal-body button[type="submit"]::before {
    content: '';
    position: absolute;
    top: -0.4rem;
    left: -0.75rem;
    right: -0.75rem;
    bottom: -0.4rem;
    background: radial-gradient(ellipse at center, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.8) 35%, rgba(255,255,255,0.3) 55%, transparent 75%);
    z-index: -1;
}

.reply-modal-body button[type="submit"]:hover {
    color: #444;
}

.reply-modal-body button[type="submit"]:active {
    transform: translateY(1px);
}

/* Open Reply Button */
.open-reply-btn {
    background-color: var(--accent);
    color: var(--text);
    font-weight: 700;
    padding: 0.6rem 1.5rem;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.open-reply-btn:hover {
    background-color: var(--accent-hover);
}

.open-reply-btn:active {
    transform: translateY(1px);
}

/* Greentext (quoted text) - 4chan style */
.comment-content blockquote,
.comment-preview-content blockquote {
    color: #789922;
    font-style: normal;
    background: none;
    border: none;
    border-left: 2px solid #789922;
    padding: 0.25rem 0 0.25rem 0.75rem;
    margin: 0.5rem 0;
}

.comment-content blockquote p,
.comment-preview-content blockquote p {
    margin: 0;
}

/* Nested greentext (quotes within quotes) */
.comment-content blockquote blockquote,
.comment-preview-content blockquote blockquote {
    margin-left: 0.5rem;
    border-left-color: #5a7a1a;
}

/* Backlinks */
.comment-backlinks {
    display: inline;
    font-size: 0.85em;
}

.comment-backlinks .comment-reference {
    font-size: 0.95em;
}

/* ============================================
   Footer
   ============================================ */
footer {
    color: #000;
    max-width: 64rem;
    margin: 0 auto;
    padding: 3rem 2rem;
    border: none;
    position: relative;
}

footer::before {
    content: '';
    position: absolute;
    top: -1rem;
    left: -4rem;
    right: -4rem;
    bottom: -1rem;
    background: radial-gradient(ellipse 70% 50% at center, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.8) 35%, rgba(255,255,255,0.3) 55%, transparent 75%);
    z-index: -1;
}

footer a {
    color: #000;
}

footer a:hover {
    color: #444;
}



/* ============================================
   404 Page
   ============================================ */
main h1.text-6xl,
main .text-6xl {
    color: var(--accent);
    font-size: 5rem;
    font-weight: 800;
}

/* ============================================
   Marquee
   ============================================ */

.marquee {
    background: #fff;
    color: #000;
    overflow: hidden;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-color);
}

.marquee-content {
    display: inline-block;
    animation: marquee 20s linear infinite;
}

.marquee-content span {
    padding: 0.5rem 1rem;
    display: inline-block;
}

@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ============================================
   Post List (Homepage)
   ============================================ */

.post-preview {
    padding: 0.5rem 0;
    margin-left: 1.5rem;
    margin-bottom: 0.5rem;
    border: none;
    overflow: visible;
}

.post-preview:last-child {
    margin-bottom: 0;
}

.post-preview .post-link {
    color: #000;
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    position: relative;
    padding: 0.5rem 1rem;
}

.post-preview .post-link::before {
    content: '';
    position: absolute;
    top: -0.5rem;
    left: -1.5rem;
    right: -1.5rem;
    bottom: -0.5rem;
    background: radial-gradient(ellipse at center, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.8) 35%, rgba(255,255,255,0.3) 55%, transparent 75%);
    z-index: -1;
}

.post-preview .post-link:hover {
    color: #444;
}

.post-preview .post-title {
    display: block;
}

.post-preview .post-link .post-meta {
    display: block;
    color: #555;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.post-preview .post-meta {
    color: #555;
    margin-top: 0.25rem;
    font-size: 0.85rem;
}

.post-preview .tag {
    display: inline-block;
    border: 1px solid var(--text-muted);
    padding: 0.1rem 0.4rem;
    margin-left: 0.35rem;
}

/* Homepage posts section */
.posts-section.homepage-content {
    max-height: calc(100vh - 200px);
    display: flex;
    flex-direction: column;
}

.posts-section.homepage-content #posts-container {
    display: flex;
    flex-direction: column;
}

/* Pagination Controls */
.pagination-controls {
    display: flex;
    justify-content: flex-start;
    margin-top: auto;
    padding: 1rem 0;
    margin-left: 1.5rem;
}

.pagination-ellipse {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 0.5rem 1.5rem;
    position: relative;
}

.pagination-ellipse::before {
    content: '';
    position: absolute;
    top: -0.5rem;
    left: -1.5rem;
    right: -1.5rem;
    bottom: -0.5rem;
    background: radial-gradient(ellipse at center, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.8) 35%, rgba(255,255,255,0.3) 55%, transparent 75%);
    z-index: -1;
}

.pagination-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    color: #333;
    font-size: 1.25rem;
    transition: color 0.2s ease, transform 0.2s ease;
}

.pagination-btn:hover {
    color: #000;
    transform: scale(1.1);
}

.pagination-btn:active {
    transform: scale(0.95);
}

.pagination-arrow {
    display: inline-block;
}

.pagination-page {
    font-size: 1rem;
    color: #333;
    min-width: 2rem;
    text-align: center;
}

/* Single post page article styling */
article.post,
article.post-body {
    border-bottom: none;
    padding: 4rem 2.5rem;
    margin-bottom: 0;
    position: relative;
    color: #000;
    overflow: visible;
}

#post-caustics-canvas {
    position: absolute;
    top: -1rem;
    left: -6rem;
    right: -6rem;
    width: calc(100% + 12rem);
    height: calc(100% + 2rem);
    z-index: -1;
    pointer-events: none;
}

/* Post segments (content split by <hr>) */
article.post-body:has(.post-segment) {
    padding: 0;
    background: transparent;
}

article.post-body .post-content:has(.post-segment) {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.post-segment {
    position: relative;
    padding: 4rem 2.5rem 5rem;
}

/* Normalize spacing at segment edges - remove margins from first/last content */
.post-segment > *:nth-child(2),
.post-segment > *:nth-child(2) > *:first-child,
.post-segment > *:nth-child(2) > *:first-child > *:first-child,
.post-segment > h2:nth-child(2),
.post-segment > h3:nth-child(2),
.post-segment > section:nth-child(2) > h2:first-child,
.post-segment > section:nth-child(2) > h3:first-child {
    margin-top: 0 !important;
}

.post-segment > *:last-child,
.post-segment > *:last-child > *:last-child,
.post-segment > *:last-child > *:last-child > *:last-child,
.post-segment p:last-child,
.post-segment pre:last-child,
.post-segment table:last-child,
.post-segment ul:last-child,
.post-segment ol:last-child,
.post-segment blockquote:last-child {
    margin-bottom: 0 !important;
}

.segment-bg-canvas {
    position: absolute;
    top: -1rem;
    left: -6rem;
    right: -6rem;
    width: calc(100% + 12rem);
    height: calc(100% + 2rem);
    z-index: -1;
    pointer-events: none;
}

article.post a,
article.post-body a {
    color: #333;
    text-decoration: underline;
}

article.post a:hover,
article.post-body a:hover {
    color: #666;
}

article.post .post-content,
article.post .prose,
article.post-body .post-content,
article.post-body .prose {
    color: #000;
    padding: 0 !important;
    margin: 0 !important;
}

article.post-body .post-content > *:first-child {
    margin-top: 0 !important;
}

article.post-body .post-content > h1:first-child,
article.post-body .post-content > .post-segment:first-child h1:first-of-type {
    display: none;
}

article.post-body .post-content h1,
article.post-body .post-content h2,
article.post-body .post-content h3,
article.post-body .post-content h4 {
    color: #000;
}

article.post-body .post-content .content-section {
    margin-top: 0 !important;
}

article.post-body .post-content > *:last-child,
article.post-body .prose > *:last-child {
    margin-bottom: 0 !important;
}

article.post-body .post-content > *:last-child *:last-child,
article.post-body .prose > *:last-child *:last-child {
    margin-bottom: 0 !important;
}

article.post .post-content strong,
article.post .prose strong,
article.post-body .post-content strong,
article.post-body .prose strong {
    color: #000;
}

article.post .post-content blockquote,
article.post .prose blockquote,
article.post-body .post-content blockquote,
article.post-body .prose blockquote {
    color: #444;
    border-left-color: #888;
    background: rgba(0,0,0,0.05);
    padding: 0.5rem 0 0.5rem 1.25rem;
}

article.post-body .post-content blockquote p,
article.post-body .prose blockquote p {
    margin: 0;
}

/* Standalone post header with ellipse glow */
.post-header-standalone {
    position: relative;
    padding: 1.5rem 2rem;
    margin-top: 0;
    margin-bottom: 2rem;
    color: #000;
    text-align: center;
}

.post-header-standalone::before {
    content: '';
    position: absolute;
    top: -0.5rem;
    left: -1.5rem;
    right: -1.5rem;
    bottom: -0.5rem;
    background: radial-gradient(ellipse 65% 60% at center, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.8) 40%, rgba(255,255,255,0.3) 60%, transparent 80%);
    z-index: -1;
}

.post-header-standalone h1 {
    margin-bottom: 0.5rem;
    color: #000;
    font-size: 1.75rem;
}

.post-header-standalone .post-meta {
    color: #555;
    font-size: 0.9rem;
}

.post-header-standalone .tag {
    color: #555;
}

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

.post-header h1 {
    margin-bottom: 0.5rem;
    color: #000;
}

.post-header .post-meta {
    color: #555;
    font-size: 0.9rem;
}

.post-header .tag {
    display: inline-block;
    border: 1px solid #888;
    padding: 0.1rem 0.4rem;
    margin-left: 0.35rem;
    font-size: 0.75rem;
    color: #555;
}

.comments-section {
    margin-top: 2rem;
    padding: 1rem 0;
    position: relative;
    overflow: visible;
}

/* Reply button with ellipse background */
.comments-section .open-reply-btn {
    position: relative;
    background: transparent !important;
    color: #000 !important;
    padding: 0.5rem 1.5rem;
    margin-bottom: 2rem;
    margin-left: 1rem;
    display: inline-block;
    border: none !important;
    font-weight: normal;
    text-transform: lowercase;
}

.comments-section .open-reply-btn::before {
    content: '';
    position: absolute;
    top: -0.75rem;
    left: -1.5rem;
    right: -1.5rem;
    bottom: -0.75rem;
    background: radial-gradient(ellipse at center, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.8) 35%, rgba(255,255,255,0.3) 55%, transparent 75%);
    z-index: -1;
}

.comments-section .open-reply-btn:hover {
    color: #444 !important;
    background: transparent !important;
}

/* Comment form with soft fade rect */
.comments-section .comment-form {
    position: relative;
    margin-bottom: 8rem;
    padding: 3rem 2.5rem;
}

.comments-section .comment-form .comment-bg-canvas {
    position: absolute;
    top: -1rem;
    left: -6rem;
    right: -6rem;
    width: calc(100% + 12rem);
    height: calc(100% + 2rem);
    z-index: -1;
    pointer-events: none;
}

.comments-section .comment-form form {
    background: transparent !important;
    border: none !important;
    padding: 0;
}

.comments-section .comment-form label {
    color: #555 !important;
}

.comments-section .comment-form input,
.comments-section .comment-form textarea {
    background-color: rgba(0,0,0,0.05) !important;
    border-color: #ccc !important;
    color: #000 !important;
}

.comments-section .comment-form input::placeholder,
.comments-section .comment-form textarea::placeholder {
    color: #888 !important;
}

.comments-section .comment-form button {
    background-color: #000 !important;
    color: #fff !important;
}

.comments-section .comment-form button:hover {
    background-color: #333 !important;
}

/* Individual comments with soft fade rect */
.comments-section .comment {
    position: relative;
    background: transparent !important;
    border: none !important;
    padding: 2.5rem 2.5rem;
    margin-top: 1rem;
    margin-bottom: 3rem;
}

.comments-section .comment .comment-bg-canvas {
    position: absolute;
    top: -1.5rem;
    left: -6rem;
    right: -6rem;
    width: calc(100% + 12rem);
    height: calc(100% + 3rem);
    z-index: -1;
    pointer-events: none;
}

.comments-section .comment-header {
    font-size: 1rem;
    color: #555;
    margin-bottom: 0.5rem;
}

.comments-section .comment-author {
    font-weight: 700;
    color: #000;
}

.comments-section .comment-tripcode {
    color: #666;
}

.comments-section .comment-id-link {
    color: #555;
}

.comments-section .comment-id-link:hover {
    color: #000;
}

.comments-section .comment-reference {
    color: #555;
}

.comments-section .comment-reference:hover {
    color: #000;
}

.comments-section .comment-content,
.comments-section .comment-content p {
    color: #000;
}

.comments-section .comment-content a {
    color: #333;
    text-decoration: underline;
}

.comments-section .comment-content a:hover {
    color: #000;
}

/* Post footer - license info */
article.post-body .post-footer {
    margin-top: -0.5rem;
    margin-left: 0;
    padding-left: 0;
    text-indent: 0;
    font-size: 0.85rem;
    color: #555;
}

article.post-body .post-footer a {
    color: #555;
    text-decoration: underline;
}

article.post-body .post-footer a:hover {
    color: #333;
}


/* ============================================
   Selection
   ============================================ */
::selection {
    background-color: #333;
    color: #fff;
}

::-moz-selection {
    background-color: #333;
    color: #fff;
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    body {
        background: white;
        color: black;
        font-size: 12pt;
    }
    
    a {
        color: black;
        text-decoration: underline;
        border: none;
    }
    
    header, footer, .comment-form {
        display: none;
    }
    
    .banner-container {
        display: none;
    }
}

/* ============================================
   Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* ============================================
   Preview Mode Banner (Admin Draft Preview)
   ============================================ */
.preview-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(90deg, #1a1a2e 0%, #16213e 50%, #1a1a2e 100%);
    border-bottom: 2px solid #e94560;
    color: #fff;
    font-family: "Libertinus Mono", monospace;
    font-size: 0.85rem;
    box-shadow: 0 4px 20px rgba(233, 69, 96, 0.3);
}

.preview-banner-icon {
    font-size: 1.1rem;
}

.preview-banner-text {
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #e94560;
}

.preview-banner-status {
    padding: 0.2rem 0.6rem;
    background: rgba(233, 69, 96, 0.2);
    border: 1px solid #e94560;
    border-radius: 3px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Push body content down when preview banner is present */
body:has(.preview-banner) {
    padding-top: 3rem;
}

/* Disable interactions in preview mode */
body:has(.preview-banner) .comment-form,
body:has(.preview-banner) .open-reply-btn {
    display: none;
}
