/* ====================================
   CSS Reset & Base Styles
   ==================================== */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'iA Writer Quattro', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #1a1a1a;
    background-color: #ffffff;
    margin: 0;
    padding: 0;
}

.site-wrapper {
    margin: 0;
    padding: 0;
}

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

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

/* ====================================
   Full-Screen Hero Splash
   ==================================== */

.hero-splash {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

.hero-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 1;
}

.hero-fallback {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Navigation in top-left */
.hero-nav {
    position: absolute;
    top: 2rem;
    left: 4%;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.hero-nav-separator {
    font-size: 1rem;
    color: #ccc;
}


.site-title {
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    text-transform: lowercase;
}

.site-title a {
    color: #ffffff;
    transition: opacity 0.2s ease;
}

.site-title a:hover {
    opacity: 0.7;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-links li a {
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 300;
    transition: opacity 0.2s ease;
}

.nav-links li a:hover {
    opacity: 0.7;
}

/* ====================================
   Stories Section - Middleplane Inspired
   ==================================== */

.stories-section {
    padding: 4rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.stories-container {
    width: 100%;
}

.stories-heading {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 600;
    margin-bottom: 3rem;
    text-align: center;
    letter-spacing: -0.01em;
}

/* ====================================
   Post Grid - Card Based Layout
   ==================================== */

.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 3rem;
    margin-bottom: 4rem;
}

.story-card {
    position: relative;
    overflow: hidden;
    background: #ffffff;
    transition: transform 0.3s ease;
}

.story-card:hover {
    transform: translateY(-5px);
}

.story-card-image-link {
    display: block;
    width: 100%;
    overflow: hidden;
}

.story-card-image {
    width: 100%;
    height: 400px;
    background-size: cover;
    background-position: center;
    transition: transform 0.5s ease;
}

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

.story-card-content {
    padding: 2rem 0;
}

.story-card-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.story-card-title a {
    transition: color 0.2s ease;
}

.story-card-title a:hover {
    color: #667eea;
}

.story-card-excerpt {
    font-size: 1rem;
    line-height: 1.6;
    color: #666;
    margin-bottom: 1rem;
}

.story-card-meta {
    font-size: 0.9rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ====================================
   Regular Post Feed (for index.hbs)
   ==================================== */

.site-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 2rem;
}

.post-feed {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2.5rem;
}

.post-card {
    background: #ffffff;
    overflow: hidden;
}

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

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

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

.post-card-content {
    padding: 1.5rem 0;
}

.post-card-title {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.post-card-excerpt {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #666;
    margin-bottom: 1rem;
}

.post-card-meta {
    font-size: 0.85rem;
    color: #999;
}

/* ====================================
   Individual Post Page - Middleplane Inspired
   ==================================== */

.post-single {
    max-width: 720px;
    margin: 0 auto;
    padding: 5rem 2rem 8rem;
    padding-top: 2rem !important;
}

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

.post-single-meta-top {
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.meta-separator {
    color: #ccc;
}

.post-single-title {
    font-size: clamp(2.25rem, 5vw, 3.75rem);
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.025em;
    margin-bottom: 2rem;
    color: #1a1a1a;
}

.post-single-excerpt {
    font-size: 1.25rem;
    line-height: 1.6;
    color: #666;
    margin-top: 1.5rem;
    font-weight: 400;
}

.post-single-image {
    width: 100%;
    margin: 2rem 0 4rem;
}

.post-single-image img {
    width: 100%;
    height: auto;
    display: block;
}

.post-single-content {
    font-size: 1.125rem;
    line-height: 1.75;
    color: #1a1a1a;
}

.post-single-content p {
    margin-bottom: 1.75rem;
}

.post-single-content h2 {
    font-size: 1.875rem;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.015em;
    margin: 3rem 0 1.25rem;
    color: #1a1a1a;
}

.post-single-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: -0.01em;
    margin: 2.5rem 0 1rem;
    color: #1a1a1a;
}

.post-single-content h4 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 2rem 0 0.75rem;
}

.post-single-content ul,
.post-single-content ol {
    margin-bottom: 1.75rem;
    padding-left: 1.5rem;
}

.post-single-content li {
    margin-bottom: 0.5rem;
}

.post-single-content blockquote {
    border-left: 3px solid #1a1a1a;
    padding-left: 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    color: #4a4a4a;
}

.post-single-content img {
    width: 100%;
    height: auto;
    margin: 2.5rem 0;
}

.post-single-content code {
    font-family: 'iA Writer Mono', monospace;
    background: #f5f5f5;
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-size: 0.9em;
}

.post-single-content pre {
    background: #f5f5f5;
    padding: 1.5rem;
    border-radius: 4px;
    overflow-x: auto;
    margin: 2rem 0;
}

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

.post-single-content a {
    color: #1a1a1a;
    text-decoration: underline;
    text-decoration-color: #ccc;
    text-underline-offset: 3px;
    transition: text-decoration-color 0.2s ease;
}

.post-single-content a:hover {
    text-decoration-color: #1a1a1a;
}

.post-single-footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid #e5e5e5;
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.post-tag {
    font-size: 0.875rem;
    color: #666;
    padding: 0.4rem 0.85rem;
    background: #f5f5f5;
    border-radius: 20px;
    transition: background 0.2s ease, color 0.2s ease;
}

.post-tag:hover {
    background: #1a1a1a;
    color: #fff;
}

/* ====================================
   Blog Page - Middleplane Inspired
   ==================================== */

.blog-page {
    padding: 0 5vw 10rem;
    max-width: 90%;
    margin: 0 auto;
    position: relative;
}

@media (min-width: 768px) {
    .blog-page {
        padding: 0 8vw 10rem;
        max-width: 85%;
    }
}

@media (min-width: 1200px) {
    .blog-page {
        padding: 0 10vw 12rem;
        max-width: 80%;
    }
}

@media (min-width: 1600px) {
    .blog-page {
        max-width: 1400px;
        padding: 0 12vw 12rem;
    }
}

/* Force section to top */
section.blog-page {
    margin-top: 0 !important;
    padding-top: 2rem !important;
    padding-bottom: 8rem;
}

.blog-container {
    margin: 0;
    padding: 0;
}

.blog-header {
    margin: 0 0 2rem 0;
    padding: 1.5rem 0 0 0;
    text-align: center;
}

.blog-nav {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
}

.blog-nav-link {
    font-size: 1rem;
    font-weight: 400;
    color: #1a1a1a;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.blog-nav-link:hover {
    opacity: 0.6;
}

.blog-nav-current {
    font-weight: 600;
    cursor: default;
}

.blog-nav-current:hover {
    opacity: 1;
}

.blog-nav-separator {
    font-size: 1rem;
    color: #ccc;
}

.blog-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
    margin-bottom: 4rem;
    margin-top: 0;
}

.blog-card {
    position: relative;
}

/* Multi-column layout on larger screens */
@media (min-width: 768px) {
    .blog-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 4rem;
        row-gap: 8rem;
    }

    /* Dynamic pattern: creates visual rhythm */
    /* Pattern: Full, Half-Half, Full, Half-Half */

    /* First card: full-width, hero size */
    .blog-card:nth-child(6n+1) {
        grid-column: span 2;
        display: flex;
        justify-content: center;
    }

    .blog-card:nth-child(6n+1) .blog-card-link {
        max-width: 50%;
    }

    /* Cards 2-3: half-width, medium */
    .blog-card:nth-child(6n+2),
    .blog-card:nth-child(6n+3) {
        grid-column: span 1;
    }

    /* Card 4: full-width, medium */
    .blog-card:nth-child(6n+4) {
        grid-column: span 2;
        display: flex;
        justify-content: center;
    }

    .blog-card:nth-child(6n+4) .blog-card-link {
        max-width: 50%;
    }

    /* Cards 5-6: half-width, taller */
    .blog-card:nth-child(6n+5),
    .blog-card:nth-child(6n) {
        grid-column: span 1;
    }
}

/* Tag-based sizing overrides (for future use) */
/* Example: Add 'featured' or 'large' tag to make a post full-width */
.blog-card.tag-featured,
.blog-card.tag-large {
    grid-column: span 2 !important;
}

@media (min-width: 768px) {
    .blog-card.tag-featured,
    .blog-card.tag-large {
        display: flex !important;
        justify-content: center !important;
    }

    .blog-card.tag-featured .blog-card-link,
    .blog-card.tag-large .blog-card-link {
        max-width: 50% !important;
    }
}

.blog-card.tag-small {
    grid-column: span 1 !important;
}

.blog-card-link {
    display: block;
    width: 100%;
}

.blog-card-image-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    display: block;
}

.blog-card-image {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 0.4s ease;
}

/* .blog-card:hover .blog-card-image {
    transform: scale(1.02);
} */

/* Dark gradient overlay on bottom of image for text readability */
.blog-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70%;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0) 0%,
        rgba(0, 0, 0, 0.3) 40%,
        rgba(0, 0, 0, 0.7) 100%
    );
    z-index: 1;
}

/* Content positioned at bottom of image */
.blog-card-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2rem 2rem;
    z-index: 2;
    color: #ffffff;
}

.blog-card-title {
    font-size: clamp(1.75rem, 3vw, 2.25rem);
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.02em;
    margin-bottom: 0;
    color: #ffffff;
}

.blog-card-excerpt {
    font-size: 1.125rem;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 2rem;
    display: none;
}

.blog-card-meta {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.7);
    display: none;
    align-items: center;
    gap: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

@media (min-width: 768px) {
    .blog-card-content {
        padding: 2rem 3rem;
    }
}

@media (min-width: 1200px) {
    .blog-header {
        margin-bottom: 2rem;
    }

    /* .blog-page {
        padding: 8rem 4rem 12rem;
    } */

    .blog-card-content {
        padding: 2.5rem 3.5rem;
    }
}

/* ====================================
   About Page
   ==================================== */

.about-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 4rem 2rem 8rem;
}

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

.about-title {
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 2rem;
}

.about-content {
    font-size: 1.2rem;
    line-height: 2;
}

.about-content p {
    margin-bottom: 2rem;
}

.about-content h2 {
    font-size: 2rem;
    font-weight: 600;
    margin: 2rem 0 2rem;
}

.about-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 2rem 0 2rem;
}

.about-contact {
    font-size: 1.2rem;
    line-height: 2;
    margin-bottom: 0rem;
    line-height: 2;
}

/* Lead paragraphs - larger, philosophical statements */
.about-lead {
    font-size: 1.5rem;
    font-weight: 400;
    line-height: 2;
    margin-bottom: 2rem;
    color: #1a1a1a;
}

/* Interlude text - poetic, visual descriptions */
.about-interlude {
    font-size: 1rem;
    font-style: italic;
    color: #666;
    margin-bottom: 2rem;
    padding-left: 2rem;
}

/* Regular paragraphs - explanatory text */
.about-paragraph {
    font-size: 1.2rem;
    line-height: 2;
    margin-bottom: 2rem;
    color: #1a1a1a;
}

/* Spacer between sections */
.about-spacer {
    height: 2rem;
}

.about-link {
    color: #666;
}

/* Images in about page */
.about-images {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    margin: 4rem 0;
}

.about-image {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
}

@media (max-width: 768px) {
    .about-images {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* ====================================
   Ghost Card Widths (Koenig Editor Support)
   ==================================== */

.kg-width-wide {
    position: relative;
    width: 85vw;
    min-width: 100%;
    margin: 2.5rem auto;
}

.kg-width-full {
    position: relative;
    width: 100vw;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}

/* ====================================
   Responsive Design
   ==================================== */

@media (max-width: 768px) {
    .post-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .stories-section,
    .blog-page {
        padding: 3rem 1.5rem;
    }

    .hero-nav {
        top: 1.5rem;
        left: 1.5rem;
    }
}

@media (max-width: 480px) {
    .story-card-image {
        height: 300px;
    }

    .stories-heading,
    .blog-title {
        margin-bottom: 2rem;
    }

    .hero-nav {
        top: 1rem;
        left: 1rem;
    }
}
