/* Redrawn cards (web/js/cardrender.js). Positions are set inline in
   container units: the card is its own size container, so the whole card
   scales with its width, from a thumbnail to the card reveal. */

@font-face {
    font-family: 'IM Fell English';
    src: url('/css/fonts/IMFellEnglish-Regular.ttf') format('truetype');
    font-display: swap;
}

/* The card faces (26 Nov 2026, the user's pick of seven pairings): Grenze
   Gotisch for names, Alegreya for the text (both OFL, Latin subsets). */
@font-face {
    font-family: 'Grenze Gotisch';
    src: url('/css/fonts/GrenzeGotisch.woff2') format('woff2');
    font-weight: 100 900;
    font-display: swap;
}
@font-face {
    font-family: 'Alegreya';
    src: url('/css/fonts/Alegreya.woff2') format('woff2');
    font-weight: 400 900;
    font-display: swap;
}
@font-face {
    font-family: 'Alegreya';
    src: url('/css/fonts/Alegreya-Italic.woff2') format('woff2');
    font-weight: 400 900;
    font-style: italic;
    font-display: swap;
}


/* The other pairings the card gallery can try (CARD_FONTS in cardrender.js;
   ?font=<key>): OFL, Latin-subset woff2, static instances. A browser fetches
   a face only when a card uses it. Each has its OFL-*.txt licence beside it. */
@font-face {
    font-family: 'Cinzel';
    src: url('/css/fonts/Cinzel-Bold.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}
@font-face {
    font-family: 'Crimson Pro';
    src: url('/css/fonts/CrimsonPro.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'Crimson Pro';
    src: url('/css/fonts/CrimsonPro-Bold.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}
@font-face {
    font-family: 'Crimson Pro';
    src: url('/css/fonts/CrimsonPro-Italic.woff2') format('woff2');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: 'Cormorant SC';
    src: url('/css/fonts/CormorantSC-Bold.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}
@font-face {
    font-family: 'EB Garamond';
    src: url('/css/fonts/EBGaramond.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'EB Garamond';
    src: url('/css/fonts/EBGaramond-Bold.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}
@font-face {
    font-family: 'EB Garamond';
    src: url('/css/fonts/EBGaramond-Italic.woff2') format('woff2');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: 'Spectral SC';
    src: url('/css/fonts/SpectralSC-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-display: swap;
}
@font-face {
    font-family: 'Spectral';
    src: url('/css/fonts/Spectral.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'Spectral';
    src: url('/css/fonts/Spectral-Bold.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}
@font-face {
    font-family: 'Spectral';
    src: url('/css/fonts/Spectral-Italic.woff2') format('woff2');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: 'Marcellus SC';
    src: url('/css/fonts/MarcellusSC.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'Libre Caslon Text';
    src: url('/css/fonts/LibreCaslonText.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'Libre Caslon Text';
    src: url('/css/fonts/LibreCaslonText-Bold.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}
@font-face {
    font-family: 'Libre Caslon Text';
    src: url('/css/fonts/LibreCaslonText-Italic.woff2') format('woff2');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: 'Oswald';
    src: url('/css/fonts/Oswald-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-display: swap;
}
@font-face {
    font-family: 'Source Serif 4';
    src: url('/css/fonts/SourceSerif4.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'Source Serif 4';
    src: url('/css/fonts/SourceSerif4-Bold.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}
@font-face {
    font-family: 'Source Serif 4';
    src: url('/css/fonts/SourceSerif4-Italic.woff2') format('woff2');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: 'Barlow Condensed';
    src: url('/css/fonts/BarlowCondensed-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-display: swap;
}
@font-face {
    font-family: 'Barlow';
    src: url('/css/fonts/Barlow.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'Barlow';
    src: url('/css/fonts/Barlow-Bold.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}
@font-face {
    font-family: 'Barlow';
    src: url('/css/fonts/Barlow-Italic.woff2') format('woff2');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: 'Uncial Antiqua';
    src: url('/css/fonts/UncialAntiqua.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'IM Fell DW Pica';
    src: url('/css/fonts/IMFellDWPica.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'IM Fell DW Pica';
    src: url('/css/fonts/IMFellDWPica-Italic.woff2') format('woff2');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: 'IM Fell DW Pica SC';
    src: url('/css/fonts/IMFellDWPicaSC.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}

/* IM Fell's figures are old-style (a 1 reads as an i), so numbers come from a lining serif. */
@font-face {
    font-family: 'Card Digits';
    src: local('Times New Roman'), local('TimesNewRomanPSMT'), local('Liberation Serif'), local('Nimbus Roman'),
        local('Noto Serif'), local('DejaVu Serif');
    unicode-range: U+0030-0039;
}

/* --- Talisman cards (cardrender.js) ---
   The Digital Edition's frame (data/art/ui/*bgsmallpic.webp, 512 x 1024)
   stretched over a 5:8 card; every part is placed in % of the card and
   sized in container units, measured from the frame. */

.rcard {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 5 / 8;
    container-type: inline-size;
    /* The frame's own silver corners are rounded about this much. */
    border-radius: 6.5cqw;
    overflow: hidden;
    background: transparent;
    color: #20170d;
    font-family: 'Crimson Pro', 'EB Garamond', Georgia, serif;
    line-height: 1.12;
    user-select: none;
    box-shadow: 0 0.2rem 0.6rem rgb(0 0 0 / 0.35);
}
.rcard > * { position: absolute; box-sizing: border-box; }

.tk-frame {
    inset: 0;
    background: var(--tc-frame) center / 100% 100% no-repeat;
    pointer-events: none;
}
.tcard--adventure, .tcard--purchase { --tc-frame: url('/data/art/ui/adventurebgsmallpic.webp'); }
.tcard--spell { --tc-frame: url('/data/art/ui/spellsbgsmallpic.webp'); }
.tcard--talisman { --tc-frame: url('/data/art/ui/talismanbgsmallpic.webp'); }

/* The art window (texture x 40-477, y 159-485). */
.tk-art { left: 7.6%; top: 15.2%; width: 85.6%; height: 32.4%; background: #2a2219; overflow: hidden; }
.tk-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 35%; }
/* The Talisman frame's window is painted black: the art goes over it. */
.tcard--talisman .tk-art { z-index: 1; border-radius: 3cqw; }

/* Name strip (x 60-452, y 68-137). */
.tk-name {
    left: 11.7%; top: 6.6%; width: 76.6%; height: 6.8%;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Cinzel', 'Cormorant SC', serif; font-weight: 700;
    font-size: 8.4cqw; letter-spacing: 0.02em; color: #24180c;
    white-space: nowrap; overflow: hidden; text-shadow: 0 0.06em 0 rgb(255 255 240 / 0.5);
}
.tk-name--m { font-size: 7cqw; }
.tk-name--s { font-size: 5.8cqw; }

/* Type plaque (x 136-371, y 503-549). */
.tk-type {
    left: 26.6%; top: 49.1%; width: 45.9%; height: 4.5%;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Marcellus SC', 'Cinzel', serif; font-size: 4.6cqw; color: #f2e6c8;
    white-space: nowrap; overflow: hidden; letter-spacing: 0.02em;
}

/* Encounter number in the gem (centre x 449.5, y 516.5). */
.tk-num {
    left: 87.8%; top: 50.45%; width: 9cqw; height: 9cqw; transform: translate(-50%, -50%);
    display: flex; align-items: center; justify-content: center;
    font-family: 'Cinzel', serif; font-weight: 700; font-size: 6.2cqw; color: #fbf3da;
    text-shadow: 0 0 0.25em #000, 0 0 0.1em #000;
}

/* Text panel (x 44-476, y 575-961). */
.tk-text {
    left: 9.6%; top: 57.2%; width: 80.8%; height: 35.6%;
    display: flex; flex-direction: column; justify-content: center; gap: 0.45em;
    text-align: center; font-size: 6.6cqw; overflow: hidden;
}
.tk-text p { margin: 0; }
.tk-text--l { font-size: 5.9cqw; }
.tk-text--m { font-size: 5.1cqw; }
.tk-text--s { font-size: 4.5cqw; gap: 0.35em; }
.tk-text--xs { font-size: 3.95cqw; gap: 0.3em; line-height: 1.08; }
.tk-stat { font-family: 'Cinzel', serif; font-weight: 700; font-size: 1.12em; letter-spacing: 0.03em; }
.tk-text .kw { text-decoration-thickness: 0.06em; text-underline-offset: 0.12em; }

.tcard--back { background: center / cover no-repeat; }

/* Small cards: the text can't be read, so keep the name and the art. */
@container (max-width: 110px) {
    .tk-text, .tk-type { visibility: hidden; }
    .tk-name { font-size: 10cqw; }
}

/* --- Where cards stand in other boxes --- */

.reveal-face .rcard,
.hud .hud-card .rcard,
.card-peek .rcard,
.combat-enemy .rcard {
    width: auto;
    height: 100%;
    max-width: 100%;
    margin: 0 auto;
}
.choice-card .rcard { height: auto; width: 100%; margin-bottom: 0.3rem; }
.combat-card .rcard { border-radius: 0; }
.card-inspection-image .rcard {
    width: min(100%, calc(62vh * 5 / 8));
    margin: 0 auto;
}
.board-cards .rcard.space-card { aspect-ratio: auto; }

