/* ============================================
   ringworld.quest — Styles
   Victorian-ornate × candy-bright maximalism
   ============================================ */

:root {
    --bubblegum-rose: #FF6B9D;
    --lavender-fizz: #C084FC;
    --lemon-drop: #FDE047;
    --mint-cream: #A7F3D0;
    --cream-parchment: #FFF8ED;
    --cocoa-filigree: #5C3D2E;
    --deep-plum: #3B1F4A;
    --coral-sherbet: #FF9A76;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--cream-parchment);
    color: var(--cocoa-filigree);
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.25rem);
    line-height: 1.7;
    overflow-x: hidden;
}

/* ============================================
   Gear Rail
   ============================================ */
.gear-rail {
    position: fixed;
    right: 0;
    top: 0;
    width: 48px;
    height: 100vh;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-around;
    padding: 20px 0;
    pointer-events: none;
}

.gear-rail .gear {
    flex-shrink: 0;
}

.gear-1 { animation: spin 12s linear infinite; }
.gear-2 { animation: spin 8s linear infinite reverse; }
.gear-3 { animation: spin 20s linear infinite; }
.gear-4 { animation: spin 10s linear infinite reverse; }
.gear-5 { animation: spin 15s linear infinite; }
.gear-6 { animation: spin 9s linear infinite reverse; }
.gear-7 { animation: spin 18s linear infinite; }
.gear-8 { animation: spin 11s linear infinite reverse; }

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   Cartouche
   ============================================ */
.cartouche {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 100;
    padding: 8px 16px;
    border: 2px solid var(--cocoa-filigree);
    background: var(--cream-parchment);
}

.cartouche::before {
    content: '';
    position: absolute;
    inset: 3px;
    border: 1px dotted rgba(92, 61, 46, 0.4);
    pointer-events: none;
}

.cartouche::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 1px solid rgba(92, 61, 46, 0.2);
    pointer-events: none;
}

.cartouche-text {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 14px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--deep-plum);
}

/* ============================================
   Diagonal Sections
   ============================================ */
.diagonal-section {
    position: relative;
    min-height: 100vh;
    padding: 120px 80px;
    margin-top: -40px;
    overflow: hidden;
    opacity: 0;
    transition: opacity 600ms cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 600ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.diagonal-section:first-of-type {
    margin-top: 0;
}

.section-odd {
    clip-path: polygon(0 40px, 100% 0, 100% calc(100% - 40px), 0 100%);
    transform: translateX(-100px) skewY(-6deg);
}

.section-even {
    clip-path: polygon(0 0, 100% 40px, 100% 100%, 0 calc(100% - 40px));
    transform: translateX(100px) skewY(-6deg);
}

.diagonal-section.revealed {
    opacity: 1;
}

.section-odd.revealed {
    transform: translateX(0) skewY(-6deg);
}

.section-even.revealed {
    transform: translateX(0) skewY(-6deg);
}

.section-content {
    transform: skewY(6deg);
    position: relative;
    z-index: 2;
    max-width: 720px;
    margin: 0 auto;
}

/* Stagger children */
.section-content > [data-stagger] {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 500ms ease, transform 500ms ease;
}

.diagonal-section.revealed .section-content > [data-stagger] {
    opacity: 1;
    transform: translateY(0);
}

/* Section gradients */
.section-gradient {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.section-odd .section-gradient {
    background: linear-gradient(135deg, #FF6B9D 0%, #FF9A76 50%, #FDE047 100%);
    opacity: 0.08;
}

.section-even .section-gradient {
    background: linear-gradient(135deg, #C084FC 0%, #A7F3D0 50%, #FDE047 100%);
    opacity: 0.08;
}

/* ============================================
   Ornate Frames
   ============================================ */
.ornate-frame {
    position: absolute;
    inset: 20px;
    z-index: 1;
    pointer-events: none;
    border: 2px solid var(--cocoa-filigree);
}

.ornate-frame::before {
    content: '';
    position: absolute;
    inset: 4px;
    border: 1px dotted rgba(92, 61, 46, 0.35);
}

.ornate-frame::after {
    content: '';
    position: absolute;
    top: -6px;
    left: -6px;
    width: 20px;
    height: 20px;
    border-top: 3px solid var(--bubblegum-rose);
    border-left: 3px solid var(--bubblegum-rose);
    border-radius: 4px 0 0 0;
}

.ornate-frame-elaborate {
    border-width: 3px;
}

.ornate-frame-elaborate::before {
    border-width: 2px;
    border-style: dashed;
    border-color: rgba(192, 132, 252, 0.4);
}

.ornate-frame-elaborate::after {
    width: 30px;
    height: 30px;
    border-width: 4px;
    border-color: var(--lemon-drop);
}

/* Corner flourishes for all frames */
.diagonal-section:nth-child(odd) .ornate-frame::after {
    border-color: var(--bubblegum-rose);
}

.diagonal-section:nth-child(even) .ornate-frame::after {
    border-color: var(--lavender-fizz);
}

/* ============================================
   Typography
   ============================================ */
.hero-title {
    font-family: 'Baloo 2', cursive;
    font-weight: 800;
    font-size: clamp(3rem, 10vw, 8rem);
    color: var(--deep-plum);
    letter-spacing: 0.02em;
    text-align: center;
    line-height: 1.1;
    margin-bottom: 24px;
}

.hero-tagline {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: var(--cocoa-filigree);
    text-align: center;
    letter-spacing: 0.05em;
}

.section-label {
    display: block;
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: clamp(0.75rem, 1vw, 1rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--bubblegum-rose);
    margin-bottom: 8px;
}

.section-heading {
    font-family: 'Baloo 2', cursive;
    font-weight: 700;
    font-size: clamp(2.5rem, 7vw, 6rem);
    color: var(--deep-plum);
    letter-spacing: 0.02em;
    line-height: 1.15;
    margin-bottom: 24px;
}

.section-body {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.25rem);
    line-height: 1.7;
    color: var(--cocoa-filigree);
    max-width: 52ch;
    margin-bottom: 24px;
}

.closing-text {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: var(--deep-plum);
    text-align: center;
    letter-spacing: 0.05em;
    padding: 60px 0;
}

/* Section 1 special centering */
#section1 .section-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 240px);
}

/* Section 6 centering */
.section-content-closing {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 240px);
}

/* ============================================
   Ornamental Dividers
   ============================================ */
.ornamental-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 24px 0;
    opacity: 0.6;
}

.divider-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--cocoa-filigree);
}

.divider-line {
    width: 60px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--cocoa-filigree), transparent);
}

.divider-rosette {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1.5px solid var(--cocoa-filigree);
    position: relative;
}

.divider-rosette::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--bubblegum-rose);
    transform: translate(-50%, -50%);
}

.divider-large .divider-line {
    width: 100px;
}

/* ============================================
   Bubble Clusters & Joints
   ============================================ */
.bubble {
    border-radius: 50%;
    border: 1px solid rgba(192, 132, 252, 0.3);
    background: radial-gradient(ellipse at 30% 30%, rgba(255, 255, 255, 0.6) 0%, rgba(255, 107, 157, 0.1) 100%);
    box-shadow: inset 0 -4px 8px rgba(92, 61, 46, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Baloo 2', cursive;
    color: var(--lavender-fizz);
    backdrop-filter: blur(4px);
    animation: float 6s ease-in-out infinite;
}

.bubble::after {
    content: attr(data-glyph);
}

.bubble-xs { width: 24px; height: 24px; font-size: 10px; animation-delay: 0s; }
.bubble-sm { width: 40px; height: 40px; font-size: 14px; animation-delay: 1s; }
.bubble-md { width: 60px; height: 60px; font-size: 20px; animation-delay: 2s; }
.bubble-lg { width: 80px; height: 80px; font-size: 28px; animation-delay: 3s; }

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

.bubble-cluster {
    position: absolute;
    z-index: 3;
    display: flex;
    gap: 8px;
    align-items: center;
}

.cluster-1 { top: 20%; right: 10%; }
.cluster-2 { bottom: 25%; left: 5%; }
.cluster-3 { top: 15%; right: 8%; }
.cluster-4 { top: 20%; left: 5%; }
.cluster-5 { bottom: 20%; right: 10%; }

/* Bubble joints between sections */
.bubble-joint {
    position: absolute;
    z-index: 50;
    display: flex;
    gap: 6px;
    align-items: center;
    pointer-events: none;
}

.joint-1-2 { top: calc(100vh - 20px); left: 30%; }
.joint-2-3 { top: calc(200vh - 60px); right: 25%; }
.joint-3-4 { top: calc(300vh - 100px); left: 35%; }
.joint-4-5 { top: calc(400vh - 140px); right: 30%; }
.joint-5-6 { top: calc(500vh - 180px); left: 25%; }

/* ============================================
   Ring Watermarks
   ============================================ */
.ring-watermark {
    position: absolute;
    z-index: 0;
    top: 50%;
    left: 70%;
    transform: translate(-50%, -50%) skewY(6deg);
    pointer-events: none;
}

.ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(92, 61, 46, 0.08);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.ring-1 { width: 200px; height: 200px; }
.ring-2 { width: 350px; height: 350px; }
.ring-3 { width: 500px; height: 500px; }

/* Dense rings for The Horizon section */
.ring-watermark-dense {
    top: 30%;
    left: 50%;
}

.ring-horizon-1 { width: 120px; height: 120px; border-color: rgba(92, 61, 46, 0.1); }
.ring-horizon-2 { width: 220px; height: 220px; border-color: rgba(192, 132, 252, 0.08); }
.ring-horizon-3 { width: 340px; height: 340px; border-color: rgba(92, 61, 46, 0.06); }
.ring-horizon-4 { width: 480px; height: 480px; border-color: rgba(255, 107, 157, 0.05); }
.ring-horizon-5 { width: 640px; height: 640px; border-color: rgba(92, 61, 46, 0.03); }

/* ============================================
   Gear Watermarks
   ============================================ */
.gear-watermark {
    position: absolute;
    z-index: 0;
    top: 50%;
    right: 15%;
    transform: translateY(-50%) skewY(6deg);
    pointer-events: none;
}

.bg-gear {
    position: absolute;
}

.bg-gear-1 { top: -80px; right: 0; animation: spin 20s linear infinite; }
.bg-gear-2 { top: 40px; right: 80px; animation: spin 15s linear infinite reverse; }

.gear-watermark-dense {
    right: 10%;
}

.bg-gear-fast-1 { top: -100px; right: 0; animation: spin 6s linear infinite; }
.bg-gear-fast-2 { top: 30px; right: 100px; animation: spin 8s linear infinite reverse; }
.bg-gear-fast-3 { top: -20px; right: 40px; animation: spin 10s linear infinite; }

/* ============================================
   Ring Diagram (Section 2)
   ============================================ */
.ring-diagram {
    display: flex;
    justify-content: center;
    margin: 32px 0;
}

.ring-svg {
    width: 100%;
    max-width: 400px;
    height: auto;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .diagonal-section {
        padding: 100px 30px;
    }

    .ornate-frame {
        inset: 10px;
    }

    .gear-rail {
        width: 32px;
    }

    .gear-rail .gear {
        transform: scale(0.7);
    }

    .bubble-cluster {
        display: none;
    }

    .bubble-joint {
        display: none;
    }

    .cartouche {
        bottom: 10px;
        left: 10px;
        padding: 6px 10px;
    }

    .cartouche-text {
        font-size: 11px;
    }
}
