/* ============================================
   moral.quest - Gothic Cathedral of Ethical Inquiry
   ============================================ */

/* --- Palette ---
   Cathedral Dark:    #1A0A10
   Burgundy Deep:     #3A1020
   Stained Ruby:      #A02040
   Stained Sapphire:  #2040A0
   Stained Emerald:   #20A040
   Gold Leading:      #8A7040
   Parchment Text:    #E0D8C8
   ----------------------------------------------- */

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: #1A0A10;
    color: #E0D8C8;
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 400;
    font-size: clamp(15px, 1.1vw, 18px);
    line-height: 1.8;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* === Stone Texture Overlay === */
.stone-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
    background-repeat: repeat;
    mix-blend-mode: overlay;
}

/* === Hero Section === */
.hero {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 600px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #1A0A10;
    overflow: hidden;
}

/* Gothic arch frame at top */
.hero-arch-top {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 2;
}

.hero-arch-top svg {
    display: block;
    width: 100%;
    height: 120px;
}

/* Rose Window */
.rose-window {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: clamp(280px, 40vw, 500px);
    height: clamp(280px, 40vw, 500px);
    opacity: 0;
    z-index: 1;
    filter: drop-shadow(0 0 30px rgba(160, 32, 64, 0.2))
            drop-shadow(0 0 60px rgba(32, 64, 160, 0.15))
            drop-shadow(0 0 90px rgba(32, 160, 64, 0.1));
    transition: opacity 2s ease-in-out;
}

.rose-window.visible {
    opacity: 0.2;
}

.rose-svg {
    width: 100%;
    height: 100%;
}

/* Logotype */
.logotype {
    position: relative;
    z-index: 3;
    font-family: 'Abril Fatface', 'Georgia', serif;
    font-weight: 400;
    font-size: clamp(28px, 4vw, 52px);
    color: #E0D8C8;
    text-align: center;
    letter-spacing: 0.02em;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 1.2s ease-out, transform 1.2s ease-out;
}

.logotype.visible {
    opacity: 1;
    transform: translateY(0);
}

.hero-subtitle {
    position: relative;
    z-index: 3;
    font-family: 'Cinzel', 'Georgia', serif;
    font-weight: 700;
    font-size: clamp(12px, 1.2vw, 18px);
    color: #8A7040;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-top: 16px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 1s ease-out 0.6s, transform 1s ease-out 0.6s;
}

.hero-subtitle.visible {
    opacity: 0.8;
    transform: translateY(0);
}

/* Scroll Indicator */
.scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    opacity: 0;
    transition: opacity 1.5s ease-out 1.8s;
}

.scroll-indicator.visible {
    opacity: 0.6;
}

.scroll-dot {
    animation: scrollBounce 2s ease-in-out infinite;
}

@keyframes scrollBounce {
    0%, 100% { cy: 12; }
    50% { cy: 26; }
}

/* === Timeline Section === */
.timeline-section {
    position: relative;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 80px 20px 120px;
}

/* Central Timeline Line */
.timeline-line {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 100%;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        #8A7040 5%,
        #8A7040 95%,
        transparent 100%
    );
    z-index: 0;
}

/* === Timeline Entries === */
.timeline-entry {
    position: relative;
    width: 45%;
    margin-bottom: 80px;
    opacity: 0;
    z-index: 1;
}

.timeline-entry.entry-left {
    margin-right: 52%;
    transform: translateX(-40px);
}

.timeline-entry.entry-right {
    margin-left: 52%;
    transform: translateX(40px);
}

.timeline-entry.revealed {
    opacity: 1;
    transform: translateX(0);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

/* Entry Connector */
.entry-connector {
    position: absolute;
    top: 60px;
    z-index: 2;
    display: flex;
    align-items: center;
}

.entry-left .entry-connector {
    right: -52px;
    flex-direction: row;
}

.entry-right .entry-connector {
    left: -52px;
    flex-direction: row-reverse;
}

.connector-line {
    width: 30px;
    height: 2px;
    background-color: #8A7040;
}

.trefoil {
    flex-shrink: 0;
}

/* Gothic Arch Frame */
.entry-arch-frame {
    position: relative;
    width: 100%;
}

.arch-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.arch-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 0.6s ease-out;
}

.timeline-entry.revealed .arch-path {
    stroke-dashoffset: 0;
}

/* Entry Content */
.entry-content {
    position: relative;
    z-index: 1;
    padding: 30px 25px 35px;
    background: linear-gradient(135deg, rgba(58, 16, 32, 0.6), rgba(26, 10, 16, 0.8));
    clip-path: polygon(0 8%, 50% 0, 100% 8%, 100% 100%, 0 100%);
}

/* Stained Glass Headers */
.stained-glass-header {
    margin-bottom: 20px;
    opacity: 0.8;
    filter: drop-shadow(0 0 8px rgba(160, 32, 64, 0.3));
}

.stained-mini {
    width: 100%;
    height: auto;
    max-height: 60px;
}

/* Entry Typography */
.entry-title {
    font-family: 'Abril Fatface', 'Georgia', serif;
    font-weight: 400;
    font-size: clamp(22px, 2.5vw, 36px);
    color: #E0D8C8;
    margin-bottom: 12px;
    line-height: 1.2;
}

.entry-proposition {
    font-family: 'Cinzel', 'Georgia', serif;
    font-weight: 700;
    font-size: clamp(14px, 1.4vw, 20px);
    color: #8A7040;
    letter-spacing: 0.04em;
    line-height: 1.5;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(138, 112, 64, 0.3);
}

.entry-body {
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 400;
    font-size: clamp(15px, 1.1vw, 18px);
    color: #E0D8C8;
    line-height: 1.8;
    opacity: 0.9;
}

/* Section Break */
.section-break {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 0;
    position: relative;
    z-index: 1;
}

.trefoil-large {
    opacity: 0.7;
}

/* === Footer === */
.cathedral-footer {
    position: relative;
    padding: 80px 20px 60px;
    text-align: center;
    background-color: #1A0A10;
    overflow: hidden;
}

.footer-arch {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1;
}

.footer-arch svg {
    display: block;
    width: 100%;
    height: 100px;
}

.footer-content {
    position: relative;
    z-index: 2;
}

.trefoil-footer {
    display: block;
    margin: 0 auto 20px;
    opacity: 0.6;
}

.footer-text {
    font-family: 'Abril Fatface', 'Georgia', serif;
    font-weight: 400;
    font-size: clamp(18px, 2vw, 28px);
    color: #E0D8C8;
    opacity: 0.7;
    margin-bottom: 8px;
}

.footer-inscription {
    font-family: 'Cinzel', 'Georgia', serif;
    font-weight: 700;
    font-size: clamp(10px, 0.9vw, 14px);
    color: #8A7040;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    opacity: 0.5;
}

/* === Colored Light Cast Effect === */
.timeline-entry.entry-left .entry-content::after {
    content: '';
    position: absolute;
    top: 0;
    right: -60px;
    width: 120px;
    height: 100%;
    background: linear-gradient(90deg, rgba(160, 32, 64, 0.06), transparent);
    pointer-events: none;
    z-index: -1;
}

.timeline-entry.entry-right .entry-content::after {
    content: '';
    position: absolute;
    top: 0;
    left: -60px;
    width: 120px;
    height: 100%;
    background: linear-gradient(-90deg, rgba(32, 64, 160, 0.06), transparent);
    pointer-events: none;
    z-index: -1;
}

/* === Responsive Design === */
@media (max-width: 768px) {
    .timeline-section {
        padding: 40px 15px 80px;
    }

    .timeline-line {
        left: 20px;
        transform: none;
    }

    .timeline-entry {
        width: calc(100% - 50px);
        margin-left: 50px !important;
        margin-right: 0 !important;
    }

    .timeline-entry.entry-left,
    .timeline-entry.entry-right {
        transform: translateX(30px);
    }

    .timeline-entry.revealed {
        transform: translateX(0);
    }

    .entry-connector {
        left: -40px !important;
        right: auto !important;
        flex-direction: row-reverse !important;
    }

    .connector-line {
        width: 20px;
    }

    .entry-content {
        clip-path: polygon(0 6%, 50% 0, 100% 6%, 100% 100%, 0 100%);
        padding: 24px 18px 28px;
    }

    .hero-arch-top svg {
        height: 80px;
    }

    .rose-window {
        width: 260px;
        height: 260px;
    }
}

@media (max-width: 480px) {
    .timeline-entry {
        margin-bottom: 50px;
    }

    .entry-title {
        font-size: 22px;
    }

    .entry-proposition {
        font-size: 14px;
    }

    .entry-body {
        font-size: 15px;
    }

    .rose-window {
        width: 220px;
        height: 220px;
    }
}

/* === Animation Utility === */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Glow pulse for rose window */
@keyframes roseGlow {
    0%, 100% {
        filter: drop-shadow(0 0 30px rgba(160, 32, 64, 0.2))
                drop-shadow(0 0 60px rgba(32, 64, 160, 0.15))
                drop-shadow(0 0 90px rgba(32, 160, 64, 0.1));
    }
    50% {
        filter: drop-shadow(0 0 40px rgba(160, 32, 64, 0.3))
                drop-shadow(0 0 80px rgba(32, 64, 160, 0.2))
                drop-shadow(0 0 120px rgba(32, 160, 64, 0.15));
    }
}

.rose-window.visible {
    animation: roseGlow 6s ease-in-out infinite;
}
