/* PAPERTALK - Minimalist News Theme */
:root {
    --ochre: #CC7722;
    --terracotta: #C04000;
    --brown: #3D2B1F;
    --tan: #D2B48C;
    --sand: #F5F0E8;
    --cream: #FDFBF7;
    --ink: #1A1A1A;
    --grey: #6B6B6B;
    --light: #E8E4DC;
    
    --font: 'DM Sans', -apple-system, sans-serif;
    --serif: 'Fraunces', Georgia, serif;
    
    --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --max: 1400px;
}

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

html { 
    font-size: 16px; 
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font);
    background: var(--cream);
    color: var(--ink);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main { flex: 1; }

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

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

/* ═══════════════════════════════════════
   HEADER
   ═══════════════════════════════════════ */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--cream);
    border-bottom: 1px solid var(--light);
    backdrop-filter: blur(20px);
}

.header-inner {
    max-width: var(--max);
    margin: 0 auto;
    padding: 1.25rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-family: var(--serif);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brown);
    letter-spacing: -0.02em;
}

.logo img { height: 40px; }

.nav { display: flex; gap: 2.5rem; }
.nav a {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--grey);
    transition: color 0.2s var(--ease);
    position: relative;
}
.nav a:hover { color: var(--ochre); }
.nav a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--ochre);
    transition: width 0.3s var(--ease);
}
.nav a:hover::after { width: 100%; }

.menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--ink);
}

/* ═══════════════════════════════════════
   FEED - MASONRY GRID
   ═══════════════════════════════════════ */
.feed {
    max-width: var(--max);
    margin: 0 auto;
    padding: 3rem 2rem;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

/* ═══════════════════════════════════════
   CARD
   ═══════════════════════════════════════ */
.card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: all 0.4s var(--ease);
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.08);
}

.card-link { display: block; }

.card-img {
    aspect-ratio: 16/10;
    overflow: hidden;
    background: var(--light);
}

.card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s var(--ease);
}

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

.card-body { padding: 1.5rem; }

.card-tag {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ochre);
    margin-bottom: 0.75rem;
}

.card-title {
    font-family: var(--serif);
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--ink);
    margin-bottom: 0.75rem;
    transition: color 0.2s var(--ease);
}

.card:hover .card-title { color: var(--terracotta); }

.card-excerpt {
    font-size: 0.9rem;
    color: var(--grey);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--grey);
}

.card-meta .dot {
    width: 3px;
    height: 3px;
    background: var(--grey);
    border-radius: 50%;
}

/* Featured Card */
.card-featured {
    grid-column: span 2;
    display: grid;
    grid-template-columns: 1.2fr 1fr;
}

.card-featured .card-link {
    display: contents;
}

.card-featured .card-img {
    aspect-ratio: auto;
    height: 100%;
    border-radius: 12px 0 0 12px;
}

.card-featured .card-body {
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.card-featured .card-title {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.card-featured .card-excerpt {
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

/* ═══════════════════════════════════════
   POST
   ═══════════════════════════════════════ */
.post {
    max-width: 720px;
    margin: 0 auto;
    padding: 4rem 2rem;
}

.post-header { 
    text-align: center; 
    margin-bottom: 3rem; 
}

.post-tag {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: white;
    background: var(--ochre);
    padding: 0.4rem 1rem;
    border-radius: 50px;
    margin-bottom: 1.5rem;
}

.post-title {
    font-family: var(--serif);
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    line-height: 1.15;
    color: var(--brown);
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}

.post-desc {
    font-size: 1.25rem;
    color: var(--grey);
    margin-bottom: 2rem;
}

.post-meta {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    text-align: left;
}

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

.post-author {
    display: block;
    font-weight: 600;
    color: var(--ink);
}

.post-date {
    font-size: 0.85rem;
    color: var(--grey);
}

.post-img {
    margin: 3rem -4rem;
    border-radius: 16px;
    overflow: hidden;
}

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

.post-img figcaption {
    text-align: center;
    font-size: 0.85rem;
    color: var(--grey);
    margin-top: 1rem;
}

/* Post Content */
.post-content {
    font-size: 1.125rem;
    line-height: 1.85;
    color: var(--ink);
}

.post-content > * + * { margin-top: 1.5rem; }

.post-content h2 {
    font-family: var(--serif);
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--brown);
    margin-top: 3rem;
}

.post-content h3 {
    font-size: 1.35rem;
    font-weight: 600;
    margin-top: 2.5rem;
}

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

.post-content blockquote {
    border-left: 3px solid var(--ochre);
    padding-left: 1.5rem;
    font-style: italic;
    color: var(--grey);
}

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

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

.post-content figure {
    margin: 2rem 0;
}

.post-content figcaption {
    text-align: center;
    font-size: 0.85rem;
    color: var(--grey);
    margin-top: 0.75rem;
}

.post-content pre {
    background: var(--ink);
    color: var(--sand);
    padding: 1.5rem;
    border-radius: 12px;
    overflow-x: auto;
    font-size: 0.9rem;
}

.post-content code {
    background: var(--light);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
}

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

/* Post Tags */
.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--light);
}

.post-tags a {
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
    background: var(--sand);
    border-radius: 50px;
    color: var(--grey);
    transition: all 0.2s var(--ease);
}

.post-tags a:hover {
    background: var(--ochre);
    color: white;
}

/* Related Posts */
.related {
    max-width: 900px;
    margin: 0 auto;
    padding: 4rem 2rem;
}

.related h3 {
    font-family: var(--serif);
    font-size: 1.5rem;
    margin-bottom: 2rem;
    color: var(--brown);
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.related-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: opacity 0.2s var(--ease);
}

.related-card:hover { opacity: 0.7; }

.related-card img {
    aspect-ratio: 4/3;
    object-fit: cover;
    border-radius: 8px;
}

.related-card span {
    font-weight: 500;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* ═══════════════════════════════════════
   PAGE
   ═══════════════════════════════════════ */
.page {
    max-width: 720px;
    margin: 0 auto;
    padding: 4rem 2rem;
}

.page-title {
    font-family: var(--serif);
    font-size: 3rem;
    font-weight: 700;
    color: var(--brown);
    margin-bottom: 2rem;
}

.page-img {
    border-radius: 16px;
    margin-bottom: 2rem;
}

.page-content {
    font-size: 1.125rem;
    line-height: 1.85;
}

/* ═══════════════════════════════════════
   ARCHIVE
   ═══════════════════════════════════════ */
.archive-header {
    max-width: var(--max);
    margin: 0 auto;
    padding: 4rem 2rem 0;
    text-align: center;
}

.archive-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ochre);
}

.archive-header h1 {
    font-family: var(--serif);
    font-size: 3rem;
    font-weight: 700;
    color: var(--brown);
    margin: 0.5rem 0;
}

.archive-header p {
    color: var(--grey);
    max-width: 500px;
    margin: 0 auto;
}

.author-img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1rem;
}

/* ═══════════════════════════════════════
   PAGINATION
   ═══════════════════════════════════════ */
.pager {
    max-width: var(--max);
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
}

.pager-btn {
    font-weight: 500;
    color: var(--terracotta);
    transition: opacity 0.2s var(--ease);
}

.pager-btn:hover { opacity: 0.7; }

.pager-num {
    font-size: 0.85rem;
    color: var(--grey);
}

/* ═══════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════ */
.footer {
    background: var(--brown);
    color: var(--tan);
    margin-top: 4rem;
}

.footer-inner {
    max-width: var(--max);
    margin: 0 auto;
    padding: 4rem 2rem;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 4rem;
}

.footer-title {
    font-family: var(--serif);
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    display: block;
    margin-bottom: 0.5rem;
}

.footer-brand p {
    font-size: 0.9rem;
    opacity: 0.8;
}

.footer-nav {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.footer-nav a {
    font-size: 0.9rem;
    opacity: 0.8;
    transition: opacity 0.2s var(--ease);
}

.footer-nav a:hover { opacity: 1; color: var(--ochre); }

.footer-copy {
    font-size: 0.85rem;
    opacity: 0.6;
    text-align: right;
}

/* ═══════════════════════════════════════
   ERROR
   ═══════════════════════════════════════ */
.error {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 2rem;
}

.error h1 {
    font-family: var(--serif);
    font-size: 8rem;
    color: var(--ochre);
    line-height: 1;
}

.error p {
    font-size: 1.25rem;
    color: var(--grey);
    margin: 1rem 0 2rem;
}

.error a {
    font-weight: 500;
    color: var(--terracotta);
}

/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */
@media (max-width: 1024px) {
    .feed { grid-template-columns: repeat(2, 1fr); }
    .card-featured { grid-column: span 2; }
    .related-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .header-inner { padding: 1rem 1.5rem; }
    .nav { display: none; }
    .menu-btn { display: block; }
    
    .feed {
        grid-template-columns: 1fr;
        padding: 2rem 1.5rem;
        gap: 1.5rem;
    }
    
    .card-featured {
        grid-column: span 1;
        display: block;
    }
    
    .card-featured .card-img {
        aspect-ratio: 16/10;
        border-radius: 12px 12px 0 0;
    }
    
    .card-featured .card-body { padding: 1.5rem; }
    .card-featured .card-title { font-size: 1.5rem; }
    
    .post { padding: 2rem 1.5rem; }
    .post-img { margin: 2rem -1.5rem; border-radius: 0; }
    .post-title { font-size: 2rem; }
    
    .related-grid { grid-template-columns: 1fr 1fr; }
    
    .footer-inner {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    .footer-copy { text-align: center; }
}

@media (max-width: 480px) {
    .feed { padding: 1.5rem 1rem; }
    .card-body { padding: 1.25rem; }
    .related-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════ */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeUp 0.6s var(--ease) backwards;
}

.card:nth-child(1) { animation-delay: 0s; }
.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.15s; }
.card:nth-child(4) { animation-delay: 0.2s; }
.card:nth-child(5) { animation-delay: 0.25s; }
.card:nth-child(6) { animation-delay: 0.3s; }
.card:nth-child(7) { animation-delay: 0.35s; }
.card:nth-child(8) { animation-delay: 0.4s; }
.card:nth-child(9) { animation-delay: 0.45s; }

/* ═══════════════════════════════════════
   GHOST KOENIG EDITOR - REQUIRED CLASSES
   ═══════════════════════════════════════ */
.kg-width-wide {
    position: relative;
    width: 85vw;
    min-width: 100%;
    margin-left: calc(50% - 42.5vw);
    margin-right: calc(50% - 42.5vw);
}

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

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

/* Koenig Cards */
.kg-card {
    margin: 2rem 0;
}

.kg-image-card img {
    border-radius: 12px;
}

.kg-width-full .kg-image-card img {
    border-radius: 0;
}

.kg-card figcaption {
    text-align: center;
    font-size: 0.85rem;
    color: var(--grey);
    margin-top: 1rem;
}

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

.kg-gallery-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.kg-gallery-row {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

.kg-gallery-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.kg-bookmark-card {
    background: var(--sand);
    border-radius: 12px;
    overflow: hidden;
}

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

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

.kg-bookmark-title {
    font-weight: 600;
    font-size: 1rem;
    line-height: 1.4;
}

.kg-bookmark-description {
    font-size: 0.875rem;
    color: var(--grey);
    margin-top: 0.5rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.kg-bookmark-metadata {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--grey);
}

.kg-bookmark-icon {
    width: 20px;
    height: 20px;
}

.kg-bookmark-thumbnail {
    width: 200px;
    min-height: 160px;
}

.kg-bookmark-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Callout Card */
.kg-callout-card {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    border-radius: 12px;
    background: var(--sand);
}

.kg-callout-emoji {
    font-size: 1.5rem;
}

.kg-callout-text {
    font-size: 1rem;
    line-height: 1.6;
}

/* Button Card */
.kg-button-card {
    display: flex;
    justify-content: center;
}

.kg-btn {
    display: inline-block;
    padding: 0.875rem 2rem;
    font-weight: 600;
    font-size: 1rem;
    border-radius: 8px;
    background: var(--terracotta);
    color: white;
    text-decoration: none;
    transition: background 0.2s var(--ease);
}

.kg-btn:hover {
    background: var(--ochre);
}

/* Toggle Card */
.kg-toggle-card {
    background: var(--sand);
    border-radius: 12px;
    padding: 1.5rem;
}

.kg-toggle-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
}

.kg-toggle-content {
    margin-top: 1rem;
    color: var(--grey);
}

/* Video/Audio */
.kg-video-card,
.kg-audio-card {
    border-radius: 12px;
    overflow: hidden;
}

/* Embed */
.kg-embed-card {
    display: flex;
    justify-content: center;
}

.kg-embed-card iframe {
    border-radius: 12px;
}

/* Page Hero */
.page-header {
    text-align: center;
    margin-bottom: 3rem;
}

.page-hero {
    margin: 0 -2rem 2rem;
    border-radius: 16px;
    overflow: hidden;
}

.page-hero img {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
}

.page-content > * + * {
    margin-top: 1.5rem;
}
