/* ========================================
   ronri.net - Wabi-Sabi Timeline
   Aurora-gradient palette on dark earth
   ======================================== */

/* --- Custom Properties --- */
:root {
    --deep-ground: #1E1A1D;
    --primary-surface: #2D2B2E;
    --timeline-gold: #C4A76C;
    --aurora-green: #5B9E7A;
    --aurora-violet: #7B5EA7;
    --aurora-teal: #4A9EAD;
    --bubble-highlight: #E8F0E4;
    --body-text: #D4CFC8;
    --accent-warm: #C27D5F;

    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    --font-accent: 'Caveat', cursive;

    --ease-entry: cubic-bezier(0.25, 0.1, 0.25, 1);
    --ease-hover: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    background-color: var(--deep-ground);
    color: var(--body-text);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.72;
    overflow-x: hidden;
    position: relative;
}

/* --- Grain Overlay --- */
.grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* --- Scroll Indicator --- */
.scroll-indicator {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 36px;
    height: 36px;
    z-index: 100;
    opacity: 0.5;
    transition: opacity 0.3s var(--ease-entry);
}

.scroll-indicator:hover {
    opacity: 0.8;
}

.scroll-indicator-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.scroll-indicator-bg {
    stroke: var(--primary-surface);
    stroke-dasharray: 100, 100;
}

.scroll-indicator-fill {
    stroke: var(--timeline-gold);
    stroke-dasharray: 0, 100;
    stroke-linecap: round;
    transition: stroke-dasharray 0.1s linear;
}

/* --- Typography --- */
.caveat {
    font-family: var(--font-accent);
    font-weight: 400;
}

h1, h2 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* --- Sections --- */
.section {
    position: relative;
    width: 100%;
}

.section-opening {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.section-first {
    min-height: 150vh;
    padding: 10vh 0;
    position: relative;
}

.section-middle {
    min-height: 450vh;
    padding: 10vh 0;
    position: relative;
}

.section-climax {
    min-height: 200vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.section-closing {
    min-height: 200vh;
    padding: 10vh 0;
    position: relative;
}

/* --- Opening --- */
.opening-content {
    position: relative;
    z-index: 10;
    text-align: left;
    padding-left: 40%;
    width: 100%;
    opacity: 0;
    animation: fadeInSlow 2.5s var(--ease-entry) 0.5s forwards;
}

.site-title {
    font-size: clamp(3rem, 8vw, 6rem);
    color: var(--bubble-highlight);
    line-height: 1.1;
    margin-bottom: 0.3em;
    background: linear-gradient(160deg, var(--aurora-green), var(--aurora-teal), var(--aurora-violet));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.site-subtitle {
    font-size: clamp(1.1rem, 2vw, 1.6rem);
    color: var(--accent-warm);
    opacity: 0.8;
}

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

/* --- Timeline Thread --- */
.timeline-thread {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 100%;
    transform: translateX(-50%);
    z-index: 5;
    pointer-events: none;
}

.timeline-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.timeline-path {
    stroke: var(--timeline-gold);
    stroke-width: 1.5;
    fill: none;
    stroke-linecap: round;
    stroke-dasharray: var(--path-length, 5000);
    stroke-dashoffset: var(--path-offset, 5000);
    transition: stroke-dashoffset 0.05s linear;
    opacity: 0.7;
}

.timeline-thread-fading .timeline-path {
    opacity: 0.3;
}

/* --- Timeline Nodes --- */
.timeline-node {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    width: 18px;
    height: 18px;
}

.timeline-node[data-node="1"] { top: 8%; }
.timeline-node[data-node="2"] { top: 6%; }
.timeline-node[data-node="3"] { top: 26%; }
.timeline-node[data-node="4"] { top: 44%; }
.timeline-node[data-node="5"] { top: 58%; }
.timeline-node[data-node="6"] { top: 78%; }
.timeline-node[data-node="7"] { top: 50%; }
.timeline-node[data-node="8"] { top: 15%; }

.node-circle {
    width: 18px;
    height: 18px;
    border-radius: 48% 52% 47% 53%;
    background: var(--primary-surface);
    border: 1.5px solid var(--timeline-gold);
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.8s var(--ease-entry);
}

.timeline-node.visible .node-circle {
    opacity: 1;
    transform: scale(1);
    animation: nodePulse 1.5s var(--ease-entry) 0.2s;
}

.timeline-node.visible .node-circle:hover {
    background: linear-gradient(160deg, var(--aurora-green), var(--aurora-teal), var(--aurora-violet));
    border-color: transparent;
}

@keyframes nodePulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(196, 167, 108, 0.4); }
    50% { transform: scale(1.3); box-shadow: 0 0 12px 4px rgba(196, 167, 108, 0.15); }
}

/* Node effervescence bubbles */
.node-bubbles {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    pointer-events: none;
}

.node-micro-bubble {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(160deg, rgba(91, 158, 122, 0.4), rgba(74, 158, 173, 0.4), rgba(123, 94, 167, 0.4));
    opacity: 0;
    animation: bubbleEffervescence var(--dur, 1.5s) var(--ease-entry) var(--del, 0s) forwards;
}

@keyframes bubbleEffervescence {
    0% {
        opacity: 0.7;
        transform: translate(-50%, -50%) translateY(0) translateX(var(--dx, 0px)) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) translateY(-60px) translateX(var(--dx, 0px)) scale(0.3);
    }
}

/* --- Content Blocks --- */
.content-block {
    position: relative;
    z-index: 10;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s var(--ease-entry), transform 0.8s var(--ease-entry);
}

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

.content-left {
    width: 55%;
    margin-left: 2rem;
    padding-right: calc(50% - 2rem + 30px);
}

.content-right {
    width: 50%;
    margin-left: calc(50% + 2.5rem);
    padding-right: 2rem;
}

.content-block-inner {
    background: rgba(45, 43, 46, 0.6);
    padding: 2rem 2.2rem;
    border-radius: 3px;
    position: relative;
    transition: transform 0.3s var(--ease-hover), box-shadow 0.3s var(--ease-hover);
    overflow: hidden;
}

.content-block-inner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--timeline-gold);
    opacity: 0.4;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 4'%3E%3Cpath d='M0,2 Q50,0 100,2 T200,2 T300,2 T400,2' stroke='white' fill='none' stroke-width='4'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 4'%3E%3Cpath d='M0,2 Q50,0 100,2 T200,2 T300,2 T400,2' stroke='white' fill='none' stroke-width='4'/%3E%3C/svg%3E");
    mask-size: 100% 100%;
    -webkit-mask-size: 100% 100%;
}

.content-block-inner:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 32px rgba(30, 26, 29, 0.5), 0 2px 8px rgba(196, 167, 108, 0.08);
}

.content-sparse .content-block-inner {
    background: rgba(45, 43, 46, 0.35);
}

.block-date {
    display: block;
    font-size: clamp(0.85rem, 1.1vw, 1rem);
    color: var(--accent-warm);
    margin-bottom: 0.5em;
    opacity: 0.85;
}

.block-title {
    font-size: clamp(2rem, 5vw, 3.8rem);
    color: var(--bubble-highlight);
    line-height: 1.15;
    margin-bottom: 0.5em;
}

.block-text {
    color: var(--body-text);
    max-width: 42ch;
    margin-bottom: 1.2em;
}

.content-right .block-text {
    max-width: 38ch;
}

/* --- Block Image Circles --- */
.block-image-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    margin-top: 0.8rem;
    border: 1.5px solid rgba(196, 167, 108, 0.3);
}

.block-image-placeholder {
    width: 100%;
    height: 100%;
    filter: brightness(0.95) saturate(0.85) contrast(1.05);
}

.block-image-placeholder[data-motif="crack"] {
    background: radial-gradient(ellipse at 30% 40%, var(--accent-warm) 0%, var(--primary-surface) 60%);
    background-size: 200% 200%;
}

.block-image-placeholder[data-motif="crystal"] {
    background: radial-gradient(ellipse at 60% 50%, var(--aurora-teal) 0%, var(--deep-ground) 65%);
    background-size: 200% 200%;
}

.block-image-placeholder[data-motif="root"] {
    background: radial-gradient(ellipse at 50% 70%, var(--aurora-green) 0%, var(--deep-ground) 60%);
    background-size: 200% 200%;
}

/* --- Bubble Clusters --- */
.bubble-cluster {
    position: relative;
    width: 100%;
    height: 120px;
    z-index: 3;
    pointer-events: none;
}

.bubble-cluster-sparse {
    height: 80px;
}

.cluster-bubble {
    position: absolute;
    left: calc(50% + var(--offset, 0px));
    bottom: 0;
    width: var(--size, 20px);
    height: var(--size, 20px);
    border-radius: 50%;
    background: linear-gradient(160deg, rgba(91, 158, 122, 0.15), rgba(74, 158, 173, 0.2), rgba(123, 94, 167, 0.15));
    animation: bubbleFloat var(--duration, 14s) var(--ease-entry) var(--delay, 0s) infinite;
    opacity: 0;
}

@keyframes bubbleFloat {
    0% {
        opacity: 0;
        transform: translateY(0) translateX(0);
    }
    10% {
        opacity: 0.6;
    }
    50% {
        opacity: 0.4;
        transform: translateY(-60px) translateX(calc(sin(var(--delay, 0)) * 15px));
    }
    90% {
        opacity: 0.1;
    }
    100% {
        opacity: 0;
        transform: translateY(-120px) translateX(calc(sin(var(--delay, 0)) * -10px));
    }
}

/* --- Ambient Bubbles --- */
.ambient-bubbles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    overflow: hidden;
}

.ambient-bubble {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(160deg, rgba(91, 158, 122, 0.12), rgba(74, 158, 173, 0.15), rgba(123, 94, 167, 0.12));
    animation: ambientFloat var(--amb-dur, 16s) var(--ease-entry) var(--amb-del, 0s) infinite;
    will-change: transform;
}

@keyframes ambientFloat {
    0% {
        transform: translateY(100vh) translateX(0) scale(1);
        opacity: 0;
    }
    5% {
        opacity: var(--amb-opacity, 0.4);
    }
    25% {
        transform: translateY(75vh) translateX(var(--amb-wobble-1, 20px)) scale(1.05);
    }
    50% {
        transform: translateY(50vh) translateX(var(--amb-wobble-2, -15px)) scale(0.95);
    }
    75% {
        transform: translateY(25vh) translateX(var(--amb-wobble-3, 10px)) scale(1.02);
    }
    95% {
        opacity: var(--amb-opacity, 0.4);
    }
    100% {
        transform: translateY(-10vh) translateX(var(--amb-wobble-4, -5px)) scale(1);
        opacity: 0;
    }
}

/* --- Climax Section --- */
.climax-burst {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    z-index: 8;
    pointer-events: none;
}

.climax-bubble {
    position: absolute;
    border-radius: 50%;
    opacity: 0;
    transition: none;
    will-change: transform, opacity;
}

.climax-text {
    position: relative;
    z-index: 12;
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1.2s var(--ease-entry), transform 1.2s var(--ease-entry);
}

.climax-text.visible {
    opacity: 1;
    transform: translateY(0);
}

.climax-title {
    font-size: clamp(2.5rem, 7vw, 5rem);
    background: linear-gradient(160deg, var(--aurora-green), var(--aurora-teal), var(--aurora-violet));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.3em;
}

.climax-subtitle {
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: var(--accent-warm);
    opacity: 0.7;
}

.climax-node {
    top: 45%;
    z-index: 15;
}

/* --- Closing Section --- */
.closing-text {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 20vh 2rem;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 1.5s var(--ease-entry), transform 1.5s var(--ease-entry);
}

.closing-text.visible {
    opacity: 1;
    transform: translateY(0);
}

.closing-line {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.5rem, 4vw, 2.8rem);
    color: var(--body-text);
    opacity: 0.6;
    letter-spacing: -0.02em;
    line-height: 1.3;
    max-width: 20ch;
    margin: 0 auto;
}

/* --- Hover Interaction Bubbles --- */
.hover-bubbles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
    overflow: hidden;
}

.hover-micro-bubble {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(160deg, rgba(91, 158, 122, 0.5), rgba(74, 158, 173, 0.5), rgba(123, 94, 167, 0.5));
    pointer-events: none;
    animation: hoverBubbleRise var(--hb-dur, 1.2s) var(--ease-entry) forwards;
}

@keyframes hoverBubbleRise {
    0% {
        opacity: 0.7;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--hb-dx, 0px)), calc(-50% - 60px)) scale(0.2);
    }
}

/* --- Aurora background tint progression --- */
.section-middle::after,
.section-climax::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.section-middle::after {
    background: radial-gradient(ellipse at 50% 80%, rgba(91, 158, 122, 0.03) 0%, transparent 70%),
                radial-gradient(ellipse at 30% 60%, rgba(123, 94, 167, 0.02) 0%, transparent 60%);
}

.section-climax::after {
    background: radial-gradient(ellipse at 50% 50%, rgba(74, 158, 173, 0.05) 0%, transparent 60%),
                radial-gradient(ellipse at 60% 40%, rgba(91, 158, 122, 0.04) 0%, transparent 50%),
                radial-gradient(ellipse at 40% 60%, rgba(123, 94, 167, 0.04) 0%, transparent 50%);
}

/* --- Watercolor bleeds at section transitions --- */
.section-first::before {
    content: '';
    position: absolute;
    top: -5%;
    left: 20%;
    width: 60%;
    height: 15%;
    background: radial-gradient(ellipse, rgba(91, 158, 122, 0.06) 0%, transparent 70%);
    pointer-events: none;
    z-index: 1;
}

.section-closing::before {
    content: '';
    position: absolute;
    top: -5%;
    left: 30%;
    width: 40%;
    height: 10%;
    background: radial-gradient(ellipse, rgba(123, 94, 167, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: 1;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .content-left,
    .content-right {
        width: 85%;
        margin-left: 7.5%;
        padding-right: 7.5%;
    }

    .content-block-inner {
        padding: 1.5rem 1.6rem;
    }

    .timeline-thread {
        left: 12%;
    }

    .timeline-node {
        left: 12%;
    }

    .opening-content {
        padding-left: 10%;
        text-align: center;
    }

    .scroll-indicator {
        bottom: 16px;
        right: 16px;
        width: 28px;
        height: 28px;
    }

    .block-title {
        font-size: clamp(1.6rem, 6vw, 2.4rem);
    }

    .site-title {
        font-size: clamp(2.4rem, 10vw, 4rem);
    }
}

@media (max-width: 480px) {
    .content-left,
    .content-right {
        width: 92%;
        margin-left: 4%;
        padding-right: 4%;
    }

    .timeline-thread,
    .timeline-node {
        left: 6%;
    }
}
