/* ============================================================
   archetypos.dev  —  Street-Scholarly Luxe
   Palette: #0f0d0b #1e1a16 #3a3228 #9c8b72 #e8e0d4 #c4553a #5a8a7a #d4a857
   Fonts:   Cormorant Garamond  /  Libre Baskerville  /  Barlow Condensed
   ============================================================ */

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
    background: #0f0d0b;
}

body {
    background-color: #0f0d0b;
    color: #e8e0d4;
    font-family: 'Libre Baskerville', Georgia, serif;
    line-height: 1.7;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

/* Page-wide grain + foxing */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.05;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.95' numOctaves='3' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 0.91  0 0 0 0 0.88  0 0 0 0 0.83  0 0 0 0.55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 256px 256px;
    mix-blend-mode: overlay;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 999;
    background:
        radial-gradient(circle at 20% 30%, rgba(156,139,114,0.08) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(156,139,114,0.06) 0%, transparent 45%);
}

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

/* ============================================================
   SHARED ATOMS
   ============================================================ */

.ruling-line {
    width: 80px;
    height: 1px;
    background: #9c8b72;
    margin: 24px 0;
    position: relative;
}

.ruling-line::before {
    content: '';
    position: absolute;
    left: -3px;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 5px;
    background: inherit;
    border-radius: 50%;
}

.ruling-line-gold { background: #d4a857; }
.ruling-line-thin { width: 100%; height: 1px; background: #3a3228; margin: 14px 0 22px; }
.ruling-line-thin::before { display: none; }

.ruling-animated {
    width: 0;
    animation: lineGrow 0.9s cubic-bezier(0.4,0,0.2,1) 2.2s forwards;
}

@keyframes lineGrow {
    from { width: 0; }
    to   { width: 80px; }
}

.section-title {
    font-family: 'Cormorant Garamond', 'Times New Roman', serif;
    font-weight: 300;
    letter-spacing: -0.02em;
    line-height: 0.95;
    color: #e8e0d4;
}

.section-title em {
    font-style: italic;
    font-weight: 300;
    color: #d4a857;
}

.section-title-lg { font-size: clamp(3rem, 7vw, 6.5rem); }
.section-title-md { font-size: clamp(2.2rem, 4.5vw, 3.8rem); }

.sub-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-size: 1.6rem;
    color: #e8e0d4;
    margin-bottom: 16px;
    font-style: italic;
}

.section-kicker {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 500;
    font-size: 0.7rem;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: #9c8b72;
    display: block;
    margin-bottom: 18px;
}

.section-lede {
    font-family: 'Libre Baskerville', serif;
    font-style: italic;
    font-size: 0.95rem;
    color: #9c8b72;
    max-width: 560px;
    margin: 24px auto 0;
    line-height: 1.7;
}

.body-text {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 1.02rem;
    line-height: 1.78;
    color: #e8e0d4;
    opacity: 0.92;
}

.body-text + .body-text { margin-top: 18px; }

.body-text-note {
    font-style: italic;
    font-size: 0.88rem;
    color: #9c8b72;
    opacity: 0.75;
    text-align: right;
    margin-top: 28px;
}

/* Emphatic "stamp" inside prose */
.emph-stamp {
    display: inline-block;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 0.9em;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #e8e0d4;
    background: rgba(196,85,58,0.88);
    padding: 2px 10px 1px;
    transform: rotate(-2deg);
    margin: 0 2px;
    border: 1px solid rgba(196,85,58,0.3);
    box-shadow: 0 0 0 1px rgba(196,85,58,0.15);
}

.emph-stamp-copper {
    background: rgba(90,138,122,0.85);
    transform: rotate(1.5deg);
    border-color: rgba(90,138,122,0.3);
}

/* ============================================================
   FOXING / GRAIN / MARGINALIA
   ============================================================ */

.foxing-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.08;
    background-image:
        radial-gradient(ellipse at 14% 22%, #9c8b72 0%, transparent 35%),
        radial-gradient(ellipse at 82% 70%, #9c8b72 0%, transparent 30%),
        radial-gradient(ellipse at 60% 40%, #c4553a 0%, transparent 20%),
        radial-gradient(ellipse at 30% 80%, #9c8b72 0%, transparent 25%);
}

.grain-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.06;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 200px 200px;
    mix-blend-mode: overlay;
}

.marginalia {
    position: absolute;
    z-index: 2;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 300;
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #9c8b72;
    opacity: 0.6;
    display: flex;
    align-items: center;
    gap: 8px;
}

.marginalia-left {
    left: 56px;
    bottom: 22%;
    transform: rotate(-90deg);
    transform-origin: left bottom;
}

.marginalia-right {
    right: 56px;
    top: 28%;
    transform: rotate(90deg);
    transform-origin: right top;
}

.marginalia-bottom {
    position: relative;
    text-align: right;
    margin-top: 64px;
    padding-right: 40px;
    opacity: 0.55;
}

.marginalia-text {
    white-space: nowrap;
}

.marginalia-dagger,
.marginalia-asterisk {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.1rem;
    color: #d4a857;
    opacity: 0.75;
}

/* ============================================================
   STENCIL STAMPS
   ============================================================ */

.stencil-stamp {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 0.7rem;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: #c4553a;
    opacity: 0.28;
    border: 1.5px solid #c4553a;
    padding: 5px 14px 4px;
    display: inline-block;
    background: transparent;
    position: relative;
    filter: url(#distressedEdge);
}

.stencil-top {
    position: absolute;
    top: 48px;
    right: 64px;
    transform: rotate(-6deg);
    z-index: 3;
}

.stencil-corner {
    position: absolute;
    bottom: 48px;
    left: 64px;
    transform: rotate(5deg);
    opacity: 0.22;
    z-index: 3;
    color: #5a8a7a;
    border-color: #5a8a7a;
}

.stencil-mid {
    display: block;
    margin: 80px auto 0;
    text-align: center;
    transform: rotate(-2deg);
    width: fit-content;
}

.stencil-footer {
    transform: rotate(4deg);
}

/* ============================================================
   PANEL LABEL
   ============================================================ */

.panel-label {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 500;
    font-size: 0.72rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: #d4a857;
    display: inline-block;
    padding: 2px 0;
    border-bottom: 1px solid #d4a857;
    margin-bottom: 22px;
}

/* ============================================================
   SPINE NAVIGATION
   ============================================================ */

.spine-nav {
    position: fixed;
    left: 28px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 50;
    display: flex;
    align-items: center;
    opacity: 0;
    animation: fadeIn 1s ease-out 1.6s forwards;
}

.spine-line {
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(to bottom, transparent, #3a3228 15%, #3a3228 85%, transparent);
}

.spine-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 36px;
    padding: 16px 0;
    position: relative;
}

.spine-item {
    position: relative;
}

.spine-link {
    display: flex;
    align-items: center;
    gap: 16px;
    text-decoration: none;
    font-family: 'Cormorant Garamond', serif;
    color: #9c8b72;
    transition: color 0.4s ease;
    padding-left: 4px;
}

.spine-num {
    display: inline-block;
    font-size: 0.95rem;
    font-weight: 300;
    letter-spacing: 0.05em;
    transform: rotate(-90deg);
    transform-origin: center;
    transition: transform 0.5s cubic-bezier(0.4,0,0.2,1), color 0.4s ease;
    min-width: 14px;
    text-align: center;
}

.spine-label {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 0.68rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #9c8b72;
    opacity: 0;
    transform: translateX(-8px);
    transition: opacity 0.4s ease, transform 0.4s ease, color 0.4s ease;
    pointer-events: none;
}

.spine-link:hover .spine-num,
.spine-item.active .spine-num {
    transform: rotate(0deg) scale(1.25);
    color: #d4a857;
}

.spine-link:hover .spine-label,
.spine-item.active .spine-label {
    opacity: 1;
    transform: translateX(0);
    color: #d4a857;
}

.spine-item.active::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #d4a857;
}

/* ============================================================
   MARGIN CITATION (fixed, updates per chapter)
   ============================================================ */

.margin-citation {
    position: fixed;
    right: 28px;
    top: 50%;
    transform: translateY(-50%) rotate(90deg);
    transform-origin: right center;
    z-index: 50;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 400;
    font-size: 0.68rem;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: #9c8b72;
    opacity: 0;
    animation: fadeIn 1s ease-out 2s forwards;
    pointer-events: none;
    white-space: nowrap;
    transition: color 0.5s ease;
}

.citation-text {
    display: inline-block;
    transition: opacity 0.4s ease;
}

/* ============================================================
   CHAPTER FRAMES (roman numeral + mark in corner)
   ============================================================ */

.chapter-frame {
    position: absolute;
    top: 40px;
    right: 8%;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    z-index: 2;
    pointer-events: none;
}

.chapter-roman {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 300;
    font-size: 1.6rem;
    color: #3a3228;
    letter-spacing: 0.1em;
}

.chapter-mark {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.1rem;
    color: #9c8b72;
    opacity: 0.5;
}

/* ============================================================
   SECTION I : OPENING
   ============================================================ */

.opening-section {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 640px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: #0f0d0b;
}

.opening-content {
    text-align: center;
    z-index: 1;
    padding: 0 24px;
    max-width: 1200px;
}

.opening-folio {
    display: block;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.45em;
    text-transform: uppercase;
    color: #9c8b72;
    margin-bottom: 32px;
    opacity: 0;
    animation: fadeIn 0.9s ease-out 0.2s forwards;
}

.opening-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(4rem, 10vw, 11rem);
    letter-spacing: 0.02em;
    line-height: 0.95;
    color: #e8e0d4;
    margin-bottom: 12px;
    display: inline-block;
}

.title-char {
    display: inline-block;
    opacity: 0;
    transform: translateY(24px);
    animation: charReveal 0.7s cubic-bezier(0.25,0.46,0.45,0.94) forwards;
}

.title-char:nth-child(1)  { animation-delay: 0.55s; }
.title-char:nth-child(2)  { animation-delay: 0.62s; }
.title-char:nth-child(3)  { animation-delay: 0.69s; }
.title-char:nth-child(4)  { animation-delay: 0.76s; }
.title-char:nth-child(5)  { animation-delay: 0.83s; }
.title-char:nth-child(6)  { animation-delay: 0.90s; }
.title-char:nth-child(7)  { animation-delay: 0.97s; }
.title-char:nth-child(8)  { animation-delay: 1.04s; }
.title-char:nth-child(9)  { animation-delay: 1.11s; }
.title-char:nth-child(10) { animation-delay: 1.18s; }

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

.opening-tld {
    display: inline-block;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: 0.45em;
    text-transform: uppercase;
    color: #c4553a;
    margin-top: 8px;
    opacity: 0;
    animation: fadeIn 1s ease-out 1.5s forwards;
}

.opening-section .ruling-line {
    margin: 28px auto;
}

.opening-subtitle {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 300;
    font-size: clamp(1rem, 1.5vw, 1.3rem);
    letter-spacing: 0.05em;
    color: #9c8b72;
    margin-bottom: 24px;
    opacity: 0;
    animation: fadeIn 1s ease-out 2.6s forwards;
}

.opening-lede {
    font-family: 'Libre Baskerville', serif;
    font-size: 0.88rem;
    color: #9c8b72;
    opacity: 0;
    max-width: 420px;
    margin: 0 auto;
    font-style: italic;
    line-height: 1.75;
    animation: fadeIn 1s ease-out 3s forwards;
    animation-fill-mode: forwards;
}

.opening-lede {
    animation-name: fadeInDim;
}

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

@keyframes fadeInDim {
    to { opacity: 0.75; }
}

.scroll-indicator {
    position: absolute;
    bottom: 36px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    opacity: 0;
    animation: fadeInScroll 1s ease-out 3.4s forwards;
}

.scroll-label {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 0.62rem;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: #9c8b72;
}

.scroll-line {
    width: 1px;
    height: 44px;
    background: linear-gradient(to bottom, #9c8b72, transparent);
    animation: scrollPulse 2.4s ease-in-out infinite;
}

@keyframes fadeInScroll {
    to { opacity: 0.55; }
}

@keyframes scrollPulse {
    0%, 100% { opacity: 0.3; transform: scaleY(1); }
    50%      { opacity: 0.85; transform: scaleY(1.25); }
}

/* ============================================================
   SECTION II : MANIFESTO
   ============================================================ */

.manifesto-section {
    position: relative;
    padding: 140px 8% 120px;
    min-height: 100vh;
}

.broken-grid-container {
    max-width: 1280px;
    margin: 0 auto;
    position: relative;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: minmax(40px, auto);
    gap: 0;
}

.manifesto-panel {
    position: relative;
    transition: opacity 0.9s cubic-bezier(0.25,0.46,0.45,0.94),
                transform 0.9s cubic-bezier(0.25,0.46,0.45,0.94);
}

/* Broken-grid placement — each panel sits on a different column range */
.panel-a {
    grid-column: 1 / span 7;
    grid-row: 1;
    transform: translate3d(-80px, 40px, 0) rotate(-2deg);
    opacity: 0;
    z-index: 2;
}
.panel-a.revealed {
    transform: translate3d(0, 0, 0) rotate(-1.4deg);
    opacity: 1;
}

.panel-b {
    grid-column: 6 / span 7;
    grid-row: 2;
    margin-top: -40px;
    transform: translate3d(80px, 40px, 0) rotate(2deg);
    opacity: 0;
    z-index: 3;
}
.panel-b.revealed {
    transform: translate3d(0, 0, 0) rotate(1.2deg);
    opacity: 1;
}

.panel-c {
    grid-column: 2 / span 9;
    grid-row: 3;
    margin-top: -30px;
    transform: translate3d(-60px, 40px, 0) rotate(-2deg);
    opacity: 0;
    z-index: 4;
}
.panel-c.revealed {
    transform: translate3d(0, 0, 0) rotate(-0.8deg);
    opacity: 1;
}

.panel-inner {
    background: #1e1a16;
    border: 1px solid #3a3228;
    padding: 48px 44px;
    position: relative;
    box-shadow: 0 12px 48px rgba(0,0,0,0.35), inset 0 0 80px rgba(15,13,11,0.4);
}

.panel-inner::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.05;
    background-image:
        radial-gradient(ellipse at 20% 20%, #9c8b72 0%, transparent 40%),
        radial-gradient(ellipse at 80% 80%, #c4553a 0%, transparent 35%);
}

.panel-inner-torn-right {
    clip-path: url(#tornEdgeRight);
    padding-right: 60px;
}

.panel-inner-torn-left {
    clip-path: url(#tornEdgeLeft);
    padding-left: 60px;
}

.panel-inner-torn-both {
    clip-path: url(#tornEdgeBoth);
    padding-left: 60px;
    padding-right: 60px;
}

.panel-corner-fold {
    position: absolute;
    top: 0;
    right: 0;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, transparent 50%, #3a3228 50%);
    z-index: 2;
}

.manifesto-panel .section-title {
    font-size: clamp(2.4rem, 4.8vw, 3.8rem);
    margin-bottom: 22px;
}

.pull-quote {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 300;
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    line-height: 1.35;
    color: #e8e0d4;
    margin: 12px 0 20px;
    position: relative;
    padding: 0 24px;
}

.quote-mark {
    font-family: 'Cormorant Garamond', serif;
    font-size: 3rem;
    line-height: 0;
    color: #d4a857;
    position: relative;
    top: 16px;
    display: inline-block;
    margin: 0 4px;
}

.quote-mark-close {
    top: 22px;
}

.quote-cite {
    font-family: 'Barlow Condensed', sans-serif;
    font-style: normal;
    font-weight: 400;
    font-size: 0.72rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: #9c8b72;
    display: block;
    text-align: right;
    margin-top: 12px;
}

.method-list {
    list-style: none;
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.method-list li {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.method-bullet {
    color: #5a8a7a;
    font-size: 0.7rem;
    line-height: 1;
}

.method-text {
    font-family: 'Libre Baskerville', serif;
    font-style: italic;
    font-size: 0.92rem;
    color: #e8e0d4;
    opacity: 0.88;
}

/* Wheat-paste poster element */
.wheat-paste-element {
    margin-top: 120px;
    text-align: center;
    position: relative;
    opacity: 0;
    transform: translateY(40px) rotate(-3deg);
    transition: opacity 0.9s ease-out, transform 0.9s ease-out;
}

.wheat-paste-element.revealed {
    opacity: 1;
    transform: translateY(0) rotate(-3deg);
}

.wheat-paste-text {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: clamp(3rem, 10vw, 9rem);
    letter-spacing: 0.12em;
    color: #c4553a;
    opacity: 0.16;
    text-transform: uppercase;
    display: inline-block;
    padding: 16px 40px;
    position: relative;
    background:
        linear-gradient(110deg, transparent 0%, rgba(156,139,114,0.04) 35%, transparent 36%),
        linear-gradient(65deg, transparent 45%, rgba(156,139,114,0.03) 46%, transparent 80%);
    border-top: 2px solid rgba(196,85,58,0.15);
    border-bottom: 2px solid rgba(196,85,58,0.15);
}

.wheat-paste-layer {
    position: absolute;
    inset: -20px -8px;
    background:
        linear-gradient(85deg, transparent 70%, rgba(212,168,87,0.08) 75%, transparent 80%);
    z-index: -1;
    pointer-events: none;
    transform: rotate(2deg);
}

/* ============================================================
   SECTION III : ARCHETYPES (CARD FLIP)
   ============================================================ */

.archetypes-section {
    position: relative;
    padding: 140px 6% 120px;
    min-height: 100vh;
}

.section-header {
    text-align: center;
    margin-bottom: 100px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.9s ease-out, transform 0.9s ease-out;
}

.section-header.revealed {
    opacity: 1;
    transform: translateY(0);
}

.section-header .ruling-line {
    margin: 28px auto;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(260px, 1fr));
    gap: 60px 48px;
    max-width: 1200px;
    margin: 0 auto;
    perspective: 1600px;
}

.card-wrapper {
    perspective: 1600px;
    transition: opacity 0.9s cubic-bezier(0.25,0.46,0.45,0.94),
                transform 0.9s cubic-bezier(0.25,0.46,0.45,0.94);
    opacity: 0;
}

.card-wrapper.revealed { opacity: 1; }

/* broken-grid rotations per card */
.card-rotate-1 { transform: translate3d(-60px, 40px, 0) rotate(2deg); }
.card-rotate-1.revealed { transform: translate3d(0, 0, 0) rotate(-2.5deg); }

.card-rotate-2 { transform: translate3d(60px, 40px, 0) rotate(-2deg); margin-top: 28px; }
.card-rotate-2.revealed { transform: translate3d(0, 0, 0) rotate(1.8deg); }

.card-rotate-3 { transform: translate3d(-60px, 40px, 0) rotate(1.5deg); }
.card-rotate-3.revealed { transform: translate3d(0, 0, 0) rotate(-1.2deg); }

.card-rotate-4 { transform: translate3d(60px, 40px, 0) rotate(-1.5deg); margin-top: 36px; }
.card-rotate-4.revealed { transform: translate3d(0, 0, 0) rotate(3deg); }

.card-rotate-5 { transform: translate3d(-60px, 40px, 0) rotate(2deg); }
.card-rotate-5.revealed { transform: translate3d(0, 0, 0) rotate(-1.8deg); }

.card-rotate-6 { transform: translate3d(60px, 40px, 0) rotate(-2deg); margin-top: 24px; }
.card-rotate-6.revealed { transform: translate3d(0, 0, 0) rotate(2.2deg); }

.archetype-card {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 5.6;
    min-height: 420px;
    transform-style: preserve-3d;
    transition: transform 0.75s cubic-bezier(0.4, 0.0, 0.2, 1);
    cursor: pointer;
}

.archetype-card.is-flipped {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    background: #1e1a16;
    border: 1.5px solid #3a3228;
    padding: 34px 28px 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
    box-shadow: 0 14px 40px rgba(0,0,0,0.45);
}

.card-front {
    background: #1e1a16;
}

.card-back {
    background: #0f0d0b;
    transform: rotateY(180deg);
    border-color: #5a4a38;
    justify-content: flex-start;
    padding-top: 48px;
}

.card-foxing {
    position: absolute;
    inset: 0;
    opacity: 0.06;
    background-image:
        radial-gradient(ellipse at 30% 20%, #9c8b72 0%, transparent 40%),
        radial-gradient(ellipse at 75% 85%, #c4553a 0%, transparent 30%),
        radial-gradient(ellipse at 60% 50%, #9c8b72 0%, transparent 50%);
    pointer-events: none;
}

.card-folio {
    position: absolute;
    top: 14px;
    left: 16px;
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 300;
    font-size: 0.95rem;
    color: #9c8b72;
    opacity: 0.6;
}

.card-symbol {
    width: 78px;
    height: 78px;
    margin-bottom: 26px;
    color: #d4a857;
    transition: transform 0.5s ease, color 0.4s ease;
}

.archetype-card:hover .card-symbol {
    transform: scale(1.08) rotate(-4deg);
}

.archetype-icon {
    width: 100%;
    height: 100%;
}

.card-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-size: 1.85rem;
    letter-spacing: -0.01em;
    color: #e8e0d4;
    margin-bottom: 8px;
    line-height: 1;
}

.card-epithet {
    font-family: 'Libre Baskerville', serif;
    font-style: italic;
    font-size: 0.82rem;
    color: #9c8b72;
    opacity: 0.8;
}

.card-flip-hint {
    position: absolute;
    bottom: 14px;
    right: 18px;
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 0.6rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: #9c8b72;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.archetype-card:hover .card-flip-hint {
    opacity: 0.6;
}

/* Back face */
.card-back-label {
    position: absolute;
    top: 18px;
    left: 22px;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 500;
    font-size: 0.62rem;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: #d4a857;
    opacity: 0.7;
}

.card-back-title {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 400;
    font-size: 1.4rem;
    color: #d4a857;
    margin-bottom: 16px;
    margin-top: 8px;
    border-bottom: 1px solid rgba(212,168,87,0.3);
    padding-bottom: 10px;
    width: 100%;
    text-align: center;
}

.card-description {
    font-family: 'Libre Baskerville', serif;
    font-size: 0.85rem;
    line-height: 1.7;
    color: #e8e0d4;
    opacity: 0.82;
    text-align: left;
}

.card-sigil {
    position: absolute;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.4rem;
    color: #c4553a;
    opacity: 0.6;
}

/* Card data-archetype color accents */
.archetype-card[data-archetype="hero"] .card-symbol      { color: #d4a857; }
.archetype-card[data-archetype="shadow"] .card-symbol    { color: #9c8b72; }
.archetype-card[data-archetype="trickster"] .card-symbol { color: #c4553a; }
.archetype-card[data-archetype="sage"] .card-symbol      { color: #e8e0d4; }
.archetype-card[data-archetype="creator"] .card-symbol   { color: #5a8a7a; }
.archetype-card[data-archetype="ruler"] .card-symbol     { color: #d4a857; }

/* Footnote */
.archetype-footnote {
    max-width: 720px;
    margin: 100px auto 0;
    display: flex;
    gap: 18px;
    align-items: baseline;
    padding-left: 40px;
    padding-right: 40px;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.archetype-footnote.revealed {
    opacity: 1;
    transform: translateY(0);
}

.footnote-num {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    color: #d4a857;
    font-size: 1rem;
    flex-shrink: 0;
}

.footnote-text {
    font-family: 'Libre Baskerville', serif;
    font-style: italic;
    font-size: 0.82rem;
    color: #9c8b72;
    line-height: 1.75;
    border-left: 1px solid #3a3228;
    padding-left: 20px;
}

/* ============================================================
   SECTION IV : TAXONOMY
   ============================================================ */

.taxonomy-section {
    position: relative;
    padding: 140px 8% 120px;
    min-height: 80vh;
}

.taxonomy-header {
    text-align: center;
    margin-bottom: 90px;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.9s ease-out, transform 0.9s ease-out;
}

.taxonomy-header.revealed {
    opacity: 1;
    transform: translateY(0);
}

.taxonomy-header .ruling-line {
    margin: 26px auto;
}

.taxonomy-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 64px;
    max-width: 1100px;
    margin: 0 auto;
}

.taxonomy-column {
    opacity: 0;
    transition: opacity 0.9s cubic-bezier(0.25,0.46,0.45,0.94),
                transform 0.9s cubic-bezier(0.25,0.46,0.45,0.94);
}

.taxonomy-column:nth-child(1) { transform: translate3d(-50px, 40px, 0) rotate(-1deg); }
.taxonomy-column:nth-child(1).revealed { transform: translate3d(0, 0, 0) rotate(-0.6deg); opacity: 1; }

.taxonomy-column:nth-child(2) { transform: translate3d(0, 60px, 0) rotate(0.8deg); }
.taxonomy-column:nth-child(2).revealed { transform: translate3d(0, 0, 0) rotate(0.4deg); opacity: 1; }

.taxonomy-column:nth-child(3) { transform: translate3d(50px, 40px, 0) rotate(-0.8deg); }
.taxonomy-column:nth-child(3).revealed { transform: translate3d(0, 0, 0) rotate(-0.3deg); opacity: 1; }

.taxonomy-category {
    padding: 28px 24px 32px;
    position: relative;
    background: rgba(30,26,22,0.5);
    border: 1px solid rgba(58,50,40,0.5);
}

.category-numeral {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 300;
    font-size: 1.4rem;
    color: #d4a857;
    display: block;
    margin-bottom: 8px;
    opacity: 0.75;
}

.category-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 600;
    font-size: 0.88rem;
    letter-spacing: 0.26em;
    text-transform: uppercase;
    color: #e8e0d4;
    margin-bottom: 4px;
}

.category-motto {
    display: block;
    font-family: 'Libre Baskerville', serif;
    font-style: italic;
    font-size: 0.78rem;
    color: #9c8b72;
    opacity: 0.75;
    margin-bottom: 4px;
}

.taxonomy-list {
    list-style: none;
    margin-top: 8px;
}

.taxonomy-item {
    display: flex;
    align-items: baseline;
    padding: 13px 0;
    border-bottom: 1px dashed rgba(58,50,40,0.55);
    gap: 12px;
    transition: padding-left 0.3s ease;
    cursor: default;
}

.taxonomy-item:last-child { border-bottom: none; }

.taxonomy-item:hover {
    padding-left: 6px;
}

.item-marker {
    width: 5px;
    height: 5px;
    background: #5a8a7a;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 7px;
    transition: background 0.3s ease, transform 0.3s ease;
}

.taxonomy-item:hover .item-marker {
    background: #d4a857;
    transform: scale(1.6);
}

.item-name {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-size: 1.15rem;
    color: #e8e0d4;
    margin-right: auto;
    transition: color 0.3s ease;
}

.taxonomy-item:hover .item-name {
    color: #d4a857;
}

.item-note {
    font-family: 'Libre Baskerville', serif;
    font-size: 0.72rem;
    font-style: italic;
    color: #9c8b72;
    opacity: 0.7;
    letter-spacing: 0.02em;
}

/* ============================================================
   SECTION V : ALCHEMY
   ============================================================ */

.alchemy-section {
    position: relative;
    padding: 140px 8% 160px;
    min-height: 100vh;
}

.alchemy-header {
    text-align: center;
    margin-bottom: 100px;
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.9s ease-out, transform 0.9s ease-out;
}

.alchemy-header.revealed {
    opacity: 1;
    transform: translateY(0);
}

.alchemy-header .ruling-line {
    margin: 26px auto;
}

.alchemy-intro {
    font-size: 0.98rem;
    opacity: 0.8;
    margin-top: 12px;
}

.alchemy-intro em {
    color: #d4a857;
    font-style: italic;
}

.alchemy-stages {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
    max-width: 1200px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.alchemy-stage {
    text-align: center;
    flex: 0 0 220px;
    padding: 0 12px;
    opacity: 0;
    transform: translate3d(0, 40px, 0);
    transition: opacity 0.9s cubic-bezier(0.25,0.46,0.45,0.94),
                transform 0.9s cubic-bezier(0.25,0.46,0.45,0.94);
}

.alchemy-stage.revealed {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

.alchemy-stage:nth-child(1) { transition-delay: 0s; }
.alchemy-stage:nth-child(3) { transition-delay: 0.15s; }
.alchemy-stage:nth-child(5) { transition-delay: 0.3s; }
.alchemy-stage:nth-child(7) { transition-delay: 0.45s; }

.alchemy-connector {
    flex: 0 0 32px;
    height: 1px;
    margin-top: 52px;
    background: linear-gradient(to right, transparent, #3a3228 20%, #3a3228 80%, transparent);
    position: relative;
}

.alchemy-connector::after {
    content: '';
    position: absolute;
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #3a3228;
}

.stage-circle {
    width: 108px;
    height: 108px;
    margin: 0 auto 22px;
    transition: transform 0.5s ease;
}

.alchemy-stage:hover .stage-circle {
    transform: scale(1.08);
}

.stage-symbol {
    width: 100%;
    height: 100%;
}

.stage-folio {
    display: block;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 500;
    font-size: 0.62rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: #9c8b72;
    margin-bottom: 8px;
    opacity: 0.7;
}

.stage-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-size: 1.7rem;
    color: #e8e0d4;
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}

.stage-latin {
    display: block;
    font-family: 'Libre Baskerville', serif;
    font-style: italic;
    font-size: 0.78rem;
    color: #9c8b72;
    opacity: 0.75;
    margin-bottom: 14px;
}

.stage-description {
    font-family: 'Libre Baskerville', serif;
    font-size: 0.82rem;
    line-height: 1.72;
    color: #9c8b72;
    max-width: 200px;
    margin: 0 auto;
}

.stage-nigredo    .stage-title { color: #9c8b72; }
.stage-albedo     .stage-title { color: #e8e0d4; }
.stage-citrinitas .stage-title { color: #d4a857; }
.stage-rubedo     .stage-title { color: #c4553a; }

.alchemy-coda {
    max-width: 640px;
    margin: 120px auto 0;
    text-align: center;
    padding: 32px 24px;
    border-top: 1px solid #3a3228;
    border-bottom: 1px solid #3a3228;
    position: relative;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.9s ease-out, transform 0.9s ease-out;
}

.alchemy-coda.revealed {
    opacity: 1;
    transform: translateY(0);
}

.coda-mark {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2rem;
    color: #d4a857;
    display: block;
    line-height: 1;
    margin-bottom: 14px;
    opacity: 0.8;
}

.coda-text {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 300;
    font-size: 1.3rem;
    line-height: 1.5;
    color: #e8e0d4;
    margin-bottom: 16px;
}

.coda-cite {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 0.7rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: #9c8b72;
    opacity: 0.65;
}

/* ============================================================
   FOOTER
   ============================================================ */

.footer-section {
    position: relative;
    padding: 100px 8% 60px;
    border-top: 1px solid #3a3228;
    background: #0f0d0b;
    overflow: hidden;
}

.foxing-footer { opacity: 0.04; }

.footer-content {
    max-width: 1100px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.footer-title {
    margin-bottom: 64px;
    position: relative;
}

.footer-kicker {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 400;
    font-size: 0.72rem;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: #9c8b72;
    display: block;
    margin-bottom: 12px;
}

.footer-logo {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(2.5rem, 5vw, 4rem);
    color: #e8e0d4;
    letter-spacing: -0.02em;
    line-height: 1;
}

.footer-tagline {
    font-family: 'Libre Baskerville', serif;
    font-style: italic;
    font-size: 0.88rem;
    color: #9c8b72;
    margin-top: 12px;
    opacity: 0.75;
}

.footer-columns {
    display: grid;
    grid-template-columns: 1fr 1.6fr 1fr;
    gap: 56px;
    margin-bottom: 64px;
    padding-bottom: 48px;
    border-bottom: 1px solid #3a3228;
}

.footer-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-label {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 600;
    font-size: 0.72rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: #d4a857;
    margin-bottom: 14px;
    padding-bottom: 6px;
    border-bottom: 1px solid #3a3228;
}

.footer-link {
    font-family: 'Libre Baskerville', serif;
    font-size: 0.88rem;
    color: #9c8b72;
    text-decoration: none;
    transition: color 0.3s ease, padding-left 0.3s ease;
    position: relative;
}

.footer-link:hover {
    color: #d4a857;
    padding-left: 8px;
}

.footer-link::before {
    content: '\203A';
    position: absolute;
    left: -4px;
    opacity: 0;
    transition: opacity 0.3s ease, left 0.3s ease;
    color: #d4a857;
}

.footer-link:hover::before {
    opacity: 1;
    left: 0;
}

.footer-ref {
    font-family: 'Libre Baskerville', serif;
    font-size: 0.82rem;
    color: #9c8b72;
    opacity: 0.75;
    font-style: italic;
    line-height: 1.6;
}

.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 8px;
}

.footer-copy {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 300;
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #9c8b72;
    opacity: 0.55;
}

/* ============================================================
   SCROLL REVEAL BASE
   ============================================================ */

[data-reveal] {
    will-change: transform, opacity;
}

[data-reveal="fade"] {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.9s cubic-bezier(0.25,0.46,0.45,0.94),
                transform 0.9s cubic-bezier(0.25,0.46,0.45,0.94);
}

[data-reveal="fade"].revealed {
    opacity: 1;
    transform: translateY(0);
}

[data-reveal="up"] {
    opacity: 0;
    transform: translate3d(0, 40px, 0);
    transition: opacity 0.9s cubic-bezier(0.25,0.46,0.45,0.94),
                transform 0.9s cubic-bezier(0.25,0.46,0.45,0.94);
}

[data-reveal="up"].revealed {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

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

@media (max-width: 1100px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 56px 40px;
    }
    .broken-grid-container {
        display: flex;
        flex-direction: column;
        gap: 48px;
    }
    .panel-a, .panel-b, .panel-c {
        grid-column: unset;
        grid-row: unset;
        margin-top: 0;
    }
    .chapter-frame { right: 24px; }
}

@media (max-width: 900px) {
    .spine-nav { left: 16px; }
    .spine-label { display: none; }
    .margin-citation { display: none; }
    .manifesto-section,
    .archetypes-section,
    .taxonomy-section,
    .alchemy-section,
    .footer-section {
        padding-left: 12%;
        padding-right: 8%;
    }
    .taxonomy-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    .alchemy-stages {
        flex-direction: column;
        align-items: center;
    }
    .alchemy-connector {
        width: 1px;
        height: 36px;
        margin: 8px auto;
        background: linear-gradient(to bottom, transparent, #3a3228 20%, #3a3228 80%, transparent);
    }
    .alchemy-connector::after {
        top: 50%;
        transform: translate(-50%, -50%);
    }
    .footer-columns {
        grid-template-columns: 1fr;
        gap: 40px;
    }
}

@media (max-width: 640px) {
    .opening-title { font-size: 15vw; }
    .opening-folio { font-size: 0.65rem; letter-spacing: 0.3em; }
    .cards-grid {
        grid-template-columns: 1fr;
        gap: 44px;
    }
    .card-rotate-1, .card-rotate-1.revealed,
    .card-rotate-2, .card-rotate-2.revealed,
    .card-rotate-3, .card-rotate-3.revealed,
    .card-rotate-4, .card-rotate-4.revealed,
    .card-rotate-5, .card-rotate-5.revealed,
    .card-rotate-6, .card-rotate-6.revealed {
        transform: translate3d(0, 0, 0) rotate(0deg);
        margin-top: 0;
    }
    .panel-a, .panel-b, .panel-c,
    .panel-a.revealed, .panel-b.revealed, .panel-c.revealed {
        transform: rotate(0deg) !important;
    }
    .stencil-top { top: 20px; right: 20px; font-size: 0.62rem; padding: 3px 9px; }
    .stencil-corner { display: none; }
    .marginalia-left, .marginalia-right { display: none; }
    .chapter-frame { top: 20px; right: 14px; }
    .chapter-roman { font-size: 1.2rem; }
    .panel-inner { padding: 36px 28px; }
    .panel-inner-torn-left, .panel-inner-torn-right, .panel-inner-torn-both {
        padding-left: 40px;
        padding-right: 40px;
    }
    .wheat-paste-text { letter-spacing: 0.06em; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
