/* ============================================================
   Card Printing Layout & Base
============================================================ */
:root {
    /* Sizes */
    --card-width: 2.5in;
    --card-height: 3.5in;
    --card-radius: 0.125in;

    /* Border widths */
    --border-thin: 0.13em;
    --border-medium: 0.2em;

    /* Border colors */
    --card-border-color: #222;
    --section-border-color: #222;

    /* Font stacks */
    --font-body: "Georgia", serif;
    --font-accent: "Garamond", serif;
    --font-sans: "Arial", sans-serif;

    /* Font sizes */
    --text-regular: 1em;
    --text-small: 0.875em;
    --text-xsmall: 0.75em;

    /* Text colors */
    --text-color: #000;
    --flavor-color: #444;
    --hint-color: #666;

    /* Card type colors */
    --color-denizen: #AB6767;
    --color-belonging: #66513D;
    --color-structure: #5F669B;
    --color-resource: #83AA80;
    --color-mysticism: #8E587F;
    --color-trap: #8A8987;;
    --color-fortification: #288674;

    /* Card type header gradients */
    --color-denizen-hd: linear-gradient(to bottom, #F4CCCC, #E49C9C);
    --color-belonging-hd: linear-gradient(to bottom, #D6C4B3, #B89B7A);
    --color-structure-hd: linear-gradient(to bottom, #D3D6E8, #8D98D2);
    --color-resource-hd: linear-gradient(to bottom, #C3F1BC, #9DF690);
    --color-mysticism-hd: linear-gradient(to bottom, #E0C9D8, #C29AB6);
    --color-trap-hd: linear-gradient(to bottom, #F2EDEB, #A8A5A3);
    --color-fortification-hd: linear-gradient(to bottom, #C2D3CD, #81BDAF);

    /* Card rarity colors */
    --cc1: #d18de2;
    --cc2: #e4db5c;
    --cc3: #CCDADD;
    --cc4: #FB8A4B;
}

svg,
path,
text {
    fill: none;
    stroke: none;
}

/* ============================================================
   Card Base
============================================================ */
.hcard-wrapper {
    width: 100%;
    aspect-ratio: 2.5 / 3.5;
    position: relative;
    display: inline-block;
}

.deck-count-badge {
    position: absolute;
    top: 0rem;
    right: 0rem;
    background: #d9534f; /* Bootstrap red */
    color: #fff;
    font-weight: bold;
    font-size: 2rem;
    border-radius: 50%;
    width: 4rem;
    height: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 0 4px rgba(0,0,0,0.3);
    z-index: 10;
}


.hcard {
    width: 100%;
    height: 100%;
    font-size: min(2.2cqw, 14pt); /* scales with container */
    background-color: black;
    border: var(--border-medium) solid var(--card-border-color);
    border-radius: var(--card-radius);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    padding: 0.2em;
    font-family: var(--font-body);
}

.hcard-inner {
    border-radius: calc(var(--card-radius) * 0.5);
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 0.6em;
}

.hcard-info {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
}

/* ============================================================
   Card Sections
============================================================ */
.name-and-uniqueness {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.4em;
    border-radius: 0.17rem;
    border: var(--border-thin) solid var(--section-border-color);
    height: 2.2em;
}

.cost-and-requirements {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    width: calc(100% - 0.4em);
    border: var(--border-thin) solid var(--section-border-color);
    border-top: none;
    background: linear-gradient(to bottom, #FAF7EF, #F1E7CC);
    border-radius: 0 0 0.17rem 0.17rem;
    padding: 0.4em;
    height: 1.8em;
}

.image-and-under {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    width: calc(100% - 0.4em);
    height: calc(50% - 5.6em);
    position: relative;
}

.image {
    flex: 1 1 auto;
    position: relative;
    width: 100%;
    overflow: hidden;
    border: var(--border-thin) solid var(--section-border-color);
    border-top: none;
    border-bottom: none;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1;
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.under-image {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.4em;
    border: var(--border-thin) solid var(--section-border-color);
    background: linear-gradient(to bottom, #FAF7EF, #F1E7CC);
    border-radius: 0 0 0.17rem 0.17rem;
    flex: 0 0 2.2em;
}

/* ============================================================
   Copy Count Badge
============================================================ */
.copy-count-badge {
    width: 3rem;
    height: 1.6rem;
    position: absolute;
    bottom: 1.8em;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    pointer-events: none;
}

.copy-count-svg {
    width: 100%;
    height: 100%;
}

.triangle {
    stroke: #222;
    stroke-width: 4;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.copy-count-text {
    font-family: Arial, sans-serif;
    font-size: 2.3em;
    fill: #000;
}

/* ============================================================
   Text & Boxes
============================================================ */
.kind-and-specialty {
    white-space: nowrap;
    max-width: 100%;
    display: block;
}

.card-textbox {
    width: calc(100% - 0.4em);
    margin: 1em 0;
    border: var(--border-thin) solid var(--section-border-color);
    background: linear-gradient(to bottom, #FAF7EF, #F1E7CC);
    border-radius: 0.17rem;
    padding: 0.5em;
    flex: 1;
}

.text-main {
    width: 100%;
    align-self: center;
    line-height: 1.3em;
    height: 100%;
    overflow: hidden;
}

.text-main > br {
    margin-bottom: 1em;
}

.hcard-text {
    font-size: 1em;
}

.text-flavor {
    border-top: #ccc 1pt solid;
    padding-top: 4pt;
    width: calc(100% - 6pt);
    align-self: center;
}

/* ============================================================
   Bottom Row
============================================================ */
.bottom {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    width: calc(100% - 0.4em);
    margin-bottom: 0.5em;
}

.count-and-unit {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    position: relative;
}

.count {
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: white;
    width: 3em;
    height: 3em;
    border: var(--border-thin) solid var(--card-border-color);
    position: absolute;
    z-index: 1;
}

.unit {
    margin-left: 2em;
    padding: 0.5em 0.8em 0.5em 1.4em;
    height: auto;
    background: linear-gradient(to bottom, #FAF7EF, #F1E7CC);
    border: var(--border-thin) solid var(--section-border-color);
    border-radius: 0.17rem;
}

.stats {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    gap: 0.5em;
    margin-left: auto;
    margin-right: 0;
}

.stat {
    height: 2.5em;
    width: 2.5em;
    display: flex;
    align-items: center;
    justify-content: center;
    border: var(--border-thin) solid var(--section-border-color);
    background: linear-gradient(to bottom, #FAF7EF, #F1E7CC);
    border-radius: 0.17rem;
}

/* ============================================================
   Bounty Circles
============================================================ */
.bounty-circle {
    width: 1em;
    height: 1em;
    border: 0.1em solid var(--card-border-color);
    border-radius: 50%;
    vertical-align: middle;
    margin: 0 0.2em;
    box-shadow: 0 0.1em 0.2em rgba(0, 0, 0, 0.4);
    display: inline-block;
}

/* Gradient Variants */
.bounty-red {
    background: linear-gradient(135deg, #d65555, #a13232);
}

.bounty-green {
    background: linear-gradient(135deg, #80df8b, #66e347);
}

.bounty-blue {
    background: linear-gradient(135deg, #a0c1f0, #0085c6);;
}

.bounty-gold {
    background: linear-gradient(135deg, #ffe082, #f9a825);
}

.bounty-gray {
    background: linear-gradient(135deg, #dddddd, #888888);
}

.bounty-any {
    background: linear-gradient(78deg, #dddddd, #d65555, #ffe082, #a2b8d8, #6ad176);
}

/* ============================================================
   Color-Themed Cards
============================================================ */
.hcard-inner.denizen {
    background-color: var(--color-denizen);
}
.hcard-inner.belonging {
    background-color: var(--color-belonging);
}
.hcard-inner.structure {
    background-color: var(--color-structure);
}
.hcard-inner.resource {
    background-color: var(--color-resource);
}
.hcard-inner.mysticism {
    background-color: var(--color-mysticism);
}
.hcard-inner.trap {
    background-color: var(--color-trap);
}
.hcard-inner.fortification {
    background-color: var(--color-fortification);
}

/* Header backgrounds */
.hcard-inner.denizen > .hcard-info > .name-and-uniqueness,
.hcard-inner.denizen > .hcard-info > .bottom > .count-and-unit > .count {
    background: var(--color-denizen-hd);
}
.hcard-inner.belonging > .hcard-info > .name-and-uniqueness,
.hcard-inner.belonging > .hcard-info > .bottom > .count-and-unit > .count {
    background: var(--color-belonging-hd);
}
.hcard-inner.structure > .hcard-info > .name-and-uniqueness,
.hcard-inner.structure > .hcard-info > .bottom > .count-and-unit > .count {
    background: var(--color-structure-hd);
}
.hcard-inner.resource > .hcard-info > .name-and-uniqueness,
.hcard-inner.resource > .hcard-info > .bottom > .count-and-unit > .count {
    background: var(--color-resource-hd);
}
.hcard-inner.mysticism > .hcard-info > .name-and-uniqueness,
.hcard-inner.mysticism > .hcard-info > .bottom > .count-and-unit > .count {
    background: var(--color-mysticism-hd);
}
.hcard-inner.trap > .hcard-info > .name-and-uniqueness,
.hcard-inner.trap > .hcard-info > .bottom > .count-and-unit > .count {
    background: var(--color-trap-hd);
}
.hcard-inner.fortification > .hcard-info > .name-and-uniqueness,
.hcard-inner.fortification > .hcard-info > .bottom > .count-and-unit > .count {
    background: var(--color-fortification-hd);
}

/* ============================================================
   Copy Count Variants
============================================================ */
.triangle.cc1 { fill: var(--cc1); }
.triangle.cc2 { fill: var(--cc2); }
.triangle.cc3 { fill: var(--cc3); }
.triangle.cc4 { fill: var(--cc4); }
