/* ============================================================
   archetypos.dev - Styles
   Typography as subject, not tool.
   The medium IS the message.
   ============================================================ */

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

html {
    overflow-x: hidden;
}

body {
    background: #0C0C14;
    color: #E8D5B5;
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: clamp(16px, 1.8vw, 22px);
    font-weight: 400;
    line-height: 1.8;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Scroll Progress Indicator (right edge, 2px) --- */
.scroll-progress {
    position: fixed;
    right: 0;
    top: 0;
    width: 2px;
    height: 0%;
    background: #5B4F3A;
    z-index: 1000;
    transition: height 0.1s linear;
}

/* --- Section Watermarks (ghostly drifting labels) --- */
.section-watermarks {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.watermark-text {
    position: absolute;
    font-family: 'Playfair Display', serif;
    font-size: clamp(40px, 8vw, 120px);
    font-weight: 700;
    color: #E8D5B5;
    opacity: 0;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transition: opacity 1.2s ease, left 2s ease;
    white-space: nowrap;
}

.watermark-text.visible {
    opacity: 0.08;
}

/* --- Glyph Ghost (Background palimpsest letters) --- */
.glyph-ghost {
    position: absolute;
    font-family: 'Playfair Display', serif;
    font-size: clamp(300px, 50vw, 800px);
    font-weight: 700;
    color: #E8D5B5;
    opacity: 0.035;
    pointer-events: none;
    user-select: none;
    line-height: 1;
    z-index: 0;
}

/* --- Constellation Dividers (between major sections) --- */
.constellation-divider {
    position: relative;
    width: 100%;
    height: 60px;
    overflow: hidden;
    background: #0C0C14;
}

.constellation-divider--mid {
    background: #12121E;
}

.constellation-divider svg {
    width: 100%;
    height: 100%;
}

.divider-pt {
    transform: scale(0);
    transform-origin: center;
    transform-box: fill-box;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.divider-curve {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 2s ease;
}

.constellation-divider.in-view .divider-pt {
    transform: scale(1);
}

.constellation-divider.in-view .divider-curve {
    stroke-dashoffset: 0;
}

.constellation-divider.in-view .divider-pt:nth-child(1) { transition-delay: 0.2s; }
.constellation-divider.in-view .divider-pt:nth-child(2) { transition-delay: 0.4s; }
.constellation-divider.in-view .divider-pt:nth-child(3) { transition-delay: 0.6s; }
.constellation-divider.in-view .divider-pt:nth-child(4) { transition-delay: 0.8s; }
.constellation-divider.in-view .divider-pt:nth-child(5) { transition-delay: 1.0s; }

/* ============================================================
   GLYPH CHAMBER (100vh)
   Deep ink-black void with wireframe A
   ============================================================ */
.glyph-chamber {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #0C0C14;
    overflow: hidden;
    perspective: 1200px;
}

.glyph-chamber__letter {
    width: 90vw;
    max-width: 600px;
    height: 90vh;
    max-height: 800px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: slowRotateY 90s linear infinite;
    transform-style: preserve-3d;
}

#hero-a-svg {
    width: 100%;
    height: 100%;
}

/* SVG path-draw animation */
.a-path {
    stroke-dasharray: 4000;
    stroke-dashoffset: 4000;
    opacity: 0;
}

.a-outer.animate {
    opacity: 1;
    animation: drawPath 1.2s ease-in-out forwards;
}

.a-counter.animate {
    opacity: 1;
    animation: drawPath 0.8s ease-in-out 0.2s forwards;
}

.a-crossbar.animate {
    opacity: 1;
    animation: drawPath 0.4s ease-in-out 0.4s forwards;
}

/* Control points: scale 0 to 1 with spring easing */
.ctrl-pt {
    transform: scale(0);
    transform-origin: center;
    transform-box: fill-box;
}

.ctrl-pt.animate {
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Control handles: fade in */
.ctrl-handle {
    opacity: 0;
}

.ctrl-handle.animate {
    animation: fadeIn 0.3s ease forwards;
}

@keyframes drawPath {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes popIn {
    from {
        transform: scale(0);
    }
    to {
        transform: scale(1);
    }
}

@keyframes fadeIn {
    to {
        opacity: 0.6;
    }
}

@keyframes slowRotateY {
    from {
        transform: rotateY(0deg);
    }
    to {
        transform: rotateY(360deg);
    }
}

/* Domain name: small caps, letter-spaced, flicker-in */
.glyph-chamber__domain {
    position: absolute;
    bottom: 8vh;
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(11px, 1.2vw, 15px);
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: #E8D5B5;
}

.domain-char {
    opacity: 0;
    display: inline-block;
    transition: opacity 0.15s ease;
}

.domain-char.visible {
    opacity: 1;
}

/* ============================================================
   ETYMOLOGY CORRIDOR (300vh, horizontal scroll)
   Horizontally-scrolling timeline within vertical page
   ============================================================ */
.etymology-corridor {
    position: relative;
    width: 100%;
    height: 300vh;
    background: #12121E;
    overflow: hidden;
}

/* Progress line at top (fills left-to-right via scaleX) */
.etymology-progress-bar {
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(91, 79, 58, 0.2);
    z-index: 10;
}

.etymology-progress-fill {
    width: 100%;
    height: 100%;
    background: #E8D5B5;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.05s linear;
}

/* Horizontal scroll container (5 panels = 500vw) */
.etymology-scroll-container {
    position: sticky;
    top: 0;
    display: flex;
    width: 500vw;
    height: 100vh;
    overflow: visible;
}

/* Each panel is one full viewport width */
.etymology-panel {
    position: relative;
    width: 100vw;
    height: 100vh;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 10vw;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.etymology-panel.active {
    opacity: 1;
    transform: translateY(0);
}

/* Date labels in monospace */
.etymology-date {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(11px, 1.2vw, 15px);
    letter-spacing: 0.06em;
    color: #5B4F3A;
    margin-bottom: 2rem;
}

/* Large etymological term */
.etymology-term {
    font-family: 'Playfair Display', serif;
    font-size: clamp(36px, 8vw, 120px);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #E8D5B5;
    margin-bottom: 2rem;
    text-align: center;
}

/* Description in italic Source Serif */
.etymology-desc {
    font-family: 'Source Serif 4', Georgia, serif;
    font-style: italic;
    font-size: clamp(16px, 1.8vw, 22px);
    line-height: 1.8;
    color: #A89878;
    max-width: 40ch;
    text-align: center;
}

/* Dashed connectors between panels (ghost silver #3A3A4E) */
.etymology-connector {
    position: absolute;
    right: 0;
    top: 50%;
    width: 80px;
    height: 1px;
    border-top: 1px dashed #3A3A4E;
    transform: translateY(-50%);
}

/* ============================================================
   ANATOMY ATLAS (variable height)
   Full-width bands per typographic term
   ============================================================ */
.anatomy-atlas {
    position: relative;
    width: 100%;
}

.anatomy-band {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.anatomy-band--dark {
    background: #0C0C14;
}

.anatomy-band--darker {
    background: #12121E;
}

.anatomy-band__content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4vw;
    width: 100%;
    max-width: 1200px;
    padding: 4rem 2rem;
}

.anatomy-band__letter-container {
    position: relative;
    flex-shrink: 0;
}

/* Large letter at low opacity (the specimen) */
.anatomy-band__letter {
    font-family: 'Playfair Display', serif;
    font-size: clamp(80px, 20vw, 300px);
    font-weight: 700;
    color: #E8D5B5;
    opacity: 0.15;
    line-height: 1;
    display: block;
    transition: opacity 0.6s ease;
}

.anatomy-band__letter--ligature {
    font-feature-settings: "liga" 1;
}

/* When in view: highlighted feature pulses, rest stays dim */
.anatomy-band.in-view .anatomy-band__letter {
    animation: featurePulse 3s ease-in-out infinite alternate;
}

/* Anatomical callout SVG overlay */
.anatomy-callout {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Callout lines: grow from origin via stroke-dashoffset */
.callout-line {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 0.4s ease-out;
}

.anatomy-band.in-view .callout-line {
    stroke-dashoffset: 0;
}

/* Callout origin point */
.callout-origin {
    fill: #C4623A;
    transform: scale(0);
    transform-origin: center;
    transform-box: fill-box;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.anatomy-band.in-view .callout-origin {
    transform: scale(1);
}

/* Callout label text: fades in after line draws */
.callout-label {
    transition: opacity 0.3s ease 0.5s;
}

.anatomy-band.in-view .callout-label {
    opacity: 0.6;
}

/* Info panel: slides in from right with delay */
.anatomy-band__info {
    max-width: 40ch;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.6s ease 0.3s, transform 0.6s ease 0.3s;
}

.anatomy-band.in-view .anatomy-band__info {
    opacity: 1;
    transform: translateX(0);
}

/* Term heading in copper verdigris accent */
.anatomy-band__term {
    font-family: 'Playfair Display', serif;
    font-size: clamp(24px, 5vw, 64px);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #5B8C7A;
    margin-bottom: 1rem;
}

/* Definition in muted vellum */
.anatomy-band__definition {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: clamp(16px, 1.8vw, 22px);
    line-height: 1.8;
    color: #A89878;
}

/* Feature pulse animation */
@keyframes featurePulse {
    from {
        opacity: 0.15;
    }
    to {
        opacity: 0.3;
    }
}

/* ============================================================
   SPECIMEN THEATER (100vh per specimen, sticky stacking)
   Full-screen immersive typeface experiences
   ============================================================ */
.specimen-theater {
    position: relative;
    width: 100%;
}

/* Sticky wrapper: each specimen stacks via position: sticky */
.specimen-sticky-wrapper {
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 1;
}

.specimen-sticky-wrapper:nth-child(1) {
    z-index: 1;
}

.specimen-sticky-wrapper:nth-child(2) {
    z-index: 2;
}

.specimen-sticky-wrapper:nth-child(3) {
    z-index: 3;
}

.specimen {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.specimen--stone {
    background: #0C0C14;
}

.specimen--industrial {
    background: #12121E;
}

.specimen--geometric {
    background: #0C0C14;
}

.specimen__content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 800px;
    padding: 2rem;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.specimen.in-view .specimen__content {
    opacity: 1;
}

/* Specimen titles */
.specimen__title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

/* Stone inscription: 6-layer text-shadow for chiseled depth */
.specimen__title--stone {
    font-size: clamp(48px, 10vw, 160px);
    color: #E8D5B5;
    text-shadow:
        1px 1px 0 rgba(168, 152, 120, 0.4),
        2px 2px 0 rgba(168, 152, 120, 0.3),
        3px 3px 0 rgba(168, 152, 120, 0.2),
        4px 4px 0 rgba(168, 152, 120, 0.1),
        5px 5px 0 rgba(168, 152, 120, 0.05),
        6px 6px 0 rgba(168, 152, 120, 0.02);
}

/* Industrial: sans-serif feel, wide letter-spacing */
.specimen__title--industrial {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: clamp(48px, 10vw, 160px);
    color: #E8D5B5;
    font-weight: 400;
    letter-spacing: 0.1em;
}

/* Geometric: extra wide tracking */
.specimen__title--geometric {
    font-size: clamp(48px, 10vw, 160px);
    color: #E8D5B5;
    letter-spacing: 0.15em;
}

.specimen__subtitle {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(16px, 2vw, 24px);
    color: #A89878;
    margin-bottom: 3rem;
}

.specimen__display {
    margin-bottom: 3rem;
}

/* Carved text with layered shadow */
.specimen__carved-text {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(18px, 3vw, 36px);
    letter-spacing: 0.15em;
    color: #A89878;
    text-shadow:
        1px 1px 0 rgba(168, 152, 120, 0.3),
        2px 2px 0 rgba(168, 152, 120, 0.2),
        3px 3px 0 rgba(168, 152, 120, 0.1);
}

/* Industrial text: fog-revealed */
.specimen__industrial-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(36px, 8vw, 120px);
    letter-spacing: 0.2em;
    color: #E8D5B5;
    opacity: 0.6;
    transition: opacity 0.8s ease;
}

.specimen--industrial.in-view .specimen__industrial-text {
    opacity: 1;
}

/* Geometric display shapes container */
.specimen__display--geo {
    width: 100%;
    max-width: 600px;
    margin: 0 auto 3rem;
}

.specimen__geo-shapes {
    width: 100%;
    height: auto;
}

/* Geometric shapes: path-draw animation */
.geo-shape {
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    transition: stroke-dashoffset 1.2s ease-in-out;
}

.specimen--geometric.in-view .geo-shape {
    stroke-dashoffset: 0;
}

.geo-circle {
    transition-delay: 0s;
}

.geo-rect {
    transition-delay: 0.3s;
}

.geo-triangle {
    transition-delay: 0.6s;
}

/* Narrative text */
.specimen__narrative {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: clamp(16px, 1.8vw, 22px);
    line-height: 1.8;
    color: #A89878;
    max-width: 55ch;
    margin: 0 auto;
}

/* Fog effect: backdrop-filter blur that clears on scroll */
.specimen__fog {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        180deg,
        rgba(18, 18, 30, 0.9) 0%,
        rgba(18, 18, 30, 0.3) 40%,
        rgba(18, 18, 30, 0.3) 60%,
        rgba(18, 18, 30, 0.9) 100%
    );
    z-index: 1;
    pointer-events: none;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: backdrop-filter 1.5s ease, -webkit-backdrop-filter 1.5s ease;
}

.specimen--industrial.in-view .specimen__fog {
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
}

/* Constellation positioning */
.specimen__constellation {
    position: absolute;
    width: 200px;
    height: 200px;
    z-index: 0;
}

.specimen__constellation:not(.specimen__constellation--right):not(.specimen__constellation--left) {
    bottom: 5%;
    left: 5%;
}

.specimen__constellation--right {
    top: 10%;
    right: 5%;
}

.specimen__constellation--left {
    bottom: 10%;
    left: 5%;
}

/* Constellation points and curves */
.constellation-pt {
    transform: scale(0);
    transform-origin: center;
    transform-box: fill-box;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.constellation-curve {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    transition: stroke-dashoffset 1.5s ease;
}

.specimen.in-view .constellation-pt {
    transform: scale(1);
}

.specimen.in-view .constellation-curve {
    stroke-dashoffset: 0;
}

/* Stagger constellation point animation delays */
.specimen.in-view .constellation-pt:nth-child(1) { transition-delay: 0.2s; }
.specimen.in-view .constellation-pt:nth-child(2) { transition-delay: 0.4s; }
.specimen.in-view .constellation-pt:nth-child(3) { transition-delay: 0.6s; }
.specimen.in-view .constellation-pt:nth-child(4) { transition-delay: 0.8s; }
.specimen.in-view .constellation-pt:nth-child(5) { transition-delay: 1.0s; }

/* ============================================================
   COLOPHON CODA (100vh)
   Inverted opening -- solid A, colophon metadata
   ============================================================ */
.colophon-coda {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #0C0C14;
    overflow: hidden;
}

.colophon-coda__letter {
    width: 300px;
    max-width: 50vw;
    margin-bottom: 3rem;
    opacity: 0;
    transition: opacity 1s ease;
}

.colophon-coda.in-view .colophon-coda__letter {
    opacity: 1;
}

.colophon-a {
    width: 100%;
    height: auto;
}

/* Single closing statement at 14px */
.colophon-coda__statement {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 14px;
    color: #A89878;
    text-align: center;
    margin-bottom: 3rem;
    opacity: 0;
    transition: opacity 0.8s ease 0.5s;
}

.colophon-coda.in-view .colophon-coda__statement {
    opacity: 1;
}

/* Metadata in monospace colophon style */
.colophon-coda__metadata {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.8s ease 1s;
}

.colophon-coda.in-view .colophon-coda__metadata {
    opacity: 1;
}

.colophon-meta-item {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(11px, 1.2vw, 15px);
    letter-spacing: 0.06em;
    color: #5B4F3A;
    text-align: center;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .anatomy-band__content {
        flex-direction: column;
        gap: 2rem;
        text-align: center;
    }

    .anatomy-band__info {
        transform: translateY(20px);
    }

    .anatomy-band.in-view .anatomy-band__info {
        transform: translateY(0);
    }

    .specimen__constellation {
        width: 120px;
        height: 120px;
    }

    .etymology-panel {
        padding: 2rem 5vw;
    }

    .colophon-coda__letter {
        width: 200px;
    }

    .specimen__display--geo {
        max-width: 90vw;
    }
}
