/* ═══════════════════════════════════════════════════════════════
   VOXANA CODEX — PHB-STYLED COMPONENTS
   Comprehensive styling for D&D 5e sourcebook components
   Stat blocks, callout boxes, tables, and advanced layouts
   ═══════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════
   1. STAT BLOCKS — Monster stat blocks with PHB styling
   ═══════════════════════════════════════ */

.stat-block {
    background: #fdf1dc;
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    margin: 1.5rem 0;
    max-width: 100%;
    position: relative;
    font-family: var(--font-body);
    overflow: hidden;
    break-inside: avoid;
}

/* Full-width variant */
.stat-block.wide {
    max-width: 100%;
}

/* Decorative top/bottom bars with tapered gradient effect */
.stat-block-bar {
    height: 8px;
    background: linear-gradient(
        90deg,
        rgba(88, 24, 13, 0.3) 0%,
        rgba(88, 24, 13, 1) 10%,
        rgba(88, 24, 13, 1) 90%,
        rgba(88, 24, 13, 0.3) 100%
    );
}

/* Creature name — large maroon heading */
.stat-block h2.creature-name {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    color: var(--maroon);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0.8rem 0.8rem 0.2rem;
    border-bottom: none;
    padding-bottom: 0;
    font-weight: 700;
}

/* Type line — italicized descriptor */
.stat-block p.creature-type {
    font-size: 0.85rem;
    font-style: italic;
    color: var(--text);
    margin: 0 0.8rem 0.6rem;
    padding-left: 0.3rem;
}

/* Horizontal rules within stat blocks */
.stat-block-rule {
    height: 1px;
    background: var(--maroon);
    margin: 0.6rem 0;
    opacity: 0.8;
}

/* Stat block trait section (legendary resistance, etc.) */
.stat-block-traits {
    margin: 0.8rem 0;
    padding: 0 0.8rem;
}

.stat-block-traits p {
    margin: 0.4rem 0;
    font-size: 0.9rem;
}

.stat-block-traits strong {
    color: #000;
    font-weight: 700;
}

.stat-block-traits em {
    font-style: italic;
}

/* Section headers (Actions, Reactions, Legendary Actions) */
.stat-block h3.stat-block-section {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    color: var(--maroon);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 1rem 0.8rem 0.5rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--maroon);
    font-weight: 700;
}

/* All stat block content padding */
.stat-block p {
    margin: 0.5rem 0.8rem;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Ability score table */
.stat-block table.ability-scores {
    width: 100%;
    margin: 0.8rem 0;
    border-collapse: collapse;
    font-family: var(--font-table);
}

.stat-block table.ability-scores th {
    background: transparent;
    color: var(--maroon);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.4rem 0.2rem;
    border-bottom: 2px solid var(--maroon);
    text-align: center;
}

.stat-block table.ability-scores td {
    background: rgba(0, 0, 0, 0.02);
    color: var(--text);
    font-size: 0.85rem;
    padding: 0.35rem 0.2rem;
    text-align: center;
    border: none;
}

/* Helper text in stat blocks */
.stat-block .note {
    font-size: 0.8rem;
    font-style: italic;
    color: var(--text-muted);
    margin: 0.4rem 0.8rem;
}

/* ═══════════════════════════════════════
   2. CALLOUT BOXES / SIDEBARS
   ═══════════════════════════════════════ */

/* Base callout styling */
.entry-content .callout {
    border-left: 4px solid;
    background-color: #f9f8f6;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 2px;
    font-size: 0.88rem;
    break-inside: avoid;
}

.entry-content .callout h6 {
    font-family: var(--font-table);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 0.6rem 0;
    padding: 0;
    border: none;
}

.entry-content .callout p {
    margin: 0.4rem 0;
    font-size: 0.9rem;
}

/* Green callout — nature, lore, world info */
.entry-content .callout-green {
    background: #e0f0d0;
    border-left-color: #4a7a2a;
}

.entry-content .callout-green h6 {
    color: #4a7a2a;
}

/* Blue callout — arcane, magic, mechanics */
.entry-content .callout-blue {
    background: #d8e8f8;
    border-left-color: #2a5a8a;
}

.entry-content .callout-blue h6 {
    color: #2a5a8a;
}

/* Red callout — danger, warnings, combat */
.entry-content .callout-red,
.entry-content .callout-pink {
    background: #f8e0e0;
    border-left-color: #8a2a2a;
}

.entry-content .callout-red h6,
.entry-content .callout-pink h6 {
    color: #8a2a2a;
}

/* Yellow callout — tips, notes, items */
.entry-content .callout-yellow {
    background: #f8f0d0;
    border-left-color: #8a7a2a;
}

.entry-content .callout-yellow h6 {
    color: #8a7a2a;
}

/* Purple callout — DM notes, secrets */
.entry-content .callout-purple {
    background: #e8d8f0;
    border-left-color: #6a2a8a;
}

.entry-content .callout-purple h6 {
    color: #6a2a8a;
}

/* Grey callout — generic, neutral */
.entry-content .callout-grey {
    background: #e8e8e8;
    border-left-color: #666;
}

.entry-content .callout-grey h6 {
    color: #666;
}

/* ═══════════════════════════════════════
   3. ENHANCED TABLE STYLING
   ═══════════════════════════════════════ */

/* Alternating row colors with green tint */
.entry-content table tr:nth-child(odd) td {
    background: var(--bg-green, #e2efc6);
}

.entry-content table tr:nth-child(even) td {
    background: transparent;
}

/* Table headers — maroon, small-caps, uppercase */
.entry-content table th {
    font-family: var(--font-table);
    color: var(--maroon);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.45rem 0.6rem;
    border-bottom: 2px solid var(--maroon);
    text-align: left;
    font-weight: 700;
    background: transparent;
}

/* D20 roll table — two-column layout for d20/results */
.entry-content table.table-d20 {
    max-width: 500px;
}

.entry-content table.table-d20 th:first-child {
    width: 20%;
}

.entry-content table.table-d20 th:last-child {
    width: 80%;
}

/* D100 roll table — two-column layout for d100/results */
.entry-content table.table-d100 {
    max-width: 500px;
}

.entry-content table.table-d100 th:first-child {
    width: 15%;
}

.entry-content table.table-d100 th:last-child {
    width: 85%;
}

/* Split table — side-by-side d12 tables */
.entry-content table.table-split {
    display: inline-table;
    width: calc(50% - 0.75rem);
    margin-right: 1.5rem;
    vertical-align: top;
}

.entry-content table.table-split:nth-of-type(even) {
    margin-right: 0;
}

@media (max-width: 768px) {
    .entry-content table.table-split {
        display: table;
        width: 100%;
        margin-right: 0;
        margin-bottom: 1rem;
    }
}

/* Class feature table — full width, many columns */
.entry-content table.table-class {
    width: 100%;
}

/* ═══════════════════════════════════════
   4. TWO-COLUMN LAYOUT
   ═══════════════════════════════════════ */

.entry-content.two-column {
    column-count: 2;
    column-gap: 1.5rem;
}

/* Column divider rule */
.entry-content.two-column {
    column-rule: 1px solid rgba(88, 24, 13, 0.15);
}

/* Elements that span all columns */
.entry-content.two-column .full-width,
.entry-content.two-column .stat-block.wide {
    column-span: all;
    margin-left: 0;
    margin-right: 0;
}

/* Mobile: collapse to single column */
@media (max-width: 768px) {
    .entry-content.two-column {
        column-count: 1;
        column-rule: none;
    }
}

/* ═══════════════════════════════════════
   5. HEADING HIERARCHY — Book-style
   ═══════════════════════════════════════ */

/* h1 — Chapter Title */
.entry-content h1 {
    font-family: var(--font-heading-display);
    font-size: 2rem;
    color: var(--maroon);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 1.5rem 0 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid var(--maroon);
    page-break-after: avoid;
}

/* h2 — Section / Heading 1 */
.entry-content h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--maroon);
    margin: 1.5rem 0 0.5rem;
    padding-bottom: 0.3rem;
    border-bottom: 2px solid var(--rule-color);
    page-break-after: avoid;
    letter-spacing: 0.5px;
}

/* h3 — Subsection / Heading 2 */
.entry-content h3 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: var(--maroon);
    margin: 1.25rem 0 0.4rem;
    padding-bottom: 0.2rem;
    border-bottom: 1px solid var(--rule-color);
    page-break-after: avoid;
}

/* h4 — Feature / Heading 3 */
.entry-content h4 {
    font-family: var(--font-heading);
    font-size: 1rem;
    color: var(--maroon);
    margin: 1rem 0 0.4rem;
    border-bottom: none;
    page-break-after: avoid;
    font-weight: 700;
}

/* h5 — Minisection / Heading 4 */
.entry-content h5 {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    color: var(--maroon);
    font-style: italic;
    margin: 0.8rem 0 0.3rem;
    page-break-after: avoid;
}

/* h6 — Sidebar/Callout title */
.entry-content h6 {
    font-family: var(--font-table);
    font-size: 0.8rem;
    color: var(--maroon);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    margin: 0.5rem 0 0.3rem;
}

/* ═══════════════════════════════════════
   6. DROPCAP UTILITY CLASS
   ═══════════════════════════════════════ */

.dropcap::first-letter {
    font-family: var(--font-heading-display);
    font-size: 3.2rem;
    float: left;
    line-height: 0.85;
    padding-right: 0.08rem;
    padding-top: 0.05rem;
    color: var(--maroon);
}

/* ═══════════════════════════════════════
   7. SPELL LIST FORMATTING
   ═══════════════════════════════════════ */

.spell-list {
    margin: 1rem 0;
}

.spell-list .spell-level-header {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    color: var(--maroon);
    font-weight: 700;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.spell-list .spell-level-header:first-child {
    margin-top: 0;
}

.spell-list .spell-entry {
    margin-left: 1.5rem;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.spell-list .spell-entry strong {
    color: #000;
    font-weight: 700;
}

/* ═══════════════════════════════════════
   8. PRINT STYLES
   ═══════════════════════════════════════ */

@media print {
    /* Hide navigation and footer */
    .navbar,
    .site-footer,
    .breadcrumb,
    .entry-nav,
    nav,
    .search-form,
    .btn,
    .actions {
        display: none;
    }

    /* Adjust main content */
    main {
        padding: 0;
    }

    .entry-detail {
        max-width: 100%;
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 0;
        margin: 0;
    }

    .entry-detail::before {
        display: none;
    }

    .entry-header {
        border-bottom: 2px solid var(--maroon);
        page-break-after: avoid;
    }

    .entry-header h2 {
        page-break-after: avoid;
    }

    /* Keep stat blocks and callouts */
    .stat-block,
    .entry-content .callout {
        page-break-inside: avoid;
    }

    /* Table styling for print */
    .entry-content table {
        page-break-inside: avoid;
    }

    .entry-content h2,
    .entry-content h3,
    .entry-content h4,
    .entry-content h5,
    .entry-content h6 {
        page-break-after: avoid;
        page-break-before: avoid;
    }

    /* Ensure text is black and readable */
    .entry-content {
        color: #000;
    }

    .entry-content a {
        color: #000;
        text-decoration: underline;
    }

    /* Remove shadows and effects */
    .stat-block {
        box-shadow: none;
        border: 1px solid #999;
    }

    /* Adjust link styling for print */
    a {
        color: #000;
    }

    /* Background colors for callouts and important elements are preserved */
}

/* ═══════════════════════════════════════
   9. UTILITY CLASSES
   ═══════════════════════════════════════ */

/* Full-width span for two-column layouts */
.full-width {
    display: block;
    width: 100%;
}

/* Wide variant for stat blocks and tables */
.wide {
    max-width: 100%;
    width: 100%;
}

/* Small helper text */
.note {
    font-size: 0.8rem;
    font-style: italic;
    color: var(--text-muted);
}

/* ═══════════════════════════════════════
   10. RESPONSIVE ADJUSTMENTS
   ═══════════════════════════════════════ */

@media (max-width: 768px) {
    /* Stat blocks on mobile */
    .stat-block {
        max-width: 100%;
        margin: 1rem 0;
    }

    /* Shrink stat block fonts on mobile */
    .stat-block h2.creature-name {
        font-size: 1.1rem;
    }

    .stat-block p {
        font-size: 0.85rem;
    }

    .stat-block h3.stat-block-section {
        font-size: 0.85rem;
    }

    /* Callouts stack better on mobile */
    .entry-content .callout {
        padding: 0.75rem;
        margin: 0.75rem 0;
    }

    /* Table adjustments for mobile */
    .entry-content table {
        font-size: 0.8rem;
    }

    .entry-content table th {
        font-size: 0.65rem;
        padding: 0.3rem 0.4rem;
    }

    .entry-content table td {
        padding: 0.25rem 0.4rem;
    }

    /* Two-column becomes one on mobile */
    .entry-content.two-column {
        column-count: 1;
        column-rule: none;
    }

    /* Heading sizes on mobile */
    .entry-content h1 {
        font-size: 1.5rem;
    }

    .entry-content h2 {
        font-size: 1.2rem;
    }

    .entry-content h3 {
        font-size: 1rem;
    }

    .entry-content h4 {
        font-size: 0.95rem;
    }
}

@media (max-width: 640px) {
    /* Further adjustments for small screens */
    .stat-block {
        margin: 0.75rem 0;
        padding-bottom: 0.5rem;
    }

    .stat-block h2.creature-name {
        font-size: 1rem;
        margin: 0.6rem 0.6rem 0.15rem;
    }

    .stat-block p {
        margin: 0.3rem 0.6rem;
        font-size: 0.8rem;
    }

    .entry-content .callout {
        padding: 0.6rem;
        margin: 0.5rem 0;
        border-left-width: 3px;
    }

    .entry-content h1 {
        font-size: 1.3rem;
    }

    .entry-content h2 {
        font-size: 1.1rem;
    }

    /* Spell list on small screens */
    .spell-list .spell-entry {
        margin-left: 1rem;
    }
}

/* ═══════════════════════════════════════
   11. ACCESSIBILITY & FOCUS STATES
   ═══════════════════════════════════════ */

/* Ensure interactive elements are keyboard accessible */
.stat-block a,
.entry-content .callout a {
    outline: 2px solid transparent;
    outline-offset: 2px;
    transition: outline-color 0.2s;
}

.stat-block a:focus,
.entry-content .callout a:focus {
    outline-color: var(--maroon);
}

/* ═══════════════════════════════════════ */
