/* ==========================================================================
   footprint.market — a market of journeys
   Retro-expedition cartographic narrative
   ========================================================================== */

/* ---------- Color tokens ---------- */
:root {
    --c-bg:        #F2E6D0; /* Expedition Cream */
    --c-ink:       #2E1E10; /* Cartographer's Ink */
    --c-sienna:    #A0522D; /* Worn Sienna */
    --c-brass:     #C4A35A; /* Compass Brass */
    --c-umber:     #5C3D2E; /* Trail Umber */
    --c-vellum:    #EAD9BF; /* Map Vellum */
    --c-ochre:     #D4943A; /* Sunset Ochre */
    --c-forest:    #3A4A32; /* Forest Dusk */
    --f-display:   "Cormorant Garamond", Georgia, "Times New Roman", serif;
    --f-body:      "Cormorant Garamond", Georgia, "Times New Roman", serif;
    --f-label:     "Josefin Sans", "Helvetica Neue", Arial, sans-serif;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--c-bg);
    color: var(--c-ink);
    font-family: var(--f-body);
    font-weight: 400;
    line-height: 1.85;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

p {
    max-width: 58ch;
    font-size: clamp(1rem, 1.6vw, 1.15rem);
}

em, i {
    font-style: italic;
}

/* ---------- Background contour pattern ---------- */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='400' height='400' viewBox='0 0 400 400'><g fill='none' stroke='%23C4A35A' stroke-width='0.5' opacity='0.1'><path d='M-20,200 Q60,170 140,200 T300,200 T460,200'/><path d='M-20,160 Q60,135 140,160 T300,160 T460,160'/><path d='M-20,240 Q60,215 140,240 T300,240 T460,240'/><path d='M-20,120 Q60,95 140,120 T300,120 T460,120'/><path d='M-20,280 Q60,255 140,280 T300,280 T460,280'/><path d='M-20,80 Q60,55 140,80 T300,80 T460,80'/><path d='M-20,320 Q60,295 140,320 T300,320 T460,320'/></g></svg>");
    background-repeat: repeat;
    opacity: 0.85;
}

/* ---------- Hero ---------- */
.hero {
    position: relative;
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6rem 4vw 4rem;
    z-index: 1;
}

.hero-contour {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='500' height='500' viewBox='0 0 500 500'><g fill='none' stroke='%23C4A35A' stroke-width='0.6' opacity='0.5'><circle cx='250' cy='250' r='40'/><circle cx='250' cy='250' r='80'/><circle cx='250' cy='250' r='130'/><circle cx='250' cy='250' r='180'/><circle cx='250' cy='250' r='230'/><path d='M30,80 Q150,40 270,90 T490,80'/><path d='M20,420 Q140,380 280,430 T490,420'/></g></svg>");
    background-size: 500px 500px;
    background-repeat: repeat;
    opacity: 0.55;
    will-change: background-position;
    z-index: 0;
}

.hero-inner {
    position: relative;
    z-index: 2;
    width: min(960px, 96vw);
    text-align: center;
}

.cartouche {
    position: relative;
    padding: clamp(3rem, 7vw, 6rem) clamp(2rem, 5vw, 5rem);
    margin: 0 auto;
}

.cartouche-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.cartouche-content {
    position: relative;
    z-index: 1;
}

.hero-prelude {
    font-family: var(--f-label);
    font-weight: 300;
    font-size: clamp(0.65rem, 1.2vw, 0.85rem);
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--c-sienna);
    margin-bottom: 2.5rem;
    max-width: none;
}

.hero-title {
    font-family: var(--f-display);
    font-weight: 600;
    font-size: clamp(3.5rem, 10vw, 8rem);
    text-transform: uppercase;
    letter-spacing: 0.5em;
    line-height: 0.95;
    color: var(--c-ink);
    opacity: 0;
    margin: 0 0 1.5rem;
    transition: opacity 2s cubic-bezier(0.22, 1, 0.36, 1),
                letter-spacing 2s cubic-bezier(0.22, 1, 0.36, 1);
}

.hero-title.is-settled {
    opacity: 1;
    letter-spacing: 0.15em;
}

.hero-subtitle {
    font-family: var(--f-display);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.1rem, 2.4vw, 1.7rem);
    color: var(--c-umber);
    letter-spacing: 0.04em;
    margin: 0 auto 2rem;
    max-width: none;
}

.hero-rule {
    width: 80px;
    height: 1px;
    background: var(--c-sienna);
    margin: 1.5rem auto;
    opacity: 0.6;
    position: relative;
}
.hero-rule::before,
.hero-rule::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 6px;
    height: 6px;
    background: var(--c-brass);
    border: 1px solid var(--c-sienna);
    border-radius: 50%;
    transform: translateY(-50%);
}
.hero-rule::before { left: -10px; }
.hero-rule::after  { right: -10px; }

.hero-coords {
    font-family: var(--f-label);
    font-weight: 300;
    font-size: clamp(0.65rem, 1.1vw, 0.78rem);
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--c-brass);
    margin: 0 auto;
    max-width: none;
}

.hero-descend {
    font-family: var(--f-label);
    font-weight: 300;
    font-size: 0.72rem;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--c-sienna);
    margin-top: 4rem;
    opacity: 0.7;
    max-width: none;
    animation: descend 2.4s ease-in-out infinite;
}

@keyframes descend {
    0%, 100% { transform: translateY(0); opacity: 0.55; }
    50%      { transform: translateY(6px); opacity: 0.9; }
}

/* ---------- Stipple divider ---------- */
.stipple-divider {
    height: 16px;
    width: 100%;
    background-image: radial-gradient(circle, rgba(160,82,45,0.45) 1.2px, transparent 1.4px),
                      radial-gradient(circle, rgba(160,82,45,0.30) 1px, transparent 1.2px);
    background-size: 14px 14px, 22px 22px;
    background-position: 0 0, 7px 7px;
    opacity: 0.85;
    margin: 0;
    position: relative;
    z-index: 1;
}

/* ---------- Chapter shared ---------- */
.chapter {
    position: relative;
    z-index: 1;
    padding: 8vh 5vw;
    min-height: 85vh;
    margin: 5vh 0;
}

.chapter-mark {
    display: flex;
    align-items: baseline;
    gap: 1.2rem;
    font-family: var(--f-label);
    font-weight: 300;
    font-size: 0.78rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--c-sienna);
    margin-bottom: 1.4rem;
}

.chapter-mark.center {
    justify-content: center;
}

.chapter-mark.light {
    color: var(--c-vellum);
}

.chapter-numeral {
    font-family: var(--f-display);
    font-style: italic;
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--c-brass);
    letter-spacing: 0.04em;
}

.chapter-mark.light .chapter-numeral {
    color: var(--c-ochre);
}

.chapter-name {
    color: inherit;
}

.chapter-title {
    font-family: var(--f-display);
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1.5rem, 3vw, 2.4rem);
    letter-spacing: 0.06em;
    color: var(--c-ink);
    margin-bottom: 4rem;
    max-width: 32ch;
    line-height: 1.25;
}

.chapter-title.light {
    color: var(--c-vellum);
}

/* ---------- Chapter I: The Map Room ---------- */
.chapter-one {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.map-area {
    position: relative;
    width: min(80vw, 1100px);
    margin: 0 auto;
    min-height: 60vh;
    background: var(--c-vellum);
    padding: clamp(3rem, 6vw, 5rem) clamp(2.5rem, 5vw, 4.5rem);
    border: 1px solid rgba(160,82,45,0.25);
    box-shadow:
        inset 0 0 80px rgba(46,30,16,0.06),
        0 18px 40px rgba(46,30,16,0.12);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='400' height='400' viewBox='0 0 400 400'><g fill='none' stroke='%23A0522D' stroke-width='0.4' opacity='0.18'><path d='M0,200 Q80,180 160,205 T320,200 T480,200'/><path d='M0,170 Q80,150 160,175 T320,170 T480,170'/><path d='M0,230 Q80,215 160,240 T320,230 T480,230'/><path d='M0,140 Q80,120 160,148 T320,140 T480,140'/><path d='M0,260 Q80,245 160,272 T320,260 T480,260'/></g></svg>");
    transform: scale(0.92) perspective(800px) rotateX(3deg);
    opacity: 0;
    transition: transform 1.4s cubic-bezier(0.22, 1, 0.36, 1),
                opacity 1.4s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform, opacity;
}

.map-area.is-unfolded {
    transform: scale(1) perspective(800px) rotateX(0deg);
    opacity: 1;
}

.map-pin {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--c-brass);
    border: 2px solid var(--c-sienna);
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(46,30,16,0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.map-pin-tl { top: -6px;    left: -6px; }
.map-pin-tr { top: -6px;    right: -6px; }
.map-pin-bl { bottom: -6px; left: -6px; }
.map-pin-br { bottom: -6px; right: -6px; }

.map-pin:hover {
    transform: scale(1.3);
    box-shadow: 0 0 8px rgba(196,163,90,0.7);
}

.map-fold {
    position: absolute;
    top: 4%;
    bottom: 4%;
    left: 50%;
    width: 0;
    border-left: 1px dashed var(--c-sienna);
    opacity: 0.4;
    transform: translateX(-0.5px);
}

.map-columns {
    display: flex;
    gap: 4vw;
    justify-content: space-between;
}

.map-column {
    flex: 0 0 38%;
    width: 38%;
}

.map-column p {
    font-family: var(--f-display);
    font-style: italic;
    font-weight: 400;
    color: var(--c-ink);
    margin-bottom: 1.4em;
    line-height: 1.85;
    max-width: none;
}

/* ---------- Chapter II: The Specimen Case ---------- */
.chapter-two {
    position: relative;
    padding-top: 8vh;
    padding-bottom: 8vh;
}

.chapter-shelf {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 8vh;
    height: 40vh;
    background: var(--c-umber);
    background-image:
        linear-gradient(180deg, rgba(46,30,16,0.0) 0%, rgba(46,30,16,0.25) 100%),
        repeating-linear-gradient(90deg, rgba(196,163,90,0.05) 0 6px, transparent 6px 18px);
    z-index: 0;
}

.chapter-two .chapter-mark,
.chapter-two .chapter-title {
    position: relative;
    z-index: 2;
}

.specimen-row {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: center;
    gap: 3vw;
    flex-wrap: wrap;
    margin-top: 6vh;
}

.specimen-card {
    position: relative;
    width: 28vw;
    min-width: 260px;
    max-width: 420px;
    height: 50vh;
    min-height: 380px;
    background: var(--c-bg);
    border: 4px solid var(--c-brass);
    box-shadow:
        0 12px 28px rgba(46,30,16,0.35),
        inset 0 0 30px rgba(46,30,16,0.15);
    display: flex;
    flex-direction: column;
    transition: transform 0.35s ease,
                box-shadow 0.35s ease,
                border-color 0.35s ease;
}

.specimen-card .pin-card {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
}

.specimen-card:hover {
    transform: translateY(-6px);
    box-shadow:
        0 16px 40px rgba(46,30,16,0.4),
        inset 0 0 30px rgba(46,30,16,0.15);
    border-color: var(--c-sienna);
}

.specimen-card:hover .pin-card {
    transform: translateX(-50%) scale(1.3);
    box-shadow: 0 0 8px rgba(196,163,90,0.7);
}

.specimen-photo {
    position: relative;
    flex: 0 0 60%;
    overflow: hidden;
    background: var(--c-vellum);
    filter: sepia(18%) saturate(75%) contrast(110%) brightness(98%);
}

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

.specimen-photo::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><g stroke='%232E1E10' stroke-width='1' opacity='0.18'><line x1='0' y1='12' x2='12' y2='0'/><line x1='-6' y1='6' x2='6' y2='-6'/><line x1='6' y1='18' x2='18' y2='6'/></g></svg>");
    opacity: 0.35;
}

.specimen-label {
    flex: 1 1 auto;
    background: var(--c-bg);
    padding: 1.2rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    text-align: center;
    border-top: 1px solid rgba(46,30,16,0.15);
    opacity: 0.7;
    transition: opacity 0.35s ease;
}

.specimen-card:hover .specimen-label {
    opacity: 1;
}

.label-cat,
.label-meta {
    font-family: var(--f-label);
    font-weight: 300;
    font-size: 0.7rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--c-sienna);
}

.label-name {
    font-family: var(--f-display);
    font-style: italic;
    font-weight: 600;
    font-size: 1.15rem;
    color: var(--c-ink);
    letter-spacing: 0.04em;
}

/* ---------- Chapter III: The Field Notebook ---------- */
.chapter-three {
    padding-left: 10vw;
    padding-right: 5vw;
}

.notebook {
    position: relative;
    max-width: 50vw;
    min-width: 320px;
    margin: 0 auto;
    padding-left: 2rem;
}

.notebook-rule {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    border-left: 1px solid rgba(196,163,90,0.4);
}

.notebook-entry {
    position: relative;
    margin-bottom: 4rem;
    padding-left: 0;
}

.margin-note {
    position: absolute;
    left: -10vw;
    top: 0.4rem;
    width: 8vw;
    min-width: 110px;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-family: var(--f-label);
    font-weight: 300;
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--c-brass);
    text-align: right;
}

.notebook-prose {
    font-family: var(--f-display);
    font-weight: 400;
    font-size: 1.15rem;
    line-height: 2.0;
    color: var(--c-ink);
    max-width: 56ch;
}

/* ---------- Chapter IV: The Archive ---------- */
.chapter-four {
    position: relative;
    padding: 0;
    margin: 5vh 0 0;
    width: 100%;
    height: 70vh;
    min-height: 600px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.archive-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    filter: sepia(18%) saturate(75%) contrast(110%) brightness(98%);
}

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

.archive-image::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><g stroke='%232E1E10' stroke-width='1' opacity='0.16'><line x1='0' y1='12' x2='12' y2='0'/><line x1='-6' y1='6' x2='6' y2='-6'/><line x1='6' y1='18' x2='18' y2='6'/></g></svg>");
    opacity: 0.4;
    pointer-events: none;
}

.archive-overlay {
    position: relative;
    z-index: 2;
    background: rgba(242, 230, 208, 0.88);
    max-width: 54ch;
    padding: 4rem 4rem;
    text-align: center;
    border: 1px solid rgba(160,82,45,0.3);
    box-shadow: 0 18px 60px rgba(46,30,16,0.45);
    clip-path: polygon(
        2% 0%, 6% 1%, 12% 0%, 20% 2%, 28% 0%, 36% 1%, 44% 0%, 52% 2%,
        60% 0%, 68% 1%, 76% 0%, 84% 2%, 92% 0%, 98% 1%, 100% 4%,
        99% 12%, 100% 22%, 98% 30%, 100% 40%, 99% 52%, 100% 64%,
        98% 76%, 100% 86%, 99% 96%,
        96% 100%, 88% 99%, 80% 100%, 72% 98%, 64% 100%, 56% 99%, 48% 100%,
        40% 98%, 32% 100%, 24% 99%, 16% 100%, 8% 98%, 2% 100%,
        0% 96%, 1% 88%, 0% 76%, 2% 64%, 0% 52%, 1% 40%, 0% 28%,
        2% 16%, 0% 6%
    );
}

.archive-title {
    font-family: var(--f-display);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    letter-spacing: 0.06em;
    color: var(--c-ink);
    margin: 1rem 0 1.6rem;
    line-height: 1.25;
}

.archive-prose {
    font-family: var(--f-display);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.4vw, 1.05rem);
    line-height: 1.85;
    color: var(--c-ink);
    margin: 0 auto 1.2rem;
    max-width: none;
}

.archive-seal {
    margin-top: 2.4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}

.archive-seal svg {
    width: 64px;
    height: 64px;
    opacity: 0.85;
}

.archive-mark {
    font-family: var(--f-label);
    font-weight: 300;
    font-size: 0.7rem;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--c-sienna);
}

/* ---------- Compass rose (fixed) ---------- */
.compass-rose {
    position: fixed;
    left: 24px;
    bottom: 24px;
    width: 56px;
    height: 56px;
    z-index: 50;
    opacity: 0.4;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.compass-rose svg {
    width: 100%;
    height: 100%;
    transform: rotate(0deg);
    transition: transform 0.08s linear;
    will-change: transform;
}

.compass-rose .compass-bg {
    transition: fill-opacity 0.6s ease;
    fill: rgba(212, 148, 58, 0);
}

.compass-rose.is-complete .compass-bg {
    fill: rgba(212, 148, 58, 0.2);
}

.compass-rose:hover {
    opacity: 0.85;
}

/* ---------- Reveal animations ---------- */
.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1.0s ease-out, transform 1.0s ease-out;
    will-change: opacity, transform;
}

.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger via inline data-delay applied in JS through transition-delay */
.reveal[data-delay] {
    transition-delay: calc(var(--delay, 0) * 1ms);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .map-columns {
        flex-direction: column;
        gap: 2rem;
    }
    .map-column {
        flex: 1 1 100%;
        width: 100%;
    }
    .map-fold {
        display: none;
    }
    .specimen-row {
        flex-direction: column;
        align-items: center;
    }
    .specimen-card {
        width: 80vw;
        max-width: 480px;
    }
    .chapter-shelf {
        height: 60%;
        bottom: 0;
    }
    .chapter-three {
        padding-left: 5vw;
    }
    .notebook {
        max-width: 90vw;
        padding-left: 0;
    }
    .margin-note {
        position: static;
        flex-direction: row;
        gap: 1rem;
        margin-bottom: 0.6rem;
        text-align: left;
        width: auto;
    }
    .archive-overlay {
        padding: 2.5rem 2rem;
        max-width: 92vw;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .hero-contour {
        background-position: 0 0 !important;
    }
}
