/* ============================================
   eesugi.com — Dendrochronological Interface
   ============================================ */

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

html {
    /* Full-document gradient: sapwood to heartwood */
    background: linear-gradient(to bottom, #f0ebe3 0%, #f0ebe3 5%, #2b1f16 95%, #2b1f16 100%);
    background-attachment: fixed;
    scroll-behavior: auto;
    overflow-x: hidden;
}

body {
    position: relative;
    min-height: 800vh;
    font-family: 'Literata', Georgia, serif;
    font-weight: 400;
    color: #4a3728;
    overflow-x: hidden;
}

/* --- Grain Texture Overlay --- */
#grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='6'%3E%3Cline x1='0' y1='1' x2='200' y2='1.5' stroke='%236b5a47' stroke-width='0.3' opacity='0.05'/%3E%3Cline x1='0' y1='3.5' x2='200' y2='3' stroke='%236b5a47' stroke-width='0.25' opacity='0.04'/%3E%3Cline x1='0' y1='5.5' x2='200' y2='5.8' stroke='%236b5a47' stroke-width='0.2' opacity='0.03'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-attachment: fixed;
}

/* --- Vertical Divider Line --- */
#divider-line {
    position: fixed;
    top: 0;
    left: 68%;
    width: 1px;
    height: 100vh;
    background-color: #4a3728;
    opacity: 0.35;
    z-index: 5;
    pointer-events: none;
}

/* --- Domain Watermark --- */
#watermark {
    position: fixed;
    top: 2.5rem;
    right: 3rem;
    font-family: 'Instrument Serif', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    letter-spacing: 0.08em;
    color: #4a3728;
    opacity: 0;
    z-index: 10;
    pointer-events: none;
    transition: opacity 600ms cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

#watermark.visible {
    opacity: 0.15;
}

/* Text color transition for dark background */
#watermark.inverted {
    color: #f0ebe3;
}

/* --- Ring Diagram Container --- */
#ring-container {
    position: fixed;
    top: 50%;
    left: calc(50% - 12%);
    transform: translate(-50%, -50%);
    width: 85vw;
    height: 85vw;
    max-width: 85vh;
    max-height: 85vh;
    z-index: 2;
    pointer-events: none;
    /* Bleed off left edge by ~15% */
    margin-left: -15vw;
}

#ring-diagram {
    width: 100%;
    height: 100%;
    will-change: transform;
    transition: none;
}

#radial-cracks {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* --- Content Column (Margin Zone) --- */
#content-column {
    position: relative;
    z-index: 8;
    width: 30%;
    margin-left: 69%;
    padding-top: 120vh;
    padding-right: 3rem;
    padding-left: 1.5rem;
}

/* --- Content Blocks --- */
.content-block {
    margin-bottom: 40vh;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1200ms cubic-bezier(0.25, 0.1, 0.25, 1.0),
                transform 1200ms cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.content-block.visible {
    opacity: 1;
    transform: translateY(0);
}

.content-block.exiting {
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 800ms cubic-bezier(0.25, 0.1, 0.25, 1.0),
                transform 800ms cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

/* --- Ring Headings --- */
.ring-heading {
    font-family: 'Instrument Serif', Georgia, serif;
    font-weight: 400;
    font-size: clamp(2.4rem, 5vw, 4.8rem);
    letter-spacing: 0.08em;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    color: #4a3728;
}

/* --- Body Text --- */
.ring-body {
    font-family: 'Literata', Georgia, serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.1vw, 1.15rem);
    line-height: 1.75;
    text-indent: -1.2em;
    padding-left: 1.2em;
    margin-bottom: 1.2rem;
    color: #4a3728;
}

/* --- Data Labels --- */
.ring-data {
    display: block;
    font-family: 'DM Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #8b7d6b;
    opacity: 0.6;
    margin-top: 0.8rem;
}

/* --- Ring Counter --- */
#ring-counter {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    font-family: 'DM Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #8b7d6b;
    opacity: 0.6;
    z-index: 15;
    display: flex;
    align-items: baseline;
    gap: 0.4em;
}

#ring-current {
    font-size: 1rem;
    color: #4a3728;
    opacity: 1;
    min-width: 2.5em;
    text-align: right;
}

#ring-separator {
    opacity: 0.4;
}

#ring-total {
    opacity: 0.5;
}

/* --- Text Color Inversion (for dark background) --- */
body.inverted .ring-heading,
body.inverted .ring-body,
body.inverted #ring-current {
    color: #f0ebe3;
}

body.inverted .ring-data,
body.inverted #ring-counter {
    color: #8b7d6b;
}

body.inverted #ring-counter #ring-current {
    color: #f0ebe3;
}

body.inverted #divider-line {
    background-color: #f0ebe3;
    opacity: 0.2;
}

/* Crossover zone: both colors reduced */
body.crossover .ring-heading,
body.crossover .ring-body {
    color: #8b7d6b;
}

/* --- SVG Ring Styles --- */
#ring-diagram circle {
    fill: none;
    stroke: #6b5a47;
    stroke-opacity: 0.6;
    transition: stroke-opacity 800ms ease, stroke 800ms ease;
}

#ring-diagram circle.highlighted {
    stroke-opacity: 1;
    stroke: #b8863a;
}

/* Resin channel dots */
#ring-diagram .resin-dot {
    fill: #b8863a;
}

/* Pith mark */
#ring-diagram .pith {
    fill: #2b1f16;
}

/* Spring Ring active accent — #7a9b5a */
#ring-diagram circle.spring-active {
    stroke: #7a9b5a;
    stroke-opacity: 1;
}

#ring-counter:hover #ring-current {
    color: #7a9b5a;
}

/* --- Responsive Adjustments --- */
@media (max-width: 900px) {
    #ring-container {
        width: 120vw;
        height: 120vw;
        max-width: none;
        max-height: none;
        margin-left: -40vw;
    }

    #content-column {
        width: 45%;
        margin-left: 53%;
        padding-right: 1.5rem;
        padding-left: 1rem;
    }

    #divider-line {
        left: 52%;
    }

    .ring-heading {
        font-size: clamp(1.8rem, 4vw, 3rem);
    }
}

@media (max-width: 600px) {
    #ring-container {
        width: 150vw;
        height: 150vw;
        margin-left: -60vw;
    }

    #content-column {
        width: 55%;
        margin-left: 43%;
        padding-right: 1rem;
        padding-left: 0.8rem;
        padding-top: 100vh;
    }

    #divider-line {
        left: 42%;
    }

    .content-block {
        margin-bottom: 30vh;
    }

    #watermark {
        right: 1.5rem;
        top: 1.5rem;
    }
}
