/* rust.quest - Mid-century technical luxury */

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

:root {
    --gold: #e8b44d;
    --gold-dark: #c4943a;
    --rust: #b85c38;
    --rust-light: #d4763c;
    --tarnished: #8a7a5a;
    --black: #0d0d0d;
    --near-black: #1a1a1a;
    --cream: #f5efe3;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--black);
    color: var(--cream);
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 300;
    overflow-x: hidden;
}

/* Spine */
.spine {
    position: fixed;
    top: 0;
    left: 50%;
    width: 2px;
    height: 0;
    background: linear-gradient(to bottom, transparent, var(--gold), transparent);
    z-index: 100;
    transform: translateX(-50%);
    transition: height 1.5s ease-out;
}

.spine.visible {
    height: 100vh;
}

/* Spreads */
.spread {
    position: relative;
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    padding: 4rem;
    overflow: hidden;
}

.spread-watermark {
    position: absolute;
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    font-size: 15vw;
    opacity: 0.04;
    color: var(--gold);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    white-space: nowrap;
}

/* Spread 1 - Hero */
.spread-1 {
    background: var(--black);
}

.spread-left, .spread-right {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.ferris-svg {
    width: 100%;
    max-width: 400px;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.ferris-svg.visible {
    opacity: 1;
}

.ferris-svg path, .ferris-svg circle {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 2s ease-out;
}

.ferris-svg.animate path, .ferris-svg.animate circle {
    stroke-dashoffset: 0;
}

.hero-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    font-size: clamp(3rem, 7vw, 8rem);
    letter-spacing: -0.03em;
    line-height: 0.95;
    color: var(--cream);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out 2.2s, transform 0.6s ease-out 2.2s, letter-spacing 0.6s ease-out 2.2s;
}

.hero-title.visible {
    opacity: 1;
    transform: translateY(0);
    letter-spacing: -0.03em;
}

.hero-subtitle {
    font-family: 'Varela Round', sans-serif;
    font-size: 1.2rem;
    color: var(--tarnished);
    margin-top: 1.5rem;
    max-width: 400px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.6s ease-out 2.6s;
}

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

.scroll-indicator {
    margin-top: 3rem;
    opacity: 0;
    transition: opacity 0.6s ease-out 3s;
}

.scroll-indicator.visible {
    opacity: 1;
}

.scroll-circle {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--gold);
    animation: pulse 3s ease-in-out infinite;
    cursor: pointer;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.15); opacity: 1; }
}

/* Spread 2 - Ownership */
.spread-2 {
    background: var(--near-black);
}

.ownership-diagram {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.ownership-diagram.visible {
    opacity: 1;
    transform: translateY(0);
}

.own-box {
    border: 1.5px solid var(--gold);
    padding: 1rem 2rem;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.9rem;
    color: var(--gold);
    border-radius: 3px;
    background: var(--near-black);
    transition: border-color 0.5s ease, background 0.5s ease;
}

.own-box.owned {
    background: rgba(232, 180, 77, 0.15);
}

.own-box-moved {
    border-color: var(--tarnished);
    color: var(--tarnished);
}

.own-arrow {
    width: 40px;
    height: 60px;
}

.own-arrow path {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 0.8s ease;
}

.ownership-diagram.visible .own-arrow path {
    stroke-dashoffset: 0;
}

.essay-text {
    max-width: 450px;
    opacity: 0;
    transition: opacity 0.6s ease 0.3s;
}

.essay-text.visible {
    opacity: 1;
}

.essay-text p {
    margin-bottom: 1.5rem;
    line-height: 1.7;
    font-size: 1.05rem;
    color: var(--cream);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.essay-text.visible p:nth-child(1) { opacity: 1; transform: translateY(0); transition-delay: 0.3s; }
.essay-text.visible p:nth-child(2) { opacity: 1; transform: translateY(0); transition-delay: 0.45s; }
.essay-text.visible p:nth-child(3) { opacity: 1; transform: translateY(0); transition-delay: 0.6s; }

.drop-cap {
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    font-size: 4em;
    float: left;
    line-height: 0.8;
    margin-right: 0.1em;
    color: var(--gold);
}

/* Spread 3 - Borrowing */
.spread-3 {
    background: var(--black);
}

.spread-3 .spread-left {
    align-items: flex-start;
    padding-left: 4rem;
    position: relative;
}

.pull-quote {
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    font-size: clamp(2rem, 4vw, 4rem);
    color: var(--gold);
    line-height: 1.1;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.pull-quote.visible {
    opacity: 1;
}

.bracket-motif {
    position: absolute;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    height: 200px;
    width: 20px;
}

.bracket-motif svg {
    width: 100%;
    height: 100%;
}

.spread-3 .spread-right {
    position: relative;
}

.borrow-circles {
    position: relative;
    width: 300px;
    height: 300px;
    margin: 0 auto;
}

.borrow-circle {
    position: absolute;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(232, 180, 77, 0.15) 0%, transparent 70%);
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), background 0.4s ease;
}

#borrow-1 { top: 30px; left: 50px; }
#borrow-2 { top: 30px; left: 100px; }
#borrow-3 { top: 80px; left: 75px; }

.borrow-circle:hover {
    background: radial-gradient(circle, rgba(232, 180, 77, 0.3) 0%, transparent 70%);
}

.borrow-circle.mutable {
    background: radial-gradient(circle, rgba(232, 180, 77, 0.7) 0%, rgba(232, 180, 77, 0.2) 70%);
}

.borrow-circle.repelled-1 { transform: translate(-60px, -30px); }
.borrow-circle.repelled-2 { transform: translate(60px, -30px); }

.borrow-label {
    text-align: center;
    margin-top: 2rem;
    font-family: 'Varela Round', sans-serif;
    color: var(--tarnished);
    font-size: 0.95rem;
}

/* Spread 4 - Concurrency */
.spread-4 {
    background: var(--near-black);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.concurrency-full {
    width: 100%;
    text-align: center;
}

.thread-container {
    position: relative;
    width: 90%;
    margin: 0 auto;
    height: 300px;
}

.threads-svg {
    width: 100%;
    height: 100%;
}

.thread-line {
    stroke-dasharray: 1500;
    stroke-dashoffset: 1500;
    transition: stroke-dashoffset 1.5s ease;
}

.thread-container.visible .thread-line {
    stroke-dashoffset: 0;
}

.thread-annotations {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.annotation {
    position: absolute;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: var(--gold);
    opacity: 0;
    transition: opacity 0.5s ease;
    white-space: nowrap;
}

.thread-container.visible .annotation {
    opacity: 1;
}

.concurrency-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    font-size: clamp(2rem, 5vw, 5rem);
    color: var(--cream);
    margin-top: 2rem;
    letter-spacing: -0.03em;
}

/* Spread 5 - Ecosystem */
.spread-5 {
    background: var(--black);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ecosystem-content {
    text-align: center;
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.cargo-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    font-size: 8vw;
    color: var(--cream);
    letter-spacing: -0.03em;
}

.cargo-subtitle {
    font-family: 'Varela Round', sans-serif;
    font-size: 1.2rem;
    color: var(--tarnished);
    margin-top: 1rem;
}

.cargo-subtitle code {
    font-family: 'IBM Plex Mono', monospace;
    color: var(--gold);
    background: rgba(232, 180, 77, 0.1);
    padding: 0.2em 0.4em;
    border-radius: 3px;
}

.crates-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.crate-icon {
    position: absolute;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    cursor: default;
    transition: transform 0.3s ease;
}

.crate-icon svg {
    width: 100%;
    height: 100%;
}

.crate-icon span {
    position: absolute;
    bottom: -16px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.6rem;
    color: var(--gold);
    white-space: nowrap;
    opacity: 0.7;
}

.horizon-line {
    position: absolute;
    bottom: 15%;
    left: 10%;
    right: 10%;
}

.horizon-line svg {
    width: 100%;
    height: 60px;
}

/* Circuit pattern overlay */
.spread::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cpath d='M10 10 L50 10 L50 50 M50 10 L90 10 M50 50 L50 90 M50 50 L90 50' fill='none' stroke='%23e8b44d' stroke-width='0.5'/%3E%3Ccircle cx='50' cy='10' r='2' fill='%23e8b44d'/%3E%3Ccircle cx='50' cy='50' r='2' fill='%23e8b44d'/%3E%3C/svg%3E");
    opacity: 0.04;
    pointer-events: none;
}

/* Gold dividers */
.spread + .spread::after {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 2px;
    background: linear-gradient(to right, transparent, var(--gold), transparent);
    opacity: 0.3;
}
