/* lovable.dev - Design Language Stylesheet */
/* Monochrome manuscript aesthetic with ma negative-space layout */

:root {
    --void: #0a0a0a;
    --folio-bg: #111111;
    --parchment: #1a1a1a;
    --ink-faded: #3a3a3a;
    --ink-medium: #6e6e6e;
    --ink-body: #a0a0a0;
    --ink-display: #d4d4d4;
    --vellum: #e8e8e8;
    --candlelight: #f5f0e8;
    --ink-annotation: #5a5a5a;
    --ink-bright: #b0b0b0;
    --white: #FFFFFF;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--void);
    color: var(--ink-body);
    font-family: 'Lora', serif;
    font-weight: 400;
    font-size: 17px;
    letter-spacing: 0.01em;
    line-height: 1.75;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Paper grain texture via repeating background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.02;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-size: 256px 256px;
}

/* Candle flash overlay */
#candle-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--candlelight);
    z-index: 9999;
    pointer-events: none;
    animation: candleOut 1.5s cubic-bezier(0.4, 0, 0.2, 1) 0.1s forwards;
}

@keyframes candleOut {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* Scroll progress indicator */
#scroll-progress {
    position: fixed;
    left: 0;
    top: 0;
    width: 4px;
    height: 100vh;
    z-index: 100;
    opacity: 0;
    animation: fadeInProgress 0.5s ease 2.1s forwards;
}

@keyframes fadeInProgress {
    to { opacity: 1; }
}

#scroll-progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 0%;
    background: linear-gradient(to bottom, var(--ink-faded), #b0b0b0);
    transition: height 0.1s linear;
}

#scroll-progress-tip {
    position: absolute;
    left: -1px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--candlelight);
    top: 0%;
    transition: top 0.1s linear;
    box-shadow: 0 0 8px rgba(245, 240, 232, 0.4);
}

/* Edge ornament */
.edge-ornament {
    position: fixed;
    left: 0;
    top: 0;
    width: 16px;
    height: 100vh;
    z-index: 50;
    opacity: 0.15;
    transition: opacity 0.8s ease;
    color: var(--ink-faded);
}

.edge-ornament:hover {
    opacity: 0.6;
}

/* Quill thread SVG */
#quill-thread {
    position: fixed;
    top: 0;
    left: 0;
    width: 300px;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    animation: fadeInProgress 0.5s ease 2.1s forwards;
}

#quill-path {
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Folio sections */
.folio {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 10vh 5% 10vh 20%;
    background-color: var(--folio-bg);
}

.folio-label {
    display: block;
    font-family: 'EB Garamond', serif;
    font-style: italic;
    font-variant: small-caps;
    font-size: 10px;
    color: var(--ink-annotation);
    letter-spacing: 0.15em;
    margin-bottom: 12px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1.2s cubic-bezier(0.25, 0.1, 0.25, 1), transform 1.2s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.folio.visible .folio-label {
    opacity: 1;
    transform: translateY(0);
}

.folio-content {
    max-width: 38em;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1.2s cubic-bezier(0.25, 0.1, 0.25, 1) 0.3s, transform 1.2s cubic-bezier(0.25, 0.1, 0.25, 1) 0.3s;
}

.folio.visible .folio-content {
    opacity: 1;
    transform: translateY(0);
}

/* Illuminated initials */
.illuminated-initial {
    margin-bottom: 24px;
    opacity: 0;
    transition: opacity 0.8s ease 0.5s;
}

.folio.visible .illuminated-initial {
    opacity: 1;
}

.illuminated-initial svg {
    overflow: visible;
}

.ornament-path {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 3s cubic-bezier(0.4, 0, 0.2, 1);
}

.folio.visible .ornament-path {
    stroke-dashoffset: 0;
}

.initial-letter {
    transition: opacity 0.8s ease 2.5s;
}

.folio.visible .initial-letter {
    opacity: 1;
}

/* Headlines */
.folio-headline {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(48px, 7vw, 120px);
    color: var(--ink-display);
    letter-spacing: 0.04em;
    line-height: 1.05;
    text-transform: lowercase;
    margin-bottom: 32px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1.2s cubic-bezier(0.25, 0.1, 0.25, 1) 0.6s, transform 1.2s cubic-bezier(0.25, 0.1, 0.25, 1) 0.6s;
}

.folio.visible .folio-headline {
    opacity: 1;
    transform: translateY(0);
}

/* Body text */
.folio-body {
    font-family: 'Lora', serif;
    font-weight: 400;
    font-size: 17px;
    color: var(--ink-body);
    line-height: 1.75;
    letter-spacing: 0.01em;
    max-width: 38em;
    margin-bottom: 24px;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 1.2s cubic-bezier(0.25, 0.1, 0.25, 1) 1.2s, transform 1.2s cubic-bezier(0.25, 0.1, 0.25, 1) 1.2s;
}

.folio.visible .folio-body {
    opacity: 1;
    transform: translateY(0);
}

/* Text rules */
.text-rule {
    border: none;
    height: 0.5px;
    background-color: #2a2a2a;
    max-width: 38em;
    margin: 0;
    opacity: 0;
    transition: opacity 1s ease 1.8s;
}

.folio.visible .text-rule {
    opacity: 1;
}

/* Marginalia */
.marginalia {
    position: absolute;
    right: 5%;
    writing-mode: vertical-rl;
    font-family: 'EB Garamond', serif;
    font-style: italic;
    font-size: 11px;
    color: var(--ink-medium);
    opacity: 0;
    transition: opacity 2s ease 1.5s;
    line-height: 1.5;
}

.folio.visible .marginalia {
    opacity: 1;
}

.mono-accent {
    font-family: 'Fira Code', monospace;
    font-weight: 300;
    font-size: 13px;
    color: var(--ink-medium);
    font-style: normal;
}

/* Constellation voids */
.constellation-void {
    height: 30vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--void);
    position: relative;
}

.final-void {
    height: 50vh;
}

.constellation {
    width: 60%;
    max-width: 500px;
    height: auto;
    opacity: 0.6;
}

/* Constellation breathing dots */
.constellation-dot {
    animation: breathe 4s ease-in-out infinite;
    animation-delay: var(--delay);
}

@keyframes breathe {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .folio {
        padding: 8vh 8% 8vh 10%;
    }

    .folio-headline {
        font-size: clamp(32px, 10vw, 64px);
    }

    .marginalia {
        right: 2%;
        font-size: 9px;
    }

    .constellation {
        width: 80%;
    }

    .illuminated-initial svg {
        width: 120px;
        height: 120px;
    }
}

@media (max-width: 480px) {
    .folio {
        padding: 6vh 6% 6vh 8%;
    }

    .folio-headline {
        font-size: clamp(28px, 12vw, 48px);
    }

    .folio-body {
        font-size: 15px;
    }

    .marginalia {
        display: none;
    }
}

/* Selection styling */
::selection {
    background-color: var(--ink-faded);
    color: #FFFFFF;
}
