@import "pagination.css";
@import "navigation.css";
@import "pages/home.css";
@import "pages/series.css";
@import "pages/journal.css";
@import "pages/post.css";

    /* === Variables === */
    :root {
        --color-primary: #3b82f6;
        --color-bg: #ffffff;
        --color-text: #1f2937;
        --color-text-light: #6b7280;
        --color-border: #e5e7eb;
        --color-black: #000000;
        --color-white: #ffffff;
        --container-max: 1200px;
        --space-2: 0.5rem;
        --space-4: 1rem;
        --space-6: 1.5rem;
        --space-8: 2rem;

        /* Sphere colors */
        --sphere-systems: #00bfff;
        --sphere-life: #ff4500;
        --sphere-architects: #daa520;
        --sphere-creativity: #9932cc;

        /* Status colors */
        --error: #ef4444;
        --success: #10b981;

        /* Required for Portal styling (canonical theme variables) */
        --accent: var(--color-primary);
        --accent-contrast: var(--color-white);
        --radius: 6px;
        --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
        --text: var(--color-text);
        --muted-text: var(--color-text-light);
        --surface: var(--color-bg);
        --surface-2: #f9fafb;
        --border: var(--color-border);
        --focus-ring: var(--color-primary);

        /* Button tokens (REV 3.1 FINAL) */
        /* Source of truth: .newsletter-cta-button (assets/css/pages/post.css) */
        --btn-bg: #ffffff;
        --btn-text: #000000;
        --btn-border: transparent;
        --btn-radius: 6px;
        --btn-padding: 14px 32px;
        --btn-transition: transform 0.2s, box-shadow 0.2s;
        /* NOTE: hover for canonical button uses transform + box-shadow, not bg change */
        --btn-bg-hover: #ffffff;

        /* Ghost Custom Fonts support (Ghost 5.9+/6) */
        --gh-font-body: var(--ghost-font-body, var(--font-sans));
        --gh-font-headings: var(--ghost-font-headings, var(--gh-font-body));
        --gh-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    }

[data-theme="dark"] {
    --color-bg: #111827;
    --color-text: #f9fafb;
    --color-text-light: #9ca3af;
    --color-border: #374151;
    /* Portal dark mode variables */
    --surface: var(--color-bg);
    --surface-2: #1f2937;
    --text: var(--color-text);
    --muted-text: var(--color-text-light);
    --border: var(--color-border);
    --focus-ring: var(--color-primary);
}

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

body {
    font-family: var(--gh-font-body);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    transition: background 0.2s, color 0.2s;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--gh-font-headings);
}

code, pre, kbd, samp {
    font-family: var(--gh-font-mono);
}

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

a:hover {
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
}

/* === Layout === */
.site-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.site-main {
    flex: 1;
}

.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: var(--space-8) var(--space-4);
}

/* === Home Header === */
.home-header {
    text-align: center;
    padding: var(--space-8) 0;
    margin-bottom: var(--space-8);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
}

.home-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: var(--space-4);
}

.site-description {
    font-size: 1.125rem;
    opacity: 0.9;
}

/* === Post Feed === */
.post-feed {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-8);
    margin-bottom: var(--space-8);
}

.post-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.post-card-image {
    display: block;
    overflow: hidden;
}

.post-card-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s;
}

.post-card:hover .post-card-image img {
    transform: scale(1.05);
}

.post-card-content {
    padding: var(--space-6);
}

.post-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--space-4);
}

.post-card-title a {
    color: var(--color-text);
    text-decoration: none;
}

.post-card-title a:hover {
    color: var(--color-primary);
}

.post-card-excerpt {
    color: var(--color-text-light);
    margin-bottom: var(--space-4);
    line-height: 1.5;
}

.post-card-meta {
    display: flex;
    gap: var(--space-4);
    font-size: 0.875rem;
    color: var(--color-text-light);
}

/* === Site Footer === */
.site-footer {
    background: var(--color-black);
    color: var(--color-white);
    padding: var(--space-8) 0;
    margin-top: var(--space-8);
}

.site-footer-content {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 var(--space-4);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

/* Footer Navigation (top row) */
.footer-nav {
    display: flex;
    justify-content: center;
    gap: var(--space-6);
    flex-wrap: wrap;
}

.footer-nav a {
    color: var(--color-white);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 7px 11px;
    border: 1px solid transparent;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.footer-nav a:hover {
    border-color: var(--color-white);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.2);
    opacity: 1;
}

/* Footer Social (middle row) */
.footer-social {
    display: flex;
    justify-content: center;
    gap: var(--space-4);
}

.footer-social a {
    color: var(--color-white);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.footer-social a:hover {
    border-color: var(--color-white);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.2);
    opacity: 1;
}

/* Footer Copyright (bottom row) */
.footer-copyright {
    font-size: 0.875rem;
    opacity: 0.8;
    margin: 0;
}

/* === Koenig Editor === */
.kg-width-wide {
    max-width: 1040px;
    margin: 0 auto;
}

.kg-width-full {
    max-width: 100%;
    width: 100vw;
    margin-left: 50%;
    transform: translateX(-50%);
}

/* === Newsletter Forms (theme-only, NOT Portal) === */
/* Newsletter form styling in the theme */
.newsletter-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    margin-top: var(--space-6);
    max-width: 400px;
}

.newsletter-input {
    padding: var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--gh-font-body);
    font-size: 1rem;
}

.newsletter-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.newsletter-button {
    padding: var(--space-4);
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-family: var(--gh-font-body);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.newsletter-button:hover {
    background: color-mix(in srgb, var(--color-primary) 80%, black);
}

.newsletter-message {
    margin-top: var(--space-4);
    font-size: 0.875rem;
}

.newsletter-message.success {
    color: #10b981;
}

.newsletter-message.error {
    color: #ef4444;
}

/* === Responsive === */
@media (max-width: 768px) {
    .home-header h1 {
        font-size: 2rem;
    }

    .post-feed {
        grid-template-columns: 1fr;
    }

    .newsletter-form {
        max-width: 100%;
    }
}
