/* ==========================================================================
   archetypic.dev — Design Language Stylesheet
   Aurora-gradient · Book-Scholarly · Evolved-Minimal · Hero-Dominant
   ========================================================================== */

:root {
    --aurora-green: #39e891;
    --aurora-cyan: #00d4ff;
    --aurora-violet: #9b5de5;
    --bg-deep: #0b0e1a;
    --bg-surface: #141831;
    --text-body: #d4d0c8;
    --text-heading: #f0ece4;
    --text-muted: #5a5870;
    --divider-soft: #d4d0c8;

    --font-display: 'Josefin Sans', 'Futura', 'Space', sans-serif;
    --font-body: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    --font-ui: 'Space Grotesk', 'Inter', sans-serif;

    --aurora-gradient: linear-gradient(135deg, #39e891 0%, #00d4ff 40%, #9b5de5 100%);
    --content-max: 1200px;
    --chapter-gap: 160px;
}

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

html {
    background-color: var(--bg-deep);
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-size: 18px;
    line-height: 1.85;
    letter-spacing: 0.01em;
    color: var(--text-body);
    background-color: var(--bg-deep);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    position: relative;
}

/* Deep ambient bokeh on the whole page (very subtle) */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(circle at 8% 20%, rgba(57, 232, 145, 0.04) 0%, transparent 40%),
        radial-gradient(circle at 90% 70%, rgba(155, 93, 229, 0.05) 0%, transparent 45%),
        radial-gradient(circle at 50% 95%, rgba(0, 212, 255, 0.04) 0%, transparent 40%);
}

/* ==========================================================================
   Top Navigation — minimal, chapter-aware
   ========================================================================== */

.top-nav {
    position: fixed;
    top: 0;
    right: 0;
    padding: 28px 40px;
    z-index: 100;
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-heading);
    pointer-events: none;
}

.top-nav .nav-current,
.top-nav .nav-adjacent {
    pointer-events: auto;
}

.nav-current {
    display: inline-block;
    position: relative;
    padding: 6px 0;
    cursor: default;
    color: var(--text-heading);
    transition: color 0.4s ease;
}

.nav-current::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 1px;
    background: var(--aurora-gradient);
    background-size: 300% 100%;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    animation: auroraShift 60s linear infinite;
}

.top-nav:hover .nav-current::after {
    transform: scaleX(1);
}

.nav-adjacent {
    position: absolute;
    top: 100%;
    right: 40px;
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

.top-nav:hover .nav-adjacent {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.nav-link {
    font-family: var(--font-ui);
    font-size: 11px;
    letter-spacing: 0.18em;
    color: var(--text-muted);
    text-decoration: none;
    padding: 2px 0;
    position: relative;
    display: inline-block;
    text-transform: uppercase;
    transition: color 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 1px;
    background: var(--aurora-gradient);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-link:hover {
    color: var(--text-heading);
    transform: scale(1.04);
}

.nav-link:hover::after {
    transform: scaleX(1);
}

/* ==========================================================================
   Hero — 100vh typographic statement over bokeh field
   ========================================================================== */

.hero {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 640px;
    display: grid;
    place-items: center;
    background-color: var(--bg-deep);
    overflow: hidden;
    z-index: 1;
}

.bokeh-field {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    background:
        radial-gradient(circle at 12% 20%, rgba(57, 232, 145, 0.12) 0%, transparent 55%),
        radial-gradient(circle at 78% 18%, rgba(0, 212, 255, 0.10) 0%, transparent 50%),
        radial-gradient(circle at 55% 72%, rgba(155, 93, 229, 0.11) 0%, transparent 60%),
        radial-gradient(circle at 88% 82%, rgba(57, 232, 145, 0.06) 0%, transparent 45%),
        radial-gradient(circle at 30% 88%, rgba(0, 212, 255, 0.10) 0%, transparent 55%),
        radial-gradient(circle at 10% 58%, rgba(155, 93, 229, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 65% 40%, rgba(57, 232, 145, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 92% 45%, rgba(0, 212, 255, 0.09) 0%, transparent 55%),
        radial-gradient(circle at 45% 22%, rgba(155, 93, 229, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 20% 45%, rgba(57, 232, 145, 0.07) 0%, transparent 45%),
        radial-gradient(circle at 52% 95%, rgba(0, 212, 255, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 82% 30%, rgba(155, 93, 229, 0.05) 0%, transparent 40%);
    animation: bokehDrift 38s ease-in-out infinite alternate;
}

@keyframes bokehDrift {
    0%   { transform: translate(0, 0) scale(1); }
    33%  { transform: translate(18px, -22px) scale(1.02); }
    66%  { transform: translate(-14px, 16px) scale(0.98); }
    100% { transform: translate(22px, -12px) scale(1.015); }
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
    padding: 0 24px;
    opacity: 0;
    animation: heroFadeIn 1.6s cubic-bezier(0.16, 1, 0.3, 1) 0.4s forwards;
}

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

.hero-glyph {
    width: 120px;
    height: 120px;
    animation: glyphRotate 120s linear infinite;
    opacity: 0.9;
}

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

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

.hero-title {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(48px, 8vw, 96px);
    line-height: 1.1;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-heading);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hero-title:hover {
    transform: scale(1.02);
}

.hero-subtitle {
    font-family: var(--font-body);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(17px, 1.8vw, 20px);
    line-height: 1.5;
    letter-spacing: 0.01em;
    color: var(--text-heading);
    max-width: 560px;
}

.hero-meta {
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: 8px;
}

/* ==========================================================================
   Aurora gradient text — animated chromatic thread
   ========================================================================== */

.aurora-text {
    background: linear-gradient(135deg, var(--aurora-green) 0%, var(--aurora-cyan) 40%, var(--aurora-violet) 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: auroraTextShift 14s ease-in-out infinite;
}

@keyframes auroraTextShift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ==========================================================================
   Chapter separator — thin aurora line
   ========================================================================== */

.chapter-separator {
    display: flex;
    justify-content: center;
    padding: 80px 0 40px;
}

.separator-line {
    width: clamp(80px, 30vw, 240px);
    height: 1px;
    background: var(--aurora-gradient);
    background-size: 300% 100%;
    animation: auroraShift 60s linear infinite;
    border-radius: 1px;
    opacity: 0.85;
}

@keyframes auroraShift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ==========================================================================
   Chapter — 6-column feel, 1/3 + 2/3 asymmetric split
   ========================================================================== */

.chapter {
    position: relative;
    width: 100%;
    padding: 80px 40px var(--chapter-gap);
    background-color: var(--bg-deep);
    overflow: hidden;
    z-index: 1;
}

.chapter:nth-of-type(even) {
    background-color: var(--bg-surface);
}

/* Ghosted roman numeral watermark */
.chapter-watermark {
    position: absolute;
    top: 140px;
    left: max(24px, calc(50vw - var(--content-max) / 2));
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(90px, 12vw, 140px);
    line-height: 1;
    letter-spacing: 0.05em;
    color: var(--text-heading);
    opacity: 0.06;
    pointer-events: none;
    user-select: none;
    z-index: 0;
}

.chapter-glyph-wrap {
    display: flex;
    justify-content: center;
    padding-top: 8px;
    padding-bottom: 56px;
    position: relative;
    z-index: 2;
}

.chapter-glyph {
    width: 64px;
    height: 64px;
    cursor: default;
    transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chapter-glyph .glyph-svg {
    animation: glyphRotate 120s linear infinite;
    transform-origin: center center;
}

.chapter-glyph:hover {
    transform: scale(1.08);
}

.chapter-inner {
    position: relative;
    z-index: 2;
    max-width: var(--content-max);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 4fr;
    gap: 64px;
    align-items: start;
    opacity: 0;
    transform: translateY(40px);
    transition:
        opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.chapter-inner.visible {
    opacity: 1;
    transform: translateY(0);
}

.chapter-heading-col {
    position: sticky;
    top: 120px;
    padding-right: 24px;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chapter-inner.visible .chapter-heading-col {
    transition-delay: 0.1s;
}

.chapter-label {
    display: block;
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--aurora-cyan);
    margin-bottom: 16px;
}

.chapter-title {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(40px, 5.2vw, 72px);
    line-height: 1.05;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-heading);
    margin-bottom: 18px;
}

.chapter-meta {
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.chapter-body-col {
    position: relative;
    padding-left: 32px;
    border-left: 1px solid rgba(90, 88, 112, 0.2);
    max-width: 640px;
}

.chapter-body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 18px;
    line-height: 1.85;
    letter-spacing: 0.01em;
    color: var(--text-body);
    margin-bottom: 28px;
}

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

.chapter-body em {
    font-style: italic;
    color: var(--text-heading);
}

.chapter-body strong {
    font-weight: 600;
    color: var(--text-heading);
}

/* Marginalia pull-quote */
.marginalia {
    float: right;
    width: 220px;
    margin: 4px -48px 24px 32px;
    padding-left: 14px;
    border-left: 2px solid transparent;
    background-image: linear-gradient(var(--bg-deep), var(--bg-deep)), var(--aurora-gradient);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    background-size: 100% 100%, 300% 300%;
    animation: auroraShift 60s linear infinite;
}

.chapter:nth-of-type(even) .marginalia {
    background-image: linear-gradient(var(--bg-surface), var(--bg-surface)), var(--aurora-gradient);
}

.marginalia-text {
    font-family: var(--font-body);
    font-style: italic;
    font-weight: 400;
    font-size: 15px;
    line-height: 1.55;
    letter-spacing: 0.01em;
    color: var(--text-muted);
}

/* Three-dot divider */
.chapter-divider {
    display: flex;
    gap: 14px;
    justify-content: center;
    align-items: center;
    margin: 40px 0;
}

.chapter-divider span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--aurora-gradient);
    background-size: 300% 300%;
    animation: auroraShift 60s linear infinite;
    opacity: 0.7;
}

.chapter-divider span:nth-child(2) { animation-delay: -20s; }
.chapter-divider span:nth-child(3) { animation-delay: -40s; }

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

.colophon {
    position: relative;
    width: 100%;
    padding: 60px 24px 120px;
    background-color: var(--bg-deep);
    text-align: center;
    z-index: 1;
}

.colophon-inner {
    max-width: 680px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    opacity: 0;
    transform: translateY(40px);
    transition:
        opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.colophon-inner.visible {
    opacity: 1;
    transform: translateY(0);
}

.colophon-glyph {
    width: 64px;
    height: 64px;
    animation: glyphRotate 120s linear infinite reverse;
}

.colophon-text {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(28px, 4vw, 44px);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1.1;
}

.colophon-note {
    font-family: var(--font-body);
    font-style: italic;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.55;
    color: var(--text-body);
    max-width: 460px;
}

.colophon-divider {
    display: flex;
    gap: 14px;
    justify-content: center;
    align-items: center;
    margin: 8px 0;
}

.colophon-divider span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--aurora-gradient);
    background-size: 300% 300%;
    animation: auroraShift 60s linear infinite;
    opacity: 0.6;
}

.colophon-meta {
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* ==========================================================================
   Progress Ring — fixed bottom-right
   ========================================================================== */

.progress-ring {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 40px;
    height: 40px;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.progress-ring.visible {
    opacity: 1;
    transform: scale(1);
}

.progress-ring svg {
    position: absolute;
    inset: 0;
    overflow: visible;
}

.ring-fill {
    stroke-dasharray: 100.53;
    stroke-dashoffset: 100.53;
    transition: stroke-dashoffset 0.1s linear;
}

.progress-number {
    position: relative;
    font-family: var(--font-ui);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.06em;
    color: var(--text-heading);
    z-index: 1;
}

/* ==========================================================================
   Links
   ========================================================================== */

a {
    color: var(--aurora-cyan);
    text-decoration: none;
    position: relative;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--aurora-green);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 960px) {
    .chapter-inner {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .chapter-heading-col {
        position: static;
        padding-right: 0;
    }

    .chapter-body-col {
        padding-left: 20px;
        max-width: 100%;
    }

    .marginalia {
        float: none;
        width: auto;
        margin: 24px 0;
        padding-left: 16px;
    }

    .chapter-watermark {
        top: 60px;
        left: 24px;
        font-size: clamp(72px, 16vw, 110px);
    }

    .top-nav {
        padding: 20px 24px;
    }

    .nav-adjacent {
        right: 24px;
    }
}

@media (max-width: 640px) {
    :root {
        --chapter-gap: 100px;
    }

    body {
        font-size: 16px;
    }

    .chapter {
        padding: 60px 20px 80px;
    }

    .chapter-title {
        font-size: clamp(36px, 9vw, 48px);
        letter-spacing: 0.05em;
    }

    .hero-title {
        font-size: clamp(40px, 12vw, 72px);
        letter-spacing: 0.05em;
    }

    .hero-glyph {
        width: 88px;
        height: 88px;
    }

    .chapter-glyph {
        width: 56px;
        height: 56px;
    }

    .chapter-glyph-wrap {
        padding-bottom: 40px;
    }

    .chapter-body {
        font-size: 16.5px;
        line-height: 1.75;
    }

    .marginalia-text {
        font-size: 14px;
    }

    .chapter-separator {
        padding: 48px 0 24px;
    }

    .progress-ring {
        bottom: 20px;
        right: 20px;
    }

    .nav-adjacent {
        display: none;
    }

    .colophon {
        padding: 40px 20px 80px;
    }

    .colophon-text {
        font-size: clamp(24px, 7vw, 32px);
    }
}
