/* kakuritsu.com - Probability Design System */
/* Colors: #7A6B5D #E8943A #1C1410 #C4923A #D4652A #5C3D2E #2A1F18 #FFFFFF */
/* Fonts: Playfair Display, Source Sans 3, Space Mono */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: "Source Sans 3", sans-serif;
    font-weight: 400;
    color: #E8DCC8;
    background-color: #1C1410;
    line-height: 1.6;
    overflow-x: hidden;
}

/* ===== HERO SECTION ===== */
.hero-section {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #1C1410;
    overflow: hidden;
}

.hero-candle-glow {
    position: absolute;
    top: 35%;
    left: 55%;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(232,148,58,0.08) 0%, rgba(232,148,58,0) 70%);
    transform: translate(-50%, -50%);
    animation: glowPulse 4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes glowPulse {
    0%, 100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.7; transform: translate(-50%, -50%) scale(1.05); }
}

.hero-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.hero-desk-svg {
    width: 60%;
    max-width: 700px;
    height: auto;
    opacity: 0;
    animation: fadeInUp 1.5s ease forwards;
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.hero-text {
    position: absolute;
    bottom: 20%;
    text-align: center;
    z-index: 2;
}

.hero-title {
    font-family: "Playfair Display", serif;
    font-style: italic;
    font-weight: 400;
    font-size: 64px;
    color: #FFFFFF;
    letter-spacing: -0.01em;
    line-height: 1.1;
    opacity: 0;
    animation: fadeInUp 1.2s ease 0.3s forwards;
}

.hero-subtitle {
    font-family: "Source Sans 3", sans-serif;
    font-weight: 300;
    font-size: 20px;
    color: #7A6B5D;
    margin-top: 12px;
    opacity: 0;
    animation: fadeIn 1s ease 1.5s forwards;
}

.scroll-indicator {
    position: absolute;
    bottom: 40px;
    opacity: 0;
    animation: fadeIn 1s ease 2.5s forwards, bounce 2s ease-in-out 3s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(8px); }
}

/* ===== BENTO GRID SECTION ===== */
.bento-section {
    padding: 80px 40px;
    background-color: #1C1410;
}

.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Cell sizing */
.cell-concept { grid-column: span 2; grid-row: span 2; }
.cell-dice { grid-column: span 1; grid-row: span 1; }
.cell-bayes { grid-column: span 1; grid-row: span 1; }
.cell-urn { grid-column: span 1; grid-row: span 2; }
.cell-tree { grid-column: span 2; grid-row: span 1; }
.cell-quote { grid-column: span 1; grid-row: span 1; }
.cell-distribution { grid-column: span 2; grid-row: span 1; }
.cell-law { grid-column: span 1; grid-row: span 1; }
.cell-history { grid-column: span 3; grid-row: span 1; }
.cell-random-walk { grid-column: span 2; grid-row: span 2; }
.cell-expected { grid-column: span 1; grid-row: span 1; }
.cell-coin { grid-column: span 1; grid-row: span 1; }

.bento-cell {
    background-color: #2A1F18;
    border: 1px solid #5C3D2E;
    border-radius: 2px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
}

.bento-cell.revealed {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.bento-cell:hover {
    border-color: #C4923A;
    box-shadow: 0 0 20px rgba(232,148,58,0.08);
    transform: translateY(-2px);
}

.bento-cell.revealed:hover {
    transform: translateY(-2px);
}

.cell-inner {
    padding: 24px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* ===== CELL TYPOGRAPHY ===== */
.cell-label {
    font-family: "Space Mono", monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #C4923A;
    display: block;
    margin-bottom: 8px;
}

.cell-title {
    font-family: "Playfair Display", serif;
    font-style: italic;
    font-weight: 400;
    font-size: 32px;
    color: #FFFFFF;
    letter-spacing: -0.01em;
    line-height: 1.1;
    margin-bottom: 12px;
}

.cell-subtitle {
    font-family: "Playfair Display", serif;
    font-style: italic;
    font-weight: 400;
    font-size: 22px;
    color: #FFFFFF;
    letter-spacing: -0.01em;
    line-height: 1.2;
    margin-bottom: 10px;
}

.cell-body {
    font-family: "Source Sans 3", sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.6;
    color: #F0E6D3;
    opacity: 0.85;
}

.cell-body-small {
    font-family: "Source Sans 3", sans-serif;
    font-weight: 400;
    font-size: 14px;
    line-height: 1.5;
    color: #7A6B5D;
    margin-top: 8px;
}

/* ===== FORMULA STYLES ===== */
.cell-formula,
.bayes-formula,
.expected-formula {
    margin-top: 16px;
}

.formula,
.formula-large {
    font-family: "Playfair Display", serif;
    font-style: italic;
    color: #E8943A;
}

.formula {
    font-size: 22px;
}

.formula-large {
    font-size: 28px;
}

.formula-frac {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    vertical-align: middle;
    margin: 0 4px;
}

.frac-num,
.frac-den {
    font-size: 0.75em;
    line-height: 1.2;
    padding: 0 4px;
}

.frac-line {
    width: 100%;
    height: 1px;
    background-color: #E8943A;
    display: block;
}

/* ===== DICE CELL ===== */
.dice-interactive {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    cursor: pointer;
    gap: 12px;
}

.cell-icon-svg {
    width: 80px;
    height: 80px;
    transition: transform 0.3s ease;
}

.dice-interactive:hover .cell-icon-svg {
    transform: rotate(15deg) scale(1.05);
}

.dice-result {
    font-family: "Space Mono", monospace;
    font-size: 14px;
    color: #C4923A;
}

/* ===== URN CELL ===== */
.urn-visual {
    display: flex;
    justify-content: center;
    margin: 12px 0;
}

.urn-svg {
    width: 100px;
    height: 120px;
}

.urn-sphere {
    transition: opacity 0.4s ease, transform 0.4s ease;
    cursor: pointer;
}

/* ===== TREE CELL ===== */
.tree-svg {
    width: 100%;
    height: auto;
}

/* ===== QUOTE CELL ===== */
.cell-blockquote {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
}

.cell-blockquote p {
    font-family: "Playfair Display", serif;
    font-style: italic;
    font-size: 20px;
    color: #E8DCC8;
    line-height: 1.4;
    margin-bottom: 12px;
}

.cell-blockquote cite {
    font-family: "Source Sans 3", sans-serif;
    font-style: normal;
    font-size: 14px;
    color: #7A6B5D;
}

/* ===== BELL CURVE CELL ===== */
.bell-svg {
    width: 100%;
    height: auto;
}

.bell-curve-path {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    animation: drawBell 2s ease forwards;
    animation-play-state: paused;
}

.cell-distribution.revealed .bell-curve-path {
    animation-play-state: running;
}

@keyframes drawBell {
    to { stroke-dashoffset: 0; }
}

/* ===== CONVERGENCE METER ===== */
.convergence-meter {
    margin-top: 16px;
    position: relative;
    width: 100%;
    height: 6px;
    background-color: #1C1410;
    border-radius: 3px;
    overflow: hidden;
}

.convergence-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #D4652A, #E8943A, #C4923A);
    border-radius: 3px;
    transition: width 2s ease;
}

.cell-law.revealed .convergence-bar {
    width: 85%;
}

.convergence-label {
    font-family: "Space Mono", monospace;
    font-size: 11px;
    color: #7A6B5D;
    position: absolute;
    right: 0;
    top: 12px;
}

/* ===== RANDOM WALK CELL ===== */
#randomWalkCanvas {
    width: 100%;
    height: 200px;
    cursor: pointer;
    border-radius: 2px;
}

/* ===== COIN FLIP CELL ===== */
.coin-flip {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 12px;
    cursor: pointer;
}

.coin {
    width: 60px;
    height: 60px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s ease;
}

.coin.flipping {
    animation: coinSpin 0.6s ease;
}

@keyframes coinSpin {
    0% { transform: rotateX(0deg); }
    100% { transform: rotateX(720deg); }
}

.coin-face {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Playfair Display", serif;
    font-size: 24px;
    font-weight: 700;
    backface-visibility: hidden;
}

.coin-heads {
    background-color: #C4923A;
    color: #1C1410;
}

.coin-tails {
    background-color: #7A6B5D;
    color: #1C1410;
    transform: rotateX(180deg);
}

.coin.show-tails {
    transform: rotateX(180deg);
}

.coin-stats {
    font-family: "Space Mono", monospace;
    font-size: 13px;
    color: #7A6B5D;
}

/* ===== FOOTER ===== */
.site-footer {
    padding: 60px 40px;
    background-color: #1C1410;
    border-top: 1px solid #5C3D2E;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.footer-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 12px;
}

.footer-logo {
    font-family: "Playfair Display", serif;
    font-size: 28px;
    color: #C4923A;
}

.footer-domain {
    font-family: "Space Mono", monospace;
    font-size: 14px;
    color: #7A6B5D;
    letter-spacing: 0.05em;
}

.footer-tagline {
    font-family: "Source Sans 3", sans-serif;
    font-weight: 300;
    font-size: 16px;
    color: #5C3D2E;
    margin-bottom: 20px;
}

.footer-decoration {
    display: flex;
    justify-content: center;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .cell-concept { grid-column: span 2; grid-row: span 1; }
    .cell-bayes { grid-column: span 2; }
    .cell-history { grid-column: span 2; }
    .cell-random-walk { grid-column: span 2; grid-row: span 1; }
    .cell-distribution { grid-column: span 2; }
    .cell-tree { grid-column: span 2; }
    .cell-urn { grid-column: span 1; grid-row: span 1; }
    .hero-title { font-size: 48px; }
    .hero-desk-svg { width: 80%; }
}

@media (max-width: 600px) {
    .bento-grid {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    .cell-concept,
    .cell-bayes,
    .cell-history,
    .cell-random-walk,
    .cell-distribution,
    .cell-tree { grid-column: span 1; }
    .bento-section { padding: 40px 16px; }
    .hero-title { font-size: 36px; }
    .hero-desk-svg { width: 95%; }
    .cell-title { font-size: 26px; }
    .formula-large { font-size: 22px; }
}
