/* moral.quest -- A Cathedral of Ethical Inquiry
   Palette: deep burgundy, gothic, stained-glass jewel tones
*/

:root {
    --cathedral-dark: #1A0A10;
    --burgundy-deep: #3A1020;
    --stained-ruby: #A02040;
    --stained-sapphire: #2040A0;
    --stained-emerald: #20A040;
    --gold-leading: #8A7040;
    --parchment: #E0D8C8;

    --font-display: "Abril Fatface", "Cinzel", serif;
    --font-prop: "Cinzel", "EB Garamond", serif;
    --font-body: "EB Garamond", "Cinzel", serif;

    --reveal-duration: 600ms;
    --frame-draw-duration: 900ms;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-size: clamp(15px, 1.1vw, 18px);
    line-height: 1.8;
    color: var(--parchment);
    background: var(--cathedral-dark);
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

.stone-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.stone-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.04;
    background-image:
        radial-gradient(circle at 25% 30%, rgba(224, 216, 200, 0.6) 0.5px, transparent 1px),
        radial-gradient(circle at 75% 70%, rgba(138, 112, 64, 0.4) 0.5px, transparent 1px),
        radial-gradient(circle at 50% 50%, rgba(160, 32, 64, 0.3) 0.5px, transparent 1px),
        repeating-linear-gradient(45deg, rgba(58, 16, 32, 0.6) 0 1px, transparent 1px 3px),
        repeating-linear-gradient(-45deg, rgba(26, 10, 16, 0.6) 0 1px, transparent 1px 3px);
    background-size: 7px 7px, 11px 11px, 13px 13px, auto, auto;
}

/* ==========================================================
   Cathedral Portal (opening viewport)
   ========================================================== */

.cathedral-portal {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 2;
    padding: 0 clamp(20px, 5vw, 80px);
}

.rose-window-wrap {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    animation: roseGlow 2200ms ease-out 200ms forwards;
}

.rose-window {
    width: clamp(360px, 60vmin, 720px);
    height: clamp(360px, 60vmin, 720px);
    opacity: 0.35;
    filter: drop-shadow(0 0 48px rgba(160, 32, 64, 0.35));
    animation: rosePulse 9s ease-in-out infinite;
}

.rose-petals {
    transform-origin: 300px 300px;
    animation: roseRotate 90s linear infinite;
}

@keyframes roseGlow {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes rosePulse {
    0%, 100% { opacity: 0.32; }
    50% { opacity: 0.42; }
}

@keyframes roseRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.portal-arches {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: clamp(80px, 12vh, 160px);
    pointer-events: none;
}

.portal-arches svg {
    width: 100%;
    height: 100%;
    display: block;
}

.portal-content {
    position: relative;
    z-index: 3;
    text-align: center;
    max-width: min(900px, 90%);
    opacity: 0;
    animation: portalRise 1400ms ease-out 600ms forwards;
}

@keyframes portalRise {
    from {
        opacity: 0;
        transform: translateY(28px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.portal-eyebrow {
    font-family: var(--font-prop);
    font-weight: 400;
    font-size: clamp(11px, 0.95vw, 14px);
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--gold-leading);
    margin-bottom: clamp(20px, 3vh, 40px);
}

.logotype {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(48px, 9vw, 132px);
    line-height: 1;
    letter-spacing: -0.01em;
    color: var(--parchment);
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 0;
    text-shadow:
        0 0 40px rgba(160, 32, 64, 0.45),
        0 4px 0 rgba(26, 10, 16, 0.9);
}

.logotype .dot {
    color: var(--stained-ruby);
    margin: 0 0.04em;
    text-shadow:
        0 0 24px rgba(160, 32, 64, 0.7),
        0 0 6px rgba(160, 32, 64, 0.9);
}

.portal-tagline {
    font-family: var(--font-prop);
    font-weight: 400;
    font-size: clamp(14px, 1.4vw, 20px);
    letter-spacing: 0.08em;
    color: var(--parchment);
    opacity: 0.78;
    margin-top: clamp(24px, 3.5vh, 48px);
    font-style: italic;
}

.portal-glyph {
    margin: clamp(28px, 4vh, 56px) auto clamp(12px, 2vh, 24px);
    width: clamp(28px, 3vw, 40px);
    height: clamp(28px, 3vw, 40px);
}

.portal-glyph svg {
    width: 100%;
    height: 100%;
}

.portal-descend {
    font-family: var(--font-prop);
    font-weight: 700;
    font-size: clamp(10px, 0.85vw, 12px);
    letter-spacing: 0.45em;
    text-transform: uppercase;
    color: var(--gold-leading);
    margin-bottom: clamp(14px, 2vh, 24px);
    opacity: 0.85;
}

.portal-arrow {
    width: 18px;
    height: 30px;
    margin: 0 auto;
    animation: arrowDrift 2.6s ease-in-out infinite;
}

.portal-arrow svg {
    width: 100%;
    height: 100%;
}

@keyframes arrowDrift {
    0%, 100% { transform: translateY(0); opacity: 0.5; }
    50% { transform: translateY(8px); opacity: 1; }
}

/* ==========================================================
   Nave -- main scrolling content
   ========================================================== */

.nave {
    position: relative;
    z-index: 2;
    background:
        linear-gradient(180deg,
            var(--cathedral-dark) 0%,
            #110608 50%,
            var(--cathedral-dark) 100%);
}

/* Invocation -- intro proposition */
.invocation {
    padding: clamp(80px, 14vh, 200px) clamp(20px, 5vw, 80px);
    display: flex;
    justify-content: center;
}

.invocation-frame {
    max-width: 760px;
    text-align: center;
    padding: clamp(40px, 6vh, 80px) clamp(28px, 5vw, 64px);
    border: 1px solid rgba(138, 112, 64, 0.28);
    background:
        radial-gradient(ellipse at center, rgba(58, 16, 32, 0.55) 0%, rgba(26, 10, 16, 0.85) 80%);
    clip-path: polygon(0 12%, 50% 0, 100% 12%, 100% 100%, 0 100%);
    position: relative;
}

.proposition {
    font-family: var(--font-prop);
    font-weight: 700;
    font-size: clamp(20px, 2.4vw, 32px);
    letter-spacing: 0.04em;
    color: var(--parchment);
    line-height: 1.5;
    margin-bottom: clamp(16px, 2vh, 28px);
}

.invocation-attribution {
    font-family: var(--font-body);
    font-style: italic;
    font-size: clamp(13px, 1vw, 16px);
    color: var(--gold-leading);
    margin-bottom: clamp(28px, 4vh, 48px);
    letter-spacing: 0.05em;
}

.invocation-text p {
    margin-bottom: 1.2em;
    color: var(--parchment);
    opacity: 0.86;
    text-align: left;
}

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

/* ==========================================================
   Timeline -- central spine with alternating entries
   ========================================================== */

.timeline {
    position: relative;
    padding: clamp(40px, 8vh, 120px) clamp(20px, 5vw, 80px) clamp(60px, 10vh, 160px);
    max-width: 1280px;
    margin: 0 auto;
}

.timeline-spine {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    transform: translateX(-50%);
    background: linear-gradient(180deg,
        rgba(138, 112, 64, 0) 0%,
        rgba(138, 112, 64, 0.55) 8%,
        rgba(138, 112, 64, 0.7) 50%,
        rgba(138, 112, 64, 0.55) 92%,
        rgba(138, 112, 64, 0) 100%);
    z-index: 1;
}

.timeline-spine::before,
.timeline-spine::after {
    content: '';
    position: absolute;
    left: 50%;
    width: 1px;
    height: 100%;
    transform: translateX(-50%);
    background: rgba(138, 112, 64, 0.18);
}

.timeline-spine::before { transform: translateX(-7px); }
.timeline-spine::after { transform: translateX(6px); }

.timeline-trefoil {
    position: relative;
    width: 32px;
    height: 32px;
    margin: 0 auto;
    display: block;
    z-index: 4;
    background: var(--cathedral-dark);
    border-radius: 50%;
    padding: 4px;
}

.timeline-trefoil-top { margin-bottom: clamp(40px, 6vh, 80px); }
.timeline-trefoil-mid { margin: clamp(32px, 5vh, 64px) auto; }
.timeline-trefoil-bottom { margin-top: clamp(40px, 6vh, 80px); }

.timeline-trefoil svg {
    width: 100%;
    height: 100%;
}

/* Entries */
.entry {
    position: relative;
    width: 50%;
    padding: clamp(24px, 3.5vh, 48px) 0;
    z-index: 2;
    opacity: 0;
    transition:
        opacity var(--reveal-duration) ease-out,
        transform var(--reveal-duration) ease-out;
}

.entry-left {
    margin-right: 50%;
    padding-right: clamp(40px, 6vw, 80px);
    transform: translateX(-40px);
}

.entry-right {
    margin-left: 50%;
    padding-left: clamp(40px, 6vw, 80px);
    transform: translateX(40px);
}

.entry.is-revealed {
    opacity: 1;
    transform: translateX(0);
}

/* Connector horizontal bar with trefoil endpoint */
.entry::before {
    content: '';
    position: absolute;
    top: 50%;
    width: clamp(40px, 6vw, 80px);
    height: 1px;
    background: linear-gradient(90deg,
        rgba(138, 112, 64, 0) 0%,
        rgba(138, 112, 64, 0.7) 100%);
    transform: translateY(-50%);
    transform-origin: right center;
    transition: transform 700ms ease-out 200ms;
    transform: translateY(-50%) scaleX(0);
}

.entry-left::before {
    right: 0;
    background: linear-gradient(90deg,
        rgba(138, 112, 64, 0) 0%,
        rgba(138, 112, 64, 0.7) 100%);
    transform-origin: left center;
}

.entry-right::before {
    left: 0;
    background: linear-gradient(90deg,
        rgba(138, 112, 64, 0.7) 0%,
        rgba(138, 112, 64, 0) 100%);
    transform-origin: right center;
}

.entry.is-revealed::before {
    transform: translateY(-50%) scaleX(1);
}

/* Connector trefoil endpoint dot */
.entry::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 10px;
    height: 10px;
    background: var(--gold-leading);
    border-radius: 50%;
    transform: translateY(-50%) scale(0);
    transition: transform 400ms ease-out 700ms;
    box-shadow: 0 0 8px rgba(138, 112, 64, 0.6);
}

.entry-left::after { right: -5px; }
.entry-right::after { left: -5px; }

.entry.is-revealed::after {
    transform: translateY(-50%) scale(1);
}

/* Entry frame -- gothic arch around content */
.entry-frame {
    position: relative;
    background:
        linear-gradient(160deg,
            rgba(58, 16, 32, 0.92) 0%,
            rgba(26, 10, 16, 0.96) 100%);
    padding: clamp(28px, 4vh, 48px) clamp(24px, 3vw, 40px) clamp(28px, 4vh, 48px);
    clip-path: polygon(0 12%, 50% 0, 100% 12%, 100% 100%, 0 100%);
    border-bottom: 1px solid rgba(138, 112, 64, 0.4);
}

.entry-arch {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    transition:
        opacity 240ms ease-out,
        stroke-dashoffset var(--frame-draw-duration) ease-out;
}

.entry.is-revealed .entry-arch {
    opacity: 1;
    stroke-dashoffset: 0;
}

.entry-glass {
    width: clamp(72px, 8vw, 110px);
    height: clamp(72px, 8vw, 110px);
    margin: 0 auto clamp(20px, 3vh, 32px);
    filter: drop-shadow(0 0 12px currentColor);
    opacity: 0;
    transform: scale(0.7);
    transition:
        opacity 700ms ease-out 400ms,
        transform 700ms ease-out 400ms;
}

.entry.is-revealed .entry-glass {
    opacity: 1;
    transform: scale(1);
}

.entry-glass-ruby { color: rgba(160, 32, 64, 0.45); }
.entry-glass-sapphire { color: rgba(32, 64, 160, 0.45); }
.entry-glass-emerald { color: rgba(32, 160, 64, 0.4); }

.entry-glass svg {
    width: 100%;
    height: 100%;
    display: block;
}

.entry-body {
    position: relative;
    z-index: 2;
}

.entry-chamber {
    font-family: var(--font-prop);
    font-weight: 400;
    font-size: clamp(10px, 0.8vw, 12px);
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: var(--gold-leading);
    text-align: center;
    margin-bottom: clamp(12px, 1.6vh, 18px);
}

.entry-question {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(22px, 3vw, 38px);
    line-height: 1.18;
    text-align: center;
    color: var(--parchment);
    margin-bottom: clamp(18px, 2.4vh, 28px);
    text-shadow: 0 0 24px rgba(160, 32, 64, 0.25);
}

.entry-proposition {
    font-family: var(--font-prop);
    font-weight: 700;
    font-size: clamp(15px, 1.4vw, 19px);
    letter-spacing: 0.04em;
    line-height: 1.5;
    text-align: center;
    color: var(--stained-ruby);
    margin-bottom: clamp(20px, 2.8vh, 32px);
    padding: clamp(12px, 1.8vh, 18px) 0;
    border-top: 1px solid rgba(138, 112, 64, 0.3);
    border-bottom: 1px solid rgba(138, 112, 64, 0.3);
    font-style: italic;
}

.entry-text {
    font-family: var(--font-body);
    font-size: clamp(14px, 1.05vw, 17px);
    line-height: 1.85;
    color: var(--parchment);
    opacity: 0.88;
    margin-bottom: clamp(20px, 2.6vh, 28px);
    text-align: justify;
    hyphens: auto;
}

.entry-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    justify-content: center;
    padding-top: clamp(8px, 1.2vh, 12px);
    border-top: 1px solid rgba(138, 112, 64, 0.18);
}

.meta-tag {
    font-family: var(--font-prop);
    font-weight: 400;
    font-size: clamp(10px, 0.78vw, 12px);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--gold-leading);
    padding: 3px 10px;
    border: 1px solid rgba(138, 112, 64, 0.4);
    background: rgba(58, 16, 32, 0.5);
}

/* ==========================================================
   Benediction -- closing chamber
   ========================================================== */

.benediction {
    padding: clamp(60px, 10vh, 140px) clamp(20px, 5vw, 80px) clamp(80px, 12vh, 180px);
    display: flex;
    justify-content: center;
    position: relative;
}

.benediction-arch {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: clamp(280px, 40vw, 480px);
    height: clamp(160px, 20vh, 240px);
    pointer-events: none;
    opacity: 0.6;
}

.benediction-arch svg {
    width: 100%;
    height: 100%;
}

.benediction-content {
    max-width: 720px;
    text-align: center;
    position: relative;
    z-index: 2;
    padding-top: clamp(80px, 12vh, 160px);
}

.benediction-eyebrow {
    font-family: var(--font-prop);
    font-weight: 400;
    font-size: clamp(11px, 0.95vw, 14px);
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--gold-leading);
    margin-bottom: clamp(28px, 4vh, 48px);
}

.benediction-prop {
    color: var(--parchment);
    margin-bottom: clamp(28px, 4vh, 48px);
}

.benediction-text {
    font-family: var(--font-body);
    font-size: clamp(15px, 1.15vw, 18px);
    line-height: 1.85;
    color: var(--parchment);
    opacity: 0.85;
    margin-bottom: clamp(36px, 5vh, 56px);
    font-style: italic;
}

.benediction-trefoils {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(20px, 3vw, 40px);
    margin-bottom: clamp(28px, 4vh, 40px);
}

.benediction-trefoils svg {
    width: 24px;
    height: 24px;
    opacity: 0.8;
}

.benediction-trefoils svg:nth-child(2) {
    width: 32px;
    height: 32px;
    opacity: 1;
}

.benediction-mark {
    font-family: var(--font-display);
    font-size: clamp(20px, 2vw, 28px);
    color: var(--parchment);
    letter-spacing: 0.18em;
    opacity: 0.7;
}

/* ==========================================================
   Footer
   ========================================================== */

.cathedral-footer {
    padding: clamp(40px, 6vh, 80px) clamp(20px, 5vw, 80px);
    text-align: center;
    border-top: 1px solid rgba(138, 112, 64, 0.2);
    background: var(--cathedral-dark);
    position: relative;
    z-index: 3;
}

.cathedral-footer p {
    font-family: var(--font-prop);
    font-weight: 400;
    font-size: clamp(11px, 0.9vw, 13px);
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--gold-leading);
    margin-bottom: 8px;
}

.cathedral-footer .footer-sub {
    font-family: var(--font-body);
    font-style: italic;
    text-transform: none;
    letter-spacing: 0.08em;
    color: var(--parchment);
    opacity: 0.55;
    font-size: clamp(12px, 0.95vw, 14px);
}

/* ==========================================================
   Responsive (mobile -- collapse timeline to single column)
   ========================================================== */

@media (max-width: 760px) {
    .timeline-spine { left: 24px; transform: none; }
    .timeline-trefoil { margin-left: 8px; margin-right: auto; }

    .entry {
        width: calc(100% - 48px);
        margin-left: 48px;
        margin-right: 0;
        padding-left: 0;
        padding-right: 0;
        transform: translateX(40px);
    }

    .entry-left,
    .entry-right {
        margin-left: 48px;
        margin-right: 0;
        padding-left: 0;
        padding-right: 0;
    }

    .entry::before {
        width: 24px;
        left: -24px;
        right: auto;
        background: linear-gradient(90deg,
            rgba(138, 112, 64, 0.7) 0%,
            rgba(138, 112, 64, 0) 100%);
        transform-origin: left center;
    }

    .entry::after {
        left: -29px;
        right: auto;
    }

    .logotype {
        font-size: clamp(40px, 13vw, 80px);
    }

    .entry-frame {
        clip-path: polygon(0 8%, 50% 0, 100% 8%, 100% 100%, 0 100%);
        padding: clamp(24px, 4vh, 36px) clamp(20px, 4vw, 32px);
    }

    .entry-text {
        text-align: left;
    }
}

/* Reduce-motion friendliness */
@media (prefers-reduced-motion: reduce) {
    .rose-petals { animation: none; }
    .rose-window { animation: none; }
    .portal-arrow { animation: none; }
    .entry,
    .entry-arch,
    .entry-glass,
    .entry::before,
    .entry::after {
        transition: none;
    }
}
