/* scire.bar - Dark Academia Reading Room */

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

html {
    scroll-behavior: smooth;
    background-color: #0d0b07;
}

body {
    font-family: 'Spectral', Georgia, serif;
    font-size: 18px;
    font-weight: 400;
    line-height: 1.75;
    color: #e8dcc8;
    background-color: #0d0b07;
    overflow-x: hidden;
    position: relative;
}

/* ===== Noise Overlay ===== */
#noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    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-repeat: repeat;
    background-size: 256px 256px;
}

/* ===== Candle Progress ===== */
#candle-progress {
    position: fixed;
    top: 0;
    right: 20px;
    width: 1px;
    height: 100vh;
    z-index: 100;
}

#candle-track {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 100%;
    background: rgba(201, 169, 110, 0.3);
}

#candle-flame {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle, #f5c04a 0%, rgba(245, 192, 74, 0.6) 40%, transparent 70%);
    box-shadow: 0 0 20px rgba(245, 192, 74, 0.4), 0 0 40px rgba(245, 192, 74, 0.15);
    mix-blend-mode: screen;
    transition: opacity 0.3s ease;
}

/* ===== Threshold Section ===== */
#threshold {
    position: relative;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0d0b07;
    overflow: hidden;
}

#keyhole-mask {
    position: relative;
    width: 100%;
    height: 100%;
    clip-path: url(#keyhole-clip);
    display: flex;
    align-items: center;
    justify-content: center;
    /* Initial small keyhole - will be animated via JS */
    clip-path: circle(5% at 50% 50%);
    transition: clip-path 0.1s linear;
}

#keyhole-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1a1610;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#ambient-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(245, 192, 74, 0.05) 0%, transparent 70%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s ease;
}

#scire-title {
    font-family: 'Cormorant Garamond', 'Garamond', serif;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #e8dcc8;
    opacity: 0;
    transition: opacity 0.8s ease, font-size 0.3s ease;
    text-align: center;
    z-index: 2;
}

#scire-subtitle {
    margin-top: 12px;
    opacity: 0;
    transition: opacity 1.2s ease 0.4s;
    z-index: 2;
}

/* ===== Annotation Style ===== */
.annotation {
    font-family: 'IM Fell English', serif;
    font-style: italic;
    font-size: 14px;
    color: #a08c6a;
    opacity: 0.7;
}

/* ===== Shelf Spacer ===== */
.shelf-spacer {
    height: 25vh;
}

/* ===== Shelf Sections ===== */
.shelf {
    display: flex;
    padding: 0 5vw;
    margin-bottom: 0;
}

.shelf-left {
    justify-content: flex-start;
    padding-left: 5vw;
}

.shelf-right {
    justify-content: flex-end;
    padding-right: 5vw;
}

.shelf-card {
    position: relative;
    width: 70vw;
    min-height: 80vh;
    background: #2c2418;
    border: 2px solid #c9a96e;
    padding: 60px;
    opacity: 0;
    transform: translateX(100px);
    transition: opacity 0.6s cubic-bezier(0.33, 0, 0.2, 1), transform 0.6s cubic-bezier(0.33, 0, 0.2, 1);
}

.shelf-left .shelf-card {
    transform: translateX(-100px);
}

.shelf-card.visible {
    opacity: 1;
    transform: translateX(0);
}

/* ===== Filigree Corners ===== */
.filigree {
    position: absolute;
    width: 80px;
    height: 80px;
    opacity: 0.5;
}

.filigree-tl {
    top: 8px;
    left: 8px;
}

.filigree-tr {
    top: 8px;
    right: 8px;
}

.filigree-bl {
    bottom: 8px;
    left: 8px;
}

.filigree-br {
    bottom: 8px;
    right: 8px;
}

/* ===== Shelf Columns ===== */
.shelf-columns {
    display: flex;
    height: 100%;
    min-height: calc(80vh - 120px);
    align-items: flex-start;
}

.shelf-col-left {
    width: 40%;
    padding-right: 40px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 20px;
}

.shelf-rule {
    width: 1px;
    min-height: 100%;
    align-self: stretch;
    background: #c9a96e;
    flex-shrink: 0;
}

.shelf-col-right {
    width: 60%;
    padding-left: 40px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 20px;
}

.shelf-title {
    font-family: 'Cormorant Garamond', 'Garamond', serif;
    font-weight: 600;
    font-size: 64px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #e8dcc8;
    line-height: 1.1;
    margin-bottom: 16px;
}

.shelf-heading {
    margin-bottom: 0;
}

.shelf-text {
    font-family: 'Spectral', Georgia, serif;
    font-size: 18px;
    font-weight: 400;
    line-height: 1.75;
    color: #e8dcc8;
    margin-bottom: 24px;
}

.shelf-text:last-child {
    margin-bottom: 0;
}

/* ===== Vault Section ===== */
#vault {
    display: flex;
    justify-content: center;
    padding: 10vh 0;
    min-height: 100vh;
}

#vault-page {
    position: relative;
    max-width: 600px;
    width: 90%;
    padding: 80px 60px;
    background: #1a1610;
    border: 2px solid #c9a96e;
    text-align: center;
}

#vault-page .filigree {
    opacity: 0;
    transition: opacity 0.6s ease;
}

#vault-page.visible .filigree {
    opacity: 1;
}

.vault-filigree-path {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 1.2s ease;
}

#vault-page.visible .vault-filigree-path {
    stroke-dashoffset: 0;
}

.vault-label {
    margin-bottom: 24px;
    font-size: 13px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

#vault-title {
    font-family: 'Cormorant Garamond', 'Garamond', serif;
    font-weight: 600;
    font-size: 48px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #e8dcc8;
    line-height: 1.2;
    margin-bottom: 32px;
}

#vault-divider {
    width: 80px;
    height: 1px;
    background: #c9a96e;
    margin: 0 auto 32px;
}

#vault-text {
    text-align: left;
    margin-bottom: 48px;
}

/* ===== Wax Seal ===== */
.wax-seal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #8b2500;
    box-shadow: inset 1px 1px 2px rgba(0,0,0,0.5), inset 0 -1px 1px rgba(255,255,255,0.1);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin: 0 auto;
}

.wax-seal:hover {
    transform: scale(1.1);
    box-shadow: inset 1px 1px 2px rgba(0,0,0,0.5), inset 0 -1px 1px rgba(255,255,255,0.1), 0 0 20px rgba(139, 37, 0, 0.4);
}

.seal-letter {
    font-family: 'Cormorant Garamond', 'Garamond', serif;
    font-weight: 700;
    font-size: 22px;
    color: rgba(232, 220, 200, 0.8);
    user-select: none;
}

/* ===== Closing Space ===== */
#closing-space {
    height: 20vh;
}

/* ===== Letter-by-letter animation ===== */
.vault-char {
    opacity: 0;
    transition: opacity 0.15s ease;
}

.vault-char.revealed {
    opacity: 1;
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
    .shelf-card {
        opacity: 1;
        transform: none;
        transition: none;
    }

    #scire-title {
        opacity: 1;
        font-size: 48px;
        transition: none;
    }

    #scire-subtitle {
        opacity: 1;
        transition: none;
    }

    #keyhole-mask {
        clip-path: circle(100% at 50% 50%);
        transition: none;
    }

    .vault-char {
        opacity: 1;
        transition: none;
    }

    .vault-filigree-path {
        stroke-dashoffset: 0;
        transition: none;
    }

    #vault-page .filigree {
        opacity: 1;
        transition: none;
    }

    #ambient-glow {
        opacity: 1;
        transition: none;
    }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .shelf-card {
        width: 90vw;
        padding: 40px 24px;
    }

    .shelf-left, .shelf-right {
        justify-content: center;
        padding-left: 5vw;
        padding-right: 5vw;
    }

    .shelf-columns {
        flex-direction: column;
    }

    .shelf-col-left {
        width: 100%;
        padding-right: 0;
        padding-bottom: 24px;
    }

    .shelf-rule {
        width: 80px;
        height: 1px;
        min-height: 0;
        align-self: center;
        margin: 0 0 24px 0;
    }

    .shelf-col-right {
        width: 100%;
        padding-left: 0;
    }

    .shelf-title {
        font-size: 40px;
    }

    #vault-page {
        padding: 60px 30px;
    }

    #vault-title {
        font-size: 36px;
    }
}
