/* ============================================================================
   SUPREMACY.LEGACY - NEOCLASSICAL INSTITUTIONAL FORMALISM
   Typography: Playfair Display (serif display) + Lora (serif body) + IBM Plex Mono
   Palette: Monochromatic + Gilt Edge (#d4a574)
   Motif: Vertical columnar architecture with classical institutional markers
   ============================================================================ */

/* ============================================================================
   RESET & BASE STYLES
   ============================================================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Lora', serif;
    background-color: #1a1a1a;
    color: #e8e6e1;
    line-height: 1.8;
    overflow-x: hidden;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #d4a574 0%, #8b7355 100%);
    border-radius: 6px;
    border: 2px solid #1a1a1a;
    box-shadow: inset 0 0 4px rgba(212, 165, 116, 0.3);
}

::-webkit-scrollbar-thumb:hover {
    box-shadow: inset 0 0 8px rgba(212, 165, 116, 0.5), 0 0 12px rgba(212, 165, 116, 0.3);
}

/* ============================================================================
   VIEWPORT FRAME & COLONNADE
   ============================================================================ */

.viewport-frame {
    position: relative;
    width: 100%;
    min-height: 100vh;
}

.colonnade-frame {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    pointer-events: none;
    z-index: 1;
}

.column-line {
    position: absolute;
    top: 0;
    width: 1px;
    height: 100%;
    background-color: #2d2d2d;
    opacity: 0.12;
    transition: opacity 0.3s ease-out;
}

/* ============================================================================
   SECTIONS - STRUCTURAL
   ============================================================================ */

.heritage-section {
    position: relative;
    width: 100%;
    min-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    border-bottom: 1px solid #2d2d2d;
    background: linear-gradient(180deg, #1a1a1a 0%, #2a2a2a 100%);
    overflow: hidden;
    z-index: 2;
}

.heritage-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.04;
    background-image:
        repeating-linear-gradient(90deg, transparent, transparent 19px, #d4a574 19px, #d4a574 20px),
        repeating-linear-gradient(0deg, transparent, transparent 9px, #d4a574 9px, #d4a574 10px);
    pointer-events: none;
}

.section-foundation {
    min-height: 100vh;
    background: #1a1a1a;
}

.section-content {
    position: relative;
    width: 100%;
    max-width: 900px;
    z-index: 3;
}

/* Section-specific background depth */
#section-1 { background: linear-gradient(180deg, #1a1a1a 0%, #1f1f1f 100%); }
#section-2 { background: linear-gradient(180deg, #1f1f1f 0%, #242424 100%); }
#section-3 { background: linear-gradient(180deg, #242424 0%, #2a2a2a 100%); }
#section-4 { background: linear-gradient(180deg, #2a2a2a 0%, #1a1a1a 100%); }

/* ============================================================================
   FOUNDATION SECTION (HERO)
   ============================================================================ */

.foundation-marker {
    position: absolute;
    top: 15%;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 60px;
    border: 2px solid #d4a574;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 50%, #e6c89f 0%, #8b7355 100%);
    opacity: 0;
    animation: fadeInSeal 0.6s ease-out 0.4s forwards;
}

.domain-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.8rem, 12vw, 9rem);
    font-weight: 700;
    text-align: center;
    letter-spacing: -0.025em;
    color: #e8e6e1;
    text-transform: lowercase;
    margin: 0;
    line-height: 1;
    animation: letterFadeInTitle 0.1s ease-out 0.3s both;
}

.domain-title::first-letter {
    animation: letterFadeInTitle 0.1s ease-out 0.3s forwards;
}

.plinth-line {
    width: 100%;
    height: 1px;
    background-color: #2d2d2d;
    margin: 40px 0;
    opacity: 0;
    animation: slideInLine 0.8s ease-out 0.8s forwards;
}

.heritage-subtitle {
    font-family: 'Playfair Display', serif;
    font-size: clamp(0.9rem, 2vw, 1.3rem);
    font-weight: 400;
    text-align: center;
    letter-spacing: 0.15em;
    color: #e8e6e1;
    text-transform: uppercase;
    margin-top: 30px;
    opacity: 0;
    animation: letterFadeIn 0.12s ease-out 1.2s both;
}

/* ============================================================================
   INSTITUTIONAL SECTIONS (1-3)
   ============================================================================ */

.section-institutional .section-content {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 60px;
    align-items: start;
}

.margin-seal {
    position: absolute;
    left: 30px;
    top: 40px;
    width: 50px;
    height: 50px;
    border: 2px solid #d4a574;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 50%, #e6c89f 0%, #8b7355 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1.2rem;
    color: #1a1a1a;
    font-weight: 600;
}

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

.section-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #e8e6e1;
    margin-bottom: 30px;
    line-height: 1.2;
}

.section-body {
    font-family: 'Lora', serif;
    font-size: clamp(1rem, 1.1vw, 1.2rem);
    line-height: 1.8;
    color: #e8e6e1;
    margin-bottom: 24px;
    text-align: justify;
    opacity: 0.95;
}

.section-body:last-child {
    margin-bottom: 0;
}

.heritage-index {
    grid-column: 2;
    grid-row: 1;
    padding: 20px 0;
    border-left: 1px solid #2d2d2d;
    padding-left: 20px;
}

.index-entry {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    color: #4a4a4a;
    margin-bottom: 16px;
    line-height: 1.5;
    transition: color 0.3s ease;
}

.index-entry:hover {
    color: #d4a574;
}

/* ============================================================================
   ARCHIVE SECTION (4)
   ============================================================================ */

.section-archive {
    min-height: 100vh;
    padding: 80px 40px;
    background: linear-gradient(180deg, #2a2a2a 0%, #1a1a1a 100%);
}

.archive-content {
    position: relative;
    width: 100%;
    max-width: 1000px;
    z-index: 3;
}

.archive-intro {
    text-align: center;
    margin-bottom: 80px;
}

.archive-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2rem, 6vw, 3.5rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #e8e6e1;
    margin-bottom: 20px;
}

.archive-subtitle {
    font-family: 'Lora', serif;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    color: #8b8b8b;
    font-style: italic;
    letter-spacing: 0.05em;
}

.archive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 30px;
    background: radial-gradient(circle at 50% 50%, rgba(212, 165, 116, 0.05) 0%, transparent 70%);
    padding: 60px;
    border: 1px solid #2d2d2d;
}

.archive-entry {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.9rem;
    color: #e8e6e1;
    line-height: 1.8;
    padding: 15px;
    border-left: 2px solid #d4a574;
    padding-left: 15px;
    background: rgba(45, 45, 45, 0.3);
    transition: all 0.3s ease;
    text-align: left;
}

.archive-entry:hover {
    background: rgba(212, 165, 116, 0.1);
    border-left-color: #e6c89f;
    transform: translateX(4px);
}

/* ============================================================================
   NAVIGATION SIDEBAR
   ============================================================================ */

.section-nav {
    position: fixed;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 30px;
    z-index: 100;
    opacity: 0;
    animation: fadeInNav 0.6s ease-out 2s forwards;
}

.nav-marker {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    color: #4a4a4a;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.6;
    font-weight: 400;
}

.nav-marker:hover {
    color: #d4a574;
    opacity: 1;
    transform: scale(1.15);
}

.nav-marker.active {
    color: #d4a574;
    opacity: 1;
    text-shadow: 0 0 12px rgba(212, 165, 116, 0.4);
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

@keyframes fadeInSeal {
    from {
        opacity: 0;
        transform: translateX(-50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }
}

@keyframes letterFadeInTitle {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes letterFadeIn {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLine {
    from {
        opacity: 0;
        width: 0;
    }
    to {
        opacity: 1;
        width: 100%;
    }
}

@keyframes fadeInNav {
    from {
        opacity: 0;
        transform: translateY(-50%) translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
}

/* Breathing animation for index entries on scroll */
@keyframes breathingOpacity {
    0%, 100% {
        opacity: 0.15;
    }
    50% {
        opacity: 0.3;
    }
}

/* ============================================================================
   SCROLL-RESPONSIVE DYNAMICS
   ============================================================================ */

.column-line.foreground {
    opacity: 0.4;
}

.column-line.background {
    opacity: 0.08;
}

.section-body {
    transition: opacity 0.3s ease;
}

.section-body.scrolled-past {
    opacity: 0.7;
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

@media (max-width: 768px) {
    .section-institutional .section-content {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .heritage-index {
        grid-column: 1;
        border-left: none;
        border-top: 1px solid #2d2d2d;
        padding-left: 0;
        padding-top: 40px;
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        gap: 20px;
    }

    .index-entry {
        white-space: nowrap;
        flex-shrink: 0;
    }

    .margin-seal {
        display: none;
    }

    .colonnade-frame {
        display: none;
    }

    .heritage-section {
        padding: 40px 20px;
        min-height: 65vh;
    }

    .section-foundation {
        min-height: 80vh;
    }

    .section-archive {
        min-height: auto;
        padding: 60px 20px;
    }

    .archive-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 30px;
    }

    .section-nav {
        right: 15px;
        gap: 20px;
        opacity: 1;
        animation: none;
    }

    .nav-marker {
        font-size: 0.9rem;
    }

    .domain-title {
        font-size: clamp(2rem, 8vw, 3.5rem);
    }

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

    .section-body {
        text-align: left;
        font-size: clamp(0.95rem, 1vw, 1.1rem);
    }
}

@media (max-width: 480px) {
    .heritage-section {
        padding: 30px 16px;
        min-height: 60vh;
    }

    .section-nav {
        right: 10px;
        gap: 15px;
    }

    .nav-marker {
        font-size: 0.8rem;
    }

    .margin-seal {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .archive-grid {
        padding: 20px;
        gap: 15px;
    }

    .archive-entry {
        font-size: 0.8rem;
        padding: 10px;
    }
}

/* ============================================================================
   ACCESSIBILITY & INTERACTION
   ============================================================================ */

a {
    color: #d4a574;
    text-decoration: none;
    border-bottom: 1px solid #d4a574;
    transition: all 0.3s ease;
}

a:hover {
    color: #e6c89f;
    text-shadow: 0 0 12px rgba(212, 165, 116, 0.4);
}

button, .interactive {
    background: none;
    border: 1px solid #d4a574;
    color: #d4a574;
    padding: 12px 20px;
    cursor: pointer;
    font-family: 'Lora', serif;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

button:hover, .interactive:hover {
    background: rgba(212, 165, 116, 0.1);
    box-shadow: 0 0 12px rgba(212, 165, 116, 0.3);
    transform: scale(1.04);
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

@media print {
    .colonnade-frame,
    .section-nav {
        display: none;
    }

    .heritage-section {
        page-break-inside: avoid;
        break-inside: avoid;
    }
}
