/* Site look: a Pathfinder tome. Light mode is parchment, dark mode is dungeon stone; Bootstrap 5.3 does the
   switching (data-bs-theme on <html>), this file sets the colours, type and ornaments for both.

   Fonts (Google Fonts, linked in includes/header.php):
     Marcellus SC   headings and the brand: flared Roman capitals, like the lettering on the Core Rulebook
     Alegreya       body text: a book face made for long reading
     Alegreya Sans  buttons, labels, small print: the same family, clean at small sizes

   Change the palette in the two blocks below; everything else reads these variables. */

/* ============================================================ Palette */
:root,
[data-bs-theme="light"] {
    --pf-bg: #f2e8d2;            /* parchment */
    --pf-bg-deep: #e6d6b4;       /* parchment edge (vignette) */
    --pf-panel: #fbf5e7;         /* cards, menus, inputs */
    --pf-panel-2: #f3e9d3;       /* list rows, hover */
    --pf-ink: #2b2017;           /* text */
    --pf-ink-soft: #6a5642;      /* secondary text */
    --pf-heading: #7d1a14;       /* headings: rubric red, like a chapter title */
    --pf-accent: #8e1b17;        /* crimson: buttons, links */
    --pf-accent-hi: #b0261d;
    --pf-gold: #a5761f;          /* gilt: rules, frames, focus */
    --pf-gold-hi: #d0a24a;
    --pf-rule: #cdb98f;          /* hairlines */
    --pf-shadow: 43 32 23;       /* rgb for shadows */
    --pf-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .36 0 0 0 0 .25 0 0 0 0 .12 0 0 0 .13 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

[data-bs-theme="dark"] {
    --pf-bg: #121516;            /* slate */
    --pf-bg-deep: #0a0c0c;
    --pf-panel: #1b2021;
    --pf-panel-2: #222829;
    --pf-ink: #eadcc0;           /* parchment-coloured text */
    --pf-ink-soft: #b2a386;
    --pf-heading: #dcb35e;       /* headings: gilt */
    --pf-accent: #a8261d;        /* ember */
    --pf-accent-hi: #c8402f;
    --pf-gold: #d4a94f;
    --pf-gold-hi: #f0cd7d;
    --pf-rule: #3f3a31;
    --pf-shadow: 0 0 0;
    --pf-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .85 0 0 0 0 .8 0 0 0 0 .7 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ============================================================ Bootstrap, retuned */
:root,
[data-bs-theme="light"],
[data-bs-theme="dark"] {
    --pf-font-display: "Marcellus SC", "Cinzel", Georgia, serif;
    --pf-font-body: "Alegreya", Georgia, "Times New Roman", serif;
    --pf-font-ui: "Alegreya Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --site-header-height: 4.25rem; /* used by css/migrate.css to sit below the sticky navbar */

    --bs-body-font-family: var(--pf-font-body);
    --bs-body-font-size: 1.075rem;
    --bs-body-line-height: 1.6;
    --bs-body-bg: var(--pf-bg);
    --bs-body-color: var(--pf-ink);
    --bs-emphasis-color: var(--pf-ink);
    --bs-heading-color: var(--pf-heading);
    --bs-secondary-color: var(--pf-ink-soft);
    --bs-secondary-bg: var(--pf-panel-2);
    --bs-tertiary-bg: var(--pf-panel-2);
    --bs-border-color: var(--pf-rule);
    --bs-border-color-translucent: color-mix(in srgb, var(--pf-rule) 70%, transparent);
    --bs-link-color: var(--pf-accent);
    --bs-link-hover-color: var(--pf-accent-hi);
    --bs-primary: var(--pf-accent);
    --bs-focus-ring-color: color-mix(in srgb, var(--pf-gold) 45%, transparent);
    --bs-border-radius: .35rem;
    --bs-border-radius-sm: .25rem;
    --bs-border-radius-lg: .5rem;
}

[data-bs-theme="dark"] {
    --bs-link-color: var(--pf-gold);
    --bs-link-hover-color: var(--pf-gold-hi);
}

html {
    scrollbar-color: color-mix(in srgb, var(--pf-gold) 55%, transparent) transparent;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--pf-bg);
    background-image:
        var(--pf-grain),
        radial-gradient(ellipse at 50% 0%, transparent 55%, var(--pf-bg-deep) 130%);
    background-attachment: fixed;
    font-feature-settings: "onum" 1, "kern" 1; /* old-style figures in running text */
}

[data-bs-theme="dark"] body {
    background-image:
        var(--pf-grain),
        radial-gradient(ellipse at 15% -10%, rgb(52 82 86 / .35), transparent 55%),
        radial-gradient(ellipse at 90% 110%, rgb(140 40 24 / .22), transparent 50%),
        radial-gradient(ellipse at 50% 0%, transparent 55%, var(--pf-bg-deep) 130%);
}

body > main {
    flex: 1 0 auto;
}

::selection {
    background: color-mix(in srgb, var(--pf-accent) 80%, transparent);
    color: #fbf3df;
}

/* ============================================================ Backdrop */
/* A great compass behind every page, fixed in the middle of the window, turning once a minute. It sits under the
   content (z-index -1) and shows in the gaps between panels. */
.pf-backdrop {
    position: fixed;
    inset: 0;
    z-index: -1;
    display: grid;
    place-items: center;
    pointer-events: none;
    overflow: hidden;
}

.pf-backdrop svg {
    width: min(88vmin, 52rem);
    height: auto;
    color: var(--pf-gold);
    opacity: .1;
    animation: pf-spin 60s linear infinite;
}

[data-bs-theme="dark"] .pf-backdrop svg {
    opacity: .09;
}

@keyframes pf-spin {
    to { transform: rotate(360deg); }
}

/* ============================================================ Type */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--pf-font-display);
    font-weight: 400;
    letter-spacing: .03em;
    line-height: 1.2;
}

.btn, .form-label, .form-text, .nav-link, .dropdown-item, .badge, .small, small, .alert, .list-group-item .small {
    font-family: var(--pf-font-ui);
}

.form-label {
    font-weight: 500;
    letter-spacing: .02em;
}

a {
    color: var(--bs-link-color);
    text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
    text-underline-offset: .18em;
}

a:hover {
    color: var(--bs-link-hover-color);
    text-decoration-color: currentColor;
}

/* gilded lettering, for the brand and the hero title */
.pf-gilt {
    background: linear-gradient(180deg, #f6dc98 0%, #d9ac52 45%, #a8771f 55%, #e9c46f 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ============================================================ Ornaments */
/* <div class="pf-divider" aria-hidden="true"><span></span></div>: a gilt rule with a lozenge in the middle */
.pf-divider {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin: 1rem auto 1.5rem;
    max-width: 22rem;
    color: var(--pf-gold);
}

.pf-divider::before,
.pf-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, currentColor);
}

.pf-divider::after {
    background: linear-gradient(90deg, currentColor, transparent);
}

.pf-divider > span {
    width: .55rem;
    height: .55rem;
    transform: rotate(45deg);
    border: 1px solid currentColor;
    box-shadow: 0 0 0 3px var(--pf-bg), 0 0 0 4px color-mix(in srgb, currentColor 45%, transparent);
    background: color-mix(in srgb, currentColor 30%, transparent);
}

.card .pf-divider > span {
    box-shadow: 0 0 0 3px var(--pf-panel), 0 0 0 4px color-mix(in srgb, currentColor 45%, transparent);
}

.pf-divider.pf-divider-start {
    margin-left: 0;
}

/* section heading: small-caps title with a gilt rule running out to the right */
.pf-section-title {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.pf-section-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--pf-gold), transparent);
    opacity: .7;
}

/* ============================================================ Header: a carved stone lintel with a gilt edge */
/* The band is dark in both modes. Its bottom edge is a gilt double rule (gold, a hair of shadow, crimson), and the
   compass medallion is set into the middle of it. */
.site-header {
    z-index: 1030;
}

.site-navbar {
    --bs-navbar-color: #cbbd9f;
    --bs-navbar-hover-color: #f6dc98;
    --bs-navbar-active-color: #f6dc98;
    --bs-navbar-padding-y: .55rem;
    min-height: var(--site-header-height);
    background:
        var(--pf-grain),
        radial-gradient(ellipse at 50% 140%, rgb(227 194 122 / .12), transparent 60%),
        linear-gradient(180deg, #2b2622 0%, #1b1715 70%, #151210 100%);
    border-bottom: 1px solid #c79a45;
    box-shadow:
        0 1px 0 #0d0b0a,
        0 3px 0 #7a1a14,
        0 4px 0 #0d0b0a,
        0 10px 24px rgb(0 0 0 / .4);
}

.site-header-medallion {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translate(-50%, 50%);
    display: grid;
    place-items: center;
    width: 2.3rem;
    height: 2.3rem;
    border-radius: 50%;
    color: #e3c27a;
    background: radial-gradient(circle at 40% 35%, #2f2925, #151210 70%);
    border: 1px solid #c79a45;
    box-shadow: 0 0 0 3px #151210, 0 0 0 4px #7a1a14, 0 4px 10px rgb(0 0 0 / .5);
    pointer-events: none;
}

.site-header-medallion svg {
    width: 1.45rem;
    height: 1.45rem;
}

.site-brand {
    display: inline-flex;
    align-items: center;
    gap: .7rem;
    padding-block: 0;
}

.site-brand > .bi-emblem {
    width: 2.4rem;
    height: 2.4rem;
    color: #e3c27a;
    filter: drop-shadow(0 0 5px rgb(227 194 122 / .3));
    transition: transform .8s cubic-bezier(.3, 1.4, .5, 1), filter .3s ease;
}

.site-brand:hover > .bi-emblem,
.site-brand:focus-visible > .bi-emblem {
    transform: rotate(90deg);
    filter: drop-shadow(0 0 9px rgb(227 194 122 / .65));
}

.site-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.site-brand-name {
    font-family: var(--pf-font-display);
    font-size: 1.6rem;
    letter-spacing: .07em;
}

.site-brand-tagline {
    margin-top: .3rem;
    font-family: var(--pf-font-ui);
    font-size: .62rem;
    font-weight: 500;
    letter-spacing: .34em;
    text-transform: uppercase;
    color: #a8926a;
}

#pageStatus {
    color: #b9ab8e;
    font-style: italic;
}

/* Round icon buttons: the glyph warms to gold and glows on hover, like a rune catching torchlight. */
.pf-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 50%;
    background: transparent;
    color: #b9ab8e;
    cursor: pointer;
    transition: color .2s ease, filter .2s ease, background-color .2s ease, border-color .2s ease;
}

.pf-icon-btn svg {
    width: 1.15rem;
    height: 1.15rem;
}

.pf-icon-btn:hover,
.pf-icon-btn:focus-visible,
.pf-icon-btn[aria-expanded="true"] {
    color: #f6dc98;
    border-color: rgb(227 194 122 / .35);
    background-color: rgb(227 194 122 / .08);
    filter: drop-shadow(0 0 .35rem rgb(227 194 122 / .55));
}

.pf-icon-btn:focus-visible {
    outline: 2px solid #e3c27a;
    outline-offset: 2px;
}

.pf-nav-divider {
    width: 1px;
    height: 1.5rem;
    margin-inline: .4rem;
    background: linear-gradient(transparent, #c79a45, transparent);
}

/* Icon labels: a small dark plate with a gilt edge. */
.pf-tooltip {
    --bs-tooltip-bg: #1b1715;
    --bs-tooltip-color: #f0e3c4;
    --bs-tooltip-opacity: 1;
    font-family: var(--pf-font-display);
    letter-spacing: .05em;
}

.pf-tooltip .tooltip-inner {
    border: 1px solid rgb(199 154 69 / .7);
    box-shadow: 0 6px 16px rgb(0 0 0 / .45);
}

/* The theme toggle shows the mode you'll switch to. */
[data-bs-theme="dark"] .theme-icon-to-dark,
[data-bs-theme="light"] .theme-icon-to-light {
    display: none;
}

/* Local SVG icons (classes/logic/Icon.php) sit on the text line like an icon font would. */
svg.bi {
    vertical-align: -0.125em;
}

.pf-icon-btn svg.bi {
    vertical-align: 0;
}

/* the theme toggle wraps its icons in spans; inline spans add a descender gap that pushes the glyph up */
.pf-icon-btn > span {
    display: inline-flex;
}

/* first content clears the medallion */
body > main {
    padding-top: 1.75rem !important;
}

/* ============================================================ Header band: the rules reference's tabs */
/* In the reference the header grows a second row (includes/srd-band.php). The gilt rule moves from the navbar to the
   bottom of the band, the medallion with it; the active tab is drawn in the page colour and breaks through the rule,
   like a bookmark tab joined to its page. Wide screens: four tabs left of the medallion, five right. */
.site-header.has-band .site-navbar {
    border-bottom-color: rgb(199 154 69 / .25);
    box-shadow: none;
}

.pf-band {
    background:
        var(--pf-grain),
        linear-gradient(180deg, #1b1715 0%, #141110 100%);
    border-bottom: 1px solid #c79a45;
    box-shadow:
        0 1px 0 #0d0b0a,
        0 3px 0 #7a1a14,
        0 4px 0 #0d0b0a,
        0 10px 24px rgb(0 0 0 / .4);
}

.pf-band-inner {
    display: grid;
    grid-template-columns: 1fr 3.6rem 1fr;
    align-items: end;
}

.pf-band-tabs {
    display: flex;
    gap: .15rem;
    margin: 0;
    padding: .45rem 0 0;
    list-style: none;
}

.pf-band-left { justify-content: flex-end; }
.pf-band-right { justify-content: flex-start; }

.pf-tab {
    position: relative;
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem .8rem .55rem;
    border: 1px solid transparent;
    border-bottom: 0;
    border-radius: .45rem .45rem 0 0;
    font-family: var(--pf-font-display);
    font-size: 1rem;
    letter-spacing: .04em;
    white-space: nowrap;
    color: #cbbd9f;
    text-decoration: none;
    transition: color .2s ease, background-color .2s ease;
}

.pf-tab svg {
    width: 1rem;
    height: 1rem;
    opacity: .75;
}

.pf-tab:hover {
    color: #f6dc98;
    background: rgb(227 194 122 / .07);
}

.pf-tab[aria-current="page"] {
    z-index: 1;
    margin-bottom: -5px;           /* over the gilt rule and its crimson line */
    padding-bottom: calc(.55rem + 5px);
    color: var(--pf-heading);
    background: var(--pf-bg);
    background-image: var(--pf-grain);
    border-color: #c79a45;
}

.pf-tab[aria-current="page"] svg {
    opacity: 1;
    color: var(--pf-gold);
}

/* Tablets: one row that scrolls sideways; the medallion steps aside so it doesn't sit on a tab. */
@media (max-width: 1199.98px) {
    .pf-band-inner {
        display: flex;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .pf-band-gap { display: none; }
    .pf-band-left, .pf-band-right { justify-content: flex-start; }
    .site-header.has-band .site-header-medallion { display: none; }
}

/* Phones: the band folds open below the navbar as a list. */
@media (max-width: 767.98px) {
    .pf-band-inner { display: block; }
    .pf-band-tabs { flex-direction: column; padding: .25rem 0; }
    .pf-tab { border-radius: .35rem; padding: .55rem .75rem; }
    .pf-tab[aria-current="page"] { margin-bottom: 0; padding-bottom: .55rem; }
}

/* ---- Search box in the navbar (and the big one on the reference's front page) */
.pf-search {
    position: relative;
    align-items: center;
    width: min(20rem, 34vw);
}

.pf-search .form-control {
    padding-right: 2.4rem;
    border-radius: 2rem;
    background-color: rgb(255 255 255 / .06);
    border-color: rgb(199 154 69 / .4);
    color: #f0e3c4;
    font-family: var(--pf-font-ui);
    box-shadow: none;
}

.pf-search .form-control::placeholder {
    color: #8f8269;
}

.pf-search .form-control:focus {
    background-color: rgb(255 255 255 / .1);
    border-color: #e3c27a;
    box-shadow: 0 0 0 .2rem rgb(227 194 122 / .2);
}

.pf-search-go {
    position: absolute;
    right: .35rem;
    display: grid;
    place-items: center;
    width: 1.9rem;
    height: 1.9rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #cbbd9f;
}

.pf-search-go:hover {
    color: #f6dc98;
}

/* ============================================================ Buttons */
.btn {
    --bs-btn-font-weight: 500;
    letter-spacing: .03em;
}

.btn-primary {
    --bs-btn-color: #fbf1dc;
    --bs-btn-bg: var(--pf-accent);
    --bs-btn-border-color: color-mix(in srgb, var(--pf-gold) 70%, #000);
    --bs-btn-hover-color: #fff7e6;
    --bs-btn-hover-bg: var(--pf-accent-hi);
    --bs-btn-hover-border-color: var(--pf-gold);
    --bs-btn-active-color: #fff7e6;
    --bs-btn-active-bg: color-mix(in srgb, var(--pf-accent) 80%, #000);
    --bs-btn-active-border-color: var(--pf-gold);
    --bs-btn-disabled-bg: var(--pf-accent);
    --bs-btn-disabled-border-color: var(--pf-rule);
    --bs-btn-focus-shadow-rgb: 208 162 74;
    background-image: linear-gradient(180deg, rgb(255 255 255 / .14), rgb(0 0 0 / .14));
    box-shadow: inset 0 1px 0 rgb(255 230 180 / .25), 0 1px 2px rgb(var(--pf-shadow) / .35);
    text-shadow: 0 1px 0 rgb(0 0 0 / .35);
}

.btn-outline-secondary {
    --bs-btn-color: var(--pf-ink);
    --bs-btn-border-color: var(--pf-rule);
    --bs-btn-hover-color: var(--pf-ink);
    --bs-btn-hover-bg: var(--pf-panel-2);
    --bs-btn-hover-border-color: var(--pf-gold);
    --bs-btn-active-color: var(--pf-ink);
    --bs-btn-active-bg: var(--pf-panel-2);
    --bs-btn-active-border-color: var(--pf-gold);
}

/* a quiet gilt-edged button, for use on the dark hero */
.btn-pf-ghost {
    --bs-btn-color: #e9dcbf;
    --bs-btn-border-color: rgb(227 194 122 / .55);
    --bs-btn-hover-color: #fff4d6;
    --bs-btn-hover-bg: rgb(227 194 122 / .12);
    --bs-btn-hover-border-color: #e3c27a;
    --bs-btn-active-color: #fff4d6;
    --bs-btn-active-bg: rgb(227 194 122 / .2);
    --bs-btn-active-border-color: #e3c27a;
}

.btn-link {
    text-decoration: none;
}

/* ============================================================ Forms */
.form-control,
.form-select {
    background-color: var(--pf-panel);
    border-color: var(--pf-rule);
    color: var(--pf-ink);
    box-shadow: inset 0 1px 3px rgb(var(--pf-shadow) / .12);
}

.form-control::placeholder {
    color: color-mix(in srgb, var(--pf-ink-soft) 75%, transparent);
    font-style: italic;
}

.form-control:focus,
.form-select:focus {
    background-color: var(--pf-panel);
    color: var(--pf-ink);
    border-color: var(--pf-gold);
    box-shadow: inset 0 1px 3px rgb(var(--pf-shadow) / .12), 0 0 0 .2rem var(--bs-focus-ring-color);
}

.form-check-input:checked {
    background-color: var(--pf-accent);
    border-color: var(--pf-accent);
}

/* ============================================================ Panels: cards, lists, menus, modals */
/* Every card is a framed page: a gilt hairline inset from the edge, like a printed sidebar box. */
.card {
    --bs-card-bg: var(--pf-panel);
    --bs-card-border-color: var(--pf-rule);
    --bs-card-cap-bg: var(--pf-panel-2);
    position: relative;
    box-shadow: 0 1px 2px rgb(var(--pf-shadow) / .12), 0 8px 24px -12px rgb(var(--pf-shadow) / .45);
    outline: 1px solid color-mix(in srgb, var(--pf-gold) 35%, transparent);
    outline-offset: -6px;
}

.card.shadow {
    box-shadow: 0 2px 4px rgb(var(--pf-shadow) / .15), 0 18px 40px -16px rgb(var(--pf-shadow) / .55) !important;
}

.list-group {
    --bs-list-group-bg: var(--pf-panel);
    --bs-list-group-border-color: var(--pf-rule);
    --bs-list-group-action-hover-bg: var(--pf-panel-2);
}

.dropdown-menu {
    --bs-dropdown-bg: var(--pf-panel);
    --bs-dropdown-border-color: color-mix(in srgb, var(--pf-gold) 55%, transparent);
    --bs-dropdown-link-color: var(--pf-ink);
    --bs-dropdown-link-hover-bg: var(--pf-panel-2);
    --bs-dropdown-link-hover-color: var(--pf-accent);
    --bs-dropdown-link-active-bg: var(--pf-accent);
    --bs-dropdown-divider-bg: var(--pf-rule);
    box-shadow: 0 12px 30px -10px rgb(var(--pf-shadow) / .5);
}

.modal {
    --bs-modal-bg: var(--pf-panel);
    --bs-modal-border-color: color-mix(in srgb, var(--pf-gold) 55%, transparent);
    --bs-modal-header-border-color: var(--pf-rule);
    --bs-modal-footer-border-color: var(--pf-rule);
}

.modal-content {
    background-image: var(--pf-grain);
    outline: 1px solid color-mix(in srgb, var(--pf-gold) 30%, transparent);
    outline-offset: -6px;
}

.modal-title {
    font-family: var(--pf-font-display);
}

.alert {
    border-left-width: 4px;
}

.popover {
    --bs-popover-bg: var(--pf-panel);
    --bs-popover-border-color: color-mix(in srgb, var(--pf-gold) 55%, transparent);
    --bs-popover-header-bg: var(--pf-panel-2);
    --bs-popover-body-color: var(--pf-ink);
    font-family: var(--pf-font-body);
}

/* ============================================================ Home: hero (logged out) */
/* Always dark, in both modes: a torch-lit stone hall with the emblem carved large behind the title. */
.pf-hero {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    margin: .5rem 0 2.5rem;
    padding: clamp(2.5rem, 7vw, 5rem) clamp(1.25rem, 5vw, 4rem);
    border-radius: var(--bs-border-radius-lg);
    color: #e9dcbf;
    text-align: center;
    background:
        var(--pf-grain),
        radial-gradient(ellipse at 50% 120%, rgb(176 52 28 / .45), transparent 60%),
        radial-gradient(ellipse at 50% -20%, rgb(227 194 122 / .18), transparent 55%),
        linear-gradient(180deg, #1d2223 0%, #121516 100%);
    border: 1px solid #6b5426;
    outline: 1px solid rgb(227 194 122 / .35);
    outline-offset: -10px;
    box-shadow: 0 30px 60px -30px rgb(0 0 0 / .7);
}

.pf-hero-mark {
    position: absolute;
    z-index: -1;
    left: 50%;
    top: 50%;
    width: min(34rem, 110%);
    height: auto;
    transform: translate(-50%, -50%);
    color: #e3c27a;
    opacity: .13;
    animation: pf-turn 60s linear infinite;
}

@keyframes pf-turn {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.pf-kicker {
    font-family: var(--pf-font-ui);
    font-size: .8rem;
    letter-spacing: .32em;
    text-transform: uppercase;
    color: #c9a65c;
    margin-bottom: 1rem;
}

.pf-hero h1 {
    font-size: clamp(2.4rem, 7vw, 4.4rem);
    letter-spacing: .05em;
    margin-bottom: .25rem;
    filter: drop-shadow(0 2px 0 rgb(0 0 0 / .6)) drop-shadow(0 0 18px rgb(227 194 122 / .18));
}

.pf-hero .pf-tagline {
    font-style: italic;
    font-size: clamp(1.2rem, 2.6vw, 1.55rem);
    color: #d9c9a6;
}

.pf-hero .pf-lead {
    max-width: 38rem;
    margin: 0 auto 2rem;
    color: #bfb090;
}

.pf-hero .pf-divider {
    color: #c9a65c;
}

.pf-hero .pf-divider > span {
    box-shadow: 0 0 0 3px #171b1c, 0 0 0 4px rgb(201 166 92 / .45);
}

.pf-hero .btn-lg {
    padding: .7rem 1.8rem;
}

/* three promises under the hero */
.pf-feature {
    height: 100%;
    padding: 1.6rem 1.4rem 1.4rem;
    text-align: center;
}

.pf-feature-icon {
    display: inline-grid;
    place-items: center;
    width: 3.4rem;
    height: 3.4rem;
    margin-bottom: .9rem;
    border-radius: 50%;
    color: var(--pf-gold);
    background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--pf-gold) 22%, transparent), transparent 70%);
    border: 1px solid color-mix(in srgb, var(--pf-gold) 55%, transparent);
    box-shadow: 0 0 0 4px var(--pf-panel), 0 0 0 5px color-mix(in srgb, var(--pf-gold) 25%, transparent);
}

.pf-feature-icon svg {
    width: 1.5rem;
    height: 1.5rem;
}

.pf-feature h3 {
    font-size: 1.2rem;
    margin-bottom: .5rem;
}

.pf-feature p {
    margin: 0;
    color: var(--pf-ink-soft);
    font-size: 1rem;
}

/* ============================================================ Home: the character roster (logged in) */
.pf-roster {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.pf-character {
    display: flex;
    flex-direction: row; /* .card is a column by default */
    align-items: center;
    gap: .9rem;
    padding: 1rem 1.1rem;
    color: var(--pf-ink);
    text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease;
}

.pf-character:hover {
    color: var(--pf-ink);
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgb(var(--pf-shadow) / .15), 0 16px 30px -14px rgb(var(--pf-shadow) / .6);
}

.min-w-0 {
    min-width: 0; /* lets a flex child truncate its text */
}

.pf-character-name {
    display: block;
    font-family: var(--pf-font-display);
    font-size: 1.15rem;
    line-height: 1.25;
    color: var(--pf-heading);
}

.pf-character-meta {
    display: block;
    font-family: var(--pf-font-ui);
    font-size: .85rem;
    color: var(--pf-ink-soft);
}

/* wax seal with the character's initial */
.pf-seal {
    flex: none;
    display: grid;
    place-items: center;
    width: 2.9rem;
    height: 2.9rem;
    border-radius: 50%;
    font-family: var(--pf-font-display);
    font-size: 1.35rem;
    color: #f6e3bd;
    text-shadow: 0 1px 0 rgb(0 0 0 / .45);
    background: radial-gradient(circle at 35% 30%, #c4382b, #8e1b17 55%, #5c0f0c 100%);
    box-shadow: inset 0 0 0 3px rgb(0 0 0 / .18), inset 0 0 0 4px rgb(255 210 170 / .18), 0 2px 4px rgb(0 0 0 / .35);
}

.pf-seal-draft {
    background: radial-gradient(circle at 35% 30%, #8b8478, #5d574e 55%, #3b3731 100%);
}

.pf-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--pf-ink-soft);
    font-style: italic;
}

.pf-create {
    max-width: 34rem;
}

/* ============================================================ Rules reference pages */
.pf-srd-hero {
    max-width: 46rem;
    margin: 1.5rem auto 0;
    text-align: center;
}

.pf-srd-hero .pf-kicker {
    color: var(--pf-gold);
}

.pf-srd-hero h1 {
    font-size: clamp(2.2rem, 6vw, 3.6rem);
    letter-spacing: .05em;
    margin-bottom: .2rem;
}

.pf-srd-hero .pf-tagline {
    font-style: italic;
    font-size: clamp(1.1rem, 2.4vw, 1.4rem);
    color: var(--pf-ink-soft);
    margin-bottom: 1.6rem;
}

/* the big search: parchment field, crimson button, in one pill */
.pf-search-lg {
    display: flex;
    width: 100%;
    max-width: 40rem;
    margin: 0 auto;
    padding: .35rem;
    border: 1px solid color-mix(in srgb, var(--pf-gold) 60%, transparent);
    border-radius: 3rem;
    background: var(--pf-panel);
    box-shadow: 0 2px 4px rgb(var(--pf-shadow) / .12), 0 14px 30px -14px rgb(var(--pf-shadow) / .5);
}

.pf-search-lg .form-control {
    flex: 1;
    padding: .7rem 1.2rem;
    border: 0;
    border-radius: 3rem;
    background: transparent;
    color: var(--pf-ink);
    font-size: 1.15rem;
    font-family: var(--pf-font-body);
    box-shadow: none;
}

.pf-search-lg .form-control::placeholder {
    color: color-mix(in srgb, var(--pf-ink-soft) 70%, transparent);
}

.pf-search-lg .form-control:focus {
    background: transparent;
    color: var(--pf-ink);
    box-shadow: none;
}

.pf-search-lg:focus-within {
    border-color: var(--pf-gold);
    box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color), 0 14px 30px -14px rgb(var(--pf-shadow) / .5);
}

.pf-search-lg .btn {
    border-radius: 3rem;
    padding-inline: 1.6rem;
}

.pf-quick {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: baseline;
    gap: .4rem .9rem;
    margin-top: 1rem;
    font-family: var(--pf-font-ui);
    font-size: .95rem;
}

.pf-quick-label {
    color: var(--pf-ink-soft);
    font-style: italic;
}

.pf-quick a {
    font-weight: 500;
    text-decoration: none;
}

.pf-quick a:hover {
    text-decoration: underline;
}

/* the nine roots */
.pf-root-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);   /* nine roots: a clean 3 × 3 */
    gap: 1.1rem;
}

@media (max-width: 991.98px) {
    .pf-root-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 575.98px) {
    .pf-root-grid { grid-template-columns: 1fr; }
}

/* four tiles in one row (the Rules hub's At the table) */
.pf-root-grid.pf-root-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 991.98px) {
    .pf-root-grid.pf-root-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 575.98px) {
    .pf-root-grid.pf-root-grid-4 { grid-template-columns: 1fr; }
}

.pf-granted-by {
    align-items: center;
}

.pf-root-card {
    padding: 1.25rem 1.35rem 1.1rem;
    transition: transform .15s ease, box-shadow .15s ease;
}

.pf-root-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgb(var(--pf-shadow) / .15), 0 16px 30px -14px rgb(var(--pf-shadow) / .6);
}

.pf-root-head {
    display: flex;
    align-items: center;
    gap: .9rem;
    margin-bottom: .6rem;
    color: inherit;
    text-decoration: none;
}

.pf-root-head .pf-feature-icon {
    flex: none;
    margin: 0;
}

.pf-root-name {
    display: block;
    font-family: var(--pf-font-display);
    font-size: 1.45rem;
    line-height: 1.15;
    color: var(--pf-heading);
}

.pf-root-head:hover .pf-root-name {
    color: var(--pf-accent-hi);
}

[data-bs-theme="dark"] .pf-root-head:hover .pf-root-name {
    color: var(--pf-gold-hi);
}

.pf-root-count {
    display: block;
    font-family: var(--pf-font-ui);
    font-size: .8rem;
    letter-spacing: .04em;
    color: var(--pf-ink-soft);
}

.pf-root-text {
    margin-bottom: .75rem;
    font-size: 1rem;
    color: var(--pf-ink-soft);
}

.pf-root-links {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin: 0;
}

.pf-root-links a {
    padding: .1rem .7rem;
    border: 1px solid color-mix(in srgb, var(--pf-gold) 45%, transparent);
    border-radius: 2rem;
    font-family: var(--pf-font-ui);
    font-size: .82rem;
    text-decoration: none;
    color: var(--pf-ink);
    background: color-mix(in srgb, var(--pf-gold) 7%, transparent);
}

.pf-root-links a:hover {
    border-color: var(--pf-gold);
    color: var(--pf-accent);
    background: color-mix(in srgb, var(--pf-gold) 15%, transparent);
}

[data-bs-theme="dark"] .pf-root-links a:hover {
    color: var(--pf-gold-hi);
}

.pf-recent {
    margin-top: 2.5rem;
}

/* breadcrumbs */
.pf-crumbs {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    margin-bottom: .5rem;
    font-family: var(--pf-font-ui);
    font-size: .88rem;
    color: var(--pf-ink-soft);
}

.pf-crumbs a {
    color: var(--pf-ink-soft);
    text-decoration: none;
}

.pf-crumbs a:hover {
    color: var(--bs-link-hover-color);
}

.pf-crumbs [aria-current] {
    color: var(--pf-heading);
}

.pf-pending {
    max-width: 40rem;
}

.pf-pending .pf-feature-icon {
    margin-bottom: 1rem;
}

/* ---- Filter bar: type-ahead + chips (Classes page, later the other roots) */
.pf-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem 1rem;
    margin-bottom: 1.5rem;
}

.pf-filter-search {
    position: relative;
    flex: 1 1 18rem;
    max-width: 24rem;
}

.pf-filter-search svg {
    position: absolute;
    left: .9rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--pf-ink-soft);
}

.pf-filter-search .form-control {
    padding-left: 2.4rem;
    border-radius: 2rem;
}

.pf-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}

.pf-chip {
    padding: .25rem .85rem;
    border: 1px solid color-mix(in srgb, var(--pf-gold) 45%, transparent);
    border-radius: 2rem;
    background: color-mix(in srgb, var(--pf-gold) 6%, transparent);
    color: var(--pf-ink);
    font-family: var(--pf-font-ui);
    font-size: .88rem;
    font-weight: 500;
}

.pf-chip:hover {
    border-color: var(--pf-gold);
}

.pf-chip[aria-pressed="true"] {
    background: var(--pf-accent);
    border-color: color-mix(in srgb, var(--pf-gold) 70%, #000);
    color: #fbf1dc;
}

.pf-filter-count {
    margin: 0 0 0 auto;
    font-family: var(--pf-font-ui);
    font-size: .85rem;
    font-style: italic;
    color: var(--pf-ink-soft);
}

/* ---- The class finder (Classes page): rows of segmented choices under the filter bar */
.pf-finder {
    display: grid;
    gap: .55rem;
    margin: -.5rem 0 1.5rem;
    padding: 1rem 1.25rem .75rem;
}

.pf-finder-row {
    display: grid;
    grid-template-columns: 8.5rem 1fr;
    align-items: center;
    gap: .75rem;
}

.pf-finder-label {
    font-family: var(--pf-font-ui);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--pf-ink-soft);
}

.pf-seg {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
}

.pf-seg button {
    padding: .2rem .75rem;
    border: 1px solid color-mix(in srgb, var(--pf-gold) 40%, transparent);
    border-radius: 2rem;
    background: transparent;
    color: var(--pf-ink);
    font-family: var(--pf-font-ui);
    font-size: .86rem;
}

.pf-seg button:hover {
    border-color: var(--pf-gold);
}

.pf-seg button[aria-pressed="true"] {
    background: var(--pf-accent);
    border-color: color-mix(in srgb, var(--pf-gold) 70%, #000);
    color: #fbf1dc;
}

/* "Any" chosen: quieter, so the real choices stand out */
.pf-seg button[data-value=""][aria-pressed="true"] {
    background: color-mix(in srgb, var(--pf-gold) 16%, transparent);
    color: var(--pf-ink);
}

/* facet rows: "All" leads each row, set apart by a gilt rule */
.pf-seg .pf-seg-all {
    margin-right: .35rem;
    font-weight: 700;
    border-style: dashed;
}

.pf-facets {
    margin-top: 0;
}

.pf-finder-foot {
    display: flex;
    justify-content: flex-end;
}

.pf-finder-toggle {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    border-radius: 2rem;
    font-family: var(--pf-font-display);
}

.pf-finder-toggle[aria-expanded="true"] {
    border-color: var(--pf-gold);
    background: color-mix(in srgb, var(--pf-gold) 12%, transparent);
}

@media (max-width: 575.98px) {
    .pf-finder-row { grid-template-columns: 1fr; gap: .3rem; }
}

/* ---- Class cards: | portrait | progression table | notes |, then the Role line. One height for all three
   columns (--pf-class-h): the portrait sets it, the table scrolls inside it. */
.pf-classes {
    --pf-class-h: 270px;
    display: grid;
    gap: 1.25rem;
}

.pf-class {
    padding: 1rem 1.25rem 1.1rem;
    scroll-margin-top: 8rem; /* /srd/classes#skald lands below the sticky header */
}

.pf-class-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .25rem .75rem;
    margin-bottom: .75rem;
}

.pf-class-head h3 {
    margin: 0;
    font-size: 1.55rem;
}

.pf-class-head h3 a {
    color: var(--pf-heading);
    text-decoration: none;
}

.pf-class-head h3 a:hover {
    color: var(--bs-link-hover-color);
}

.pf-badge {
    padding: .05rem .6rem;
    border-radius: 2rem;
    background: color-mix(in srgb, var(--pf-gold) 18%, transparent);
    color: var(--pf-ink);
    font-family: var(--pf-font-ui);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.pf-class-parents {
    font-style: italic;
    color: var(--pf-ink-soft);
}

.pf-class-book {
    margin-left: auto;
    font-family: var(--pf-font-ui);
    font-size: .8rem;
    color: var(--pf-ink-soft);
}

.pf-class-body {
    display: grid;
    grid-template-columns: calc(var(--pf-class-h) * 2 / 3) minmax(15rem, 19rem) 1fr;
    gap: 1rem;
    align-items: start;
}

.pf-class-art {
    width: 100%;
    height: var(--pf-class-h);
    object-fit: cover;
    border-radius: var(--bs-border-radius);
    border: 1px solid color-mix(in srgb, var(--pf-gold) 45%, transparent);
    box-shadow: 0 6px 16px -8px rgb(var(--pf-shadow) / .6);
}

.pf-class-table {
    height: var(--pf-class-h);
    overflow-y: auto;
    border: 1px solid var(--pf-rule);
    border-radius: var(--bs-border-radius);
    background: var(--pf-panel-2);
    scrollbar-width: thin;
}

.pf-class-table:focus-visible {
    outline: 2px solid var(--pf-gold);
    outline-offset: 2px;
}

.pf-class-table table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--pf-font-ui);
    font-size: .88rem;
    font-variant-numeric: lining-nums tabular-nums;
    text-align: center;
}

.pf-class-table thead {
    position: sticky; /* the whole head, so a second row (spell groups) stays with it */
    top: 0;
    z-index: 1;
}

.pf-class-table thead th {
    padding: .4rem .35rem;
    background: var(--pf-panel);
    border-bottom: 1px solid var(--pf-gold);
    font-family: var(--pf-font-display);
    font-weight: 400;
    color: var(--pf-heading);
}

.pf-class-table tbody th,
.pf-class-table td {
    padding: .22rem .35rem;
    border-bottom: 1px solid color-mix(in srgb, var(--pf-rule) 55%, transparent);
}

.pf-class-table tbody th {
    font-weight: 500;
    color: var(--pf-ink-soft);
}

.pf-class-table tbody tr:nth-child(even) {
    background: color-mix(in srgb, var(--pf-gold) 5%, transparent);
}

.pf-class-table td:nth-child(2) {
    text-align: left;
    padding-left: .6rem;
}

/* good saves: gilt, so "Fort & Will" reads at a glance */
.pf-class-table .pf-good {
    color: var(--pf-gold);
    font-weight: 700;
}

[data-bs-theme="light"] .pf-class-table .pf-good {
    color: #8a5f12;
}

.pf-class-notes {
    display: grid;
    gap: 0;
    margin: 0;
    max-height: var(--pf-class-h);
    overflow-y: auto;
}

.pf-class-notes > div {
    display: grid;
    grid-template-columns: 8.5rem 1fr;
    gap: .75rem;
    padding: .32rem 0;
    border-bottom: 1px solid color-mix(in srgb, var(--pf-rule) 55%, transparent);
}

.pf-class-notes > div:last-child {
    border-bottom: 0;
}

.pf-class-notes dt {
    font-family: var(--pf-font-ui);
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--pf-ink-soft);
    padding-top: .15rem;
}

.pf-class-notes dd {
    margin: 0;
    font-size: .98rem;
    line-height: 1.4;
}

/* names that open an "about" popover (the Role, the introduction) */
.pf-pop-trigger {
    text-decoration: underline dotted color-mix(in srgb, var(--pf-gold) 60%, transparent);
    text-decoration-thickness: 1px;
    text-underline-offset: .2em;
}

span.pf-pop-trigger {
    cursor: help;
}

.pf-pop-trigger:focus-visible {
    outline: 2px solid var(--pf-gold);
    outline-offset: 3px;
    border-radius: .2rem;
}

.pf-about-popover {
    --bs-popover-max-width: 34rem;
    --bs-popover-font-size: .98rem;
    font-family: var(--pf-font-body);
}

.pf-about-popover .popover-body {
    max-height: 55vh;
    overflow-y: auto;
    line-height: 1.55;
}

.pf-about-popover p:last-child {
    margin-bottom: 0;
}

.pf-pop-role b {
    font-family: var(--pf-font-display);
    font-weight: 400;
    color: var(--pf-heading);
}

.pf-class-role {
    margin: .9rem 0 0;
    padding-top: .75rem;
    border-top: 1px solid color-mix(in srgb, var(--pf-gold) 35%, transparent);
    font-style: italic;
    color: var(--pf-ink-soft);
}

/* Tablets: portrait + table side by side, notes below. Phones: a banner portrait, then table and notes. */
@media (max-width: 991.98px) {
    .pf-class-body { grid-template-columns: calc(var(--pf-class-h) * 2 / 3) 1fr; }
    .pf-class-notes { grid-column: 1 / -1; max-height: none; }
    .pf-class-book { margin-left: 0; width: 100%; }
}

@media (max-width: 575.98px) {
    .pf-class-body { grid-template-columns: 1fr; }
    .pf-class-art { height: 180px; object-position: 50% 20%; }
    .pf-class-table { height: 220px; }
    .pf-class-notes > div { grid-template-columns: 7rem 1fr; }
}

/* ---- Race cards (Races page): | portrait | facts | racial traits |, the class card's frame. Other races: compact. */
.pf-race-body {
    grid-template-columns: calc(var(--pf-class-h) * 2 / 3) minmax(16rem, 24rem) 1fr;
}

.pf-ability {
    display: inline-block;
    margin: 0 .3rem .25rem 0;
    padding: .02rem .5rem;
    border-radius: .3rem;
    background: color-mix(in srgb, var(--pf-gold) 20%, transparent);
    font-family: var(--pf-font-ui);
    font-size: .85rem;
    font-weight: 700;
    font-variant-numeric: lining-nums tabular-nums;
    white-space: nowrap;
}

.pf-ability.is-minus {
    background: color-mix(in srgb, var(--pf-ink-soft) 14%, transparent);
    color: var(--pf-ink-soft);
}

.pf-race-traits h3 {
    margin: 0 0 .5rem;
    font-size: 1rem;
    color: var(--pf-heading);
}

.pf-trait-tags {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}

/* a racial trait: hover or focus for its rule (js/header.js), click for its place on the race's page */
.pf-trait-tag {
    padding: .12rem .6rem;
    border: 1px solid color-mix(in srgb, var(--pf-gold) 45%, transparent);
    border-radius: 2rem;
    background: var(--pf-panel-2);
    color: var(--pf-ink);
    font-family: var(--pf-font-ui);
    font-size: .85rem;
    text-decoration: none;
}

.pf-trait-tag:hover,
.pf-trait-tag:focus-visible {
    border-color: var(--pf-gold);
    color: var(--pf-heading);
}

/* the race size chart under the Races heading: a folded card, opened from its header or the chevron tab below */
.pf-size-chart {
    position: relative;
    margin: 0 0 1.75rem;
}

.pf-size-chart-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .2rem .9rem;
    width: 100%;
    padding: .6rem 1.1rem;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
}

.pf-size-chart-title {
    font-family: var(--pf-font-display);
    font-size: 1.15rem;
    color: var(--pf-heading);
}

.pf-size-chart-hint {
    font-size: .9rem;
    font-style: italic;
    color: var(--pf-ink-soft);
}

.pf-size-chart-body {
    padding: 0 1rem 1rem;
}

.pf-size-chart-body .pf-zoom {
    display: block;
    width: 100%;
}

/* the mini-tab hanging from the card's bottom edge: chevron down when closed, up when open */
.pf-size-chart-tab {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translate(-50%, 100%);
    display: grid;
    place-items: center;
    width: 3rem;
    height: 1.15rem;
    padding: 0;
    border: 1px solid color-mix(in srgb, var(--pf-gold) 45%, transparent);
    border-top: 0;
    border-radius: 0 0 .6rem .6rem;
    background: var(--pf-panel);
    color: var(--pf-gold);
}

.pf-size-chart-tab svg {
    width: .8rem;
    height: .8rem;
    transform: rotate(90deg);
    transition: transform .2s ease;
}

.pf-size-chart-tab[aria-expanded="true"] svg {
    transform: rotate(-90deg);
}

.pf-size-chart-head:hover .pf-size-chart-title,
.pf-size-chart-tab:hover {
    color: var(--pf-heading);
}

.pf-size-chart-body img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--bs-border-radius);
    border: 1px solid color-mix(in srgb, var(--pf-gold) 45%, transparent);
    box-shadow: 0 6px 16px -8px rgb(var(--pf-shadow) / .6);
}

/* the portrait cards' racial traits in full: name, then the rule, one per row */
.pf-race-rules {
    margin: 0;
}

.pf-race-rules > div {
    padding: .3rem 0;
    border-bottom: 1px solid color-mix(in srgb, var(--pf-rule) 45%, transparent);
    font-size: .93rem;
    line-height: 1.42;
}

.pf-race-rules > div:last-child {
    border-bottom: 0;
}

.pf-race-rules dt {
    display: inline;
    font-family: var(--pf-font-display);
    font-weight: 400;
}

.pf-race-rules dt a {
    color: var(--pf-heading);
    text-decoration: none;
}

.pf-race-rules dt::after {
    content: ": ";
    color: var(--pf-ink-soft);
}

.pf-race-rules dd {
    display: inline;
    margin: 0;
}

.pf-race-more {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem 1rem;
    margin: .9rem 0 0;
    padding: .6rem 0 0;
    border-top: 1px solid color-mix(in srgb, var(--pf-gold) 30%, transparent);
    list-style: none;
    font-family: var(--pf-font-ui);
    font-size: .88rem;
}

.pf-about-popover .popover-header {
    font-family: var(--pf-font-display);
    font-weight: 400;
    color: var(--pf-heading);
}

.pf-races-other {
    margin-top: 1.5rem;
}

.pf-races-other-title {
    margin: 0 0 .75rem;
    font-size: 1.3rem;
}

.pf-race-line {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 .1rem;
    margin-top: .4rem;
    font-family: var(--pf-font-ui);
    font-size: .85rem;
    color: var(--pf-ink-soft);
}

.pf-race-line > span:not(.pf-ability) {
    margin-left: .3rem;
}

.pf-races-other .pf-trait-tags {
    margin-top: .5rem;
}

.pf-races-other .pf-trait-tag {
    font-size: .78rem;
}

.pf-finder-hint {
    margin: .25rem 0 0;
    font-size: .85rem;
    font-style: italic;
    color: var(--pf-ink-soft);
}

/* the race's page: standard traits and favored class options as label | rule rows */
.pf-race-traitlist {
    margin: 0;
}

.pf-race-traitlist > div {
    display: grid;
    grid-template-columns: 13rem 1fr;
    gap: 1rem;
    padding: .55rem 0;
    border-bottom: 1px solid color-mix(in srgb, var(--pf-rule) 55%, transparent);
    scroll-margin-top: 8rem;
}

.pf-race-traitlist dt {
    font-family: var(--pf-font-display);
    font-weight: 400;
    color: var(--pf-heading);
}

.pf-race-traitlist dd {
    margin: 0;
}

.pf-race-traitlist dd p:last-of-type {
    margin-bottom: 0;
}

.pf-favored dd .pf-class-book {
    display: block;
    margin-top: .2rem;
}

.pf-race-about summary {
    cursor: pointer;
    font-style: italic;
    color: var(--pf-ink-soft);
}

.pf-race-about .pf-more {
    font-family: var(--pf-font-ui);
    font-size: .85rem;
    font-style: normal;
    color: var(--bs-link-color);
}

.pf-race-about[open] .pf-more {
    display: none;
}

.pf-race-about .pf-rules {
    margin-top: .75rem;
}

.pf-replaces {
    font-family: var(--pf-font-ui);
    font-size: .82rem;
    font-style: italic;
    color: var(--pf-ink-soft);
}

.pf-section-note {
    margin: -.25rem 0 .75rem;
    font-size: .95rem;
    color: var(--pf-ink-soft);
}

@media (max-width: 991.98px) {
    .pf-race-body { grid-template-columns: calc(var(--pf-class-h) * 2 / 3) 1fr; }
    .pf-race-traits { grid-column: 1 / -1; }
}

@media (max-width: 575.98px) {
    .pf-race-body { grid-template-columns: 1fr; }
    .pf-race-traitlist > div { grid-template-columns: 1fr; gap: .2rem; }
}

/* ---- Feat cards (Feats page): name, types, book; opening line; prerequisites and what it leads to; the tree button.
   3,400+ cards: the browser skips laying out the ones off screen (content-visibility). */
/* a ranked filter's section line ("Leads to", "Also mentions"): across the whole grid, a rule with its label */
.pf-rank-divider {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: .75rem;
    margin: .6rem 0 .1rem;
    font-family: var(--pf-font-ui);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--pf-ink-soft);
}

tr.pf-rank-divider td {
    padding: .5rem .55rem .25rem;
    border-bottom: 1px solid color-mix(in srgb, var(--pf-gold) 45%, transparent);
    font-family: var(--pf-font-ui);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--pf-ink-soft);
}

p..pf-rank-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: color-mix(in srgb, var(--pf-gold) 45%, transparent);
}

.pf-feats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(24rem, 1fr));
    gap: .75rem;
}

.pf-feat {
    padding: .75rem 1rem .8rem;
    content-visibility: auto;
    contain-intrinsic-size: auto 10rem;
    scroll-margin-top: 8rem;
}

.pf-feat-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .2rem .5rem;
}

.pf-feat-head h2 {
    margin: 0 .2rem 0 0;
    font-size: 1.15rem;
}

.pf-feat-head h2 a {
    color: var(--pf-heading);
    text-decoration: none;
}

.pf-feat-head .pf-badge {
    font-size: .68rem;
}

.pf-feat-summary {
    margin: .35rem 0 .45rem;
    font-size: .95rem;
    font-style: italic;
    color: var(--pf-ink-soft);
}

.pf-feat-facts {
    margin: 0;
}

.pf-feat-facts > div {
    display: grid;
    grid-template-columns: 7.5rem 1fr;
    gap: .6rem;
    padding: .2rem 0;
    border-top: 1px solid color-mix(in srgb, var(--pf-rule) 45%, transparent);
}

.pf-feat-facts dt {
    font-family: var(--pf-font-ui);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--pf-ink-soft);
    padding-top: .2rem;
}

.pf-feat-facts dd {
    margin: 0;
    font-size: .93rem;
    line-height: 1.4;
}

.pf-feat-facts-page {
    margin: 0 0 1rem;
}

.pf-none {
    color: var(--pf-ink-soft);
}

.pf-chip-select {
    width: auto;
    display: inline-block;
}

.pf-chip-select.is-active {
    border-color: var(--pf-gold);
    background-color: color-mix(in srgb, var(--pf-gold) 18%, transparent);
}

/* a dropdown's open list takes the select's background, and a see-through one (the chosen state above) leaves the
   browser to fall back to a light list: give the options the page's own colours, and tell the browser which theme
   its controls are in */
[data-bs-theme="dark"] select {
    color-scheme: dark;
}

[data-bs-theme="light"] select {
    color-scheme: light;
}

select option,
select optgroup {
    background-color: var(--pf-panel);
    color: var(--pf-ink);
}

.pf-tree-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin-top: .55rem;
    padding: .15rem .65rem;
    border: 1px solid color-mix(in srgb, var(--pf-gold) 50%, transparent);
    border-radius: 2rem;
    background: transparent;
    color: var(--pf-ink);
    font-family: var(--pf-font-ui);
    font-size: .82rem;
}

.pf-tree-btn:hover,
.pf-tree-btn:focus-visible {
    border-color: var(--pf-gold);
    color: var(--pf-heading);
}

.pf-tree-count {
    color: var(--pf-ink-soft);
    font-variant-numeric: lining-nums tabular-nums;
}

/* ---- Race Builder (/srd/races/builder): quality tables, RP costs (negative = gives RP back) */
.pf-rb-table {
    margin: .5rem 0 1rem;
    overflow-x: auto;
    border: 1px solid var(--pf-rule);
    border-radius: var(--bs-border-radius);
    background: var(--pf-panel-2);
}

.pf-rb-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: .93rem;
    line-height: 1.42;
}

.pf-rb-table thead th {
    padding: .45rem .6rem;
    background: var(--pf-panel);
    border-bottom: 1px solid var(--pf-gold);
    font-family: var(--pf-font-display);
    font-weight: 400;
    color: var(--pf-heading);
    text-align: left;
    white-space: nowrap;
}

.pf-rb-table tbody th,
.pf-rb-table td {
    padding: .45rem .6rem;
    vertical-align: top;
    text-align: left;
    border-bottom: 1px solid color-mix(in srgb, var(--pf-rule) 55%, transparent);
}

.pf-rb-table tbody th {
    font-family: var(--pf-font-display);
    font-weight: 400;
    color: var(--pf-heading);
    white-space: nowrap;
}

.pf-rb-table td ul {
    margin: .3rem 0 0;
    padding-left: 1.1rem;
}

.pf-rp {
    font-family: var(--pf-font-ui);
    font-weight: 700;
    white-space: nowrap;
    color: var(--pf-gold);
}

.pf-rp-badge {
    padding: .02rem .5rem;
    border-radius: .3rem;
    background: color-mix(in srgb, var(--pf-gold) 22%, transparent);
    font-family: var(--pf-font-ui);
    font-size: .78rem;
    font-weight: 700;
    white-space: nowrap;
}

.pf-rp.is-negative,
.pf-rp-badge.is-negative {
    color: #6fae8f; /* gives RP back */
}

/* trait categories: one closed accordion section each, tiers as subheadings inside */
.pf-rb-groups {
    display: grid;
    gap: .6rem;
}

.pf-rb-group > summary {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .2rem .7rem;
    padding: .6rem 1rem;
    cursor: pointer;
    list-style: none;
}

.pf-rb-group > summary::-webkit-details-marker {
    display: none;
}

.pf-rb-group > summary::before {
    content: "▸";
    color: var(--pf-gold);
    transition: transform .15s ease;
}

.pf-rb-group[open] > summary::before {
    transform: rotate(90deg);
}

.pf-rb-group-name {
    font-family: var(--pf-font-display);
    font-size: 1.1rem;
    color: var(--pf-heading);
}

.pf-rb-group-tiers {
    margin-left: auto;
    font-family: var(--pf-font-ui);
    font-size: .8rem;
    color: var(--pf-ink-soft);
}

.pf-rb-group-body {
    padding: 0 1rem 1rem;
}

.pf-rb-tier {
    margin: .75rem 0 .4rem;
    font-family: var(--pf-font-ui);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--pf-ink-soft);
}

/* long quality text: a few lines, then "… more" */
.pf-clamp-box {
    max-height: 4.4em;
    overflow: hidden;
}

.pf-clamp-box.is-open {
    max-height: none;
}

.pf-clamp-more {
    margin-top: .15rem;
    padding: 0;
    border: 0;
    background: none;
    color: var(--bs-link-color);
    font-family: var(--pf-font-ui);
    font-size: .85rem;
}

.pf-onpage-sub {
    padding-left: .8rem;
    font-size: .9em;
}

/* ---- The spellbook table (Spells page): one row per spell, the head stays on top while scrolling.
   Full width (container-fluid): eight columns need the room. Narrow screens drop casting, range, duration, save. */
.pf-spells-page {
    max-width: 1800px;
}

.pf-level-pills button {
    min-width: 2rem;
}

.pf-spellbook {
    max-height: calc(100vh - 14rem);
    overflow: auto;
    border: 1px solid var(--pf-rule);
    border-radius: var(--bs-border-radius);
    background: var(--pf-panel-2);
}

.pf-spellbook table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
    line-height: 1.35;
}

.pf-spellbook thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: .45rem .55rem;
    background: var(--pf-panel);
    border-bottom: 1px solid var(--pf-gold);
    font-family: var(--pf-font-display);
    font-weight: 400;
    color: var(--pf-heading);
    text-align: left;
    white-space: nowrap;
}

.pf-spellbook tbody th,
.pf-spellbook td {
    padding: .3rem .55rem;
    vertical-align: top;
    text-align: left;
    border-bottom: 1px solid color-mix(in srgb, var(--pf-rule) 45%, transparent);
}

.pf-spellbook tbody th {
    font-weight: 500;
    white-space: nowrap;
}

.pf-spellbook tbody th a {
    color: var(--pf-heading);
    text-decoration: none;
}

.pf-spellbook tbody th a:hover {
    text-decoration: underline;
}

.pf-spellbook tbody tr:not(.pf-level-head):hover {
    background: color-mix(in srgb, var(--pf-gold) 7%, transparent);
}

.pf-spellbook .pf-sp-lvl {
    text-align: center;
    font-family: var(--pf-font-ui);
    font-weight: 700;
    font-variant-numeric: lining-nums tabular-nums;
    color: var(--pf-gold);
    white-space: nowrap;
}

.pf-spellbook .pf-sp-school {
    white-space: nowrap;
    color: var(--pf-ink-soft);
}

.pf-spellbook .pf-sp-opt {
    max-width: 12rem;
    font-size: .85rem;
}

.pf-spellbook .pf-sp-sum {
    min-width: 18rem;
    color: var(--pf-ink-soft);
}

.pf-spellbook .pf-sp-sum span {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pf-spellbook .pf-level-head th {
    position: sticky;
    top: 2.2rem;
    z-index: 1;
    padding: .5rem .55rem .35rem;
    background: color-mix(in srgb, var(--pf-gold) 14%, var(--pf-panel));
    font-family: var(--pf-font-display);
    font-weight: 400;
    font-size: 1rem;
    color: var(--pf-heading);
}

@media (max-width: 991.98px) {
    .pf-spellbook .pf-sp-opt { display: none; }
}

@media (max-width: 575.98px) {
    .pf-spellbook .pf-sp-school { display: none; }
    .pf-spellbook .pf-sp-sum { min-width: 12rem; }
}

/* ---- Equipment: the hub's shelves and search, and the list pages (the spellbook table, sortable heads) */
.pf-eq-shelf {
    margin: 2rem 0 1rem;
}

.pf-root-card.is-pending {
    opacity: .55;
}

.pf-root-card.is-pending:hover {
    transform: none;
    box-shadow: none;
}

.pf-eq-results {
    columns: 2 22rem;
    column-gap: 2rem;
    margin: 0 0 2rem;
    padding: 0;
    list-style: none;
}

.pf-eq-results li {
    display: flex;
    gap: .75rem;
    justify-content: space-between;
    align-items: baseline;
    padding: .35rem .25rem;
    border-bottom: 1px solid color-mix(in srgb, var(--pf-rule) 45%, transparent);
    break-inside: avoid;
}

.pf-eq-group {
    font-size: .8rem;
    color: var(--pf-ink-soft);
    white-space: nowrap;
}

/* ---- Condition and monster-rule terms in rules text: a dotted underline, the rule on hover, focus or tap */
.pf-term {
    text-decoration: underline dotted color-mix(in srgb, var(--pf-gold) 70%, transparent);
    text-underline-offset: 3px;
    cursor: help;
}

.pf-term:hover,
.pf-term:focus-visible {
    color: var(--pf-heading);
    outline: none;
}

.pf-term-popover {
    max-width: 26rem;
}

.pf-term-popover .popover-body p {
    margin-bottom: .45rem;
}

.pf-term-more {
    margin: .2rem 0 0;
    font-size: .8rem;
}

/* ---- License page: the OGL in small print, Section 15 as a compact list */
.pf-license-text p,
.pf-license-notice li {
    font-size: .85rem;
    color: var(--pf-ink-soft);
}

.pf-license-notice {
    padding-left: 1.1rem;
}

.pf-license-notice li {
    margin-bottom: .3rem;
}

/* ---- Spheres: the hub (a first lesson: intro, class picker, three system cards, steps) and its lists */
.pf-sphere-finder {
    position: relative;
    width: min(18rem, 45%);
}

.pf-sphere-results {
    position: absolute;
    z-index: 20;
    top: calc(100% + .25rem);
    right: 0;
    width: min(28rem, 90vw);
    max-height: 60vh;
    overflow-y: auto;
    margin: 0;
    padding: .5rem .8rem;
    list-style: none;
}

.pf-sphere-results:empty {
    display: none;
}

.pf-sphere-results li {
    padding: .15rem 0;
}

.pf-sphere-intro {
    margin-top: 1rem;
    padding: 1rem 1.25rem .5rem;
}

.pf-sphere-intro .pf-rules p:last-child {
    margin-bottom: .4rem;
}

.pf-sphere-class {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin: 1rem 0 .5rem;
}

.pf-sphere-class .form-select {
    width: auto;
    min-width: 14rem;
}

.pf-sphere-answer {
    margin-bottom: .5rem;
    padding: .9rem 1.2rem;
}

.pf-sphere-answer p {
    margin-bottom: .45rem;
}

.pf-sphere-swaps {
    margin: 0 0 .45rem;
    padding-left: 1.2rem;
}

.pf-sphere-systems {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.1rem;
    margin-top: 1.5rem;
}

@media (max-width: 991.98px) {
    .pf-sphere-systems { grid-template-columns: 1fr; }
}

.pf-sphere-system {
    display: flex;
    flex-direction: column;
    padding: 1.1rem 1.25rem;
}

.pf-sphere-terms dt {
    margin-top: .5rem;
    font-weight: 600;
}

.pf-sphere-terms dd {
    margin: 0;
    font-size: .92rem;
}

.pf-sphere-count {
    margin: auto 0 .5rem;   /* the spheres sit at the card's foot, level across the three */
    padding-top: .75rem;
    border-top: 1px solid color-mix(in srgb, var(--pf-rule) 45%, transparent);
    font-size: .85rem;
    font-weight: 600;
    color: var(--pf-ink-soft);
}

.pf-sphere-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
}

.pf-sphere-chips .pf-chip {
    text-decoration: none;
}

.pf-sphere-steps li {
    margin-bottom: .4rem;
}

.pf-sphere-links {
    columns: 15rem;
    column-gap: 1.5rem;
    margin: 0 0 1.25rem;
    padding: 0;
    list-style: none;
}

.pf-sphere-links li {
    break-inside: avoid;
    padding: .12rem 0;
}

/* a page title with a related link at its right (Rules: FAQ & Errata) */
.pf-title-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.pf-title-row .pf-section-title {
    flex: 1;
    margin-bottom: 0;
}

.pf-title-row + * {
    margin-top: 1rem;
}

/* ---- FAQ: the box on an entry page, and the FAQ page's answers */
.pf-faq-box {
    margin-top: 1.5rem;
    padding: .7rem 1.1rem;
}

.pf-faq-box > summary {
    cursor: pointer;
}

.pf-faq-title {
    font-family: var(--pf-font-display);
    color: var(--pf-heading);
}

.pf-faq-item {
    padding: .7rem 0;
    border-top: 1px solid color-mix(in srgb, var(--pf-rule) 45%, transparent);
}

.pf-faq-q {
    margin-bottom: .35rem;
    font-weight: 600;
    color: var(--pf-heading);
}

.pf-faq-a p {
    margin-bottom: .4rem;
}

.pf-faq-source {
    margin: 0;
    font-size: .8rem;
    color: var(--pf-ink-soft);
}

.pf-faq-list {
    display: grid;
    gap: .6rem;
}

.pf-faq-card {
    padding: .9rem 1.2rem;
    border-top: 1px solid var(--pf-rule);
}

/* ---- Search: the suggestions under a search box, and the results page */
.pf-suggest-host {
    position: relative;
}

.pf-suggest {
    position: absolute;
    top: calc(100% + .35rem);
    left: 0;
    right: 0;
    z-index: 1050;
    min-width: 20rem;
    max-height: 70vh;
    margin: 0;
    padding: .3rem 0;
    overflow: auto;
    list-style: none;
    border: 1px solid var(--pf-gold);
    border-radius: var(--bs-border-radius);
    background: var(--pf-panel);
    box-shadow: 0 12px 30px -10px rgb(var(--pf-shadow) / .7);
    text-align: left;
}

.pf-suggest a {
    display: flex;
    flex-direction: column;
    padding: .35rem .8rem;
    color: var(--pf-ink);
    text-decoration: none;
}

.pf-suggest [aria-selected="true"] a,
.pf-suggest a:hover {
    background: color-mix(in srgb, var(--pf-gold) 14%, transparent);
}

.pf-suggest-name {
    color: var(--pf-heading);
}

.pf-suggest-kind {
    font-size: .78rem;
    color: var(--pf-ink-soft);
}

.pf-suggest-all {
    margin-top: .2rem;
    border-top: 1px solid var(--pf-rule);
}

.pf-suggest-all a {
    font-size: .85rem;
    color: var(--pf-gold);
}

.pf-search-page-box {
    flex: 1 1 30rem;
    max-width: 40rem;
}

.pf-search-results {
    padding: 0;
    list-style: none;
}

.pf-search-results li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .25rem .75rem;
    padding: .45rem .25rem;
    border-bottom: 1px solid color-mix(in srgb, var(--pf-rule) 45%, transparent);
}

.pf-search-results li > a {
    font-size: 1.05rem;
}

.pf-search-note {
    font-size: .85rem;
    color: var(--pf-ink-soft);
}

.pf-search-excerpt {
    flex-basis: 100%;
    margin: .1rem 0 0;
    font-size: .88rem;
    color: var(--pf-ink-soft);
}

.pf-search-excerpt mark {
    padding: 0 .1rem;
    border-radius: .2rem;
    background: color-mix(in srgb, var(--pf-gold) 30%, transparent);
    color: var(--pf-ink);
}

.pf-search-more {
    justify-content: center;
    border-bottom: 0 !important;
}

/* ---- Rules: the hub's book cards and optional rules, a section page with its chapter tree beside it */
.pf-rule-books {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
    gap: 1rem;
}

.pf-rule-book {
    padding: 1rem 1.2rem;
}

.pf-rule-book h3 {
    margin-bottom: .6rem;
    font-family: var(--pf-font-display);
    color: var(--pf-heading);
}

.pf-rule-book ul {
    margin: 0;
    padding: 0;
    list-style: none;
    columns: 1;
}

.pf-rule-book li {
    padding: .12rem 0;
}

.pf-rule-optional {
    display: block;
    margin-bottom: .5rem;
    padding: .7rem 1rem;
    color: inherit;
    text-decoration: none;
}

.pf-rule-optional:hover .pf-option-name {
    text-decoration: underline;
}

.pf-rule-layout {
    display: grid;
    grid-template-columns: 17rem minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
}

.pf-rule-tree {
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow: auto;
    padding: .8rem .9rem;
    border: 1px solid var(--pf-rule);
    border-radius: var(--bs-border-radius);
    background: var(--pf-panel-2);
    font-size: .85rem;
}

.pf-rule-tree ul {
    margin: 0;
    padding-left: .9rem;
    list-style: none;
}

.pf-rule-tree > ul {
    padding-left: 0;
}

.pf-rule-tree li {
    padding: .1rem 0;
}

.pf-rule-tree a {
    color: var(--pf-ink-soft);
    text-decoration: none;
}

.pf-rule-tree a:hover {
    color: var(--pf-heading);
    text-decoration: underline;
}

.pf-rule-tree .is-current > a {
    color: var(--pf-gold);
    font-weight: 700;
}

.pf-rule-main {
    max-width: 52rem;
}

.pf-rule-children {
    padding: 0;
    list-style: none;
}

.pf-rule-children li {
    padding: .45rem 0;
    border-bottom: 1px solid color-mix(in srgb, var(--pf-rule) 45%, transparent);
}

.pf-rule-children li > span {
    display: block;
    font-size: .85rem;
    color: var(--pf-ink-soft);
}

.pf-rule-pager {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--pf-rule);
}

.pf-rule-next {
    margin-left: auto;
    text-align: right;
}

@media (max-width: 991.98px) {
    .pf-rule-layout { grid-template-columns: 1fr; }
    .pf-rule-tree { position: static; max-height: 18rem; order: 2; }
}

.pf-conditions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(22rem, 1fr));
    gap: 1rem;
    align-items: start;
}

.pf-condition {
    padding: 1rem 1.2rem .4rem;
    scroll-margin-top: 1rem;
}

.pf-condition:target {
    border-color: var(--pf-gold);
    box-shadow: 0 0 0 1px var(--pf-gold);
}

.pf-condition h2 {
    margin: 0;
    font-family: var(--pf-font-display);
    color: var(--pf-heading);
}

.pf-condition-chain {
    margin: .35rem 0 .5rem;
    font-size: .85rem;
    color: var(--pf-ink-soft);
}

.pf-condition-chain strong {
    color: var(--pf-gold);
}

.pf-condition .pf-rules {
    font-size: .92rem;
}

/* ---- Bestiary: a creature's page */
.pf-monster-cr {
    margin-left: .4rem;
    padding: .1rem .6rem;
    border: 1px solid var(--pf-gold);
    border-radius: 2rem;
    font-family: var(--pf-font-ui);
    font-size: .45em;
    font-weight: 700;
    letter-spacing: .06em;
    color: var(--pf-gold);
    vertical-align: middle;
}

.pf-monster-identify {
    padding: .6rem .9rem;
    border-left: 3px solid var(--pf-gold);
    background: color-mix(in srgb, var(--pf-gold) 8%, transparent);
    font-size: .92rem;
}

.pf-statblock h3 {
    margin-top: 1rem;
    padding-bottom: .15rem;
    border-bottom: 1px solid var(--pf-gold);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: .06em;
}

/* a group of filters on a faint panel of its own (Monster Finder: CR, subtypes, size, alignment...) */
.pf-filter-group {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    padding: .3rem .45rem;
    border: 1px solid color-mix(in srgb, var(--pf-rule) 60%, transparent);
    border-radius: var(--bs-border-radius);   /* the dropdowns' corners, not the pills' */
    background: color-mix(in srgb, var(--pf-panel-2) 40%, transparent);
}

.pf-filter-group .pf-seg-label {
    padding-left: .35rem;
}

/* a label standing in a group by itself ("Type" before the chips): the pill groups' own label style */
.pf-filter-group > .pf-seg-label {
    font-family: var(--pf-font-ui);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--pf-ink-soft);
}

/* the filters behind a button (Monster Finder): closed, the search, the button and the count share one row;
   open, the panel takes the column beside them */
.pf-filter.pf-filter-panel:not(.is-open) {
    grid-template-columns: minmax(15rem, 28rem) auto;
}

.pf-filter-side-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}

.pf-filter-toggle .pf-filter-active:not(:empty) {
    margin-left: .3rem;
    padding: 0 .4rem;
    border-radius: 1rem;
    background: var(--pf-gold);
    color: var(--pf-panel);
    font-size: .75rem;
    font-weight: 700;
}

.pf-filter-toggle[aria-expanded="true"] {
    border-color: var(--pf-gold);
}

/* a from / to pair of dropdowns (CR) */
.pf-range-to {
    font-size: .85rem;
    color: var(--pf-ink-soft);
}

.pf-range .pf-chip-select {
    min-width: 6.5rem;
}

/* a chain of dropdowns joined by And / Or */
.pf-chain,
.pf-chain-link {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
}

.pf-chain .pf-chip-select {
    max-width: 12rem;
}

.pf-chain-link[hidden] {
    display: none;
}

/* a filter panel (Monster Finder): the search and the count in a column of their own, beside it full-width bars of
   filters, all the same width, each a faint panel; groups inside a bar are told apart by their labels */
.pf-filter.pf-filter-panel {
    display: grid;
    grid-template-columns: minmax(15rem, 20rem) minmax(0, 1fr);
    gap: 1rem;
    align-items: stretch;
}

.pf-filter-side {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: .75rem;
}

.pf-filter-side .pf-filter-search {
    max-width: none;
    flex: 0 0 auto;
}

.pf-filter-side .pf-filter-count {
    margin: 0;
}

.pf-filter-bars {
    display: flex;
    flex-direction: column;
    gap: .45rem;
}

.pf-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .45rem 1.4rem;
    padding: .35rem .6rem;
    border: 1px solid color-mix(in srgb, var(--pf-rule) 60%, transparent);
    border-radius: var(--bs-border-radius);
    background: color-mix(in srgb, var(--pf-panel-2) 40%, transparent);
}

.pf-filter-labelled {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
}

.pf-filter-bar > .pf-seg-label,
.pf-filter-bar label.pf-seg-label {
    margin: 0;
    padding: 0 .1rem 0 0;
    font-family: var(--pf-font-ui);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--pf-ink-soft);
}

.pf-filter-bar > .pf-seg-label {
    margin-right: -.9rem;   /* "Type" sits next to its chips, not a group's width away */
}

@media (max-width: 991.98px) {
    .pf-filter.pf-filter-panel { grid-template-columns: 1fr; }
}

/* a filter bar of full rows, all flush left: the search box sits in the first row */
.pf-filter.pf-filter-stack {
    flex-direction: column;
    align-items: stretch;
    gap: .6rem;
}

.pf-filter-stack .pf-filter-search {
    flex: 0 1 22rem;
}

/* a book's abbreviation (B4, AP96): its title on hover, focus or tap */
abbr.pf-book {
    text-decoration: underline dotted color-mix(in srgb, var(--pf-ink-soft) 60%, transparent);
    text-underline-offset: 3px;
    cursor: help;
}

/* two subtype dropdowns joined by And / Or (Monster Finder): kept together on one line */
.pf-subtype-pair {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: .35rem;
}

.pf-subtype-pair .pf-chip-select {
    max-width: 12rem;
}

.pf-hazard-facts {
    display: block;
    margin-top: .25rem;
    font-size: .85rem;
    color: var(--pf-ink-soft);
}

.pf-hazard-facts b {
    color: var(--pf-ink);
}

.pf-monster-family {
    columns: 2 14rem;
    padding: 0;
    list-style: none;
}

.pf-monster-family li {
    padding: .15rem 0;
    break-inside: avoid;
}

.pf-yes {
    color: var(--pf-gold);
    font-weight: 700;
}

.pf-skill-ability {
    font-size: .6em;
    color: var(--pf-ink-soft);
}

/* ---- Companions: each type's folded rules and progression, the stages table on an animal companion's page */
.pf-comp-rules {
    margin-bottom: 1rem;
    padding: .8rem 1.2rem;
}

.pf-comp-rules > summary {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem 1rem;
    align-items: baseline;
    cursor: pointer;
}

.pf-comp-rules-title {
    font-family: var(--pf-font-display);
    font-size: 1.1rem;
    color: var(--pf-heading);
}

.pf-comp-rules[open] > summary {
    margin-bottom: .8rem;
    padding-bottom: .6rem;
    border-bottom: 1px solid var(--pf-rule);
}

.pf-comp-rules .pf-rules table {
    font-size: .85rem;
}

/* a filter bar as a 2 × 2 grid (Eidolons): search | chips, then the switch under the search | the rest */
.pf-filter.pf-filter-grid {
    display: grid;
    grid-template-columns: minmax(16rem, 24rem) 1fr;
    gap: .75rem 1rem;
}

.pf-filter-grid > .pf-filter-search {
    max-width: none;
}

.pf-filter-grid > .pf-switch {
    justify-self: start;
}

@media (max-width: 767.98px) {
    .pf-filter.pf-filter-grid { grid-template-columns: 1fr; }
}

/* a two-sided switch (Chained ⟵○⟶ Unchained): the chosen side's label in full colour, the other muted; the
   knob slides to the chosen side (.pf-switch[data-value] is set by the page's script) */
.pf-switch {
    align-items: center;
    gap: .5rem;
}

.pf-switch > button[data-value] {
    padding: .2rem .1rem;
    border: 0;
    background: none;
    font-family: var(--pf-font-ui);
    font-weight: 700;
    color: var(--pf-ink-soft);
    opacity: .55;
}

.pf-switch > button[data-value][aria-pressed="true"] {
    background: none;
    color: var(--pf-heading);
    opacity: 1;
}

.pf-switch-track {
    position: relative;
    width: 2.6rem;
    height: 1.4rem;
    padding: 0;
    border: 1px solid var(--pf-gold);
    border-radius: 1rem;
    background: color-mix(in srgb, var(--pf-gold) 18%, transparent);
}

.pf-switch-track span {
    position: absolute;
    top: 50%;
    left: .2rem;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: var(--pf-gold);
    transform: translateY(-50%);
    transition: left .15s ease;
}

.pf-switch[data-value="unchained"] .pf-switch-track span,
.pf-switch[data-value="eidolon"] .pf-switch-track span,
.pf-switch[data-value="builder"] .pf-switch-track span {
    left: calc(100% - 1.2rem);
}

@media (prefers-reduced-motion: reduce) {
    .pf-switch-track span { transition: none; }
}

/* group headings among option cards ("Unchained · 2-point evolutions 12"), like the spellbook's level rows */
.pf-comp-head {
    margin: 1.5rem 0 .6rem;
    padding-bottom: .3rem;
    border-bottom: 1px solid var(--pf-gold);
    font-family: var(--pf-font-display);
    font-size: 1.15rem;
    color: var(--pf-heading);
}

.pf-comp-head:first-child {
    margin-top: 0;
}

.pf-head-count {
    margin-left: .35rem;
    font-family: var(--pf-font-ui);
    font-size: .8rem;
    color: var(--pf-ink-soft);
}

.pf-statblock {
    padding: 1rem 1.25rem;
}

.pf-comp-stages {
    max-height: none;
    margin: 1rem 0 .5rem;
}

.pf-comp-stages td {
    min-width: 10rem;
}

.pf-comp-features {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}

.pf-comp-features .pf-chip {
    text-decoration: none;
}

.pf-option .pf-trait-req {
    display: block;
    margin-top: .2rem;
    font-size: .85rem;
}

/* a filter bar in two rows beside the search box (Weapons): the second row starts under the first chip */
.pf-filter-rows {
    display: flex;
    flex: 999 1 30rem;
    flex-direction: column;
    gap: .75rem;
}

.pf-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem 1rem;
}

/* the potion / scroll / wand calculator (Potions, Scrolls & Wands page) */
.pf-calc {
    margin-bottom: 1.75rem;
    padding: 1.1rem 1.35rem;
}

.pf-calc-title {
    margin-bottom: .9rem;
    font-family: var(--pf-font-display);
    color: var(--pf-heading);
}

.pf-calc-inputs {
    display: flex;
    flex-wrap: wrap;
    gap: .9rem 1.5rem;
    align-items: flex-end;
}

.pf-calc-field {
    display: flex;
    flex-direction: column;
    gap: .3rem;
}

.pf-calc-small {
    width: 9rem;
}

.pf-calc-label,
.pf-calc-hint {
    font-family: var(--pf-font-ui);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--pf-ink-soft);
}

.pf-calc-hint {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.pf-calc-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    gap: .75rem;
    margin: 1.1rem 0 .8rem;
}

.pf-calc-result {
    display: flex;
    flex-direction: column;
    padding: .65rem .9rem;
    border: 1px solid var(--pf-rule);
    border-left: 3px solid var(--pf-gold);
    border-radius: var(--bs-border-radius);
    background: var(--pf-panel-2);
}

.pf-calc-result.is-off {
    opacity: .55;
    border-left-color: var(--pf-rule);
}

.pf-calc-kind {
    font-size: .85rem;
    color: var(--pf-ink-soft);
}

.pf-calc-price {
    font-family: var(--pf-font-display);
    font-size: 1.5rem;
    color: var(--pf-heading);
    font-variant-numeric: lining-nums tabular-nums;
}

.pf-calc-sub {
    font-size: .8rem;
    color: var(--pf-ink-soft);
}

.pf-calc-note {
    margin: 0;
    font-size: .85rem;
    color: var(--pf-ink-soft);
}

.pf-seg button:disabled {
    opacity: .35;
    cursor: not-allowed;
}

/* a label before a row's chips ("Evolutions", "Charge level"): as close to them as a pill group's own label */
.pf-filter-row > .pf-seg-label {
    margin-right: -.55rem;
    padding: 0 .2rem;
    font-family: var(--pf-font-ui);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--pf-ink-soft);
}

.pf-seg .pf-seg-label {
    align-self: center;
    padding: 0 .45rem 0 .2rem;
    font-family: var(--pf-font-ui);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--pf-ink-soft);
}

.pf-eq-table .pf-sort {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    color: inherit;
    white-space: nowrap;
    cursor: pointer;
}

.pf-eq-table .pf-sort::after {
    content: "↕";
    margin-left: .3rem;
    font-size: .75em;
    opacity: .35;
}

.pf-eq-table th[aria-sort="ascending"] .pf-sort::after { content: "▲"; opacity: .9; color: var(--pf-gold); }
.pf-eq-table th[aria-sort="descending"] .pf-sort::after { content: "▼"; opacity: .9; color: var(--pf-gold); }

.pf-eq-table .pf-eq-cat {
    white-space: nowrap;
    color: var(--pf-ink-soft);
}

.pf-eq-table .pf-eq-num {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: lining-nums tabular-nums;
}

.pf-eq-table .pf-eq-mid {
    text-align: center;
    white-space: nowrap;
    font-variant-numeric: lining-nums tabular-nums;
}

.pf-eq-table .pf-eq-opt {
    font-size: .85rem;
}

.pf-ap {
    margin-left: .25rem;
    padding: 0 .35rem;
    border-radius: .25rem;
    background: color-mix(in srgb, var(--pf-ink-soft) 18%, transparent);
    font-family: var(--pf-font-ui);
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .06em;
    color: var(--pf-ink-soft);
    vertical-align: .1em;
}

/* a source tag beside a name: Golarion (setting) or Adventure (paths, modules); the book's title on hover */
.pf-ap.pf-src-golarion {
    background: color-mix(in srgb, var(--pf-gold) 16%, transparent);
    color: var(--pf-gold);
}

.pf-badge-soft {
    background: color-mix(in srgb, var(--pf-ink-soft) 16%, transparent);
}

a.pf-badge {
    text-decoration: none;
}

@media (max-width: 991.98px) {
    .pf-eq-table .pf-eq-opt { display: none; }
}

/* ---- Trait cards (Traits page): the feat card's frame, the rule in full */
.pf-trait-req {
    margin: .35rem 0 0;
    font-family: var(--pf-font-ui);
    font-size: .85rem;
    color: var(--pf-ink-soft);
}

.pf-trait-req b {
    margin-right: .3rem;
    font-size: .72rem;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.pf-trait-text {
    margin-top: .4rem;
    font-size: .93rem;
    line-height: 1.45;
}

.pf-trait-text p:last-child {
    margin-bottom: 0;
}

/* ---- The feat tree window: needs <- feat -> leads to, one column per tier, a color per tier */
.pf-tree-modal {
    --pf-tier-1: #c9a24a;   /* gold */
    --pf-tier-2: #b8743c;   /* bronze */
    --pf-tier-3: #3f9a86;   /* verdigris */
    --pf-tier-4: #9a62a8;   /* plum */
    --pf-tier-5: #6f86a6;   /* slate */
    --pf-tree-line: color-mix(in srgb, var(--pf-gold) 45%, transparent);
    --pf-tree-gap: 1.4rem;
}

.pf-tree-modal .modal-dialog {
    max-width: min(96vw, 1700px);
}

.pf-tree-modal .modal-header {
    gap: .75rem;
}

.pf-tree-modal .modal-title {
    margin: 0;
    color: var(--pf-heading);
    white-space: nowrap;
}

.pf-tree-find {
    max-width: 16rem;
    margin-left: auto;
}

.pf-tree-modal .modal-body {
    padding: .75rem 1rem 1rem;
}

.pf-tree-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: .4rem .6rem;
    margin: 0 0 .75rem;
    font-family: var(--pf-font-ui);
    font-size: .8rem;
    color: var(--pf-ink-soft);
}

.pf-tree-scroll {
    overflow: auto;
    max-height: calc(100vh - 12rem);
}

.pf-tree {
    display: flex;
    align-items: center;
    justify-content: center;
    width: max-content;
    min-width: 100%;
    padding: .5rem;
}

.pf-tree ul {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin: 0;
    padding: 0;
    list-style: none;
}

.pf-tree ul[hidden] {
    display: none;
}

.pf-tree li {
    position: relative;
    display: flex;
    align-items: center;
    gap: .3rem;
    padding: .14rem 0;
}

/* connectors, right side: parent -> spine -> child */
.pf-tree .is-right,
.pf-tree .is-right ul {
    padding-left: var(--pf-tree-gap);
}

.pf-tree .is-right li {
    padding-left: var(--pf-tree-gap);
}

.pf-tree .is-right::before,
.pf-tree .is-right ul::before,
.pf-tree .is-right li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: var(--pf-tree-gap);
    border-top: 1px solid var(--pf-tree-line);
}

.pf-tree .is-right li::after {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    border-left: 1px solid var(--pf-tree-line);
}

/* left side: the mirror image */
.pf-tree .is-left,
.pf-tree .is-left ul {
    padding-right: var(--pf-tree-gap);
}

.pf-tree .is-left li {
    flex-direction: row-reverse;
    padding-right: var(--pf-tree-gap);
}

.pf-tree .is-left::before,
.pf-tree .is-left ul::before,
.pf-tree .is-left li::before {
    content: "";
    position: absolute;
    right: 0;
    top: 50%;
    width: var(--pf-tree-gap);
    border-top: 1px solid var(--pf-tree-line);
}

.pf-tree .is-left li::after {
    content: "";
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    border-right: 1px solid var(--pf-tree-line);
}

.pf-tree li:first-child::after { top: 50%; }
.pf-tree li:last-child::after { bottom: 50%; }
.pf-tree li:only-child::after { display: none; }

.pf-tree-node {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .16rem .6rem .16rem .22rem;
    border: 1px solid var(--pf-tier, var(--pf-gold));
    border-left-width: 4px;
    border-radius: .35rem;
    background: var(--pf-panel-2);
    color: var(--pf-ink);
    font-family: var(--pf-font-ui);
    font-size: .86rem;
    line-height: 1.3;
    text-decoration: none;
    white-space: nowrap;
}

.pf-tree .is-left .pf-tree-node {
    border-left-width: 1px;
    border-right-width: 4px;
}

a.pf-tree-node:hover,
a.pf-tree-node:focus-visible {
    background: color-mix(in srgb, var(--pf-tier) 22%, var(--pf-panel-2));
    color: var(--pf-heading);
}

.pf-tier-mark {
    display: inline-grid;
    place-items: center;
    min-width: 1.15rem;
    height: 1.15rem;
    border-radius: 50%;
    background: var(--pf-tier, var(--pf-gold));
    color: #15110c;
    font-size: .7rem;
    font-weight: 700;
}

.pf-tier-0 {
    --pf-tier: var(--pf-gold);
    padding: .35rem .9rem;
    border-width: 2px;
    background: color-mix(in srgb, var(--pf-gold) 22%, var(--pf-panel));
    font-family: var(--pf-font-display);
    font-size: 1.05rem;
    color: var(--pf-heading);
}

.pf-tier-1 { --pf-tier: var(--pf-tier-1); }
.pf-tier-2 { --pf-tier: var(--pf-tier-2); }
.pf-tier-3 { --pf-tier: var(--pf-tier-3); }
.pf-tier-4 { --pf-tier: var(--pf-tier-4); }
.pf-tier-5 { --pf-tier: var(--pf-tier-5); }

.pf-tree-node.is-hit {
    outline: 2px solid var(--pf-heading);
    outline-offset: 2px;
}

.pf-tree-also {
    font-family: var(--pf-font-ui);
    font-size: .74rem;
    font-style: italic;
    color: var(--pf-ink-soft);
    white-space: nowrap;
}

.pf-tree-fold {
    padding: 0 .35rem;
    border: 1px solid var(--pf-tree-line);
    border-radius: 1rem;
    background: transparent;
    color: var(--pf-ink-soft);
    font-family: var(--pf-font-ui);
    font-size: .74rem;
    white-space: nowrap;
}

.pf-tree-fold:hover,
.pf-tree-fold:focus-visible {
    border-color: var(--pf-gold);
    color: var(--pf-heading);
}

/* Phones: an indented list (needs above the feat, leads-to below), same colors */
@media (max-width: 767.98px) {
    .pf-tree { display: block; width: auto; }
    .pf-tree ul { display: block; padding: 0 0 0 1rem !important; border-left: 1px solid var(--pf-tree-line); }
    .pf-tree ul[hidden] { display: none; }
    .pf-tree li { display: block; padding: .15rem 0 .15rem .5rem !important; }
    .pf-tree li::before, .pf-tree li::after, .pf-tree ul::before { display: none; }
    .pf-tree .is-left .pf-tree-node { border-left-width: 4px; border-right-width: 1px; }
    .pf-tree-root { margin: .5rem 0; }
    .pf-tree-also { display: block; margin-left: 1.6rem; white-space: normal; }
    .pf-tree-find { max-width: none; }
    .pf-tree-modal .modal-title { white-space: normal; }
}

/* ---- Prestige requirements table (in the Requirements panel): one row per class, long cells cut to 3 lines */
.pf-req-table {
    max-height: 60vh;
    overflow: auto;
    margin-top: .75rem;
    border: 1px solid var(--pf-rule);
    border-radius: var(--bs-border-radius);
    background: var(--pf-panel-2);
}

.pf-req-table table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--pf-font-ui);
    font-size: .86rem;
    line-height: 1.35;
}

.pf-req-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

.pf-req-table thead th {
    padding: .45rem .55rem;
    background: var(--pf-panel);
    border-bottom: 1px solid var(--pf-gold);
    font-family: var(--pf-font-display);
    font-weight: 400;
    color: var(--pf-heading);
    text-align: left;
    white-space: nowrap;
}

.pf-req-table tbody th,
.pf-req-table td {
    padding: .35rem .55rem;
    vertical-align: top;
    border-bottom: 1px solid color-mix(in srgb, var(--pf-rule) 55%, transparent);
    text-align: left;
}

.pf-req-table tbody th {
    position: sticky; /* the class name stays while the table scrolls sideways */
    left: 0;
    z-index: 1;
    min-width: 11rem;
    background: var(--pf-panel-2);
    font-weight: 500;
}

.pf-req-table tbody tr:nth-child(even) td {
    background: color-mix(in srgb, var(--pf-gold) 5%, transparent);
}

.pf-req-table tbody th a {
    color: var(--pf-heading);
    text-decoration: none;
}

.pf-req-table td {
    min-width: 8rem;
    max-width: 18rem;
}

.pf-req-table .pf-req-entry {
    min-width: 0;
    white-space: nowrap;
    font-weight: 700;
    color: var(--pf-gold);
}

[data-bs-theme="light"] .pf-req-table .pf-req-entry {
    color: #8a5f12;
}

.pf-req-table .pf-req-none {
    min-width: 0;
    color: var(--pf-ink-soft);
}

.pf-clamp {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---- Prestige classes: a compact list */
.pf-prestige ul {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(22rem, 1fr));
    gap: .75rem;
    margin: 0;
}

.pf-prestige li {
    padding: .8rem 1rem;
}

.pf-prestige li a {
    font-family: var(--pf-font-display);
    font-size: 1.15rem;
    color: var(--pf-heading);
    text-decoration: none;
    margin-right: .5rem;
}

.pf-prestige li p {
    margin: .3rem 0 0;
    font-size: .95rem;
    color: var(--pf-ink-soft);
}

/* ---- Class choices in the tables (talents, rage powers...): gains gilt, notes marked ✦ */
.pf-class-table td.pf-gain,
.pf-progression td.pf-gain {
    color: var(--pf-gold);
    font-weight: 700;
}

[data-bs-theme="light"] .pf-class-table td.pf-gain,
[data-bs-theme="light"] .pf-progression td.pf-gain {
    color: #8a5f12;
}

.pf-note-mark {
    margin-left: .2rem;
    color: var(--pf-accent-hi);
    font-size: .8em;
    cursor: help;
}

.pf-table-note {
    margin: .5rem 0 0;
    font-family: var(--pf-font-ui);
    font-size: .88rem;
    color: var(--pf-ink-soft);
}

/* ---- The spells-per-day chevron (casters' cards): the table grows over the notes */
.pf-class-tablewrap {
    position: relative;
    min-width: 0;
}

.pf-class .pf-sp {
    display: none;
}

.pf-class.is-expanded .pf-sp {
    display: table-cell;
}

.pf-class .pf-sp-row {
    display: none;
}

.pf-class.is-expanded .pf-sp-row {
    display: table-row;
}

.pf-class .pf-sp-row th {
    padding: .3rem .35rem 0;
    border-bottom: 0;
    font-size: .8rem;
}

/* a gilt rule before each spell group (per day | known), on cards and class pages */
.pf-class-table .pf-group-start,
.pf-progression .pf-group-start {
    border-left: 1px solid color-mix(in srgb, var(--pf-gold) 60%, transparent) !important;
}

.pf-class.is-expanded .pf-class-body {
    grid-template-columns: calc(var(--pf-class-h) * 2 / 3) 1fr;
}

.pf-class.is-expanded .pf-class-notes {
    display: none;
}

.pf-class .pf-class-table th.pf-sp,
.pf-class .pf-class-table td.pf-sp {
    border-left: 1px solid color-mix(in srgb, var(--pf-rule) 55%, transparent);
}

.pf-class-expand {
    position: absolute;
    top: 50%;
    right: -.95rem;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 1.9rem;
    height: 1.9rem;
    padding: 0;
    transform: translateY(-50%);
    border: 1px solid var(--pf-gold);
    border-radius: 50%;
    background: var(--pf-panel);
    color: var(--pf-gold);
    box-shadow: 0 2px 6px rgb(var(--pf-shadow) / .35);
    transition: transform .25s ease, background-color .2s ease;
}

.pf-class-expand:hover,
.pf-class-expand:focus-visible {
    background: var(--pf-accent);
    color: #fbf1dc;
}

.pf-class-expand[aria-expanded="true"] {
    transform: translateY(-50%) rotate(180deg);
}

.pf-class-expand svg {
    width: .9rem;
    height: .9rem;
}

@media (max-width: 991.98px) {
    .pf-class.is-expanded .pf-class-notes { display: grid; }
}

@media (max-width: 575.98px) {
    .pf-class-expand { top: auto; bottom: -.95rem; right: 50%; transform: translateX(50%) rotate(90deg); }
    .pf-class-expand[aria-expanded="true"] { transform: translateX(50%) rotate(270deg); }
    .pf-class-table { overflow-x: auto; }
}

/* ============================================================ Rules reference: an entry's own page (a class, ...) */
.pf-entry {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 13.5rem;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 1199.98px) {
    .pf-entry { grid-template-columns: minmax(0, 1fr); }
    .pf-onpage { display: none; }
}

.pf-entry-narrow {
    max-width: 54rem;
}

/* a page without a header card (prestige classes, archetypes): the heading, its meta line, then the content */
.pf-entry-plain {
    margin-bottom: 1.5rem;
}

.pf-entry-head {
    display: grid;
    grid-template-columns: 15rem 1fr;
    gap: 1.5rem;
    padding: 1.25rem;
    margin-bottom: 2rem;
}

.pf-entry-art {
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border-radius: var(--bs-border-radius);
    border: 1px solid color-mix(in srgb, var(--pf-gold) 45%, transparent);
    box-shadow: 0 8px 20px -10px rgb(var(--pf-shadow) / .6);
}

.pf-entry-facts h1,
.pf-entry-plain h1 {
    font-size: clamp(2rem, 4vw, 2.8rem);
    margin-bottom: .35rem;
}

.pf-entry-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .3rem .75rem;
    margin-bottom: .9rem;
}

.pf-entry-meta .pf-class-book {
    margin-left: 0;
}

.pf-entry-role {
    font-style: italic;
    color: var(--pf-ink-soft);
    margin-bottom: 1rem;
}

.pf-entry-facts .pf-class-notes {
    max-height: none;
}

@media (max-width: 767.98px) {
    .pf-entry-head { grid-template-columns: 1fr; }
    .pf-entry-art { max-height: 16rem; aspect-ratio: auto; object-position: 50% 20%; }
}

.pf-entry-section {
    margin-bottom: 2rem;
}

.pf-entry-intro {
    margin-bottom: 1.5rem;
}

.pf-count {
    display: inline-block;
    min-width: 1.8rem;
    padding: .05rem .5rem;
    border-radius: 2rem;
    background: color-mix(in srgb, var(--pf-gold) 18%, transparent);
    font-family: var(--pf-font-ui);
    font-size: .9rem;
    vertical-align: middle;
    text-align: center;
    color: var(--pf-ink);
}

/* the full progression table (Special and spells per day) */
.pf-progression {
    overflow-x: auto;
    border: 1px solid var(--pf-rule);
    border-radius: var(--bs-border-radius);
    background: var(--pf-panel);
}

.pf-progression table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--pf-font-ui);
    font-size: .9rem;
    font-variant-numeric: lining-nums tabular-nums;
}

.pf-progression th,
.pf-progression td {
    padding: .3rem .55rem;
    text-align: center;
    white-space: nowrap;
    border-bottom: 1px solid color-mix(in srgb, var(--pf-rule) 55%, transparent);
}

.pf-progression thead th {
    background: var(--pf-panel-2);
    font-family: var(--pf-font-display);
    font-weight: 400;
    color: var(--pf-heading);
    border-bottom: 1px solid var(--pf-gold);
}

.pf-progression .pf-progression-group th {
    border-bottom: 0;
    font-size: .85rem;
}

.pf-progression .pf-sp-head {
    border-left: 1px solid var(--pf-rule);
    border-bottom: 1px solid var(--pf-rule) !important;
}

.pf-progression .pf-special {
    text-align: left;
    white-space: normal;
    min-width: 10rem;
}

/* spell columns: narrow, so per day and known fit side by side next to the Special column */
.pf-progression .pf-sp {
    padding-inline: .25rem;
    min-width: 1.9rem;
    font-size: .85rem;
    border-left: 1px solid color-mix(in srgb, var(--pf-rule) 35%, transparent);
}

.pf-progression tbody tr:nth-child(even) {
    background: color-mix(in srgb, var(--pf-gold) 5%, transparent);
}

.pf-progression tbody th {
    font-weight: 500;
    color: var(--pf-ink-soft);
}

.pf-progression .pf-good {
    color: var(--pf-gold);
    font-weight: 700;
}

[data-bs-theme="light"] .pf-progression .pf-good {
    color: #8a5f12;
}

/* the rules text: our cleaned HTML (srd/tools/site_html.py) */
.pf-rules {
    font-size: 1.05rem;
}

.pf-rules.card {
    padding: 1.5rem 1.75rem;
}

.pf-rules h2 {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 2.25rem 0 1rem;
    font-size: 1.75rem;
}

.pf-rules h2::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--pf-gold), transparent);
    opacity: .7;
}

.pf-rules h3 {
    margin: 1.5rem 0 .5rem;
    font-size: 1.3rem;
}

.pf-rules p > b:first-child {
    font-family: var(--pf-font-display);
    font-weight: 400;
    font-size: 1.08em;
    letter-spacing: .02em;
    color: var(--pf-heading);
}

.pf-rules [id],
.pf-entry-section [id] {
    scroll-margin-top: 9rem; /* below the sticky header and its tab band */
}

/* a feature reached by its address (#arcane-bond) is lit for a moment */
.pf-rules :target {
    animation: pf-found 2.4s ease-out;
    border-radius: var(--bs-border-radius);
}

@keyframes pf-found {
    from { background: color-mix(in srgb, var(--pf-gold) 28%, transparent); box-shadow: 0 0 0 .5rem color-mix(in srgb, var(--pf-gold) 28%, transparent); }
    to { background: transparent; box-shadow: 0 0 0 .5rem transparent; }
}

.pf-rules table {
    margin: 1rem 0 1.5rem;
    border-collapse: collapse;
    font-family: var(--pf-font-ui);
    font-size: .9rem;
    font-variant-numeric: lining-nums tabular-nums;
    background: var(--pf-panel);
    border: 1px solid var(--pf-rule);
}

.pf-rules th,
.pf-rules td {
    padding: .3rem .6rem;
    border-bottom: 1px solid color-mix(in srgb, var(--pf-rule) 55%, transparent);
    text-align: center;
}

.pf-rules tr:first-child td,
.pf-rules th {
    background: var(--pf-panel-2);
    font-weight: 700;
}

.pf-rules i {
    color: var(--pf-ink-soft);
}

.pf-rules a {
    text-decoration-style: dotted;
}

/* archetypes of a class */
.pf-archetypes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
    gap: .75rem;
    margin: 0;
}

.pf-archetypes li {
    padding: .8rem 1rem;
}

.pf-archetypes li a {
    margin-right: .5rem;
    font-family: var(--pf-font-display);
    font-size: 1.12rem;
    color: var(--pf-heading);
    text-decoration: none;
}

.pf-archetypes li a:hover {
    color: var(--bs-link-hover-color);
}

.pf-archetypes li .pf-class-book {
    margin-left: 0;
}

.pf-archetypes li p {
    margin: .3rem 0 0;
    font-size: .95rem;
    color: var(--pf-ink-soft);
}

/* "On this page": follows the reader on wide screens */
.pf-onpage {
    position: sticky;
    top: 9rem;
    padding: 1rem 1.1rem;
    border-left: 2px solid color-mix(in srgb, var(--pf-gold) 55%, transparent);
    font-family: var(--pf-font-ui);
    font-size: .92rem;
}

.pf-onpage-title {
    margin-bottom: .5rem;
    font-family: var(--pf-font-display);
    font-size: 1rem;
    color: var(--pf-heading);
}

.pf-onpage li + li {
    margin-top: .3rem;
}

.pf-onpage a {
    color: var(--pf-ink-soft);
    text-decoration: none;
}

.pf-onpage a:hover,
.pf-onpage a[aria-current] {
    color: var(--bs-link-hover-color);
}

.pf-onpage a[aria-current]::before {
    content: "◆ ";
    font-size: .7em;
    color: var(--pf-gold);
}

/* ---- Portrait zoom: the portrait is a button; the full-size original opens in a window (js/header.js) */
.pf-zoom {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: none;
    cursor: zoom-in;
    border-radius: var(--bs-border-radius);
}

.pf-zoom:focus-visible {
    outline: 2px solid var(--pf-gold);
    outline-offset: 3px;
}

.pf-zoom img {
    transition: filter .2s ease;
}

.pf-zoom:hover img {
    filter: brightness(1.06) drop-shadow(0 0 .5rem rgb(227 194 122 / .35));
}

.pf-zoom-modal .modal-dialog {
    max-width: min(92vw, calc(88vh * 2 / 3));
}

.pf-zoom-modal .modal-content {
    position: relative;
    padding: .6rem;
    background: #151210;
    border: 1px solid #c79a45;
    outline: 1px solid rgb(227 194 122 / .3);
    outline-offset: -6px;
    box-shadow: 0 30px 80px rgb(0 0 0 / .7);
}

.pf-zoom-modal img {
    display: block;
    width: 100%;
    max-height: 82vh;
    object-fit: contain;
    border-radius: .3rem;
    cursor: zoom-out;
}

.pf-zoom-modal .btn-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 1;
    padding: .6rem;
    border-radius: 50%;
    background-color: rgb(21 18 16 / .85);
    box-shadow: 0 0 0 1px rgb(227 194 122 / .6);
    opacity: 1;
}

.pf-zoom-title {
    margin: .55rem 0 .15rem;
    text-align: center;
    font-family: var(--pf-font-display);
    font-size: 1.2rem;
    letter-spacing: .05em;
    color: #e3c27a;
}

/* ---- A class's option lists (class page) and one list's page (/srd/class/barbarian/rage-powers) */
/* a class's option lists: buttons inside Class Features, after the proficiencies */
.pf-option-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    margin: .25rem 0 1.25rem;
}

.pf-option-buttons .btn {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    border-radius: 2rem;
    padding-inline: .9rem;
    font-family: var(--pf-font-display);
    font-size: .98rem;
    letter-spacing: .03em;
    border-color: color-mix(in srgb, var(--pf-gold) 55%, transparent);
}

.pf-option-buttons .btn:hover {
    border-color: var(--pf-gold);
    background: color-mix(in srgb, var(--pf-gold) 12%, transparent);
}

.pf-option-buttons .pf-count {
    min-width: 0;
    font-size: .75rem;
}

.pf-options {
    display: grid;
    gap: .5rem;
}

.pf-option {
    padding: 0;
    scroll-margin-top: 9rem;
}

.pf-option > summary {
    display: block;
    padding: .7rem 1.1rem .75rem 2.4rem;
    cursor: pointer;
    list-style: none;
    position: relative;
}

.pf-option > summary::-webkit-details-marker {
    display: none;
}

/* a gilt chevron that turns when the item opens */
.pf-option > summary::before {
    content: "";
    position: absolute;
    left: 1.05rem;
    top: 1.1rem;
    width: .5rem;
    height: .5rem;
    border-right: 2px solid var(--pf-gold);
    border-bottom: 2px solid var(--pf-gold);
    transform: rotate(-45deg);
    transition: transform .2s ease;
}

.pf-option[open] > summary::before {
    transform: rotate(45deg);
}

.pf-option-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .2rem .6rem;
}

.pf-option-name {
    font-family: var(--pf-font-display);
    font-size: 1.15rem;
    color: var(--pf-heading);
}

.pf-option-tag {
    font-family: var(--pf-font-ui);
    font-size: .85rem;
    color: var(--pf-ink-soft);
}

.pf-option-head .pf-class-book {
    margin-left: auto;
}

.pf-option-summary {
    display: block;
    margin-top: .15rem;
    font-size: .95rem;
    color: var(--pf-ink-soft);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pf-option[open] .pf-option-summary {
    display: none;
}

.pf-option-body {
    position: relative;
    padding: .25rem 1.4rem 1rem 2.4rem;
    border-top: 1px solid color-mix(in srgb, var(--pf-gold) 25%, transparent);
}

.pf-option-body > p:first-child {
    margin-top: .75rem;
}

.pf-option-link {
    position: absolute;
    right: 1rem;
    bottom: .6rem;
    font-family: var(--pf-font-display);
    color: var(--pf-gold) !important;
    text-decoration: none !important;
    opacity: .6;
}

.pf-option-link:hover {
    opacity: 1;
}

.pf-option:target {
    box-shadow: 0 0 0 2px var(--pf-gold), 0 8px 24px -12px rgb(var(--pf-shadow) / .45);
}

/* ============================================================ Login */
.site-auth {
    width: 100%;
    max-width: 420px;
    margin: 8vh auto 3rem;
    padding: 0 16px;
}

.site-auth .card-body {
    padding: 2.25rem 2rem 2rem !important;
}

.pf-auth-mark {
    display: block;
    width: 3.2rem;
    height: 3.2rem;
    margin: 0 auto .75rem;
    color: var(--pf-gold);
}

.site-auth h1 {
    margin-bottom: 0 !important;
}

/* Sign-up honeypot (modals/signup.php): off-screen for people and screen readers, still filled in by bots. */
.site-honeypot {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ============================================================ Admin */
.site-admin-card {
    max-width: 32rem;
}

/* ============================================================ Footer: one slim band, the legal notice in a popover */
.site-footer {
    margin-top: 3rem;
    padding: .85rem 0;
    font-family: var(--pf-font-ui);
    font-size: .85rem;
    color: #a99b80;
    background:
        var(--pf-grain),
        linear-gradient(180deg, #1b1715 0%, #120f0e 100%);
    border-top: 1px solid #c79a45;
    box-shadow: inset 0 2px 0 #7a1a14;
}

.site-footer .bi-emblem {
    flex: none;
    width: 1.35rem;
    height: 1.35rem;
    color: #c79a45;
}

.site-footer-about {
    flex: 1;
    margin: 0;
    line-height: 1.45;
    text-align: center;
}

@media (min-width: 768px) {
    .site-footer-about { text-align: left; }
}

.site-footer-legal {
    flex: none;
    padding: .2rem .7rem;
    font-size: .78rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    white-space: nowrap;
    color: #d4b46e;
    border: 1px solid rgb(199 154 69 / .4);
    border-radius: 2rem;
}

.site-footer-legal:hover,
.site-footer-legal[aria-describedby] {
    color: #f6dc98;
    border-color: #c79a45;
    background: rgb(227 194 122 / .08);
}

.pf-legal-popover {
    --bs-popover-max-width: 26rem;
    --bs-popover-font-size: .85rem;
    font-family: var(--pf-font-ui);
}

.pf-legal-popover .popover-header {
    font-family: var(--pf-font-display);
    color: var(--pf-heading);
}

/* ============================================================ Motion */
@media (prefers-reduced-motion: reduce) {
    .pf-hero-mark, .pf-backdrop svg { animation: none; }
    .site-brand > .bi-emblem, .pf-icon-btn, .pf-character, .pf-tab, .pf-root-card, .pf-class-expand, .pf-option > summary::before { transition: none; }
    .pf-rules :target { animation: none; }
    .pf-root-card:hover { transform: none; }
    .pf-character:hover { transform: none; }
}

/* ---------------------------------------------------------------- Charts (reference/charts.php) and
   "Charts on this page" (reference/rule.php) */
.pf-page-tables {
    align-items: center;
    margin-top: .6rem;
}

.pf-page-tables .pf-chip,
.pf-chart-jump .pf-chip {
    text-decoration: none;
}

.pf-page-tables-label {
    font-family: var(--pf-font-ui);
    font-size: .85rem;
    color: var(--pf-ink-soft);
}

.pf-chart-jump {
    display: grid;
    gap: .5rem;
    margin-bottom: 1rem;
}

.pf-chart-jump .pf-chips {
    align-items: center;
}

.pf-charts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 24rem), 1fr));
    gap: 1rem;
    align-items: start;
}

.pf-chart {
    padding: 1rem 1.1rem;
    scroll-margin-top: 6rem;
}

.pf-chart-wide {
    grid-column: 1 / -1;
}

.pf-chart-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: .25rem 1rem;
    margin-bottom: .5rem;
}

.pf-chart-head h3 {
    margin: 0;
}

.pf-chart-rules {
    font-family: var(--pf-font-ui);
    font-size: .85rem;
}

.pf-chart-table {
    overflow-x: auto;
}

.pf-chart-table table {
    margin-bottom: 0;
}

/* ---------------------------------------------------------------- Classes page sections (reference/classes.php):
   open <details> per section; unchained and alternate classes indented under their parent; .is-flat while filtering */
.pf-class-sections {
    display: grid;
    gap: 1.75rem;
}

.pf-class-section > summary {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .2rem .9rem;
    margin-bottom: 1rem;
    padding-bottom: .4rem;
    border-bottom: 1px solid color-mix(in srgb, var(--pf-gold) 45%, transparent);
    list-style: none;
    cursor: pointer;
}

.pf-class-section > summary::-webkit-details-marker {
    display: none;
}

.pf-class-section-title {
    margin: 0;
    font-size: 1.5rem;
}

.pf-class-section-line {
    flex: 1 1 18rem;
    font-style: italic;
    color: var(--pf-ink-soft);
}

.pf-class-section-chevron {
    align-self: center;
    color: var(--pf-ink-soft);
    transition: transform .15s ease;
}

.pf-class-section[open] > summary .pf-class-section-chevron {
    transform: rotate(90deg);
}

.pf-class-section:not([open]) > summary {
    margin-bottom: 0;
}

/* a variant (Rogue (Unchained), Ninja) under its parent: stepped in, joined by a thin rule */
.pf-class-variant {
    position: relative;
    margin-left: 2.25rem;
}

.pf-class-variant::before {
    content: "";
    position: absolute;
    top: -1.25rem;
    bottom: 50%;
    left: -1.35rem;
    width: 1rem;
    border-left: 2px solid color-mix(in srgb, var(--pf-gold) 55%, transparent);
    border-bottom: 2px solid color-mix(in srgb, var(--pf-gold) 55%, transparent);
    border-bottom-left-radius: .5rem;
}

.pf-class-variant-of {
    font-family: var(--pf-font-ui);
    font-size: .85rem;
    color: var(--pf-ink-soft);
}

@media (max-width: 767.98px) {
    .pf-class-variant {
        margin-left: .75rem;
    }

    .pf-class-variant::before {
        left: -.6rem;
        width: .45rem;
    }
}

/* filtering: one flat list, no headers, no indents (the "Variant of" label stays) */
.pf-class-sections.is-flat {
    gap: 1.25rem;
}

.pf-class-sections.is-flat .pf-class-section > summary {
    display: none;
}

.pf-class-sections.is-flat .pf-class-variant {
    margin-left: 0;
}

.pf-class-sections.is-flat .pf-class-variant::before {
    display: none;
}

/* The generator (tabs/generator.php): the side-tabs lie over the page's right edge and fold away */
.pf-generator { position: relative; }
.pf-generator-nav {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 20;
    display: flex;
    align-items: flex-start;
}
.pf-generator-panel {
    width: 12rem;
    padding: .5rem;
    border: 1px solid var(--pf-gold);
    border-radius: .4rem;
    background: var(--pf-panel);
    box-shadow: 0 .5rem 1.5rem rgb(var(--pf-shadow) / .45);
}
.pf-generator-nav.is-folded .pf-generator-panel { display: none; }
.pf-generator-fold {
    padding: .35rem .5rem;
    margin-right: -1px;
    border: 1px solid var(--pf-gold);
    border-radius: .4rem 0 0 .4rem;
    background: var(--pf-panel);
    color: var(--pf-gold);
    line-height: 1;
}
.pf-generator-nav.is-folded .pf-generator-fold { margin-right: 0; border-radius: .4rem; }
.pf-generator-fold:hover { color: var(--pf-gold-hi); }
.pf-generator-nav .nav-link {
    color: var(--pf-ink-soft);
    border-left: 3px solid transparent;
    border-radius: .25rem;
}
.pf-generator-nav .nav-link:hover { color: var(--pf-heading); }
.pf-generator-nav .nav-link.active {
    color: var(--pf-heading);
    background: color-mix(in srgb, var(--pf-gold) 18%, transparent);
    border-left-color: var(--pf-gold);
}
.pf-generator-actions { margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--pf-rule); }
.btn-gilt {
    --bs-btn-color: var(--pf-bg-deep);
    --bs-btn-bg: var(--pf-gold);
    --bs-btn-border-color: var(--pf-gold);
    --bs-btn-hover-color: var(--pf-bg-deep);
    --bs-btn-hover-bg: var(--pf-gold-hi);
    --bs-btn-hover-border-color: var(--pf-gold-hi);
    --bs-btn-active-bg: var(--pf-gold-hi);
    --bs-btn-active-border-color: var(--pf-gold-hi);
    font-weight: 700;
}
.pf-sub-rule { margin-left: 2.5rem; padding-left: 1rem; border-left: 2px solid var(--pf-rule); }

/* the Character tab */
.pf-alignment { display: inline-grid; grid-template-columns: repeat(3, 3.2rem); gap: .3rem; align-items: center; }
.pf-alignment .btn-link { grid-column: 1 / -1; justify-self: start; }
.pf-alignment .btn.active, .btn-group .btn-outline-secondary.active {
    color: var(--pf-bg-deep);
    background: var(--pf-gold);
    border-color: var(--pf-gold);
}
.pf-portrait img { max-height: 22rem; object-fit: contain; }

/* a roster card: the name, then the edit and sheet icons */
.pf-character-icons { display: flex; gap: .25rem; flex: 0 0 auto; }
.pf-character-icons .pf-icon-btn { width: 2rem; height: 2rem; }

/* the Attributes tab */
.pf-attributes th, .pf-attributes td { white-space: nowrap; }
.pf-stepper { width: 9rem; margin: 0 auto; flex-wrap: nowrap; }
.pf-stepper input { -moz-appearance: textfield; }
.pf-stepper input::-webkit-outer-spin-button, .pf-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pf-points { display: flex; align-items: baseline; gap: .4rem; }

/* the Race tab */
.pf-subraces { display: grid; gap: .4rem; }
.pf-subrace { display: flex; align-items: flex-start; gap: .6rem; padding: .5rem .7rem; border: 1px solid var(--pf-rule); border-radius: .35rem; cursor: pointer; }
.pf-subrace.is-sub { border-color: color-mix(in srgb, var(--pf-gold) 55%, var(--pf-rule)); background: color-mix(in srgb, var(--pf-gold) 8%, transparent); }
.pf-subrace.is-chosen { border-color: var(--pf-gold); background: color-mix(in srgb, var(--pf-gold) 18%, transparent); }
.pf-subrace-name { color: var(--pf-gold); }

/* a racial trait, default or optional: the same look; the (i) opens what it does */
.pf-traits { display: grid; gap: .15rem; }
.pf-trait { padding: .15rem .5rem; border-left: 3px solid transparent; border-radius: .2rem; }
.pf-trait.is-taken { border-left-color: var(--pf-gold); background: color-mix(in srgb, var(--pf-gold) 14%, transparent); }
.pf-trait.is-taken .pf-trait-name { font-weight: 700; }
.pf-trait.is-struck .pf-trait-name { text-decoration: line-through; color: var(--pf-ink-soft); }
.pf-trait-take { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.pf-trait-take:hover .pf-trait-name { color: var(--pf-heading); }
.pf-info {
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.1rem; height: 1.1rem; padding: 0; margin-left: .25rem;
    border: 1px solid var(--pf-gold); border-radius: 50%;
    background: none; color: var(--pf-gold);
    font: italic 700 .72rem/1 var(--pf-font-body); cursor: help;
}
.pf-info:hover, .pf-info:focus-visible { background: var(--pf-gold); color: var(--pf-bg-deep); }
.pf-trait-popover { --bs-popover-max-width: 26rem; }
.pf-trait-popover .popover-body { max-height: 18rem; overflow: auto; font-size: .9rem; }
.pf-trait-popover .popover-body p:last-child { margin-bottom: 0; }

.pf-score { min-width: 4.5rem; border-color: var(--pf-gold) !important; background: color-mix(in srgb, var(--pf-gold) 10%, transparent); }
.pf-score-total { color: var(--pf-heading); }

/* the Class tab */
.pf-star { padding: 0 .2rem; border: 0; background: none; color: var(--pf-rule); font-size: 1.2rem; line-height: 1; cursor: pointer; }
.pf-star.is-on { color: var(--pf-gold); }
.pf-star:hover { color: var(--pf-gold-hi); }
.pf-class-line { padding: .35rem 0; border-bottom: 1px solid var(--pf-rule); }
.pf-archetypes summary { list-style: none; cursor: pointer; }
.pf-archetypes summary::-webkit-details-marker { display: none; }
.pf-archetype-list { position: absolute; z-index: 10; right: 0; max-height: 18rem; overflow: auto; min-width: 16rem; }
.pf-archetypes { position: relative; }
.pf-levels th, .pf-levels td { vertical-align: middle; }
.pf-hp { min-width: 4.5rem; }
.pf-level-edit { padding: .5rem .75rem; border-left: 3px solid var(--pf-gold); background: color-mix(in srgb, var(--pf-gold) 7%, transparent); }

.pf-levels .pf-col-class { width: 20%; min-width: 12rem; }

.pf-favored { border: 1px solid var(--pf-rule); color: var(--pf-ink-soft); background: none; }
.pf-favored:hover { border-color: var(--pf-gold); color: var(--pf-gold); }
.pf-favored.is-on { border-color: var(--pf-gold); color: var(--pf-bg-deep); background: var(--pf-gold); font-weight: 700; }

.pf-invalid { color: var(--pf-ink-soft); }

/* the Skills tab */
.pf-skills th, .pf-skills td { white-space: nowrap; }
.pf-rank-step { width: 8.5rem; margin: 0 auto; flex-wrap: nowrap; }
.pf-rank-step input { -moz-appearance: textfield; }
.pf-rank-step input::-webkit-outer-spin-button, .pf-rank-step input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pf-class-skill { color: var(--pf-gold); }
.pf-skill-parent th { background: color-mix(in srgb, var(--pf-gold) 8%, transparent); }
.pf-skill-specialty th { padding-left: 1.5rem; }

.pf-star-btn { padding: 0 .2rem; border: 0; background: none; color: var(--pf-rule); font-size: 1.1rem; line-height: 1; cursor: pointer; }
.pf-star-btn:hover { color: var(--pf-gold); }
.pf-star-btn.is-wrong { color: #d9534f; }
.pf-star-btn.is-wrong:hover { color: #e57370; }

/* the Feats tab */
.pf-feat-row:last-child { border-bottom: 0 !important; }
.pf-feat-name { min-width: 12rem; }
.pf-feat-results { position: absolute; z-index: 20; left: 0; right: 0; max-height: 26rem; overflow: auto; margin-top: .15rem; background: var(--bs-body-bg); }
.pf-feat-results .list-group-item { background-color: var(--bs-body-bg); }   /* (opaque: what is under the list must not show through it) */
.pf-feat-result { cursor: pointer; }
.pf-feat-results .pf-feat-result.is-active, .pf-feat-results .pf-feat-result:hover { background-color: color-mix(in srgb, var(--pf-gold) 14%, var(--bs-body-bg)); }
.pf-feat-result.is-unmet .pf-feat-result-name { text-decoration: line-through; color: var(--pf-ink-soft); }
.pf-feat-list { display: block; }

/* Racial traits that can be taken: a box to the left that is ticked while the trait is taken */
.pf-trait-box { display: inline-block; width: 1em; height: 1em; margin-right: .5em; border: 1px solid var(--bs-border-color); border-radius: .2em; vertical-align: -.15em; background: var(--bs-body-bg); }
.pf-trait-take[aria-pressed="true"] .pf-trait-box { background: var(--pf-heading, #7a5c1e); border-color: var(--pf-heading, #7a5c1e); box-shadow: inset 0 0 0 .14em var(--bs-body-bg); }
.pf-trait-take:hover .pf-trait-box { border-color: var(--pf-heading, #7a5c1e); }
/* The Edit button of a level says Close while its panel is open */
.pf-levels [data-bs-toggle="collapse"] .pf-edit-shut, .pf-levels [data-bs-toggle="collapse"][aria-expanded="true"] .pf-edit-open { display: none; }
.pf-levels [data-bs-toggle="collapse"][aria-expanded="true"] .pf-edit-shut { display: inline; }

/* why a search found a feat or trait (a bonus to a statistic, a class skill ...) */
.pf-feat-why { color: var(--pf-heading, #7a5c1e); }

/* The Allies tab: a card per ally, its top opens and closes it */
.pf-ally-head { cursor: pointer; user-select: none; }
.pf-ally-caret { display: inline-block; transition: transform .15s; }
.pf-ally-head[aria-expanded="true"] .pf-ally-caret { transform: rotate(90deg); }
.pf-ally-slot { border-style: dashed; }
.pf-ally-slot.is-optional { opacity: .8; }

/* Spells tab: a spell's tile and the empty box of its slot take the colour of its spell level: cyan at 0, purple at 4, crimson at 9 (the border at full strength, the background at 70%) */
.pf-spell-tile, .pf-spell-box {
    --pf-spell-hue: 190;
    border: 1px solid hsl(var(--pf-spell-hue) 70% 55%);
    color: #f1ecdf;
}
.pf-spell-tile {
    background: hsl(var(--pf-spell-hue) 55% 30% / .7);
}
.pf-spell-tile:hover, .pf-spell-tile:focus-visible {
    background: hsl(var(--pf-spell-hue) 60% 38% / .85);
    color: #fff;
}
.pf-spell-box {
    background-color: transparent;
}
.pf-spell-l0 { --pf-spell-hue: 190; }
.pf-spell-l1 { --pf-spell-hue: 213; }
.pf-spell-l2 { --pf-spell-hue: 237; }
.pf-spell-l3 { --pf-spell-hue: 259; }
.pf-spell-l4 { --pf-spell-hue: 280; }
.pf-spell-l5 { --pf-spell-hue: 298; }
.pf-spell-l6 { --pf-spell-hue: 316; }
.pf-spell-l7 { --pf-spell-hue: 332; }
.pf-spell-l8 { --pf-spell-hue: 346; }
.pf-spell-l9 { --pf-spell-hue: 358; }
