/* ===========================================================
   adhoc.quest -- Erigeron adhocensis, the Quest-daisy
   A Victorian naturalist's pocket atlas in isometric projection.
   =========================================================== */

:root {
    /* Muted-vintage herbarium palette */
    --paper-linen: #e8dfc9;
    --paper-shadow: #c9bfa3;
    --paper-pale: #d4c8ac;
    --ink-faded: #3d3a2e;
    --ink-sepia: #6b4a2a;
    --botanical-sage: #8a9775;
    --botanical-moss: #5d6b4e;
    --bloom-madder: #a5545a;
    --bloom-ochre: #c49b52;
    --brass-patina: #7a6a4f;
    --stain-tea: #bca078;

    /* Isometric transform for the diorama */
    --iso-rotate: rotateX(55deg) rotateZ(-45deg);

    /* Driven by JS */
    --zoom-t: 0;
    --zoom-scale: 1;
    --zoom-rot: 0deg;
    --mx-norm: 0;
    --my-norm: 0;
    --scroll-y: 0;
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    background: var(--paper-linen);
    color: var(--ink-faded);
    font-family: "Fraunces", "Lora", Georgia, serif;
    font-size: 17px;
    font-weight: 380;
    font-variation-settings: "opsz" 14, "SOFT" 60;
    line-height: 1.55;
    cursor: none; /* lens replaces cursor */
    position: relative;
}

.foxing-defs { position: absolute; width: 0; height: 0; }

/* ===========================================================
   The Diorama -- single-scene isometric stage
   =========================================================== */
.diorama {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    perspective: 2400px;
    transform-style: preserve-3d;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(188,160,120,0.08), transparent 50%),
        radial-gradient(ellipse at 75% 70%, rgba(122,106,79,0.06), transparent 60%),
        var(--paper-linen);
}

.plane {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    transform-origin: 50% 50%;
    transform:
        translate3d(0, 0, var(--plane-z, 0))
        var(--iso-rotate)
        scale(var(--zoom-scale))
        rotateZ(var(--zoom-rot));
    transition: none;
    will-change: transform;
}

.plane-foundation { --plane-z: 0px; }
.plane-specimen   { --plane-z: 40px; }
.plane-annotation { --plane-z: 80px; }
.plane-ribbon     { --plane-z: 140px; }
.plane-particulate { --plane-z: 220px; }

/* ===========================================================
   Foundation plane: the linen table surface
   =========================================================== */
.ruled-paper {
    position: absolute;
    inset: -20%;
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='24'><line x1='0' y1='23.5' x2='100' y2='23.5' stroke='%23d4c8ac' stroke-width='0.5' opacity='0.3'/></svg>");
    background-repeat: repeat;
    pointer-events: none;
    opacity: 0.55;
}

.foxing-overlay {
    position: absolute;
    inset: -10%;
    filter: url(#foxing);
    opacity: 0.55;
    pointer-events: none;
    mix-blend-mode: multiply;
    background: var(--paper-linen);
}

.coffee-ring {
    position: absolute;
    top: var(--top);
    left: var(--left);
    width: var(--size);
    height: var(--size);
    border: 1.5px solid rgba(122, 76, 38, 0.18);
    border-radius: 50%;
    box-shadow:
        inset 0 0 0 4px rgba(122, 76, 38, 0.04),
        inset 0 0 26px rgba(188, 160, 120, 0.18);
    pointer-events: none;
    transform: rotate(7deg);
}
.coffee-ring.small {
    border-width: 1px;
    opacity: 0.7;
}

.corner-fox {
    position: absolute;
    width: 220px;
    height: 220px;
    pointer-events: none;
    background: radial-gradient(ellipse at center, rgba(188,160,120,0.4), transparent 60%);
    filter: url(#foxing);
    opacity: 0.5;
    mix-blend-mode: multiply;
}
.corner-fox.tl { top: -40px; left: -40px; }
.corner-fox.tr { top: -40px; right: -40px; }
.corner-fox.bl { bottom: -40px; left: -40px; }
.corner-fox.br { bottom: -40px; right: -40px; }

/* ===========================================================
   Specimen plane: the Quest-daisy
   =========================================================== */
.specimen {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 540px;
    height: clamp(540px, 76vh, 820px);
    transform: translate(-50%, -50%);
    overflow: visible;
    filter: drop-shadow(0 6px 0 rgba(61, 58, 46, 0.06));
}

.specimen text.leaf-num {
    font-family: "Caveat", "Bradley Hand", cursive;
    font-size: 18px;
    fill: var(--ink-sepia);
    font-style: italic;
}

.engrave path,
.engrave line,
.engrave ellipse,
.engrave circle {
    vector-effect: non-scaling-stroke;
}

/* exploded layer floats */
.specimen-stem,
.specimen-roots,
.specimen-leaf,
.specimen-bloom,
.specimen-bud {
    transform-box: fill-box;
    transform-origin: center;
    animation: float-sine var(--period, 12s) ease-in-out infinite;
    animation-delay: calc(var(--phase, 0) * -1s);
}

.specimen-stem    { --period: 11s; }
.specimen-roots   { --period: 14s; animation-name: float-sine-deep; }
.specimen-bloom   { --period: 9s; }
.specimen-bud     { --period: 12s; }
.leaf-left-upper  { --period: 13s; }
.leaf-right-upper { --period: 15s; }
.leaf-left-mid    { --period: 17s; }
.leaf-right-mid   { --period: 19s; }

@keyframes float-sine {
    0%, 100% { transform: translate3d(0, 0, 0); }
    25%      { transform: translate3d(2px, -4px, 12px); }
    50%      { transform: translate3d(0, -2px, 0); }
    75%      { transform: translate3d(-2px, -4px, 12px); }
}
@keyframes float-sine-deep {
    0%, 100% { transform: translate3d(0, 0, 0); }
    50%      { transform: translate3d(0, 2px, -8px); }
}

/* specimen label cartouche */
.specimen-label {
    position: absolute;
    top: 78%;
    left: 56%;
    padding: 14px 22px 16px;
    background: var(--paper-linen);
    border: 1px solid var(--ink-faded);
    box-shadow:
        2px 2px 0 var(--paper-shadow),
        4px 4px 0 var(--ink-faded);
    transform: rotate(-2deg) translate3d(0, 0, 30px);
    text-align: center;
    min-width: 260px;
    animation: float-sine 21s ease-in-out infinite;
}
.label-genus {
    display: block;
    font-family: "Alfa Slab One", "Lora", serif;
    font-size: 1.6rem;
    letter-spacing: 0.08em;
    color: var(--ink-faded);
    font-style: oblique 6deg;
}
.label-species {
    display: block;
    font-family: "Alfa Slab One", "Lora", serif;
    font-size: 1.4rem;
    letter-spacing: 0.08em;
    color: var(--ink-faded);
    font-style: oblique 6deg;
    margin-top: -2px;
}
.label-meta {
    display: block;
    font-family: "Caveat", cursive;
    font-size: 1.05rem;
    color: var(--ink-sepia);
    margin-top: 6px;
    font-style: italic;
}

/* ===========================================================
   Annotation plane: index cards, brass pins, butterfly wing
   =========================================================== */
.index-card {
    position: absolute;
    width: 240px;
    padding: 16px 18px 22px;
    background: var(--paper-linen);
    background-image:
        repeating-linear-gradient(0deg, transparent 0 22px, rgba(212, 200, 172, 0.5) 22px 23px);
    border: 1px solid rgba(61, 58, 46, 0.6);
    box-shadow:
        1px 1px 0 var(--paper-shadow),
        3px 3px 0 rgba(61, 58, 46, 0.15),
        6px 6px 14px rgba(61, 58, 46, 0.1);
    color: var(--ink-sepia);
    font-family: "Caveat", "Bradley Hand", cursive;
    font-size: 1.1rem;
    line-height: 1.35;
    transform-style: preserve-3d;
    will-change: transform;
    transition: box-shadow 240ms ease;
}
.index-card.card-1 { top: 14%; left: 6%; transform: rotate(-3deg) translateZ(20px); }
.index-card.card-2 { top: 62%; left: 10%; transform: rotate(2.5deg) translateZ(18px); }
.index-card.card-3 { top: 16%; right: 6%; transform: rotate(2deg) translateZ(22px); width: 260px; }
.index-card.card-4 { top: 58%; right: 8%; transform: rotate(-2.5deg) translateZ(16px); }

.index-card:hover {
    box-shadow:
        1px 1px 0 var(--paper-shadow),
        3px 3px 0 rgba(61, 58, 46, 0.2),
        10px 10px 22px rgba(61, 58, 46, 0.16);
}

.card-eyebrow {
    font-family: "Alfa Slab One", "Lora", serif;
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    color: var(--ink-faded);
    font-weight: 400;
    text-transform: uppercase;
    margin-bottom: 6px;
    font-style: oblique 4deg;
}
.card-body {
    color: var(--ink-sepia);
    font-family: "Caveat", cursive;
    font-size: 1.18rem;
}
.card-body em {
    font-family: "Fraunces", serif;
    font-style: italic;
    color: var(--ink-faded);
    font-size: 0.92em;
    font-variation-settings: "opsz" 14, "SOFT" 80;
}
.card-sign {
    display: block;
    margin-top: 10px;
    text-align: right;
    font-style: italic;
    font-size: 0.95rem;
    color: var(--brass-patina);
}
.card-counter {
    display: block;
    margin-top: 10px;
    text-align: right;
    font-family: "Alfa Slab One", serif;
    font-size: 0.95rem;
    color: var(--ink-faded);
    letter-spacing: 0.06em;
}

/* brass insect pin head */
.brass-pin {
    position: absolute;
    top: -8px;
    left: 24px;
    width: 14px;
    height: 14px;
    background: radial-gradient(circle at 30% 30%, #b8a370, #7a6a4f 60%, #4a3f2c 100%);
    border-radius: 50%;
    box-shadow:
        0 1px 0 rgba(61, 58, 46, 0.5),
        0 6px 6px rgba(61, 58, 46, 0.3),
        inset 0 -1px 2px rgba(0, 0, 0, 0.3);
    transform: translateZ(8px);
}
.brass-pin::after {
    content: "";
    position: absolute;
    top: 12px;
    left: 6px;
    width: 1.5px;
    height: 18px;
    background: linear-gradient(180deg, var(--brass-patina), rgba(122, 106, 79, 0.4));
    transform: translateZ(-4px);
}

/* butterfly wing */
.butterfly-wing {
    position: absolute;
    bottom: 8%;
    left: 14%;
    width: 220px;
    transform: rotate(-12deg) translateZ(8px);
    opacity: 0.7;
}
.butterfly-wing svg { width: 100%; height: auto; }
.wing-label {
    position: absolute;
    bottom: -4px;
    right: 18px;
    font-family: "Caveat", cursive;
    color: var(--ink-sepia);
    font-style: italic;
    font-size: 0.9rem;
}

/* corner bookmarks */
.corner-bookmark {
    position: absolute;
    width: 80px;
    height: 80px;
    opacity: 0.7;
}
.corner-bookmark.corner-tl { top: 8px; left: 8px; transform: translateZ(4px); }
.corner-bookmark.corner-br { bottom: 8px; right: 8px; transform: translateZ(4px) rotate(180deg); }

/* ===========================================================
   Ribbon plane: navigation banner, wordmark, zoom indicator
   =========================================================== */
.ribbon {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 110px;
    pointer-events: none;
}
.ribbon-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 4px 0 rgba(61, 58, 46, 0.18));
}
.ribbon-nav {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 48px;
    padding: 8px 40px 0;
    pointer-events: auto;
}
.ribbon-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: "Alfa Slab One", "Lora", serif;
    font-size: 0.95rem;
    letter-spacing: 0.1em;
    color: var(--paper-linen);
    text-decoration: none;
    text-transform: uppercase;
    text-shadow: 1px 1px 0 rgba(61, 58, 46, 0.4);
    transition: transform 200ms ease;
}
.ribbon-link:hover { transform: translateY(-2px); }
.pin-glyph {
    width: 10px;
    height: 10px;
    background: radial-gradient(circle at 30% 30%, #d8c794, var(--brass-patina) 70%);
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 2px 0 rgba(61, 58, 46, 0.4);
}

/* The wordmark -- pressed-into-paper botanical title */
.wordmark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateZ(60px);
    font-family: "Bagel Fat One", "Lora", serif;
    font-weight: 400;
    font-size: clamp(3.8rem, 8vw, 8rem);
    letter-spacing: -0.04em;
    color: var(--ink-faded);
    text-align: center;
    line-height: 0.9;
    pointer-events: none;
    text-shadow:
        1px 1px 0 var(--paper-shadow),
        2px 2px 0 rgba(61, 58, 46, 0.08);
    mix-blend-mode: multiply;
    opacity: 0.92;
}
.wordmark-prefix,
.wordmark-suffix,
.wordmark-dot {
    display: inline-block;
}
.wordmark-dot {
    color: var(--bloom-madder);
    transform: translateY(-0.05em);
}
.wordmark-binomial {
    display: block;
    font-family: "Alfa Slab One", serif;
    font-size: 1.05rem;
    letter-spacing: 0.16em;
    color: var(--ink-faded);
    margin-top: 18px;
    font-style: oblique 6deg;
    text-shadow: none;
    mix-blend-mode: normal;
    opacity: 0.85;
}
.wordmark-binomial em {
    font-family: "Fraunces", serif;
    font-style: italic;
    color: var(--ink-sepia);
    font-variation-settings: "opsz" 14, "SOFT" 60;
}

.zoom-indicator {
    position: absolute;
    bottom: 28px;
    left: 50%;
    transform: translate(-50%, 0) translateZ(40px);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: "Caveat", cursive;
    font-size: 1.1rem;
    color: var(--ink-sepia);
    font-style: italic;
    pointer-events: none;
}
.zoom-arrow {
    font-family: serif;
    font-size: 1.4rem;
    color: var(--brass-patina);
    animation: zoom-pulse 3s ease-in-out infinite;
}
@keyframes zoom-pulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50%      { transform: scale(1.15); opacity: 1; }
}

/* ===========================================================
   Particulate plane: pollen specks
   =========================================================== */
.mote {
    position: absolute;
    top: var(--my);
    left: var(--mx);
    width: var(--size, 4px);
    height: var(--size, 4px);
    background: var(--hue, var(--bloom-ochre));
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(196, 155, 82, 0.3);
    opacity: 0.65;
    animation: mote-drift var(--period, 12s) ease-in-out infinite;
    animation-delay: calc(var(--phase, 0) * -1s);
    will-change: transform;
}
@keyframes mote-drift {
    0%   { transform: translate3d(0, 0, 0); }
    25%  { transform: translate3d(14px, -22px, 24px); }
    50%  { transform: translate3d(-8px, -34px, 12px); }
    75%  { transform: translate3d(-18px, -16px, 28px); }
    100% { transform: translate3d(0, 0, 0); }
}

/* ===========================================================
   Marginalia gutters
   =========================================================== */
.marginalia {
    position: absolute;
    top: 28%;
    width: 140px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-family: "Caveat", cursive;
    color: var(--ink-sepia);
    font-style: italic;
    font-size: 1.05rem;
    pointer-events: none;
    transform: translateZ(60px);
}
.margin-left  { left: 2.5%; transform: translateZ(60px) rotate(-2deg); }
.margin-right { right: 2.5%; text-align: right; transform: translateZ(60px) rotate(2deg); }
.margin-line {
    display: block;
    border-bottom: 0.5px dashed rgba(122, 76, 38, 0.25);
    padding-bottom: 2px;
}
.margin-line em {
    font-family: "Fraunces", serif;
    font-variation-settings: "opsz" 14, "SOFT" 60;
}

/* ===========================================================
   Fiddlehead loader (replaces spinner)
   =========================================================== */
.fiddlehead {
    position: fixed;
    bottom: 24px;
    left: 24px;
    width: 60px;
    height: 60px;
    pointer-events: none;
    z-index: 50;
    opacity: 0.55;
    animation: fiddle-unfurl 6s ease-in-out infinite;
}
.fiddlehead svg { width: 100%; height: 100%; }
@keyframes fiddle-unfurl {
    0%, 100% { transform: rotate(0deg) scale(0.95); }
    50%      { transform: rotate(20deg) scale(1.05); }
}

/* ===========================================================
   Magnifying lens (cursor replacement, follows with lag)
   =========================================================== */
.lens {
    position: fixed;
    top: 0;
    left: 0;
    width: 140px;
    height: 140px;
    pointer-events: none;
    z-index: 100;
    transform: translate(-50%, -50%);
    will-change: transform;
}
.lens-glass {
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    overflow: hidden;
    background:
        radial-gradient(circle at 35% 30%, rgba(232, 223, 201, 0.25), rgba(232, 223, 201, 0.08) 60%, rgba(61, 58, 46, 0.05) 100%);
    box-shadow:
        inset 0 0 22px rgba(232, 223, 201, 0.4),
        inset 0 0 40px rgba(122, 76, 38, 0.15);
    backdrop-filter: blur(0.4px) saturate(1.05);
}
.lens-rim {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 6px solid var(--brass-patina);
    box-shadow:
        0 0 0 1px var(--ink-faded),
        inset 0 0 0 1px rgba(61, 58, 46, 0.6),
        0 8px 22px rgba(61, 58, 46, 0.3),
        inset 0 0 12px rgba(184, 163, 112, 0.4);
    background:
        conic-gradient(from 0deg,
            #8a7858 0deg, #b8a370 60deg, #6a5a40 120deg,
            #a89464 180deg, #7a6a4f 240deg, #b8a370 300deg, #8a7858 360deg);
    background-clip: border-box;
    -webkit-mask: radial-gradient(circle, transparent 56%, black 57%);
            mask: radial-gradient(circle, transparent 56%, black 57%);
}
.lens-handle {
    position: absolute;
    bottom: -52px;
    right: 6px;
    width: 14px;
    height: 60px;
    background: linear-gradient(180deg, var(--brass-patina), #4a3f2c);
    border-radius: 6px;
    transform: rotate(-30deg);
    transform-origin: top center;
    box-shadow: 0 4px 10px rgba(61, 58, 46, 0.4);
    border: 1px solid rgba(61, 58, 46, 0.5);
}

/* ===========================================================
   Pin-here glyph (CTA replacement)
   =========================================================== */
.pin-here {
    position: absolute;
    bottom: 14%;
    right: 18%;
    pointer-events: auto;
    z-index: 20;
    transform: translateZ(50px) rotate(-8deg);
    cursor: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.pin-here-shaft {
    width: 2px;
    height: 36px;
    background: linear-gradient(180deg, var(--brass-patina), rgba(122, 106, 79, 0.4));
    border-radius: 1px;
    box-shadow: 1px 0 0 rgba(61, 58, 46, 0.3);
}
.pin-here-head {
    position: absolute;
    top: -10px;
    width: 18px;
    height: 18px;
    background:
        radial-gradient(circle at 30% 30%, #c46068, var(--bloom-madder) 60%, #6e2a2e 100%);
    border-radius: 50%;
    box-shadow:
        0 2px 0 rgba(61, 58, 46, 0.4),
        0 8px 12px rgba(61, 58, 46, 0.3),
        inset -1px -2px 4px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(61, 58, 46, 0.4);
}
.pin-here-label {
    margin-top: 12px;
    font-family: "Caveat", cursive;
    font-style: italic;
    font-size: 1.05rem;
    color: var(--ink-sepia);
    white-space: nowrap;
    background: rgba(232, 223, 201, 0.6);
    padding: 2px 8px;
    border-radius: 2px;
}

/* ===========================================================
   Reduced motion preferences are deliberately ignored per spec.
   The paper is the paper.
   =========================================================== */
