/* kakuritsu.com Styles */

:root {
    --color-sand: #E8D5C0;
    --color-clay: #A0522D;
    --color-cream: #F5EDE3;
    --color-sage: #8B9A7B;
    --color-charcoal: #2A1F1A;
    --color-terracotta: #C2704E;
    --color-ochre: #D4A055;
    --color-maroon: #3B2F2A;

    --font-display: 'Playfair Display', serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'Space Mono', monospace;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    color: var(--color-charcoal);
    background-color: var(--color-cream);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Hero Section */
.hero {
    position: relative;
    height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: var(--color-sand);
}

.hero-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(4rem, 10vw, 9rem);
    font-weight: 900;
    letter-spacing: -0.03em;
    line-height: 0.95;
    color: var(--color-charcoal);
    text-transform: lowercase;
    margin-bottom: 0.5rem;
}

.title-break {
    display: block;
    font-size: 0.5em;
    letter-spacing: 0.1em;
    color: var(--color-sage);
}

.hero-subtitle {
    font-family: var(--font-body);
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--color-charcoal);
    opacity: 0.8;
    font-weight: 400;
}

/* Content Sections */
.content-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    background-color: var(--color-cream);
    position: relative;
}

.content-section:nth-child(even) {
    background-color: #FBF8F3;
}

.section-inner {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
}

.section-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 2rem;
    color: var(--color-charcoal);
    letter-spacing: -0.02em;
}

.section-text {
    font-family: var(--font-body);
    font-size: clamp(1rem, 2vw, 1.25rem);
    line-height: 1.8;
    margin-bottom: 3rem;
    color: var(--color-charcoal);
    max-width: 700px;
    font-weight: 400;
}

.visualization-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    aspect-ratio: 4 / 3;
}

.hero-canvas,
.coin-visualization,
.distribution-visualization,
.scatter-visualization,
.tree-visualization,
.bayesian-visualization,
.markov-visualization {
    width: 100%;
    height: 100%;
    display: block;
}

/* SVG Elements */
.dot-field {
    pointer-events: none;
}

.coin-text,
.state-label {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    fill: var(--color-cream);
}

.bell-curve {
    stroke: var(--color-sage);
    fill: none;
    opacity: 0.7;
}

.regression-line {
    stroke: var(--color-clay);
    opacity: 0.6;
}

.coin-flip-container {
    animation: coin-spin 2s infinite linear;
    transform-origin: 200px 150px;
}

@keyframes coin-spin {
    0% { transform: rotateY(0deg); }
    50% { transform: rotateY(180deg); }
    100% { transform: rotateY(360deg); }
}

.bayes-bars rect {
    transition: all 1s ease-in-out;
    opacity: 0.7;
}

.bayes-bars rect:hover {
    opacity: 1;
}

/* Closing Section */
.closing-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    background: linear-gradient(135deg, var(--color-sand) 0%, var(--color-cream) 100%);
    position: relative;
    overflow: hidden;
}

.closing-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(139, 154, 123, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(160, 82, 45, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.closing-section .section-inner {
    position: relative;
    z-index: 1;
    text-align: center;
}

.closing-title {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 900;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 2rem;
    color: var(--color-charcoal);
}

.closing-text {
    font-family: var(--font-body);
    font-size: clamp(1rem, 2vw, 1.25rem);
    line-height: 1.8;
    margin-bottom: 2rem;
    color: var(--color-charcoal);
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.closing-quote {
    font-family: var(--font-display);
    font-size: clamp(1.25rem, 2.5vw, 1.75rem);
    font-style: italic;
    font-weight: 700;
    color: var(--color-clay);
    line-height: 1.6;
    margin-top: 3rem;
}

/* Distribution Dots Animation */
.distribution-dots circle {
    fill: var(--color-terracotta);
    opacity: 0.6;
    animation: float-up 3s ease-out forwards;
}

@keyframes float-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 0.6;
        transform: translateY(0);
    }
}

/* Scatter Points */
.scatter-points circle {
    fill: var(--color-ochre);
    opacity: 0.65;
    animation: scatter-appear 1.5s ease-out forwards;
}

@keyframes scatter-appear {
    from {
        opacity: 0;
        r: 0;
    }
    to {
        opacity: 0.65;
        r: 3;
    }
}

/* Tree Animation */
.tree-branches line,
.tree-nodes circle {
    opacity: 0;
    animation: tree-grow 2s ease-out forwards;
}

.tree-branches line:nth-child(1) { animation-delay: 0s; }
.tree-branches line:nth-child(2) { animation-delay: 0.3s; }
.tree-branches line:nth-child(3) { animation-delay: 0.3s; }
.tree-branches line:nth-child(4) { animation-delay: 0.6s; }
.tree-branches line:nth-child(5) { animation-delay: 0.6s; }
.tree-branches line:nth-child(6) { animation-delay: 0.6s; }
.tree-branches line:nth-child(7) { animation-delay: 0.6s; }

.tree-nodes circle:nth-child(1) { animation-delay: 0s; }
.tree-nodes circle:nth-child(2) { animation-delay: 0.3s; }
.tree-nodes circle:nth-child(3) { animation-delay: 0.3s; }
.tree-nodes circle:nth-child(4) { animation-delay: 0.6s; }
.tree-nodes circle:nth-child(5) { animation-delay: 0.6s; }
.tree-nodes circle:nth-child(6) { animation-delay: 0.6s; }
.tree-nodes circle:nth-child(7) { animation-delay: 0.6s; }

@keyframes tree-grow {
    from {
        opacity: 0;
        stroke-width: 0;
    }
    to {
        opacity: 1;
        stroke-width: inherit;
    }
}

/* Markov Animation */
.markov-arrows path {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    animation: dash-draw 2s ease-in-out forwards;
}

.markov-arrows path:nth-child(2) { animation-delay: 0s; }
.markov-arrows path:nth-child(3) { animation-delay: 0.5s; }
.markov-arrows path:nth-child(4) { animation-delay: 1s; }

@keyframes dash-draw {
    to {
        stroke-dashoffset: 0;
    }
}

.markov-states circle {
    animation: pulse-state 2s ease-in-out infinite;
}

@keyframes pulse-state {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .section-title {
        font-size: 2rem;
    }

    .section-text {
        font-size: 1rem;
    }

    .closing-title {
        font-size: 2.5rem;
    }

    .visualization-container {
        max-width: 100%;
        aspect-ratio: auto;
        min-height: 300px;
    }
}

/* Smooth Scroll Behavior */
section {
    scroll-margin-top: 0;
}

/* Print Styles */
@media print {
    .hero-canvas,
    .visualization-container {
        display: none;
    }
}
