/* ============================================
   continu.ax — Styles
   Chrome-metallic precision instrument aesthetic
   ============================================ */

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: #0a0e16;
    color: #e2e6ec;
    font-family: 'Libre Baskerville', serif;
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    font-weight: 400;
    line-height: 1.85;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Perspective Grid Background --- */
/* Palette ref: grid lines #1a1f2a, axis stroke #c0c8d4 */
#perspective-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    perspective: 1200px;
    overflow: hidden;
    color: #1a1f2a;
}

#grid-svg {
    width: 140%;
    height: 140%;
    position: absolute;
    top: -20%;
    left: -20%;
    opacity: 0.2;
    transform: rotateX(60deg);
    transform-origin: center center;
    transition: transform 0.1s linear;
}

/* --- The Axis Spine --- */
#axis-container {
    position: fixed;
    top: 50vh;
    left: 0;
    width: 100vw;
    height: 40px;
    transform: translateY(-50%);
    z-index: 10;
    pointer-events: none;
    opacity: 0;
    color: #c0c8d4;
}

#axis-container.visible {
    opacity: 1;
}

#axis-svg {
    width: 100%;
    height: 40px;
    display: block;
}

#axis-line {
    transition: all 1.2s ease-in-out;
}

#axis-line.drawn {
    x1: 0;
    x2: 2000;
}

/* Origin Diamond Marker */
#origin-marker {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    filter: drop-shadow(0 0 8px rgba(77, 184, 255, 0.5));
    transition: opacity 0.3s ease;
    z-index: 11;
}

#origin-marker.visible {
    opacity: 1;
    animation: originPulse 2s ease-in-out infinite;
}

@keyframes originPulse {
    0%, 100% { filter: drop-shadow(0 0 8px rgba(77, 184, 255, 0.5)); }
    50% { filter: drop-shadow(0 0 16px rgba(77, 184, 255, 0.8)); }
}

/* Tick Marks */
.tick-mark {
    transition: all 0.4s ease-out;
}

.tick-mark.active line {
    stroke: #4db8ff;
}

/* --- Coordinate Readout --- */
#coordinate-readout {
    position: fixed;
    top: 24px;
    right: 32px;
    z-index: 100;
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.7rem, 1.2vw, 0.85rem);
    font-weight: 400;
    letter-spacing: 0.08em;
    color: #8a96a8;
    cursor: pointer;
    pointer-events: auto;
    opacity: 0;
    transition: opacity 0.3s ease, color 0.3s ease;
    font-variant-numeric: tabular-nums;
    user-select: none;
}

#coordinate-readout.visible {
    opacity: 1;
}

#coordinate-readout:hover {
    color: #4db8ff;
}

#coordinate-readout.pulse {
    color: #c8d4e0;
}

/* --- Navigation Overlay --- */
#nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 14, 22, 0.92);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

#nav-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

#nav-list {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 24px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.nav-item:hover {
    opacity: 1;
}

.nav-coord {
    font-family: 'Share Tech Mono', monospace;
    font-size: 13px;
    color: #5e6a7a;
    letter-spacing: 0.08em;
    min-width: 100px;
    font-variant-numeric: tabular-nums;
}

.nav-label {
    font-family: 'Didact Gothic', sans-serif;
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: #e2e6ec;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* --- Main Content Area --- */
#content-area {
    position: relative;
    z-index: 5;
    padding-top: 60vh;
    padding-bottom: 40vh;
}

/* --- Content Modules --- */
.content-module {
    width: 60vw;
    max-width: 800px;
    margin: 0 auto;
    margin-bottom: 20vh;
    position: relative;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.content-module.revealed {
    opacity: 1;
    transform: translateY(0);
}

.content-module[data-offset="left"] {
    margin-left: calc(50% - 30vw - 3vw);
    margin-right: auto;
}

.content-module[data-offset="right"] {
    margin-left: auto;
    margin-right: calc(50% - 30vw - 3vw);
}

/* Module inner with precision engraving borders */
.module-inner {
    border: 1px solid #2a3040;
    box-shadow: inset 0 0 0 4px #0a0e16, inset 0 0 0 5px #1a2030, inset 0 0 40px rgba(10, 14, 22, 0.6);
    padding: 48px 40px;
    background: #111720;
    position: relative;
    transition: border-color 0.4s ease, box-shadow 0.4s ease, transform 0.3s ease;
}

.content-module.registered .module-inner {
    border-color: #4db8ff;
}

.content-module:hover .module-inner {
    border-color: #2a7abf;
    transform: translateY(-2px);
    box-shadow: inset 0 0 0 4px #0a0e16, inset 0 0 0 5px #1a2030, inset 0 0 40px rgba(10, 14, 22, 0.6), 0 4px 20px rgba(77, 184, 255, 0.08);
}

/* Module annotation */
.module-annotation {
    position: absolute;
    top: -4px;
    right: -60px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
    color: #5e6a7a;
    letter-spacing: 0.08em;
    font-variant-numeric: tabular-nums;
    opacity: 0;
    transition: opacity 0.3s ease 0.2s;
}

.content-module.revealed .module-annotation {
    opacity: 1;
}

/* Module heading */
.module-heading {
    font-family: 'Didact Gothic', sans-serif;
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #e2e6ec;
    text-shadow: 0 0 20px rgba(160, 180, 210, 0.15);
    margin-bottom: 28px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.content-module.revealed .module-heading {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.15s;
}

/* Module body text */
.module-body {
    font-family: 'Libre Baskerville', serif;
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    font-weight: 400;
    line-height: 1.85;
    letter-spacing: 0.01em;
    color: #9ca8b8;
    margin-bottom: 20px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.module-body:last-child {
    margin-bottom: 0;
}

.content-module.revealed .module-body {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.3s;
}

.content-module.revealed .module-body:nth-child(3) {
    transition-delay: 0.45s;
}

/* Dimension lines (hover) */
.dimension-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

.dim-line {
    opacity: 0;
    stroke: #2a3040;
    transition: opacity 0.3s ease;
}

.content-module:hover .dim-line {
    opacity: 1;
    stroke-dashoffset: 0;
}

/* --- Compressed Modules (approaching the limit) --- */
.module-compressed {
    margin-bottom: 14vh;
}

.module-compressed .module-inner {
    padding: 36px 32px;
}

.module-compressed-2 {
    margin-bottom: 8vh;
    transform: scale(0.9) translateY(20px);
}

.module-compressed-2.revealed {
    transform: scale(0.9) translateY(0);
}

.module-compressed-2 .module-inner {
    padding: 28px 24px;
}

.module-compressed-3 {
    margin-bottom: 4vh;
    transform: scale(0.8) translateY(20px);
}

.module-compressed-3.revealed {
    transform: scale(0.8) translateY(0);
}

.module-compressed-3 .module-inner {
    padding: 20px 20px;
}

/* --- The Ellipsis --- */
#ellipsis-marker {
    text-align: center;
    padding: 40px 0 60px;
    font-family: 'Libre Baskerville', serif;
    font-style: italic;
    font-size: 2rem;
    color: #5e6a7a;
    letter-spacing: 0.3em;
    opacity: 0;
    transition: opacity 0.8s ease;
}

#ellipsis-marker.visible {
    opacity: 1;
}

/* --- Opening animation overlay --- */
#body-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #0a0e16;
    z-index: 1000;
    pointer-events: none;
    transition: opacity 0.8s ease;
}

#body-overlay.hidden {
    opacity: 0;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .content-module {
        width: 85vw;
    }

    .content-module[data-offset="left"],
    .content-module[data-offset="right"] {
        margin-left: auto;
        margin-right: auto;
    }

    .module-inner {
        padding: 32px 24px;
    }

    .module-annotation {
        right: 0;
        top: -18px;
    }

    #coordinate-readout {
        top: 16px;
        right: 16px;
    }
}

@media (max-width: 480px) {
    .content-module {
        width: 92vw;
    }

    .module-inner {
        padding: 24px 18px;
    }

    .module-heading {
        letter-spacing: 0.06em;
    }
}
