/* ==========================================================================
   witch-trial.com — Styles
   Dark Academia / Gothic Reverence / Archival Manuscript
   ========================================================================== */

/* --- CSS Custom Properties --- */
:root {
    --color-primary-dark: #1A1714;
    --color-secondary-dark: #2D2620;
    --color-accent-gold: #D4AF6A;
    --color-text-primary: #F5F1E8;
    --color-text-secondary: #E8E4D8;
    --color-text-tertiary: #B8A080;
    --color-muted-grid: #4A4540;
    --color-muted-taupe: #8B8680;

    --font-display: 'Cormorant Garamond', 'Georgia', serif;
    --font-body: 'Lora', 'Georgia', serif;
    --font-marginalia: 'Crimson Text', 'Georgia', serif;
    --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
}

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

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

body {
    background-color: var(--color-primary-dark);
    color: var(--color-text-secondary);
    font-family: var(--font-body);
    line-height: 1.8;
    overflow-x: hidden;
    position: relative;
}

/* --- Texture Overlay --- */
.texture-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.06;
    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.85' 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;
}

/* --- Hero Section --- */
.hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--color-primary-dark);
    overflow: hidden;
}

.hero-grain {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='grain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23grain)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 512px 512px;
    animation: grainShift 60s linear infinite;
}

@keyframes grainShift {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-5px, 5px); }
    50% { transform: translate(5px, -5px); }
    75% { transform: translate(-3px, -3px); }
    100% { transform: translate(0, 0); }
}

.hero-content {
    text-align: center;
    z-index: 2;
    padding: 0 2rem;
}

.hero-ornament {
    display: flex;
    justify-content: center;
    margin: 1.5rem 0;
}

.hero-ornament svg {
    width: 200px;
    height: auto;
}

.hero-ornament--bottom svg {
    width: 300px;
}

.hero-title {
    font-family: var(--font-display);
    font-size: 4.5rem;
    font-weight: 600;
    color: var(--color-text-primary);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    line-height: 1.1;
    margin-bottom: 0.5rem;
}

.hero-subtitle {
    font-family: var(--font-marginalia);
    font-size: 1.25rem;
    font-style: italic;
    color: var(--color-text-tertiary);
    letter-spacing: 0.08em;
}

.scroll-indicator {
    position: absolute;
    bottom: 2.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    opacity: 0.5;
    animation: scrollPulse 2.5s ease-in-out infinite;
}

.scroll-indicator svg {
    width: 24px;
    height: 40px;
}

.scroll-dot {
    animation: scrollDotMove 2.5s ease-in-out infinite;
}

@keyframes scrollPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.2; }
}

@keyframes scrollDotMove {
    0% { cy: 10; }
    50% { cy: 26; }
    100% { cy: 10; }
}

/* --- Manuscript Main Layout --- */
.manuscript {
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 2rem;
}

.manuscript-section {
    display: grid;
    grid-template-columns: 1fr 3fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
    position: relative;
}

/* --- Content Column --- */
.content-column {
    grid-column: 2;
    max-width: 720px;
    margin: 0 auto;
    width: 100%;
}

/* --- Section Headings --- */
.section-heading {
    font-family: var(--font-display);
    font-size: 3.2rem;
    font-weight: 600;
    color: var(--color-text-primary);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    text-align: center;
    margin-bottom: 0.5rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.section-heading.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* --- Ornate Dividers --- */
.ornate-divider {
    text-align: center;
    margin: 1rem 0 2rem;
}

.ornate-divider svg {
    width: 100%;
    max-width: 400px;
    height: auto;
}

.section-break {
    text-align: center;
    padding: 3rem 0;
}

.section-break svg {
    width: 100%;
    max-width: 500px;
    height: auto;
}

.divider-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 0.8s ease-in-out;
}

.divider-path.animated {
    stroke-dashoffset: 0;
}

/* --- Body Text --- */
.body-text {
    font-family: var(--font-body);
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--color-text-secondary);
    line-height: 1.8;
    margin-bottom: 1.5rem;
    text-indent: 1.5em;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.body-text:first-of-type {
    text-indent: 0;
}

.body-text.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* --- Margin Notes --- */
.margin-note {
    padding-top: 3rem;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.margin-note.revealed {
    opacity: 0.8;
}

.margin-note--left {
    grid-column: 1;
    text-align: right;
    padding-right: 1rem;
}

.margin-note--right {
    grid-column: 3;
    text-align: left;
    padding-left: 1rem;
}

.margin-icon {
    display: inline-block;
    width: 28px;
    height: 28px;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.margin-icon svg {
    width: 100%;
    height: 100%;
}

.margin-text {
    font-family: var(--font-marginalia);
    font-size: 0.9rem;
    font-style: italic;
    color: var(--color-text-tertiary);
    line-height: 1.6;
}

/* --- Case Studies --- */
.case-study {
    position: relative;
    background: rgba(212, 175, 106, 0.08);
    border: 1px solid rgba(212, 175, 106, 0.12);
    padding: 2rem 2.5rem;
    margin-bottom: 2rem;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.5s ease, transform 0.5s ease, background 0.2s ease;
}

.case-study.revealed {
    opacity: 1;
    transform: translateY(0);
}

.case-study:hover {
    background: rgba(212, 175, 106, 0.15);
}

.case-study:hover .case-title {
    color: #FFFFFF;
}

/* Corner Flourishes */
.case-corner {
    position: absolute;
    width: 20px;
    height: 20px;
    transition: transform 0.2s ease;
}

.case-study:hover .case-corner {
    transform: scale(1.1);
}

.case-corner--tl {
    top: -1px;
    left: -1px;
    border-top: 2px solid var(--color-accent-gold);
    border-left: 2px solid var(--color-accent-gold);
    opacity: 0.5;
}

.case-corner--tr {
    top: -1px;
    right: -1px;
    border-top: 2px solid var(--color-accent-gold);
    border-right: 2px solid var(--color-accent-gold);
    opacity: 0.5;
}

.case-corner--bl {
    bottom: -1px;
    left: -1px;
    border-bottom: 2px solid var(--color-accent-gold);
    border-left: 2px solid var(--color-accent-gold);
    opacity: 0.5;
}

.case-corner--br {
    bottom: -1px;
    right: -1px;
    border-bottom: 2px solid var(--color-accent-gold);
    border-right: 2px solid var(--color-accent-gold);
    opacity: 0.5;
}

.case-header {
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(212, 175, 106, 0.15);
    padding-bottom: 0.75rem;
}

.case-title {
    font-family: var(--font-display);
    font-size: 2.4rem;
    font-weight: 600;
    color: var(--color-text-primary);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    transition: color 0.2s ease;
}

.case-meta {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--color-muted-taupe);
    margin-top: 0.25rem;
    letter-spacing: 0.05em;
}

.case-body {
    font-family: var(--font-body);
    font-size: 1.1rem;
    color: var(--color-text-secondary);
    line-height: 1.8;
    margin-bottom: 1rem;
}

.case-ref {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--color-muted-taupe);
    opacity: 0.6;
    text-align: right;
}

/* --- Process Timeline --- */
.process-timeline {
    margin-top: 2.5rem;
    padding-left: 2rem;
    border-left: 2px solid var(--color-muted-grid);
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.process-timeline.revealed {
    opacity: 1;
    transform: translateY(0);
}

.timeline-item {
    position: relative;
    padding: 0 0 2rem 1.5rem;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -2.35rem;
    top: 0.35rem;
    width: 10px;
    height: 10px;
    background-color: var(--color-accent-gold);
    border-radius: 50%;
    opacity: 0.7;
}

.timeline-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--color-text-primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.25rem;
}

.timeline-text {
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--color-text-secondary);
    line-height: 1.7;
}

/* --- Colophon / Footer --- */
.colophon {
    text-align: center;
    padding: 4rem 2rem 3rem;
    border-top: 1px solid var(--color-muted-grid);
    margin-top: 2rem;
}

.colophon-ornament {
    margin-bottom: 1.5rem;
}

.colophon-ornament svg {
    width: 200px;
    height: auto;
}

.colophon-text {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--color-text-primary);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 0.5rem;
}

.colophon-subtitle {
    font-family: var(--font-marginalia);
    font-size: 1rem;
    font-style: italic;
    color: var(--color-text-tertiary);
    margin-bottom: 1rem;
}

.colophon-meta {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--color-muted-taupe);
    opacity: 0.6;
    max-width: 500px;
    margin: 0 auto;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .manuscript-section {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .content-column {
        grid-column: 1;
    }

    .margin-note--left,
    .margin-note--right {
        grid-column: 1;
        text-align: left;
        padding: 0 1rem;
        border-left: 2px solid var(--color-muted-grid);
        margin-left: 1rem;
    }

    .margin-note--left {
        order: -1;
    }

    .hero-title {
        font-size: 3rem;
    }

    .section-heading {
        font-size: 2.4rem;
    }

    .case-title {
        font-size: 1.8rem;
    }

    .case-study {
        padding: 1.5rem;
    }
}

@media (max-width: 600px) {
    .hero-title {
        font-size: 2.2rem;
        letter-spacing: 0.08em;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .section-heading {
        font-size: 1.8rem;
    }

    .case-title {
        font-size: 1.4rem;
    }

    .body-text {
        font-size: 1rem;
    }

    .manuscript {
        padding: 2rem 1rem;
    }
}

/* --- Selection --- */
::selection {
    background: rgba(212, 175, 106, 0.3);
    color: var(--color-text-primary);
}