/* ===========================================
   rational.today - Victorian-Ornate Earth Scroll
   =========================================== */

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

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

body {
    background-color: #FAF4E8;
    color: #4A3A28;
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.9;
    overflow-x: hidden;
    min-height: 100vh;
}

/* --- Background Geometric Cuts --- */
#geometric-cuts {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.geo-cut {
    position: absolute;
    opacity: 0.06;
}

.geo-cut-1 {
    top: 5%;
    left: -5%;
    width: 40%;
    height: 30%;
    transform: rotate(-15deg);
}

.geo-cut-2 {
    top: 25%;
    right: -10%;
    width: 45%;
    height: 35%;
    transform: rotate(12deg);
}

.geo-cut-3 {
    top: 55%;
    left: -8%;
    width: 35%;
    height: 25%;
    transform: rotate(-8deg);
}

.geo-cut-4 {
    top: 70%;
    right: -5%;
    width: 50%;
    height: 30%;
    transform: rotate(20deg);
}

.geo-cut-5 {
    top: 90%;
    left: 10%;
    width: 30%;
    height: 25%;
    transform: rotate(-25deg);
}

/* --- Manuscript Scroll Container --- */
#manuscript-scroll {
    position: relative;
    z-index: 1;
    max-width: 700px;
    margin: 0 auto;
    padding: 0 24px;
}

/* --- Scroll Sections --- */
.scroll-section {
    padding: clamp(60px, 10vh, 120px) 0;
    transition: filter 0.6s ease, opacity 0.6s ease;
}

.scroll-section.blurred {
    filter: blur(1.5px);
    opacity: 0.7;
}

.scroll-section.active {
    filter: blur(0);
    opacity: 1;
}

/* --- Hero Section --- */
#hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
}

.hero-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.hero-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    color: #1A1808;
    letter-spacing: 0.15em;
    margin-bottom: 16px;
    position: relative;
}

.hero-subtitle {
    font-family: 'Nunito', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 2vw, 1.3rem);
    color: #8A7050;
    letter-spacing: 0.08em;
    margin-bottom: 40px;
}

.hero-ornament {
    width: 300px;
    max-width: 80%;
}

.hero-ornament svg {
    width: 100%;
    height: auto;
}

/* --- Ornament Dividers --- */
.ornament-divider {
    width: 100%;
    max-width: 600px;
    margin: 0 auto 40px auto;
    opacity: 0.08;
    animation: ornamentGlitch 10s ease-in-out infinite;
}

.ornament-divider svg {
    width: 100%;
    height: auto;
    display: block;
}

#hero .ornament-divider {
    opacity: 0.12;
    max-width: 700px;
}

#hero .ornament-top {
    margin-bottom: 0;
    align-self: stretch;
}

#hero .ornament-bottom {
    margin-top: 0;
    margin-bottom: 0;
    align-self: stretch;
}

.ornament-final {
    margin-top: 60px;
    margin-bottom: 20px;
}

/* --- Glitch Animation --- */
@keyframes ornamentGlitch {
    0%, 100% {
        transform: translate(0, 0) skew(0deg);
        opacity: 0.08;
    }
    14% {
        transform: translate(0, 0) skew(0deg);
        opacity: 0.08;
    }
    14.5% {
        transform: translate(3px, -1px) skew(2deg);
        opacity: 0.15;
        filter: hue-rotate(20deg);
    }
    15% {
        transform: translate(-2px, 1px) skew(-1.5deg);
        opacity: 0.04;
    }
    15.3% {
        transform: translate(1px, 0) skew(0.5deg);
        opacity: 0.12;
    }
    15.5% {
        transform: translate(0, 0) skew(0deg);
        opacity: 0.08;
    }
    64% {
        transform: translate(0, 0) skew(0deg);
        opacity: 0.08;
    }
    64.3% {
        transform: translate(-4px, 2px) skew(-3deg);
        opacity: 0.2;
        filter: hue-rotate(-15deg);
    }
    64.6% {
        transform: translate(2px, -1px) skew(1deg);
        opacity: 0.03;
    }
    64.8% {
        transform: translate(0, 0) skew(0deg);
        opacity: 0.08;
    }
}

/* Glitch flash color overlay for ornaments */
.ornament-divider.glitching {
    position: relative;
}

.ornament-divider.glitching::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #C07040;
    opacity: 0.1;
    mix-blend-mode: overlay;
    animation: glitchFlash 150ms ease-out forwards;
}

@keyframes glitchFlash {
    0% { opacity: 0.15; }
    50% { opacity: 0.08; }
    100% { opacity: 0; }
}

/* --- Section Headings --- */
.section-heading {
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    font-size: clamp(2rem, 4.5vw, 3.2rem);
    color: #1A1808;
    margin-bottom: 32px;
    letter-spacing: 0.04em;
}

/* --- Body Text --- */
.body-text {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.9;
    color: #4A3A28;
    margin-bottom: 28px;
}

/* --- Tutorial Steps --- */
.tutorial-step {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 24px;
    padding: 20px 24px;
    background: #FFF8EE;
    border-left: 3px solid #B08858;
    position: relative;
}

.tutorial-step::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 30px;
    height: 30px;
    border-top: 2px solid rgba(138, 112, 80, 0.12);
    border-right: 2px solid rgba(138, 112, 80, 0.12);
}

.step-number {
    font-family: 'Fira Code', monospace;
    font-weight: 500;
    font-size: 1.1rem;
    color: #8A7050;
    min-width: 32px;
    flex-shrink: 0;
    line-height: 1.9;
}

.step-text {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.9;
    color: #4A3A28;
}

/* --- Framework Cards --- */
.framework-card {
    margin-bottom: 32px;
    padding: 32px;
    background: #FFF8EE;
    border: 1px solid rgba(176, 136, 88, 0.15);
    position: relative;
}

.framework-card::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 1px solid rgba(176, 136, 88, 0.06);
    pointer-events: none;
}

/* Sharp angle cut on framework cards */
.framework-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    border-top: 24px solid #FAF4E8;
    border-right: 24px solid transparent;
}

.framework-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    font-size: clamp(1.1rem, 1.8vw, 1.35rem);
    color: #1A1808;
    margin-bottom: 12px;
    letter-spacing: 0.02em;
}

.framework-card .body-text {
    margin-bottom: 0;
}

/* --- Colophon --- */
.colophon {
    text-align: center;
    font-family: 'Nunito', sans-serif;
    font-weight: 300;
    font-size: 0.85rem;
    color: #8A7050;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    padding-bottom: 60px;
}

/* --- Scroll Reveal Animation --- */
.scroll-section {
    opacity: 0;
    transform: translateY(30px);
}

.scroll-section.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.8s ease, transform 0.8s ease, filter 0.6s ease;
}

.scroll-section.visible.blurred {
    opacity: 0.7;
}

#hero {
    opacity: 1;
    transform: translateY(0);
}

/* --- Victorian Line Borders (subtle page edges) --- */
body::before,
body::after {
    content: '';
    position: fixed;
    top: 20px;
    bottom: 20px;
    width: 1px;
    background: rgba(176, 136, 88, 0.08);
    z-index: 2;
    pointer-events: none;
}

body::before {
    left: 20px;
}

body::after {
    right: 20px;
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    #manuscript-scroll {
        padding: 0 20px;
    }

    .tutorial-step {
        padding: 16px 18px;
        gap: 14px;
    }

    .framework-card {
        padding: 24px 20px;
    }

    body::before,
    body::after {
        display: none;
    }

    .geo-cut {
        opacity: 0.03;
    }
}

@media (max-width: 480px) {
    .hero-title {
        letter-spacing: 0.08em;
    }

    .ornament-divider {
        max-width: 100%;
    }
}

/* --- Selection Color --- */
::selection {
    background: rgba(176, 136, 88, 0.3);
    color: #1A1808;
}

/* --- Scrollbar Styling --- */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #FAF4E8;
}

::-webkit-scrollbar-thumb {
    background: rgba(176, 136, 88, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(176, 136, 88, 0.5);
}
