/* ===========================================================
   lunar.quest -- v2
   Field journal of the moonlit wild.
   Palette: honeyed neutrals, leather, autumn gold, olive sage.
   Layout: vertical timeline with alternating journal pages.
   =========================================================== */

:root {
    --honey: #F0E4D0;
    --leather: #6B5040;
    --saddle: #8B7355;
    --cream: #FAF4E8;
    --gold: #C8A050;
    --sage: #7A8B60;
    --earth: #3A3028;
    --ink-soft: rgba(58, 48, 40, 0.72);
    --line: rgba(107, 80, 64, 0.35);
    --shadow-soft: 0 14px 30px -18px rgba(58, 48, 40, 0.45);
    --shadow-lift: 0 22px 50px -22px rgba(58, 48, 40, 0.55);
    --blob-radius: 28px 6px 28px 6px;
    --blob-radius-mirror: 6px 28px 6px 28px;

    --font-slab: "Zilla Slab", Georgia, serif;
    --font-body: "Source Sans 3", "Helvetica Neue", Arial, sans-serif;
    --font-mono: "Inconsolata", ui-monospace, "Menlo", monospace;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--honey);
    color: var(--earth);
    font-family: var(--font-body);
    font-size: clamp(14px, 1vw, 17px);
    line-height: 1.75;
    overflow-x: hidden;
    position: relative;
    background-image:
        radial-gradient(ellipse at 12% 8%, rgba(200, 160, 80, 0.18) 0%, transparent 55%),
        radial-gradient(ellipse at 88% 92%, rgba(122, 139, 96, 0.14) 0%, transparent 55%),
        radial-gradient(ellipse at 50% 50%, rgba(107, 80, 64, 0.06) 0%, transparent 70%);
    background-attachment: fixed;
}

/* ---------- Grain / leather texture overlay ---------- */
.grain-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.35;
    mix-blend-mode: multiply;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(58, 48, 40, 0.05) 0.5px, transparent 1.5px),
        radial-gradient(circle at 70% 60%, rgba(58, 48, 40, 0.04) 0.5px, transparent 1.5px),
        radial-gradient(circle at 40% 80%, rgba(107, 80, 64, 0.04) 0.6px, transparent 1.6px),
        radial-gradient(circle at 90% 10%, rgba(58, 48, 40, 0.05) 0.5px, transparent 1.5px),
        radial-gradient(circle at 10% 90%, rgba(107, 80, 64, 0.05) 0.5px, transparent 1.5px);
    background-size: 7px 7px, 11px 11px, 9px 9px, 13px 13px, 8px 8px;
}

/* ---------- Hero ---------- */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(40px, 6vw, 80px) clamp(20px, 4vw, 56px);
    z-index: 2;
}

.hero-inner {
    position: relative;
    width: min(960px, 100%);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(18px, 2.4vw, 32px);
}

.hero-eyebrow {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--saddle);
    margin: 0;
    opacity: 0;
    animation: fadeUp 800ms ease-out 200ms forwards;
}

.logotype {
    font-family: var(--font-slab);
    font-weight: 700;
    font-size: clamp(48px, 8vw, 104px);
    line-height: 0.95;
    letter-spacing: -0.01em;
    color: var(--earth);
    margin: 0;
    opacity: 0;
    animation: fadeUp 800ms ease-out 400ms forwards;
}

.logotype-dot {
    color: var(--gold);
}

.crescent-wrap {
    position: relative;
    width: clamp(180px, 22vw, 260px);
    height: clamp(180px, 22vw, 260px);
    margin: clamp(8px, 1.5vw, 22px) 0;
    opacity: 0;
    animation: fadeUp 1000ms ease-out 700ms forwards;
}

.crescent-blob {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 14px 22px rgba(58, 48, 40, 0.25));
}

.crescent-outline {
    stroke-dasharray: 720;
    stroke-dashoffset: 720;
    animation: drawCrescent 1500ms ease-out 700ms forwards;
}

.crescent-fill {
    opacity: 0;
    animation: fadeIn 1200ms ease-out 1500ms forwards;
}

.crescent-grain {
    opacity: 0;
    animation: fadeIn 1500ms ease-out 1800ms forwards;
}

.leaf-hero {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    animation: fadeUp 1200ms ease-out 1700ms forwards;
}

.leaf-hero.leaf-oak {
    width: 70px;
    top: -20px;
    left: -34px;
    transform: rotate(-22deg);
    opacity: 0;
    animation: leafSway 1200ms ease-out 1700ms forwards, drift 9s ease-in-out 2900ms infinite;
}

.leaf-hero.leaf-fern {
    width: 46px;
    bottom: -22px;
    right: -30px;
    transform: rotate(18deg);
    animation: leafSway 1200ms ease-out 2000ms forwards, drift 11s ease-in-out 3300ms infinite reverse;
}

.hero-tagline {
    font-family: var(--font-slab);
    font-weight: 400;
    font-style: italic;
    font-size: clamp(16px, 1.4vw, 22px);
    line-height: 1.55;
    color: var(--leather);
    max-width: 560px;
    margin: 0;
    opacity: 0;
    animation: fadeUp 800ms ease-out 1900ms forwards;
}

.hero-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    opacity: 0;
    animation: fadeUp 800ms ease-out 2100ms forwards;
}

.meta-line {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.05em;
    color: var(--saddle);
}

.hero-scroll-hint {
    margin-top: clamp(20px, 3vw, 40px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0;
    animation: fadeUp 1000ms ease-out 2400ms forwards;
}

.hint-rule {
    width: 1px;
    height: 36px;
    background: linear-gradient(to bottom, transparent, var(--saddle));
    animation: pulseRule 2.6s ease-in-out infinite;
}

.hint-text {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--saddle);
}

/* ---------- Timeline ---------- */
.timeline {
    position: relative;
    width: min(1100px, 100%);
    margin: clamp(40px, 6vw, 96px) auto;
    padding: 0 clamp(20px, 4vw, 56px);
    z-index: 2;
}

.timeline-spine {
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(50% - 1.5px);
    width: 3px;
    background: var(--saddle);
    background-image: linear-gradient(
        to bottom,
        rgba(122, 86, 70, 0.0) 0%,
        var(--saddle) 6%,
        var(--saddle) 94%,
        rgba(122, 86, 70, 0.0) 100%
    );
    border-radius: 2px;
    box-shadow: 0 0 0 0.5px rgba(58, 48, 40, 0.2);
}

.timeline-spine::before,
.timeline-spine::after {
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--leather);
    box-shadow: inset 0 0 0 2px var(--honey);
}

.timeline-spine::before { top: -7px; }
.timeline-spine::after  { bottom: -7px; }

.entry {
    position: relative;
    width: 50%;
    padding: clamp(20px, 3vw, 40px) clamp(24px, 4vw, 56px);
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 700ms ease-out, transform 700ms ease-out;
}

.entry.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.entry-left {
    margin-right: 50%;
    text-align: right;
}

.entry-right {
    margin-left: 50%;
    text-align: left;
}

.entry .node {
    position: absolute;
    top: clamp(40px, 5vw, 72px);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 30%, #B89060 0%, var(--leather) 60%, #4A382A 100%);
    box-shadow:
        0 0 0 4px var(--honey),
        0 0 0 5px rgba(107, 80, 64, 0.55),
        0 4px 8px rgba(58, 48, 40, 0.35);
    z-index: 3;
}

.entry-left .node {
    right: calc(-8px - 1px);
    transform: translateX(50%);
    right: -8px;
    margin-right: -8px;
}

/* explicit node positions: snap to spine */
.entry-left  .node { right: -8px; }
.entry-right .node { left:  -8px; }

/* ---------- Card ---------- */
.card {
    position: relative;
    background: var(--cream);
    color: var(--earth);
    border-radius: var(--blob-radius);
    padding: clamp(22px, 2.8vw, 36px) clamp(22px, 3vw, 40px);
    box-shadow: var(--shadow-soft);
    transform-style: preserve-3d;
    transform: perspective(800px) rotateX(0deg) rotateY(0deg);
    transition: transform 0.18s ease-out, box-shadow 0.25s ease-out;
    text-align: left;
    background-image:
        radial-gradient(circle at 20% 25%, rgba(107, 80, 64, 0.045) 0.6px, transparent 1.2px),
        radial-gradient(circle at 70% 60%, rgba(107, 80, 64, 0.04) 0.6px, transparent 1.2px),
        radial-gradient(circle at 35% 80%, rgba(107, 80, 64, 0.05) 0.6px, transparent 1.4px),
        radial-gradient(circle at 85% 30%, rgba(58, 48, 40, 0.04) 0.5px, transparent 1.2px),
        linear-gradient(135deg, var(--cream) 0%, #F4ECD8 100%);
    background-size: 9px 9px, 13px 13px, 11px 11px, 7px 7px, 100% 100%;
    border: 1px solid rgba(107, 80, 64, 0.12);
}

.entry-right .card {
    border-radius: var(--blob-radius-mirror);
}

.card::before {
    content: "";
    position: absolute;
    inset: 6px;
    border: 1px solid rgba(107, 80, 64, 0.12);
    border-radius: inherit;
    pointer-events: none;
}

.card.folded::after {
    content: "";
    position: absolute;
    bottom: 0;
    right: 0;
    width: 38px;
    height: 38px;
    background:
        linear-gradient(135deg, transparent 50%, #E6DAC2 50%, #DCCDB0 100%);
    border-bottom-right-radius: inherit;
    box-shadow: -2px -2px 4px rgba(58, 48, 40, 0.08) inset;
    pointer-events: none;
}

.entry-right .card.folded::after {
    bottom: 0;
    left: 0;
    right: auto;
    background:
        linear-gradient(225deg, transparent 50%, #E6DAC2 50%, #DCCDB0 100%);
    border-bottom-left-radius: inherit;
    border-bottom-right-radius: 0;
    box-shadow: 2px -2px 4px rgba(58, 48, 40, 0.08) inset;
}

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--line);
    margin-bottom: 16px;
}

.entry-number {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--gold);
}

.entry-date {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.05em;
    color: var(--saddle);
}

.entry-title {
    font-family: var(--font-slab);
    font-weight: 600;
    font-size: clamp(22px, 2.2vw, 30px);
    line-height: 1.2;
    color: var(--earth);
    margin: 0 0 14px;
}

.entry-body {
    font-family: var(--font-body);
    font-size: clamp(14px, 1vw, 17px);
    line-height: 1.75;
    color: var(--earth);
    margin: 0 0 14px;
}

.entry-body.entry-soft {
    color: var(--ink-soft);
    font-style: italic;
}

.entry-list {
    list-style: none;
    padding: 0;
    margin: 0 0 14px;
    border-top: 1px dotted var(--line);
}

.entry-list li {
    font-family: var(--font-body);
    font-size: 15px;
    padding: 8px 0;
    border-bottom: 1px dotted var(--line);
    color: var(--ink-soft);
    position: relative;
    padding-left: 22px;
}

.entry-list li::before {
    content: "\002767";
    position: absolute;
    left: 0;
    top: 6px;
    color: var(--gold);
    font-size: 14px;
}

.entry-quote {
    font-family: var(--font-slab);
    font-style: italic;
    font-weight: 500;
    font-size: clamp(15px, 1.2vw, 18px);
    line-height: 1.55;
    color: var(--leather);
    border-left: 3px solid var(--gold);
    margin: 14px 0;
    padding: 6px 0 6px 16px;
    background:
        linear-gradient(to right, rgba(200, 160, 80, 0.08), transparent 70%);
}

.entry-defs {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 6px 14px;
    margin: 12px 0 0;
    padding: 10px 0 0;
    border-top: 1px dashed var(--line);
}

.entry-defs dt {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.06em;
    color: var(--saddle);
    text-transform: uppercase;
}

.entry-defs dd {
    margin: 0;
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--earth);
}

.entry-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0 0;
    font-family: var(--font-mono);
    font-size: 13px;
}

.entry-table th,
.entry-table td {
    padding: 6px 8px;
    border-bottom: 1px dashed var(--line);
    text-align: left;
    color: var(--earth);
}

.entry-table th {
    font-weight: 500;
    color: var(--saddle);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 11px;
}

.entry-table tbody tr:last-child td {
    border-bottom: none;
}

.entry-signoff {
    font-family: var(--font-slab);
    font-style: italic;
    font-size: 15px;
    color: var(--leather);
    text-align: right;
    margin: 18px 0 0;
    border-top: 1px solid var(--line);
    padding-top: 12px;
}

.signoff-name {
    color: var(--gold);
    font-weight: 600;
    font-style: normal;
}

/* ---------- Decorative leaves on cards ---------- */
.leaf-deco {
    position: absolute;
    opacity: 0.3;
    pointer-events: none;
}

.leaf-oak-small {
    width: 50px;
    bottom: -16px;
    right: -14px;
    transform: rotate(18deg);
}

.leaf-oak-small.leaf-rotated {
    transform: rotate(-32deg);
    bottom: auto;
    top: -18px;
    right: auto;
    left: -12px;
}

.leaf-maple {
    width: 56px;
    top: -20px;
    right: -16px;
    transform: rotate(-12deg);
}

.entry-right .leaf-maple {
    right: auto;
    left: -16px;
    transform: rotate(12deg);
}

.leaf-fern-small {
    width: 36px;
    bottom: -18px;
    left: -10px;
    transform: rotate(-22deg);
}

.entry-right .leaf-fern-small {
    left: auto;
    right: -10px;
    transform: rotate(22deg);
}

/* ---------- Hover lift ---------- */
.card:hover {
    box-shadow: var(--shadow-lift);
}

/* ---------- Colophon ---------- */
.colophon {
    position: relative;
    z-index: 2;
    padding: clamp(48px, 6vw, 88px) clamp(20px, 4vw, 56px);
    text-align: center;
    border-top: 1px dashed var(--line);
    margin-top: clamp(20px, 4vw, 40px);
}

.colophon-inner {
    width: min(680px, 100%);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.colophon-mark {
    width: 54px;
    height: 54px;
    opacity: 0.85;
}

.colophon-line {
    font-family: var(--font-slab);
    font-style: italic;
    font-size: clamp(14px, 1.1vw, 17px);
    color: var(--leather);
    margin: 0;
    line-height: 1.55;
}

.colophon-meta {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--saddle);
    margin: 0;
}

/* ---------- Animations ---------- */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes leafSway {
    from {
        opacity: 0;
        transform: translateY(8px) rotate(-22deg);
    }
    to {
        opacity: 1;
    }
}

@keyframes drift {
    0%   { transform: translateY(0) rotate(-22deg); }
    50%  { transform: translateY(-6px) rotate(-18deg); }
    100% { transform: translateY(0) rotate(-22deg); }
}

@keyframes drawCrescent {
    from { stroke-dashoffset: 720; }
    to   { stroke-dashoffset: 0; }
}

@keyframes pulseRule {
    0%, 100% { opacity: 0.4; transform: scaleY(0.9); transform-origin: top; }
    50%      { opacity: 1;   transform: scaleY(1); }
}

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
    .timeline {
        padding: 0 clamp(16px, 4vw, 28px);
    }
    .timeline-spine {
        left: 18px;
    }
    .entry,
    .entry-left,
    .entry-right {
        width: 100%;
        margin: 0;
        padding: 16px 0 16px 44px;
        text-align: left;
    }
    .entry-left  .node,
    .entry-right .node {
        left: 10px;
        right: auto;
        top: 28px;
    }
    .entry-right .card,
    .card {
        border-radius: 22px 6px 22px 6px;
    }
    .card.folded::after,
    .entry-right .card.folded::after {
        right: 0;
        left: auto;
        background:
            linear-gradient(135deg, transparent 50%, #E6DAC2 50%, #DCCDB0 100%);
        border-bottom-right-radius: inherit;
        border-bottom-left-radius: 0;
    }
    .leaf-hero.leaf-oak  { left: -20px; top: -10px; }
    .leaf-hero.leaf-fern { right: -16px; bottom: -10px; }
    .entry-right .leaf-maple {
        left: auto;
        right: -10px;
        transform: rotate(-12deg);
    }
    .entry-right .leaf-fern-small {
        right: auto;
        left: -10px;
        transform: rotate(-22deg);
    }
}

@media (max-width: 420px) {
    .logotype { font-size: 44px; }
    .hero-tagline { font-size: 15px; }
    .card { padding: 20px 18px; }
}
