/* ============================================
   memoirs.md — Landing Page Styles
   ============================================ */

/* --- Reset & Base --- */

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

/* --- Custom Properties --- */

:root {
    /* Surfaces */
    --bg:              #faf7f1;
    --bg-alt:          #f2ece3;
    --bg-dark:         #1e1c19;
    --bg-dark-mid:     #272420;
    --bg-dark-alt:     #2f2b26;

    /* Text */
    --ink:             #2d2926;
    --ink-soft:        #4a4540;
    --ink-muted:       #8a8279;
    --ink-light:       #f0ebe2;
    --ink-light-muted: #a99f92;

    /* Accents */
    --vermillion:      #b5493a;
    --vermillion-glow: #d4654e;
    --sage:            #5c7a54;

    /* Borders */
    --rule:            #d9d2c7;
    --rule-dark:       #3d3830;

    /* Typography */
    --serif:  'Alegreya', 'Georgia', serif;
    --hand:   'Caveat', cursive;
    --mono:   'DM Mono', 'Courier New', monospace;

    /* Layout */
    --max-w:  960px;
    --gutter: 2rem;
}

body {
    font-family: var(--serif);
    font-size: 1.125rem;
    line-height: 1.72;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: rgba(181, 73, 58, 0.18);
    color: var(--ink);
}

img { max-width: 100%; display: block; }
a   { color: inherit; text-decoration: none; }

.container {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 var(--gutter);
}


/* ============================================
   Navigation
   ============================================ */

.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 1.25rem var(--gutter);
    transition: background-color 0.5s ease, box-shadow 0.5s ease;
}

.nav.scrolled {
    background-color: rgba(30, 28, 25, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
}

.nav-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-family: var(--serif);
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--ink-light);
    letter-spacing: -0.01em;
}

.nav-logo span {
    font-family: var(--mono);
    font-weight: 400;
    color: var(--vermillion-glow);
    font-size: 0.95em;
}



/* ============================================
   Hero
   ============================================ */

.hero {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    overflow: hidden;
    padding: 6rem var(--gutter) 4rem;
    color: var(--ink-light);
    background:
        radial-gradient(ellipse at 35% 35%, rgba(181, 130, 80, 0.10) 0%, transparent 55%),
        radial-gradient(ellipse at 70% 65%, rgba(181, 73, 58, 0.05) 0%, transparent 45%),
        linear-gradient(172deg, #1a1816 0%, var(--bg-dark) 40%, var(--bg-dark-mid) 100%);
}

/* Subtle grain texture */
.hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
    pointer-events: none;
    opacity: 0.5;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 680px;
}

.hero-title {
    font-family: var(--serif);
    font-weight: 900;
    font-size: clamp(3.4rem, 9vw, 7rem);
    line-height: 1.05;
    letter-spacing: -0.03em;
    margin-bottom: 1.5rem;
    animation: fadeInUp 1s ease both;
}

.hero-title .md {
    font-family: var(--mono);
    font-weight: 400;
    color: var(--vermillion-glow);
    font-size: 0.72em;
    letter-spacing: 0;
}

.hero-tagline {
    font-family: var(--serif);
    font-size: clamp(1.2rem, 2.5vw, 1.55rem);
    font-weight: 500;
    font-style: italic;
    color: var(--ink-light);
    margin-bottom: 1.5rem;
    opacity: 0;
    animation: fadeInUp 1s ease 0.15s both;
}

.hero-description {
    font-size: 1.05rem;
    line-height: 1.75;
    color: var(--ink-light-muted);
    max-width: 520px;
    margin: 0 auto 2.5rem;
    opacity: 0;
    animation: fadeInUp 1s ease 0.3s both;
}


/* Scroll indicator */
.scroll-indicator {
    position: absolute;
    bottom: 2.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
    opacity: 0;
    animation: fadeIn 1s ease 1.2s both;
}

.scroll-indicator span {
    display: block;
    width: 20px;
    height: 20px;
    border-right: 1.5px solid var(--ink-light-muted);
    border-bottom: 1.5px solid var(--ink-light-muted);
    transform: rotate(45deg);
    animation: scrollBounce 2.8s ease infinite;
}


/* ============================================
   Problem Section
   ============================================ */

.problem {
    padding: 7rem 0 6rem;
    background: var(--bg);
    text-align: center;
}

.problem h2 {
    font-family: var(--serif);
    font-weight: 700;
    font-size: clamp(1.8rem, 3.5vw, 2.4rem);
    color: var(--ink);
    margin-bottom: 2.5rem;
    letter-spacing: -0.02em;
}

.ornament {
    font-size: 1.4rem;
    color: var(--vermillion);
    margin-bottom: 1.5rem;
    letter-spacing: 0.6em;
    opacity: 0.6;
}

.problem-body {
    max-width: 600px;
    margin: 0 auto;
    text-align: left;
}

.problem-body p {
    color: var(--ink-soft);
    margin-bottom: 1.25rem;
}

.divider {
    width: 3rem;
    height: 1px;
    background: var(--rule);
    border: none;
    margin: 2.5rem auto;
}

.highlight {
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.25rem;
    font-weight: 500;
    line-height: 1.65;
    color: var(--vermillion);
    border-left: 2.5px solid var(--vermillion);
    padding-left: 1.4rem;
    margin: 2.5rem 0 0.5rem;
}


/* ============================================
   Process / Chapters Section
   ============================================ */

.process {
    padding: 5.5rem 0 7rem;
    background: var(--bg-alt);
}

.process h2 {
    font-family: var(--serif);
    font-weight: 700;
    font-size: clamp(1.8rem, 3.5vw, 2.4rem);
    color: var(--ink);
    text-align: center;
    margin-bottom: 3.5rem;
    letter-spacing: -0.02em;
}

.chapter-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

.chapter {
    position: relative;
    overflow: hidden;
    background: var(--bg);
    border: 1px solid var(--rule);
    border-radius: 3px;
    padding: 2.5rem 2rem 2rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.chapter:hover {
    border-color: #c4b9aa;
    box-shadow: 0 4px 24px rgba(45, 41, 38, 0.06);
}

.chapter-num {
    font-family: var(--hand);
    font-size: 5.5rem;
    font-weight: 600;
    line-height: 1;
    color: rgba(181, 73, 58, 0.06);
    position: absolute;
    top: -0.3rem;
    right: 0.8rem;
    user-select: none;
    pointer-events: none;
}

.chapter h3 {
    font-family: var(--serif);
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--ink);
    margin-bottom: 0.65rem;
    letter-spacing: -0.01em;
}

.chapter p {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--ink-soft);
}


/* ============================================
   CTA Section
   ============================================ */

.cta {
    padding: 7rem 0 6rem;
    background:
        radial-gradient(ellipse at 50% 80%, rgba(181, 73, 58, 0.06) 0%, transparent 50%),
        linear-gradient(176deg, var(--bg-dark-mid) 0%, var(--bg-dark) 100%);
    color: var(--ink-light);
    text-align: center;
}

.cta h2 {
    font-family: var(--serif);
    font-weight: 700;
    font-size: clamp(1.8rem, 3.5vw, 2.4rem);
    margin-bottom: 1.25rem;
    letter-spacing: -0.02em;
}

.cta-description {
    font-size: 1.05rem;
    color: var(--ink-light-muted);
    max-width: 480px;
    margin: 0 auto;
    line-height: 1.72;
}



/* ============================================
   Footer
   ============================================ */

.footer {
    padding: 3rem 0;
    background: var(--bg-dark);
    text-align: center;
    border-top: 1px solid var(--rule-dark);
}

.footer-logo {
    font-family: var(--serif);
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--ink-light);
    margin-bottom: 0.4rem;
}

.footer-logo span {
    font-family: var(--mono);
    font-weight: 400;
    color: var(--vermillion-glow);
    font-size: 0.92em;
}

.footer-note {
    font-size: 0.88rem;
    color: var(--ink-light-muted);
    opacity: 0.5;
}


/* ============================================
   Animations
   ============================================ */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(1.8rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes scrollBounce {
    0%, 100% { transform: rotate(45deg) translate(0, 0); }
    50%      { transform: rotate(45deg) translate(4px, 4px); }
}

/* Scroll reveal base */
.reveal {
    opacity: 0;
    transform: translateY(1.6rem);
    transition: opacity 0.75s ease, transform 0.75s ease;
}

.reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children in the chapter grid */
.chapter-grid .chapter.reveal:nth-child(2) { transition-delay: 0.08s; }
.chapter-grid .chapter.reveal:nth-child(3) { transition-delay: 0.16s; }
.chapter-grid .chapter.reveal:nth-child(4) { transition-delay: 0.24s; }


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

@media (max-width: 768px) {
    :root {
        --gutter: 1.5rem;
    }

    body {
        font-size: 1.05rem;
    }

    .hero {
        padding: 5rem var(--gutter) 3.5rem;
    }

    .hero-title {
        letter-spacing: -0.02em;
    }

    .problem {
        padding: 5rem 0 4.5rem;
    }

    .process {
        padding: 4.5rem 0 5.5rem;
    }

    .chapter-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .cta {
        padding: 5rem 0 4.5rem;
    }

    .signup-form {
        flex-direction: column;
    }

    .signup-form input,
    .btn-fill {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2.8rem;
    }

    .chapter {
        padding: 2rem 1.5rem 1.75rem;
    }

    .chapter-num {
        font-size: 4rem;
    }
}

/* Respect motion preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-delay: 0ms !important;
        transition-duration: 0.01ms !important;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }

    html {
        scroll-behavior: auto;
    }
}
