/* simulai.dev - Scandinavian Retro-Futuristic Simulation Codex */

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

html {
    overflow: hidden;
    height: 100%;
}

body {
    font-family: 'Libre Franklin', sans-serif;
    font-weight: 400;
    color: #3d4f5f;
    background: #faf8f4;
    height: 100%;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ===== Running Header ===== */
.running-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: #faf8f4;
    display: flex;
    align-items: center;
    padding: 0 32px;
    z-index: 100;
    border-bottom: 1px solid #e8e2d6;
}

.header-text {
    font-family: 'Source Serif 4', serif;
    font-style: italic;
    font-size: 0.85rem;
    color: #8a7e6b;
    letter-spacing: 0.02em;
}

/* ===== Folio Index Dots ===== */
.folio-index {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
    z-index: 100;
}

.folio-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1.5px solid #c2b393;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.25, 0.1, 0.25, 1.0);
    position: relative;
}

.folio-dot span {
    font-family: 'Source Serif 4', serif;
    font-size: 0.6rem;
    color: #8a7e6b;
    transition: color 0.4s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.folio-dot.active {
    background: #d4885a;
    border-color: #d4885a;
}

.folio-dot.active span {
    color: #faf8f4;
}

.folio-dot:hover {
    border-color: #d4885a;
}

/* ===== Codex Wrapper (Horizontal Scroll) ===== */
.codex-wrapper {
    width: 100%;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    scrollbar-width: none;
    padding-top: 48px;
}

.codex-wrapper::-webkit-scrollbar {
    display: none;
}

.codex {
    display: flex;
    height: 100%;
    width: fit-content;
}

/* ===== Folio Base ===== */
.folio {
    width: 100vw;
    height: calc(100vh - 48px);
    flex-shrink: 0;
    display: flex;
    position: relative;
    scroll-snap-align: start;
    overflow: hidden;
}

.folio-light {
    background: #faf8f4;
}

.folio-warm {
    background: #f0ebe0;
}

.folio-dark {
    background: #2a3a2e;
}

/* ===== Folio Numbers (Watermark) ===== */
.folio-number {
    position: absolute;
    top: 20px;
    right: 40px;
    font-family: 'Source Serif 4', serif;
    font-size: 12vw;
    color: #2c3e50;
    opacity: 0.06;
    pointer-events: none;
    line-height: 1;
    z-index: 1;
}

.folio-number-light {
    color: #faf8f4;
    opacity: 0.08;
}

/* ===== Margin Column ===== */
.margin-column {
    width: 15%;
    min-width: 120px;
    max-width: 200px;
    background: #f7f3ec;
    position: relative;
    flex-shrink: 0;
    border-right: 1px solid #e8e2d6;
    z-index: 2;
}

.margin-dark {
    background: #243029;
    border-right-color: #3d4f3e;
}

.margin-note {
    position: absolute;
    left: 12px;
    right: 12px;
    transform: rotate(-2deg);
}

.margin-text {
    font-family: 'Source Serif 4', serif;
    font-style: italic;
    font-size: 0.78rem;
    line-height: 1.5;
    color: #8a7e6b;
    display: block;
}

.margin-text-light {
    color: #8a7e6b;
}

.margin-diagram {
    position: absolute;
    left: 15px;
    width: 60px;
    height: auto;
}

/* ===== Folio Content ===== */
.folio-content {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 60px 80px 80px;
    position: relative;
    z-index: 2;
    overflow: hidden;
}

.folio-inner {
    max-width: 720px;
    width: 100%;
}

.folio-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

/* ===== Gutter (Book Fold) ===== */
.gutter {
    width: 60px;
    flex-shrink: 0;
    background: linear-gradient(to right, #d4c5a9, #c2b393);
    box-shadow: inset 4px 0 8px rgba(0,0,0,0.06);
    position: relative;
}

.gutter::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    width: 1px;
    background: rgba(0,0,0,0.05);
}

.gutter-dark {
    background: linear-gradient(to right, #1e2b22, #2a3a2e);
    box-shadow: inset 4px 0 8px rgba(0,0,0,0.15);
}

/* ===== Typography ===== */
.hero-headline {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 3.8rem);
    letter-spacing: -0.02em;
    color: #2c3e50;
    line-height: 1.15;
    margin-bottom: 40px;
}

.section-headline {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: clamp(1.6rem, 3.5vw, 2.8rem);
    letter-spacing: -0.02em;
    color: #2c3e50;
    line-height: 1.2;
    margin-bottom: 32px;
}

.headline-light {
    color: #faf8f4;
}

.body-text {
    font-family: 'Libre Franklin', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    line-height: 1.72;
    color: #3d4f5f;
    margin-bottom: 20px;
}

.text-light {
    color: #f0ebe0;
}

/* ===== Animations ===== */
.animate-in {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s cubic-bezier(0.25, 0.1, 0.25, 1.0),
                transform 0.6s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.animate-in.visible {
    opacity: 1;
    transform: translateY(0);
}

.stagger-1 { transition-delay: 80ms; }
.stagger-2 { transition-delay: 160ms; }
.stagger-3 { transition-delay: 240ms; }

/* ===== SVG Draw Animation ===== */
.draw-svg {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 1.2s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.folio.in-view .draw-svg {
    stroke-dashoffset: 0;
}

/* ===== Hero Image (Folio 1) ===== */
.hero-image {
    width: 100%;
    max-width: 500px;
    margin-top: 20px;
}

.cloud-svg {
    width: 100%;
    height: auto;
    filter: grayscale(100%) contrast(1.3);
}

/* ===== Two Columns (Folio 3) ===== */
.two-columns {
    display: flex;
    gap: 60px;
    align-items: flex-start;
}

.column-left {
    flex: 1;
}

.column-right {
    flex: 0 0 300px;
}

/* ===== Particle Viewport (Folio 3) ===== */
.particle-viewport {
    width: 300px;
    height: 300px;
    border: 1px solid #e8e2d6;
    border-radius: 4px;
    background: #faf8f4;
    overflow: hidden;
}

#particleSvg {
    width: 100%;
    height: 100%;
}

/* ===== Graph Paper Background (Folio 4) ===== */
.folio-graph-paper {
    background:
        repeating-linear-gradient(0deg, transparent, transparent 19.5px, #e8e2d6 19.5px, #e8e2d6 20px),
        repeating-linear-gradient(90deg, transparent, transparent 19.5px, #e8e2d6 19.5px, #e8e2d6 20px),
        #f0ebe0;
}

/* ===== Data Table (Folio 4) ===== */
.data-table-container {
    margin-top: 24px;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.88rem;
}

.data-table thead th {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #8a7e6b;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 2px solid #c2b393;
}

.data-table tbody td {
    padding: 10px 16px;
    border-bottom: 1px solid #e8e2d6;
    color: #3d4f5f;
}

.table-row {
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.4s cubic-bezier(0.25, 0.1, 0.25, 1.0),
                transform 0.4s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.table-row.row-visible {
    opacity: 1;
    transform: translateX(0);
}

.status-complete { color: #5b8a8a; }
.status-running { color: #d4885a; }
.status-pending { color: #8a7e6b; }

/* ===== Oscilloscope (Folio 5) ===== */
.oscilloscope-container {
    width: 100%;
    max-width: 600px;
    height: 200px;
    border: 1px solid #5b8a8a;
    border-radius: 4px;
    background: rgba(42, 58, 46, 0.5);
    margin: 32px auto;
    overflow: hidden;
}

#oscilloscope {
    width: 100%;
    height: 100%;
}

/* ===== Contour Visualization (Folio 6) ===== */
.contour-viz {
    width: 100%;
    max-width: 500px;
    margin-bottom: 40px;
}

.contour-map {
    width: 100%;
    height: auto;
}

/* ===== Bookplate (Folio 6) ===== */
.bookplate {
    position: relative;
    border: 2px double #c2b393;
    padding: 40px;
    max-width: 600px;
}

.bookplate-corner {
    position: absolute;
    width: 12px;
    height: 12px;
}

.corner-tl {
    top: -2px;
    left: -2px;
    border-top: 3px solid #c2b393;
    border-left: 3px solid #c2b393;
}

.corner-tr {
    top: -2px;
    right: -2px;
    border-top: 3px solid #c2b393;
    border-right: 3px solid #c2b393;
}

.corner-bl {
    bottom: -2px;
    left: -2px;
    border-bottom: 3px solid #c2b393;
    border-left: 3px solid #c2b393;
}

.corner-br {
    bottom: -2px;
    right: -2px;
    border-bottom: 3px solid #c2b393;
    border-right: 3px solid #c2b393;
}

.bookplate-text {
    font-family: 'Source Serif 4', serif;
    font-style: italic;
    font-size: 1.3rem;
    line-height: 1.6;
    color: #2c3e50;
    text-align: center;
}

/* ===== Final CTA (Folio 7) ===== */
.final-cta {
    text-align: center;
}

.domain-title {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #d4885a 0%, #e0a070 50%, #d4885a 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 4s ease-in-out infinite;
    margin-bottom: 48px;
}

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

.punchcard-input {
    margin-top: 16px;
}

.simulation-input {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1rem;
    color: #3d4f5f;
    background: #faf8f4;
    border: 2px solid #c2b393;
    border-radius: 2px;
    padding: 16px 24px;
    width: 100%;
    max-width: 480px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.06);
    transition: border-color 0.3s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.simulation-input::placeholder {
    color: #c2b393;
    font-style: italic;
}

.simulation-input:focus {
    outline: none;
    border-color: #d4885a;
}

/* ===== Simulation Ticker ===== */
.simulation-ticker {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 24px;
    overflow: hidden;
    z-index: 100;
    background: #faf8f4;
    border-top: 1px solid #e8e2d6;
}

.ticker-track {
    display: flex;
    white-space: nowrap;
    animation: tickerScroll 60s linear infinite;
}

.ticker-item {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    color: #5b8a8a;
    opacity: 0.5;
    line-height: 24px;
    padding: 0 4px;
}

@keyframes tickerScroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ===== Code snippets style ===== */
.code-snippet {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.88rem;
    background: #f0ebe0;
    border-left: 2px solid #d4885a;
    padding: 4px 8px;
}

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

    .folio-content {
        padding: 40px 24px 60px;
    }

    .two-columns {
        flex-direction: column;
    }

    .column-right {
        flex: none;
        width: 100%;
    }

    .particle-viewport {
        width: 100%;
        height: 250px;
    }

    .gutter {
        width: 30px;
    }

    .folio-index {
        bottom: 30px;
        gap: 10px;
    }

    .folio-dot {
        width: 24px;
        height: 24px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .codex-wrapper {
        overflow-x: auto;
        scroll-snap-type: none;
        scroll-behavior: auto;
    }

    .animate-in {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .draw-svg {
        stroke-dasharray: none;
        stroke-dashoffset: 0;
        transition: none;
    }

    .table-row {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .ticker-track {
        animation: none;
    }

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