/*
 * Hive: a honeycomb. The portrait is a hexagonal cell with the six abilities
 * locked around it, their skills fanning out to either side; the rest of the
 * page is left to combat, vitals and two generous columns of notes.
 */

.hive-page {
    --hive-hexagon: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
    display: flex;
    flex-direction: column;
    gap: 5mm;
}

.hive-page .sheet-toggle-mark {
    border: none;
    transform: none;
    background: var(--card-accent);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M10 2.2L18.4 17.2H1.6Z' fill='none' stroke='%23000' stroke-width='2.2' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M10 2.2L18.4 17.2H1.6Z' fill='none' stroke='%23000' stroke-width='2.2' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

.hive-page .sheet-toggle-input:checked + .sheet-toggle-mark {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M10 2.2L18.4 17.2H1.6Z' fill='%23000' stroke='%23000' stroke-width='2.2' stroke-linejoin='round'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M10 2.2L18.4 17.2H1.6Z' fill='%23000' stroke='%23000' stroke-width='2.2' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* ---------- the head ---------- */

.hive-head {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    column-gap: 8mm;
}

.hive-equipment .hive-head {
    align-items: center;
}

.hive-identity,
.hive-casting {
    display: flex;
    gap: 3mm;
}

.hive-identity .sheet-slot { width: 24mm; }
.hive-identity .identity-level { width: 11mm; }
.hive-casting .casting-ability { width: 30mm; }
.hive-casting .casting-save,
.hive-casting .casting-attack { width: 16mm; }

.hive-identity .sheet-slot-label,
.hive-casting .sheet-slot-label,
.hive-cells .sheet-slot-label {
    text-align: center;
}

.hive-identity .sheet-input,
.hive-casting .sheet-input,
.hive-cells .sheet-input {
    text-align: center;
}

/* ---------- the comb ---------- */

.hive-comb {
    position: relative;
    width: 170mm;
    height: 84mm;
    margin: 0 auto;
}

.hive-cell,
.hive-portrait {
    position: absolute;
    width: 27.7mm;
    height: 32mm;
}

.hive-cell::before,
.hive-cell::after,
.hive-portrait::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.hive-cell::before {
    background: var(--card-accent-soft);
    clip-path: var(--hive-hexagon);
}

.hive-cell::after,
.hive-portrait::before {
    background: var(--card-rule);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 115.5' preserveAspectRatio='none'%3E%3Cpolygon points='50,1.6 98.6,29.7 98.6,85.8 50,113.9 1.4,85.8 1.4,29.7' fill='none' stroke='%23000' stroke-width='2.4'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 115.5' preserveAspectRatio='none'%3E%3Cpolygon points='50,1.6 98.6,29.7 98.6,85.8 50,113.9 1.4,85.8 1.4,29.7' fill='none' stroke='%23000' stroke-width='2.4'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}

.hive-portrait { left: 71.15mm; top: 26mm; }
.hive-cell-strength { left: 98.85mm; top: 26mm; }
.hive-cell-constitution { left: 43.45mm; top: 26mm; }
.hive-cell-intelligence { left: 85mm; top: 2mm; }
.hive-cell-dexterity { left: 57.3mm; top: 2mm; }
.hive-cell-wisdom { left: 85mm; top: 50mm; }
.hive-cell-charisma { left: 57.3mm; top: 50mm; }

.hive-portrait .sheet-portrait {
    position: relative;
    width: 100%;
    height: 100%;
}

.hive-page .sheet-portrait-frame {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 0;
    clip-path: var(--hive-hexagon);
}

.hive-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.8mm;
    padding: 5mm 2mm 4mm;
}

.hive-cell > * {
    position: relative;
    z-index: 1;
}

.hive-cell .ability-name {
    font-family: var(--card-label-font);
    font-size: 5.4pt;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.hive-cell .ability-modifier {
    width: 13mm;
}

.hive-cell .ability-modifier .sheet-input {
    padding: 0.4mm 0;
    font-size: 14pt;
    box-shadow: none;
}

.hive-cell-foot {
    display: flex;
    align-items: center;
    gap: 1mm;
}

.hive-cell-foot .ability-score {
    width: 7mm;
}

.hive-cell-foot .ability-score .sheet-input {
    padding: 0.3mm 0;
    font-size: 8pt;
    box-shadow: inset 0 0 0 0.22mm var(--card-rule);
}

.hive-cell-foot .ability-save {
    gap: 0.8mm;
}

.hive-cell-foot .ability-save-label {
    display: none;
}

.hive-cell-foot .ability-save-value {
    width: 7mm;
}

.hive-cell-foot .ability-save-value .sheet-input {
    padding: 0.3mm 0;
    font-size: 8pt;
}

.hive-list {
    position: absolute;
    width: 40mm;
}

.hive-list-strength { left: 128.6mm; top: 39.6mm; }
.hive-list-intelligence { left: 114.7mm; top: 5.5mm; }
.hive-list-wisdom { left: 114.7mm; top: 53.5mm; }
.hive-list-constitution { left: 1.5mm; top: 33mm; }
.hive-list-dexterity { left: 15.3mm; top: 10.8mm; }
.hive-list-charisma { left: 15.3mm; top: 56.4mm; }

.hive-list .skill-list {
    gap: 1mm;
}

.hive-list .skill-row {
    gap: 1mm;
}

.hive-list .skill-marks {
    gap: 0.8mm;
}

.hive-list .sheet-toggle,
.hive-list .sheet-toggle-mark {
    width: 3mm;
    height: 3mm;
}

.hive-list .skill-modifier {
    width: 7mm;
}

.hive-list .skill-name {
    font-size: 7.2pt;
}

.hive-list-dexterity .skill-row,
.hive-list-charisma .skill-row {
    flex-direction: row-reverse;
}

.hive-list-dexterity .skill-name,
.hive-list-charisma .skill-name {
    text-align: right;
}

.hive-list-constitution .ability-aside {
    flex-direction: row;
    gap: 2mm;
}

.hive-list-constitution .aside-slot {
    flex: 1;
}

.hive-list-constitution .aside-slot .sheet-slot-label {
    text-align: center;
    white-space: normal;
    line-height: 1.2;
}

.hive-page .inspiration {
    justify-content: center;
    margin-top: -2mm;
}

/* ---------- the band and the notes ---------- */

.hive-band {
    display: grid;
    grid-template-columns: 1fr 58mm;
    column-gap: 5mm;
}

.hive-band .hive-cells {
    grid-column: 1;
}

.hive-band .hive-cells + .hive-cells {
    margin-top: 2.4mm;
}

.hive-band .damage-log {
    grid-column: 2;
    grid-row: 1 / span 2;
}

.hive-cells {
    display: flex;
    gap: 3mm;
}

.hive-cells .sheet-slot {
    flex: 1;
}

.hive-cells .conditions {
    flex: 1.7;
}

.hive-band .armor-class .sheet-input,
.hive-band .hit-points .sheet-input {
    font-family: var(--card-title-font);
    font-weight: var(--card-title-weight);
    font-size: 13pt;
    color: var(--card-accent);
}

.hive-notes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6mm;
    flex: 1;
    min-height: 0;
}

/* ---------- page two: honeycomb purse and bricked stores ---------- */

.hive-purse {
    display: flex;
    gap: 2mm;
}

.hive-purse .coin {
    position: relative;
    width: 22mm;
    height: 25.4mm;
    justify-content: center;
    align-items: center;
    gap: 0.6mm;
}

.hive-purse .coin:nth-child(even) {
    margin-top: 6mm;
}

.hive-purse .coin::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--card-accent-soft);
    clip-path: var(--hive-hexagon);
}

.hive-purse .coin > * {
    position: relative;
}

.hive-purse .coin .sheet-input {
    width: 13mm;
    padding: 0.4mm 0;
    text-align: center;
    box-shadow: none;
}

.hive-bricks {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: 1fr 1fr;
    gap: 5mm;
    flex: 1;
    min-height: 0;
}

.hive-bricks .sheet-area:nth-child(1) { grid-column: 1 / 4; }
.hive-bricks .sheet-area:nth-child(2) { grid-column: 4 / 6; }
.hive-bricks .sheet-area:nth-child(3) { grid-column: 1 / 3; }
.hive-bricks .sheet-area:nth-child(4) { grid-column: 3 / 6; }

.hive-page .attunement-slots {
    gap: 8mm;
}

/* ---------- page three: a strip of cells for the slots ---------- */

.hive-slots {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 1.6mm;
}

.hive-slots .spell-slot {
    position: relative;
    flex-direction: column;
    align-items: center;
    gap: 0.8mm;
    width: 19mm;
    padding: 4.5mm 0 0;
}

.hive-slots .spell-slot:nth-child(even) {
    margin-top: 10mm;
}

.hive-slots .spell-slot::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 19mm;
    height: 22mm;
    background: var(--card-accent-soft);
    clip-path: var(--hive-hexagon);
}

.hive-slots .spell-slot > * {
    position: relative;
}

.hive-slots .spell-slot-level {
    width: auto;
    font-size: 10pt;
}

.hive-slots .spell-slot-total {
    width: 9mm;
}

.hive-slots .spell-slot-total .sheet-input {
    padding: 0.3mm 0;
    box-shadow: inset 0 0 0 0.22mm var(--card-rule);
}

.hive-slots .spell-slot-expended {
    width: 100%;
    flex: none;
    margin-top: 5.5mm;
}

.hive-slots .spell-slot-expended .sheet-input {
    padding: 0.5mm;
    text-align: center;
}
