/* graphers.net - Maximalist Aquatic Cartography */

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

:root {
    --abyss: #0B1628;
    --deep-water: #1A3A5C;
    --mid-water: #2E6B8A;
    --surface-light: #3ED8C3;
    --bubble-highlight: #A0F0E8;
    --prismatic-1: #FF6B8A;
    --prismatic-2: #F5A623;
    --prismatic-3: #9B59B6;
    --text-primary: #E8F4F0;
    --text-muted: #7A9BAE;
    --grid-rule: rgba(255,255,255,0.12);
}

body {
    font-family: 'Albert Sans', sans-serif;
    background: var(--abyss);
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.6;
}

/* Fixed Margin Annotations */
.margin-left {
    position: fixed;
    left: 0;
    top: 0;
    width: 40px;
    height: 100%;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.margin-left .annotation {
    position: absolute;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-family: 'Albert Sans', sans-serif;
    font-weight: 300;
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    opacity: 0;
    transition: opacity 1200ms ease;
    white-space: nowrap;
}

.margin-left .annotation.active {
    opacity: 0.5;
}

.margin-right {
    position: fixed;
    right: 0;
    top: 0;
    width: 40px;
    height: 100%;
    z-index: 50;
    overflow: hidden;
    pointer-events: none;
}

.num-seq {
    position: absolute;
    writing-mode: vertical-rl;
    font-family: 'Albert Sans', sans-serif;
    font-weight: 300;
    font-size: 0.65rem;
    color: var(--text-muted);
    opacity: 0.3;
    letter-spacing: 0.15em;
    animation: scrollNum 60s linear infinite;
    white-space: nowrap;
}

@keyframes scrollNum {
    0% { transform: translateY(100%); }
    100% { transform: translateY(-100%); }
}

/* Acts */
.act {
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* Act I: Submersion */
.act-submersion {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, var(--abyss) 0%, var(--deep-water) 40%, var(--mid-water) 100%);
}

.bubble-field {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.03), rgba(255,255,255,0.12));
    border: 1px solid rgba(160,240,232,0.25);
    will-change: transform, opacity;
}

.bubble-highlight {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
}

.hero-content {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 0 60px;
}

.hero-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(3rem, 9vw, 7.5rem);
    color: var(--text-primary);
    letter-spacing: -0.01em;
    line-height: 1.1;
    min-height: 1.2em;
}

.hero-title .char {
    display: inline-block;
    opacity: 0;
    transform: scale(1.3);
    transition: opacity 200ms ease, transform 300ms ease;
}

.hero-title .char.visible {
    opacity: 1;
    transform: scale(1);
}

.hero-axis {
    width: 0;
    height: 1px;
    background: var(--grid-rule);
    margin: 24px auto;
    transition: width 2s ease;
}

.hero-axis.extended {
    width: min(80%, 500px);
}

.hero-subtitle {
    font-family: 'Albert Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(0.875rem, 1.2vw, 1.1rem);
    color: var(--text-muted);
    letter-spacing: 0.15em;
    opacity: 0;
    transition: opacity 1200ms ease;
}

.hero-subtitle.visible {
    opacity: 1;
}

/* Act II: Archive */
.act-archive {
    padding: 80px 60px;
    background: var(--abyss);
    background-image: radial-gradient(ellipse at 30% 70%, rgba(62,216,195,0.08), transparent 60%);
    position: relative;
}

/* Refraction light streaks */
.act-archive::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(28deg, rgba(255,255,255,0.04) 0%, transparent 40%),
        linear-gradient(33deg, transparent 50%, rgba(255,255,255,0.03) 70%, transparent 90%);
    pointer-events: none;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-auto-flow: dense;
    gap: 6px;
    max-width: 1200px;
    margin: 0 auto;
}

.grid-cell {
    background: rgba(26,58,92,0.4);
    border: 1px solid var(--grid-rule);
    padding: 20px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 160px;
    transition: filter 200ms ease;
}

.grid-cell:hover {
    filter: brightness(1.1);
}

/* Grid cell sizes */
.cell-1x1 { grid-column: span 1; grid-row: span 1; }
.cell-2x1 { grid-column: span 2; grid-row: span 1; }
.cell-1x2 { grid-column: span 1; grid-row: span 2; }
.cell-2x2 { grid-column: span 2; grid-row: span 2; min-height: 340px; }

/* Depth layers */
.depth-1 {
    transform: translateZ(0);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 3;
}

.depth-2 {
    transform: translateZ(0);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    z-index: 2;
    background: rgba(26,58,92,0.3);
}

.depth-3 {
    transform: translateZ(0);
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    z-index: 1;
    background: rgba(26,58,92,0.2);
}

/* Gradient cells (bubble vignettes) */
.gradient-cell {
    background: radial-gradient(ellipse at 50% 80%, rgba(62,216,195,0.06), transparent 70%);
    border-color: transparent;
}

/* Dancheong border */
.dancheong-border {
    border-image: linear-gradient(135deg, var(--prismatic-1), var(--prismatic-2), var(--surface-light), var(--prismatic-3)) 1;
    border-width: 2px;
    border-style: solid;
}

/* Prismatic hover border */
.grid-cell::after {
    content: '';
    position: absolute;
    inset: -1px;
    border: 2px solid transparent;
    border-image: linear-gradient(135deg, var(--prismatic-1) 0%, var(--prismatic-2) 33%, var(--surface-light) 66%, var(--prismatic-3) 100%) 1;
    opacity: 0;
    transition: opacity 200ms ease;
    pointer-events: none;
}

.grid-cell:hover::after {
    opacity: 1;
}

/* Cell reveal animation */
.reveal-cell {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: opacity 400ms ease, transform 400ms ease;
    transition-delay: var(--stagger, 0ms);
}

.reveal-cell.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Cell content */
.cell-heading {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: clamp(1rem, 2vw, 1.75rem);
    color: var(--text-primary);
    letter-spacing: -0.01em;
    line-height: 1.1;
    margin-top: 12px;
    position: relative;
    z-index: 2;
}

.cell-body {
    font-family: 'Albert Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.875rem, 1.2vw, 1.1rem);
    color: var(--text-muted);
    line-height: 1.6;
    margin-top: 8px;
    position: relative;
    z-index: 2;
}

.cell-calligraphy {
    font-family: 'Noto Sans', sans-serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 4vw, 3rem);
    color: var(--text-primary);
    opacity: 0.5;
    position: relative;
    z-index: 2;
}

.cell-calligraphy-bg {
    font-family: 'Noto Sans', sans-serif;
    font-weight: 700;
    font-size: clamp(3rem, 6vw, 5rem);
    color: var(--text-primary);
    opacity: 0.08;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    white-space: nowrap;
    z-index: 1;
}

.cell-calligraphy-bg.large-cal {
    font-size: clamp(5rem, 10vw, 9rem);
}

/* Micro graphs */
.micro-graph {
    width: 100%;
    max-height: 80px;
    position: relative;
    z-index: 2;
}

.micro-graph.large-scatter {
    max-height: 200px;
}

.draw-line {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    transition: stroke-dashoffset 1.5s ease;
}

.visible .draw-line {
    stroke-dashoffset: 0;
}

.scatter-dot {
    opacity: 0;
    transform-origin: center;
    transition: opacity 400ms ease, transform 400ms ease;
}

.visible .scatter-dot {
    opacity: 1;
}

.visible .scatter-dot:nth-child(1) { transition-delay: 100ms; }
.visible .scatter-dot:nth-child(2) { transition-delay: 200ms; }
.visible .scatter-dot:nth-child(3) { transition-delay: 300ms; }
.visible .scatter-dot:nth-child(4) { transition-delay: 400ms; }
.visible .scatter-dot:nth-child(5) { transition-delay: 500ms; }
.visible .scatter-dot:nth-child(6) { transition-delay: 600ms; }
.visible .scatter-dot:nth-child(7) { transition-delay: 700ms; }
.visible .scatter-dot:nth-child(8) { transition-delay: 800ms; }

.bar-rise {
    transform: scaleY(0);
    transform-origin: bottom;
    transition: transform 600ms ease;
}

.visible .bar-rise {
    transform: scaleY(1);
}

.visible .bar-rise:nth-child(1) { transition-delay: 50ms; }
.visible .bar-rise:nth-child(2) { transition-delay: 120ms; }
.visible .bar-rise:nth-child(3) { transition-delay: 190ms; }
.visible .bar-rise:nth-child(4) { transition-delay: 260ms; }
.visible .bar-rise:nth-child(5) { transition-delay: 330ms; }
.visible .bar-rise:nth-child(6) { transition-delay: 400ms; }
.visible .bar-rise:nth-child(7) { transition-delay: 470ms; }
.visible .bar-rise:nth-child(8) { transition-delay: 540ms; }

/* Ambient bubbles in grid */
.ambient-bubble {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.02), rgba(255,255,255,0.08));
    border: 1px solid rgba(160,240,232,0.15);
    position: absolute;
    bottom: 20%;
    left: 50%;
    animation: ambientRise 10s ease-in-out infinite;
}

.ambient-bubble--sm {
    width: 14px;
    height: 14px;
    left: 30%;
    animation-delay: 3s;
    animation-duration: 8s;
}

.ambient-bubble--lg {
    width: 50px;
    height: 50px;
    animation-duration: 14s;
}

@keyframes ambientRise {
    0% { transform: translateY(0) translateX(0); opacity: 0.3; }
    50% { transform: translateY(-40px) translateX(8px); opacity: 0.6; }
    100% { transform: translateY(-80px) translateX(-4px); opacity: 0; }
}

/* Act III: Resonance */
.act-resonance {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, var(--deep-water) 0%, var(--abyss) 100%);
    position: relative;
}

.resonance-content {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 0 60px;
    max-width: 800px;
}

.resonance-text {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: var(--text-primary);
    letter-spacing: -0.01em;
    line-height: 1.4;
    min-height: 2em;
}

.resonance-text .char {
    display: inline-block;
    opacity: 0;
    transition: opacity 150ms ease;
}

.resonance-text .char.visible {
    opacity: 1;
}

/* Act IV: Surface */
.act-surface {
    min-height: 100vh;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: linear-gradient(180deg, var(--abyss) 0%, #000000 100%);
    position: relative;
}

.terminal-bubble {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.04), rgba(255,255,255,0.14));
    border: 1px solid rgba(160,240,232,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    bottom: -70px;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    will-change: transform, opacity;
}

.terminal-bubble.rising {
    animation: terminalRise 12s ease-in forwards;
}

.terminal-bubble.popped {
    animation: bubblePop 300ms ease forwards;
}

@keyframes terminalRise {
    0% { bottom: -70px; opacity: 0; }
    5% { opacity: 1; }
    90% { opacity: 1; }
    100% { bottom: calc(100vh + 70px); opacity: 0.8; }
}

@keyframes bubblePop {
    0% { transform: translateX(-50%) scale(1); opacity: 0.8; }
    100% { transform: translateX(-50%) scale(1.3); opacity: 0; }
}

.bubble-label {
    font-family: 'Albert Sans', sans-serif;
    font-size: 6px;
    color: var(--text-muted);
    white-space: nowrap;
    letter-spacing: 0.05em;
}

/* Pop micro-bubbles */
.pop-bubble {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(160,240,232,0.4);
    opacity: 0;
    will-change: transform, opacity;
}

.pop-bubble.burst {
    animation: microBurst 500ms ease-out forwards;
}

@keyframes microBurst {
    0% { opacity: 1; transform: translate(0,0) scale(1); }
    100% { opacity: 0; transform: translate(var(--bx), var(--by)) scale(0.5); }
}

/* Responsive */
@media (max-width: 768px) {
    .margin-left,
    .margin-right {
        display: none;
    }

    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .cell-2x1 { grid-column: span 2; }
    .cell-1x2 { grid-column: span 1; grid-row: span 2; }
    .cell-2x2 { grid-column: span 2; grid-row: span 2; }

    .act-archive {
        padding: 40px 16px;
    }

    .hero-content {
        padding: 0 24px;
    }

    .resonance-content {
        padding: 0 24px;
    }
}
