/* ===========================================================================
   QANON PROJECT — ЛЕТОПИСЬ ПОДЗЕМНОГО МИРА
   Concept: an archival dossier — the chronicle is typed on aged paper sheets
   lying on a dark metro "desk". Chrome (header/footer/red accents/Montserrat)
   matches the main site; the reading surface is paper.
   =========================================================================== */

.lore-body {
    /* site-matched tokens */
    --red: #cf2929;
    --red-d: #9e1414;
    --red-br: #ef3b3b;
    --bg: #0a0b0c;            /* desk / metro dark */
    --line: rgba(255, 255, 255, .08);
    --on-dark: #e7e3da;
    --on-dark-dim: #9a948a;

    /* paper / ink */
    --paper: #d8ccae;
    --paper-hi: rgba(255, 250, 236, .55);
    --paper-lo: rgba(120, 96, 56, .22);
    --ink: #2a2620;
    --ink-soft: #50473a;
    --ink-faint: #5f5240;

    --f: "Montserrat", "Inter", system-ui, sans-serif;
    --f-read: "Lora", "PT Serif", Georgia, "Times New Roman", serif;

    margin: 0;
    background: var(--bg);
    color: var(--on-dark);
    font-family: var(--f);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}
.lore-body * { box-sizing: border-box; }
.lore-body ::selection { background: var(--red); color: #fff; }
.lore-body a { color: inherit; text-decoration: none; }
.lore-body a:focus-visible,
.lore-body button:focus-visible,
.lore-chap:focus-visible,
.lore-cta:focus-visible,
.lore-top:focus-visible,
.lore-toc a:focus-visible,
.lore-toc__toggle:focus-visible,
.lore-hero__toc-btn:focus-visible,
.lore-sec__link:focus-visible {
    outline: 2px solid var(--red-br);
    outline-offset: 3px;
    border-radius: 6px;
}
.header--lore .header_btn:focus-visible { outline: 2px solid var(--red-br); outline-offset: 2px; }

/* ---- custom page scrollbar (overrides the global one from _scroll.css) ------ */
.lore-html { scrollbar-width: thin; scrollbar-color: var(--red-d) rgba(10, 10, 11, .55); }
.lore-html::-webkit-scrollbar { width: 14px; }
.lore-html::-webkit-scrollbar-track {
    background: linear-gradient(90deg, rgba(0, 0, 0, .5), rgba(12, 13, 14, .8));
    box-shadow: inset 1px 0 0 rgba(255, 255, 255, .04);
}
.lore-html::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--red-br), var(--red-d));
    background-clip: padding-box;
    border: 3px solid transparent;             /* padding so the thumb "floats" in the track */
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(207, 41, 41, .45), inset 0 1px 0 rgba(255, 255, 255, .3);
}
.lore-html::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #ff5b50, var(--red));
    background-clip: padding-box;
    box-shadow: 0 0 16px rgba(239, 59, 59, .7), inset 0 1px 0 rgba(255, 255, 255, .4);
}

/* ---- fixed atmospheric background (the "desk") --------------------------- */
.lore-bg {
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        linear-gradient(180deg, rgba(10, 10, 11, .62), rgba(8, 9, 10, .8)),
        url(../img/main-bg.webp) 78% 60%/cover no-repeat fixed;
    filter: saturate(.78) contrast(1.05);
}
.lore-bg::after {                       /* vignette */
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(120% 90% at 50% 18%, transparent 40%, rgba(0, 0, 0, .72) 100%);
}
.lore-grain {
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image: url(../img/paper-grain-tile.png);
    background-size: 512px;
    opacity: .05;
    pointer-events: none;
}

/* ===========================================================================
   HEADER  (reuse site .header, make it fixed + translucent)
   =========================================================================== */
.header--lore {
    position: fixed;
    top: 0; left: 0; right: 0;
    padding: 12px 0;
    z-index: 9000;
    background: linear-gradient(180deg, rgba(8, 8, 9, .96), rgba(8, 8, 9, .55) 70%, transparent);
    transition: background .3s ease, padding .3s ease;
}
.header--lore.is-scrolled {
    padding: 8px 0;
    background: rgba(10, 10, 11, .94);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 1px 0 var(--line), 0 10px 24px rgba(0, 0, 0, .45);
}
.header--lore .header_nav li.is-active { color: var(--red-br); cursor: default; }
.header--lore .header_btn { display: inline-flex; align-items: center; gap: 8px; }
.header_btn-ico { width: 19px; height: 19px; fill: currentColor; flex: 0 0 auto; }

.lore-mhead {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 9001;
    align-items: center;
    justify-content: space-between;
    padding: 9px 16px;
    background: rgba(10, 10, 11, .96);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}
.lore-mhead__logo { width: 128px; height: 36px; background: url(../img/logonew.png) center/contain no-repeat; }
.lore-mhead__btn {
    font-size: 13px; font-weight: 600; color: var(--on-dark);
    padding: 8px 15px; border: 1px solid var(--line); border-radius: 8px;
    background: rgba(255, 255, 255, .04);
}

/* ===========================================================================
   CHAPTER NAV  (sticky tabs + reading progress) — proper chapter switching
   =========================================================================== */
.lore-chapters {
    position: fixed;
    top: 112px; left: 0; right: 0;
    z-index: 8000;
    display: flex;
    flex-direction: column;          /* bar on top, crumb on its own line below */
    align-items: center;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity .35s ease, transform .35s ease, top .3s ease;
}
.lore-chapters.is-on { opacity: 1; transform: none; pointer-events: auto; }
.header--lore.is-scrolled ~ .lore-chapters { top: 80px; }
.lore-chapters__inner {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: 1040px;
    width: calc(100% - 32px);
    padding: 6px;
    background: linear-gradient(180deg, rgba(24, 24, 26, .94), rgba(15, 15, 16, .94));
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 14px;
    box-shadow:
        0 14px 34px rgba(0, 0, 0, .55),
        0 1px 0 rgba(255, 255, 255, .05) inset,
        0 0 0 1px rgba(0, 0, 0, .3);
    overflow: visible;
}
.lore-chapters__list {
    display: flex;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}
.lore-chapters__list::-webkit-scrollbar { display: none; }
.lore-toc__toggle {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 12px;
    border-radius: 9px;
    border: 0;
    background: rgba(255, 255, 255, .04);
    color: var(--on-dark-dim);
    font-family: var(--f);
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
}
.lore-toc__toggle:hover, .lore-toc__toggle[aria-expanded="true"] { background: rgba(255, 255, 255, .09); color: var(--on-dark); }
.lore-toc__toggle-ico {
    width: 15px; height: 11px;
    background:
        linear-gradient(var(--c, currentColor), var(--c, currentColor)) 0 0/100% 2px no-repeat,
        linear-gradient(var(--c, currentColor), var(--c, currentColor)) 0 50%/100% 2px no-repeat,
        linear-gradient(var(--c, currentColor), var(--c, currentColor)) 0 100%/100% 2px no-repeat;
}
@media (max-width: 560px) { .lore-toc__toggle-t { display: none; } }
.lore-chap {
    position: relative;
    isolation: isolate;
    flex: 1 1 0;
    min-width: 0;                    /* allow shrink so long names ellipsize, never overflow */
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    padding: 9px 10px;
    border-radius: 9px;
    color: var(--on-dark-dim);
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
    transition: color .3s ease, box-shadow .35s ease;
}
.lore-chap::before {                 /* the red highlight — fades in/out smoothly */
    content: "";
    position: absolute; inset: 0;
    border-radius: 9px;
    background: linear-gradient(180deg, var(--red), var(--red-d));
    opacity: 0;
    transition: opacity .35s ease;
    z-index: -1;
}
.lore-chap::after {                  /* soft hover tint (also animated) */
    content: "";
    position: absolute; inset: 0;
    border-radius: 9px;
    background: rgba(255, 255, 255, .06);
    opacity: 0;
    transition: opacity .25s ease;
    z-index: -2;
}
.lore-chap b { color: var(--red-br); font-weight: 800; font-size: 12px; transition: color .3s ease; }
.lore-chap:hover { color: var(--on-dark); }
.lore-chap:hover::after { opacity: 1; }
.lore-chap.is-active { color: #fff; box-shadow: 0 0 18px rgba(207, 41, 41, .5), 0 2px 8px rgba(158, 20, 20, .45); }
.lore-chap.is-active::before { opacity: 1; }
.lore-chap.is-active b { color: #fff; }
.lore-chap__t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lore-chapters__bar {
    position: absolute;
    left: 0; bottom: 0; height: 2px;
    width: 0;
    background: var(--red-br);
    box-shadow: 0 0 8px rgba(239, 59, 59, .7);
    border-radius: 2px;
    transition: width .15s linear;
}
.lore-crumb {
    display: none;
}

/* ===========================================================================
   COMPASS — table of contents + live search, one drawer over the dark desk
   =========================================================================== */
.lore-toc__scrim {
    position: fixed; inset: 0; z-index: 9250;
    background: rgba(0, 0, 0, .55);
    opacity: 0; pointer-events: none;
    transition: opacity .3s ease;
}
.lore-toc__scrim.is-open { opacity: 1; pointer-events: auto; }
.lore-toc {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 9300;
    width: min(360px, 86vw);
    background: rgba(17, 17, 18, .97);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-right: 1px solid var(--line);
    box-shadow: 20px 0 50px rgba(0, 0, 0, .5);
    transform: translateX(-100%);
    transition: transform .3s ease;
    overflow-y: auto;
    padding: 90px 18px 40px;
    color: var(--on-dark);
    font-family: var(--f);
}
.lore-toc.is-open { transform: translateX(0); }
.lore-toc__search {
    position: sticky; top: -90px; z-index: 2;
    display: flex; align-items: center; gap: 8px;
    margin: 0 0 14px;
}
.lore-toc__search input {
    flex: 1 1 auto;
    background: rgba(255, 255, 255, .05);
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 10px 12px;
    color: var(--on-dark);
    font-family: var(--f);
    font-size: 13.5px;
}
.lore-toc__search input::placeholder { color: var(--on-dark-dim); }
.lore-toc__search input:focus-visible { outline: 2px solid var(--red-br); outline-offset: 2px; }
.lore-toc__count { font-size: 11px; color: var(--on-dark-dim); white-space: nowrap; }
.lore-toc__list, .lore-toc__list ul { list-style: none; margin: 0; padding: 0; }
.lore-toc__part {
    margin: 0 0 4px;
}
.lore-toc__part > a {
    display: block;
    margin: 14px 0 6px;
    font-weight: 800;
    letter-spacing: .1em;
    font-size: 11px;
    text-transform: uppercase;
    color: #fff;
    background: linear-gradient(180deg, var(--red), var(--red-d));
    padding: 6px 10px;
    border-radius: 4px;
}
.lore-toc__part:first-child > a { margin-top: 0; }
.lore-toc__list ul li a {
    display: block;
    padding: 7px 10px 7px 14px;
    margin: 1px 0;
    font-size: 13px;
    line-height: 1.35;
    color: var(--on-dark-dim);
    border-left: 2px solid transparent;
    border-radius: 0 6px 6px 0;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.lore-toc__list ul li a:hover { color: var(--on-dark); background: rgba(255, 255, 255, .04); }
.lore-toc__list ul li a.is-current { color: #fff; border-color: var(--red-br); background: rgba(207, 41, 41, .14); }
.lore-toc__results { display: flex; flex-direction: column; gap: 2px; }
.lore-toc__result {
    display: block;
    padding: 9px 10px;
    border-radius: 8px;
    color: var(--on-dark-dim);
    transition: background .15s ease, color .15s ease;
}
.lore-toc__result:hover, .lore-toc__result:focus-visible { color: var(--on-dark); background: rgba(255, 255, 255, .05); }
.lore-toc__result-crumb { display: block; font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--red-br); margin-bottom: 3px; }
.lore-toc__result-snip { display: block; font-size: 12.5px; line-height: 1.5; }
.lore-toc__result-snip mark { background: var(--red); color: #fff; border-radius: 2px; padding: 0 2px; }
.lore-toc__empty { padding: 10px; font-size: 12.5px; color: var(--on-dark-dim); }

/* ===========================================================================
   SHEET — the aged paper surface (shared)
   =========================================================================== */
.lore-sheet {
    position: relative;
    background-color: var(--paper);
    background-image:
        radial-gradient(120% 80% at 50% 0%, var(--paper-hi), transparent 58%),
        radial-gradient(90% 60% at 85% 110%, var(--paper-lo), transparent 60%);
    color: var(--ink);
    border-radius: 2px;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, .45),
        0 46px 80px rgba(0, 0, 0, .66),
        0 12px 24px rgba(0, 0, 0, .5),
        inset 0 0 120px rgba(120, 98, 60, .2);
}
.lore-sheet::before {                   /* paper fiber / grain */
    content: "";
    position: absolute;
    inset: 0;
    background: url(../img/paper-grain-tile.png) center/240px;
    mix-blend-mode: multiply;
    opacity: .14;
    border-radius: inherit;
    pointer-events: none;
}
.lore-sheet::after {                    /* worn darkened edges */
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 2px rgba(60, 48, 28, .55), inset 0 0 40px rgba(90, 70, 40, .22), inset 0 1px 0 rgba(255, 255, 255, .4);
    pointer-events: none;
}
/* ===========================================================================
   HERO — the document's title sheet
   =========================================================================== */
.lore-hero {
    position: relative;
    min-height: 100svh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 120px 24px 72px;
}
.lore-hero__sheet {
    position: relative;
    width: min(760px, 100%);
    padding: clamp(44px, 6vw, 80px) clamp(30px, 6vw, 76px) clamp(40px, 5vw, 62px);
    text-align: center;
    /* thin inner keyline — reads as an official archival cover */
    outline: 1px solid rgba(90, 72, 44, .32);
    outline-offset: -16px;
}
.lore-hero__kicker {
    display: inline-flex; align-items: center; gap: 14px;
    font-weight: 700;
    letter-spacing: .24em;
    text-transform: uppercase;
    font-size: 12px;
    color: var(--ink-faint);
    margin-bottom: 24px;
}
.lore-hero__kicker::before, .lore-hero__kicker::after {
    content: ""; width: 20px; height: 1px; background: rgba(122, 110, 89, .5); flex: 0 0 auto;
}
.lore-hero__title {
    font-weight: 800;
    font-size: clamp(36px, 6.6vw, 72px);
    line-height: 1.05;
    color: var(--ink);
    margin: 0 0 24px;
    letter-spacing: -.01em;
}
/* masked lines for the entrance reveal */
.lore-hero__ln { display: block; overflow: hidden; padding: .06em 0; }
.lore-hero__ln > span { display: block; }
.lore-hero__years {
    display: flex; align-items: center; justify-content: center; gap: 18px;
    font-weight: 700;
    font-size: clamp(19px, 2.6vw, 27px);
    letter-spacing: .16em;
    color: var(--red-d);
    margin: 0;
}
.lore-hero__years i { display: block; width: 44px; height: 2px; background: rgba(158, 20, 20, .55); }
.lore-hero__sub {
    margin: 16px 0 0;
    font-size: 12px;
    letter-spacing: .24em;
    text-transform: uppercase;
    color: var(--ink-soft);
}
.lore-hero__quote {
    margin: 32px auto 0;
    max-width: 520px;
    font-family: var(--f-read);
    font-style: italic;
    font-size: 17px;
    line-height: 1.66;
    color: var(--ink-soft);
}
.lore-hero__quote cite {
    display: block;
    margin-top: 12px;
    font-family: var(--f);
    font-style: normal;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: .04em;
    color: var(--ink-faint);
}
.lore-hero__actions {
    display: flex; gap: 16px; justify-content: center; flex-wrap: wrap;
    margin-top: 32px;
}
/* ---- buttons: clean, flat, editorial (shared by hero + finale) ----------- */
.lore-hero__cta, .lore-hero__toc-btn, .lore-cta {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-family: var(--f);
    font-weight: 700; font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
    padding: 16px 30px;
    border-radius: 4px;
    cursor: pointer;
    transition: transform .25s cubic-bezier(.2, .7, .2, 1), background .22s ease, color .22s ease, border-color .22s ease, box-shadow .25s ease;
}
/* primary — solid red, crisp */
.lore-hero__cta, .lore-cta--play {
    background: var(--red-d);
    color: #fff; border: 1px solid var(--red-d);
    box-shadow: 0 6px 16px rgba(110, 12, 12, .28);
}
.lore-hero__cta:hover, .lore-cta--play:hover { background: var(--red); border-color: var(--red); transform: translateY(-2px); box-shadow: 0 10px 22px rgba(140, 14, 14, .34); }
.lore-hero__cta:active, .lore-cta--play:active { transform: translateY(0); box-shadow: 0 4px 12px rgba(110, 12, 12, .3); }
/* secondary — ink outline, inverts on hover */
.lore-hero__toc-btn, .lore-cta--dc {
    background: transparent;
    color: var(--ink);
    border: 1.5px solid rgba(42, 38, 32, .75);
    box-shadow: none;
}
.lore-hero__toc-btn:hover, .lore-cta--dc:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); transform: translateY(-2px); }
.lore-hero__toc-btn:active, .lore-cta--dc:active { transform: translateY(0); }

/* ===========================================================================
   DOCUMENT — the chapters as paper pages
   =========================================================================== */
.lore-doc {
    position: relative;
    max-width: 880px;
    margin: 0 auto;
    padding: 0 24px 60px;
}
.lore-part, .lore-finale {
    position: relative;
    z-index: 1;
}
/* a part is just a group now — its topics are separate paper sheets below */
.lore-part {
    margin: 0 auto;
    padding: 0;
    scroll-margin-top: 120px;
}

/* chapter divider — sits on the dark desk between the paper stacks, so parts
   read as clearly separate acts, lit by a soft glow */
.lore-part__head {
    position: relative;
    text-align: center;
    padding: clamp(46px, 8vw, 92px) 20px clamp(30px, 4vw, 46px);
}
.lore-part__head::before {
    content: "";
    position: absolute;
    left: 50%; top: 54%;
    width: min(640px, 92%); height: 320px;
    transform: translate(-50%, -50%);
    background: radial-gradient(ellipse at center, rgba(207, 41, 41, .16), rgba(207, 41, 41, .05) 45%, transparent 72%);
    pointer-events: none;
    z-index: -1;
}
.lore-part__label {
    display: inline-block;
    font-weight: 800;
    letter-spacing: .26em;
    font-size: 12px;
    color: #fff;
    background: linear-gradient(180deg, var(--red), var(--red-d));
    padding: 6px 16px;
    border-radius: 4px;
    box-shadow: 0 6px 16px rgba(158, 20, 20, .3);
}
.lore-part__name {
    margin: 16px 0 8px;
    font-weight: 800;
    font-size: clamp(28px, 4.8vw, 50px);
    line-height: 1.03;
    letter-spacing: -.01em;
    color: var(--on-dark);
    text-shadow: 0 2px 30px rgba(0, 0, 0, .5);
}
.lore-part__sub {
    font-size: 13px;
    color: var(--on-dark-dim);
    letter-spacing: .04em;
}

/* section — now its own paper sheet (page) */
.lore-sec {
    margin: 0 auto 20px;
    padding: clamp(28px, 4vw, 48px) clamp(28px, 5vw, 56px);
    scroll-margin-top: 120px;
}
/* continuous notebook ruling across the whole card, anchored (content-box) to
   the text baseline so running body text sits on the lines while the ruling
   still fills the entire sheet; warm sepia tone to sit in the paper family */
.lore-sec.lore-sheet {
    background-image:
        repeating-linear-gradient(to bottom,
            transparent 0, transparent 27px,
            rgba(70, 92, 138, .13) 27px, rgba(70, 92, 138, .13) 28px,
            transparent 28px, transparent 32px),
        radial-gradient(120% 80% at 50% 0%, var(--paper-hi), transparent 58%),
        radial-gradient(90% 60% at 85% 110%, var(--paper-lo), transparent 60%);
    background-origin: content-box, border-box, border-box;
}
.lore-sec__title {
    position: relative;
    font-weight: 700;
    font-size: clamp(20px, 2.5vw, 25px);
    line-height: 1.25;
    color: var(--ink);
    margin: 0 0 16px;
    padding-left: 16px;
}
.lore-sec__title::before {
    content: "";
    position: absolute; left: 0; top: .12em; bottom: .12em; width: 4px;
    background: linear-gradient(var(--red), var(--red-d));
    border-radius: 2px;
}
.lore-sec--note .lore-sec__title { font-size: clamp(15px, 2vw, 18px); color: var(--ink-soft); }
.lore-sec__link {
    opacity: 0;
    margin-left: 8px;
    font-size: .65em;
    font-weight: 400;
    color: var(--ink-faint);
    background: none;
    border: 0;
    cursor: pointer;
    vertical-align: middle;
    transition: opacity .2s ease, color .2s ease;
}
.lore-sec__title:hover .lore-sec__link,
.lore-sec__link:focus-visible { opacity: 1; }
.lore-sec__link:hover { color: var(--red-d); }
.lore-sec__link.is-copied { opacity: 1; color: var(--red-d); }
.lore-sec__link.is-copied::after {
    content: "Скопировано";
    position: absolute;
    margin-left: 8px;
    font-size: 11px;
    font-family: var(--f);
    font-weight: 600;
    color: var(--ink-soft);
}

/* dateline — dossier stamp */
.lore-dateline {
    display: inline-block;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    font-size: 11.5px;
    color: var(--red-d);
    margin: 0 0 16px;
    padding: 5px 12px;
    border: 1.5px solid rgba(158, 20, 20, .4);
    border-radius: 3px;
    background: rgba(158, 20, 20, .05);
}

/* body — typed on paper. line-height === ruling step (32px); JS snaps each
   paragraph's top onto the grid (see lore.js §12) so every line rests on a
   ruled line, and the 32px bottom margin leaves exactly ONE empty ruled line
   between paragraphs */
.lore-p {
    font-family: var(--f-read);
    font-size: 18px;
    line-height: 32px;             /* matches the 32px ruling so lines track the text */
    color: var(--ink);
    margin: 0 0 32px;              /* one blank ruled line between paragraphs */
    text-align: left;
    -webkit-hyphens: none;
    hyphens: none;
}
/* raised initial — a large coloured capital that sits on the first line,
   not a deep drop cap spanning two lines */
.lore-p--first::first-letter {
    font-family: var(--f);
    font-weight: 800;
    font-size: 1.75em;
    line-height: 1;
    color: var(--red-d);
    padding-right: 2px;
}

/* dramatic lead line */
.lore-lead {
    font-weight: 600;
    font-size: clamp(18px, 2.1vw, 21px);
    line-height: 1.35;
    color: var(--ink);
    text-align: center;
    margin: 28px auto;
    max-width: 560px;
}
.lore-lead::before, .lore-lead::after { content: "—"; color: var(--red-d); margin: 0 .5em; }

/* epigraph — handwritten note */
.lore-epigraph {
    margin: 28px 0;
    padding: 20px 24px;
    border-left: 3px solid var(--red-d);
    background: rgba(120, 96, 56, .1);
    border-radius: 0 6px 6px 0;
}
.lore-epigraph p {
    font-family: var(--f-read);
    font-style: italic;
    font-size: 18px;
    line-height: 1.66;
    color: var(--ink-soft);
}
.lore-epigraph cite {
    display: block;
    margin-top: 12px;
    font-family: var(--f);
    font-style: normal;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: .04em;
    color: var(--ink-faint);
}

/* ===========================================================================
   PHOTOS — vintage cards laid on the paper
   =========================================================================== */
.lore-photos {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 32px;
    margin: 40px 0;
}
.lore-photo {
    position: relative;
    width: min(440px, 100%);
    cursor: grab;
    touch-action: pan-y;
}
.lore-photo.is-held { will-change: transform; }
.lore-photos--cluster .lore-photo { width: min(360px, 47%); }
/* no mat, no tape — just the photograph itself, cropped clean of its baked-in
   border, casting a soft shadow onto the paper. hover lift lives on the frame
   (not on .lore-photo, whose transform is owned by the drag/settle JS) */
.lore-photo__frame {
    position: relative;
    transition: transform .45s cubic-bezier(.16, 1, .3, 1);
}
.lore-photo__shot {
    line-height: 0;
    border-radius: 3px;
    overflow: hidden;                /* rounds off any ragged corner scraps */
    box-shadow: 0 14px 28px rgba(0, 0, 0, .4), 0 4px 10px rgba(0, 0, 0, .28);
    transition: box-shadow .45s cubic-bezier(.16, 1, .3, 1);
}
.lore-photo__frame img {
    display: block;
    width: 100%;
    height: auto;                       /* keep the card's own aspect, don't squish */
}
.lore-photo figcaption {
    font-family: var(--f);
    font-size: 12px;
    font-style: normal;
    line-height: 1.55;
    letter-spacing: .01em;
    color: var(--ink-soft);
    text-align: center;
    padding: 12px 4px 0;
}
.lore-photo figcaption b { color: var(--red-d); font-weight: 700; letter-spacing: .04em; }
.lore-photo:hover { z-index: 5; }
.lore-photo:hover .lore-photo__frame { transform: translateY(-6px); }
.lore-photo:hover .lore-photo__shot { box-shadow: 0 22px 38px rgba(0, 0, 0, .44), 0 8px 16px rgba(0, 0, 0, .3); }
.lore-photo.is-held { cursor: grabbing; z-index: 500; }

/* entrance: clean rise + fade + settle (no rotation) */
.lore-photo.is-drop { opacity: 0; transform: translateY(30px) scale(.985); }
.lore-photo.is-dropped { animation: dropIn .8s cubic-bezier(.16, 1, .3, 1) var(--dl, 0s) forwards; }
@keyframes dropIn {
    0%   { opacity: 0; transform: translateY(30px) scale(.985); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===========================================================================
   FINALE
   =========================================================================== */
.lore-finale {
    max-width: 760px;
    margin: 0 auto;
    padding: clamp(40px, 6vw, 72px) clamp(26px, 5vw, 60px);
    text-align: center;
    scroll-margin-top: 130px;
}
.lore-finale__line { font-weight: 800; font-size: clamp(24px, 4vw, 40px); line-height: 1.1; color: var(--ink); }
.lore-finale__line--accent { color: var(--red-d); }
.lore-finale__note { max-width: 500px; margin: 16px auto 32px; color: var(--ink-soft); font-size: 14.5px; line-height: 1.65; font-family: var(--f-read); }
.lore-finale__btns { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
/* .lore-cta styling is unified with the hero buttons above */

/* ---- back to top --------------------------------------------------------- */
.lore-top {
    position: fixed; left: 20px; bottom: 20px; z-index: 9500;
    width: 48px; height: 48px; border-radius: 50%;
    border: 1px solid var(--line); background: rgba(15, 15, 16, .9);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 22px rgba(0, 0, 0, .5);
    color: var(--on-dark-dim);
    opacity: 0; transform: translateY(8px); pointer-events: none;
    transition: opacity .25s ease, transform .25s ease, border-color .2s ease;
}
.lore-top.is-on { opacity: 1; transform: none; pointer-events: auto; }
.lore-top:hover { border-color: rgba(239, 59, 59, .5); color: var(--on-dark); }
.lore-top__ico { font-size: 18px; line-height: 1; }

/* page-transition curtain styling lives in the shared public/js/transition.js */

/* ===========================================================================
   REVEAL — safe by default (visible); only hidden once JS "arms" it. Elements
   rise + fade with an expensive ease; grouped children stagger via --reveal-delay.
   =========================================================================== */
.reveal { opacity: 1; transform: none; }
html.reveal-armed .reveal {
    opacity: 0;
    transform: translateY(24px);
    transition:
        opacity .8s cubic-bezier(.16, 1, .3, 1) var(--reveal-delay, 0s),
        transform .9s cubic-bezier(.16, 1, .3, 1) var(--reveal-delay, 0s);
}
html.reveal-armed .reveal.is-visible { opacity: 1; transform: none; }
html.reveal-armed .reveal.no-anim { transition: none !important; }

/* mask reveal — the heading text wipes up from behind a clip */
.reveal-mask { overflow: hidden; }
.reveal-mask > span { display: inline-block; will-change: transform; }
html.reveal-armed .reveal-mask { opacity: 1; transform: none; }   /* container stays put; only the inner span moves */
html.reveal-armed .reveal-mask > span {
    transform: translateY(112%);
    transition: transform 1s cubic-bezier(.16, 1, .3, 1) var(--reveal-delay, 0s);
}
html.reveal-armed .reveal-mask.is-visible > span { transform: none; }
html.reveal-armed .reveal-mask.no-anim > span { transition: none !important; transform: none; }

/* section accent bar grows in with its title */
html.reveal-armed .lore-sec__title::before { transform: scaleY(0); transform-origin: top; transition: transform .8s cubic-bezier(.16,1,.3,1) .12s; }
html.reveal-armed .lore-sec__title.is-visible::before { transform: scaleY(1); }

/* ===========================================================================
   HERO ENTRANCE — a composed load sequence
   =========================================================================== */
.lore-hero__kicker, .lore-hero__years, .lore-hero__sub, .lore-hero__quote, .lore-hero__actions {
    opacity: 1; transform: none;
}
html.hero-armed .lore-hero__kicker,
html.hero-armed .lore-hero__years,
html.hero-armed .lore-hero__sub,
html.hero-armed .lore-hero__quote,
html.hero-armed .lore-hero__actions {
    opacity: 0; transform: translateY(22px);
    transition: opacity .9s cubic-bezier(.16,1,.3,1) var(--d,0s), transform 1s cubic-bezier(.16,1,.3,1) var(--d,0s);
}
html.hero-armed .lore-hero__ln > span {
    transform: translateY(115%);
    transition: transform 1.1s cubic-bezier(.16,1,.3,1) var(--d,0s);
}
/* played state */
.lore-hero.is-in .lore-hero__kicker,
.lore-hero.is-in .lore-hero__years,
.lore-hero.is-in .lore-hero__sub,
.lore-hero.is-in .lore-hero__quote,
.lore-hero.is-in .lore-hero__actions { opacity: 1; transform: none; }
.lore-hero.is-in .lore-hero__ln > span { transform: none; }
/* stagger timing */
html.hero-armed .lore-hero__kicker { --d: .05s; }
html.hero-armed .lore-hero__ln:nth-child(1) > span { --d: .18s; }
html.hero-armed .lore-hero__ln:nth-child(2) > span { --d: .30s; }
html.hero-armed .lore-hero__years { --d: .5s; }
html.hero-armed .lore-hero__sub { --d: .6s; }
html.hero-armed .lore-hero__quote { --d: .72s; }
html.hero-armed .lore-hero__actions { --d: .86s; }

/* ===========================================================================
   FOOTER — same as the main site (.footer / .footer_bg from style.css),
   but compact (the site's 700px footer_bg is far too tall after the finale)
   =========================================================================== */
.lore-body .footer {
    position: relative; z-index: 10;
    height: auto; margin-top: 40px;
    align-items: flex-start;
    padding: 34px 0 46px;
}
.lore-body .footer_bg { z-index: 1; height: 260px; opacity: .32; }
.lore-body .footer_design { height: auto; align-self: center; }

/* ===========================================================================
   WIKI RAIL INTEGRATION — the shared left section switcher (wiki-rail.css)
   On desktop the fixed reading-nav shifts right to line up with the content
   column (which body padding-left has already offset). On narrow screens the
   rail is hidden here: lore keeps its own mobile chrome (.lore-mhead + chapter
   bar), and section switching on mobile lore is a separate follow-up.
   =========================================================================== */
@media (min-width: 1025px) {
    .lore-body.has-rail .lore-chapters { left: var(--rail-w); }
}
@media (max-width: 1024px) {
    .lore-body .wiki-rail { display: none; }
    .lore-body.has-rail { padding-left: 0; }
}

/* ===========================================================================
   RESPONSIVE
   =========================================================================== */
@media (max-width: 900px) {
    .header--lore { display: none; }
    .lore-mhead { display: flex; }
    .lore-chapters { top: 66px; }
    .header--lore.is-scrolled ~ .lore-chapters { top: 66px; }
    .lore-chap__t { display: none; }              /* tabs collapse to numerals */
    .lore-chap { flex: 0 0 auto; padding: 12px 16px; min-height: 44px; }
    .lore-chapters__inner { justify-content: center; }
    .lore-hero { padding: 90px 16px 50px; }
    .lore-crumb {
        display: block;
        max-width: calc(100% - 32px);
        margin: 4px auto 0;
        padding: 4px 10px;
        font-size: 11px;
        letter-spacing: .02em;
        color: var(--on-dark-dim);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        text-align: center;
    }
}
@media (max-width: 560px) {
    .lore-doc { padding: 0 12px 40px; }
    .lore-part { padding: 30px 20px; transform: none !important; }
    .lore-hero__sheet { padding: 34px 22px; }
    .lore-p { font-size: 16.5px; }
    .lore-photo figcaption { font-size: 13px; line-height: 1.55; }
    .lore-photos--cluster .lore-photo { width: min(360px, 90%); }
    .lore-toc { width: 100vw; }
}

/* ===========================================================================
   REDUCED MOTION
   =========================================================================== */
@media (prefers-reduced-motion: reduce) {
    .lore-photo.is-drop { opacity: 0; transform: none; }
    .lore-photo.is-dropped { animation: fadeOnly .4s ease forwards; }
    @keyframes fadeOnly { to { opacity: 1; } }
    .lore-bg { background-attachment: scroll; }
    .lore-chapters { transition: opacity .2s ease; }
    .lore-chapters.is-on { transform: none; }
    .lore-photo { transition: none; }
    .lore-photo:hover { transform: none; }
    .lore-cta:hover, .lore-top:hover, .lore-hero__cta:hover, .lore-hero__toc-btn:hover { transition: none; transform: none; }
    .header--lore, .lore-toc, .lore-toc__scrim { transition: none; }
    /* new motion off */
    .reveal-mask > span, .lore-hero__ln > span { transform: none !important; }
    .lore-sec__title::before { transform: scaleY(1) !important; }
}

/* ===========================================================================
   PRINT
   =========================================================================== */
@media print {
    .header--lore, .lore-mhead, .lore-chapters, .lore-top,
    .lore-toc, .lore-toc__scrim, .lore-bg, .lore-grain,
    .lore-hero__toc-btn { display: none !important; }
    .lore-sheet { box-shadow: none !important; background: var(--paper) !important; transform: none !important; }
    .lore-part, .lore-sec { page-break-inside: avoid; }
    .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
    .lore-photo { transform: none !important; }
}

/* ===========================================================================
   ПРАВКИ ОГЛАВЛЕНИЯ
   1) Сверху зиял пустой отступ: панель имела padding-top 90px под фиксированную
      шапку, а поле поиска липло к top:-90px — костыль, из-за которого над
      поиском оставалась пустота. Отступ убираем, поиск липнет к нулю и получает
      собственный фон, чтобы список уезжал под него, а не просвечивал.
   2) Кнопка «наверх» стояла слева снизу поверх открытого оглавления и
      перекрывала пункт. Переносим вправо — там она никому не мешает.
   3) У панели был системный скроллбар. Делаем такой же тонкий красный, как у
      страницы.
   =========================================================================== */
.lore-toc {
    padding-top: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(207, 41, 41, .55) transparent;
    overscroll-behavior: contain;
}
.lore-toc::-webkit-scrollbar { width: 8px; }
.lore-toc::-webkit-scrollbar-track { background: transparent; }
.lore-toc::-webkit-scrollbar-thumb {
    background: rgba(207, 41, 41, .5);
    border: 2px solid transparent;
    background-clip: padding-box;
    border-radius: 8px;
}
.lore-toc:hover::-webkit-scrollbar-thumb { background: rgba(239, 59, 59, .8); background-clip: padding-box; }

.lore-toc__search {
    position: sticky;
    top: 0;
    margin: 0 -18px 14px;
    padding: 16px 18px 12px;
    background: linear-gradient(180deg, rgba(17, 17, 18, .99) 78%, rgba(17, 17, 18, 0));
}

/* кнопка «наверх» — справа, чтобы не накрывать оглавление */
.lore-top { left: auto; right: 20px; }

@media (max-width: 560px) {
    .lore-top { right: 14px; bottom: 14px; }
}

/* ===========================================================================
   КНОПКА DISCORD В ШАПКЕ ЛОРА
   lore.html не подключает polish.css, поэтому кнопка оставалась плоской синей
   из style.css — не тот вид, что на лендинге и в вики. Повторяем фирменный:
   тёмная подложка, светящаяся рамка через маску, пятно следует за курсором.
   =========================================================================== */
.header--lore .header_btn {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    width: auto;
    height: 46px;
    padding: 0 26px;
    gap: 11px;
    border: none;
    border-radius: 12px;
    background: #131417;
    color: #f2f3f5;
    font-weight: 600;
    --mx: 50%;
    --my: 0%;
    box-shadow: 0 0 22px -10px rgba(88, 101, 242, .45);
    transition: transform .3s ease, box-shadow .3s ease;
}
.header--lore .header_btn::after {
    content: "";
    position: absolute; inset: 0;
    border-radius: inherit;
    z-index: -1;
    pointer-events: none;
    background: radial-gradient(circle 130px at var(--mx) var(--my), rgba(88, 101, 242, .30), transparent 60%);
}
.header--lore .header_btn::before {
    content: "";
    position: absolute; inset: 0;
    border-radius: inherit;
    padding: 1.4px;
    pointer-events: none;
    background: radial-gradient(circle 150px at var(--mx) var(--my), #8b95ff, #5865f2 22%, rgba(88, 101, 242, .14) 52%, rgba(88, 101, 242, .08));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
            mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
}
.header--lore .header_btn:hover {
    background: #131417;
    filter: none;
    transform: translateY(-1px);
    box-shadow: 0 0 30px -6px rgba(88, 101, 242, .6);
}
.header--lore .header_btn-ico { width: 22px; height: 22px; flex: 0 0 auto; }

/* логотип шапки лора — то же белое свечение, что на лендинге */
.header--lore .header_logo { transition: filter .2s ease-in-out; }
.header--lore .header_logo:hover { filter: drop-shadow(1px 1px 30px white); }
