/* ==========================================================================
   continu.ax — Minimalist mathematical horizontal-scroll experience
   One axis. One line. One direction.
   ========================================================================== */

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

/* ---------- Color & motion tokens ---------- */
:root {
    --void:  #f8f8f8;   /* Continuous White - canvas */
    --axis:  #1a1a1a;   /* Line Black - axis itself, primary text */
    --point: #e63946;   /* Origin Red - points and key markers */
    --label: #457b9d;   /* Coordinate Blue - axis labels, math */
    --ghost: #d4d4d4;   /* Grid Light - faint grid lines */
    --muted: #999999;   /* Approach Gray - text fading toward limit */

    --axis-thickness: 2px;
    --section-width: 80vw;
    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------- Base ---------- */
html,
body {
    height: 100vh;
    overflow: hidden;
    background: var(--void);
    color: var(--axis);
    font-family: 'Libre Franklin', sans-serif;
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    position: relative;
    width: 100vw;
}

/* ---------- The fixed central axis line ---------- */
#axis-line {
    position: fixed;
    top: 50%;
    left: 0;
    width: 100vw;
    height: var(--axis-thickness);
    background: var(--axis);
    transform: translateY(-1px);
    z-index: 10;
    pointer-events: none;
}

/* ---------- Vertical grid (faint coordinate background) ---------- */
#grid-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.grid-line {
    position: absolute;
    top: 0;
    width: 1px;
    height: 100vh;
    background: var(--ghost);
    opacity: 0.3;
}

/* ---------- Tick marks layered on the axis ---------- */
#tick-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 11;
    pointer-events: none;
    overflow: hidden;
}

.tick-mark {
    position: absolute;
    top: calc(50% - 5px);
    width: 1px;
    height: 10px;
    background: var(--axis);
    opacity: 0.35;
}

.tick-mark.major {
    height: 14px;
    top: calc(50% - 7px);
    opacity: 0.55;
}

/* ---------- Negative-infinity label on left edge ---------- */
#neg-infinity {
    position: fixed;
    top: 50%;
    left: 24px;
    transform: translateY(-50%);
    z-index: 14;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    pointer-events: none;
    font-family: 'STIX Two Text', serif;
    color: var(--muted);
    font-size: 0.85rem;
}

#neg-infinity .infinity-arrow {
    font-size: 1.1rem;
    color: var(--label);
    opacity: 0.7;
}

#neg-infinity .infinity-label {
    color: var(--label);
    letter-spacing: 0.04em;
}

/* ---------- Horizontal scroll container ---------- */
#scroll-container {
    position: relative;
    z-index: 5;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    height: 100vh;
    width: 100vw;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    overscroll-behavior-x: contain;
}

#scroll-container::-webkit-scrollbar {
    display: none;
}

/* ---------- Sections positioned along the number line ---------- */
.content-section {
    position: relative;
    flex: 0 0 auto;
    width: var(--section-width);
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.origin-section {
    width: 60vw;
    padding-left: 8vw;
    justify-content: flex-start;
}

.asymptote-section {
    width: 110vw;
}

/* ---------- Coordinate points (the dots on the line) ---------- */
.coordinate-point {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}

.origin-section .coordinate-point {
    left: 8vw;
}

.asymptote-section .coordinate-point {
    left: 30%;
}

.point-dot {
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--point);
    box-shadow: 0 0 0 0 rgba(230, 57, 70, 0);
    transition: box-shadow 600ms var(--ease), transform 600ms var(--ease);
}

.point-dot.pulse {
    box-shadow:
        0 0 0 8px rgba(230, 57, 70, 0.18),
        0 0 0 16px rgba(230, 57, 70, 0.06);
    transform: scale(1.05);
}

.point-label {
    font-family: 'STIX Two Text', serif;
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--label);
    margin-top: 18px;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

/* ---------- Section content blocks ---------- */
.section-content {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    max-width: 460px;
    width: max-content;
    max-width: min(460px, 70vw);
    white-space: normal;
    padding: 0 20px;
    transition: opacity 500ms var(--ease), transform 500ms var(--ease);
}

.section-content.above {
    bottom: calc(50% + 32px);
    text-align: left;
}

.section-content.below {
    top: calc(50% + 32px);
    text-align: left;
}

.origin-section .section-content {
    left: 8vw;
    transform: none;
    bottom: calc(50% + 28px);
    max-width: min(540px, 70vw);
}

.asymptote-section .section-content {
    left: 30%;
    transform: none;
    max-width: min(420px, 60vw);
}

/* ---------- Typography ---------- */
.section-index {
    display: block;
    font-family: 'STIX Two Text', serif;
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--label);
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    opacity: 0.75;
}

.section-content h1,
.site-title {
    font-family: 'Libre Franklin', sans-serif;
    font-weight: 700;
    font-size: clamp(2rem, 4vw, 3.5rem);
    color: var(--axis);
    line-height: 1.05;
    margin-bottom: 0.4rem;
    letter-spacing: -0.025em;
}

.section-content h2 {
    font-family: 'Libre Franklin', sans-serif;
    font-weight: 700;
    font-size: clamp(1.4rem, 2.4vw, 2rem);
    color: var(--axis);
    line-height: 1.15;
    margin-bottom: 0.6rem;
    letter-spacing: -0.015em;
}

.section-content p {
    font-family: 'Libre Franklin', sans-serif;
    font-weight: 400;
    font-size: 1rem;
    color: var(--axis);
    line-height: 1.65;
    margin-bottom: 0.85rem;
    opacity: 0.82;
    max-width: 38ch;
}

.site-subtitle {
    display: block;
    font-family: 'Libre Franklin', sans-serif;
    font-weight: 300;
    font-size: 0.75rem;
    color: var(--muted);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
    opacity: 1;
}

.site-equation {
    margin-top: 1rem;
    font-size: 1rem;
}

.math-notation {
    display: inline-block;
    font-family: 'STIX Two Text', serif;
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--label);
    margin-top: 0.5rem;
    letter-spacing: 0.01em;
}

.math-notation sub,
.math-notation sup {
    font-size: 0.7em;
}

/* ---------- The Asymptote ---------- */
.asymptote-line {
    position: absolute;
    top: 8%;
    right: 22%;
    width: 0;
    height: 84%;
    border-right: 2px dashed var(--point);
    opacity: 0.7;
    z-index: 15;
}

.asymptote-line::after {
    content: 'x = c';
    position: absolute;
    bottom: -28px;
    right: -22px;
    font-family: 'STIX Two Text', serif;
    font-size: 0.85rem;
    color: var(--point);
    opacity: 0.85;
    white-space: nowrap;
}

.asymptote-text {
    transition:
        opacity 200ms var(--ease),
        font-size 200ms var(--ease),
        letter-spacing 200ms var(--ease),
        transform 200ms var(--ease);
    transform-origin: left center;
}

/* ---------- Trailing scroll padding (the unreachable interval) ---------- */
.scroll-padding {
    flex: 0 0 auto;
    width: 90vw;
    height: 100vh;
}

/* ---------- Scroll hint ---------- */
@keyframes drift-right {
    0%, 100% { transform: translateX(0); opacity: 0.45; }
    50%      { transform: translateX(10px); opacity: 0.9; }
}

#scroll-hint {
    position: fixed;
    bottom: 32px;
    right: 32px;
    z-index: 100;
    font-family: 'Libre Franklin', sans-serif;
    font-weight: 300;
    font-size: 0.75rem;
    color: var(--muted);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: opacity 600ms var(--ease);
}

.scroll-hint-arrow {
    display: inline-block;
    font-size: 1rem;
    color: var(--label);
    animation: drift-right 1.6s ease-in-out infinite;
}

/* ---------- Progress readout (current x value) ---------- */
#progress-readout {
    position: fixed;
    top: 28px;
    right: 32px;
    z-index: 100;
    font-family: 'STIX Two Text', serif;
    font-size: 0.85rem;
    color: var(--label);
    letter-spacing: 0.04em;
    display: flex;
    align-items: baseline;
    gap: 8px;
    opacity: 0.85;
    pointer-events: none;
}

.progress-label {
    color: var(--muted);
    font-weight: 300;
}

.progress-value {
    color: var(--axis);
    font-feature-settings: 'tnum' 1;
    min-width: 6ch;
    text-align: right;
}

/* ---------- Domain badge (top-left) ---------- */
#progress-readout::before {
    content: 'continu.ax';
    position: fixed;
    top: 28px;
    left: 32px;
    font-family: 'Libre Franklin', sans-serif;
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--muted);
    opacity: 0.8;
}

/* ---------- Mobile adjustments ---------- */
@media (max-width: 720px) {
    .content-section {
        width: 100vw;
    }
    .origin-section {
        width: 100vw;
        padding-left: 6vw;
    }
    .origin-section .coordinate-point,
    .origin-section .section-content {
        left: 8vw;
    }
    .section-content {
        max-width: min(360px, 86vw);
    }
    #neg-infinity {
        left: 12px;
    }
    #scroll-hint {
        right: 16px;
        bottom: 18px;
    }
    #progress-readout {
        right: 16px;
        top: 18px;
    }
    #progress-readout::before {
        left: 16px;
        top: 18px;
    }
}
