/* kakuritsu.com — Seapunk Scholarly Probability */

:root {
    --coral-terracotta: #c4786a;
    --probability-teal: #00d2d3;
    --parchment-sand: #d8d0c2;
    --abyssal-sage: #6b8f8e;
    --slate-carbon: #2b2d31;
    --bioluminescent-green: #a3d9a5;
    --abyssal-ink: #0a1628;
    --bleached-shell: #e8e2d6;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--abyssal-ink);
    color: var(--parchment-sand);
    font-family: 'Source Serif 4', serif;
    font-size: 16px;
    line-height: 1.6;
    overflow-x: hidden;
}

/* === SUBMERSION OPENING === */
.submersion {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--abyssal-ink);
    overflow: hidden;
}

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

.typewriter {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: var(--probability-teal);
    letter-spacing: 0.05em;
    min-height: 2em;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.typewriter.visible {
    opacity: 1;
}

.typewriter .cursor {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background: var(--probability-teal);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

.scroll-indicator {
    margin-top: 4rem;
    opacity: 0;
    transition: opacity 1s ease 3s;
    color: var(--abyssal-sage);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.scroll-indicator.visible {
    opacity: 1;
}

.scroll-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.scroll-arrow {
    animation: float 2s ease-in-out infinite;
}

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

/* Bioluminescent Particles */
.bioluminescent-particles {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.particle {
    position: absolute;
    border-radius: 50%;
    animation: drift linear infinite;
    opacity: 0;
}

@keyframes drift {
    0% { transform: translateY(100vh) translateX(0); opacity: 0; }
    10% { opacity: 0.8; }
    90% { opacity: 0.6; }
    100% { transform: translateY(-20vh) translateX(30px); opacity: 0; }
}

/* === MAIN MATRIX === */
.matrix {
    padding: 4rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.matrix-header {
    text-align: center;
    margin-bottom: 4rem;
    padding: 2rem 0;
}

.site-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 600;
    font-size: clamp(3rem, 8vw, 6rem);
    color: var(--probability-teal);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.site-subtitle {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: clamp(0.7rem, 1.2vw, 0.9rem);
    color: var(--abyssal-sage);
    letter-spacing: 0.15em;
}

/* === BENTO GRID === */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1rem;
    margin-bottom: 4rem;
}

.bento-cell {
    background: rgba(43, 45, 49, 0.6);
    border: 1px solid rgba(0, 210, 211, 0.15);
    border-radius: 4px;
    padding: 2rem;
    position: relative;
    overflow: hidden;
    transition: border-color 0.4s ease, transform 0.3s ease;
}

.bento-cell:hover {
    border-color: rgba(0, 210, 211, 0.4);
    transform: translateY(-2px);
}

.bento-cell::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--probability-teal), transparent);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.bento-cell:hover::before {
    opacity: 0.6;
}

/* Cell sizing */
.cell-theorem { grid-column: span 6; }
.cell-image { grid-column: span 6; grid-row: span 2; min-height: 300px; }
.cell-definition { grid-column: span 4; }
.cell-viz { grid-column: span 8; min-height: 250px; }
.cell-quote { grid-column: span 5; }
.cell-wide { grid-column: span 7; }
.cell-data { grid-column: span 3; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.cell-coral { grid-column: span 4; min-height: 200px; display: flex; align-items: center; justify-content: center; }
.cell-tall { grid-column: span 5; grid-row: span 2; }
.cell-ambient { grid-column: span 4; }

/* Cell content styles */
.cell-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.2em;
    color: var(--coral-terracotta);
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.75rem;
}

.cell-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 600;
    font-size: clamp(1.4rem, 2.5vw, 2.2rem);
    color: var(--bleached-shell);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.cell-body {
    font-family: 'Source Serif 4', serif;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--parchment-sand);
    opacity: 0.85;
}

/* Formula */
.formula {
    background: rgba(10, 22, 40, 0.8);
    border-left: 2px solid var(--probability-teal);
    padding: 1rem 1.5rem;
    margin: 1rem 0;
    border-radius: 0 4px 4px 0;
}

.formula-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1.1rem;
    color: var(--probability-teal);
    letter-spacing: 0.02em;
}

/* Duotone Image */
.duotone-container {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.duotone-base {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--abyssal-ink) 0%, var(--slate-carbon) 50%, var(--abyssal-ink) 100%);
    background-size: 200% 200%;
    animation: shimmer 8s ease-in-out infinite;
}

.duotone-overlay {
    position: absolute;
    inset: 0;
    background: var(--probability-teal);
    mix-blend-mode: overlay;
    opacity: 0.3;
}

@keyframes shimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.image-caption {
    position: absolute;
    bottom: 1rem;
    left: 1.5rem;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    color: var(--probability-teal);
    letter-spacing: 0.1em;
    z-index: 2;
}

/* Quote */
.cell-quote blockquote {
    border: none;
    padding: 0;
}

.cell-quote blockquote p {
    font-family: 'Source Serif 4', serif;
    font-style: italic;
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--bleached-shell);
    margin-bottom: 1rem;
}

.cell-quote cite {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: var(--abyssal-sage);
    letter-spacing: 0.05em;
}

/* Data Cell */
.data-value {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 2.5rem;
    color: var(--bioluminescent-green);
    font-weight: 300;
}

.data-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.6rem;
    color: var(--abyssal-sage);
    letter-spacing: 0.15em;
    margin-top: 0.5rem;
}

/* Coral SVG */
.coral-svg {
    width: 80%;
    max-width: 160px;
    height: auto;
}

.coral-path {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    animation: drawCoral 4s ease forwards;
}

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

.biolum-dot {
    animation: pulse 3s ease-in-out infinite;
}

.biolum-dot:nth-child(2) { animation-delay: 0.5s; }
.biolum-dot:nth-child(3) { animation-delay: 1s; }
.biolum-dot:nth-child(4) { animation-delay: 1.5s; }
.biolum-dot:nth-child(5) { animation-delay: 2s; }

@keyframes pulse {
    0%, 100% { opacity: 0.3; r: 2; }
    50% { opacity: 1; r: 4; }
}

/* Viz Canvas */
#probability-canvas {
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
}

.cell-viz {
    position: relative;
}

.viz-label {
    position: absolute;
    bottom: 1rem;
    right: 1.5rem;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.6rem;
    color: var(--abyssal-sage);
    letter-spacing: 0.15em;
    z-index: 2;
}

/* Depth Marker */
.depth-marker {
    margin-top: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.depth-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--probability-teal), transparent);
}

.depth-value {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    color: var(--probability-teal);
    letter-spacing: 0.1em;
}

/* Ambient Readings */
.ambient-readings {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.reading {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(107, 143, 142, 0.2);
}

.reading-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.6rem;
    color: var(--abyssal-sage);
    letter-spacing: 0.15em;
}

.reading-value {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    color: var(--bioluminescent-green);
}

/* === FOOTER === */
.matrix-footer {
    text-align: center;
    padding: 3rem 0;
}

.footer-line {
    width: 60px;
    height: 1px;
    background: var(--abyssal-sage);
    margin: 0 auto 2rem;
}

.footer-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: var(--abyssal-sage);
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

.footer-note {
    font-family: 'Source Serif 4', serif;
    font-style: italic;
    font-size: 0.8rem;
    color: rgba(107, 143, 142, 0.6);
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .bento-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .bento-cell,
    .cell-theorem,
    .cell-image,
    .cell-definition,
    .cell-viz,
    .cell-quote,
    .cell-wide,
    .cell-data,
    .cell-coral,
    .cell-tall,
    .cell-ambient {
        grid-column: span 1;
        grid-row: span 1;
    }

    .matrix {
        padding: 2rem 1rem;
    }
}
