/* =============================================
   shared.css — Common styles across all pages
   ============================================= */

/* CSS Variables — Sage green palette */
:root {
    --sage-50: #f6f8f3;
    --sage-100: #eaefe4;
    --sage-200: #d6dfcc;
    --sage-300: #b8cba5;
    --sage-400: #9ab67f;
    --sage-500: #7d9b62;
    --sage-600: #638050;
    --sage-700: #4f6640;
    --sage-800: #425536;
    --sage-900: #37462d;
    --cream-50: #fefdfb;
    --cream-100: #faf8f4;
    --cream-200: #f5f1ea;
    --cream-300: #ebe5db;
    --amber-400: #d4a574;
    --amber-500: #c4956a;
    --text-dark: #3d4535;
    --text-medium: #4a5440;
    --text-light: #7a856d;
}

/* Selection highlight */
::selection {
    background: #F4F4F4;
    color: inherit;
}

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

/* Base body */
body {
    font-family: 'Source Serif 4', Georgia, serif;
    background: var(--cream-100);
    color: var(--text-medium);
    line-height: 1.7;
}

/* =============================================
   Animations
   ============================================= */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-4px); }
}

.animate-float { animation: float 8s ease-in-out infinite; }

.animate-fade-in {
    opacity: 0;
    animation: fadeInUp 0.8s ease-out forwards;
}

/* Anchor offset for fixed nav */
[id] {
    scroll-margin-top: 5rem;
}

/* Scroll fade-in */
.fade-in-section {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in-section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* =============================================
   Navigation
   ============================================= */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background: transparent;
    border-bottom: none;
    transition: backdrop-filter 0.3s ease, -webkit-backdrop-filter 0.3s ease;
}

.nav.scrolled {
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.nav-inner {
    max-width: 72rem;
    margin: 0 auto;
    padding: 1rem 1.5rem 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-link {
    font-family: 'Fraunces', serif;
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-medium);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

/* Chapter nav row (landscape pages) */
.nav-chapter {
    display: none;
}

.nav-chapter.active {
    display: block;
}

.nav-chapter-inner {
    max-width: 72rem;
    margin: 0 auto;
    padding: 0 1.5rem 0.75rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.6rem;
}

.nav-chapter-sep {
    color: var(--text-light);
    opacity: 0.35;
    font-size: 0.8rem;
    user-select: none;
}

.nav-chapter-link {
    font-family: 'Fraunces', serif;
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-light);
    text-decoration: none;
    padding: 0.25rem 0;
    transition: color 0.15s ease;
}

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

.nav-chapter-link.current {
    color: var(--text-dark);
    font-weight: 600;
}

.nav-logo {
    width: 24px;
    height: 24px;
    color: var(--sage-600);
    position: relative;
    top: -2px;
}

.nav-title {
    font-family: 'Fraunces', serif;
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-dark);
    line-height: 1.2;
}

/* =============================================
   Footer
   ============================================= */
.footer {
    background: var(--cream-200);
    color: var(--text-medium);
    padding: 2rem 1.5rem;
    text-align: center;
}

.footer-inner {
    max-width: 32rem;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.footer-brand {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.footer-brand .footer-logo {
    margin-top: 0.15rem;
}

.footer-logo {
    width: 20px;
    height: 20px;
    color: var(--sage-500);
}

.footer-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-dark);
}

.footer-author {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.75rem;
    color: var(--text-light);
}

.footer-copyright {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.7rem;
    color: var(--text-light);
    margin-top: 1rem;
}

/* =============================================
   Intro / Prose Sections
   ============================================= */
.intro-section {
    padding: clamp(3rem, 6vw, 6rem) 1.5rem;
}

.section-title {
    font-family: 'Fraunces', serif;
    font-size: clamp(1.8rem, 3vw, 2.25rem);
    font-weight: 500;
    color: #1F1B16;
    margin-bottom: 0.75rem;
    text-align: center;
}

.concept-box .section-title {
    font-size: 1.5rem;
}

.section-divider {
    font-size: 0;
    line-height: 0;
    color: transparent;
    padding: 2rem 0;
    display: flex;
    justify-content: center;
}

.section-divider::after {
    content: '';
    width: 3rem;
    height: 1px;
    background: var(--sage-300);
}

/* =============================================
   Next Page Link
   ============================================= */
.next-page {
    text-align: center;
    padding: 4rem 1.5rem 4rem;
}

.next-page a {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-light);
    text-decoration: none;
    transition: color 0.2s ease;
}

.next-page a span {
    display: inline-block;
    transition: transform 0.2s ease;
}

.next-page a:hover {
    color: var(--text-dark);
}

.next-page a:hover span {
    transform: translateX(3px);
}

/* =============================================
   Quote Section
   ============================================= */
.quote-section {
    padding: 5rem 1.5rem;
    background: var(--cream-100);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.quote-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 500px;
    max-width: 90%;
    height: 100px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='500' height='100' viewBox='0 0 500 100'%3E%3Cpath d='M0,100 L60,95 L100,75 L130,82 L160,55 L190,68 L220,35 L250,20 L280,38 L310,52 L340,40 L380,60 L410,72 L450,88 L500,100' fill='none' stroke='rgba(120,155,98,0.22)' stroke-width='1.5' stroke-linecap='round'/%3E%3Cpath d='M30,100 L80,92 L120,78 L160,85 L200,60 L240,45 L270,55 L300,48 L340,65 L380,75 L420,85 L470,95 L500,100' fill='none' stroke='rgba(120,155,98,0.14)' stroke-width='1.5' stroke-linecap='round'/%3E%3Cpath d='M60,100 L110,94 L160,82 L210,70 L250,62 L290,68 L340,78 L390,88 L440,96 L500,100' fill='none' stroke='rgba(120,155,98,0.08)' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center top;
    background-size: contain;
    pointer-events: none;
}

.quote-inner {
    max-width: 28rem;
    margin: 0 auto;
    padding: 3rem 0;
    position: relative;
}

.quote-inner::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 1px;
    background: var(--sage-400);
    bottom: 0;
}

.quote-text {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 500;
    font-style: italic;
    line-height: 1.6;
    color: var(--text-dark);
    margin: 0;
    position: relative;
}

.quote-text::before {
    content: '\201C';
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.8rem;
    color: var(--sage-300);
    font-style: normal;
    vertical-align: middle;
}

.quote-text::after {
    content: '\201D';
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.8rem;
    color: var(--sage-300);
    font-style: normal;
    vertical-align: middle;
}

/* =============================================
   Common Buttons
   ============================================= */
.btn-primary {
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: 0.9rem;
    background: var(--sage-500);
    color: white;
    padding: 0.875rem 1.75rem;
    border-radius: 2rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.25s ease;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(99, 128, 80, 0.25);
}

.btn-primary:hover {
    background: var(--sage-600);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(99, 128, 80, 0.35);
}

/* =============================================
   Footer Actions (message + mailing list)
   ============================================= */
.footer-actions {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 0.75rem;
}

.footer-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.4rem;
    transition: color 0.2s ease;
}

.footer-action:hover {
    color: var(--text-dark);
}

.footer-action svg {
    width: 14px;
    height: 14px;
}

/* =============================================
   Modals (message + mailing list)
   ============================================= */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-inner {
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    position: relative;
}

.modal h3 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.modal p {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

.modal input, .modal textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--sage-200);
    border-radius: 0.5rem;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.modal textarea {
    min-height: 120px;
    resize: vertical;
}

.modal input:focus, .modal textarea:focus {
    outline: none;
    border-color: var(--sage-400);
}

.modal-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.modal-btn {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-btn-cancel {
    background: transparent;
    border: 1px solid var(--sage-200);
    color: var(--text-light);
}

.modal-btn-cancel:hover {
    background: var(--cream-200);
}

.modal-btn-submit {
    background: var(--sage-600);
    border: none;
    color: white;
}

.modal-btn-submit:hover {
    background: var(--sage-700);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    line-height: 1;
}

.modal-status {
    margin-top: 1rem;
    font-size: 0.875rem;
    text-align: center;
}

/* =============================================
   Theme Templates
   Add these classes to <body> to switch styles.
   ============================================= */

/* Nav: always-on blur (default is blur-on-scroll) */
.nav-blur .nav {
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

/* Darker text variant */
.theme-dark-text {
    --text-dark: #2e3528;
    --text-medium: #454f3d;
    --text-light: #6a7560;
}

/* Emerald / stone palette (origin page) */
.theme-emerald {
    --emerald-50: #ecfdf5;
    --emerald-100: #d1fae5;
    --emerald-200: #a7f3d0;
    --emerald-300: #6ee7b7;
    --emerald-400: #34d399;
    --emerald-500: #10b981;
    --emerald-600: #059669;
    --emerald-700: #047857;
    --emerald-800: #065f46;
    --emerald-900: #064e3b;
    --stone-50: #fafaf9;
    --stone-100: #f5f5f4;
    --stone-200: #e7e5e4;
    --stone-500: #78716c;
    --stone-600: #57534e;
    --stone-700: #44403c;
    --stone-800: #292524;
    background: var(--stone-100);
    color: var(--stone-700);
    line-height: 1.6;
}

/* =============================================
   Responsive — Mobile
   ============================================= */
@media (max-width: 640px) {
    .nav {
        background: rgba(250, 248, 244, 0.95);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .nav.scrolled {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .nav-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 0.75rem 1.25rem 0.4rem;
    }

    .nav-links {
        gap: 1.25rem;
    }

    .nav-link {
        font-size: 0.8rem;
    }

    .nav-chapter-inner {
        justify-content: flex-start;
        padding: 0 1.25rem 0.6rem;
        gap: 0.4rem;
        flex-wrap: wrap;
    }

    .nav-chapter-link {
        font-size: 0.75rem;
    }

    .nav-chapter-sep {
        font-size: 0.7rem;
    }
}
