
/* Design palette custom properties */
:root {
    --deepest-ink: #0f0f12;
    --dark-charcoal: #1a1a1a;
    --reading-black: #2e2e2e;
    --graphite: #4a4a4a;
    --pencil-lead: #6b6b6b;
    --margin-gray: #808080;
    --silver-rule: #999999;
    --fog: #b0b0b0;
    --vellum: #c8c8c8;
    --underline-silver: #c0c0c0;
    --parchment-light: #d8d8d8;
    --mist: #e4e4e4;
    --bone: #ececec;
    --paper: #f2f2f2;
    --cream-haze: #f7f7f7;
    --ghost-white: #fafafa;
    --void-light: #fdfdfd;
    --lavender-gray: #d8d8e8;
    --mint-gray: #d8e8d8;
}

/* dilemma.dev - Ethereal Library in Vaporwave Void */
/* Commissioner Variable Font - Monochrome Palette */

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    color: #2e2e2e;
    background: #fdfdfd;
    overflow-x: hidden;
    line-height: 1.75;
    letter-spacing: 0.01em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== CODEX CONTAINER ========== */
.codex-container {
    position: relative;
    perspective: 1200px;
}

/* ========== FOLIO BASE STRUCTURE ========== */
.folio {
    position: relative;
    min-height: 100vh;
    width: 100%;
    overflow: hidden;
    margin-top: -8vh;
    opacity: 0.7;
    transform: translateZ(-40px);
    transition: opacity 0.8s ease-in-out, transform 0.8s ease-in-out;
}

.folio:first-child {
    margin-top: 0;
}

.folio.folio-active {
    opacity: 1;
    transform: translateZ(0);
}

.folio-iii {
    min-height: 120vh;
}

/* ========== FOLIO BASE LAYERS (gradient-mesh backgrounds) ========== */
.folio-base {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

.folio-base-i {
    background:
        radial-gradient(ellipse at 20% 30%, #fafafa 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, #e4e4e4 0%, transparent 45%),
        radial-gradient(ellipse at 45% 80%, #f2f2f2 0%, transparent 55%),
        linear-gradient(170deg, #f7f7f7 0%, #ececec 100%);
    animation: mesh-drift-i 30s ease-in-out infinite;
}

.folio-base-ii {
    background:
        radial-gradient(ellipse at 30% 20%, #f2f2f2 0%, transparent 50%),
        radial-gradient(ellipse at 60% 70%, #e4e4e4 0%, transparent 48%),
        radial-gradient(ellipse at 80% 30%, #ececec 0%, transparent 40%),
        linear-gradient(190deg, #f2f2f2 0%, #ececec 100%);
    animation: mesh-drift-ii 30s ease-in-out infinite;
}

.folio-base-iii {
    background:
        radial-gradient(ellipse at 40% 25%, #ececec 0%, transparent 45%),
        radial-gradient(ellipse at 75% 55%, #e4e4e4 0%, transparent 50%),
        radial-gradient(ellipse at 20% 70%, #f2f2f2 0%, transparent 42%),
        linear-gradient(160deg, #ececec 0%, #e4e4e4 100%);
    animation: mesh-drift-iii 30s ease-in-out infinite;
}

.folio-base-iv {
    background:
        radial-gradient(ellipse at 50% 40%, #e4e4e4 0%, transparent 50%),
        radial-gradient(ellipse at 25% 65%, #d8d8d8 0%, transparent 45%),
        radial-gradient(ellipse at 70% 20%, #ececec 0%, transparent 48%),
        linear-gradient(175deg, #e4e4e4 0%, #d8d8d8 100%);
    animation: mesh-drift-iv 30s ease-in-out infinite;
}

.folio-base-v {
    background:
        radial-gradient(ellipse at 35% 50%, #d8d8d8 0%, transparent 50%),
        radial-gradient(ellipse at 65% 30%, #e4e4e4 0%, transparent 45%),
        radial-gradient(ellipse at 50% 75%, #c8c8c8 0%, transparent 40%),
        linear-gradient(180deg, #d8d8d8 0%, #c8c8c8 100%);
    animation: mesh-drift-v 30s ease-in-out infinite;
}

/* ========== GRADIENT MESH DRIFT ANIMATIONS ========== */
@keyframes mesh-drift-i {
    0%, 100% { background-position: 0% 0%, 0% 0%, 0% 0%, 0% 0%; }
    50% { background-position: 5% 3%, -3% 5%, 4% -2%, 0% 0%; }
}

@keyframes mesh-drift-ii {
    0%, 100% { background-position: 0% 0%, 0% 0%, 0% 0%, 0% 0%; }
    50% { background-position: -4% 6%, 5% -3%, -2% 4%, 0% 0%; }
}

@keyframes mesh-drift-iii {
    0%, 100% { background-position: 0% 0%, 0% 0%, 0% 0%, 0% 0%; }
    50% { background-position: 3% -5%, -5% 4%, 6% 3%, 0% 0%; }
}

@keyframes mesh-drift-iv {
    0%, 100% { background-position: 0% 0%, 0% 0%, 0% 0%, 0% 0%; }
    50% { background-position: -3% 4%, 4% -6%, -5% 2%, 0% 0%; }
}

@keyframes mesh-drift-v {
    0%, 100% { background-position: 0% 0%, 0% 0%, 0% 0%, 0% 0%; }
    50% { background-position: 5% -4%, -4% 5%, 3% -3%, 0% 0%; }
}

/* ========== ATMOSPHERE LAYER ========== */
.folio-atmosphere {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    pointer-events: none;
}

.ruled-line-golden {
    position: absolute;
    left: 0;
    top: 61.8%;
    width: 40%;
    height: 1px;
    background: #b0b0b0;
    opacity: 0.3;
}

.folio-rule {
    position: absolute;
    left: 28%;
    top: 0;
    width: 40%;
    height: 1px;
    background: #b0b0b0;
    opacity: 0.3;
}

/* ========== FOLIO CONTENT LAYER ========== */
.folio-content {
    position: relative;
    z-index: 2;
    padding: 8vh 12%;
    min-height: inherit;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* ========== PAGE CORNER SHADOWS ========== */
.folio::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 10px;
    height: 10px;
    background: linear-gradient(135deg, rgba(15, 15, 18, 0.06) 0%, transparent 100%);
    z-index: 4;
    pointer-events: none;
}

.folio::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background: linear-gradient(315deg, rgba(15, 15, 18, 0.06) 0%, transparent 100%);
    z-index: 4;
    pointer-events: none;
}

/* ========== GHOST NUMERALS ========== */
.ghost-numeral {
    position: absolute;
    top: 4vh;
    right: 8%;
    font-family: 'Commissioner', sans-serif;
    font-weight: 100;
    font-size: 8rem;
    color: #1a1a1a;
    opacity: 0.06;
    line-height: 1;
    pointer-events: none;
    z-index: 1;
}

.ghost-numeral-large {
    font-size: 40vw;
    top: 50%;
    right: 50%;
    transform: translate(50%, -50%);
    opacity: 0.03;
}

/* ========== TYPOGRAPHY ========== */
.title-container {
    font-family: 'Commissioner', sans-serif;
    font-weight: 200;
    font-size: clamp(2.8rem, 6vw, 5.2rem);
    letter-spacing: 0.08em;
    line-height: 1.15;
    color: #1a1a1a;
    margin-bottom: 3rem;
}

.title-letter {
    display: inline-block;
    position: relative;
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
}

.title-letter.revealed {
    opacity: 1;
}

.title-letter .skeleton-char {
    position: absolute;
    top: 10%;
    left: 0;
    width: 100%;
    height: 70%;
    background: #c8c8c8;
    border-radius: 3px;
}

.section-subheading {
    font-family: 'Commissioner', sans-serif;
    font-weight: 500;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #4a4a4a;
    text-decoration: underline;
    text-decoration-color: rgba(192, 192, 192, 0.5); /* #c0c0c0 at 50% */
    text-underline-offset: 0.3em;
    margin-bottom: 3rem;
}

.question-text {
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.4vw, 1.15rem);
    color: #2e2e2e;
    line-height: 1.75;
    letter-spacing: 0.01em;
    max-width: 55ch;
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
}

.question-text.visible {
    opacity: 1;
}

/* ========== SKELETON LOADING ========== */
.skeleton-block {
    width: 100%;
    height: 120px;
    background: linear-gradient(90deg, #c8c8c8 0%, #d8d8d8 40%, #e4e4e4 50%, #d8d8d8 60%, #c8c8c8 100%);
    background-size: 200% 100%;
    border-radius: 4px;
    animation: skeleton-drift 2.5s ease-in-out infinite;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    transition: opacity 0.6s ease-in-out;
}

.skeleton-block.hidden {
    opacity: 0;
    pointer-events: none;
}

.skeleton-eternal {
    position: relative;
    height: 60px;
    margin-top: 2rem;
}

.skeleton-persistent {
    height: 40px;
    position: relative;
}

@keyframes skeleton-drift {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-block-ltr {
    animation: skeleton-drift-ltr 2.5s ease-in-out infinite;
}

.skeleton-block-rtl {
    animation: skeleton-drift-rtl 2.5s ease-in-out infinite;
}

@keyframes skeleton-drift-ltr {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes skeleton-drift-rtl {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ========== SPINE DIVIDERS ========== */
.spine-divider {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 0;
    position: relative;
    z-index: 10;
}

.spine-divider::after {
    content: '';
    display: block;
    width: 1px;
    height: 40px;
    background: #d8d8d8;
    position: absolute;
    top: -20px;
}

/* ========== FOOTNOTE RULES ========== */
.footnote-rule {
    width: 25%;
    height: 1px;
    background: #c8c8c8;
    margin-top: 3rem;
}

.footnote-content {
    margin-top: 1.5rem;
}

.footnote-ref {
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-size: 0.85rem;
    color: #6b6b6b;
    font-style: italic;
}

.footnote-num {
    font-family: 'Commissioner', sans-serif;
    font-weight: 700;
    font-size: 0.65rem;
    color: #999999;
    vertical-align: super;
    margin-right: 0.3em;
}

/* ========== MARGINALIA ========== */
.margin-annotations {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.marginalia {
    font-family: 'Commissioner', sans-serif;
    font-weight: 400;
    font-style: italic;
    font-size: 0.8rem;
    color: #808080;
    line-height: 1.5;
}

.marginalia del {
    text-decoration-color: #b0b0b0;
}

.marginalia-dense {
    display: block;
    font-family: 'Commissioner', sans-serif;
    font-weight: 400;
    font-style: italic;
    font-size: 0.8rem;
    color: #808080;
    line-height: 1.6;
    margin-bottom: 1.2rem;
}

.marginalia-dense del {
    text-decoration-color: #b0b0b0;
}

/* ========== FOLIO II - THE FORK ========== */
.fork-grid {
    display: grid;
    grid-template-columns: 1fr 2.618fr 1px 2.618fr 1fr;
    gap: 2rem;
    align-items: start;
}

.fork-column {
    position: relative;
    min-height: 200px;
}

.fork-text {
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
}

.fork-text.visible {
    opacity: 1;
}

.fork-text p {
    margin-bottom: 1.5rem;
    font-size: clamp(1rem, 1.4vw, 1.15rem);
}

.fork-divider {
    width: 1px;
    background: #b0b0b0;
    min-height: 200px;
    align-self: stretch;
}

/* ========== FOLIO III - THE DEPTH ========== */
.depth-container {
    position: relative;
    perspective: 1200px;
    min-height: 500px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.depth-panel {
    position: relative;
    padding: 2.5rem;
    background: rgba(253, 253, 253, 0.6);
    border: 1px solid #e4e4e4;
    min-height: 150px;
    transition: transform 1s ease-in-out, opacity 1s ease-in-out;
}

.depth-panel-front {
    opacity: 1;
    transform: translateZ(0);
    z-index: 3;
    border-color: #d8d8e8;
    animation: iridescent-border 12s ease-in-out infinite;
}

.depth-panel-mid {
    opacity: 0.7;
    transform: translateZ(-20px);
    z-index: 2;
}

.depth-panel-mid .depth-text p {
    color: #4a4a4a;
}

.depth-panel-rear {
    opacity: 0.4;
    transform: translateZ(-40px);
    z-index: 1;
}

.depth-panel-rear .depth-text p {
    color: #6b6b6b;
}

.depth-panel.converged {
    opacity: 1;
    transform: translateZ(0);
}

.depth-panel.converged .depth-text p {
    color: #2e2e2e;
}

.depth-text {
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
}

.depth-text.visible {
    opacity: 1;
}

.depth-text p {
    font-size: clamp(1rem, 1.4vw, 1.15rem);
    line-height: 1.75;
}

/* ========== IRIDESCENT BORDER ========== */
@keyframes iridescent-border {
    0%, 100% { border-color: #d8d8e8; }
    50% { border-color: #d8e8d8; }
}

/* ========== FOLIO IV - THE MARGIN ========== */
.margin-grid {
    display: grid;
    grid-template-columns: 2fr 1.618fr 2fr;
    gap: 2rem;
    align-items: start;
}

.margin-dense {
    position: relative;
    min-height: 200px;
}

.margin-text-content {
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
}

.margin-text-content.visible {
    opacity: 1;
}

.margin-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    position: relative;
}

.margin-center-text {
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.4vw, 1.15rem);
    color: #4a4a4a;
    text-align: center;
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
    margin-top: 1rem;
}

.margin-center-text.visible {
    opacity: 1;
}

/* ========== FOLIO V - THE SILENCE ========== */
.folio-v .folio-content {
    justify-content: center;
    align-items: center;
    text-align: center;
}

.silence-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 55ch;
}

.silence-text {
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.4vw, 1.15rem);
    color: #4a4a4a;
    line-height: 1.75;
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
}

.silence-text.visible {
    opacity: 1;
}

.ellipsis {
    font-family: 'Commissioner', sans-serif;
    font-weight: 200;
    font-size: 2rem;
    color: #b0b0b0;
    text-align: center;
    margin-top: 3rem;
    letter-spacing: 0.5em;
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
}

.ellipsis.visible {
    opacity: 1;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .folio-content {
        padding: 6vh 6%;
    }

    .fork-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .margin-left,
    .margin-right {
        display: none;
    }

    .fork-divider {
        width: 40%;
        height: 1px;
        min-height: 1px;
        margin: 0 auto;
    }

    .margin-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .ghost-numeral {
        font-size: 4rem;
        right: 4%;
    }

    .ghost-numeral-large {
        font-size: 60vw;
    }

    .depth-container {
        perspective: none;
    }

    .depth-panel {
        transform: none;
    }

    .marginalia {
        writing-mode: horizontal-tb;
        transform: none;
    }
}

@media (min-width: 769px) {
    .margin-left .marginalia,
    .margin-right .marginalia {
        writing-mode: vertical-rl;
        transform: rotate(180deg);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-height: 200px;
    }
}
