/* ============================================================
   xanadu.science — The Alph, Sacred River
   A surreal dreamscape of speculative research.
   ============================================================ */

:root {
    /* palette — "The Alph, Sacred River" */
    --midnight-alph: #0a1229;
    --sunless-sea: #16243f;
    --caverns: #2a3b5e;
    --vellum: #d8d0c2;
    --vellum-deep: #cfc3a8;
    --vellum-center: #e6dcc9;
    --honeyed-dew: #e8c97a;
    --sinuous-rill: #c95f4f;
    --corrected-teal: #4a8f8a;
    --ancestral-voice: #6b4f8a;

    /* typography */
    --display: "Cormorant Garamond", "Lora", serif;
    --body: "Spectral", "Lora", "Georgia", serif;
    --hand: "Caveat", "Inter", cursive;
    --mono: "IBM Plex Mono", "Inter", ui-monospace, monospace;

    /* timing */
    --ease-long: cubic-bezier(0.22, 1, 0.36, 1);

    --tilt: 0deg;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

html {
    background: var(--midnight-alph);
    scroll-behavior: smooth;
}

body {
    font-family: var(--body);
    font-weight: 300;
    font-size: 18px;
    line-height: 1.75;
    color: var(--vellum);
    background: var(--midnight-alph);
    overflow-x: hidden;
    cursor: crosshair;
    -webkit-font-smoothing: antialiased;
    letter-spacing: 0.01em;
}

/* ------------------------------------------------------------
   grain canvas & cursor mist
   ------------------------------------------------------------ */

#grain-canvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 2000;
    mix-blend-mode: overlay;
    opacity: 0.45;
}

#cursor-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1800;
}

.mist-dot {
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(216, 208, 194, 0.55) 0%, rgba(216, 208, 194, 0) 70%);
    mix-blend-mode: screen;
    transform: translate(-50%, -50%) scale(0.4);
    opacity: 0;
    transition: opacity 900ms linear, transform 900ms var(--ease-long);
    pointer-events: none;
}

.mist-dot.alive {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.6);
}

/* ------------------------------------------------------------
   compass navigation
   ------------------------------------------------------------ */

#compass-nav {
    position: fixed;
    top: 1.6rem;
    right: 1.6rem;
    z-index: 1500;
    transform: rotate(-4deg);
}

#compass-toggle {
    background: rgba(10, 18, 41, 0.6);
    border: 1px solid rgba(216, 208, 194, 0.25);
    border-radius: 50%;
    padding: 0.3rem;
    cursor: crosshair;
    transition: transform 600ms var(--ease-long), background 400ms ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

#compass-toggle:hover {
    transform: rotate(120deg) scale(1.08);
    background: rgba(10, 18, 41, 0.85);
}

#compass-list {
    list-style: none;
    padding: 1.25rem 1.5rem;
    margin: 1rem 0 0;
    background: rgba(10, 18, 41, 0.88);
    border: 1px solid rgba(232, 201, 122, 0.2);
    border-radius: 2px;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--vellum);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-4px) rotate(2deg);
    transition: max-height 600ms var(--ease-long), opacity 500ms var(--ease-long), transform 600ms var(--ease-long);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    pointer-events: none;
}

#compass-nav.open #compass-list {
    max-height: 700px;
    opacity: 1;
    transform: translateY(0) rotate(2deg);
    pointer-events: auto;
}

#compass-list li {
    margin-bottom: 0.55rem;
}

#compass-list a {
    color: inherit;
    text-decoration: none;
    display: flex;
    gap: 0.75rem;
    align-items: baseline;
    transition: color 300ms ease;
}

#compass-list a:hover {
    color: var(--honeyed-dew);
}

#compass-list a:hover .num {
    color: var(--sinuous-rill);
}

#compass-list .num {
    color: var(--corrected-teal);
    font-weight: 500;
    min-width: 2.4rem;
    display: inline-block;
}

#compass-list .lab {
    font-weight: 400;
}

/* ------------------------------------------------------------
   main scaffolding & strata
   ------------------------------------------------------------ */

#alph {
    position: relative;
    z-index: 10;
}

.stratum {
    position: relative;
    min-height: 100vh;
    padding: 8rem 5vw;
    overflow: hidden;
    background: var(--midnight-alph);
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: background 1400ms var(--ease-long);
}

/* gradient wash transitions between strata */
.stratum::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 160px;
    pointer-events: none;
    background: linear-gradient(to bottom, var(--midnight-alph), transparent);
    z-index: 3;
}

.stratum::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 160px;
    pointer-events: none;
    background: linear-gradient(to top, var(--midnight-alph), transparent);
    z-index: 3;
}

.stratum.vellum::before,
.stratum.vellum::after {
    background: linear-gradient(to bottom, var(--vellum-center), transparent);
}

.stratum.vellum::after {
    background: linear-gradient(to top, var(--vellum-deep), transparent);
}

#stratum-ii { background: linear-gradient(180deg, var(--midnight-alph) 0%, var(--sunless-sea) 100%); }
#stratum-iii {
    background:
        radial-gradient(ellipse at center, var(--vellum-center) 0%, var(--vellum-deep) 90%),
        url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg"><filter id="n"><feTurbulence baseFrequency="0.9"/></filter><rect width="100%" height="100%" filter="url(%23n)" opacity="0.06"/></svg>');
    color: var(--midnight-alph);
}
#stratum-iv { background: linear-gradient(180deg, var(--sunless-sea) 0%, var(--midnight-alph) 100%); }
#stratum-v { background: linear-gradient(180deg, var(--midnight-alph) 0%, var(--caverns) 55%, var(--midnight-alph) 100%); }
#stratum-vi {
    background:
        radial-gradient(ellipse at 30% 40%, var(--vellum-center) 0%, var(--vellum-deep) 95%);
    color: var(--midnight-alph);
    background-image:
        radial-gradient(circle, rgba(74, 143, 138, 0.25) 1px, transparent 1.4px),
        radial-gradient(ellipse at 30% 40%, var(--vellum-center) 0%, var(--vellum-deep) 95%);
    background-size: 24px 24px, cover;
}
#stratum-vii { background: linear-gradient(180deg, var(--midnight-alph) 0%, #0d1730 100%); }
#stratum-viii { background: radial-gradient(ellipse at 40% 60%, #15243d 0%, var(--midnight-alph) 80%); }
#stratum-ix {
    background: radial-gradient(ellipse at 50% 50%, var(--vellum-center) 0%, var(--vellum-deep) 95%);
    color: var(--midnight-alph);
}
#stratum-x { background: linear-gradient(180deg, var(--midnight-alph) 0%, var(--sunless-sea) 100%); }
#stratum-xi { background: radial-gradient(ellipse at 50% 80%, #0d1a38 0%, #050a1d 80%); }

.content {
    position: relative;
    z-index: 5;
    max-width: 1200px;
    margin: 0 auto;
}

.tilt {
    transform: rotate(0deg);
    transition: transform 1400ms var(--ease-long);
    transform-origin: 50% 50%;
    will-change: transform;
}

.stratum.in-view .tilt {
    transform: rotate(var(--tilt, 0deg));
}

/* ------------------------------------------------------------
   reveal / stagger
   ------------------------------------------------------------ */

.reveal {
    opacity: 0;
    transform: translateY(18px) translateX(-6px);
    transition: opacity 1400ms var(--ease-long), transform 1400ms var(--ease-long);
}

.stratum.in-view .reveal {
    opacity: 1;
    transform: translateY(0) translateX(0);
}

.stratum.in-view .reveal:nth-child(1) { transition-delay: 0ms; }
.stratum.in-view .reveal:nth-child(2) { transition-delay: 180ms; }
.stratum.in-view .reveal:nth-child(3) { transition-delay: 360ms; }
.stratum.in-view .reveal:nth-child(4) { transition-delay: 540ms; }
.stratum.in-view .reveal:nth-child(5) { transition-delay: 720ms; }
.stratum.in-view .reveal:nth-child(6) { transition-delay: 900ms; }
.stratum.in-view .reveal:nth-child(7) { transition-delay: 1080ms; }
.stratum.in-view .reveal:nth-child(8) { transition-delay: 1260ms; }
.stratum.in-view .reveal:nth-child(9) { transition-delay: 1440ms; }
.stratum.in-view .reveal:nth-child(10) { transition-delay: 1620ms; }
.stratum.in-view .reveal:nth-child(11) { transition-delay: 1800ms; }
.stratum.in-view .reveal:nth-child(12) { transition-delay: 1980ms; }

/* ------------------------------------------------------------
   shared text styles
   ------------------------------------------------------------ */

.plate-caption {
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--corrected-teal);
    margin: 0 0 1.5rem;
    font-variant: small-caps;
    font-weight: 400;
}

.plate-caption.dark { color: #5a7a78; }

.stratum-title {
    font-family: var(--display);
    font-weight: 300;
    font-style: italic;
    font-size: clamp(2.6rem, 7.5vw, 6rem);
    line-height: 1.04;
    letter-spacing: -0.015em;
    margin: 0 0 1.5rem;
    color: var(--vellum);
    max-width: 16ch;
}

.stratum-title.dark { color: var(--midnight-alph); }
.stratum-title em {
    font-family: var(--display);
    font-weight: 500;
    font-style: italic;
    color: var(--honeyed-dew);
}

.stratum.vellum .stratum-title em {
    color: var(--sinuous-rill);
}

.lede {
    font-family: var(--body);
    font-size: clamp(18px, 1.6vw, 22px);
    font-weight: 300;
    line-height: 1.65;
    max-width: 38ch;
    margin: 0 0 2rem;
    color: var(--vellum);
}

.lede.dark { color: #2a3b5e; }
.lede em { color: var(--honeyed-dew); font-style: italic; }
.lede.dark em { color: var(--sinuous-rill); }

.hint {
    font-family: var(--hand);
    color: var(--corrected-teal);
    font-size: 1.4rem;
    transform: rotate(-2deg);
    display: inline-block;
    margin-top: 1rem;
}

.hint.dark { color: var(--corrected-teal); }

/* ------------------------------------------------------------
   STRATUM I — The Pleasure Dome
   ------------------------------------------------------------ */

#stratum-i {
    background: radial-gradient(ellipse at 50% 75%, #121d3c 0%, var(--midnight-alph) 60%, #05091b 100%);
    min-height: 110vh;
    padding-top: 6rem;
}

.dome-sky {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 1;
}

.dome-wrap {
    position: absolute;
    top: 18%;
    left: 50%;
    width: 80vw;
    max-width: 1100px;
    height: 45vh;
    transform: translateX(-50%) rotate(-3deg);
}

.dome {
    position: relative;
    width: 100%;
    height: 100%;
    animation: domeBreath 7s ease-in-out infinite;
}

.ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    filter: blur(0.5px);
    pointer-events: none;
}

.ring.r1 { background: radial-gradient(ellipse at 52% 48%, rgba(107, 79, 138, 0.55) 0%, rgba(107, 79, 138, 0) 55%); opacity: 0.9; animation-delay: 0s; }
.ring.r2 { inset: 5% 5%; background: radial-gradient(ellipse at 52% 48%, rgba(107, 79, 138, 0.5) 0%, rgba(107, 79, 138, 0) 52%); opacity: 0.8; }
.ring.r3 { inset: 10% 10%; background: radial-gradient(ellipse at 52% 48%, rgba(130, 96, 166, 0.45) 0%, rgba(130, 96, 166, 0) 50%); opacity: 0.8; }
.ring.r4 { inset: 15% 15%; background: radial-gradient(ellipse at 53% 47%, rgba(145, 110, 180, 0.4) 0%, rgba(145, 110, 180, 0) 48%); opacity: 0.85; }
.ring.r5 { inset: 20% 20%; background: radial-gradient(ellipse at 53% 46%, rgba(160, 125, 192, 0.36) 0%, rgba(160, 125, 192, 0) 46%); opacity: 0.85; }
.ring.r6 { inset: 25% 25%; background: radial-gradient(ellipse at 54% 45%, rgba(175, 140, 200, 0.34) 0%, rgba(175, 140, 200, 0) 44%); opacity: 0.85; }
.ring.r7 { inset: 30% 28%; background: radial-gradient(ellipse at 55% 44%, rgba(185, 155, 210, 0.34) 0%, rgba(185, 155, 210, 0) 42%); opacity: 0.9; }
.ring.r8 { inset: 35% 30%; background: radial-gradient(ellipse at 56% 43%, rgba(195, 165, 215, 0.33) 0%, rgba(195, 165, 215, 0) 40%); opacity: 0.9; }
.ring.r9 { inset: 38% 33%; background: radial-gradient(ellipse at 56% 42%, rgba(205, 175, 220, 0.3) 0%, rgba(205, 175, 220, 0) 38%); opacity: 0.9; }
.ring.r10 { inset: 42% 36%; background: radial-gradient(ellipse at 57% 41%, rgba(215, 185, 225, 0.28) 0%, rgba(215, 185, 225, 0) 35%); opacity: 0.9; }
.ring.r11 { inset: 45% 40%; background: radial-gradient(ellipse at 58% 40%, rgba(220, 195, 230, 0.22) 0%, rgba(220, 195, 230, 0) 32%); opacity: 0.85; }
.ring.r12 { inset: 48% 44%; background: radial-gradient(ellipse at 59% 38%, rgba(228, 205, 210, 0.18) 0%, rgba(228, 205, 210, 0) 30%); opacity: 0.8; }
.ring.r13 { inset: 52% 48%; background: radial-gradient(ellipse at 60% 36%, rgba(232, 215, 190, 0.2) 0%, rgba(232, 215, 190, 0) 28%); opacity: 0.8; }
.ring.r14 { inset: 55% 50%; background: radial-gradient(ellipse at 62% 34%, rgba(232, 201, 122, 0.25) 0%, rgba(232, 201, 122, 0) 25%); opacity: 0.9; }

.rim-light {
    position: absolute;
    inset: -4% -4%;
    border-radius: 50%;
    background: conic-gradient(from 60deg, transparent 0deg, rgba(232, 201, 122, 0.35) 30deg, transparent 90deg, transparent 360deg);
    mix-blend-mode: screen;
    filter: blur(6px);
    opacity: 0.7;
    animation: rimGlow 11s ease-in-out infinite alternate;
}

@keyframes domeBreath {
    0%, 100% { transform: scale(1); filter: blur(0); }
    50% { transform: scale(1.015); filter: blur(0.3px); }
}

@keyframes rimGlow {
    0% { opacity: 0.5; transform: rotate(0deg); }
    100% { opacity: 0.85; transform: rotate(6deg); }
}

.stars {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.stars span {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: 2px;
    height: 2px;
    border-radius: 50%;
    background: var(--honeyed-dew);
    opacity: 0.6;
    animation: starPulse 5s ease-in-out infinite;
    animation-delay: var(--d);
}

@keyframes starPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.9; box-shadow: 0 0 6px rgba(232, 201, 122, 0.7); }
}

#stratum-i .content {
    position: relative;
    z-index: 5;
    padding-top: 52vh;
    text-align: left;
    --tilt: -6deg;
}

.wordmark {
    font-family: var(--display);
    font-weight: 300;
    font-style: italic;
    font-size: clamp(3rem, 10vw, 8rem);
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--vellum);
    margin: 0 0 1.5rem;
    transform: rotate(-6deg);
    transform-origin: left center;
    display: inline-block;
}

.wordmark .dot {
    color: var(--sinuous-rill);
    font-weight: 500;
    font-style: normal;
}

.caption {
    font-family: var(--body);
    font-style: italic;
    font-size: clamp(18px, 1.8vw, 24px);
    font-weight: 400;
    color: var(--vellum);
    max-width: 42ch;
    margin: 0 0 2rem;
    line-height: 1.55;
    transform: rotate(-6deg) translateX(1rem);
    transform-origin: left center;
}

.establishment {
    font-family: var(--body);
    font-size: 15px;
    font-weight: 300;
    max-width: 48ch;
    color: rgba(216, 208, 194, 0.7);
    transform: rotate(-6deg);
    transform-origin: left center;
    margin: 0 0 3rem;
}

#stratum-i .hint {
    transform: rotate(-6deg);
    color: var(--corrected-teal);
    font-size: 1.2rem;
}

/* ------------------------------------------------------------
   STRATUM II — The Five Rivers
   ------------------------------------------------------------ */

#stratum-ii .content { --tilt: 5deg; }

.rivers {
    position: relative;
    margin-top: 4rem;
    --tilt: 5deg;
    transform: rotate(var(--tilt));
    transform-origin: center center;
    transition: transform 1400ms var(--ease-long);
    padding: 2rem 0;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.river {
    display: flex;
    flex-direction: column;
    padding: 0.6rem 1rem;
    border-top: 1px solid rgba(216, 208, 194, 0.08);
    border-bottom: 1px solid rgba(216, 208, 194, 0.08);
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
    transform-origin: left center;
    transition: transform 700ms var(--ease-long), background 700ms ease;
    white-space: nowrap;
}

.river.r-one { transform: rotate(-1deg); }
.river.r-two { transform: rotate(1.2deg); }
.river.r-three { transform: rotate(-0.6deg); }
.river.r-four { transform: rotate(1.5deg); }
.river.r-five { transform: rotate(-1.2deg); }

.rivers.dim .river:not(:hover) {
    opacity: 0.2;
}

.river-label {
    font-family: var(--display);
    font-style: italic;
    font-weight: 300;
    font-size: clamp(2rem, 5.5vw, 4.2rem);
    color: var(--vellum);
    letter-spacing: -0.01em;
    line-height: 1.1;
    display: inline-block;
    animation: riverFlow 45s linear infinite;
    animation-play-state: running;
}

.river.r-two .river-label { animation-duration: 52s; animation-delay: -12s; }
.river.r-three .river-label { animation-duration: 48s; animation-delay: -6s; }
.river.r-four .river-label { animation-duration: 60s; animation-delay: -18s; }
.river.r-five .river-label { animation-duration: 55s; animation-delay: -3s; }

@keyframes riverFlow {
    0% { transform: translateX(-15%); }
    100% { transform: translateX(15%); }
}

.river:hover .river-label {
    animation-play-state: paused;
    color: var(--honeyed-dew);
    font-weight: 500;
}

.river-sub {
    font-family: var(--hand);
    color: var(--corrected-teal);
    font-size: 1.2rem;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 500ms ease, transform 500ms var(--ease-long);
    margin-top: 0.3rem;
    padding-left: 2rem;
}

.river:hover .river-sub {
    opacity: 1;
    transform: translateY(0);
}

/* ------------------------------------------------------------
   STRATUM III — The Mnemonic Garden
   ------------------------------------------------------------ */

#stratum-iii .content { --tilt: -4deg; }

.stratum-title.dark em {
    color: var(--sinuous-rill);
}

.portholes {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2.5rem;
    margin-top: 4rem;
    position: relative;
    z-index: 5;
    transform: rotate(-4deg);
    transform-origin: center center;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

.porthole {
    aspect-ratio: 1;
    background: radial-gradient(circle, var(--midnight-alph) 0%, var(--sunless-sea) 100%);
    border: 1.2px solid var(--honeyed-dew);
    border-radius: 50%;
    padding: 0;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 600ms var(--ease-long), box-shadow 600ms ease, border-color 400ms ease;
    box-shadow: 0 0 0 1px rgba(232, 201, 122, 0.15), inset 0 0 20px rgba(10, 18, 41, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
}

.porthole:hover {
    transform: scale(1.08) rotate(3deg);
    border-color: var(--sinuous-rill);
    box-shadow: 0 0 24px rgba(232, 201, 122, 0.25), inset 0 0 20px rgba(10, 18, 41, 0.4);
}

.porthole svg {
    width: 72%;
    height: 72%;
}

.inkline {
    fill: none;
    stroke: var(--vellum);
    stroke-width: 1.1;
    stroke-opacity: 0.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 1800ms var(--ease-long), stroke 400ms ease;
}

.porthole.drawn .inkline {
    stroke-dashoffset: 0;
}

.porthole:hover .inkline {
    stroke: var(--honeyed-dew);
}

.porthole-label {
    position: absolute;
    bottom: 0.7rem;
    left: 0;
    right: 0;
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(216, 208, 194, 0.55);
    text-align: center;
    transition: color 400ms ease;
}

.porthole:hover .porthole-label {
    color: var(--honeyed-dew);
}

.reader-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9) rotate(-2deg);
    width: min(560px, 90vw);
    background: var(--vellum-center);
    color: var(--midnight-alph);
    padding: 3rem 3rem;
    z-index: 2500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 500ms var(--ease-long), transform 700ms var(--ease-long);
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(232, 201, 122, 0.4);
}

.reader-panel.open {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1) rotate(-2deg);
}

.reader-close {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--sinuous-rill);
    cursor: crosshair;
    position: absolute;
    top: 1rem;
    right: 1.5rem;
}

.reader-title {
    font-family: var(--display);
    font-style: italic;
    font-weight: 300;
    font-size: 2.4rem;
    margin: 0.2rem 0 1rem;
    color: var(--midnight-alph);
}

.reader-body {
    font-family: var(--body);
    font-size: 17px;
    line-height: 1.75;
    color: #273957;
    margin: 0;
}

/* ------------------------------------------------------------
   STRATUM IV — Fellows in Residence
   ------------------------------------------------------------ */

#stratum-iv .content { --tilt: 4deg; }

.fellows {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem 2.4rem;
    margin-top: 4rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    transform: rotate(3deg);
    transform-origin: center center;
}

.fellow-card {
    background:
        radial-gradient(ellipse at 30% 30%, var(--vellum-center) 0%, var(--vellum-deep) 100%);
    color: var(--midnight-alph);
    padding: 2rem 1.8rem 2.6rem;
    position: relative;
    clip-path: polygon(3% 2%, 18% 0%, 42% 3%, 68% 1%, 94% 4%, 98% 20%, 97% 48%, 99% 78%, 96% 98%, 74% 100%, 46% 97%, 22% 99%, 3% 96%, 1% 74%, 3% 46%, 1% 20%);
    transform: rotate(-3deg);
    transition: transform 700ms var(--ease-long), box-shadow 700ms ease;
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.45);
}

.fellow-card:nth-child(2) { transform: rotate(2deg) translateY(1.2rem); }
.fellow-card:nth-child(3) { transform: rotate(-1deg) translateY(-1rem); }
.fellow-card:nth-child(4) { transform: rotate(1.4deg) translateY(0.6rem); }
.fellow-card:nth-child(5) { transform: rotate(-2deg) translateY(1.4rem); }
.fellow-card:nth-child(6) { transform: rotate(1deg) translateY(-0.4rem); }

.fellow-card:hover {
    transform: rotate(0deg) translateY(-6px) scale(1.02);
    box-shadow: 0 28px 48px rgba(0, 0, 0, 0.55);
}

.portrait {
    width: 88px;
    height: 110px;
    border-radius: 4px;
    margin-bottom: 1.2rem;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 50% 35%, #8a6c4d 0%, transparent 55%),
        linear-gradient(160deg, #4a3320 0%, #6b5036 100%);
    box-shadow: inset 0 0 20px rgba(42, 30, 15, 0.6);
    filter: sepia(0.5) contrast(0.9);
}

.portrait::before,
.portrait::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 30% 25%, rgba(10, 10, 10, 0.4) 0%, transparent 40%),
        radial-gradient(circle at 70% 45%, rgba(0, 0, 0, 0.3) 0%, transparent 50%);
    mix-blend-mode: multiply;
}

.portrait::after {
    background-image:
        url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="80" height="110"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency="1.6" numOctaves="2"/></filter><rect width="100%" height="100%" filter="url(%23n)" opacity="0.4"/></svg>');
    mix-blend-mode: overlay;
    opacity: 0.55;
}

.portrait-one { background: radial-gradient(ellipse at 45% 30%, #a28361 0%, transparent 55%), linear-gradient(160deg, #3f2a17 0%, #6c4d30 100%); }
.portrait-two { background: radial-gradient(ellipse at 55% 35%, #8c6a48 0%, transparent 55%), linear-gradient(160deg, #2c1d10 0%, #5c3f26 100%); }
.portrait-three { background: radial-gradient(ellipse at 50% 28%, #b08a64 0%, transparent 55%), linear-gradient(160deg, #4b341f 0%, #785a3c 100%); }
.portrait-four { background: radial-gradient(ellipse at 48% 34%, #9a7956 0%, transparent 55%), linear-gradient(160deg, #362311 0%, #5b3f22 100%); }
.portrait-five { background: radial-gradient(ellipse at 52% 32%, #a68365 0%, transparent 55%), linear-gradient(160deg, #42301c 0%, #6e4e34 100%); }
.portrait-six { background: radial-gradient(ellipse at 47% 30%, #b89680 0%, transparent 55%), linear-gradient(160deg, #4e3622 0%, #7e5d3e 100%); }

.fellow-name {
    font-family: var(--display);
    font-style: italic;
    font-weight: 500;
    font-size: 1.6rem;
    margin: 0.2rem 0 1rem;
    color: var(--midnight-alph);
    letter-spacing: -0.01em;
}

.fellow-question {
    font-family: var(--body);
    font-weight: 300;
    font-size: 15px;
    line-height: 1.55;
    color: #2a3b5e;
    margin: 0;
}

.fellow-question em {
    color: var(--sinuous-rill);
    font-style: italic;
}

.marginal {
    display: inline-block;
    font-family: var(--hand);
    color: var(--corrected-teal);
    font-size: 1.1rem;
    margin-top: 0.8rem;
    transform: rotate(-2deg);
    padding-left: 0.5rem;
}

/* ------------------------------------------------------------
   STRATUM V — Current Expeditions
   ------------------------------------------------------------ */

#stratum-v .content { --tilt: -7deg; }

.timeline {
    position: relative;
    max-width: 1100px;
    margin: 4rem auto 0;
    transform: rotate(-5deg);
    transform-origin: center center;
}

.timeline-line {
    position: absolute;
    top: 0;
    left: -5%;
    width: 110%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: visible;
}

.timeline-line .drawpath {
    fill: none;
    stroke: var(--honeyed-dew);
    stroke-width: 1.2;
    stroke-opacity: 0.5;
    stroke-dasharray: 2600;
    stroke-dashoffset: 2600;
    transition: stroke-dashoffset 2600ms var(--ease-long);
}

.stratum.in-view .timeline-line .drawpath {
    stroke-dashoffset: 0;
}

.expeditions {
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.5rem;
}

.exp {
    position: relative;
    padding: 2rem 1.2rem 1.5rem;
    background: rgba(22, 36, 63, 0.55);
    border: 1px solid rgba(232, 201, 122, 0.14);
    transition: transform 600ms var(--ease-long), border-color 400ms ease, background 400ms ease;
}

.exp:nth-child(1) { transform: translateY(100%) rotate(-4deg); }
.exp:nth-child(2) { transform: translateY(70%) rotate(3deg); }
.exp:nth-child(3) { transform: translateY(50%) rotate(-2deg); }
.exp:nth-child(4) { transform: translateY(20%) rotate(4deg); }
.exp:nth-child(5) { transform: translateY(-10%) rotate(-3deg); }

.exp::before {
    content: "";
    position: absolute;
    top: -6px;
    left: 1.2rem;
    width: 10px;
    height: 10px;
    background: var(--honeyed-dew);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(232, 201, 122, 0.6);
}

.exp:hover {
    border-color: var(--honeyed-dew);
    background: rgba(22, 36, 63, 0.8);
    transform: translateY(0) rotate(0deg) scale(1.04);
}

.exp-date {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--honeyed-dew);
    display: block;
    margin-bottom: 0.5rem;
    font-variant: small-caps;
}

.exp-title {
    font-family: var(--display);
    font-style: italic;
    font-weight: 300;
    font-size: 1.5rem;
    line-height: 1.15;
    margin: 0 0 0.8rem;
    color: var(--vellum);
}

.exp-desc {
    font-family: var(--body);
    font-size: 14px;
    line-height: 1.55;
    color: rgba(216, 208, 194, 0.72);
    margin: 0;
}

.exp-desc em { color: var(--corrected-teal); font-style: italic; }

/* ------------------------------------------------------------
   STRATUM VI — Library of Unwritten Books
   ------------------------------------------------------------ */

#stratum-vi .content { --tilt: 6deg; }

.bookshelf {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.6rem;
    padding: 3rem 2rem 4rem;
    margin: 2rem -2rem 0;
    transform: rotate(7deg);
    transform-origin: center center;
    scrollbar-width: thin;
    scrollbar-color: var(--sinuous-rill) transparent;
    scroll-behavior: smooth;
}

.bookshelf::-webkit-scrollbar { height: 8px; }
.bookshelf::-webkit-scrollbar-thumb { background: var(--sinuous-rill); border-radius: 2px; }
.bookshelf::-webkit-scrollbar-track { background: transparent; }

.spine {
    flex: 0 0 auto;
    width: 72px;
    height: 340px;
    padding: 1.2rem 0.6rem;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    background:
        linear-gradient(90deg, rgba(0, 0, 0, 0.3) 0%, transparent 18%, transparent 82%, rgba(0, 0, 0, 0.3) 100%),
        linear-gradient(180deg, #3a2a4f 0%, #2a1f3d 100%);
    border: 1px solid rgba(232, 201, 122, 0.3);
    color: var(--vellum);
    cursor: pointer;
    transition: transform 600ms var(--ease-long), box-shadow 600ms ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-direction: column;
    box-shadow: inset 2px 0 6px rgba(0, 0, 0, 0.3), 0 8px 12px rgba(0, 0, 0, 0.4);
    font-family: var(--display);
    font-size: 0.95rem;
    font-style: italic;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.spine:nth-child(2n) {
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.3) 0%, transparent 18%, transparent 82%, rgba(0, 0, 0, 0.3) 100%), linear-gradient(180deg, #3b2918 0%, #2a1d10 100%);
}
.spine:nth-child(3n) {
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.3) 0%, transparent 18%, transparent 82%, rgba(0, 0, 0, 0.3) 100%), linear-gradient(180deg, #1e3340 0%, #14242f 100%);
    border-color: rgba(74, 143, 138, 0.45);
}
.spine:nth-child(4n) {
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.3) 0%, transparent 18%, transparent 82%, rgba(0, 0, 0, 0.3) 100%), linear-gradient(180deg, #4b2a20 0%, #32180f 100%);
    border-color: rgba(201, 95, 79, 0.4);
}
.spine:nth-child(5n) {
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.3) 0%, transparent 18%, transparent 82%, rgba(0, 0, 0, 0.3) 100%), linear-gradient(180deg, #2a3048 0%, #1a1f30 100%);
}

.spine:nth-child(odd) { transform: rotate(-2deg) translateY(6px); }
.spine:nth-child(even) { transform: rotate(1deg) translateY(-4px); }

.spine:hover {
    transform: rotate(0deg) translateY(-18px) scale(1.06);
    box-shadow: 0 20px 30px rgba(0, 0, 0, 0.6), inset 2px 0 6px rgba(0, 0, 0, 0.3);
    z-index: 3;
}

.spine.open {
    transform: rotate(0deg) scale(1.4) translateY(-20px);
    z-index: 4;
    box-shadow: 0 30px 40px rgba(0, 0, 0, 0.7);
}

.spine-title {
    color: var(--honeyed-dew);
    padding-top: 0.8rem;
}

.spine-author {
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: rgba(216, 208, 194, 0.6);
    font-weight: 400;
    font-style: normal;
    padding-bottom: 0.4rem;
}

/* ------------------------------------------------------------
   STRATUM VII — Field Notes
   ------------------------------------------------------------ */

#stratum-vii .content { --tilt: -5deg; }

.journal {
    max-width: 680px;
    margin: 3rem auto 0;
    padding: 2.5rem 3rem;
    background: rgba(22, 36, 63, 0.3);
    border-left: 1px solid rgba(232, 201, 122, 0.2);
    position: relative;
}

.journal .entry {
    font-family: var(--body);
    font-size: 17px;
    line-height: 1.8;
    color: rgba(216, 208, 194, 0.92);
    margin: 0 0 2rem;
    position: relative;
    padding-right: 1rem;
}

.journal .drop {
    font-family: var(--display);
    font-style: italic;
    font-weight: 500;
    font-size: 2.6rem;
    line-height: 1;
    color: var(--sinuous-rill);
    float: left;
    margin: 0.1rem 0.5rem 0 0;
}

.journal .entry em {
    color: var(--honeyed-dew);
    font-style: italic;
}

.margin-note {
    font-family: var(--hand);
    color: var(--corrected-teal);
    font-size: 1.2rem;
    display: inline-block;
    margin-left: 0.6rem;
    transform: rotate(-2deg);
    padding: 0 0.3rem;
}

/* ------------------------------------------------------------
   STRATUM VIII — Instrument Gallery
   ------------------------------------------------------------ */

#stratum-viii .content { --tilt: 3deg; }

.instruments {
    position: relative;
    height: 640px;
    margin-top: 3rem;
    transform: rotate(2deg);
    transform-origin: center center;
}

.constellation-lines {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.constellation-lines .drawpath {
    fill: none;
    stroke: var(--corrected-teal);
    stroke-width: 0.6;
    stroke-opacity: 0.4;
    stroke-dasharray: 4000;
    stroke-dashoffset: 4000;
    transition: stroke-dashoffset 3200ms var(--ease-long);
}

.stratum.in-view .constellation-lines .drawpath {
    stroke-dashoffset: 0;
}

.instrument {
    position: absolute;
    left: var(--px);
    top: var(--py);
    width: 200px;
    margin: 0;
    text-align: center;
    z-index: 2;
    transition: transform 700ms var(--ease-long);
    cursor: crosshair;
}

.instrument:hover { transform: scale(1.1) rotate(-2deg); }

.instrument svg {
    width: 120px;
    height: 120px;
    display: block;
    margin: 0 auto 0.8rem;
}

.instrument .inkline {
    stroke: var(--vellum);
    stroke-opacity: 0.7;
    stroke-width: 1;
}

.instrument:hover .inkline { stroke: var(--honeyed-dew); }

.instrument figcaption { }

.instrument h4 {
    font-family: var(--display);
    font-style: italic;
    font-weight: 300;
    font-size: 1.2rem;
    margin: 0.3rem 0;
    color: var(--vellum);
}

.instrument p {
    font-family: var(--body);
    font-size: 12px;
    line-height: 1.55;
    color: rgba(216, 208, 194, 0.65);
    max-width: 20ch;
    margin: 0 auto;
}

/* ------------------------------------------------------------
   STRATUM IX — Dispatches
   ------------------------------------------------------------ */

#stratum-ix .content { --tilt: -6deg; }

.dispatches {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    max-width: 1200px;
    margin: 3rem auto 0;
    transform: rotate(-5deg);
    transform-origin: center center;
}

.dispatch {
    padding: 2rem 1.6rem;
    position: relative;
    background: rgba(230, 220, 201, 0.4);
    border-top: 1px solid rgba(42, 59, 94, 0.2);
    border-bottom: 1px solid rgba(42, 59, 94, 0.2);
}

.dispatch:nth-child(1) { transform: rotate(-1.6deg); }
.dispatch:nth-child(2) { transform: rotate(1deg) translateY(1.5rem); }
.dispatch:nth-child(3) { transform: rotate(-0.8deg) translateY(-0.8rem); }

.pull {
    font-family: var(--display);
    font-style: italic;
    font-weight: 300;
    font-size: clamp(1.6rem, 3.2vw, 2.4rem);
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--midnight-alph);
    margin: 0 0 1.2rem;
    border-left: 2px solid var(--sinuous-rill);
    padding-left: 1rem;
}

.pull em {
    color: var(--sinuous-rill);
    font-style: italic;
    font-weight: 500;
}

.dispatch-body {
    font-family: var(--body);
    font-size: 15px;
    line-height: 1.65;
    color: #2a3b5e;
    margin: 0 0 1rem;
}

.dispatch-body em { color: var(--corrected-teal); }

.dispatch-sign {
    font-family: var(--hand);
    color: var(--corrected-teal);
    font-size: 1.2rem;
    margin: 0;
}

/* ------------------------------------------------------------
   STRATUM X — Correspondence
   ------------------------------------------------------------ */

#stratum-x .content { --tilt: 7deg; }

.envelopes {
    list-style: none;
    padding: 0;
    margin: 4rem auto 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 3rem 2rem;
    max-width: 1000px;
    transform: rotate(6deg);
    transform-origin: center center;
}

.envelope {
    position: relative;
    cursor: crosshair;
    perspective: 1200px;
    min-height: 180px;
}

.envelope:nth-child(odd) { transform: rotate(-3deg); }
.envelope:nth-child(even) { transform: rotate(2deg) translateY(1rem); }

.env-face {
    background: var(--vellum-center);
    color: var(--midnight-alph);
    padding: 1.4rem 1.6rem;
    position: relative;
    font-family: var(--body);
    min-height: 180px;
    transition: transform 800ms var(--ease-long), opacity 500ms ease;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
    background-image:
        repeating-linear-gradient(45deg, transparent 0 8px, rgba(201, 95, 79, 0.18) 8px 9px, transparent 9px 18px),
        repeating-linear-gradient(-45deg, transparent 0 8px, rgba(42, 59, 94, 0.12) 8px 9px, transparent 9px 18px),
        radial-gradient(ellipse, var(--vellum-center) 0%, var(--vellum-deep) 100%);
    background-size: 18px 18px, 18px 18px, cover;
}

.env-face::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(42, 59, 94, 0.06), transparent);
    pointer-events: none;
    clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.stamp {
    position: absolute;
    top: 0.7rem;
    right: 0.8rem;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--sinuous-rill);
    font-variant: small-caps;
    border: 1px dashed rgba(201, 95, 79, 0.5);
    padding: 0.2rem 0.4rem;
}

.wax {
    position: absolute;
    bottom: 0.7rem;
    right: 1rem;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 40%, #a84030 0%, #661f18 100%);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.to {
    display: block;
    font-family: var(--display);
    font-style: italic;
    font-weight: 500;
    font-size: 1.3rem;
    margin: 2.2rem 0 0.3rem;
    color: var(--midnight-alph);
}

.from {
    display: block;
    font-family: var(--body);
    font-size: 13px;
    color: var(--corrected-teal);
    font-style: italic;
}

.env-letter {
    background: var(--vellum-center);
    color: var(--midnight-alph);
    padding: 1.8rem 1.8rem 2rem;
    position: absolute;
    inset: 0;
    font-family: var(--hand);
    font-size: 1.15rem;
    line-height: 1.55;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px) rotate(1deg);
    transition: opacity 600ms var(--ease-long), transform 700ms var(--ease-long);
    box-shadow: 0 16px 28px rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.env-letter p {
    margin: 0 0 0.8rem;
    color: #1f2b48;
}

.env-letter .sign {
    font-family: var(--hand);
    color: var(--sinuous-rill);
    font-size: 1.3rem;
    margin-top: 0.8rem;
}

.envelope.open .env-face {
    opacity: 0;
    transform: translateY(-10px);
}

.envelope.open .env-letter {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) rotate(0deg);
}

/* ------------------------------------------------------------
   STRATUM XI — Colophon
   ------------------------------------------------------------ */

#stratum-xi {
    min-height: 100vh;
    justify-content: center;
    align-items: center;
    text-align: center;
}

#stratum-xi .content {
    text-align: center;
    max-width: 620px;
    --tilt: 0deg;
}

.constellation-field {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.constellation-field span {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--honeyed-dew);
    box-shadow: 0 0 8px rgba(232, 201, 122, 0.7);
    animation: starPulse 6s ease-in-out infinite;
}

.colophon-body {
    font-family: var(--body);
    font-style: italic;
    font-weight: 300;
    font-size: 17px;
    line-height: 1.8;
    color: rgba(216, 208, 194, 0.75);
    margin: 0 0 1.2rem;
}

.colophon-small {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--corrected-teal);
    font-variant: small-caps;
    margin: 2rem 0 1.2rem;
}

.colophon-cursor {
    font-family: var(--mono);
    font-size: 1.1rem;
    color: var(--honeyed-dew);
    margin-top: 2rem;
}

.blink {
    display: inline-block;
    animation: blink 1.1s steps(2, end) infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* ------------------------------------------------------------
   link refraction
   ------------------------------------------------------------ */

a {
    color: var(--honeyed-dew);
    text-decoration: none;
    position: relative;
    transition: color 400ms ease, text-shadow 400ms ease;
}

a:hover {
    color: var(--honeyed-dew);
    text-shadow:
        -2px 0 0 rgba(74, 143, 138, 0.8),
        2px 0 0 rgba(201, 95, 79, 0.8);
    animation: refract 500ms var(--ease-long);
}

@keyframes refract {
    0% { text-shadow: 0 0 0 transparent, 0 0 0 transparent; }
    50% { text-shadow: -3px 0 0 rgba(74, 143, 138, 0.9), 3px 0 0 rgba(201, 95, 79, 0.9); }
    100% { text-shadow: -2px 0 0 rgba(74, 143, 138, 0.8), 2px 0 0 rgba(201, 95, 79, 0.8); }
}

/* ------------------------------------------------------------
   responsive
   ------------------------------------------------------------ */

@media (max-width: 960px) {
    .portholes { grid-template-columns: repeat(2, 1fr); }
    .fellows { grid-template-columns: repeat(2, 1fr); }
    .expeditions { grid-template-columns: 1fr; gap: 1rem; }
    .exp:nth-child(n) { transform: none; }
    .dispatches { grid-template-columns: 1fr; }
    .envelopes { grid-template-columns: 1fr; }
    .instruments { height: auto; display: flex; flex-wrap: wrap; gap: 2rem; justify-content: center; }
    .instrument { position: static; width: 180px; }
    .constellation-lines { display: none; }
    .stratum { padding: 5rem 5vw; }
    .timeline { transform: none; }
    .bookshelf { transform: rotate(3deg); }
    .fellows { transform: none; }
    .dispatches { transform: none; }
    .envelopes { transform: none; }
    .portholes { transform: none; }
}

@media (max-width: 600px) {
    .portholes { grid-template-columns: 1fr 1fr; gap: 1.2rem; }
    .fellows { grid-template-columns: 1fr; }
    .wordmark { font-size: 3.2rem; }
    body { font-size: 17px; }
}
