/* ============================================
   riron.xyz — Frutiger Aero + Sepia Nostalgic
   ============================================ */

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

:root {
    --warm-parchment: #F5EDE0;
    --sepia-deep: #8B7355;
    --amber-glow: #C8A050;
    --frutiger-blue: #5B9BD5;
    --tech-gray: #A0998C;
    --cream-light: #FFF8F0;
    --dark-walnut: #4A3828;
    --gradient-end: #E8DDD0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Lora', Georgia, serif;
    font-weight: 400;
    font-size: clamp(16px, 1.5vw, 18px);
    line-height: 1.85;
    color: var(--sepia-deep);
    background-color: var(--warm-parchment);
    overflow-x: hidden;
}

/* --- Typography --- */
h1, h2, h3 {
    font-family: 'Libre Baskerville', 'Georgia', serif;
    font-weight: 700;
    color: var(--dark-walnut);
    letter-spacing: -0.01em;
}

h2 {
    font-size: clamp(28px, 4.5vw, 60px);
    margin-bottom: 0.4em;
}

.body-italic {
    font-weight: 700;
    font-style: italic;
    color: var(--dark-walnut);
    margin-top: 1.2em;
}

/* Data labels */
.bar-label,
.bar-chart-label,
.chart-title,
.radial-label,
.radial-value,
.ring-label,
.ring-value,
.node-label,
.map-node-sublabel {
    font-family: 'DM Mono', monospace;
    font-weight: 400;
    font-size: 13px;
}

/* ============================================
   THEORY HORIZON (Hero Section)
   ============================================ */
#theory-horizon {
    position: relative;
    min-height: 100vh;
    background: linear-gradient(180deg, var(--warm-parchment) 0%, var(--gradient-end) 100%);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.horizon-content {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 18vh;
}

/* Wordmark */
.wordmark-container {
    position: relative;
    text-align: center;
    z-index: 2;
}

.wordmark {
    font-family: 'Libre Baskerville', 'Georgia', serif;
    font-size: clamp(42px, 7vw, 90px);
    font-weight: 700;
    color: var(--dark-walnut);
    letter-spacing: -0.02em;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.wordmark.revealed {
    opacity: 1;
    transform: translateY(0);
}

.wordmark-sub {
    display: block;
    font-family: 'Libre Baskerville', 'Georgia', serif;
    font-size: clamp(16px, 2.5vw, 28px);
    font-weight: 400;
    color: var(--tech-gray);
    margin-top: 0.3em;
    letter-spacing: 0.15em;
    opacity: 0;
    transition: opacity 0.8s ease 0.3s;
}

.wordmark.revealed + .wordmark-sub,
.wordmark.revealed ~ .wordmark-sub {
    opacity: 1;
}

/* Slide-reveal line */
.slide-reveal-line {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--amber-glow);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.5s ease;
    z-index: 3;
}

.slide-reveal-line.animate {
    transform: scaleX(1);
}

.slide-reveal-line.fade-out {
    opacity: 0;
    transition: opacity 0.3s ease 0.5s;
}

/* Circuit lines from wordmark */
.circuit-lines {
    position: absolute;
    top: 28vh;
    left: 50%;
    transform: translateX(-50%);
    width: clamp(400px, 60vw, 800px);
    height: auto;
    z-index: 1;
    pointer-events: none;
}

.circuit-path {
    fill: none;
    stroke: var(--tech-gray);
    stroke-width: 0.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    transition: stroke-dashoffset 1.5s ease;
}

.circuit-path.drawn {
    stroke-dashoffset: 0;
}

.circuit-node {
    fill: var(--tech-gray);
    opacity: 0;
    transition: opacity 0.6s ease;
}

.circuit-node.visible {
    opacity: 1;
}

/* Hero data-viz element */
.hero-dataviz {
    position: absolute;
    bottom: 8vh;
    right: 8vw;
    display: flex;
    align-items: flex-end;
    gap: 24px;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.8s ease, transform 0.8s ease;
    z-index: 2;
}

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

.radial-chart {
    width: 100px;
    height: 100px;
}

.radial-bg {
    fill: none;
    stroke: var(--gradient-end);
    stroke-width: 6;
}

.radial-progress {
    fill: none;
    stroke: var(--amber-glow);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 314;
    stroke-dashoffset: 314;
    transform: rotate(-90deg);
    transform-origin: center;
    transition: stroke-dashoffset 1.2s ease;
}

.radial-progress.animate {
    stroke-dashoffset: 69; /* 78% of 314 = ~245, 314 - 245 = 69 */
}

.radial-label {
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    fill: var(--dark-walnut);
}

.radial-value {
    font-family: 'DM Mono', monospace;
    font-size: 14px;
    fill: var(--amber-glow);
    font-weight: 700;
}

/* Mini bars */
.mini-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 160px;
}

.mini-bar-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mini-bar-row .bar-label {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    color: var(--tech-gray);
}

.bar-track {
    width: 100%;
    height: 4px;
    background: var(--gradient-end);
    border-radius: 2px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--amber-glow), var(--frutiger-blue));
    border-radius: 2px;
    transition: width 1s ease;
}

.bar-fill.animate {
    width: var(--bar-width);
}

/* ============================================
   BREATHING SECTIONS
   ============================================ */
.breathing-section {
    margin-block: clamp(100px, 15vh, 200px);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.section-inner {
    max-width: 900px;
    width: 90%;
    margin-inline: auto;
    display: flex;
    gap: clamp(40px, 5vw, 80px);
    align-items: flex-start;
    padding: 40px;
    position: relative;
}

.section-content {
    flex: 1;
    max-width: 640px;
}

.section-content p {
    margin-top: 1em;
}

.section-content p:first-of-type {
    margin-top: 0.6em;
}

.section-dataviz {
    flex: 0 0 200px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 10px;
}

/* Slide-reveal system */
.slide-reveal {
    position: relative;
    overflow: hidden;
}

.slide-reveal::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--warm-parchment);
    transform-origin: left;
    transform: scaleX(1);
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

.slide-reveal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: var(--amber-glow);
    z-index: 2;
    transform: translateX(-2px);
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.slide-reveal.revealed::after {
    transform: scaleX(0);
}

.slide-reveal.revealed::before {
    transform: translateX(calc(100vw));
}

/* Section connector lines */
.section-connector {
    width: 40px;
    height: 80px;
    margin-top: -10px;
    margin-bottom: -10px;
}

.connector-path {
    fill: none;
    stroke: var(--tech-gray);
    stroke-width: 0.5;
    stroke-linecap: round;
}

.connector-node {
    fill: var(--tech-gray);
}

/* --- SVG Data-Viz Styles --- */

/* Bar chart */
.bar-chart {
    width: 200px;
    height: 140px;
}

.bar-chart .bar {
    fill: var(--amber-glow);
    opacity: 0.7;
}

.bar-chart .bar:nth-child(2n+1) {
    fill: var(--frutiger-blue);
    opacity: 0.6;
}

.chart-title {
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    fill: var(--tech-gray);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.bar-chart-label {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    fill: var(--sepia-deep);
}

/* Dot network */
.dot-network {
    width: 200px;
    height: 160px;
}

.network-edge {
    stroke: var(--tech-gray);
    stroke-width: 0.8;
    opacity: 0.5;
}

.network-node {
    stroke: var(--cream-light);
    stroke-width: 1.5;
}

.glossy-node {
    fill: url(#nodeGlossSmall);
}

.dot-network .network-node:nth-child(odd) {
    fill: var(--amber-glow);
}

.dot-network .network-node:nth-child(even) {
    fill: var(--frutiger-blue);
}

.node-label {
    font-family: 'DM Mono', monospace;
    font-size: 8px;
    fill: var(--cream-light);
    font-weight: 700;
}

/* Progress rings */
.progress-rings {
    width: 200px;
    height: 140px;
}

.ring-bg {
    fill: none;
    stroke: var(--gradient-end);
    stroke-width: 5;
}

.ring-progress {
    fill: none;
    stroke-width: 5;
    stroke-linecap: round;
    stroke-dasharray: 220;
    stroke-dashoffset: 220;
    transform: rotate(-90deg);
    transform-origin: center;
    transition: stroke-dashoffset 1.5s ease;
}

.ring-1 {
    stroke: var(--amber-glow);
}

.ring-2 {
    stroke: var(--frutiger-blue);
}

.ring-progress.animate.ring-1 {
    stroke-dashoffset: 17.6; /* 92% of 220 = 202.4, 220 - 202.4 = 17.6 */
}

.ring-progress.animate.ring-2 {
    stroke-dashoffset: 72.6; /* 67% of 220 = 147.4, 220 - 147.4 = 72.6 */
}

.ring-label {
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    fill: var(--dark-walnut);
}

.ring-value {
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    fill: var(--amber-glow);
}

/* ============================================
   THEORY MAP
   ============================================ */
#theory-map {
    margin-block: clamp(100px, 15vh, 200px);
    padding: 40px 20px;
    text-align: center;
}

.map-title {
    font-size: clamp(28px, 4.5vw, 60px);
    margin-bottom: 0.2em;
}

.map-subtitle {
    font-family: 'DM Mono', monospace;
    font-size: 14px;
    color: var(--tech-gray);
    margin-bottom: 60px;
    letter-spacing: 0.05em;
}

.map-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
    background: linear-gradient(135deg, var(--cream-light), var(--warm-parchment));
    border-radius: 16px;
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.5), 0 4px 20px rgba(74, 56, 40, 0.08);
}

.theory-network {
    width: 100%;
    height: auto;
    max-height: 500px;
}

.map-edge {
    stroke: var(--tech-gray);
    stroke-width: 1;
    opacity: 0.4;
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    transition: stroke-dashoffset 1.5s ease;
}

.map-edge.drawn {
    stroke-dashoffset: 0;
}

.map-node {
    filter: url(#nodeShadow);
    cursor: default;
    transition: transform 0.3s ease;
}

.map-node-root {
    fill: var(--amber-glow);
    stroke: var(--cream-light);
    stroke-width: 2;
}

.map-node-l2 {
    fill: url(#nodeGloss);
    stroke: var(--amber-glow);
    stroke-width: 1.5;
}

.map-node-l3 {
    fill: url(#nodeGloss);
    stroke: var(--frutiger-blue);
    stroke-width: 1;
}

.map-node-label {
    font-family: 'Libre Baskerville', 'Georgia', serif;
    font-size: 14px;
    font-weight: 700;
    fill: var(--dark-walnut);
    pointer-events: none;
}

.map-node-sublabel {
    font-family: 'DM Mono', monospace;
    font-size: 9px;
    fill: var(--sepia-deep);
    pointer-events: none;
}

/* ============================================
   HORIZON FOOTER
   ============================================ */
#horizon-footer {
    background: linear-gradient(180deg, var(--warm-parchment) 0%, var(--gradient-end) 100%);
    padding: 60px 40px 40px;
    text-align: center;
    position: relative;
}

.footer-circuits {
    width: 100%;
    max-width: 800px;
    height: 60px;
    margin: 0 auto 30px;
    display: block;
}

.footer-circuit-path {
    fill: none;
    stroke: var(--tech-gray);
    stroke-width: 0.5;
    stroke-linecap: round;
    opacity: 0.5;
}

.footer-circuit-node {
    fill: var(--tech-gray);
    opacity: 0.5;
}

.footer-content {
    max-width: 640px;
    margin: 0 auto;
}

.footer-wordmark {
    font-family: 'Libre Baskerville', 'Georgia', serif;
    font-weight: 700;
    font-size: clamp(18px, 2.5vw, 24px);
    color: var(--dark-walnut);
    margin-bottom: 0.3em;
}

.footer-tagline {
    font-family: 'DM Mono', monospace;
    font-size: 13px;
    color: var(--tech-gray);
    letter-spacing: 0.05em;
}

/* ============================================
   FRUTIGER AERO GLOSSY SURFACES
   ============================================ */
.glossy-surface {
    background: linear-gradient(135deg, var(--cream-light), var(--gradient-end));
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.5), 0 2px 4px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .section-inner {
        flex-direction: column;
        padding: 30px 20px;
    }

    .section-dataviz {
        flex: none;
        width: 100%;
        justify-content: center;
        margin-top: 30px;
    }

    .hero-dataviz {
        position: relative;
        bottom: auto;
        right: auto;
        margin: 40px auto 60px;
        flex-direction: column;
        align-items: center;
    }

    .mini-bars {
        width: 200px;
    }

    .circuit-lines {
        width: 90vw;
    }

    .map-container {
        padding: 20px 10px;
    }
}

@media (max-width: 480px) {
    .horizon-content {
        padding-top: 12vh;
    }

    .breathing-section {
        margin-block: clamp(60px, 10vh, 120px);
    }

    .section-inner {
        padding: 20px 16px;
    }
}
