/* talegrapher.com - Anti-design storytelling machine */

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

:root {
    --manuscript-cream: #f7f2e8;
    --deep-sepia: #2a2018;
    --warm-umber: #6b5040;
    --construction-red: #9c3a2e;
    --faded-sage: #8a9a78;
    --blueprint-gray: #8a7260;
    --canvas-bone: #ede5d6;
    --shadow-depth: #1a1410;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--canvas-bone);
    color: #3d3026;
    font-family: 'EB Garamond', serif;
    font-size: 18px;
    line-height: 1.8;
    overflow-x: hidden;
}

/* ---- Construction Lines ---- */
.construction-lines {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.c-line {
    position: absolute;
    background: none;
}

.c-line-v1 {
    left: 25%;
    top: 0;
    bottom: 0;
    width: 0;
    border-left: 1px dashed rgba(138, 114, 96, 0.2);
}

.c-line-v2 {
    left: 75%;
    top: 0;
    bottom: 0;
    width: 0;
    border-left: 1px dashed rgba(138, 114, 96, 0.2);
}

.c-line-h1 {
    top: 50vh;
    left: 0;
    right: 0;
    height: 0;
    border-top: 1px dashed rgba(138, 114, 96, 0.12);
}

/* ---- Curtain Section ---- */
.curtain-section {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.curtain-layer {
    position: absolute;
    width: 80%;
    max-width: 750px;
    height: 60vh;
    border-radius: 0;
}

.layer-3 {
    background: var(--canvas-bone);
    transform: translate(-20px, 20px);
    opacity: 0.4;
    z-index: 1;
}

.layer-2 {
    background: var(--canvas-bone);
    transform: translate(-10px, 10px);
    opacity: 0.7;
    z-index: 2;
}

.layer-1 {
    background: var(--manuscript-cream);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 4px 12px rgba(0,0,0,0.08), 0 12px 30px rgba(0,0,0,0.05);
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80%;
    max-width: 750px;
    height: 60vh;
}

.curtain-content {
    text-align: center;
    padding: 40px;
}

.curtain-title {
    font-family: 'EB Garamond', serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 4rem);
    color: var(--deep-sepia);
    letter-spacing: -0.01em;
    margin-bottom: 20px;
}

.title-part {
    display: inline-block;
    opacity: 0;
    transform: translateY(15px);
    animation: staggerReveal 0.5s ease forwards;
}

.tp-1 { animation-delay: 0.3s; }
.tp-2 { animation-delay: 0.5s; }
.tp-3 { animation-delay: 0.7s; }

@keyframes staggerReveal {
    to { opacity: 1; transform: translateY(0); }
}

.curtain-sub {
    font-family: 'Roboto Mono', monospace;
    font-size: 13px;
    color: var(--blueprint-gray);
    letter-spacing: 0.06em;
    min-height: 1.5em;
}

.curtain-sub::after {
    content: '|';
    animation: cursorBlink 1s step-end infinite;
    color: var(--construction-red);
}

@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ---- Tales Section ---- */
.tales-section {
    position: relative;
    padding: 60px 20px;
    max-width: 950px;
    margin: 0 auto;
    z-index: 2;
}

.tale-card {
    display: flex;
    gap: 0;
    background: var(--manuscript-cream);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 4px 12px rgba(0,0,0,0.08), 0 12px 30px rgba(0,0,0,0.05);
    margin-bottom: -40px;
    position: relative;
    z-index: 3;
}

.tale-card + .tale-card,
.construction-marker + .tale-card {
    z-index: 4;
}

.tale-margin {
    width: 25%;
    flex-shrink: 0;
    padding: 24px 16px;
    border-right: 0.5px solid rgba(138, 114, 96, 0.15);
}

.margin-diagram {
    margin-bottom: 16px;
}

.margin-diagram svg {
    width: 100%;
    height: auto;
    display: block;
    margin-bottom: 6px;
}

.diagram-label {
    font-family: 'Roboto Mono', monospace;
    font-size: 10px;
    color: var(--blueprint-gray);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    display: block;
}

.tale-content {
    flex: 1;
    padding: 36px 40px;
}

.tale-tag {
    display: block;
    font-family: 'Roboto Mono', monospace;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.06em;
    color: var(--blueprint-gray);
    text-transform: uppercase;
    margin-bottom: 10px;
}

.tale-content h2 {
    font-family: 'EB Garamond', serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.4rem);
    color: var(--deep-sepia);
    letter-spacing: -0.01em;
    margin-bottom: 14px;
}

.tale-content p {
    margin-bottom: 14px;
    position: relative;
}

.tale-content em {
    font-style: italic;
    font-weight: 600;
}

.red-circle-inline {
    display: inline;
    width: auto;
    height: 20px;
    vertical-align: middle;
    margin: 0 -4px;
}

.bold-callout {
    font-family: 'EB Garamond', serif;
    font-weight: 800;
    font-style: italic;
    font-size: 24px;
    color: var(--construction-red);
    border: none;
    padding: 16px 0;
    margin: 16px 0;
    line-height: 1.4;
}

/* ---- Construction Marker ---- */
.construction-marker {
    width: 8px;
    height: 8px;
    background: var(--construction-red);
    margin: 20px auto;
    position: relative;
    z-index: 5;
}

/* ---- Stagger Animation ---- */
.stagger-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

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

.stagger-margin {
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.5s ease 0.3s, transform 0.5s ease 0.3s;
}

.stagger-margin.visible {
    opacity: 1;
    transform: translateX(0);
}

/* ---- Graph Revealed ---- */
.graph-revealed {
    position: relative;
    padding: 80px 20px;
    text-align: center;
    overflow: hidden;
}

.graph-grid-intensify {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(to right, rgba(138,114,96,0.08) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(138,114,96,0.08) 1px, transparent 1px);
    background-size: 80px 80px;
    pointer-events: none;
}

.story-arc-svg {
    width: 100%;
    max-width: 800px;
    height: auto;
    margin: 0 auto 20px;
    display: block;
    position: relative;
    z-index: 2;
}

.story-arc-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 2s ease;
}

.story-arc-svg.visible .story-arc-path {
    stroke-dashoffset: 0;
}

.graph-caption {
    font-family: 'Roboto Mono', monospace;
    font-size: 12px;
    color: var(--blueprint-gray);
    letter-spacing: 0.06em;
    position: relative;
    z-index: 2;
}

/* ---- Deeper Tales ---- */
.deeper .tale-card {
    z-index: 5;
}

.deeper .tale-card + .construction-marker + .tale-card {
    z-index: 6;
}

/* ---- Unbound Section ---- */
.unbound-section {
    background: var(--shadow-depth);
    min-height: 80vh;
    position: relative;
    padding: 100px 40px;
    overflow: hidden;
}

.unbound-element {
    position: relative;
}

.ub-1 {
    max-width: 500px;
    margin-left: 15%;
    margin-bottom: 60px;
}

.ub-1 h2 {
    font-family: 'EB Garamond', serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3rem);
    color: var(--manuscript-cream);
    opacity: 0.9;
}

.ub-2 {
    max-width: 450px;
    margin-left: 40%;
    margin-bottom: 60px;
}

.ub-2 p {
    color: var(--canvas-bone);
    opacity: 0.7;
    font-size: 16px;
}

.ub-3 {
    margin-left: 60%;
    margin-bottom: 80px;
}

.construction-annotation {
    font-family: 'Roboto Mono', monospace;
    font-size: 13px;
    color: var(--blueprint-gray);
    letter-spacing: 0.06em;
    opacity: 0.6;
}

.empty-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px solid var(--construction-red);
    position: absolute;
    bottom: 60px;
    right: 15%;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .tale-card {
        flex-direction: column;
    }

    .tale-margin {
        width: 100%;
        border-right: none;
        border-bottom: 0.5px solid rgba(138, 114, 96, 0.15);
        padding: 16px;
    }

    .tale-content {
        padding: 24px 20px;
    }

    .curtain-layer,
    .layer-1 {
        width: 95%;
        height: 50vh;
    }

    .c-line-v1 { left: 10%; }
    .c-line-v2 { left: 90%; }

    .ub-1, .ub-2, .ub-3 {
        margin-left: 5%;
    }
}
