/* Cards share the parchment and lettering of the character sheet. Every
   measure is in cqw — hundredths of the card's width — so one design serves
   every printed size. The card's width and height come from where it sits. */

.card {
    container-type: size;
    --title-scale: 1;
    --body-scale: 1;
    --card-accent: var(--red);
}

.card--blue {
    --card-accent: var(--blue);
}

.card-ink {
    font-size: 2.65cqw;
}

.card-frame {
    position: absolute;
    inset: 3.4cqw;
    border: 0.22cqw solid var(--rule);
    border-radius: 1.2cqw;
    pointer-events: none;
}

.card-frame::before {
    content: "";
    position: absolute;
    inset: 0.9cqw;
    border: 0.12cqw solid oklch(0.74 0.04 72 / 0.6);
    border-radius: 0.6cqw;
}

.card-corner {
    position: absolute;
    width: 1.9cqw;
    height: 1.9cqw;
    background: var(--paper);
    border: 0.2cqw solid var(--card-accent);
    box-shadow: inset 0 0 0 0.3cqw var(--paper), inset 0 0 0 1cqw oklch(0.52 0.12 32 / 0.18);
    transform: rotate(45deg);
}

.card-corner--top-left { top: -1.15cqw; left: -1.15cqw; }
.card-corner--top-right { top: -1.15cqw; right: -1.15cqw; }
.card-corner--bottom-left { bottom: -1.15cqw; left: -1.15cqw; }
.card-corner--bottom-right { bottom: -1.15cqw; right: -1.15cqw; }

.card-content {
    position: absolute;
    inset: 7.4cqw 7.8cqw 6.6cqw;
    display: flex;
    flex-direction: column;
    gap: 2.2cqw;
}

.card-head {
    display: flex;
    align-items: flex-start;
    gap: 3cqw;
}

.card-heading {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.8cqw;
}

.card-title {
    margin: 0;
    font-size: calc(5.4cqw * var(--title-scale));
    font-weight: 400;
    line-height: 1.12;
    white-space: nowrap;
    overflow: hidden;
    padding: 0.12em 0 0.15em;
}

.card-title.is-wrapping {
    white-space: normal;
    max-height: 2.95em;
}

.card-initial {
    font-family: "UnifrakturMaguntia", serif;
    font-size: 1.62em;
    line-height: 0.8;
}

.card-initial--red { color: var(--red); }
.card-initial--blue { color: var(--blue); }

.card-title-rest {
    font-family: "IM Fell English SC", serif;
    letter-spacing: 0.035em;
    margin-left: 0.04em;
}

.card-type {
    margin: 0;
    font-size: 3.1cqw;
    font-style: italic;
    font-weight: 500;
    color: var(--ink-muted);
    line-height: 1.15;
}

.card-seal {
    position: relative;
    flex: none;
    width: 13.6cqw;
    height: 9.6cqw;
    display: grid;
    place-items: center;
    margin-top: 0.6cqw;
}

.card-seal-shape {
    position: absolute;
    inset: 0;
    overflow: visible;
}

.card-seal-rim {
    fill: var(--paper);
    stroke: var(--ink-muted);
    stroke-width: 1.4;
    stroke-linejoin: miter;
}

.card-seal-inner {
    fill: none;
    stroke: oklch(0.52 0.12 32 / 0.5);
    stroke-width: 1;
    stroke-linejoin: miter;
}

.card-seal-numeral {
    position: relative;
    font-family: "IM Fell English SC", serif;
    font-size: 4.4cqw;
    line-height: 1;
    color: var(--red);
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 1cqw 3.2cqw;
    margin: -0.6cqw 0 0;
    padding: 0;
    list-style: none;
}

.card-tag {
    display: inline-flex;
    align-items: center;
    gap: 1.3cqw;
    font-family: "IM Fell English SC", serif;
    font-size: 2.3cqw;
    letter-spacing: 0.05em;
    color: var(--card-accent);
}

.card-tag::before {
    content: "";
    width: 1.3cqw;
    height: 1.3cqw;
    transform: rotate(45deg);
    border: 0.18cqw solid var(--card-accent);
    background: var(--card-accent);
    box-shadow: inset 0 0 0 0.25cqw var(--paper);
}

.card-stats {
    display: flex;
    flex-wrap: wrap;
    gap: calc(1.8cqw * clamp(0.6, var(--body-scale), 1.15)) 3.4cqw;
    margin: 0;
    font-size: calc(3cqw * clamp(0.62, var(--body-scale), 1.15));
}

.card-stat {
    flex: 1 1 10.5em;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.12em;
}

.card-stat--wide {
    flex-basis: 100%;
}

.card-stat-value {
    margin: 0;
    font-weight: 600;
    line-height: 1.2;
    padding: 0 0.1em 0.08em;
    border-bottom: 0.2cqw solid var(--rule);
}

.card-stat-label {
    font-family: "IM Fell English SC", serif;
    font-size: 0.66em;
    letter-spacing: 0.06em;
    color: var(--ink-muted);
}

.card-divider {
    flex: none;
    position: relative;
    height: 1.6cqw;
    margin: 0.4cqw 0;
}

.card-divider::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    border-top: 0.2cqw solid var(--rule);
}

.card-divider::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 1.4cqw;
    height: 1.4cqw;
    background: var(--paper);
    border: 0.2cqw solid var(--card-accent);
    transform: translate(-50%, -50%) rotate(45deg);
}

.card-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.card-text {
    height: 100%;
    font-size: calc(2.65cqw * var(--body-scale));
    font-weight: 500;
    line-height: 1.32;
    text-align: justify;
    hyphens: auto;
    overflow-wrap: break-word;
}

.card-text.is-two-column {
    column-count: 2;
    column-gap: 4cqw;
    column-rule: 0.12cqw solid oklch(0.74 0.04 72 / 0.6);
    column-fill: auto;
}

.card-text > :first-child {
    margin-top: 0;
}

.card-text p {
    margin: 0 0 0.5em;
}

.card-text > p:first-child::first-letter {
    float: left;
    font-family: "UnifrakturMaguntia", serif;
    font-weight: 400;
    font-size: 2.55em;
    line-height: 0.84;
    margin: 0.06em 0.1em 0 0;
    color: var(--card-accent);
}

.card-text strong {
    font-weight: 700;
}

.card-text h3 {
    margin: 0.7em 0 0.3em;
    font-family: "IM Fell English SC", serif;
    font-size: 1.08em;
    font-weight: 400;
    letter-spacing: 0.04em;
    color: var(--card-accent);
    break-after: avoid;
}

.card-text ul {
    margin: 0 0 0.5em;
    padding: 0;
    list-style: none;
}

.card-text li {
    position: relative;
    padding-left: 1.1em;
    margin-bottom: 0.2em;
}

.card-text li::before {
    content: "";
    position: absolute;
    left: 0.2em;
    top: 0.55em;
    width: 0.32em;
    height: 0.32em;
    transform: rotate(45deg);
    background: var(--card-accent);
}

.card-text table {
    width: 100%;
    margin: 0.2em 0 0.7em;
    border-collapse: collapse;
    font-size: 0.9em;
    line-height: 1.22;
    text-align: left;
    break-inside: avoid;
}

.card-text th {
    font-family: "IM Fell English SC", serif;
    font-weight: 400;
    letter-spacing: 0.04em;
    color: var(--ink-muted);
    border-bottom: 0.2cqw solid var(--rule);
    padding: 0.15em 0.4em;
}

.card-text td {
    vertical-align: top;
    border-bottom: 0.12cqw solid oklch(0.74 0.04 72 / 0.55);
    padding: 0.2em 0.4em;
}

.card-foot {
    flex: none;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 3cqw;
    padding-top: 1.2cqw;
    border-top: 0.2cqw solid var(--rule);
    color: var(--ink-muted);
}

.card-foot-note {
    font-family: "IM Fell English SC", serif;
    font-size: 2.05cqw;
    letter-spacing: 0.05em;
}

.card-foot-source {
    font-size: 2.2cqw;
    font-style: italic;
    text-align: right;
}
