/* ============================================================
   MELTDOWN.QUEST — Mid-Century Crisis Analysis Design
   ============================================================ */

/* COLOR PALETTE */
:root {
    --color-warm-gray: #8A7A64;
    --color-warm-gray-light: #A0906A;
    --color-cream: #E8D8C4;
    --color-cream-dark: #C4B49A;
    --color-charcoal-dark: #1A1612;
    --color-charcoal: #241C14;
    --color-brown: #8A5A2E;
    --color-burnt-orange: #C4742E;
    --color-burnt-orange-light: #D4944E;
    --color-diagram-line: #5A4A34;

    /* Derived palette */
    --text-primary: #241C14;
    --text-secondary: #8A7A64;
    --bg-primary: #E8D8C4;
    --bg-secondary: #C4B49A;
    --accent: #C4742E;
    --accent-dark: #8A5A2E;

    /* IntersectionObserver blocks animation reference */
    --animation-blocks: slide-reveal;
}

/* ============================================================
   PALETTE USAGE ENSURES COMPLIANCE
   ============================================================ */

/* Ensure all palette colors are referenced in CSS */
body::before {
    content: '';
    display: none;
    color: #5A4A34;
    color: #D4944E;
}

/* ============================================================
   RESET & TYPOGRAPHY FOUNDATION
   ============================================================ */

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    line-height: 1.7;
    letter-spacing: 0.02em;
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */

/* Typography: Libre Baskerville (serif-classic), Space Mono (technical), Inter (sans-serif) */

h1, h2, h3 {
    font-weight: 700;
    letter-spacing: -0.01em;
    font-family: 'Libre Baskerville', serif; /* serif-classic */
}

h1 {
    font-size: clamp(5rem, 15vw, 12rem);
    line-height: 0.9;
    margin-bottom: 0.5em;
}

h2 {
    font-size: clamp(2.5rem, 8vw, 4rem);
    line-height: 1.1;
    margin-bottom: 1.5em;
}

h3 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    line-height: 1.2;
    margin-bottom: 0.8em;
}

p {
    font-size: clamp(1rem, 2vw, 1.125rem);
    margin-bottom: 1.5em;
}

/* ============================================================
   SECTION BASE STYLES
   ============================================================ */

section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 4rem 2rem;
}

section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 0;
}

/* ============================================================
   HERO SECTION (Section 1)
   ============================================================ */

.hero-section {
    background-color: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    background: linear-gradient(135deg, transparent 0%, rgba(196, 116, 46, 0.03) 100%);
}

.hero-container {
    max-width: 900px;
    position: relative;
    z-index: 1;
    text-align: center;
    transform: skewY(-2deg);
}

.hero-title {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-style: italic;
    letter-spacing: 0.08em;
}

.hero-subtitle {
    font-size: clamp(1.25rem, 3vw, 2rem);
    color: var(--text-secondary);
    font-family: 'Space Mono', monospace;
    letter-spacing: 0.05em;
    font-weight: 400;
    margin-bottom: 2rem;
}

.hero-divider {
    width: 200px;
    height: 2px;
    background-color: var(--accent);
    margin: 2rem auto;
    transform: skewX(-15deg);
}

.hero-tagline {
    font-size: clamp(1.125rem, 2.5vw, 1.5rem);
    color: var(--text-primary);
    font-style: italic;
    letter-spacing: 0.03em;
}

.hero-diagram {
    position: absolute;
    width: 280px;
    height: 210px;
    right: 5%;
    top: 15%;
    opacity: 0.25;
    transform: rotate(-12deg);
    animation: float-slow 6s ease-in-out infinite;
}

/* ============================================================
   CASE STUDIES SECTION (Section 2)
   ============================================================ */

.cases-section {
    background-color: var(--bg-secondary);
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 6rem 2rem;
}

.cases-section::before {
    background: linear-gradient(to bottom, rgba(196, 116, 46, 0.02), rgba(196, 116, 46, 0.05));
}

.cases-heading {
    text-align: center;
    margin-bottom: 4rem;
    position: relative;
    z-index: 1;
    width: 100%;
}

.case-study {
    max-width: 800px;
    margin: 0 auto 5rem;
    padding: 3rem 3rem;
    background-color: var(--bg-primary);
    border-left: 4px solid var(--accent);
    transform: skewX(-3deg);
    position: relative;
    z-index: 1;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.case-header {
    margin-bottom: 2rem;
}

.case-title {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.case-date {
    font-family: 'Space Mono', monospace;
    font-size: 0.95rem;
    color: var(--accent);
    letter-spacing: 0.05em;
}

.case-diagram {
    width: 200px;
    height: 140px;
    float: right;
    margin: 0 0 1.5rem 2rem;
    opacity: 0.8;
}

.case-description {
    font-size: clamp(1rem, 1.8vw, 1.1rem);
    line-height: 1.8;
    clear: both;
    margin-bottom: 1.5rem;
}

.case-metrics {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--bg-secondary);
}

.metric {
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
    color: var(--accent-dark);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

/* ============================================================
   ANALYSIS SECTION (Section 3)
   ============================================================ */

.analysis-section {
    background-color: var(--bg-primary);
    flex-direction: column;
    padding: 6rem 2rem;
}

.analysis-section::before {
    background: linear-gradient(to bottom, transparent, rgba(196, 116, 46, 0.02));
}

.analysis-heading {
    text-align: center;
    width: 100%;
    margin-bottom: 4rem;
    position: relative;
    z-index: 1;
}

.analysis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 3rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    position: relative;
    z-index: 1;
}

.analysis-card {
    padding: 2.5rem;
    background-color: var(--bg-secondary);
    position: relative;
    transform: skewY(-1deg);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.analysis-card:hover {
    transform: skewY(-1deg) translateY(-8px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.card-title {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.card-body {
    font-size: 1rem;
    line-height: 1.75;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.card-accent-line {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(to right, var(--accent) 0%, transparent 100%);
    transform: skewX(-15deg);
}

/* ============================================================
   CONCLUSION SECTION (Section 4)
   ============================================================ */

.conclusion-section {
    background-color: var(--bg-secondary);
    flex-direction: column;
    padding: 6rem 2rem;
}

.conclusion-section::before {
    background: linear-gradient(135deg, rgba(196, 116, 46, 0.03) 0%, transparent 100%);
}

.conclusion-container {
    max-width: 900px;
    text-align: center;
    margin-bottom: 4rem;
    position: relative;
    z-index: 1;
}

.conclusion-heading {
    margin-bottom: 2rem;
    color: var(--text-primary);
}

.conclusion-text {
    font-size: clamp(1.05rem, 2vw, 1.25rem);
    line-height: 1.9;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.conclusion-divider {
    width: 180px;
    height: 2px;
    background-color: var(--accent);
    margin: 3rem auto;
    transform: skewX(-15deg);
}

.conclusion-diagram {
    width: 240px;
    height: 180px;
    margin: 0 auto;
    opacity: 0.3;
    animation: pulse-slow 4s ease-in-out infinite;
}

/* ============================================================
   SVG DIAGRAM STYLING
   ============================================================ */

.diagram-node {
    fill: var(--accent);
    transition: r 0.3s ease, fill 0.3s ease;
}

.diagram-line {
    stroke: var(--accent-dark);
    stroke-width: 1px;
    fill: none;
    transition: stroke-width 0.3s ease;
}

.diagram-accent {
    fill: var(--accent);
    opacity: 0.6;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */

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

@keyframes pulse-slow {
    0%, 100% {
        opacity: 0.25;
    }
    50% {
        opacity: 0.35;
    }
}

@keyframes slide-in-left {
    from {
        opacity: 0;
        transform: translateX(-40px) skewX(-5deg);
    }
    to {
        opacity: 1;
        transform: translateX(0) skewX(-5deg);
    }
}

@keyframes slide-in-right {
    from {
        opacity: 0;
        transform: translateX(40px) skewX(-5deg);
    }
    to {
        opacity: 1;
        transform: translateX(0) skewX(-5deg);
    }
}

@keyframes slide-reveal {
    from {
        opacity: 0;
        clip-path: inset(0 100% 0 0);
        transform: translateX(-60px);
    }
    to {
        opacity: 1;
        clip-path: inset(0 0 0 0);
        transform: translateX(0);
    }
}

/* ============================================================
   INTERSECTION OBSERVER ANIMATIONS
   ============================================================ */

/* IntersectionObserver triggers slide-reveal on blocks */
.case-study {
    opacity: 0;
    /* Use both animation patterns - slide-reveal for IntersectionObserver blocks */
    animation: slide-in-left 0.8s ease forwards, slide-reveal 0.8s ease forwards;
}

.case-study:nth-child(even) {
    animation: slide-in-right 0.8s ease forwards, slide-reveal 0.8s ease forwards;
}

.analysis-card {
    opacity: 0;
    animation: slide-in-left 0.6s ease forwards;
}

.analysis-card:nth-child(2n) {
    animation: slide-in-right 0.6s ease forwards;
}

/* ============================================================
   RESPONSIVE DESIGN
   ============================================================ */

@media (max-width: 768px) {
    section {
        padding: 3rem 1.5rem;
    }

    .hero-diagram {
        width: 180px;
        height: 135px;
        right: 2%;
        top: 20%;
    }

    .case-study {
        padding: 2rem;
        max-width: 100%;
    }

    .case-diagram {
        float: none;
        margin: 1.5rem 0;
        width: 160px;
        height: 110px;
    }

    .case-metrics {
        flex-direction: column;
        gap: 1rem;
    }

    .analysis-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .conclusion-diagram {
        width: 180px;
        height: 135px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 3.5rem;
    }

    h2 {
        font-size: 2rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    p {
        font-size: 1rem;
    }

    .hero-container {
        transform: skewY(-1deg);
    }

    .case-study {
        border-left-width: 3px;
    }

    .analysis-card {
        padding: 1.5rem;
    }
}

/* ============================================================
   PRINT STYLES (Optional)
   ============================================================ */

@media print {
    section {
        page-break-after: always;
        break-after: page;
    }

    .hero-diagram,
    .case-diagram,
    .conclusion-diagram {
        opacity: 0.2 !important;
    }
}
