/* continu.ax - Continuous Function Visualization */

:root {
    --continuous-blue: #3A86FF;
    --inflection-violet: #7B2FBE;
    --limit-coral: #FF6B6B;
    --graph-paper-white: #F8FAFC;
    --slate-depth: #0F172A;
    --axis-silver: #E2E8F0;
    --ink-charcoal: #1E293B;
    --label-slate: #64748B;
    --origin-pulse: #3A86FF33;
    --aurora-teal: #06B6D4;
    --spectrum-indigo: #6366F1;
    --grid-size: 40px;
}

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

body {
    background: var(--graph-paper-white);
    color: var(--ink-charcoal);
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    font-size: 1.125rem;
    line-height: 1.7;
    overflow-x: hidden;
}

/* Coordinate Grid */
.coordinate-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background:
        repeating-linear-gradient(
            to right,
            rgba(226, 232, 240, 0.08) 0px,
            rgba(226, 232, 240, 0.08) 0.5px,
            transparent 0.5px,
            transparent var(--grid-size)
        ),
        repeating-linear-gradient(
            to bottom,
            rgba(226, 232, 240, 0.08) 0px,
            rgba(226, 232, 240, 0.08) 0.5px,
            transparent 0.5px,
            transparent var(--grid-size)
        );
    will-change: background-size;
    transition: background-size 200ms ease;
}

.coordinate-grid.dark-mode {
    background:
        repeating-linear-gradient(
            to right,
            rgba(226, 232, 240, 0.03) 0px,
            rgba(226, 232, 240, 0.03) 0.5px,
            transparent 0.5px,
            transparent var(--grid-size)
        ),
        repeating-linear-gradient(
            to bottom,
            rgba(226, 232, 240, 0.03) 0px,
            rgba(226, 232, 240, 0.03) 0.5px,
            transparent 0.5px,
            transparent var(--grid-size)
        );
}

/* Y-Axis */
.y-axis {
    position: fixed;
    left: 64px;
    top: 0;
    width: 1px;
    height: 0;
    background: rgba(58, 134, 255, 0.4);
    z-index: 2;
    transition: height 800ms ease;
}

.y-axis.drawn {
    height: 100vh;
}

/* X-Axis */
.x-axis {
    position: absolute;
    top: 50%;
    left: 0;
    width: 0;
    height: 1px;
    background: rgba(58, 134, 255, 0.4);
    z-index: 2;
    transition: width 600ms ease;
}

.x-axis.drawn {
    width: 100%;
}

/* Main Curve SVG */
.main-curve-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.main-curve {
    stroke-dasharray: 5000;
    stroke-dashoffset: 5000;
    transition: none;
}

.derivative-curve {
    stroke-dasharray: 5000;
    stroke-dashoffset: 5000;
}

/* Origin */
.section-origin {
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    background: var(--graph-paper-white);
}

.origin-point {
    position: relative;
    width: 6px;
    height: 6px;
    margin-bottom: 32px;
}

.origin-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--continuous-blue);
    position: relative;
    z-index: 3;
    opacity: 0;
    transition: opacity 300ms ease;
}

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

.origin-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle, var(--origin-pulse) 0%, transparent 70%);
    opacity: 0;
    animation: none;
}

.origin-glow.pulse {
    animation: originPulse 600ms ease-out forwards;
}

@keyframes originPulse {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.5); }
    100% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
}

/* Site Title */
.site-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 5vw, 5rem);
    letter-spacing: -0.03em;
    color: var(--ink-charcoal);
    margin-bottom: 12px;
}

.title-char {
    display: inline-block;
    opacity: 0;
    transition: opacity 200ms ease;
}

.title-char.visible {
    opacity: 1;
}

.origin-subtitle {
    font-family: 'Outfit', sans-serif;
    font-weight: 300;
    font-size: 1.5rem;
    letter-spacing: 0.01em;
    color: var(--label-slate);
    opacity: 0;
    transition: opacity 600ms ease;
}

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

/* Sections */
.section {
    position: relative;
    min-height: 100vh;
    padding: 80px 100px 80px 100px;
}

.section-light {
    background: var(--graph-paper-white);
    color: var(--ink-charcoal);
}

.section-dark {
    background: var(--slate-depth);
    color: var(--graph-paper-white);
}

/* Section Content */
.section-content {
    max-width: 600px;
    position: relative;
}

.section-content.align-right {
    margin-left: auto;
}

.section-content.section-wide {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.section-heading {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2rem, 4vw, 3.5rem);
    letter-spacing: -0.03em;
    margin-bottom: 24px;
}

.section-dark .section-heading {
    color: var(--graph-paper-white);
}

.section-content p {
    margin-bottom: 20px;
    font-size: 1.125rem;
    line-height: 1.7;
}

.section-dark .section-content p {
    color: rgba(248, 250, 252, 0.85);
}

/* Coordinate Labels */
.coord-label {
    margin-bottom: 16px;
}

.coord-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.875rem;
    letter-spacing: 0.02em;
    color: var(--label-slate);
}

.section-dark .coord-text {
    color: #94A3B8;
}

/* Zoom Focus Animation */
.zoom-focus {
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 400ms cubic-bezier(0.16, 1, 0.3, 1), transform 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

.zoom-focus.visible {
    opacity: 1;
    transform: scale(1);
}

/* Oscillation Cards */
.section-oscillation {
    min-height: 150vh;
    padding: 80px 40px;
}

.oscillation-cards {
    display: flex;
    flex-direction: column;
    gap: 60px;
    max-width: 480px;
    margin: 0 auto;
}

.osc-card {
    padding: 32px;
    background: var(--graph-paper-white);
    border: 1px solid var(--axis-silver);
    border-radius: 4px;
}

.osc-card:nth-child(even) {
    background: var(--slate-depth);
    color: var(--graph-paper-white);
    border-color: rgba(226, 232, 240, 0.1);
}

.osc-card h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
}

.osc-card p {
    font-size: 1rem;
    line-height: 1.7;
}

/* Asymptote Line */
.asymptote-line {
    position: absolute;
    bottom: 40px;
    left: 10%;
    width: 80%;
    height: 1px;
    background: repeating-linear-gradient(
        to right,
        rgba(255, 107, 107, 0.4) 0px,
        rgba(255, 107, 107, 0.4) 8px,
        transparent 8px,
        transparent 16px
    );
}

/* Asymptote / Footer */
.section-asymptote {
    min-height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.footer-content {
    text-align: center;
}

.footer-domain {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.875rem;
    color: var(--label-slate);
    display: block;
    margin-bottom: 8px;
}

.footer-year {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: var(--label-slate);
    opacity: 0.6;
}

/* Tangent Sidebar */
.tangent-sidebar {
    position: fixed;
    right: -200px;
    top: 50%;
    transform: translateY(-50%);
    width: 200px;
    background: rgba(15, 23, 42, 0.95);
    border-left: 1px solid rgba(58, 134, 255, 0.2);
    padding: 20px;
    z-index: 50;
    transition: right 300ms ease;
    border-radius: 4px 0 0 4px;
}

.tangent-sidebar.visible {
    right: 0;
}

.sidebar-label {
    font-family: 'Outfit', sans-serif;
    font-weight: 300;
    font-size: 0.8rem;
    color: #94A3B8;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.sidebar-minimap {
    width: 100%;
    height: 300px;
}

/* Responsive */
@media (max-width: 768px) {
    .section {
        padding: 60px 24px;
    }

    .section-content.align-right {
        margin-left: 0;
    }

    .y-axis {
        left: 20px;
    }

    .tangent-sidebar {
        display: none;
    }

    .oscillation-cards {
        max-width: 100%;
    }
}
