/* thesecond.day - Generative Textbook */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --warm-cream: #FBF5F0;
    --parchment: #F5EDE5;
    --wine: #6A1830;
    --rose-wine: #9A3048;
    --vanilla: #E8D8C8;
    --book-rule: #C8B0A0;
    --text-primary: #2A1820;
    --text-body: #3A2830;
    --text-mono: #8A6870;
}
body {
    background: var(--warm-cream);
    color: var(--text-primary);
    font-family: 'Crimson Pro', serif;
    font-size: 1.0625rem;
    line-height: 1.85;
    font-weight: 400;
    overflow-x: hidden;
    position: relative;
}

/* Generative Canvas */
.generative-canvas {
    position: fixed;
    top: 0;
    right: 0;
    width: 30%;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
    opacity: 0.3;
}

/* Floating 3D Shapes */
.floating-shapes {
    position: fixed;
    top: 0;
    right: 5%;
    width: 20%;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
}
.shape-cube {
    position: absolute;
    top: 20%;
    right: 20%;
    width: 60px;
    height: 60px;
    background: var(--rose-wine);
    opacity: 0.1;
    transform: perspective(200px) rotateX(30deg) rotateY(45deg);
    animation: cubeRotate 20s linear infinite;
}
@keyframes cubeRotate {
    from { transform: perspective(200px) rotateX(30deg) rotateY(0deg); }
    to { transform: perspective(200px) rotateX(30deg) rotateY(360deg); }
}
.shape-sphere {
    position: absolute;
    bottom: 30%;
    right: 10%;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, var(--vanilla), var(--wine));
    opacity: 0.12;
    animation: sphereFloat 15s ease-in-out infinite;
}
@keyframes sphereFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

/* Content */
#content {
    max-width: 720px;
    margin-left: 15vw;
    margin-right: auto;
    padding: 4rem 2rem;
    position: relative;
    z-index: 1;
}

/* Chapter Sections */
.chapter {
    margin-bottom: clamp(4rem, 7vh, 8rem);
}
.day-title {
    font-family: 'Crimson Pro', serif;
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}
.day-subtitle {
    font-size: 1.1rem;
    color: var(--text-mono);
    font-style: italic;
    margin-top: 1rem;
}
.chapter-heading {
    font-family: 'Crimson Pro', serif;
    font-size: clamp(1.8rem, 3.5vw, 2.8rem);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}
.chapter-num {
    font-variant: small-caps;
    font-size: 0.7em;
    color: var(--wine);
    display: block;
    margin-bottom: 0.25rem;
    letter-spacing: 0.05em;
}
.chapter-body {
    font-size: 1.0625rem;
    color: var(--text-body);
    line-height: 1.85;
    margin-bottom: 1rem;
}

/* Code Blocks */
.code-block {
    border: 2px solid var(--book-rule);
    border-radius: 4px;
    background: var(--parchment);
    padding: 1.5rem;
    margin: 1.5rem 0;
    overflow-x: auto;
}
.code-label {
    font-family: 'Overpass Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.03em;
    color: var(--text-mono);
    display: block;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
}
.code-content {
    font-family: 'Overpass Mono', monospace;
    font-size: 0.8rem;
    color: var(--wine);
    line-height: 1.6;
    white-space: pre;
    display: block;
}

/* Margin Notes */
.margin-note {
    border-left: 2px solid var(--book-rule);
    padding-left: 1rem;
    margin: 1.5rem 0;
}
.note-text {
    font-family: 'Overpass Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-mono);
    line-height: 1.6;
}

/* Ornament Rule */
.ornament-rule {
    height: 1px;
    background: var(--book-rule);
    max-width: 400px;
    margin: 0 auto;
    position: relative;
}
.ornament-rule::after {
    content: '';
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 8px;
    height: 8px;
    border: 1px solid var(--book-rule);
    background: var(--warm-cream);
}

/* Section Animation */
.section {
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.section.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Footer */
#footer {
    max-width: 720px;
    margin-left: 15vw;
    padding: 3rem 2rem;
    border-top: 1px solid var(--book-rule);
    position: relative;
    z-index: 1;
}
.footer-text {
    font-family: 'Overpass Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-mono);
    letter-spacing: 0.03em;
}

/* Responsive */
@media (max-width: 900px) {
    #content {
        margin-left: auto;
        margin-right: auto;
        padding: 3rem 1.5rem;
    }
    #footer {
        margin-left: auto;
        margin-right: auto;
    }
    .generative-canvas { display: none; }
    .floating-shapes { display: none; }
}
