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

/* Color palette definitions */
:root {
    --color-dark-charcoal: #2E2A24;
    --color-muted-brown: #6B5E52;
    --color-deep-sienna: #8B3A0F;
    --color-soft-sage: #A8B09A;
    --color-burnt-orange: #C2571A;
    --color-amber-gold: #D4943A;
    --color-faded-terracotta: #D4B8A0;
    --color-deep-cream: #EDE6D8;
    --color-warm-cream: #F5F0E8;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: #F5F0E8;
    color: #2E2A24;
    font-family: 'EB Garamond', serif;
    font-size: clamp(1rem, 1.1vw + 0.4rem, 1.25rem);
    line-height: 1.72;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* Grain overlay texture */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' result='noise'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
    opacity: 0.15;
    mix-blend-mode: multiply;
    z-index: 9998;
}

/* Main layout structure */
body {
    display: grid;
    grid-template-columns: 1fr 2fr;
    grid-template-rows: 1fr;
}

.left-margin {
    background-color: #EDE6D8;
    padding: 2rem;
    position: relative;
    border-right: 1px solid #D4B8A0;
    min-height: 100vh;
}

.main-content {
    grid-column: 2;
    padding: 0;
    position: relative;
}

/* Domain imprint */
.domain-imprint {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(0.6rem, 1vw, 0.8rem);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #6B5E52;
    margin-bottom: 3rem;
    writing-mode: horizontal-tb;
}

/* Progress indicator */
.progress-bar {
    position: fixed;
    left: 2rem;
    top: 50%;
    transform: translateY(-50%);
    height: 300px;
    width: 2px;
    background-color: #D4B8A0;
    z-index: 100;
}

.progress-fill {
    position: absolute;
    left: -1px;
    top: 0;
    width: 4px;
    height: 0%;
    background-color: #C2571A;
    transform: scaleY(0);
    transform-origin: top;
    z-index: 101;
}

.progress-ruler {
    position: absolute;
    left: -3px;
    top: 0;
    width: 8px;
    height: 100%;
}

.ruler-tick {
    position: absolute;
    left: 0;
    width: 8px;
    height: 2px;
    background-color: #C2571A;
    opacity: 0.3;
    transition: all 0.2s ease-out;
}

.ruler-tick:hover {
    background-color: #8B3A0F;
    opacity: 0.8;
}

.ruler-tick[data-section="1"] { top: 0%; }
.ruler-tick[data-section="2"] { top: 14.3%; }
.ruler-tick[data-section="3"] { top: 28.6%; }
.ruler-tick[data-section="4"] { top: 42.9%; }
.ruler-tick[data-section="5"] { top: 57.2%; }
.ruler-tick[data-section="6"] { top: 71.5%; }
.ruler-tick[data-section="7"] { top: 85.8%; }

/* Section styling */
.report-section {
    min-height: 100vh;
    padding: 6rem 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background-color: #F5F0E8;
    overflow: hidden;
}

.section-number-bg {
    position: absolute;
    left: -4rem;
    top: 2rem;
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(4rem, 8vw, 9rem);
    font-weight: 300;
    color: #C2571A;
    opacity: 0.12;
    line-height: 1;
    pointer-events: none;
}

.section-content {
    max-width: 800px;
    width: 100%;
    position: relative;
    z-index: 10;
}

.section-heading {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(1.8rem, 3vw, 2.8rem);
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 1.5rem;
    color: #2E2A24;
}

.section-narrative {
    color: #2E2A24;
    margin-bottom: 2rem;
    line-height: 1.72;
    font-weight: 400;
}

.chart-container {
    margin: 2.5rem 0;
    padding: 1.5rem;
    border: 2px solid #C2571A;
    background-color: #F5F0E8;
    position: relative;
    opacity: 0;
    animation: borderAnimateIn 1.2s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}

@keyframes borderAnimateIn {
    0% {
        clip-path: inset(0 100% 100% 0);
        opacity: 1;
    }
    25% {
        clip-path: inset(0 0 100% 0);
    }
    50% {
        clip-path: inset(0 0 0 0);
    }
    75% {
        clip-path: inset(0 0 0 0);
    }
    100% {
        clip-path: inset(0 0 0 0);
        opacity: 1;
    }
}

.data-chart {
    width: 100%;
    height: 300px;
    display: block;
}

.chart-bar, .chart-line, .data-point, .data-point-large, .chart-area, .chart-line-forecast, .chart-line-historical {
    opacity: 0;
    animation: chartDataReveal 1s ease-out forwards;
}

.chart-bar:nth-child(1) { animation-delay: 0.2s; }
.chart-bar:nth-child(2) { animation-delay: 0.25s; }
.chart-bar:nth-child(3) { animation-delay: 0.3s; }
.chart-bar:nth-child(4) { animation-delay: 0.35s; }
.chart-bar:nth-child(5) { animation-delay: 0.4s; }
.chart-bar:nth-child(6) { animation-delay: 0.45s; }
.chart-bar:nth-child(7) { animation-delay: 0.5s; }

.data-point {
    animation-delay: 0.6s;
}

.data-point-large {
    animation-delay: 0.5s;
}

.chart-line {
    animation-delay: 0.3s;
}

.chart-line-forecast {
    animation-delay: 0.6s;
}

.chart-line-historical {
    animation-delay: 0.4s;
}

.chart-area {
    animation-delay: 0.2s;
}

@keyframes chartDataReveal {
    from {
        opacity: 0;
        transform: scaleY(0.8);
    }
    to {
        opacity: 1;
        transform: scaleY(1);
    }
}

.axis-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(0.65rem, 0.7vw + 0.15rem, 0.8rem);
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    fill: #6B5E52;
}

.section-annotation {
    color: #6B5E52;
    font-size: 0.95rem;
    margin-top: 1.5rem;
    line-height: 1.65;
    font-weight: 400;
}

.data-value {
    font-family: 'JetBrains Mono', monospace;
    background-color: rgba(194, 87, 26, 0.06);
    padding: 0.1em 0.35em;
    letter-spacing: 0.06em;
    font-weight: 400;
    color: #C2571A;
    transition: color 0.2s ease-out, background-color 0.2s ease-out;
}

.data-value:hover {
    color: #8B3A0F;
    background-color: rgba(139, 58, 15, 0.12);
}

.marginal-notes {
    margin-top: 2rem;
    padding-left: 2rem;
    border-left: 2px solid #D4B8A0;
}

.marginal-note {
    font-family: 'EB Garamond', serif;
    font-size: clamp(0.7rem, 0.8vw + 0.2rem, 0.85rem);
    line-height: 1.6;
    font-style: italic;
    color: #6B5E52;
    font-weight: 400;
    opacity: 0;
    animation: marginalNoteReveal 0.5s ease-out forwards;
}

.marginal-note:nth-child(1) { animation-delay: 0.8s; }
.marginal-note:nth-child(2) { animation-delay: 0.95s; }

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

/* Section dividers */
.section-divider {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #EDE6D8;
    position: relative;
    overflow: hidden;
}

.divider-line {
    position: absolute;
    width: 100%;
    height: 2px;
    background-color: #C2571A;
    transform-origin: bottom left;
    opacity: 0;
    animation: dividerLineReveal 0.8s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}

@keyframes dividerLineReveal {
    from {
        width: 0;
        opacity: 1;
        transform: scaleX(0);
        transform-origin: bottom left;
    }
    to {
        width: 100%;
        opacity: 1;
        transform: scaleX(1);
    }
}

.divider-number {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(5rem, 12vw, 12rem);
    font-weight: 300;
    color: #C2571A;
    opacity: 0;
    animation: dividerNumberReveal 0.6s ease-out 0.3s forwards;
}

@keyframes dividerNumberReveal {
    from {
        opacity: 0;
    }
    to {
        opacity: 0.2;
    }
}

/* Closing section */
.report-closing {
    min-height: 100vh;
    padding: 6rem 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #F5F0E8;
    text-align: center;
}

.report-closing p {
    max-width: 600px;
    font-size: 1.1rem;
    color: #6B5E52;
    line-height: 1.8;
}

/* Japanese watermark */
.japanese-watermark {
    position: fixed;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%) rotate(-90deg);
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem;
    color: #C2571A;
    opacity: 0.06;
    pointer-events: none;
    white-space: nowrap;
    z-index: 1;
    letter-spacing: 0.5em;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    body {
        grid-template-columns: 1fr;
    }

    .left-margin {
        display: none;
    }

    .main-content {
        grid-column: 1;
    }

    .progress-bar {
        display: none;
    }

    .report-section {
        padding: 4rem 2rem;
    }

    .section-number-bg {
        left: 0;
        opacity: 0.06;
    }
}

@media (max-width: 768px) {
    .chart-container {
        padding: 1rem;
    }

    .marginal-notes {
        padding-left: 1rem;
        margin-top: 1.5rem;
    }

    .section-heading {
        font-size: clamp(1.4rem, 2.5vw, 2rem);
    }

    .report-section {
        padding: 2rem 1.5rem;
        min-height: auto;
    }

    .section-divider {
        min-height: 50vh;
    }

    .divider-number {
        font-size: clamp(3rem, 8vw, 6rem);
    }

    .report-closing {
        padding: 3rem 1.5rem;
        min-height: auto;
    }

    .japanese-watermark {
        font-size: 1rem;
        right: 0.5rem;
    }
}

/* Print styles */
@media print {
    body::after {
        display: none;
    }

    .progress-bar {
        display: none;
    }

    .left-margin {
        display: none;
    }

    body {
        grid-template-columns: 1fr;
    }

    .main-content {
        grid-column: 1;
    }
}
