/* ============================================================
   witch-trial.com -- Editorial archive of documentary testimony
   Minimalist editorial / triadic palette / garamond-classic
   ============================================================ */

:root {
    /* Triadic palette */
    --color-crimson: #8B1A1A;        /* dried blood crimson  */
    --color-gold:    #C59B2C;        /* saffron gold         */
    --color-blue:    #1B4F6B;        /* inquisitor blue      */

    /* Surfaces & text */
    --color-parchment: #F5F0E8;      /* aged parchment       */
    --color-charcoal:  #2C2418;      /* charcoal umber       */
    --color-stone:     #8A8578;      /* stone gray (metadata)*/
    --color-walnut:    #1A1612;      /* near-black walnut    */
    --color-walnut-2:  #2C2418;      /* slightly lifted      */

    /* Typography */
    --font-display: "Cormorant Garamond", "Cormorant", Georgia, serif;
    --font-body:    "EB Garamond", Garamond, Georgia, serif;
    --font-meta:    "DM Sans", "Inter", "Helvetica Neue", Arial, sans-serif;

    /* Reading rhythm */
    --reading-max:   680px;
    --reading-pad:   clamp(1.5rem, 5vw, 3rem);
    --para-gap:      2.5em;
    --section-gap:   clamp(8rem, 18vh, 14rem);
    --line-height:   1.85;

    /* Motion */
    --ease-editorial: cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

* {
    box-sizing: border-box;
}

html {
    background-color: var(--color-parchment);
    color: var(--color-charcoal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--color-parchment);
    font-family: var(--font-body);
    font-size: 1.125rem;
    line-height: var(--line-height);
    color: var(--color-charcoal);
    overflow-x: hidden;
    cursor: default;
}

/* Subtle parchment grain */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    background-image:
        radial-gradient(rgba(44, 36, 24, 0.020) 1px, transparent 1px),
        radial-gradient(rgba(44, 36, 24, 0.014) 1px, transparent 1px);
    background-size: 3px 3px, 7px 7px;
    background-position: 0 0, 1px 2px;
    mix-blend-mode: multiply;
    opacity: 0.7;
}

/* ============================================================
   Progress bar
   ============================================================ */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 0%;
    background-color: var(--color-crimson);
    z-index: 100;
    transition: width 80ms linear;
    will-change: width;
}

/* ============================================================
   Wordmark
   ============================================================ */
.wordmark {
    position: fixed;
    top: 1.6rem;
    left: 1.8rem;
    z-index: 90;
    user-select: none;
    pointer-events: none;
}

.wordmark-text {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 14px;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--color-blue);
    font-feature-settings: "smcp" 1;
    font-variant: small-caps;
}

/* ============================================================
   Archive layout
   ============================================================ */
.archive {
    position: relative;
    z-index: 2;
    padding-top: clamp(7rem, 16vh, 11rem);
    padding-bottom: 8rem;
}

.section {
    width: 100%;
    margin: 0 auto;
    padding-block: var(--section-gap);
}

.reading-column {
    max-width: var(--reading-max);
    margin-inline: auto;
    padding-inline: var(--reading-pad);
}

/* ============================================================
   Typography primitives
   ============================================================ */
.metadata {
    font-family: var(--font-meta);
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-stone);
    margin: 0 0 1.5em 0;
}

.chapter-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.4rem, 5vw, 4rem);
    line-height: 1.1;
    letter-spacing: 0.04em;
    color: var(--color-charcoal);
    margin: 0 0 0.4em 0;
    text-shadow: 0 0 40px rgba(139, 69, 19, 0.08);
}

.subtitle {
    font-family: var(--font-display);
    font-weight: 500;
    font-style: italic;
    font-size: 1.4rem;
    line-height: 1.4;
    color: var(--color-stone);
    margin: 0 0 2.4em 0;
}

.body-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 1.125rem;
    line-height: var(--line-height);
    color: var(--color-charcoal);
    margin: 0 0 var(--para-gap) 0;
    text-align: left;        /* flush-left, ragged right */
    hyphens: none;
}

.body-text em {
    font-style: italic;
    color: var(--color-charcoal);
}

/* First-line indent paragraphs (used in testimony) */
.body-text--indent {
    text-indent: 1.5em;
    margin-bottom: 0.6em;
}
.body-text--indent + .body-text--indent {
    margin-top: 0;
}

.attribution {
    font-family: var(--font-body);
    font-style: italic;
    font-size: 0.95rem;
    color: var(--color-stone);
    text-align: center;
    margin: 2.5em 0 0 0;
}

/* ============================================================
   Pull-quotes
   ============================================================ */
.pull-quote {
    margin: 4rem 0 2rem 0;
    padding: 0;
    text-align: center;
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 500;
    font-size: clamp(1.6rem, 3.4vw, 2.4rem);
    line-height: 1.4;
    color: var(--color-crimson);
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: clamp(1rem, 3vw, 2.4rem);
}

.pull-quote-text {
    display: block;
    max-width: 32ch;
    margin-inline: auto;
}

.ornament--bracket {
    color: var(--color-gold);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 32px;
    flex-shrink: 0;
}

/* ============================================================
   Footnotes
   ============================================================ */
.footnote-list {
    list-style: none;
    margin: 3rem 0 0 0;
    padding: 0;
    border-top: 1px solid rgba(138, 133, 120, 0.35);
    padding-top: 1.6rem;
}

.footnote {
    display: grid;
    grid-template-columns: 18px 1fr;
    align-items: start;
    gap: 0.8rem;
    margin-bottom: 1rem;
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--color-stone);
}

.footnote-marker {
    display: inline-flex;
    width: 18px;
    height: 18px;
    align-items: center;
    justify-content: center;
    margin-top: 0.35em;
    color: var(--color-blue);
}

.footnote-text em {
    color: var(--color-charcoal);
}

/* ============================================================
   Dividers (geometric ornaments)
   ============================================================ */
.divider {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-block: clamp(4rem, 10vh, 8rem);
}

.divider--triangle .ornament-svg {
    width: 24px;
    height: 22px;
}

.divider--rule .ornament-svg {
    width: 120px;
    height: 2px;
}

.divider--final {
    padding-bottom: 0;
}

/* ============================================================
   Geometric interlude (centered triangle flanked by circles)
   ============================================================ */
.section--interlude {
    padding-block: clamp(10rem, 22vh, 16rem);
}

.interlude-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(2.4rem, 8vw, 5rem);
}

.ornament-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ornament-triangle-large .ornament-svg {
    width: 56px;
    height: 50px;
}

/* ============================================================
   Path-draw animation (geometric ornaments)
   ============================================================ */
.draw-path,
.draw-circle {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 0.6s var(--ease-editorial);
}

.draw-circle {
    stroke-dasharray: 32;
    stroke-dashoffset: 32;
    transform-origin: center;
    transform: scale(0);
    transition: stroke-dashoffset 0.5s var(--ease-editorial), transform 0.4s var(--ease-editorial);
}

.is-drawn .draw-path {
    stroke-dashoffset: 0;
}

.is-drawn .draw-circle {
    stroke-dashoffset: 0;
    transform: scale(1);
}

/* Rule: extends from center outward via the data-x1/x2 pattern, handled in JS */

/* ============================================================
   Photographic plates (full-bleed) with skeleton loading
   ============================================================ */
.section--plate {
    padding-block: clamp(5rem, 11vh, 9rem);
}

.plate {
    margin: 0;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.plate-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: var(--color-walnut);
    overflow: hidden;
}

.skeleton {
    position: absolute;
    inset: 0;
    background-color: var(--color-walnut);
    z-index: 1;
    overflow: hidden;
    transition: opacity 1.2s var(--ease-editorial);
}

.skeleton-shimmer {
    position: absolute;
    top: 0;
    left: -30%;
    height: 100%;
    width: 60px;
    background: linear-gradient(
        90deg,
        rgba(197, 155, 44, 0) 0%,
        rgba(197, 155, 44, 0.18) 35%,
        rgba(197, 155, 44, 0.55) 50%,
        rgba(197, 155, 44, 0.18) 65%,
        rgba(197, 155, 44, 0) 100%
    );
    filter: blur(0.5px);
    animation: shimmer 2s linear infinite;
}

@keyframes shimmer {
    0%   { transform: translateX(0); }
    100% { transform: translateX(calc(100vw + 60px)); }
}

.plate-image {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: sepia(0.15) contrast(1.1) saturate(0.85);
    opacity: 0;
    transition: opacity 1.2s var(--ease-editorial);
    z-index: 2;
}

.plate.is-resolved .skeleton {
    opacity: 0;
}

.plate.is-resolved .plate-image {
    opacity: 1;
}

.plate-caption {
    max-width: var(--reading-max);
    margin-inline: auto;
    padding: 1.6rem var(--reading-pad) 0 var(--reading-pad);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    text-align: left;
}

.caption-text {
    font-family: var(--font-body);
    font-style: italic;
    font-size: 0.98rem;
    color: var(--color-stone);
    line-height: 1.55;
}

/* ============================================================
   Reveal animations
   ============================================================ */
.reveal,
.reveal-scale {
    opacity: 0;
    transform: translateY(12px);
    transition:
        opacity 0.8s var(--ease-editorial),
        transform 0.8s var(--ease-editorial);
    will-change: opacity, transform;
}

.reveal-scale {
    transform: translateY(12px) scale(0.97);
    transition:
        opacity 1.5s var(--ease-editorial),
        transform 1.5s var(--ease-editorial);
}

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

/* ============================================================
   Closing silence
   ============================================================ */
.section--silence {
    height: 100vh;
    padding: 0;
    margin: 0;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 600px) {
    .wordmark {
        top: 1.1rem;
        left: 1.1rem;
    }

    .wordmark-text {
        font-size: 12px;
    }

    .pull-quote {
        font-size: clamp(1.3rem, 5vw, 1.8rem);
        gap: 0.8rem;
    }

    .ornament--bracket {
        width: 18px;
        height: 24px;
    }

    .ornament--bracket svg {
        width: 18px;
        height: 24px;
    }

    .interlude-row {
        gap: 2rem;
    }

    .ornament-triangle-large .ornament-svg {
        width: 44px;
        height: 40px;
    }

    .footnote {
        grid-template-columns: 16px 1fr;
        font-size: 0.92rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .reveal,
    .reveal-scale {
        transition: none;
        opacity: 1;
        transform: none;
    }

    .draw-path,
    .draw-circle {
        transition: none;
        stroke-dashoffset: 0;
        transform: scale(1);
    }

    .skeleton-shimmer {
        animation: none;
    }
}
