/* ------------------------------
   Liminal Pie - Brand CSS
   Full Unified File
-------------------------------*/

/* ---------- Color Variables ---------- */
:root {
    --bg-color: #f9f8f5;
    --text-color: #2d2d2d;
    --heading-color: #1c1c1c;
    --subtle-color: #7a7a7a;
    --accent-color: #a084ca;
    --blockquote-line: #cccce0;

    /* Section backgrounds - light mode */
    --section-sage-bg: #c7d0c0;
    --section-cream-bg: #fdfcf9;
    --section-parchment-bg: #f5f3ed;

    /* Footer */
    --footer-text: #333;
    --footer-border: rgba(0, 0, 0, 0.1);
    --footer-link-color: #2f2540;
}

[data-theme="dark"] {
    --bg-color: #1b1a1e;
    --text-color: #eae6f1;
    --heading-color: #f2f1ff;
    --subtle-color: #aaa0b5;
    --accent-color: #c3b3f5;
    --blockquote-line: #444258;

    /* Section backgrounds - dark mode */
    --section-sage-bg: #5b4b6a; /* primary muted aubergine */
    --section-cream-bg: #3a333d; /* soft dark neutral */
    --section-parchment-bg: #2a262f;

    /* Footer */
    --footer-text: #d8d6e0;
    --footer-border: rgba(255, 255, 255, 0.15);
    --footer-link-color: #e6e0f5;
}

/* ---------- Global Typography ---------- */
body {
    background: var(--bg-color);
    color: var(--text-color);
    font-family: "Lora", serif;
    font-size: 1.125rem;
    max-width: 42rem;
    margin: 0 auto;
    padding: 2rem 1.25rem 4rem;
    line-height: 1.8;
    transition:
        background 0.3s ease,
        color 0.3s ease;
}
body {
    max-width: 48rem; /* ~768px */
    margin: 0 auto;
    padding: 2rem 1rem 4rem;
}

h1,
h2,
h3 {
    font-family: "Lora", serif;
    color: var(--heading-color);
    margin: 2rem 0 1rem;
    line-height: 1.2;
}

h1 {
    font-size: 2.25rem;
    font-weight: 700;
}
h2 {
    font-size: 1.75rem;
    font-weight: 600;
}
h3 {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--accent-color);
}

p {
    margin: 1.25rem 0;
}
em {
    font-style: italic;
    color: var(--subtle-color);
}
strong {
    font-weight: bold;
    color: var(--heading-color);
}
/* ----- Header Container ----- */
/* =========================
   Liminal Pie Header
   ========================= */

/* Container */
.site-header {
    position: relative;
    margin: 1rem auto 2rem;
    z-index: 100;
}

/* Flex bar: hamburger on left, controls on right */
.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem 0 0; /* remove left padding */
    position: relative;
}

/* ----- Branding (Title + Subtitle) ----- */
.site-branding {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center; /* center subtitle */
    min-width: 12rem; /* stabilizes centering if text is narrow */
    opacity: 0;
    animation: brandingFadeIn 1.2s ease-out forwards;
}

.site-title {
    font-size: 2rem;
    font-weight: 400;

    letter-spacing: 0.05em;
    line-height: 1.2;
    font-family: "Lora", serif;
}

/* Title link: brand color, no underline */
.site-title-link {
    text-decoration: none;
    color: #5b4b6a; /* brand aubergine */
    transition: color 0.3s ease;
}

.site-title-link:hover {
    color: #483a56; /* subtle darken on hover */
}

/* Subtitle (fade in after title) */
.site-subtitle {
    font-size: 0.95rem;
    font-style: italic;
    font-family: "Lora", serif;
    color: #9baa97; /* darker sage for light mode */
    line-height: 1.3;
    margin-top: 0.1rem;
    opacity: 0;
    animation: subtitleFadeIn 1.5s ease-out forwards;
    animation-delay: 0.3s;
    text-align: center;
}

/* ----- Dark Mode Adjustments ----- */
[data-theme="dark"] .site-title-link {
    color: #c7bfd4; /* softened aubergine */
}

[data-theme="dark"] .site-title-link:hover {
    color: #e0d6f0; /* gentle hover */
}

[data-theme="dark"] .site-subtitle {
    color: #b4bdaf; /* soft sage for dark bg */
}

/* Right: Controls */
.controls {
    display: flex;
    gap: 0.75rem;
    font-size: 0.9rem;
    opacity: 0.65;
    transition: opacity 0.3s ease;
}

.controls:hover {
    opacity: 1;
}

/* ----- Responsive Adjustments ----- */
@media (max-width: 768px) {
    .site-title {
        font-size: 1.7rem;
    }
    .site-subtitle {
        font-size: 0.85rem;
    }

    /* Controls float top-right on mobile */
    .controls {
        position: absolute;
        top: 0.5rem;
        right: 0.5rem;
    }

    /* Branding remains centered */
    .site-branding {
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .site-title {
        font-size: 1.5rem;
        letter-spacing: 0.04em;
    }
    .site-subtitle {
        font-size: 0.8rem;
    }
    .controls {
        font-size: 0.75rem;
        gap: 0.5rem;
    }
}

/* ----- Fade Animations ----- */
@keyframes brandingFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -0.5rem);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes subtitleFadeIn {
    from {
        opacity: 0;
        transform: translateY(-0.25rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

blockquote {
    border-left: 3px solid var(--blockquote-line);
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: var(--subtle-color);
    font-style: italic;
}

hr {
    border: none;
    border-top: 1px solid var(--blockquote-line);
    margin: 2rem 0;
}

/* ---------- Accessibility Widgets ---------- */
#font-toggle,
#theme-toggle {
    position: fixed;
    top: 1rem;
    z-index: 999;
    font-size: 1rem;
    color: var(--text-color);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    opacity: 0.75;
    transition: opacity 0.3s ease;
}

#font-toggle:hover,
#theme-toggle:hover {
    opacity: 1;
}

#font-toggle {
    right: 3.5rem;
}
#theme-toggle {
    right: 1rem;
}

/* ---------- Watermark ---------- */
.watermark {
    position: fixed;
    top: 0.75rem;
    left: 50%;
    transform: translate(-50%, -0.5rem);
    font-size: clamp(1.3rem, 1vw, 1rem);
    font-family: "Cormorant Garamond", serif;
    color: var(--subtle-color);
    opacity: 0;

    z-index: 500;
    animation: watermarkFadeIn 2.5s ease-out forwards;
    animation-delay: 1s;
}

@keyframes watermarkFadeIn {
    0% {
        opacity: 0;
        transform: translate(-50%, -1.5rem);
    }
    100% {
        opacity: 0.4;
        transform: translate(-50%, 0);
    }
}

.watermark.breathing {
    animation:
        watermarkFadeIn 2.5s ease-out forwards,
        watermarkPulse 6s ease-in-out infinite 3s;
}

@keyframes watermarkPulse {
    0%,
    100% {
        opacity: 0.35;
    }
    50% {
        opacity: 0.5;
    }
}
.watermark-link {
    text-decoration: none;
    color: inherit; /* keeps it subtle like the rest of the watermark */
}
/* ---------- Featured Image ---------- */
.featured-image {
    width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin: 1rem 0 2rem;
    display: block;
    object-fit: cover;
    max-height: 20rem;
    opacity: 0.9;
}

/* ---------- Hero Quote ---------- */
.hero-quote {
    font-family: var(--quote-font, Georgia, serif);
    font-size: 1.8rem;
    font-style: italic;
    line-height: 1.6;
    margin: 4rem auto;
    padding: 2rem 2rem;
    max-width: 60ch;
    position: relative;
    text-align: center;
    color: var(--heading-color);
    background: none;
    border-left: none;
}

.hero-quote::before,
.hero-quote::after {
    content: "“";
    font-size: 3rem;
    color: #d4cbb8;
    position: absolute;
    top: -0.5rem;
}

.hero-quote::before {
    left: clamp(0rem, -1.5rem, -0.5rem);
}
.hero-quote::after {
    right: clamp(0rem, -1.5rem, -0.5rem);
}

/* ---------- Quote Highlight ---------- */
.quote-highlight {
    font-family: "Georgia", serif;
    font-size: 1.6rem;
    line-height: 1.6;
    color: #2f2540;
    background: #f8f5f2;
    border-left: 6px solid #aa8bb2;
    padding: 1.2rem 2rem;
    margin: 2rem auto;
    max-width: 800px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
}

.quote-highlight p {
    quotes: "“" "”" "‘" "’";
    margin: 0 0 0.6rem;
}

.quote-highlight footer {
    text-align: right;
    font-style: italic;
    color: #6d5e7d;
}

/* ---------- Section Styling ---------- */
.section {
    padding: 2rem;
    border-radius: 12px;
    margin: 3rem auto;
    max-width: 42rem;
    overflow: hidden;
    background: var(--section-cream-bg);
    color: var(--text-color);
    box-shadow:
        0 2px 6px rgba(0, 0, 0, 0.06),
        0 8px 20px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.03);
    transition:
        background 0.3s ease,
        color 0.3s ease;
}

/* Section Variations */
.section-sage {
    background-color: var(--section-sage-bg);
}
.section-cream {
    background-color: var(--section-cream-bg);
}
.section-parchment {
    background-color: var(--section-parchment-bg);
}

.section-deep {
    background-color: #5b4b6a;
    color: #ffffff;
}

.section-deep a {
    color: #e5e1eb;
}

/* ---------- Footer ---------- */
.footer-section {
    background: var(--footer-bg, transparent);
    color: var(--footer-text);
    border-top: 1px solid var(--footer-border);
    padding: 2rem 1rem;
    text-align: center;
    font-family: "Georgia", serif;
    transition:
        background 0.3s ease,
        color 0.3s ease,
        border-color 0.3s ease;
}

.footer-links {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links a {
    color: var(--footer-link-color, var(--footer-text));
    text-decoration: none;
    font-weight: 500;
    opacity: 0.9;
    transition:
        opacity 0.3s ease,
        color 0.3s ease;
}

.footer-links a:hover {
    opacity: 1;
    text-decoration: underline;
}

@media (min-width: 600px) {
    .footer-links {
        grid-template-columns: repeat(2, 1fr);
        justify-items: center;
    }
}

/* ---------------------------------------
   Legacy Section Class Compatibility Layer
   Maps old classes to new unified section system
---------------------------------------- */

/* Base styling for all legacy sections */
.section-mint,
.section-wheat,
.section-cream,
.section-parchment,
.section-lightgray,
.section-oat,
.section-faq {
    border-radius: 12px;
    padding: 0.5rem;
    margin: 3rem auto;
    max-width: 42rem;
    overflow: hidden;
    box-shadow:
        0 2px 6px rgba(0, 0, 0, 0.06),
        0 8px 20px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.03);
    color: var(--text-color);
    transition:
        background 0.3s ease,
        color 0.3s ease;
}

/* Map old classes to brand-aligned variables */
.section-mint {
    background-color: var(--section-sage-bg); /* Mint → Sage */
}
.section-wheat {
    background-color: var(--section-parchment-bg); /* Wheat → Warm parchment */
}
.section-cream {
    background-color: var(--section-cream-bg); /* Cream → Cream */
}
.section-parchment {
    background-color: var(--section-parchment-bg); /* Parchment → Parchment */
}
.section-lightgray,
.section-faq {
    background-color: var(--section-cream-bg); /* Light gray → soft cream */
}
.section-oat {
    background-color: var(--section-sage-bg); /* Oat → Soft sage */
}

/* cards from allcards */
.cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
    padding: 0 0rem; /* tighter on mobile */
}
.story-card {
    border: 1px solid #e6dcd1;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    width: 280px;
    max-width: 90%;
    padding: 1.5rem;
    position: relative;
    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease;
    background-color: #fffdfb; /* Fallback */
}
.story-card {
    width: 100%; /* let it expand to container width */
    max-width: 36rem; /* keeps it readable, ~576px */
    margin: 0 auto; /* centers card if narrower than screen */
    border-radius: 12px;
    padding: 1.5rem;
}

.story-card:hover {
    transform: scale(1.025);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}
.card-image-wrapper {
    width: 100%;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.card-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    border-radius: 8px;
}
.tag-float {
    position: absolute;
    top: -12px;
    right: -12px;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    z-index: 2;
}

.tag-pill {
    background: #d7c282;
    color: #fff;
    font-size: 1.4rem;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
}

.story-title {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    color: #2c1f1a;
}

.story-snippet {
    font-size: 1.1rem;
    color: #5e5e5e;
    line-height: 1.5;
    margin-bottom: 1rem;
}
.read-more {
    display: inline-block; /* allows it to size to content */
    padding: 0.4rem 1rem;
    font-size: 1.2rem;
    border: 1px solid #ba6b57;
    border-radius: 6px;
    color: #ba6b57;
    text-decoration: none;
    background-color: transparent;
    transition:
        background-color 0.2s ease,
        color 0.2s ease;
    align-self: flex-start; /* prevents it from stretching in flex containers */
}

.read-more:hover {
    background-color: #ba6b57;
    color: #fff;
    text-decoration: none;
}

.story-title {
    font-size: 1.6rem; /* was 1.4rem */
    line-height: 1.3;
    margin-bottom: 0.75rem;
}

.story-snippet {
    font-size: 1.15rem; /* was 1.1rem */
    line-height: 1.6; /* more breathing room */
    margin-bottom: 1.25rem;
}

a.linkified {
    font-family: "Caveat", cursive; /* or another handwritten font */
    color: #3a2f4d;
    text-decoration: underline wavy #aaa;
    text-underline-offset: 2px;
}

a.linkified:hover {
    text-decoration: underline wavy #3a2f4d;
}

.preview {
    text-align: center; /* handles inline-block images or captions */
    margin: 2rem 0;
}

/* Make figure behave like a block-level container, centered */
.preview figure {
    display: block;
    margin: 0 auto; /* centers the figure as a whole */
    max-width: 80%;
}

/* Image inside preview, whether direct or inside a figure */
.preview img {
    display: block; /* removes inline gap */
    margin: 0 auto; /* centers the image itself */
    max-width: 100%; /* figure already limits width */
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Figcaption styling stays consistent */
.preview figcaption {
    margin: 0;
    padding-top: 0.4rem;
    font-size: 0.9rem;
    color: #444;
}
