/* ============================================================
   hwaglyul.com — 확률 — Styles
   Luxury-premium aesthetic + mathematical elegance
   ============================================================ */

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

:root {
    --deep-walnut: #2A1F14;
    --warm-umber: #3D3228;
    --burnished-gold: #C4A265;
    --rose-quartz: #E8A0B5;
    --peach-sorbet: #F5C6A0;
    --lavender-mist: #C5B8E8;
    --cream-vellum: #FAF5EE;
    --blush-cloud: #FFF0F3;
    --antique-brass: #8B7355;
    --gold-light: #E8D5A0;
    --gold-accent: #B89A5C;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.005em;
    color: var(--warm-umber);
    background-color: var(--cream-vellum);
    overflow-x: hidden;

    /* Grid-line coordinate background */
    background-image:
        /* Vellum texture - subtle noise */
        radial-gradient(ellipse at 20% 50%, rgba(232, 213, 160, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(232, 160, 181, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(197, 184, 232, 0.03) 0%, transparent 50%),
        /* Grid lines */
        linear-gradient(to right, rgba(180, 156, 120, 0.12) 0.5px, transparent 0.5px),
        linear-gradient(to bottom, rgba(180, 156, 120, 0.12) 0.5px, transparent 0.5px);
    background-size:
        100% 100%,
        100% 100%,
        100% 100%,
        120px 120px,
        120px 120px;
    background-attachment: fixed;
}

/* --- Typography --- */
h1, h2, h3 {
    font-family: 'Playfair Display', Georgia, serif;
    color: var(--deep-walnut);
    letter-spacing: -0.01em;
    line-height: 1.08;
}

h2 {
    font-size: clamp(2.2rem, 5vw, 4.5rem);
    font-weight: 900;
    margin-bottom: 1.5rem;
}

p {
    margin-bottom: 1.2rem;
}

em {
    font-style: italic;
}

.math-notation {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 0.85em;
    letter-spacing: 0.03em;
    color: var(--antique-brass);
}

/* --- Gold Annotation Symbols --- */
.gold-annotations {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.gold-symbol {
    position: absolute;
    pointer-events: auto;
    transition: transform 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
                filter 200ms ease;
    cursor: default;
    opacity: 0.7;
}

.gold-symbol:hover {
    transform: scale(1.08);
    filter: drop-shadow(0 0 6px rgba(196, 162, 101, 0.5));
}

.gold-symbol-1 {
    top: 15%;
    right: 5%;
    transform: rotate(8deg);
}
.gold-symbol-2 {
    top: 35%;
    left: 3%;
    transform: rotate(-5deg);
}
.gold-symbol-3 {
    top: 55%;
    right: 4%;
    transform: rotate(12deg);
}
.gold-symbol-4 {
    top: 75%;
    left: 5%;
    transform: rotate(-8deg);
}
.gold-symbol-5 {
    top: 90%;
    right: 8%;
    transform: rotate(15deg);
}

/* --- Section Base --- */
.section {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.content-section {
    padding: clamp(2rem, 4vw, 4rem) clamp(1rem, 3vw, 3rem);
}

.content-section .section-inner {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.content-section .section-inner.narrow {
    max-width: 680px;
}

.content-section .section-inner.wide {
    max-width: 960px;
}

/* Probability Cascade: increasing padding as we go down */
#the-question {
    padding-top: clamp(3rem, 5vw, 5rem);
    padding-bottom: clamp(3rem, 5vw, 5rem);
}

#classical-probability {
    padding-top: clamp(3.5rem, 6vw, 6rem);
    padding-bottom: clamp(3.5rem, 6vw, 6rem);
}

#bell-curve {
    padding-top: clamp(4rem, 7vw, 7rem);
    padding-bottom: clamp(4rem, 7vw, 7rem);
}

#bayesian-thinking {
    padding-top: clamp(4.5rem, 7.5vw, 7.5rem);
    padding-bottom: clamp(4.5rem, 7.5vw, 7.5rem);
}

#randomness {
    padding-top: clamp(5rem, 8vw, 8rem);
    padding-bottom: clamp(5rem, 8vw, 8rem);
}

/* Section alignment */
.content-section.centered {
    text-align: center;
}

.content-section.centered p {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}

.content-section.left-aligned {
    text-align: left;
}

/* Section gold rule */
.section-rule {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: var(--burnished-gold);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 600ms ease-out;
}

.section.in-view .section-rule {
    transform: scaleX(1);
}

/* Section probability notation */
.content-section::before {
    content: attr(data-probability);
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--gold-accent);
    letter-spacing: 0.03em;
    z-index: 3;
    opacity: 0;
    transition: opacity 400ms ease;
}

.content-section.in-view::before {
    opacity: 1;
}

/* --- Hero Section --- */
.hero-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    position: relative;
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
}

.hero-curve-container {
    width: clamp(300px, 60vw, 700px);
    margin-bottom: 2rem;
    opacity: 0;
    transition: opacity 600ms ease;
}

.hero-curve-container.visible {
    opacity: 1;
}

.hero-curve-container svg {
    width: 100%;
    height: auto;
    display: block;
}

.curve-draw {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 1.8s ease-out;
}

.hero-curve-container.visible .curve-draw {
    stroke-dashoffset: 0;
}

.hero-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 900;
    font-size: clamp(3rem, 8vw, 6rem);
    color: var(--deep-walnut);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 500ms ease, transform 500ms ease;
}

.hero-title.visible {
    opacity: 1;
    transform: translateY(0);
}

.hero-subtitle {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: var(--warm-umber);
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 500ms ease, transform 500ms ease;
    margin-top: 0.8rem;
}

.hero-subtitle.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Section Headings --- */
.section-heading {
    margin-bottom: 1.5rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms ease, transform 600ms ease;
}

.in-view .section-heading {
    opacity: 1;
    transform: translateY(0);
}

.section-intro {
    font-weight: 300;
    font-size: clamp(1rem, 1.2vw, 1.2rem);
    line-height: 1.8;
    margin-bottom: 2rem;
    max-width: 680px;
    margin-left: auto;
    margin-right: auto;
}

/* --- Blush Cloud Background --- */
.blush-bg {
    background-color: var(--blush-cloud);
}

/* --- Watercolor Motifs --- */
.watercolor-motif {
    margin-bottom: 2rem;
}

.watercolor-curve {
    display: block;
}

.watercolor-curve.interactive {
    cursor: crosshair;
}

.question-motif {
    display: flex;
    justify-content: center;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 800ms ease, transform 800ms ease;
}

.in-view .question-motif {
    opacity: 1;
    transform: scale(1);
}

/* --- Section Body with Visual --- */
.section-body-with-visual {
    display: flex;
    gap: clamp(2rem, 4vw, 4rem);
    align-items: flex-start;
}

.section-text {
    flex: 1;
    min-width: 0;
}

.pascal-triangle-container {
    flex: 0 0 auto;
    width: clamp(200px, 30vw, 400px);
}

.pascal-triangle-container svg {
    width: 100%;
    height: auto;
}

.bayesian-visual-container {
    flex: 0 0 auto;
    width: clamp(250px, 35vw, 500px);
}

.bayesian-visual-container svg {
    width: 100%;
    height: auto;
}

/* --- Interactive Bell Curve --- */
.interactive-curve-container {
    width: 100%;
    max-width: 900px;
    margin: 2rem auto 0;
}

.interactive-curve-container svg {
    width: 100%;
    height: auto;
    display: block;
}

/* --- Randomness Canvas --- */
.full-viewport {
    min-height: 100vh;
}

.randomness-canvas-container {
    position: relative;
    max-width: 900px;
    margin: 2rem auto 0;
}

.randomness-canvas-container canvas {
    width: 100%;
    height: auto;
    display: block;
}

.distribution-label {
    text-align: center;
    margin-top: 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--antique-brass);
}

/* --- Probability Dots --- */
.probability-dots {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.probability-dot {
    position: absolute;
    border-radius: 50%;
    opacity: 0;
    transform: scale(0);
    transition: transform 400ms cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 400ms ease;
}

.probability-dot.visible {
    opacity: var(--dot-opacity, 0.25);
    transform: scale(1);
}

/* --- Footer --- */
.site-footer {
    position: relative;
    padding: clamp(4rem, 8vw, 8rem) 2rem;
    text-align: center;
    /* Fade grid at bottom */
    background: linear-gradient(to bottom,
        transparent 0%,
        var(--cream-vellum) 100%
    );
}

.footer-inner {
    position: relative;
    z-index: 2;
}

.footer-text {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    color: var(--deep-walnut);
    margin-bottom: 0.5rem;
}

.footer-notation {
    font-size: 0.85rem;
    margin-bottom: 0;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .section-body-with-visual {
        flex-direction: column;
    }

    .pascal-triangle-container,
    .bayesian-visual-container {
        width: 100%;
        max-width: 400px;
        margin: 2rem auto 0;
    }

    .gold-annotations {
        display: none;
    }

    .content-section::before {
        font-size: 0.6rem;
        top: 0.5rem;
        right: 0.8rem;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: clamp(2.5rem, 12vw, 4rem);
    }

    .hero-subtitle {
        font-size: clamp(0.9rem, 3.5vw, 1.1rem);
    }

    .content-section .section-inner {
        max-width: 100%;
    }
}

/* --- Curve label styles (Bayesian) --- */
.curve-label {
    opacity: 0.7;
}
