/* ==========================================================================
   GGEZ Ghost Theme – screen.css
   Matches the style system from ggez.dev
   ========================================================================== */

/* --- Custom Properties (mirrored from main site) --- */
:root {
    color-scheme: light;
    font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    line-height: 1.5;
    --accent: #c30d0d;
    --accent-rgb: 195, 13, 13;
    --ink: #141414;
    --ink-soft: #4f4f4f;
    --panel: #ffffff;
    --line: #e6e6e6;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 0% 0%, rgba(var(--accent-rgb), 0.08), transparent 34%),
        radial-gradient(circle at 100% 20%, rgba(var(--accent-rgb), 0.06), transparent 38%),
        linear-gradient(180deg, #ffffff 0%, #fcfcfc 52%, #f8f8f8 100%);
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

a:focus-visible,
button:focus-visible {
    outline: 3px solid rgba(var(--accent-rgb), 0.3);
    outline-offset: 2px;
}

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

/* --- Utility --- */
.icon {
    width: 1rem;
    height: 1rem;
    flex: 0 0 auto;
}

.hover-lift {
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(var(--accent-rgb), 0.08);
    border-color: rgba(var(--accent-rgb), 0.35);
}

/* --- Layout --- */
.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 6vw;
}

/* --- Ghost content width classes (Koenig editor cards) --- */
.kg-width-wide {
    position: relative;
    width: 85vw;
    min-width: 100%;
    margin: 2rem calc(50% - 42.5vw);
}

.kg-width-full {
    position: relative;
    width: 100vw;
    min-width: 100%;
    margin: 2rem calc(50% - 50vw);
}

.kg-width-wide img,
.kg-width-full img {
    width: 100%;
}

/* --- Header (matches main site) --- */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 6vw 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.brand {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.brand-logo {
    width: clamp(150px, 20vw, 220px);
    height: auto;
}

.brand-title {
    font-weight: 700;
    font-size: 1.4rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.brand-sub {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--ink-soft);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.95rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    font-weight: 600;
}

.nav-links a {
    color: var(--ink-soft);
    transition: color 180ms ease, transform 180ms ease;
}

.nav-links a:hover {
    color: var(--accent);
    transform: translateY(-1px);
}

.nav-cta {
    border: 1px solid rgba(var(--accent-rgb), 0.4);
    color: var(--ink-soft);
    border-radius: 999px;
    padding: 0.5rem 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
    background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.06), rgba(var(--accent-rgb), 0.015));
    transition: border-color 180ms ease, color 180ms ease;
}

.nav-cta:hover {
    border-color: rgba(var(--accent-rgb), 0.55);
    color: var(--accent);
}

.nav-cta-primary {
    color: #fff !important;
    background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.9), rgba(var(--accent-rgb), 0.72));
    box-shadow: 0 8px 18px rgba(var(--accent-rgb), 0.24);
    border-color: rgba(var(--accent-rgb), 0.4);
}

.nav-cta-primary:hover {
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: 0 12px 22px rgba(var(--accent-rgb), 0.3);
}

/* --- Typography (mirrored) --- */
.eyebrow {
    margin: 0 0 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.72rem;
    color: var(--accent);
}

h1, h2, h3 {
    line-height: 1.15;
}

/* --- Buttons (mirrored from main site) --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.42rem;
    font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    font-weight: 600;
    border-radius: 999px;
    padding: 0.76rem 1.2rem;
    border: 1px solid transparent;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.78rem;
    transition: transform 180ms ease, box-shadow 180ms ease;
    cursor: pointer;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn.primary {
    background: linear-gradient(135deg, rgba(var(--accent-rgb), 1), rgba(var(--accent-rgb), 0.78));
    color: #fff;
    box-shadow: 0 10px 22px rgba(var(--accent-rgb), 0.22);
}

.btn.ghost {
    border-color: rgba(var(--accent-rgb), 0.35);
    color: var(--accent);
    background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.09), rgba(var(--accent-rgb), 0.03));
}

/* --- Blog Hero --- */
.blog-hero {
    padding: 2.5rem 0 2rem;
}

.blog-hero h1 {
    margin: 0 0 0.8rem;
    font-size: clamp(2rem, 4.8vw, 3.2rem);
    line-height: 1.05;
}

.hero-sub {
    margin: 0;
    color: var(--ink-soft);
    max-width: 52rem;
    font-size: 1.05rem;
}

/* --- Section (mirrored) --- */
.section {
    padding: 2.8rem 0;
    border-radius: 16px;
    box-shadow: 0 8px 22px rgba(15, 15, 15, 0.04);
    margin-bottom: 0.9rem;
}

.section.alt {
    background:
        linear-gradient(180deg, rgba(var(--accent-rgb), 0.1), rgba(var(--accent-rgb), 0.06)),
        #ffffff;
    border: 1px solid rgba(var(--accent-rgb), 0.28);
    border-radius: 16px;
    padding: 2.2rem;
    box-shadow: 0 14px 32px rgba(var(--accent-rgb), 0.14);
}

.section-title {
    max-width: 48rem;
    margin-bottom: 1.3rem;
}

.section-title h2 {
    margin: 0.38rem 0 0;
    font-size: clamp(1.4rem, 2.9vw, 2.2rem);
}

/* --- Featured Post --- */
.featured-section {
    background: #fff;
    padding: 2.2rem;
}

.featured-post {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    background: linear-gradient(180deg, #ffffff, #fcfcfc);
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
}

.featured-image-link {
    display: block;
}

.featured-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    min-height: 280px;
}

.featured-content {
    padding: 1.5rem 1.5rem 1.5rem 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.featured-content h2 {
    margin: 0.4rem 0 0.6rem;
    font-size: clamp(1.3rem, 2.4vw, 1.8rem);
}

.featured-content p {
    color: var(--ink-soft);
    margin: 0 0 1rem;
}

/* --- Post Grid --- */
.post-grid {
    display: grid;
    gap: 0.8rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* --- Post Card --- */
.post-card {
    background: linear-gradient(180deg, #ffffff, #fcfcfc);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.post-card-image-link {
    display: block;
    aspect-ratio: 16 / 10;
    overflow: hidden;
}

.post-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 320ms ease;
}

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

.post-card-content {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.post-card-tag {
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.68rem;
    color: var(--accent);
    font-weight: 600;
}

.post-card-title {
    margin: 0.35rem 0 0.45rem;
    font-size: 1.05rem;
    line-height: 1.25;
}

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

.post-card-excerpt {
    color: var(--ink-soft);
    margin: 0;
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.5;
}

.post-card-meta {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-top: 0.8rem;
    font-size: 0.76rem;
    color: var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.post-card-reading-time::before {
    content: "·";
    margin-right: 0.8rem;
}

/* --- Single Post --- */
.post-header {
    padding: 2.5rem 0 1.5rem;
}

.post-title {
    margin: 0 0 0.6rem;
    font-size: clamp(2rem, 4.2vw, 3rem);
    line-height: 1.1;
    max-width: 18ch;
}

.post-excerpt {
    color: var(--ink-soft);
    font-size: 1.15rem;
    margin: 0 0 1rem;
    max-width: 52rem;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.82rem;
    color: var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.post-meta-author {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.post-meta-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.post-meta-reading::before {
    content: "·";
    margin-right: 1rem;
}

.post-feature-image {
    margin: 0 auto 2rem;
    max-width: 1000px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 14px 32px rgba(var(--accent-rgb), 0.1);
}

.post-feature-image img {
    width: 100%;
}

.post-feature-image figcaption {
    text-align: center;
    padding: 0.6rem 1rem;
    font-size: 0.82rem;
    color: var(--ink-soft);
}

/* --- Post Content (Ghost editor output) --- */
.post-content {
    max-width: 720px;
    margin: 0 auto;
    padding-bottom: 3rem;
    font-size: 1.05rem;
    line-height: 1.7;
}

.post-content h2 {
    margin-top: 2.5rem;
    margin-bottom: 0.6rem;
    font-size: 1.6rem;
}

.post-content h3 {
    margin-top: 2rem;
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
}

.post-content p {
    margin: 0 0 1.4rem;
}

.post-content a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: rgba(var(--accent-rgb), 0.3);
    text-underline-offset: 2px;
    transition: text-decoration-color 180ms ease;
}

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

.post-content blockquote {
    margin: 1.6rem 0;
    padding: 1rem 1.4rem;
    border-left: 3px solid var(--accent);
    background: rgba(var(--accent-rgb), 0.04);
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: var(--ink-soft);
}

.post-content pre {
    margin: 1.6rem 0;
    padding: 1.2rem;
    background: var(--ink);
    color: #e6e6e6;
    border-radius: 12px;
    overflow-x: auto;
    font-size: 0.88rem;
    line-height: 1.6;
}

.post-content code {
    font-size: 0.88em;
    background: rgba(var(--accent-rgb), 0.08);
    padding: 0.15em 0.4em;
    border-radius: 4px;
}

.post-content pre code {
    background: none;
    padding: 0;
    border-radius: 0;
}

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

.post-content li + li {
    margin-top: 0.4rem;
}

.post-content img {
    border-radius: 12px;
    margin: 1.6rem 0;
}

.post-content hr {
    border: none;
    height: 1px;
    margin: 2.5rem 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(var(--accent-rgb), 0.35) 20%,
        rgba(var(--accent-rgb), 0.5) 50%,
        rgba(var(--accent-rgb), 0.35) 80%,
        transparent 100%
    );
}

/* Ghost bookmark cards */
.post-content .kg-bookmark-card {
    margin: 1.6rem 0;
}

.post-content .kg-bookmark-container {
    display: flex;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    transition: border-color 180ms ease, box-shadow 180ms ease;
}

.post-content .kg-bookmark-container:hover {
    border-color: rgba(var(--accent-rgb), 0.35);
    box-shadow: 0 8px 20px rgba(var(--accent-rgb), 0.08);
}

.post-content .kg-bookmark-content {
    padding: 1rem;
    flex: 1;
}

.post-content .kg-bookmark-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.post-content .kg-bookmark-description {
    font-size: 0.85rem;
    color: var(--ink-soft);
    margin-top: 0.3rem;
}

.post-content .kg-bookmark-thumbnail {
    width: 200px;
    min-height: 100%;
}

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

/* Ghost gallery */
.post-content .kg-gallery-container {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin: 1.6rem 0;
}

.post-content .kg-gallery-row {
    display: flex;
    gap: 0.6rem;
}

.post-content .kg-gallery-image img {
    margin: 0;
    border-radius: 8px;
}

/* --- Tags (post footer) --- */
.post-tags {
    padding: 1rem 6vw 2rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    max-width: 720px;
    margin: 0 auto;
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    font-size: 0.76rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border: 1px solid rgba(var(--accent-rgb), 0.22);
    border-radius: 999px;
    padding: 0.4rem 0.75rem;
    color: var(--ink-soft);
    background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.06), rgba(var(--accent-rgb), 0.015));
    transition: border-color 180ms ease, color 180ms ease;
}

.tag-pill:hover {
    border-color: rgba(var(--accent-rgb), 0.45);
    color: var(--accent);
}

/* --- Author Page --- */
.author-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.author-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(var(--accent-rgb), 0.35);
    box-shadow: 0 10px 26px rgba(var(--accent-rgb), 0.18);
}

.author-link {
    color: var(--accent);
    font-size: 0.88rem;
}

/* --- Pagination --- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem 0;
}

.pagination-info {
    font-size: 0.82rem;
    color: var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* --- Blog CTA Section --- */
.blog-cta {
    text-align: center;
    margin: 2rem 0;
}

.blog-cta h2 {
    margin: 0.4rem 0 0.5rem;
    font-size: clamp(1.4rem, 2.9vw, 2.2rem);
}

.blog-cta p {
    color: var(--ink-soft);
    margin: 0 0 1.2rem;
}

.blog-cta-actions {
    display: flex;
    gap: 0.7rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* --- Error Page --- */
.error-page {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.error-page .blog-hero {
    text-align: center;
}

/* --- Related Posts --- */
.related-posts {
    margin-top: 1rem;
}

/* --- Footer (mirrored from main site) --- */
.site-footer {
    margin-top: 2rem;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    background: linear-gradient(130deg, rgba(var(--accent-rgb), 0.92), rgba(var(--accent-rgb), 0.82));
    padding: 1.6rem 6vw 1rem;
    color: #fff;
}

.site-footer a {
    color: #fff;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    align-items: start;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-column {
    display: grid;
    gap: 0.5rem;
    align-content: start;
}

.footer-column h3 {
    margin: 0;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.9;
}

.footer-brand {
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.site-footer p {
    margin: 0.32rem 0 0;
}

.footer-summary {
    color: rgba(255, 255, 255, 0.92);
    margin-top: 0.2rem;
}

.footer-link {
    font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    font-weight: 600;
    font-size: 0.88rem;
    opacity: 0.9;
    transition: opacity 180ms ease;
}

.footer-link:hover {
    opacity: 1;
}

.site-footer .btn.primary {
    background: linear-gradient(180deg, #ffffff, #f3f3f3);
    color: var(--accent);
}

.footer-bottom {
    margin-top: 1rem;
    padding-top: 0.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.28);
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.footer-bottom p {
    margin: 0;
    font-size: 0.84rem;
    opacity: 0.92;
}

/* --- Ghost default navigation styling ---
   Ghost outputs its navigation as a series of <li> tags.
   We restyle them to match the nav-links pattern. */
.site-header .nav-links ul,
.site-header .nav-links ol {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 0.95rem;
    align-items: center;
}

.site-header .nav-links li a {
    color: var(--ink-soft);
    transition: color 180ms ease, transform 180ms ease;
    position: relative;
}

.site-header .nav-links li a:hover {
    color: var(--accent);
    transform: translateY(-1px);
}

.site-header .nav-links li a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -0.28rem;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.2), rgba(var(--accent-rgb), 0.8));
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 180ms ease;
}

.site-header .nav-links li a:hover::after {
    transform: scaleX(1);
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .post-grid {
        grid-template-columns: 1fr;
    }

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

    .featured-content {
        padding: 1.2rem;
    }

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

@media (max-width: 720px) {
    .page-container {
        padding: 0 5vw;
    }

    .site-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 1rem 5vw;
    }

    .nav-links {
        flex-wrap: wrap;
    }

    .section.alt {
        padding: 1.5rem 1rem;
    }

    .author-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hover-lift,
    .btn,
    .nav-cta,
    .nav-links a,
    .tag-pill,
    .footer-link {
        transition: none;
    }

    .post-card:hover .post-card-image {
        transform: none;
    }
}
