/* ============================================
   yesan.xyz — Candlelit Editorial Chamber
   ============================================ */

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

:root {
    --soot: #1F1A14;
    --deep-umber: #2A2218;
    --parchment-light: #F2E8D5;
    --warm-parchment: #C4B8A4;
    --amber-flame: #D4A44A;
    --burnt-sienna: #A86B3D;
    --tallow: #E8D5A8;
    --dark-umber-text: #3D3428;
    --candle-core: #F5D98A;
}

html {
    scroll-behavior: smooth;
    scroll-snap-type: y proximity;
}

body {
    background: var(--soot);
    color: var(--parchment-light);
    font-family: 'Source Sans 3', 'Inter', sans-serif;
    font-weight: 400;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Paper grain overlay */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='5'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
    opacity: 0.4;
}

.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* --- Sections --- */
.section {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    scroll-snap-align: start;
}

/* --- Candle Glows --- */
.candle-glow {
    position: absolute;
    pointer-events: none;
    border-radius: 50%;
}

.chamber-glow {
    width: 120vmax;
    height: 120vmax;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(ellipse at 50% 50%, rgba(245,217,138,0.25) 0%, rgba(212,164,74,0.08) 35%, rgba(31,26,20,0) 65%);
    opacity: 0;
    animation: glow-in 1.2s ease-out 0.6s forwards;
}

.ledger-glow {
    width: 80vmax;
    height: 80vmax;
    top: 30%;
    left: 60%;
    transform: translate(-50%, -50%);
    background: radial-gradient(ellipse at 50% 40%, rgba(245,217,138,0.12) 0%, rgba(212,164,74,0.04) 40%, rgba(31,26,20,0) 65%);
    opacity: 1;
}

.allocation-glow {
    width: 60vmax;
    height: 60vmax;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(ellipse at 50% 50%, rgba(245,217,138,0.15) 0%, rgba(212,164,74,0.05) 40%, rgba(31,26,20,0) 60%);
}

.deliberation-glow {
    width: 70vmax;
    height: 70vmax;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(ellipse at 50% 50%, rgba(245,217,138,0.1) 0%, rgba(212,164,74,0.03) 45%, rgba(31,26,20,0) 65%);
}

.seal-glow {
    width: 140vmax;
    height: 140vmax;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(ellipse at 50% 50%, rgba(245,217,138,0.35) 0%, rgba(212,164,74,0.15) 45%, rgba(31,26,20,0) 75%);
}

/* --- Keyframes --- */
@keyframes glow-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes chevron-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(8px); }
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.88; }
}

@keyframes ripple {
    0% { transform: scale(0.8); opacity: 0.25; }
    100% { transform: scale(2.5); opacity: 0; }
}

@keyframes seal-turn {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes band-enter {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

/* --- Section 1: The Chamber --- */
#chamber {
    background: var(--soot);
}

.chamber-content {
    text-align: center;
    z-index: 2;
    opacity: 0;
    animation: fade-in 1s ease-out 1.8s forwards;
}

.hero-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: clamp(4rem, 12vw, 10rem);
    letter-spacing: -0.02em;
    color: var(--parchment-light);
    line-height: 1.1;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 1rem;
    font-weight: 400;
    color: var(--warm-parchment);
    opacity: 0;
    animation: fade-in 0.8s ease-out 2.6s forwards;
}

.scroll-chevron {
    position: absolute;
    bottom: 2rem;
    z-index: 2;
    animation: chevron-bounce 2s ease-in-out infinite, flicker 3s ease-in-out infinite;
    opacity: 0;
    animation: chevron-bounce 2s ease-in-out infinite, fade-in 0.6s ease-out 3.4s forwards;
}

/* --- Section 2: The Ledger --- */
#ledger {
    background: var(--soot);
    padding: 4rem 2rem;
}

.ruled-lines-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    background-image: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent calc(2rem - 1px),
        rgba(42, 34, 24, 0.3) 2rem
    );
    will-change: transform;
}

.ledger-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    max-width: 1100px;
    width: 100%;
    z-index: 2;
    position: relative;
}

.ledger-text {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.72;
    color: var(--warm-parchment);
    text-align: justify;
}

.ledger-text p {
    margin-bottom: 1.5rem;
}

.drop-cap::first-letter {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    float: left;
    font-size: 4.5rem;
    line-height: 0.8;
    margin-right: 0.5rem;
    margin-top: 0.1rem;
    color: var(--amber-flame);
}

.ledger-figures {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2rem;
}

.figure-item {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 1rem 0;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.figure-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.figure-item::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--amber-flame);
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0;
    pointer-events: none;
}

.figure-item.ripple-active::after {
    animation: ripple 1.2s ease-out forwards;
}

.figure-label {
    font-family: 'DM Mono', monospace;
    font-weight: 400;
    font-size: 0.8rem;
    color: var(--burnt-sienna);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.25rem;
}

.figure-number {
    font-family: 'DM Mono', monospace;
    font-weight: 500;
    font-size: clamp(1.8rem, 3vw, 2.8rem);
    color: var(--amber-flame);
}

/* --- Section 3: The Allocation --- */
#allocation {
    background: var(--deep-umber);
    padding: 4rem 2rem;
}

.section-heading {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(1.8rem, 4vw, 3.2rem);
    letter-spacing: -0.02em;
    color: var(--parchment-light);
    margin-bottom: 3rem;
    z-index: 2;
}

.allocation-bands {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 2;
}

.band {
    height: 3.2rem;
    background: var(--band-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
    overflow: hidden;
}

.band.visible {
    transform: scaleX(1);
}

.band-label {
    font-family: 'DM Mono', monospace;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--soot);
    white-space: nowrap;
}

.band-pct {
    font-family: 'DM Mono', monospace;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--soot);
}

/* --- Section 4: The Deliberation --- */
#deliberation {
    background: var(--soot);
    padding: 6rem 2rem;
    scroll-snap-type: y proximity;
}

.deliberation-content {
    max-width: 640px;
    width: 100%;
    z-index: 2;
    position: relative;
}

.deliberation-content > p {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: 1.05rem;
    line-height: 1.78;
    color: var(--warm-parchment);
    margin-bottom: 2.5rem;
}

.pull-quote {
    position: relative;
    margin: 2.5rem 0;
    padding: 1.5rem 0;
}

.pull-quote-glow {
    position: absolute;
    width: 160px;
    height: 160px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(ellipse at 50% 50%, rgba(245,217,138,0.12) 0%, rgba(31,26,20,0) 70%);
    pointer-events: none;
}

.pull-quote blockquote {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-style: italic;
    font-size: clamp(1.3rem, 2.5vw, 1.8rem);
    color: var(--tallow);
    text-align: center;
    position: relative;
    z-index: 1;
}

/* --- Section 5: The Seal --- */
#seal {
    background: var(--soot);
}

.seal-content {
    text-align: center;
    z-index: 2;
}

.seal-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: clamp(4rem, 12vw, 10rem);
    letter-spacing: -0.02em;
    color: var(--amber-flame);
    line-height: 1.1;
    margin-bottom: 1rem;
}

.seal-subtitle {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--warm-parchment);
    margin-bottom: 3rem;
}

.wax-seal {
    animation: seal-turn 20s linear infinite, flicker 3s ease-in-out infinite;
}

/* --- Scroll Indicator --- */
.scroll-indicator {
    position: fixed;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 100;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--burnt-sienna);
    cursor: pointer;
    transition: background 0.3s, transform 0.3s;
    animation: flicker 3s ease-in-out infinite;
}

.dot.active {
    background: var(--candle-core);
    transform: scale(1.4);
}

/* Ink blot transitions between sections */
.section::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 16px;
    background: var(--dark-umber-text);
    border-radius: 40% 60% 50% 50%;
    opacity: 0.4;
}

/* Ruled margins */
.ledger-grid::before,
.ledger-grid::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(42, 34, 24, 0.25);
}

.ledger-grid::before { left: 0; }
.ledger-grid::after { right: 0; }

/* --- Responsive --- */
@media (max-width: 768px) {
    .ledger-grid {
        grid-template-columns: 1fr;
        padding: 0 1rem;
    }

    .pull-quote {
        position: relative;
        right: auto;
        width: 100%;
    }

    .scroll-indicator {
        right: 0.75rem;
    }
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
