/* ============================================
   scire.bar - Styles
   A 1920s bibliothèque speakeasy for knowledge
   ============================================ */

:root {
    /* Palette */
    --color-primary-bg: #F5ECD7;
    --color-secondary-bg: #E8D9B8;
    --color-dark-bg: #1E1810;
    --color-text-primary: #3B2F1E;
    --color-text-body: #5C4A32;
    --color-text-accent: #7A6548;
    --color-highlight: #C4973B;
    --color-border: #B8A88A;
    --color-shadow: #2A2118;
    --color-decorative: #8B6914;
    --color-accent: #9C8B72;

    /* Spacing */
    --gutter: 64px;
    --outer-margin: 120px;
    --baseline: 48px;
    --shadow-gap: 24px;

    /* Diagonal angle */
    --angle: 6deg;
}

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

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

body {
    font-family: 'Lora', Georgia, serif;
    background-color: var(--color-dark-bg);
    color: var(--color-text-body);
    line-height: 1.78;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   Bokeh Background (CSS-generated)
   ============================================ */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(circle 80px at 15% 20%, rgba(196, 151, 59, 0.06) 0%, transparent 70%),
        radial-gradient(circle 120px at 75% 15%, rgba(139, 105, 20, 0.05) 0%, transparent 70%),
        radial-gradient(circle 60px at 40% 60%, rgba(196, 151, 59, 0.04) 0%, transparent 70%),
        radial-gradient(circle 100px at 85% 70%, rgba(139, 105, 20, 0.07) 0%, transparent 70%),
        radial-gradient(circle 90px at 25% 80%, rgba(196, 151, 59, 0.05) 0%, transparent 70%),
        radial-gradient(circle 70px at 60% 35%, rgba(139, 105, 20, 0.06) 0%, transparent 70%),
        radial-gradient(circle 110px at 10% 50%, rgba(196, 151, 59, 0.04) 0%, transparent 70%),
        radial-gradient(circle 85px at 90% 45%, rgba(139, 105, 20, 0.08) 0%, transparent 70%),
        radial-gradient(circle 95px at 50% 90%, rgba(196, 151, 59, 0.05) 0%, transparent 70%),
        radial-gradient(circle 75px at 30% 10%, rgba(139, 105, 20, 0.03) 0%, transparent 70%),
        radial-gradient(circle 130px at 70% 85%, rgba(196, 151, 59, 0.06) 0%, transparent 70%),
        radial-gradient(circle 65px at 5% 95%, rgba(139, 105, 20, 0.07) 0%, transparent 70%);
}

/* ============================================
   Navigation Circle
   ============================================ */
.nav-circle {
    position: fixed;
    top: 32px;
    left: 32px;
    z-index: 1000;
    cursor: pointer;
}

.nav-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: var(--color-highlight);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 0.3s ease;
}

.nav-circle:hover .nav-dot {
    transform: scale(1.2);
    box-shadow: 0 0 20px rgba(196, 151, 59, 0.35);
}

.nav-menu {
    list-style: none;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    padding: 30px 0 0 0;
}

.nav-circle:hover .nav-menu {
    opacity: 1;
    pointer-events: all;
    transform: translateX(0);
}

.nav-link {
    display: block;
    padding: 6px 0;
    font-family: 'Playfair Display SC', serif;
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-highlight);
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

.nav-link:hover {
    color: var(--color-primary-bg);
    text-shadow: 0 0 12px rgba(196, 151, 59, 0.3);
}

/* ============================================
   Margin Annotations
   ============================================ */
.margin-annotation {
    position: absolute;
    font-family: 'IM Fell English', serif;
    font-style: italic;
    font-size: 0.7rem;
    color: var(--color-text-accent);
    opacity: 0.2;
    transition: opacity 0.4s ease;
    z-index: 5;
    pointer-events: auto;
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

.margin-annotation:hover {
    opacity: 0.5;
}

/* ============================================
   Diagonal Sections
   ============================================ */
.diagonal-section {
    position: relative;
    min-height: 100vh;
    padding: 120px var(--outer-margin);
    will-change: clip-path, transform;
    z-index: 1;
    transition: transform 0.1s linear;
}

.diagonal-section::after {
    content: '';
    display: block;
    height: var(--shadow-gap);
    background-color: var(--color-dark-bg);
    position: absolute;
    bottom: -12px;
    left: 0;
    right: 0;
    z-index: -1;
}

/* Section variations */
.section-hero {
    background-color: var(--color-primary-bg);
    clip-path: polygon(0 0, 100% 0, 100% 92%, 0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.section-dark {
    background-color: var(--color-dark-bg);
    clip-path: polygon(0 4%, 100% 0, 100% 96%, 0 92%);
    margin-top: -60px;
}

.section-light {
    background-color: var(--color-secondary-bg);
    clip-path: polygon(0 0, 100% 6%, 100% 94%, 0 100%);
    margin-top: -60px;
}

.section-taper {
    background-color: var(--color-primary-bg);
    clip-path: polygon(0 6%, 100% 0, 85% 100%, 15% 100%);
    margin-top: -60px;
    padding-bottom: 80px;
}

.section-inner {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* ============================================
   Skeleton Loading
   ============================================ */
.skeleton-lines {
    display: flex;
    flex-direction: column;
    gap: calc(1.78rem - 4px);
    padding: 40px 0;
}

.skeleton-line {
    height: 4px;
    border-radius: 2px;
    animation: skeletonPulse 1.5s ease-in-out infinite;
}

.skeleton-line-heading {
    height: 8px;
    width: 40%;
    border-radius: 4px;
    margin-bottom: 24px;
    animation: skeletonPulse 1.5s ease-in-out infinite;
}

.section-hero .skeleton-line,
.section-light .skeleton-line,
.section-taper .skeleton-line {
    background-color: var(--color-secondary-bg);
}

.section-hero .skeleton-line-heading,
.section-light .skeleton-line-heading,
.section-taper .skeleton-line-heading {
    background-color: var(--color-secondary-bg);
}

.section-dark .skeleton-line {
    background-color: var(--color-shadow);
}

.section-dark .skeleton-line-heading {
    background-color: var(--color-shadow);
}

@keyframes skeletonPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.6; }
}

.skeleton-lines.dissolved {
    animation: dissolveSkeleton 0.4s ease-out forwards;
}

@keyframes dissolveSkeleton {
    to { opacity: 0; height: 0; padding: 0; overflow: hidden; }
}

/* ============================================
   Content
   ============================================ */
.section-content {
    opacity: 1;
    transition: opacity 0.4s ease-out;
}

.section-content.hidden {
    opacity: 0;
    pointer-events: none;
}

.section-content.visible {
    opacity: 1;
    pointer-events: auto;
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--gutter);
    align-items: start;
}

.content-column.span-full {
    grid-column: 1 / -1;
    max-width: 800px;
}

/* ============================================
   Typography
   ============================================ */
.hero-title {
    font-family: 'Playfair Display SC', serif;
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 6rem);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-text-primary);
    text-align: center;
}

.letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(6px);
    animation: letterReveal 0.5s ease-out forwards;
    animation-delay: calc(var(--i) * 80ms);
    animation-play-state: paused;
}

.letter.animate {
    animation-play-state: running;
}

@keyframes letterReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-subtitle {
    font-family: 'IM Fell English', serif;
    font-style: italic;
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: var(--color-text-accent);
    text-align: center;
    margin-top: 24px;
    opacity: 0;
    transition: opacity 0.8s ease-out 0.6s;
}

.hero-subtitle.visible {
    opacity: 1;
}

.section-heading {
    font-family: 'Playfair Display SC', serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 4.2rem);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-text-primary);
    margin-bottom: 32px;
}

.section-dark .section-heading {
    color: var(--color-primary-bg);
}

.body-text {
    font-family: 'Lora', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.15vw, 1.2rem);
    line-height: 1.78;
    color: var(--color-text-body);
    margin-bottom: 24px;
}

.body-text em {
    font-weight: 600;
    font-style: italic;
}

.dark-text {
    color: var(--color-secondary-bg);
}

.pull-quote {
    font-family: 'IM Fell English', serif;
    font-style: italic;
    font-size: clamp(0.85rem, 1vw, 1.05rem);
    color: var(--color-text-accent);
    border-left: 2px solid var(--color-highlight);
    padding-left: 24px;
    margin-top: 16px;
}

.dark-quote {
    color: var(--color-border);
    border-left-color: var(--color-decorative);
}

.attribution {
    display: block;
    margin-top: 8px;
    font-size: 0.8rem;
    opacity: 0.7;
}

.mono-text {
    font-family: 'Cutive Mono', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    color: var(--color-accent);
}

.closing-mark {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-top: 64px;
    padding-top: 32px;
    border-top: 1px solid var(--color-border);
}

.closing-quote {
    margin-top: 48px;
    border-left: none;
    text-align: center;
    padding-left: 0;
    font-size: clamp(1rem, 1.2vw, 1.3rem);
}

/* ============================================
   Ink Dividers
   ============================================ */
.ink-divider {
    display: flex;
    justify-content: center;
    margin-bottom: 48px;
}

.ink-drop {
    clip-path: circle(0% at 50% 50%);
    transition: clip-path 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.ink-drop.spread {
    clip-path: circle(50% at 50% 50%);
}

/* ============================================
   Floating Elements
   ============================================ */
.floating-element {
    position: absolute;
    z-index: 10;
    animation: drift 8s ease-in-out infinite;
    opacity: 0.6;
}

@keyframes drift {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(3px, -2px) rotate(1deg); }
}

.floating-quill {
    bottom: -20px;
    right: 15%;
}

.floating-compass {
    top: -20px;
    left: 10%;
    animation-delay: -2s;
}

.floating-hourglass {
    bottom: -30px;
    right: 20%;
    animation-delay: -4s;
}

.floating-seal {
    top: -15px;
    left: 15%;
    animation-delay: -6s;
}

/* ============================================
   SVG Styling
   ============================================ */
.svg-compass {
    transition: transform 0.3s ease;
}

.svg-seal {
    filter: drop-shadow(0 2px 4px rgba(30, 24, 16, 0.3));
}

/* ============================================
   Hover Effects
   ============================================ */
a:hover,
.interactive:hover {
    color: var(--color-highlight);
    box-shadow: 0 0 20px rgba(196, 151, 59, 0.15);
    transition: all 0.3s ease;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
    :root {
        --outer-margin: 48px;
        --gutter: 32px;
    }

    .content-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    :root {
        --outer-margin: 24px;
        --gutter: 24px;
    }

    .content-grid {
        grid-template-columns: 1fr;
    }

    .diagonal-section {
        padding: 80px var(--outer-margin);
    }

    .margin-annotation {
        display: none;
    }

    .floating-element {
        opacity: 0.3;
    }

    .section-hero {
        clip-path: polygon(0 0, 100% 0, 100% 96%, 0 100%);
    }

    .section-dark {
        clip-path: polygon(0 2%, 100% 0, 100% 98%, 0 96%);
    }

    .section-light {
        clip-path: polygon(0 0, 100% 3%, 100% 97%, 0 100%);
    }

    .section-taper {
        clip-path: polygon(0 3%, 100% 0, 92% 100%, 8% 100%);
    }
}

@media (max-width: 480px) {
    :root {
        --outer-margin: 16px;
    }

    .nav-circle {
        top: 16px;
        left: 16px;
    }
}
