/* miris.bar - Scholar's Bar - Maximalist Manuscript Design */

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

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

body {
    background: #2a1a0e;
    color: #e8dcc8;
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.4vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.005em;
    overflow-x: hidden;
}

/* ========== SVG FILTERS (HIDDEN) ========== */
.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ========== SCANLINES OVERLAY ========== */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 229, 204, 0.03) 2px,
        rgba(0, 229, 204, 0.04) 4px
    );
    animation: scanline-drift 8s linear infinite;
}

@keyframes scanline-drift {
    from { background-position: 0 0; }
    to { background-position: 0 4px; }
}

/* ========== BOOK SPINE ========== */
.spine {
    position: fixed;
    left: 0;
    top: 0;
    width: clamp(28px, 3vw, 48px);
    height: 100vh;
    background: repeating-linear-gradient(
        180deg,
        #8b6914 0px,
        #5c3d1e 3px,
        #8b6914 6px
    );
    z-index: 900;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    padding: 2rem 0;
    transition: background 0.5s ease;
}

.spine-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background: linear-gradient(to top, #5c1a2a, #8b6914);
    transition: height 0.3s ease;
    opacity: 0.6;
}

.spine-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #d4a054;
    opacity: 0.4;
    z-index: 1;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.spine-dot.active {
    opacity: 1;
    transform: scale(1.5);
}

/* ========== GLITCH BLOCK ========== */
.glitch-block {
    position: fixed;
    pointer-events: none;
    z-index: 999;
    background: #2a1a0e;
    opacity: 0;
    transition: none;
}

/* ========== HERO SECTION ========== */
.hero {
    position: relative;
    min-height: 120vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #2a1a0e;
    margin-left: clamp(28px, 3vw, 48px);
}

.hero-patterns {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.pattern-layer {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pattern-layer.visible {
    opacity: 1;
}

.pattern-grid {
    background:
        repeating-linear-gradient(0deg, transparent, transparent 39px, rgba(139, 105, 20, 0.08) 39px, rgba(139, 105, 20, 0.08) 40px),
        repeating-linear-gradient(90deg, transparent, transparent 39px, rgba(139, 105, 20, 0.08) 39px, rgba(139, 105, 20, 0.08) 40px);
}

.pattern-hatch {
    background: repeating-linear-gradient(45deg, transparent, transparent 8px, rgba(212, 160, 84, 0.04) 8px, rgba(212, 160, 84, 0.04) 9px);
}

.pattern-glow {
    background: radial-gradient(ellipse at 30% 40%, rgba(196, 122, 90, 0.12), transparent 60%);
}

.pattern-noise {
    filter: url(#noise);
    opacity: 0;
}

.pattern-noise.visible {
    opacity: 0.15;
}

/* ========== HERO BLOBS ========== */
.blob {
    position: absolute;
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    animation: blob-drift 120s linear infinite;
}

@keyframes blob-drift {
    from { transform: rotate(0deg) scale(1); }
    to { transform: rotate(360deg) scale(1.05); }
}

.blob-1 {
    width: 300px;
    height: 300px;
    background: rgba(92, 26, 42, 0.08);
    top: 15%;
    right: 10%;
    z-index: 2;
}

.blob-2 {
    width: 250px;
    height: 250px;
    background: rgba(212, 160, 84, 0.06);
    bottom: 20%;
    left: 15%;
    z-index: 2;
    animation-direction: reverse;
    animation-duration: 100s;
}

.blob-3 {
    width: 280px;
    height: 280px;
    background: rgba(92, 26, 42, 0.08);
    top: 30%;
    left: -5%;
    z-index: 0;
    animation-duration: 140s;
}

.blob-4 {
    width: 420px;
    height: 420px;
    background: rgba(212, 160, 84, 0.04);
    top: 10%;
    right: -10%;
    z-index: 0;
    animation-duration: 160s;
}

.blob-5 {
    width: 380px;
    height: 380px;
    background: rgba(92, 26, 42, 0.05);
    bottom: 5%;
    left: 5%;
    z-index: 0;
    animation-direction: reverse;
    animation-duration: 180s;
}

/* ========== HERO CONTENT ========== */
.hero-content {
    position: relative;
    z-index: 10;
    text-align: center;
}

.hero-title {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 700;
    font-size: clamp(3.2rem, 8vw, 7rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #d4a054;
    text-shadow: 2px 2px 0px #2a1a0e, -1px -1px 0px rgba(212, 160, 84, 0.3);
    mix-blend-mode: difference;
    opacity: 0;
    overflow: hidden;
    white-space: nowrap;
}

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

.hero-title .char {
    display: inline-block;
    opacity: 0;
    transition: opacity 0.1s ease;
}

.hero-title .char.visible {
    opacity: 1;
}

.hero-tagline {
    font-family: 'Source Serif 4', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(0.9rem, 2vw, 1.4rem);
    color: #e8dcc8;
    margin-top: 1.5rem;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.hero-tagline.visible {
    opacity: 0.85;
}

/* ========== SCROLL INDICATOR ========== */
.scroll-indicator {
    position: absolute;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.scroll-line {
    width: 1px;
    height: 40px;
    background: #d4a054;
    animation: scroll-pulse 3s ease-in-out infinite;
}

@keyframes scroll-pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

/* ========== SVG MOTIFS ========== */
.svg-motif {
    position: absolute;
    pointer-events: none;
    z-index: 1;
}

.svg-spiral-hero {
    width: 400px;
    height: 400px;
    top: 10%;
    right: 5%;
    opacity: 0.18;
}

.svg-spiral {
    width: 250px;
    height: 250px;
    top: 5%;
    right: 8%;
    opacity: 0.18;
}

.svg-penrose {
    width: 180px;
    height: 180px;
    top: 10%;
    left: 5%;
    opacity: 0.2;
}

.svg-tessellation {
    width: 220px;
    height: 220px;
    bottom: 10%;
    right: 3%;
    opacity: 0.12;
}

.svg-orbital {
    width: 300px;
    height: 300px;
    top: 5%;
    right: 10%;
    opacity: 0.15;
}

.svg-feynman {
    width: 160px;
    height: 160px;
    bottom: 15%;
    left: 8%;
    opacity: 0.18;
}

.svg-sinewave {
    width: 100%;
    height: 80px;
    bottom: 30%;
    left: 0;
    opacity: 0.12;
}

/* ========== CARD BASE ========== */
.card {
    position: relative;
    margin-left: clamp(28px, 3vw, 48px);
    padding: 6rem 0;
    overflow: hidden;
}

.card + .card {
    margin-top: -12vh;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.3);
}

/* ========== CARD VARIANTS ========== */
.card-parchment {
    background: #f2e8d5;
    color: #2a1a0e;
    min-height: 100vh;
    z-index: 10;
}

.card-burgundy {
    background: #5c1a2a;
    color: #f2e8d5;
    min-height: 100vh;
    z-index: 20;
}

.card-dark {
    background: #2a1a0e;
    color: #e8dcc8;
    min-height: 80vh;
    z-index: 30;
}

.card-signature {
    background: #2a1a0e;
    color: #e8dcc8;
    min-height: 60vh;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========== CARD GRID ========== */
.card-grid {
    display: grid;
    grid-template-columns: 1fr minmax(0, 3fr) minmax(0, 1.2fr) 1fr;
    gap: 2rem;
    max-width: 100%;
    padding: 0 1rem;
}

.card-margin-left,
.card-margin-right {
    min-width: 0;
}

.card-content {
    min-width: 0;
}

.card-aside {
    min-width: 0;
    padding-top: 4rem;
}

/* ========== SECTION HEADINGS ========== */
.section-heading {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 600;
    font-size: clamp(2rem, 5vw, 3.5rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 2rem;
    position: relative;
}

.card-parchment .section-heading {
    color: #2a1a0e;
}

.card-burgundy .section-heading {
    color: #d4a054;
}

.card-dark .section-heading {
    color: #d4a054;
}

.section-heading-exclusion {
    mix-blend-mode: exclusion;
}

/* ========== GLITCH EFFECT ON HEADINGS ========== */
.glitch-target.glitching {
    animation: chromatic-aberration 300ms ease-out;
}

@keyframes chromatic-aberration {
    0% { text-shadow: none; }
    20% { text-shadow: -3px 0 #ff2d6b, 3px 0 #00e5cc; }
    80% { text-shadow: -3px 0 #ff2d6b, 3px 0 #00e5cc; }
    100% { text-shadow: none; }
}

.glitch-intense.glitching {
    animation: chromatic-aberration-intense 400ms ease-out;
}

@keyframes chromatic-aberration-intense {
    0% { text-shadow: none; }
    15% { text-shadow: -5px 0 #ff2d6b, 5px 0 #00e5cc; }
    30% { text-shadow: -3px 2px #ff2d6b, 4px -1px #00e5cc; }
    70% { text-shadow: -4px -1px #ff2d6b, 3px 2px #00e5cc; }
    85% { text-shadow: -5px 0 #ff2d6b, 5px 0 #00e5cc; }
    100% { text-shadow: none; }
}

/* ========== BODY TEXT ========== */
.body-text {
    margin-bottom: 1.5rem;
    max-width: 65ch;
}

.body-text-light {
    color: #f2e8d5;
}

/* ========== MARGIN NOTES ========== */
.margin-note {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: clamp(0.72rem, 1vw, 0.85rem);
    line-height: 1.55;
    letter-spacing: 0.02em;
    color: #a08a6e;
    margin-bottom: 1.5rem;
    padding-left: 0.8rem;
    border-left: 1px solid rgba(139, 105, 20, 0.3);
}

.card-parchment .margin-note {
    color: #8b6914;
    border-left-color: rgba(139, 105, 20, 0.4);
}

/* ========== PULL QUOTE ========== */
.pull-quote {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1.8rem, 4vw, 3.2rem);
    color: #c47a5a;
    padding: 2rem 0;
    border-left: 3px solid #8b6914;
    padding-left: 2rem;
    margin-bottom: 2rem;
    line-height: 1.3;
}

/* ========== INDEX ENTRIES ========== */
.index-entries {
    list-style: none;
    padding-top: 2rem;
}

.index-entry {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: clamp(0.72rem, 1vw, 0.85rem);
    line-height: 1.55;
    letter-spacing: 0.02em;
    color: #a08a6e;
    padding: 0.4rem 0;
    padding-left: 1rem;
    position: relative;
}

.index-entry::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #d4a054;
    opacity: 0.6;
}

/* ========== INTERFERENCE SECTION ========== */
.interference-scanlines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 229, 204, 0.045) 2px,
        rgba(0, 229, 204, 0.06) 4px
    );
    animation: scanline-drift 6s linear infinite;
    pointer-events: none;
    z-index: 1;
}

.card-content-centered {
    position: relative;
    z-index: 10;
    max-width: 700px;
    margin: 0 auto;
    padding: 4rem 2rem;
    text-align: center;
}

.interference-text {
    max-width: 55ch;
    margin: 0 auto;
}

/* ========== SIGNATURE SECTION ========== */
.signature-content {
    position: relative;
    z-index: 10;
    text-align: center;
}

.signature-domain {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: #a08a6e;
    letter-spacing: 0.1em;
}

/* ========== FADE-IN ANIMATIONS ========== */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .card-grid {
        grid-template-columns: 1fr;
        padding: 0 1.5rem;
    }

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

    .card-aside {
        padding-top: 2rem;
        border-top: 1px solid rgba(139, 105, 20, 0.2);
    }

    .spine {
        width: 20px;
    }

    .hero,
    .card {
        margin-left: 20px;
    }

    .blob {
        display: none;
    }

    .svg-motif {
        display: none;
    }

    .hero-title {
        font-size: clamp(2.5rem, 10vw, 4rem);
    }
}

@media (max-width: 480px) {
    .pull-quote {
        font-size: clamp(1.4rem, 5vw, 2rem);
        padding-left: 1rem;
    }
}