/* ==========================================================================
   Pharaoh Ghost Theme — screen.css
   Design tokens + typography aligned with pharaoh.so landing page
   ========================================================================== */

/* --- CSS Custom Properties (aligned with pharaoh.so landing page) --- */
:root {
    --gold: #d4a843;
    --gold-bright: #f0c855;
    --gold-dim: #8a6d2b;
    --bg: #111110;
    --surface: #1a1917;
    --surface-raised: #242320;
    --border: rgba(255, 255, 255, 0.08);
    --border-gold: rgba(212, 168, 67, 0.15);
    --text: #9a9284;
    --text-bright: #e8dcc8;
    --green: #4ade80;
    --red: #ef4444;
    --cyan: #22d3ee;
}

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

/* --- Base --- */
body {
    background: var(--bg);
    color: var(--text);
    font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--gold);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--gold-bright);
}

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

.container {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ==========================================================================
   Navigation (matched to shared.ts NAV_CSS)
   ========================================================================== */
.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    position: relative;
    z-index: 2;
}

.nav-logo {
    font-family: 'Syne', sans-serif;
    font-size: 21px;
    font-weight: 800;
    color: var(--gold-bright);
    letter-spacing: 3px;
    text-decoration: none;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 28px;
}

.nav-link {
    font-size: 14px;
    color: var(--text);
    text-decoration: none;
    transition: color 0.2s;
}

.nav-link:hover {
    color: var(--text-bright);
}

.nav-cta {
    font-size: 14px;
    font-weight: 500;
    color: var(--bg);
    background: var(--gold);
    padding: 10px 22px;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.2s;
}

.nav-cta:hover {
    background: var(--gold-bright);
}

/* Burger menu (mobile only) */
.nav-burger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
}

.nav-burger svg { display: block; }
.nav-burger .burger-close { display: none; }
.nav-burger.open .burger-open { display: none; }
.nav-burger.open .burger-close { display: block; }

.nav-mobile-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 0 24px 20px;
    flex-direction: column;
    gap: 0;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 100;
}

.nav-mobile-menu.visible {
    opacity: 1;
    transform: translateY(0);
}

.nav-mobile-menu a {
    display: block;
    padding: 14px 0;
    font-size: 15px;
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    transition: color 0.15s;
}

.nav-mobile-menu a:last-child { border-bottom: none; }
.nav-mobile-menu a:hover { color: var(--text-bright); }

.nav-mobile-menu .nav-mobile-cta {
    display: inline-block;
    margin-top: 12px;
    padding: 12px 22px;
    font-weight: 500;
    color: var(--gold);
    border-bottom: none;
    text-align: center;
    background: rgba(212, 175, 55, 0.08);
    border-radius: 8px;
}

.nav-mobile-menu .nav-mobile-cta:hover {
    color: var(--gold-bright);
}

/* ==========================================================================
   Post Feed (index, tag, author) — 2-column grid
   ========================================================================== */
.post-feed {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin: 0 0 40px;
}

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

.post-card:hover {
    border-color: var(--border-gold);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

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

.post-card-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}

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

.post-card-content {
    padding: 24px;
}

.post-card-tag-pill {
    display: inline-block;
    font-size: 12px;
    font-weight: 500;
    color: var(--gold);
    border: 1px solid var(--border-gold);
    padding: 3px 10px;
    border-radius: 20px;
    margin-bottom: 10px;
    transition: border-color 0.2s;
}

.post-card-tag-pill:hover {
    border-color: var(--gold-dim);
    color: var(--gold-bright);
}

.post-card-title {
    font-family: 'Syne', sans-serif;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 8px;
}

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

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

.post-card-excerpt {
    font-size: 15px;
    color: var(--text);
    line-height: 1.5;
    margin-bottom: 16px;
}

.post-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--gold-dim);
    flex-wrap: wrap;
}

.post-card-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: none;
    margin: 0;
}

.post-card-tag {
    color: var(--gold);
}

.meta-sep {
    margin: 0 2px;
    color: var(--gold-dim);
    opacity: 0.5;
}

/* --- Featured Post (first post in feed) --- */
.post-card-featured {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 32px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.post-card-featured:hover {
    border-color: var(--border-gold);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

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

.post-card-featured .post-card-image {
    width: 100%;
    height: 100%;
    min-height: 300px;
    aspect-ratio: auto;
    object-fit: cover;
}

.post-card-featured .post-card-content {
    padding: 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.post-card-featured .post-card-title {
    font-size: 24px;
}

.post-card-featured .post-card-excerpt {
    font-size: 16px;
}

/* ==========================================================================
   Single Post / Page
   ========================================================================== */
.post-full {
    padding-top: 48px;
    padding-bottom: 60px;
}

.post-full-header {
    margin-bottom: 32px;
    text-align: center;
}

.post-full-title {
    font-family: 'Syne', sans-serif;
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    color: var(--text-bright);
    line-height: 1.3;
    margin-bottom: 16px;
}

.post-full-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    color: var(--gold-dim);
}

.post-full-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: none;
    margin: 0;
}

.post-full-author {
    color: var(--text);
}

.post-full-image {
    margin-bottom: 32px;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.post-full-image img {
    width: 100%;
    display: block;
}

/* --- Post Content Typography --- */
.post-full-content {
    font-size: 16px;
    line-height: 1.75;
    color: var(--text);
}

.post-full-content h1,
.post-full-content h2,
.post-full-content h3,
.post-full-content h4,
.post-full-content h5,
.post-full-content h6 {
    font-family: 'Syne', sans-serif;
    color: var(--text-bright);
    margin-top: 2em;
    margin-bottom: 0.5em;
    line-height: 1.3;
}

.post-full-content h1 { font-size: 28px; font-weight: 700; }
.post-full-content h2 { font-size: 22px; font-weight: 700; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.post-full-content h3 { font-size: 18px; font-weight: 700; color: var(--text-bright); }
.post-full-content h4 { font-size: 16px; font-weight: 700; }

.post-full-content p {
    margin-bottom: 1.5em;
}

.post-full-content a {
    color: var(--gold);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.post-full-content a:hover {
    color: var(--gold-bright);
}

.post-full-content strong {
    color: var(--text-bright);
    font-weight: 600;
}

.post-full-content em {
    color: var(--text-bright);
    font-style: italic;
}

.post-full-content blockquote {
    border-left: 3px solid var(--gold-dim);
    padding: 4px 0 4px 20px;
    margin: 1.5em 0;
    color: var(--text-bright);
    font-style: italic;
    opacity: 0.85;
}

.post-full-content ul,
.post-full-content ol {
    padding-left: 24px;
    margin-bottom: 1.5em;
}

.post-full-content li {
    margin-bottom: 0.4em;
}

.post-full-content code {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.875em;
    background: var(--surface);
    color: var(--gold-bright);
    padding: 2px 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.post-full-content pre {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    margin: 1.5em 0;
    overflow-x: auto;
    line-height: 1.5;
}

.post-full-content pre code {
    font-family: 'IBM Plex Mono', monospace;
    background: none;
    border: none;
    padding: 0;
    border-radius: 0;
    font-size: 13px;
    color: var(--text);
}

.post-full-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2em 0;
}

.post-full-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
    font-size: 14px;
}

.post-full-content th {
    background: var(--surface);
    color: var(--gold-bright);
    font-weight: 600;
    text-align: left;
    padding: 10px 12px;
    border: 1px solid var(--border);
}

.post-full-content td {
    padding: 10px 12px;
    border: 1px solid var(--border);
}

.post-full-content img {
    border: 1px solid var(--border);
    border-radius: 8px;
    margin: 1.5em 0;
}

/* Back to blog link */
.post-back {
    display: inline-block;
    margin-top: 40px;
    font-size: 14px;
    color: var(--gold-dim);
    transition: color 0.2s;
}

.post-back:hover {
    color: var(--gold);
}

/* Ghost content cards — width modifiers */
.kg-width-wide {
    margin-left: -60px;
    margin-right: -60px;
    max-width: calc(100% + 120px);
}

.kg-width-full {
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    max-width: 100vw;
    width: 100vw;
}

/* Ghost gallery card */
.kg-gallery-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 1.5em 0;
}

.kg-gallery-row {
    display: flex;
    gap: 4px;
}

.kg-gallery-image {
    flex: 1;
    overflow: hidden;
}

.kg-gallery-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin: 0;
}

/* Ghost bookmark card */
.kg-bookmark-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin: 1.5em 0;
    overflow: hidden;
}

.kg-bookmark-container {
    display: flex;
    text-decoration: none;
    color: inherit;
    min-height: 140px;
}

.kg-bookmark-content {
    flex: 1;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-width: 0;
}

.kg-bookmark-title {
    font-family: 'Syne', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-bright);
    line-height: 1.4;
    margin-bottom: 6px;
}

.kg-bookmark-description {
    font-size: 14px;
    color: var(--text);
    line-height: 1.4;
    margin-bottom: 8px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.kg-bookmark-metadata {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--gold-dim);
}

.kg-bookmark-icon {
    width: 16px;
    height: 16px;
    border: none;
    margin: 0;
}

.kg-bookmark-author,
.kg-bookmark-publisher {
    color: var(--gold-dim);
}

.kg-bookmark-author::after {
    content: '\00B7';
    margin: 0 4px;
}

.kg-bookmark-thumbnail {
    width: 200px;
    flex-shrink: 0;
    overflow: hidden;
}

.kg-bookmark-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none;
    border-radius: 0;
    margin: 0;
}

/* Ghost image card */
.post-full-content .kg-image-card,
.post-full-content .kg-gallery-card {
    margin: 1.5em 0;
}

.post-full-content .kg-image-card img {
    margin: 0;
}

/* --- Post Tags --- */
.post-full-tags {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-link {
    font-size: 13px;
    color: var(--gold);
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 4px 12px;
    border-radius: 8px;
    transition: border-color 0.2s, background 0.2s;
}

.tag-link:hover {
    border-color: var(--gold-dim);
    background: var(--surface-raised);
    color: var(--gold-bright);
}

/* ==========================================================================
   Tag & Author Pages
   ========================================================================== */
.tag-header,
.author-header {
    text-align: center;
    padding: 48px 0 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}

.tag-name,
.author-name {
    font-family: 'Syne', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: var(--gold-bright);
    margin-bottom: 12px;
}

.tag-description,
.author-bio {
    font-size: 16px;
    color: var(--text);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.5;
}

/* ==========================================================================
   Newsletter Subscribe
   ========================================================================== */
.subscribe-section {
    border-top: 1px solid var(--border);
    padding: 64px 0;
    text-align: center;
}

.subscribe-title {
    font-family: 'Syne', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-bright);
    margin-bottom: 8px;
}

.subscribe-desc {
    color: var(--text);
    font-size: 15px;
    margin-bottom: 24px;
}

.subscribe-form {
    display: flex;
    gap: 8px;
    max-width: 400px;
    margin: 0 auto;
}

.subscribe-input {
    flex: 1;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-bright);
    font-size: 14px;
    font-family: inherit;
}

.subscribe-input::placeholder {
    color: var(--text);
    opacity: 0.6;
}

.subscribe-input:focus {
    outline: none;
    border-color: var(--gold-dim);
}

.subscribe-btn {
    padding: 12px 24px;
    background: var(--gold);
    color: var(--bg);
    border: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s;
}

.subscribe-btn:hover {
    background: var(--gold-bright);
}

.subscribe-feedback {
    margin-top: 12px;
    font-size: 14px;
    color: var(--green);
}

.subscribe-error {
    margin-top: 12px;
    font-size: 14px;
    color: var(--red);
}

/* ==========================================================================
   Error Page
   ========================================================================== */
.error-page {
    text-align: center;
    padding: 100px 0;
}

.error-code {
    font-family: 'Syne', sans-serif;
    font-size: 64px;
    font-weight: 800;
    color: var(--gold-bright);
    text-shadow: 0 0 40px rgba(212, 168, 67, 0.3);
    margin-bottom: 16px;
}

.error-message {
    font-size: 18px;
    color: var(--text);
    margin-bottom: 32px;
}

.error-link {
    font-size: 14px;
    font-weight: 500;
    color: var(--bg);
    background: var(--gold);
    padding: 10px 24px;
    border-radius: 8px;
    display: inline-block;
    transition: background 0.2s;
}

.error-link:hover {
    background: var(--gold-bright);
}

/* ==========================================================================
   Pagination
   ========================================================================== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 40px 0;
    font-size: 14px;
}

.pagination-prev,
.pagination-next {
    color: var(--gold);
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: border-color 0.2s, background 0.2s;
}

.pagination-prev:hover,
.pagination-next:hover {
    border-color: var(--gold-dim);
    background: var(--surface);
}

.pagination-prev.disabled,
.pagination-next.disabled {
    color: var(--text);
    opacity: 0.3;
    border-color: transparent;
    pointer-events: none;
}

.pagination-count {
    color: var(--gold-dim);
    font-size: 13px;
}

/* ==========================================================================
   Footer (matched to shared.ts FOOTER_CSS)
   ========================================================================== */
.footer {
    border-top: 1px solid var(--border);
    padding: 48px 24px;
    text-align: center;
    font-size: 13px;
    color: var(--text);
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--gold);
}

.footer-oss {
    margin-top: 16px;
    font-size: 12px;
    color: var(--text);
    opacity: 0.5;
    line-height: 1.6;
}

.footer-oss a {
    color: var(--gold-dim);
    text-decoration: none;
}

.footer-oss a:hover {
    color: var(--gold);
}

/* ==========================================================================
   Prism.js Syntax Highlighting Overrides
   ========================================================================== */
.token.keyword,
.token.tag,
.token.operator {
    color: var(--gold) !important;
}

.token.string,
.token.attr-value {
    color: var(--green) !important;
}

.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
    color: var(--gold-dim) !important;
    font-style: italic;
}

.token.function,
.token.class-name {
    color: var(--cyan) !important;
}

.token.number,
.token.boolean {
    color: var(--gold-bright) !important;
}

.token.punctuation {
    color: var(--text) !important;
}

.token.property,
.token.constant,
.token.symbol {
    color: var(--gold) !important;
}

.token.selector,
.token.important,
.token.atrule,
.token.builtin {
    color: var(--gold-bright) !important;
}

/* ==========================================================================
   Responsive — 640px breakpoint
   ========================================================================== */
@media (max-width: 640px) {
    .nav-right { display: none; }
    .nav-burger { display: block; }

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

    .post-card-featured .post-card-image {
        min-height: 200px;
    }

    .post-card-featured .post-card-title {
        font-size: 20px;
    }

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

    .post-card-content {
        padding: 16px;
    }

    .post-card-title {
        font-size: 16px;
    }

    .post-full-title {
        font-size: 22px;
    }

    .post-full-content {
        font-size: 15px;
    }

    .post-full-content pre {
        padding: 14px;
        font-size: 12px;
    }

    .tag-name,
    .author-name {
        font-size: 18px;
    }

    .error-code {
        font-size: 40px;
    }

    .pagination {
        gap: 12px;
    }

    .footer-links {
        gap: 16px;
    }

    .subscribe-form {
        flex-direction: column;
    }

    .kg-width-wide {
        margin-left: 0;
        margin-right: 0;
        max-width: 100%;
    }
}
