@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    --h-bg: 240;
    --s-bg: 60%;
    --l-bg: 2%;
    
    --bg: hsl(var(--h-bg), var(--s-bg), var(--l-bg));
    --bg-alt: hsl(var(--h-bg), var(--s-bg), calc(var(--l-bg) + 4%));
    --fg: hsl(0, 0%, 100%);
    --fg-muted: hsla(0, 0%, 100%, 0.4);
    
    --accent: hsl(280, 80%, 60%);
    --accent-glow: hsla(280, 80%, 60%, 0.2);
    --accent-bg: hsla(280, 80%, 60%, 0.1);
    --flare: hsl(10, 100%, 65%);
    --flare-bg: hsla(10, 100%, 65%, 0.1);
    --aurora: hsl(150, 100%, 60%);
    --aurora-bg: hsla(150, 100%, 60%, 0.1);
    
    --border: hsla(0, 0%, 100%, 0.08);
    --border-accent: hsla(280, 80%, 60%, 0.3);
    
    --font-sans: 'Plus Jakarta Sans', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --transition: all 0.7s cubic-bezier(0.19, 1, 0.22, 1);
    --grid-size: 40px;
    --blur: 40px;
    --comm-hover: var(--bg-05);
    --bg-02: hsla(0, 0%, 100%, 0.02);
    --bg-05: hsla(0, 0%, 100%, 0.05);
}

[data-theme="light"] {
    --s-bg: 10%;
    --l-bg: 98%;
    
    --bg: hsl(var(--h-bg), var(--s-bg), var(--l-bg));
    --bg-alt: hsl(var(--h-bg), var(--s-bg), calc(var(--l-bg) - 3%));
    --fg: hsl(240, 60%, 5%);
    --fg-muted: hsla(240, 60%, 5%, 0.7);
    --border: hsla(240, 60%, 5%, 0.15);
    --accent: hsl(280, 80%, 45%);
    --accent-glow: hsla(280, 80%, 45%, 0.15);
    --accent-bg: hsla(280, 80%, 45%, 0.08);
    --aurora: hsl(150, 100%, 25%);
    --aurora-bg: hsla(150, 100%, 25%, 0.08);
    --flare: hsl(10, 100%, 40%);
    --flare-bg: hsla(10, 100%, 40%, 0.08);
    --comm-hover: hsla(0, 0%, 0%, 0.05);
    --bg-02: hsla(0, 0%, 0%, 0.02);
    --bg-05: hsla(0, 0%, 0%, 0.05);
}

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

body {
    background-color: var(--bg);
    color: var(--fg);
    font-family: var(--font-sans);
    line-height: 1.5;
    min-height: 100vh;
    transition: background-color 0.8s ease, color 0.8s ease;
    overflow-x: hidden;
}

.galaxy-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    filter: blur(var(--blur));
    background: 
        radial-gradient(circle at 20% 30%, var(--accent-glow), transparent 40%),
        radial-gradient(circle at 80% 70%, var(--aurora-bg), transparent 40%),
        radial-gradient(circle at 50% 50%, var(--flare-bg), transparent 50%);
}

.spatial-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.2;
    background-image: 
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: var(--grid-size) var(--grid-size);
}

.dock {
    position: fixed;
    left: 40px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 12px;
    background: var(--bg-02);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 100px;
}

.dock-item {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--fg-muted);
    text-decoration: none;
    transition: var(--transition);
    border: 1px solid transparent;
}
.dock-item:hover, 
.dock-item.active {
    background: var(--fg);
    color: var(--bg);
    box-shadow: 0 0 20px var(--fg);
}

button.dock-item {
    background: transparent;
}

button.dock-item:hover {
    background: var(--bg-05) !important;
    color: #fff !important;
    border-color: hsla(0, 0%, 100%, 0.2) !important;
    box-shadow: 0 0 15px hsla(0, 0%, 100%, 0.1) !important;
}

[data-theme="light"] button.dock-item:hover {
    background: var(--bg-05) !important;
    color: #000 !important;
    border-color: hsla(0, 0%, 0%, 0.1) !important;
}

[data-theme="light"] .dock-item:hover, 
[data-theme="light"] .dock-item.active {
    background: #000;
    color: #fff;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

#theme-icon {
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), color 0.3s ease;
}

[data-theme="dark"] #theme-icon {
    color: var(--fg-muted);
}

[data-theme="light"] #theme-icon {
    color: var(--fg-muted);
}

.dock-item:hover #theme-icon {
    transform: rotate(360deg) scale(1.1);
}

[data-theme="dark"] .dock-item:hover #theme-icon {
    color: #fff !important;
}

[data-theme="light"] .dock-item:hover #theme-icon {
    color: #000 !important;
}

.spatial-container {
    padding: 80px 120px 160px 160px;
}

.module {
    margin-bottom: 120px;
    position: relative;
}

.module-tag {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--accent);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.module-tag::after {
    content: "";
    height: 1px;
    width: 60px;
    background: var(--border);
}

h1 {
    font-size: clamp(3.5rem, 12vw, 9rem);
    line-height: 0.85;
    font-weight: 800;
    letter-spacing: -0.05em;
    margin-bottom: 60px;
}

.text-reveal {
    background: linear-gradient(135deg, var(--fg), var(--accent), var(--aurora));
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 10s infinite linear;
    background-size: 200% auto;
}

@keyframes gradientShift {
    to { background-position: 200% center; }
}

.module-card {
    background: var(--bg-02);
    border: 1px solid var(--border);
    padding: 56px;
    backdrop-filter: blur(32px);
    transition: var(--transition);
    color: var(--fg);
}

.module-card h1, .module-card h2, .module-card h3, .module-card h4, .module-card p, .module-card li {
    color: var(--fg);
}

article {
    color: var(--fg);
}

.module-card:hover {
    border-color: var(--accent);
    background: var(--bg-05);
    transform: scale(1.02);
    box-shadow: 0 0 60px var(--accent-glow);
}

.secondary, 
footer, 
p.secondary {
    color: var(--fg-muted);
}

[data-theme="light"] .secondary, 
[data-theme="light"] footer, 
[data-theme="light"] p.secondary {
    color: hsla(240, 60%, 5%, 0.8);
}

.console-input {
    width: 100%;
    background: var(--bg-05);
    border: 1px solid var(--border);
    padding: 20px;
    color: var(--fg);
    font-family: var(--font-mono);
    outline: none;
    transition: var(--transition);
    margin-bottom: 24px;
    resize: vertical;
}

textarea.console-input {
    min-height: 120px;
}

.console-form {
    max-width: 480px;
    width: 100%;
    margin: 0 auto;
    padding: 60px;
    background: var(--bg-02);
    border: 1px solid var(--border);
    backdrop-filter: blur(32px);
    transition: var(--transition);
}

.console-form:hover {
    border-color: var(--accent);
    box-shadow: 0 0 40px var(--accent-glow);
}

.console-input:focus {
    border-color: var(--flare);
    box-shadow: 0 0 20px hsla(10, 100%, 65%, 0.2);
}

.comm-array {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.comm-link {
    background: var(--bg);
    padding: 60px;
    text-decoration: none;
    color: var(--fg);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 20px;
    transition: var(--transition);
    border: 1px solid var(--border);
}

.comm-link:hover {
    background: var(--comm-hover);
    color: var(--accent);
    border-color: var(--accent);
}

.comm-link i {
    font-size: 20px;
}

.ri {
    font-size: 1.2rem;
    line-height: 1;
    vertical-align: middle;
}

.dock-item .ri {
    font-size: 1.4rem;
}

.comm-link span {
    font-family: var(--font-mono);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
}

.timeline {
    position: relative;
    padding-left: 40px;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(to bottom, var(--accent), var(--aurora), transparent);
}

.timeline-entry {
    margin-bottom: 80px;
    position: relative;
}

.timeline-entry::before {
    content: "";
    position: absolute;
    left: -45px;
    top: 10px;
    width: 10px;
    height: 10px;
    background: var(--bg);
    border: 2px solid var(--accent);
    border-radius: 50%;
}

.staggered-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 32px;
}

.animate {
    opacity: 0;
    transform: translateY(30px);
    transition: var(--transition);
}

.animate.visible {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 1100px) {
    .spatial-container {
        padding: 80px 40px 120px 100px;
    }
}

@media (max-width: 768px) {
    .dock {
        left: auto;
        bottom: 40px;
        top: auto;
        transform: none;
        flex-direction: row;
        width: fit-content;
        margin: 0 auto;
        right: 0;
    }

    .spatial-container {
        padding: 40px 24px 120px 24px;
    }

    h1 {
        font-size: 4rem;
    }

    .staggered-grid {
        grid-template-columns: 1fr;
    }
}

.page-centered {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.page-centered-col {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 0;
    flex-direction: column;
    text-align: center;
}

.dock-divider {
    margin: 10px 0;
    border-top: 1px solid var(--border);
}

.console-form--aurora {
    border-color: var(--aurora);
    background: var(--bg-02);
}

.form-header {
    text-align: center;
    margin-bottom: 60px;
}

.form-title {
    font-size: 2.5rem;
    letter-spacing: -0.05em;
}

.field-label {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--fg-muted);
    display: block;
    margin-bottom: 8px;
}

.form-label-aurora {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--aurora);
    margin-bottom: 12px;
}

.form-label-flare {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--flare);
    margin-bottom: 12px;
}

.form-field {
    margin-bottom: 40px;
}

.form-field-sm {
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 32px;
}

.form-group-lg {
    margin-bottom: 48px;
}

.form-actions {
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.form-footer {
    margin-top: 40px;
    text-align: center;
}

.form-footer-link {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--fg-muted);
    text-decoration: none;
}

.btn-full {
    width: 100%;
}

.btn-aurora {
    border-color: var(--aurora);
    background: var(--aurora-bg);
    color: var(--aurora);
    padding: 24px;
    font-weight: 700;
}

.btn-flare {
    border-color: var(--flare);
    background: var(--flare-bg);
    color: var(--flare);
    padding: 20px;
    font-weight: 700;
}

.btn-accent {
    border-color: var(--accent);
    background: var(--accent-bg);
    color: var(--fg);
    padding: 24px;
    font-weight: 700;
}

.module-tag-sm {
    font-size: 10px;
    margin-bottom: 12px;
}

.tag-aurora {
    color: var(--aurora);
}

.tag-flare {
    color: var(--flare);
}

.page-title {
    font-size: 5rem;
}

.admin-title {
    font-size: 4rem;
    margin-bottom: 0;
}

.page-desc {
    font-size: 1.2rem;
    max-width: 600px;
}

.post-timestamp {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--accent);
    margin-bottom: 24px;
}

.section-heading-aurora {
    margin-bottom: 32px;
    font-family: var(--font-mono);
    color: var(--aurora);
}

.footer-text {
    font-family: var(--font-mono);
    font-size: 11px;
    opacity: 0.3;
}

.critical-text {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--flare);
}

.hints-text {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--fg-muted);
    line-height: 2;
}

.protocol-text {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--fg-muted);
    line-height: 1.8;
}

.stat-label-accent {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--accent);
    margin-bottom: 16px;
}

.stat-label-aurora {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--aurora);
    margin-bottom: 16px;
}

.stat-label-flare {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--flare);
    margin-bottom: 16px;
}

.stat-value {
    font-size: 4rem;
    font-weight: 800;
}

.site-footer {
    margin-top: 100px;
    padding: 60px 0;
    border-top: 1px solid var(--border);
}

.card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.card-flex {
    display: flex;
    flex-direction: column;
}

.card-narrow {
    max-width: 800px;
}

.card-padded {
    padding: 40px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.back-link {
    display: inline-flex;
    width: auto;
    padding: 0 24px;
    border-radius: 100px;
    margin-top: 24px;
    text-decoration: none;
}

.back-link-lg {
    display: inline-flex;
    width: auto;
    padding: 0 40px;
    border-radius: 100px;
    text-decoration: none;
}

.meta-grid {
    margin-top: 40px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 32px;
}

.form-inline {
    display: inline;
}

.file-input-hidden {
    display: none;
}

.upload-label {
    font-family: var(--font-mono);
    font-size: 2rem;
    color: var(--accent);
}

.post-entry-id {
    font-family: var(--font-mono);
    color: var(--accent);
    font-size: 12px;
    margin-bottom: 8px;
}

.post-entry-date {
    font-family: var(--font-mono);
    font-size: 11px;
}

.post-read-more {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--aurora);
    display: flex;
    align-items: center;
    gap: 8px;
}

.error-heading {
    font-size: clamp(5rem, 20vw, 15rem);
    margin-bottom: 20px;
}

.error-subtext {
    font-size: 1.5rem;
    color: var(--fg-muted);
    font-family: var(--font-mono);
    letter-spacing: 0.2em;
}

.reading-module {
    max-width: 800px;
    margin: 0 auto;
    padding-top: 100px;
    transition: var(--transition);
}

.hud-header {
    border: 1px solid var(--border);
    padding: 60px;
    position: relative;
    margin-bottom: 80px;
    transition: var(--transition);
}

.hud-header::before {
    content: "MODULE_INFO";
    position: absolute;
    top: -10px;
    left: 20px;
    font-family: var(--font-mono);
    font-size: 9px;
    background: var(--bg);
    padding: 2px 8px;
    color: var(--accent);
}

.article-content {
    font-size: 1.25rem;
    line-height: 1.8;
    color: var(--fg);
}

.article-content h2 {
    margin-top: 4rem;
    font-size: 2.2rem;
    color: var(--fg);
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
    margin-bottom: 24px;
}

.article-content p {
    margin-bottom: 24px;
}

.article-content code {
    background: var(--bg-alt);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.9em;
    border: 1px solid var(--border);
    color: var(--aurora);
}

.article-content pre {
    background: var(--bg-alt);
    padding: 32px;
    border-radius: 8px;
    overflow-x: auto;
    border: 1px solid var(--border);
    margin: 3rem 0;
    font-family: var(--font-mono);
    font-size: 14px;
}

body.reading-mode .galaxy-bg,
body.reading-mode .spatial-grid,
body.reading-mode .hud-header::before,
body.reading-mode footer {
    display: none !important;
}

body.reading-mode .hud-header {
    border: none;
    padding: 0;
    margin-bottom: 60px;
}

body.reading-mode .reading-module {
    padding-top: 60px;
    max-width: 700px;
}

body.reading-mode .spatial-container {
    padding: 40px;
}

body.reading-mode .dock {
    opacity: 0.2;
    transition: opacity 0.3s;
}

body.reading-mode .dock:hover {
    opacity: 1;
}

#read-icon {
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), color 0.3s ease;
    stroke-width: 1.5px;
    color: var(--fg-muted);
}

[data-theme="dark"] .dock-item:hover #read-icon {
    transform: scale(1.1);
    color: #fff !important;
}

[data-theme="light"] .dock-item:hover #read-icon {
    transform: scale(1.1);
    color: #000 !important;
}

.post-footer {
    margin-top: 160px;
    padding: 60px 0;
    border-top: 1px solid var(--border);
    text-align: center;
}

.post-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.post-row {
    display: grid;
    grid-template-columns: 100px 1fr 200px 120px;
    align-items: center;
    padding: 24px 32px;
    background: var(--bg-02);
    border: 1px solid var(--border);
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
}

.post-row:hover {
    background: var(--bg-05);
    border-color: var(--accent);
    transform: scale(1.01);
    box-shadow: 0 0 30px var(--accent-glow);
}

.post-id {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--accent);
}

.post-title {
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: -0.02em;
}

.post-date {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--fg-muted);
}

.action-group {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.icon-btn {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    color: var(--fg);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    cursor: pointer;
}

.icon-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-bg);
}

.icon-btn.delete:hover {
    border-color: var(--flare);
    color: var(--flare);
    background: var(--flare-bg);
}

.editor-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    min-height: 700px;
}

.toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding: 8px;
    background: var(--bg-02);
    border: 1px solid var(--border);
    border-radius: 8px;
    flex-wrap: wrap;
}

.tool-btn {
    background: none;
    border: 1px solid transparent;
    color: var(--fg-muted);
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 11px;
}

.tool-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-bg);
}

.editor-textarea {
    height: 100%;
    min-height: 600px;
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.6;
    resize: none;
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
}

.preview-pane {
    height: 100%;
    min-height: 600px;
    padding: 0;
    overflow-y: auto;
    color: var(--fg);
    font-size: 14px;
    line-height: 1.6;
}

.preview-pane h1,
.preview-pane h2,
.preview-pane h3 {
    margin-top: 24px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

.preview-pane p {
    margin-bottom: 16px;
}

.preview-pane img {
    max-width: 100%;
    border-radius: 12px;
    margin: 16px 0;
    border: 1px solid var(--border);
}

.preview-pane code {
    background: var(--bg-05);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
}

.preview-pane pre {
    background: var(--bg-02);
    padding: 20px;
    border-radius: 12px;
    overflow-x: auto;
    margin-bottom: 24px;
    border: 1px solid var(--border);
}

.preview-pane blockquote {
    border-left: 4px solid var(--accent);
    padding-left: 20px;
    color: var(--fg-muted);
    font-style: italic;
    margin-bottom: 24px;
}

.preview-pane .spoiler {
    background: var(--fg);
    color: var(--fg);
    transition: var(--transition);
    border-radius: 4px;
    padding: 0 4px;
    cursor: help;
}

.preview-pane .spoiler:hover {
    background: var(--bg-05);
    color: var(--fg);
}

.upload-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--accent-bg);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    border: 4px dashed var(--accent);
}

.otp-input {
    text-align: center;
    letter-spacing: 1em;
    font-size: 1.5rem;
}

@media (max-width: 1100px) {
    .editor-container {
        grid-template-columns: 1fr;
    }
}
