/* ==========================================================================
   multipledger.com - Celestial Almanac of Accounts
   Cottagecore Celestial Aesthetic | Ethereal Blue Palette
   ========================================================================== */

/* CSS Custom Properties */
:root {
    --deep-night: #0d1b2a;
    --twilight-indigo: #1b2838;
    --constellation-blue: #c8d5e3;
    --ledger-ink: #e8eff5;
    --pressed-lavender: #7b8fa8;
    --tallow-flame: #d4a54a;
    --linen-cream: #f0ead6;
    --spine-shadow: #4a5d7a;
    --soft-lavender: #a3b5c8;
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: var(--deep-night);
    color: var(--constellation-blue);
    font-family: 'Crimson Text', Georgia, serif;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.85;
    overflow-x: hidden;
}

/* Hidden SVG Defs */
.svg-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ==========================================================================
   LEATHER EDGE STRIPS
   ========================================================================== */

.leather-edge {
    position: fixed;
    left: 0;
    right: 0;
    height: 8px;
    z-index: 100;
    background: linear-gradient(
        90deg,
        var(--spine-shadow) 0%,
        rgba(74, 93, 122, 0.6) 20%,
        var(--spine-shadow) 40%,
        rgba(74, 93, 122, 0.5) 60%,
        var(--spine-shadow) 80%,
        rgba(74, 93, 122, 0.7) 100%
    );
    filter: url(#leather-grain);
}

.leather-edge--top {
    top: 0;
}

.leather-edge--bottom {
    position: fixed;
    bottom: 0;
}

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

.spread-title {
    font-family: 'Bebas Neue', 'Arial Narrow', sans-serif;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: clamp(3rem, 8vw, 6rem);
    color: var(--ledger-ink);
    margin-bottom: 2rem;
}

.cover-title {
    font-family: 'Bebas Neue', 'Arial Narrow', sans-serif;
    font-weight: 400;
    text-transform: lowercase;
    letter-spacing: 0.15em;
    font-size: clamp(3.5rem, 10vw, 7rem);
    color: var(--ledger-ink);
    line-height: 1;
}

.cover-subtitle {
    font-family: 'Crimson Text', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: var(--pressed-lavender);
    margin-top: 1.5rem;
    letter-spacing: 0.05em;
}

.body-text {
    font-family: 'Crimson Text', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.85;
    color: var(--constellation-blue);
    margin-bottom: 1.5em;
    max-width: 380px;
}

.mono-value {
    font-family: 'IBM Plex Mono', 'Courier New', monospace;
    font-weight: 300;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

/* Small caps for labels */
.star-label {
    font-family: 'Crimson Text', Georgia, serif;
    font-weight: 600;
    font-variant: small-caps;
    letter-spacing: 0.08em;
    font-size: 11px;
    fill: var(--pressed-lavender);
    text-anchor: middle;
}

.star-label-secondary {
    fill: #a3b5c8;
}

.constellation-name {
    font-family: 'Crimson Text', Georgia, serif;
    font-weight: 600;
    font-variant: small-caps;
    letter-spacing: 0.08em;
    font-size: 14px;
    fill: var(--tallow-flame);
    text-anchor: middle;
}

/* ==========================================================================
   SPREADS - GENERAL LAYOUT
   ========================================================================== */

.spread {
    min-height: 100vh;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spread-pages {
    display: flex;
    width: 100%;
    max-width: 1200px;
    min-height: 100vh;
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
}

.page {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 4rem 2rem;
}

.page--left {
    align-items: flex-start;
    position: relative;
}

.page--right {
    align-items: center;
    justify-content: center;
}

.gutter-line {
    width: 1px;
    background-color: var(--spine-shadow);
    opacity: 0.4;
    align-self: stretch;
    margin: 4rem 0;
}

/* ==========================================================================
   SPREAD 1 - THE COVER
   ========================================================================== */

.spread--cover {
    background-color: var(--deep-night);
    justify-content: flex-start;
    align-items: center;
}

.cover-content {
    position: relative;
    z-index: 2;
    padding-left: 10vw;
    width: 100%;
    max-width: 1200px;
}

/* Star field - CSS-only radial gradients */
.star-field {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    background-image:
        radial-gradient(1px 1px at 10% 15%, var(--constellation-blue) 50%, transparent 100%),
        radial-gradient(2px 2px at 25% 30%, rgba(200, 213, 227, 0.7) 50%, transparent 100%),
        radial-gradient(1px 1px at 40% 10%, rgba(200, 213, 227, 0.4) 50%, transparent 100%),
        radial-gradient(1.5px 1.5px at 55% 45%, rgba(200, 213, 227, 0.6) 50%, transparent 100%),
        radial-gradient(1px 1px at 70% 20%, rgba(200, 213, 227, 0.3) 50%, transparent 100%),
        radial-gradient(2px 2px at 85% 55%, rgba(200, 213, 227, 0.5) 50%, transparent 100%),
        radial-gradient(1px 1px at 15% 60%, rgba(200, 213, 227, 0.4) 50%, transparent 100%),
        radial-gradient(1.5px 1.5px at 30% 75%, rgba(200, 213, 227, 0.6) 50%, transparent 100%),
        radial-gradient(1px 1px at 50% 80%, var(--constellation-blue) 50%, transparent 100%),
        radial-gradient(2px 2px at 65% 65%, rgba(200, 213, 227, 0.5) 50%, transparent 100%),
        radial-gradient(1px 1px at 80% 40%, rgba(200, 213, 227, 0.3) 50%, transparent 100%),
        radial-gradient(1px 1px at 92% 72%, rgba(200, 213, 227, 0.5) 50%, transparent 100%),
        radial-gradient(1.5px 1.5px at 5% 85%, rgba(200, 213, 227, 0.4) 50%, transparent 100%),
        radial-gradient(1px 1px at 20% 92%, rgba(200, 213, 227, 0.6) 50%, transparent 100%),
        radial-gradient(2px 2px at 38% 50%, rgba(200, 213, 227, 0.3) 50%, transparent 100%),
        radial-gradient(1px 1px at 48% 25%, rgba(200, 213, 227, 0.7) 50%, transparent 100%),
        radial-gradient(1.5px 1.5px at 62% 88%, rgba(200, 213, 227, 0.4) 50%, transparent 100%),
        radial-gradient(1px 1px at 75% 8%, rgba(200, 213, 227, 0.5) 50%, transparent 100%),
        radial-gradient(1px 1px at 88% 28%, rgba(200, 213, 227, 0.2) 50%, transparent 100%),
        radial-gradient(2px 2px at 95% 90%, rgba(200, 213, 227, 0.6) 50%, transparent 100%),
        radial-gradient(1px 1px at 8% 38%, rgba(200, 213, 227, 0.5) 50%, transparent 100%),
        radial-gradient(1.5px 1.5px at 33% 18%, rgba(200, 213, 227, 0.3) 50%, transparent 100%),
        radial-gradient(1px 1px at 42% 68%, rgba(200, 213, 227, 0.6) 50%, transparent 100%),
        radial-gradient(1px 1px at 58% 5%, rgba(200, 213, 227, 0.4) 50%, transparent 100%),
        radial-gradient(2px 2px at 72% 52%, rgba(200, 213, 227, 0.5) 50%, transparent 100%),
        radial-gradient(1px 1px at 82% 78%, rgba(200, 213, 227, 0.3) 50%, transparent 100%),
        radial-gradient(1.5px 1.5px at 12% 48%, rgba(200, 213, 227, 0.7) 50%, transparent 100%),
        radial-gradient(1px 1px at 27% 55%, rgba(200, 213, 227, 0.2) 50%, transparent 100%),
        radial-gradient(1px 1px at 45% 38%, rgba(200, 213, 227, 0.5) 50%, transparent 100%),
        radial-gradient(2px 2px at 68% 12%, rgba(200, 213, 227, 0.4) 50%, transparent 100%),
        radial-gradient(1px 1px at 90% 48%, rgba(200, 213, 227, 0.6) 50%, transparent 100%),
        radial-gradient(1.5px 1.5px at 3% 72%, rgba(200, 213, 227, 0.3) 50%, transparent 100%),
        radial-gradient(1px 1px at 18% 22%, rgba(200, 213, 227, 0.5) 50%, transparent 100%),
        radial-gradient(1px 1px at 35% 88%, rgba(200, 213, 227, 0.4) 50%, transparent 100%),
        radial-gradient(2px 2px at 52% 58%, rgba(200, 213, 227, 0.6) 50%, transparent 100%),
        radial-gradient(1px 1px at 78% 32%, rgba(200, 213, 227, 0.3) 50%, transparent 100%),
        radial-gradient(1.5px 1.5px at 97% 15%, rgba(200, 213, 227, 0.5) 50%, transparent 100%),
        radial-gradient(1px 1px at 22% 42%, rgba(200, 213, 227, 0.7) 50%, transparent 100%),
        radial-gradient(1px 1px at 57% 72%, rgba(200, 213, 227, 0.4) 50%, transparent 100%),
        radial-gradient(3px 3px at 83% 62%, rgba(200, 213, 227, 0.2) 50%, transparent 100%);
    animation: siderealDrift 60s linear infinite;
}

@keyframes siderealDrift {
    0% { transform: translateY(0); }
    100% { transform: translateY(-30px); }
}

/* Leather texture overlay on cover */
.spread--cover::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-conic-gradient(
        var(--spine-shadow) 0% 25%,
        transparent 0% 50%
    );
    opacity: 0.03;
    z-index: 0;
    pointer-events: none;
}

/* ==========================================================================
   SPREAD 2 - THE FIRST ENTRY
   ========================================================================== */

.spread--entry {
    background-color: var(--twilight-indigo);
}

.entry-text {
    padding-top: 30vh;
}

.constellation-diagram {
    width: 100%;
    max-width: 400px;
}

.constellation-svg {
    width: 100%;
    height: auto;
}

/* Stars */
.star {
    fill: var(--constellation-blue);
    opacity: 0;
    transform-origin: center;
}

.constellation-svg.is-visible .star {
    animation: starAppear 400ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.constellation-svg.is-visible .star-1 { animation-delay: 0ms; }
.constellation-svg.is-visible .star-2 { animation-delay: 80ms; }
.constellation-svg.is-visible .star-3 { animation-delay: 160ms; }
.constellation-svg.is-visible .star-4 { animation-delay: 240ms; }
.constellation-svg.is-visible .star-5 { animation-delay: 320ms; }
.constellation-svg.is-visible .star-6 { animation-delay: 400ms; }
.constellation-svg.is-visible .star-7 { animation-delay: 480ms; }
.constellation-svg.is-visible .star-8 { animation-delay: 560ms; }
.constellation-svg.is-visible .star-9 { animation-delay: 640ms; }
.constellation-svg.is-visible .star-10 { animation-delay: 720ms; }
.constellation-svg.is-visible .star-11 { animation-delay: 800ms; }
.constellation-svg.is-visible .star-12 { animation-delay: 880ms; }
.constellation-svg.is-visible .star-13 { animation-delay: 960ms; }
.constellation-svg.is-visible .star-14 { animation-delay: 1040ms; }
.constellation-svg.is-visible .star-15 { animation-delay: 1120ms; }

@keyframes starAppear {
    0% {
        opacity: 0;
        transform: scale(0);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Star connection lines */
.star-line {
    stroke: var(--pressed-lavender);
    stroke-width: 0.5;
    opacity: 0.6;
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
}

.constellation-svg.is-visible .star-line {
    animation: drawLine 600ms ease-out forwards;
}

.constellation-svg.is-visible .line-1 { animation-delay: 500ms; }
.constellation-svg.is-visible .line-2 { animation-delay: 600ms; }
.constellation-svg.is-visible .line-3 { animation-delay: 700ms; }
.constellation-svg.is-visible .line-4 { animation-delay: 800ms; }
.constellation-svg.is-visible .line-5 { animation-delay: 900ms; }
.constellation-svg.is-visible .line-6 { animation-delay: 1000ms; }
.constellation-svg.is-visible .line-7 { animation-delay: 1100ms; }
.constellation-svg.is-visible .line-8 { animation-delay: 1200ms; }
.constellation-svg.is-visible .line-9 { animation-delay: 1300ms; }
.constellation-svg.is-visible .line-10 { animation-delay: 1400ms; }

@keyframes drawLine {
    to {
        stroke-dashoffset: 0;
    }
}

/* Pressed Flowers */
.pressed-flower {
    position: absolute;
    z-index: 3;
}

.pressed-flower--top-right {
    top: 3rem;
    right: 2rem;
    width: 40px;
}

.pressed-flower--bottom-margin {
    bottom: 3rem;
    right: 8rem;
    width: 35px;
}

.pressed-flower-drift {
    animation: flowerDrift 12s ease-in-out infinite;
}

@keyframes flowerDrift {
    0%, 100% {
        transform: rotate(0deg) translate(0, 0);
    }
    25% {
        transform: rotate(3deg) translate(4px, -2px);
    }
    50% {
        transform: rotate(-1deg) translate(-2px, 3px);
    }
    75% {
        transform: rotate(-3deg) translate(-4px, -1px);
    }
}

/* ==========================================================================
   SPREAD 3 - THE ACCOUNTS
   ========================================================================== */

.spread--accounts {
    background-color: var(--deep-night);
    flex-direction: column;
    padding: 4rem 2rem;
}

.ledger-table-wrapper {
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
}

.hand-ruled-line {
    width: 100%;
    height: 4px;
    margin: 2rem 0;
}

.ledger-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 2px solid var(--spine-shadow);
    filter: url(#leather-grain);
}

.ledger-header {
    border-bottom: 1px solid var(--spine-shadow);
}

.ledger-th {
    font-family: 'Crimson Text', Georgia, serif;
    font-weight: 600;
    font-variant: small-caps;
    letter-spacing: 0.08em;
    font-size: 0.95rem;
    color: var(--tallow-flame);
    text-align: left;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid rgba(74, 93, 122, 0.4);
}

.ledger-row {
    transition: background-color 0.3s ease;
}

.ledger-row td {
    padding: 2.5rem 2rem;
    vertical-align: top;
    border-bottom: 1px solid rgba(74, 93, 122, 0.15);
}

.ledger-row:nth-child(odd) {
    background-color: rgba(240, 234, 214, 0.03);
}

.ledger-date {
    white-space: nowrap;
    color: var(--pressed-lavender);
}

.ledger-account {
    font-family: 'Crimson Text', Georgia, serif;
    font-weight: 600;
    font-variant: small-caps;
    letter-spacing: 0.08em;
    color: var(--ledger-ink);
}

.ledger-particular {
    color: var(--constellation-blue);
    max-width: 400px;
    font-size: 0.95rem;
    line-height: 1.7;
}

.ledger-particular em {
    font-style: italic;
}

.ledger-amount {
    text-align: right;
    white-space: nowrap;
    color: var(--tallow-flame);
}

/* ==========================================================================
   SPREAD 4 - THE NIGHT SKY
   ========================================================================== */

.spread--sky {
    background-color: var(--deep-night);
    flex-direction: column;
    animation: skyBreathe 8s ease-in-out infinite;
}

@keyframes skyBreathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.celestial-grid {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 800px;
    height: auto;
    z-index: 1;
    pointer-events: none;
}

.sky-constellation {
    position: relative;
    z-index: 2;
    width: 70%;
    max-width: 700px;
}

.constellation-svg--large {
    width: 100%;
    height: auto;
}

.journal-entry {
    position: absolute;
    bottom: 8vh;
    left: 5vw;
    max-width: 420px;
    z-index: 3;
}

.journal-text {
    font-family: 'Crimson Text', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.6vw, 1.15rem);
    line-height: 1.85;
    color: var(--constellation-blue);
}

.journal-attribution {
    font-family: 'Crimson Text', Georgia, serif;
    font-weight: 600;
    font-variant: small-caps;
    letter-spacing: 0.08em;
    font-size: 0.85rem;
    color: var(--pressed-lavender);
    margin-top: 1rem;
}

/* ==========================================================================
   SPREAD 5 - THE COLOPHON
   ========================================================================== */

.spread--colophon {
    background-color: var(--twilight-indigo);
    flex-direction: column;
}

.colophon-text {
    padding-top: 20vh;
}

.colophon-flower {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
}

.flower-fern {
    width: 60px;
    height: auto;
}

.closing-text {
    color: var(--tallow-flame);
    font-style: italic;
}

.site-footer {
    position: absolute;
    bottom: 2rem;
    left: 0;
    right: 0;
    text-align: center;
}

.footer-text {
    font-family: 'Crimson Text', Georgia, serif;
    font-weight: 400;
    font-size: 0.8rem;
    color: var(--spine-shadow);
    opacity: 0.6;
    letter-spacing: 0.1em;
}

/* ==========================================================================
   SLIDE-REVEAL ANIMATIONS
   ========================================================================== */

.slide-reveal {
    opacity: 0;
    transition: opacity 800ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
                clip-path 800ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 800ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transition-delay: var(--delay, 0s);
}

.slide-reveal--left {
    clip-path: inset(0 100% 0 0);
}

.slide-reveal--left.is-visible {
    clip-path: inset(0 0 0 0);
    opacity: 1;
}

.slide-reveal--right {
    clip-path: inset(0 0 0 100%);
}

.slide-reveal--right.is-visible {
    clip-path: inset(0 0 0 0);
    opacity: 1;
}

.slide-reveal--up {
    transform: translateY(40px);
    opacity: 0;
}

.slide-reveal--up.is-visible {
    transform: translateY(0);
    opacity: 1;
}

.slide-reveal--fade {
    opacity: 0;
}

.slide-reveal--fade.is-visible {
    opacity: 1;
}

/* ==========================================================================
   RESPONSIVE - SINGLE PAGE LAYOUT < 900px
   ========================================================================== */

@media (max-width: 900px) {
    .spread-pages {
        flex-direction: column;
    }

    .gutter-line {
        width: 80%;
        height: 1px;
        margin: 2rem auto;
        align-self: center;
    }

    .page {
        padding: 2rem 1rem;
    }

    .page--right {
        align-items: center;
    }

    .entry-text {
        padding-top: 10vh;
    }

    .body-text {
        max-width: 100%;
    }

    .constellation-diagram {
        max-width: 300px;
    }

    .cover-content {
        padding-left: 5vw;
    }

    .journal-entry {
        position: relative;
        bottom: auto;
        left: auto;
        padding: 2rem;
        max-width: 100%;
    }

    .sky-constellation {
        width: 90%;
    }

    .pressed-flower--top-right {
        top: 1rem;
        right: 1rem;
    }

    .pressed-flower--bottom-margin {
        bottom: 1rem;
        right: 2rem;
    }

    .colophon-text {
        padding-top: 8vh;
    }

    .spread--sky {
        padding-bottom: 6rem;
    }

    .ledger-table {
        font-size: 0.85rem;
    }

    .ledger-th,
    .ledger-row td {
        padding: 1.5rem 1rem;
    }

    .ledger-particular {
        max-width: 200px;
    }
}

@media (max-width: 600px) {
    .ledger-particular {
        display: none;
    }

    .ledger-th:nth-child(3) {
        display: none;
    }
}

/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .star-field {
        animation: none;
    }

    .spread--sky {
        animation: none;
    }

    .pressed-flower-drift {
        animation: none;
    }

    .slide-reveal {
        opacity: 1;
        clip-path: none;
        transform: none;
        transition: none;
    }

    .star {
        opacity: 1;
        transform: none;
        animation: none !important;
    }

    .star-line {
        stroke-dasharray: none;
        stroke-dashoffset: 0;
        animation: none !important;
    }

    .constellation-svg .star,
    .constellation-svg .star-line {
        opacity: 1;
        animation: none !important;
    }
}
