/*
 * Kyrell — D&D 5e Stat Block Styles
 * Used by Bestiary entries (Phase 4) and Character Sheets (Phase 3).
 * ─────────────────────────────────────────────────────────────────────────── */

/* ── Stat Block Container ───────────────────────────────────────────────── */
.stat-block {
    background: #fdf1dc;
    color: #1a0a00;
    border: 1px solid #9c7836;
    border-radius: 3px;
    padding: 12px 14px;
    font-family: 'Bookinsanity', 'Palatino Linotype', Georgia, serif;
    font-size: 13.5px;
    line-height: 1.4;
    max-width: 380px;
    box-shadow: 2px 2px 6px rgba(0,0,0,0.5);
    position: relative;
    overflow: hidden;
}

/* Top and bottom orange bars */
.stat-block::before,
.stat-block::after {
    content: '';
    position: absolute;
    left: 0; right: 0;
    height: 6px;
    background: linear-gradient(to right, #9c7836, #c8a84a, #9c7836);
}
.stat-block::before { top: 0; }
.stat-block::after  { bottom: 0; }

/* Creature name header */
.stat-block__name {
    font-family: 'MrEavesSmallCaps', 'Palatino Linotype', serif;
    font-size: 22px;
    font-weight: 700;
    color: #58180d;
    line-height: 1.1;
    margin-bottom: 2px;
}

.stat-block__meta {
    font-style: italic;
    font-size: 12.5px;
    color: #58180d;
    margin-bottom: 8px;
}

/* Section dividers */
.stat-block__divider {
    height: 6px;
    background: linear-gradient(to right, #9c7836, #c8a84a, #9c7836);
    margin: 8px -14px;
    border: none;
}

/* Property rows (AC, HP, Speed) */
.stat-block__prop {
    margin-bottom: 2px;
    font-size: 13.5px;
}
.stat-block__prop-label {
    font-weight: 700;
    color: #58180d;
}

/* Ability scores grid */
.stat-block__abilities {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    text-align: center;
    gap: 4px;
    margin: 8px 0;
}
.ability-block { display: flex; flex-direction: column; }
.ability-block__name {
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #58180d;
}
.ability-block__score {
    font-size: 13.5px;
}

/* Section labels (Actions, Traits, etc.) */
.stat-block__section-title {
    font-family: 'MrEavesSmallCaps', 'Palatino Linotype', serif;
    font-size: 18px;
    font-weight: 700;
    color: #58180d;
    border-bottom: 1px solid #9c7836;
    margin: 8px 0 4px;
    padding-bottom: 1px;
}

/* Individual trait/action entries */
.stat-block__trait {
    margin-bottom: 6px;
    font-size: 13.5px;
}
.stat-block__trait-name {
    font-weight: 700;
    font-style: italic;
    color: #58180d;
}

/* Legendary action point counter */
.stat-block__legendary-note {
    font-style: italic;
    font-size: 12.5px;
    margin-bottom: 6px;
}

/* CR / XP line */
.stat-block__challenge {
    margin-bottom: 2px;
}


/* ── Character Sheet ────────────────────────────────────────────────────── */
.char-sheet {
    font-family: var(--font-ui);
    font-size: var(--text-sm);
}

.char-sheet__header {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-6);
    margin-bottom: var(--sp-8);
    padding-bottom: var(--sp-6);
    border-bottom: 1px solid var(--color-border);
}

.char-sheet__portrait {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: var(--radius-md);
    border: 2px solid var(--color-border);
    flex-shrink: 0;
}

.char-sheet__name {
    font-family: var(--font-heading);
    font-size: var(--text-2xl);
    color: var(--color-gold);
    margin-bottom: var(--sp-1);
}

.char-sheet__meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-4);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

.char-sheet__meta-item { display: flex; align-items: center; gap: var(--sp-2); }
.char-sheet__meta-label { color: var(--color-text-muted); text-transform: uppercase; font-size: var(--text-xs); letter-spacing: 0.08em; }

/* Ability score blocks */
.ability-score-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: var(--sp-3);
    margin-bottom: var(--sp-6);
}

.ability-score-block {
    background: var(--color-surface-inset);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: var(--sp-3) var(--sp-2);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-1);
}

.ability-score-block__name {
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
}

.ability-score-block__score {
    font-family: var(--font-heading);
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--color-gold);
    line-height: 1;
}

.ability-score-block__modifier {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text-secondary);
}

/* Combat stats bar */
.combat-stats {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-4);
    margin-bottom: var(--sp-6);
}

.combat-stat {
    background: var(--color-surface-inset);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: var(--sp-3) var(--sp-4);
    text-align: center;
    min-width: 80px;
}
.combat-stat__value {
    font-family: var(--font-heading);
    font-size: var(--text-xl);
    color: var(--color-gold);
    font-weight: 700;
    line-height: 1.1;
}
.combat-stat__label {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Skills / saving throws list */
.skill-list {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-2);
    font-size: var(--text-sm);
}
.skill-list__item {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    color: var(--color-text-secondary);
}
.skill-list__prof {
    width: 14px; height: 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 9px;
    flex-shrink: 0;
}
.skill-list__prof--proficient  { background: var(--color-gold); border-color: var(--color-gold); color: var(--color-bg); }
.skill-list__prof--expertise   { background: var(--color-gold-bright); border-color: var(--color-gold-bright); color: var(--color-bg); }
.skill-list__bonus { font-weight: 600; color: var(--color-gold); min-width: 28px; text-align: right; }
.skill-list__name  { flex: 1; }

/* Spell slots table */
.spell-slots {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: var(--sp-2);
    text-align: center;
}
.spell-slot-block { display: flex; flex-direction: column; gap: var(--sp-1); }
.spell-slot-block__level {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    text-transform: uppercase;
}
.spell-slot-block__count {
    font-family: var(--font-heading);
    font-size: var(--text-lg);
    color: var(--color-gold);
    font-weight: 700;
}

/* Print overrides for character sheet */
@media print {
    .stat-block {
        box-shadow: none;
        border: 1px solid #9c7836;
    }
    .char-sheet__meta { gap: 8px; }
}


/* ── Bestiary Show Page ─────────────────────────────────────────────────── */

/* Wide stat block variant for the show page (overrides max-width) */
.stat-block--wide {
    max-width: 100%;
    font-size: 14px;
}

/* Layout wrapper: stat block + sidebar or full-width */
.bestiary-layout {
    margin-bottom: var(--sp-10);
}

/* Admin bar (edit button + gm badge row above the stat block) */
.bestiary-show__admin-bar {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    margin-bottom: var(--sp-4);
}

/* Lore section below stat block */
.bestiary-lore {
    margin-bottom: var(--sp-8);
    padding-bottom: var(--sp-6);
    border-bottom: 1px solid var(--color-border-subtle);
}
.bestiary-lore:last-child { border-bottom: none; }

.bestiary-habitat {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    font-style: italic;
}

/* Responsive: cap stat block width on wide screens */
@media (min-width: 900px) {
    .stat-block--wide {
        max-width: 680px;
    }
}
