/* slave.quest - navy-metallic field guide */
/* Palette: #0c1424 #152339 #1f2d4a #3a4a64 #c8cdd6 #9aa3b3 #a89466 #e7eaf0 */

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

:root {
    --navy-deep: #0c1424;
    --navy-felt: #152339;
    --navy-ink: #1f2d4a;
    --steel-rivet: #3a4a64;
    --pewter: #c8cdd6;
    --pewter-shadow: #9aa3b3;
    --brass: #a89466;
    --glass-highlight: #e7eaf0;
    --elastic: cubic-bezier(0.34, 1.56, 0.64, 1);
    --column-max: 720px;
}

html {
    background: var(--navy-deep);
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--navy-deep);
    color: var(--pewter);
    font-family: 'Libre Baskerville', Georgia, 'Times New Roman', serif;
    font-size: 16px;
    line-height: 1.62;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

::selection {
    background: var(--brass);
    color: var(--navy-deep);
}

/* Noise texture overlay */
.noise-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.04;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='64' height='64'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.4' numOctaves='2' seed='5'/><feColorMatrix values='0 0 0 0 0.78  0 0 0 0 0.80  0 0 0 0 0.84  0 0 0 0.6 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* Ambient drifting glass slab behind the column */
.ambient-slab {
    position: fixed;
    top: 18vh;
    left: 50%;
    width: 880px;
    height: 620px;
    transform: translate(-50%, 0) rotate(-7deg);
    background: linear-gradient(135deg, rgba(231, 234, 240, 0.05) 0%, rgba(231, 234, 240, 0.015) 100%);
    border: 1px solid rgba(196, 204, 222, 0.08);
    border-radius: 18px;
    box-shadow: 0 24px 80px rgba(8, 12, 22, 0.55);
    pointer-events: none;
    z-index: 0;
    animation: ambientDrift 300s linear infinite;
    filter: blur(0.4px);
}

@keyframes ambientDrift {
    0%   { transform: translate(-50%, 0) rotate(-7deg); }
    25%  { transform: translate(calc(-50% + 90px), 30px) rotate(-6.2deg); }
    50%  { transform: translate(calc(-50% + 45px), 60px) rotate(-7.6deg); }
    75%  { transform: translate(calc(-50% - 45px), 30px) rotate(-7.2deg); }
    100% { transform: translate(-50%, 0) rotate(-7deg); }
}

/* Banner */
.banner {
    position: relative;
    width: 100%;
    height: 72px;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0) 22%, rgba(0, 0, 0, 0.18) 100%),
        repeating-linear-gradient(
            90deg,
            #1c2a44 0px,
            #1f2d4a 2px,
            #1a2740 4px,
            #1f2d4a 6px,
            #1c2a44 8px
        );
    border-bottom: 1px solid rgba(58, 74, 100, 0.6);
    box-shadow: 0 4px 18px rgba(8, 12, 22, 0.45), inset 0 1px 0 rgba(231, 234, 240, 0.06);
    font-family: 'Libre Baskerville', Georgia, serif;
}

.banner-wordmark {
    color: var(--pewter);
    font-family: 'Libre Baskerville', Georgia, serif;
    font-variant: small-caps;
    text-transform: lowercase;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.34em;
    padding: 0 28px;
    text-shadow: 0 1px 0 rgba(8, 12, 22, 0.7), 0 0 12px rgba(168, 148, 102, 0.07);
}

.banner-rivet {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #5a6a84, var(--steel-rivet) 60%, #1f2d4a 100%);
    box-shadow: inset 0 1px 0 rgba(231, 234, 240, 0.25), 0 1px 1px rgba(8, 12, 22, 0.7);
}

.banner-micro {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Inter', sans-serif;
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0.22em;
    color: var(--pewter-shadow);
    text-transform: uppercase;
    opacity: 0.65;
}

.banner-micro.left-micro { left: 28px; }
.banner-micro.right-micro { right: 28px; }

@media (max-width: 640px) {
    .banner-micro { display: none; }
}

/* Main centered column */
.column {
    position: relative;
    z-index: 2;
    max-width: var(--column-max);
    margin: 0 auto;
    padding: 96px 32px 120px;
}

/* Masthead */
.masthead {
    text-align: center;
    margin-bottom: 120px;
    padding-bottom: 32px;
}

.title {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-style: italic;
    font-weight: 700;
    font-size: clamp(2.4rem, 6vw, 4.6rem);
    line-height: 1.05;
    letter-spacing: -0.012em;
    color: var(--pewter);
    margin-bottom: 28px;
    text-shadow: 0 1px 0 rgba(8, 12, 22, 0.6);
}

.subtitle {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--pewter-shadow);
    max-width: 480px;
    margin: 0 auto;
}

.masthead-rule {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 56px;
}

.rule-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--brass);
    box-shadow: 0 0 6px rgba(168, 148, 102, 0.4);
}

.rule-line {
    width: 80px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--steel-rivet) 50%, transparent);
}

/* Chapters */
.chapter {
    position: relative;
    margin-bottom: 140px;
    padding-top: 32px;
}

.chapter:last-of-type {
    margin-bottom: 80px;
}

/* Patch */
.patch-mount {
    width: 96px;
    height: 96px;
    margin: 0 auto 36px;
    transform: rotate(0deg) scale(0.86);
    opacity: 0;
    transition: transform 900ms var(--elastic), opacity 700ms ease;
    filter: drop-shadow(0 6px 10px rgba(8, 12, 22, 0.6));
}

.chapter.in-view .patch-mount {
    transform: rotate(4deg) scale(1);
    opacity: 1;
}

.patch {
    width: 96px;
    height: 96px;
    display: block;
}

.patch-felt {
    fill: var(--navy-felt);
    stroke: #0c1424;
    stroke-width: 0.5;
    filter: drop-shadow(0 0 2px rgba(8, 12, 22, 0.6));
}

.patch-stitchring {
    fill: none;
    stroke: var(--brass);
    stroke-width: 0.9;
    stroke-dasharray: 2 1.6;
    opacity: 0.78;
}

.patch-numeral {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 700;
    font-style: italic;
    font-size: 32px;
    fill: var(--brass);
    stroke: rgba(12, 20, 36, 0.6);
    stroke-width: 0.4;
    letter-spacing: 0.04em;
    filter: drop-shadow(0 1px 0 rgba(8, 12, 22, 0.5));
}

.patch-numeral--large {
    font-size: 24px;
}

.patch-numeral--inline {
    font-size: 28px;
}

/* Chapter label */
.chapter-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--pewter-shadow);
    text-align: center;
    margin-bottom: 40px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 600ms ease 200ms, transform 600ms var(--elastic) 200ms;
}

.chapter.in-view .chapter-label {
    opacity: 1;
    transform: translateY(0);
}

/* Body */
.chapter-body {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 400;
    font-size: 1.18rem;
    line-height: 1.62;
    color: var(--pewter);
    text-align: justify;
    hyphens: auto;
    -webkit-hyphens: auto;
    margin-bottom: 1.4rem;
    word-spacing: 0.01em;
}

.chapter-body em {
    color: var(--pewter);
    font-style: italic;
}

.chapter-body--italic {
    font-style: italic;
    color: var(--pewter-shadow);
    border-left: 1px solid rgba(58, 74, 100, 0.4);
    padding-left: 22px;
    margin-left: 8px;
    background: linear-gradient(90deg, rgba(31, 45, 74, 0.18), transparent 30%);
}

.drop-cap {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-style: italic;
    font-weight: 700;
    font-size: 5.4rem;
    line-height: 0.92;
    float: left;
    margin: 0.18rem 0.6rem -0.2rem 0;
    color: var(--pewter);
    text-shadow: 0 2px 0 rgba(8, 12, 22, 0.7);
}

.drop-cap--brass {
    color: var(--brass);
    text-shadow: 0 2px 0 rgba(8, 12, 22, 0.7), 0 0 14px rgba(168, 148, 102, 0.18);
}

/* Glass cards (drifting marginalia) */
.glass-card {
    position: relative;
    margin: 2.4rem 0;
    padding: 22px 26px 26px;
    background: linear-gradient(135deg, rgba(231, 234, 240, 0.08) 0%, rgba(231, 234, 240, 0.03) 100%);
    backdrop-filter: blur(14px) saturate(1.15);
    -webkit-backdrop-filter: blur(14px) saturate(1.15);
    border: 1px solid rgba(196, 204, 222, 0.18);
    border-radius: 4px;
    box-shadow:
        0 8px 32px rgba(8, 12, 22, 0.5),
        inset 0 1px 0 rgba(231, 234, 240, 0.22);
    max-width: 320px;
    cursor: text;
    transition:
        transform 320ms var(--elastic),
        backdrop-filter 320ms ease,
        box-shadow 320ms ease;
    opacity: 0;
}

.glass-card.in-view {
    opacity: 1;
}

.glass-card:hover {
    transform: translateY(-4px);
    backdrop-filter: blur(18px) saturate(1.2);
    -webkit-backdrop-filter: blur(18px) saturate(1.2);
    box-shadow:
        0 14px 44px rgba(8, 12, 22, 0.6),
        inset 0 1px 0 rgba(231, 234, 240, 0.28);
}

/* Drift positions: cards float off-axis from the column edge */
.glass-card.right-drift {
    margin-left: auto;
    margin-right: -10%;
    transform: translateX(40px);
    transition:
        transform 900ms var(--elastic),
        backdrop-filter 320ms ease,
        box-shadow 320ms ease,
        opacity 700ms ease;
}

.glass-card.right-drift.in-view {
    transform: translateX(0);
}

.glass-card.right-drift:hover {
    transform: translateX(0) translateY(-4px);
}

.glass-card.left-drift {
    margin-right: auto;
    margin-left: -10%;
    transform: translateX(-40px);
    transition:
        transform 900ms var(--elastic),
        backdrop-filter 320ms ease,
        box-shadow 320ms ease,
        opacity 700ms ease;
}

.glass-card.left-drift.in-view {
    transform: translateX(0);
}

.glass-card.left-drift:hover {
    transform: translateX(0) translateY(-4px);
}

@media (max-width: 840px) {
    .glass-card.right-drift,
    .glass-card.left-drift {
        margin-left: auto;
        margin-right: auto;
        max-width: 100%;
    }
}

.corner-rivet {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--steel-rivet);
    box-shadow: inset 0 1px 0 rgba(231, 234, 240, 0.4), 0 1px 1px rgba(8, 12, 22, 0.6);
}

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

.card-label {
    font-family: 'Inter', sans-serif;
    font-style: italic;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    color: var(--pewter-shadow);
    text-transform: lowercase;
    margin-bottom: 10px;
    opacity: 0.86;
}

.card-text {
    font-family: 'Inter', sans-serif;
    font-style: italic;
    font-size: 0.86rem;
    line-height: 1.55;
    color: var(--pewter);
}

.card-text em {
    font-style: normal;
    color: var(--brass);
}

.card-ascii {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.72rem;
    line-height: 1.4;
    color: var(--pewter);
    margin: 8px 0 8px;
    white-space: pre;
    background: rgba(12, 20, 36, 0.35);
    padding: 8px 10px;
    border-left: 2px solid var(--brass);
    overflow-x: auto;
}

.card-foot {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.66rem;
    color: var(--pewter-shadow);
    margin-top: 10px;
    letter-spacing: 0.04em;
}

.mono {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.74rem;
    color: var(--brass);
    letter-spacing: 0.02em;
}

/* Slap stickers */
.slap-sticker {
    position: absolute;
    top: var(--st-top, 30%);
    right: -32px;
    transform: rotate(var(--st-rot, -4deg));
    width: 132px;
    height: 22px;
    background:
        linear-gradient(180deg, #d0d4dc, #b8bcc4 70%, #9ea3ad);
    color: var(--navy-deep);
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-align: center;
    line-height: 22px;
    text-transform: uppercase;
    box-shadow:
        0 2px 6px rgba(8, 12, 22, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.5),
        inset 0 -1px 0 rgba(8, 12, 22, 0.25);
    pointer-events: none;
    z-index: 3;
    opacity: 0;
    transition: opacity 800ms ease, transform 800ms var(--elastic);
}

.chapter.in-view .slap-sticker {
    opacity: 0.92;
}

.slap-sticker::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 4px;
    transform: translateY(-50%);
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--brass);
    box-shadow: 116px 0 0 var(--brass);
}

@media (max-width: 880px) {
    .slap-sticker {
        right: 4px;
    }
}

@media (max-width: 540px) {
    .slap-sticker {
        position: relative;
        top: auto;
        right: auto;
        display: block;
        margin: 24px auto;
    }
}

/* Inline patch (Chapter IV) */
.inline-patch-tilt {
    width: 72px;
    height: 72px;
    margin: 28px auto 30px;
    transform: rotate(-6deg);
    filter: drop-shadow(0 4px 8px rgba(8, 12, 22, 0.55));
    opacity: 0.94;
}

.inline-patch-tilt svg {
    width: 72px;
    height: 72px;
}

/* Ornaments */
.ornament {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 56px auto 0;
    height: 28px;
    opacity: 0;
    transition: opacity 600ms ease 200ms;
}

.ornament.in-view {
    opacity: 1;
}

.ornament svg {
    width: 80px;
    height: 28px;
    overflow: visible;
}

.orn-path {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 1400ms var(--elastic);
}

.ornament.in-view .orn-path {
    stroke-dashoffset: 0;
}

.ornament--final svg { width: 60px; height: 36px; }
.ornament--final {
    margin-top: 64px;
}

/* Letter chapter */
.chapter--letter {
    padding-top: 20px;
}

.letter-salutation {
    font-style: italic;
    text-align: left;
    text-indent: 0;
    margin-bottom: 0.6rem;
    color: var(--pewter-shadow);
}

.letter-closing {
    text-align: right;
    font-style: italic;
    color: var(--pewter-shadow);
    margin-top: 2.4rem;
    line-height: 1.7;
}

.letter-question {
    text-align: center;
    font-style: italic;
    color: var(--brass);
    margin-top: 2.4rem;
    font-size: 1.22rem;
    letter-spacing: 0.01em;
}

/* Footer */
.footer {
    margin-top: 100px;
    padding: 36px 0 0;
    text-align: center;
    border-top: 1px solid rgba(58, 74, 100, 0.3);
}

.footer-line {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-style: italic;
    font-size: 0.86rem;
    color: var(--pewter-shadow);
    line-height: 1.6;
}

/* Footnote markers (mono inline brackets) */
.footnote {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.74rem;
    color: var(--brass);
    position: relative;
    cursor: help;
    padding: 0 2px;
}

.footnote::after {
    content: "";
    position: absolute;
    left: 2px;
    right: 2px;
    bottom: -2px;
    height: 2px;
    background: var(--brass);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 380ms var(--elastic);
}

.footnote:hover::after {
    transform: scaleX(1);
}

/* Reveal animations: paragraphs */
.chapter-body {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 700ms ease, transform 700ms var(--elastic);
}

.chapter.in-view .chapter-body {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger paragraphs in a chapter */
.chapter.in-view .chapter-body:nth-of-type(1) { transition-delay: 80ms; }
.chapter.in-view .chapter-body:nth-of-type(2) { transition-delay: 220ms; }
.chapter.in-view .chapter-body:nth-of-type(3) { transition-delay: 340ms; }
.chapter.in-view .chapter-body:nth-of-type(4) { transition-delay: 460ms; }
.chapter.in-view .chapter-body:nth-of-type(5) { transition-delay: 580ms; }

/* Letter chapter overrides */
.chapter--letter .chapter-body {
    text-align: justify;
}
.chapter--letter .letter-salutation,
.chapter--letter .letter-closing,
.chapter--letter .letter-question {
    text-align: inherit;
}

/* Masthead intro animation */
.title, .subtitle, .masthead-rule {
    opacity: 0;
    animation: introFade 1400ms var(--elastic) forwards;
}

.subtitle { animation-delay: 250ms; }
.masthead-rule { animation-delay: 500ms; }

@keyframes introFade {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* small screen */
@media (max-width: 720px) {
    .column {
        padding: 64px 22px 80px;
    }
    .chapter-body {
        font-size: 1.06rem;
    }
    .drop-cap {
        font-size: 4.2rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ambient-slab { animation: none; }
    *, *::before, *::after {
        transition-duration: 0ms !important;
        animation-duration: 0ms !important;
    }
}
