/* ============================================
   concepts.news — Pastoral Broadsheet for Ideas
   ============================================ */

/* CSS Custom Properties */
:root {
    --parchment: #f7f5f2;
    --ink-black: #1a1a1a;
    --charcoal: #3a3a3a;
    --slate: #7a7a7a;
    --silver: #d4d4d4;
    --fern: #4a7c59;
    --lichen: #dce8d8;

    --font-headline: 'Roboto Slab', serif;
    --font-body: 'Source Sans 3', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;

    --stem-width: 2px;
    --node-size: 12px;
    --entry-max-width: 420px;
    --entry-padding: 32px;
    --entry-gap: 48px;
    --entry-spacing: 180px;
    --timeline-width: 60%;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--parchment);
    color: var(--charcoal);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.6vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.005em;
    overflow-x: hidden;
}

/* ============================================
   HERO SECTION
   ============================================ */

.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero-seed {
    width: 60px;
    height: 120px;
    margin-bottom: 24px;
    opacity: 0;
    animation: fadeInSeed 600ms 300ms ease-out forwards;
}

.seed-svg {
    width: 100%;
    height: 100%;
}

.seed-body {
    animation: seedSplit 1200ms 500ms ease-out forwards;
    transform-origin: 30px 26px;
}

.sprout-stem {
    animation: stemGrow 800ms 900ms ease-out forwards;
}

.sprout-leaf-left {
    animation: leafAppear 600ms 1400ms ease-out forwards;
}

.sprout-leaf-right {
    animation: leafAppear 600ms 1200ms ease-out forwards;
}

@keyframes fadeInSeed {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes seedSplit {
    0% { transform: scale(1); }
    40% { transform: scale(1.05); }
    70% { transform: scale(0.95) translateY(2px); }
    100% { transform: scale(0.9) translateY(4px); opacity: 0.7; }
}

@keyframes stemGrow {
    from { stroke-dashoffset: 70; }
    to { stroke-dashoffset: 0; }
}

@keyframes leafAppear {
    from { opacity: 0; transform: rotate(90deg); }
    to { opacity: 1; transform: rotate(0deg); }
}

.hero-title {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 3.6rem);
    color: var(--ink-black);
    letter-spacing: 0.02em;
    line-height: 1.18;
    opacity: 0;
    animation: fadeInUp 600ms 1400ms ease-out forwards;
}

.hero-subtitle {
    font-family: var(--font-body);
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1rem, 2vw, 1.3rem);
    color: var(--slate);
    margin-top: 12px;
    opacity: 0;
    animation: fadeInUp 600ms 1600ms ease-out forwards;
}

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

.hero-stem-continue {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: var(--stem-width);
    height: 120px;
    background: var(--charcoal);
    opacity: 0;
    animation: stemContinueGrow 800ms 2000ms ease-out forwards;
}

@keyframes stemContinueGrow {
    from { opacity: 0; height: 0; }
    to { opacity: 1; height: 120px; }
}

/* ============================================
   TIMELINE CONTAINER
   ============================================ */

.timeline-container {
    position: relative;
    width: var(--timeline-width);
    max-width: 900px;
    margin: 0 auto;
    padding-bottom: 60px;
}

/* The central stem line */
.timeline-stem {
    position: absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    width: var(--stem-width);
    height: 100%;
    background: var(--charcoal);
}

/* ============================================
   TIMELINE ENTRIES
   ============================================ */

.timeline-entry {
    position: relative;
    display: flex;
    align-items: flex-start;
    margin-bottom: var(--entry-spacing);
    opacity: 0;
    transition: opacity 400ms ease-out, transform 400ms ease-out;
}

.timeline-entry.visible {
    opacity: 1;
    transform: translate(0, 0) !important;
}

/* Left entries */
.timeline-left {
    flex-direction: row-reverse;
    padding-right: calc(50% + var(--entry-gap));
    transform: translateX(-20px);
}

.timeline-left .entry-content {
    text-align: right;
}

.timeline-left .entry-connector {
    position: absolute;
    right: calc(50% - var(--node-size) / 2);
    top: var(--entry-padding);
    display: flex;
    align-items: center;
    flex-direction: row-reverse;
}

.timeline-left .connector-line {
    width: calc(var(--entry-gap) - var(--node-size) / 2);
    height: 1px;
    background: var(--charcoal);
    display: block;
}

.timeline-left .entry-icon {
    margin-left: auto;
    margin-right: 0;
}

/* Right entries */
.timeline-right {
    padding-left: calc(50% + var(--entry-gap));
    transform: translateX(20px);
}

.timeline-right .entry-connector {
    position: absolute;
    left: calc(50% - var(--node-size) / 2);
    top: var(--entry-padding);
    display: flex;
    align-items: center;
}

.timeline-right .connector-line {
    width: calc(var(--entry-gap) - var(--node-size) / 2);
    height: 1px;
    background: var(--charcoal);
    display: block;
}

/* Connector node (circle) */
.connector-node {
    width: var(--node-size);
    height: var(--node-size);
    border-radius: 50%;
    background: var(--fern);
    display: block;
    flex-shrink: 0;
    transition: transform 500ms ease-in-out;
}

/* Node leaf */
.node-leaf {
    width: 16px;
    height: 24px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 800ms ease-out, transform 800ms ease-out;
}

.node-leaf-right {
    transform: rotate(90deg);
    margin-right: -4px;
}

.node-leaf-left {
    transform: rotate(-90deg);
    margin-left: -4px;
}

.timeline-entry.visible .node-leaf-right {
    opacity: 1;
    transform: rotate(0deg);
}

.timeline-entry.visible .node-leaf-left {
    opacity: 1;
    transform: rotate(0deg);
}

/* Entry content block */
.entry-content {
    max-width: var(--entry-max-width);
    padding: var(--entry-padding);
    transition: background-color 300ms ease;
    position: relative;
}

.timeline-left .entry-content {
    border-right: 1px solid var(--silver);
}

.timeline-right .entry-content {
    border-left: 1px solid var(--silver);
}

.entry-content:hover {
    background-color: var(--lichen);
}

.entry-content:hover .entry-headline {
    color: var(--fern);
}

/* Hover: pulse node */
.timeline-entry:hover .connector-node {
    animation: nodePulse 500ms ease-in-out;
}

@keyframes nodePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* Entry icon */
.entry-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
}

.entry-icon svg {
    width: 100%;
    height: 100%;
}

/* Date stamp */
.entry-date {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--slate);
    display: block;
    margin-bottom: 8px;
    opacity: 0;
    transition: opacity 300ms ease-out;
    transition-delay: 0ms;
}

.timeline-entry.visible .entry-date {
    opacity: 1;
    transition-delay: 0ms;
}

/* Headline */
.entry-headline {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: clamp(1.6rem, 3vw, 2.8rem);
    letter-spacing: 0.01em;
    line-height: 1.18;
    color: var(--ink-black);
    margin-bottom: 12px;
    transition: color 300ms ease, opacity 300ms ease-out;
    opacity: 0;
}

.timeline-entry.visible .entry-headline {
    opacity: 1;
    transition-delay: 100ms;
}

/* Excerpt */
.entry-excerpt {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.6vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.005em;
    color: var(--charcoal);
}

/* ============================================
   INTERSTITIAL MEADOWS
   ============================================ */

.interstitial-meadow {
    position: relative;
    height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--entry-spacing);
}

.meadow-stem {
    position: absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    width: var(--stem-width);
    height: 100%;
    background: var(--charcoal);
}

.drifting-leaf-container {
    position: relative;
    z-index: 1;
    margin-bottom: 40px;
}

.drifting-leaf {
    width: 24px;
    height: 36px;
    animation: driftLeaf 6s ease-in-out infinite;
}

@keyframes driftLeaf {
    0% {
        transform: translateY(-20px) rotate(0deg);
        opacity: 0.3;
    }
    25% {
        transform: translateY(10px) rotate(15deg) translateX(10px);
        opacity: 0.6;
    }
    50% {
        transform: translateY(30px) rotate(-5deg) translateX(-5px);
        opacity: 0.5;
    }
    75% {
        transform: translateY(50px) rotate(10deg) translateX(8px);
        opacity: 0.4;
    }
    100% {
        transform: translateY(70px) rotate(0deg);
        opacity: 0.3;
    }
}

.meadow-quote {
    font-family: var(--font-body);
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1rem, 2vw, 1.3rem);
    color: var(--slate);
    text-align: center;
    position: relative;
    z-index: 1;
    max-width: 400px;
    padding: 0 24px;
}

/* ============================================
   FOOTER
   ============================================ */

.site-footer {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 60px 24px 80px;
    overflow: hidden;
}

.footer-roots {
    width: 200px;
    height: 120px;
    margin-bottom: 40px;
}

.roots-svg {
    width: 100%;
    height: 100%;
}

.root-tendril {
    transition: stroke-dashoffset 1500ms ease-out;
}

.footer-roots.visible .root-tendril {
    stroke-dashoffset: 0 !important;
}

/* Leaf grid wallpaper in footer */
.footer-leaf-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.35;
    z-index: 0;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Cpath d='M20 4 Q14 14 14 24 Q17 30 20 34 Q23 30 26 24 Q26 14 20 4Z' fill='%23dce8d8' stroke='none'/%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Cpath d='M20 4 Q14 14 14 24 Q17 30 20 34 Q23 30 26 24 Q26 14 20 4Z' fill='%23dce8d8' stroke='none' transform='rotate(45 20 20)'/%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Cpath d='M20 4 Q14 14 14 24 Q17 30 20 34 Q23 30 26 24 Q26 14 20 4Z' fill='%23dce8d8' stroke='none' transform='rotate(90 20 20)'/%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Cpath d='M20 4 Q14 14 14 24 Q17 30 20 34 Q23 30 26 24 Q26 14 20 4Z' fill='%23dce8d8' stroke='none' transform='rotate(135 20 20)'/%3E%3C/svg%3E");
    background-size: 80px 80px, 80px 80px, 80px 80px, 80px 80px;
    background-position: 0 0, 40px 0, 0 40px, 40px 40px;
    background-repeat: repeat;
}

.footer-text {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--slate);
    text-align: center;
    position: relative;
    z-index: 1;
}

/* ============================================
   RESPONSIVE: MOBILE (< 768px)
   ============================================ */

@media (max-width: 768px) {
    .timeline-container {
        width: 100%;
        padding-left: 24px;
        padding-right: 24px;
    }

    .timeline-stem {
        left: 24px;
        transform: none;
    }

    /* All entries go to the right on mobile */
    .timeline-left,
    .timeline-right {
        padding-left: calc(24px + var(--entry-gap));
        padding-right: 0;
        flex-direction: row;
        transform: translateX(20px);
    }

    .timeline-left .entry-content,
    .timeline-right .entry-content {
        text-align: left;
        border-left: 1px solid var(--silver);
        border-right: none;
    }

    .timeline-left .entry-icon {
        margin-left: 0;
        margin-right: auto;
    }

    .timeline-left .entry-connector,
    .timeline-right .entry-connector {
        position: absolute;
        left: calc(24px - var(--node-size) / 2);
        right: auto;
        top: var(--entry-padding);
        display: flex;
        flex-direction: row;
    }

    .timeline-left .connector-line,
    .timeline-right .connector-line {
        width: calc(var(--entry-gap) - var(--node-size) / 2);
    }

    .timeline-left .node-leaf-right {
        transform: rotate(-90deg);
        margin-right: 0;
        margin-left: -4px;
    }

    .timeline-left.visible .node-leaf-right {
        transform: rotate(0deg);
    }

    .meadow-stem {
        left: 24px;
        transform: none;
    }

    .interstitial-meadow {
        height: 40vh;
    }

    .entry-content {
        max-width: 100%;
    }

    .hero-stem-continue {
        left: 24px;
        transform: none;
    }
}

/* ============================================
   SCROLL ANIMATION STATES
   ============================================ */

/* Stagger reveal for date -> headline */
.timeline-entry.visible .entry-date {
    animation: fadeInContent 300ms ease-out forwards;
}

.timeline-entry.visible .entry-headline {
    animation: fadeInContent 300ms 100ms ease-out forwards;
}

@keyframes fadeInContent {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* New badge for recent articles */
.timeline-entry[data-index="0"] .entry-date::after {
    content: 'new';
    display: inline-block;
    margin-left: 8px;
    padding: 1px 6px;
    background: var(--fern);
    color: var(--parchment);
    font-size: 0.6rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    vertical-align: middle;
}
