/* ===========================================
   op9.rs - Painted Terminal for Rust
   Aesthetic: Dopamine + Muted Vintage
   Layout: Hero-Dominant + Single Column
   =========================================== */

/* ---- CSS Custom Properties ---- */
:root {
    --parchment-cream: #f8f4ed;
    --charcoal-ink: #3a3632;
    --warm-stone: #7d746a;
    --dusty-rose: #c4908a;
    --sage-mist: #9aab8e;
    --faded-goldenrod: #d4b87a;
    --vintage-denim: #7b9bb4;
    --walnut-shadow: #2e2a26;
    --aged-linen: #f4efe7;

    --rose-wash: rgba(196, 144, 138, 0.12);
    --sage-wash: rgba(154, 171, 142, 0.10);
    --gold-wash: rgba(212, 184, 122, 0.09);
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw, 1.15rem);
    line-height: 1.72;
    color: var(--charcoal-ink);
    background-color: var(--parchment-cream);
    overflow-x: hidden;
}

/* ---- Typography ---- */
h1, h2, h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--charcoal-ink);
}

code {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 0.92em;
    background: var(--aged-linen);
    padding: 0.15em 0.4em;
    border-radius: 3px;
    color: var(--walnut-shadow);
}

/* ---- Hero Section ---- */
.hero {
    position: relative;
    display: grid;
    grid-template-rows: 1fr auto auto 1fr;
    height: 100vh;
    min-height: 600px;
    place-items: center;
    overflow: hidden;
    background-color: var(--parchment-cream);
}

/* Watercolor wash layers */
.wash {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 1s ease-out;
    pointer-events: none;
    transform: scale(0.8);
}

.wash.visible {
    opacity: 1;
    transform: scale(1);
    transition: opacity 2s ease-out, transform 2s ease-out;
}

.wash-rose {
    background: radial-gradient(ellipse at 30% 40%, rgba(196, 144, 138, 0.15) 0%, transparent 70%);
}

.wash-sage {
    background: radial-gradient(ellipse at 70% 60%, rgba(154, 171, 142, 0.12) 0%, transparent 65%);
}

.wash-gold {
    background: radial-gradient(ellipse at 50% 30%, rgba(212, 184, 122, 0.11) 0%, transparent 75%);
}

/* Hero content */
.hero-content {
    grid-row: 2 / 4;
    text-align: center;
    z-index: 2;
    position: relative;
}

.hero-title-wrapper,
.hero-subtitle-wrapper {
    position: relative;
    display: inline-block;
}

.hero-title {
    font-size: clamp(4rem, 12vw, 9rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.05;
    background: linear-gradient(135deg, var(--dusty-rose), var(--faded-goldenrod), var(--sage-mist));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    opacity: 0;
    transition: opacity 0.8s ease-out;
}

.hero-title.revealed {
    opacity: 1;
}

.hero-subtitle {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 2vw, 1.35rem);
    color: var(--warm-stone);
    margin-top: 1rem;
    opacity: 0;
    transition: opacity 0.8s ease-out;
}

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

.hero-brushstroke {
    display: block;
    width: clamp(200px, 40vw, 400px);
    height: 4px;
    margin: 1.5rem auto 0;
    opacity: 0;
    transition: opacity 0.6s ease-out;
}

.hero-brushstroke.revealed {
    opacity: 1;
}

.hero-brushstroke line {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    transition: stroke-dashoffset 1.2s ease-out;
}

.hero-brushstroke.revealed line {
    stroke-dashoffset: 0;
}

/* Skeleton loading */
.skeleton {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 8px;
    overflow: hidden;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.6s ease-out;
}

.skeleton.hidden {
    opacity: 0;
}

.skeleton-title {
    width: clamp(250px, 60vw, 550px);
    height: clamp(50px, 12vw, 110px);
    background: radial-gradient(ellipse at 30% 50%, var(--rose-wash) 0%, var(--aged-linen) 100%);
}

.skeleton-subtitle {
    width: clamp(200px, 50vw, 420px);
    height: 1.6rem;
    background: radial-gradient(ellipse at 60% 50%, var(--sage-wash) 0%, var(--aged-linen) 100%);
}

.skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 30%, rgba(212, 184, 122, 0.15) 50%, transparent 70%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

.skeleton.hidden::after {
    animation: none;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Content section skeletons */
.content-section .skeleton {
    position: relative;
    left: 0;
    transform: none;
    margin-bottom: 0.8rem;
    display: block;
}

.content-section .skeleton.hidden {
    display: none;
}

.skeleton-heading {
    width: 60%;
    height: 2.4rem;
    background: var(--aged-linen);
    border-radius: 6px;
}

.skeleton-text {
    width: 100%;
    height: 1.2rem;
    background: var(--aged-linen);
    border-radius: 4px;
}

.skeleton-text.short {
    width: 75%;
}

/* Code snippet chips - floating in hero */
.code-chips {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.chip {
    position: absolute;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    background: var(--walnut-shadow);
    color: var(--sage-mist);
    padding: 0.3em 0.7em;
    border-radius: 4px;
    opacity: 0;
    white-space: nowrap;
    transition: opacity 0.8s ease-out;
}

.chip.floating {
    opacity: 0.7;
}

.chip:nth-child(1) { top: 12%; left: -100px; }
.chip:nth-child(2) { top: 22%; right: -100px; }
.chip:nth-child(3) { top: 35%; left: -100px; }
.chip:nth-child(4) { top: 48%; right: -100px; }
.chip:nth-child(5) { top: 58%; left: -100px; }
.chip:nth-child(6) { top: 68%; right: -100px; }
.chip:nth-child(7) { top: 78%; left: -100px; }
.chip:nth-child(8) { top: 88%; right: -100px; }
.chip:nth-child(9) { top: 8%; left: -100px; }
.chip:nth-child(10) { top: 42%; right: -100px; }
.chip:nth-child(11) { top: 73%; left: -100px; }
.chip:nth-child(12) { top: 15%; right: -100px; }

/* Watercolor orbs */
.orb {
    position: absolute;
    border-radius: 42% 58% 63% 37% / 55% 38% 62% 45%;
    z-index: 0;
    pointer-events: none;
    animation: orbMorph 15s ease-in-out infinite alternate, orbFloat 8s ease-in-out infinite;
}

.orb-1 {
    width: 80px;
    height: 80px;
    top: 15%;
    left: 8%;
    background: radial-gradient(circle, rgba(196, 144, 138, 0.15) 0%, transparent 70%);
    box-shadow: inset 0 0 40px rgba(196, 144, 138, 0.08), 0 0 60px rgba(196, 144, 138, 0.05);
    animation-delay: 0s, 0s;
}

.orb-2 {
    width: 50px;
    height: 50px;
    top: 70%;
    right: 12%;
    background: radial-gradient(circle, rgba(154, 171, 142, 0.15) 0%, transparent 70%);
    box-shadow: inset 0 0 30px rgba(154, 171, 142, 0.08), 0 0 40px rgba(154, 171, 142, 0.05);
    animation-delay: -3s, -2s;
}

.orb-3 {
    width: 60px;
    height: 60px;
    top: 30%;
    right: 20%;
    background: radial-gradient(circle, rgba(212, 184, 122, 0.12) 0%, transparent 70%);
    box-shadow: inset 0 0 35px rgba(212, 184, 122, 0.06), 0 0 50px rgba(212, 184, 122, 0.04);
    animation-delay: -5s, -4s;
}

.orb-4 {
    width: 40px;
    height: 40px;
    bottom: 20%;
    left: 15%;
    background: radial-gradient(circle, rgba(123, 155, 180, 0.12) 0%, transparent 70%);
    box-shadow: inset 0 0 25px rgba(123, 155, 180, 0.06), 0 0 35px rgba(123, 155, 180, 0.04);
    animation-delay: -7s, -1s;
}

.orb-5 {
    width: 35px;
    height: 35px;
    top: 55%;
    left: 25%;
    background: radial-gradient(circle, rgba(196, 144, 138, 0.10) 0%, transparent 70%);
    box-shadow: inset 0 0 20px rgba(196, 144, 138, 0.05), 0 0 30px rgba(196, 144, 138, 0.03);
    animation-delay: -9s, -6s;
}

@keyframes orbMorph {
    0% { border-radius: 42% 58% 63% 37% / 55% 38% 62% 45%; }
    33% { border-radius: 55% 45% 38% 62% / 48% 60% 40% 52%; }
    66% { border-radius: 38% 62% 50% 50% / 60% 42% 58% 38%; }
    100% { border-radius: 48% 52% 45% 55% / 42% 55% 45% 58%; }
}

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

/* ---- Main Content ---- */
.content-wrapper {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 clamp(1.5rem, 5vw, 4rem);
    position: relative;
}

.content-section {
    padding-top: 8rem;
    position: relative;
}

.content-section:first-child {
    padding-top: 4rem;
}

.section-inner {
    position: relative;
}

.section-heading {
    font-size: clamp(1.8rem, 4vw, 3rem);
    letter-spacing: -0.02em;
    margin-bottom: 1.5rem;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.section-heading.revealed {
    opacity: 1;
    transform: translateY(0);
}

.section-text {
    max-width: 65ch;
    margin-bottom: 1.5rem;
    color: var(--charcoal-ink);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.section-text.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Code Blocks ---- */
.code-block {
    margin: 2rem 0;
    border-radius: 8px;
    overflow: hidden;
    background: var(--aged-linen);
    border-left: 2px solid var(--dusty-rose);
    position: relative;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.code-block.revealed {
    opacity: 1;
    transform: translateY(0);
}

.code-block::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.4s ease-out;
    pointer-events: none;
    border-radius: 8px;
}

.code-block:hover::before {
    background: radial-gradient(ellipse at 50% 50%, rgba(196, 144, 138, 0.06) 0%, transparent 70%);
    opacity: 1;
}

.code-header {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid rgba(125, 116, 106, 0.1);
}

.code-filename {
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: 0.8rem;
    color: var(--warm-stone);
}

.code-body {
    padding: 1rem;
    overflow-x: auto;
}

.code-line {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.7;
    white-space: pre;
    display: block;
}

.line-number {
    display: inline-block;
    width: 2.5em;
    text-align: right;
    margin-right: 1.2em;
    color: var(--sage-mist);
    opacity: 0.6;
    user-select: none;
}

/* Syntax highlighting with palette colors */
.keyword { color: var(--vintage-denim); }
.string { color: var(--dusty-rose); }
.comment { color: var(--warm-stone); opacity: 0.7; }
.function { color: var(--faded-goldenrod); }
.number { color: var(--sage-mist); }

/* ---- Annotations ---- */
.annotation {
    position: absolute;
    top: 10rem;
    right: -240px;
    width: 200px;
    padding: 1rem;
    border: 1px solid rgba(212, 184, 122, 0.4);
    border-radius: 8px;
    background: radial-gradient(ellipse at 50% 50%, rgba(196, 144, 138, 0.08) 0%, var(--parchment-cream) 100%);
    font-size: 0.85rem;
    color: var(--warm-stone);
    line-height: 1.55;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 5;
}

.annotation.visible {
    opacity: 1;
    transform: translateX(0);
}

.annotation-pointer {
    position: absolute;
    left: -8px;
    top: 1.2rem;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 8px solid rgba(212, 184, 122, 0.4);
}

.annotation p {
    margin: 0;
}

.annotation code {
    font-size: 0.8em;
    padding: 0.1em 0.3em;
}

/* ---- Brushstroke Dividers ---- */
.brushstroke-divider {
    position: relative;
    width: 120%;
    margin-left: -10%;
    height: 20px;
    margin-top: 3rem;
    transform: rotate(-0.5deg);
}

.brushstroke-line {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent 0%, var(--dusty-rose) 20%, var(--dusty-rose) 80%, transparent 100%);
    opacity: 0.5;
}

.brushstroke-edge {
    position: absolute;
    top: 50%;
    left: 5%;
    right: 5%;
    height: 3px;
    clip-path: polygon(0% 30%, 8% 70%, 15% 20%, 25% 80%, 35% 40%, 45% 60%, 55% 25%, 65% 75%, 75% 35%, 85% 65%, 92% 30%, 100% 50%);
    background: var(--dusty-rose);
    opacity: 0.3;
    transform: translateY(-1px);
}

/* ---- Footer ---- */
.footer {
    background: var(--walnut-shadow);
    padding: 4rem 2rem;
    text-align: center;
    margin-top: 8rem;
    position: relative;
    overflow: hidden;
}

.footer-inner {
    position: relative;
    z-index: 1;
}

.footer-text {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.8rem;
    letter-spacing: -0.02em;
    color: var(--parchment-cream);
    opacity: 0.9;
}

.footer-caption {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    color: var(--warm-stone);
    margin-top: 0.5rem;
}

.footer-orb {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.footer-orb-1 {
    width: 120px;
    height: 120px;
    top: -30px;
    left: 15%;
    background: radial-gradient(circle, rgba(196, 144, 138, 0.1) 0%, transparent 70%);
    animation: orbFloat 10s ease-in-out infinite;
}

.footer-orb-2 {
    width: 80px;
    height: 80px;
    bottom: -20px;
    right: 20%;
    background: radial-gradient(circle, rgba(154, 171, 142, 0.08) 0%, transparent 70%);
    animation: orbFloat 12s ease-in-out infinite;
    animation-delay: -4s;
}

/* ---- Responsive / Narrow Viewports ---- */
@media (max-width: 1100px) {
    .annotation {
        position: relative;
        top: auto;
        right: auto;
        width: 100%;
        margin-top: 1.5rem;
        margin-bottom: 1rem;
        transform: none;
        opacity: 0;
        border-left: 3px solid rgba(212, 184, 122, 0.5);
        border-top: none;
        border-right: none;
        border-bottom: none;
        border-radius: 0 8px 8px 0;
    }

    .annotation.visible {
        transform: none;
    }

    .annotation-pointer {
        display: none;
    }
}

@media (max-width: 600px) {
    .chip {
        font-size: 0.65rem;
        padding: 0.2em 0.5em;
    }

    .code-line {
        font-size: 0.75rem;
    }

    .line-number {
        width: 2em;
        margin-right: 0.8em;
    }

    .brushstroke-divider {
        width: 110%;
        margin-left: -5%;
    }

    .content-section {
        padding-top: 5rem;
    }
}
