/* ============================================================
   THAUMATURGIS LIGHT THEME (v3 — comprehensive, hand-tuned)
   
   Architecture:
   - Page backgrounds become warm parchment (#f0e4c8)
   - Cards become cream (#fbf3e0) with tan borders (#c8b890)
   - Headers/heroes KEEP their dark dramatic look (they often have
     background images) but text stays light on them
   - Text on light surfaces: deep brown (#2c1810 primary,
     #5d4e37 secondary, #7a6a4f muted)
   - Accent colors (purples, golds, blues) preserved — they read
     well on both dark and parchment
   
   Loaded LAST in <head>, so its [data-theme="light"] selectors
   beat the original rules in the cascade.
   ============================================================ */

/* ============================================================
   1. CSS VARIABLES — override the design tokens
   ============================================================ */

[data-theme="light"] {
    color-scheme: light;

    --background-dark: #f0e4c8;
    --background-medium: #fbf3e0;
    --background-light-dark: #e8dcc0;
    --surface-color: #fbf3e0;
    --border-color: #c8b890;

    --text-primary: #2c1810;
    --text-secondary: #5d4e37;
    --text-muted: #7a6a4f;

    --background-light: #faf3e2;
    --background-white: #ffffff;
    --text-dark: #2c1810;
    --text-medium: #3d2814;
    --text-light: #5d4e37;
}

/* ============================================================
   2. BODY / PAGE CONTAINERS
   ============================================================ */

[data-theme="light"] body,
[data-theme="light"] body.region-page,
[data-theme="light"] body.region-page main {
    background-color: #f0e4c8;
    color: #2c1810;
}

/* Class-style page bodies (witch, psion, pugilist, etc.) */
[data-theme="light"] body.pugilist-style,
[data-theme="light"] body.shaman-style,
[data-theme="light"] body.witch-style,
[data-theme="light"] body.sant-rakshak-style,
[data-theme="light"] body.psion-style,
[data-theme="light"] body.inventor-style,
[data-theme="light"] body.wizard-style,
[data-theme="light"] body.scholar-style {
    background-color: #f0e4c8;
    color: #2c1810;
}

/* Page-content paragraph defaults — these get a warm brown */
[data-theme="light"] body p,
[data-theme="light"] body li,
[data-theme="light"] body main p,
[data-theme="light"] body main li {
    color: #2c1810;
}

/* ============================================================
   3. HEADER & HEROES — KEEP DARK (they're dramatic brand elements)
   ============================================================ */

/* The main-header gradient is kept; text on it stays light.
   .main-header itself is in our skip list so it isn't auto-flipped. */

/* Region hero sections have background images and dark overlays —
   keep them visually dark, just ensure text reads. */
[data-theme="light"] .region-hero,
[data-theme="light"] .page-hero,
[data-theme="light"] .npc-hero,
[data-theme="light"] .class-hero,
[data-theme="light"] .hero-section {
    color: #f8eed8;
}

[data-theme="light"] .region-hero h1,
[data-theme="light"] .page-hero h1,
[data-theme="light"] .npc-hero h1,
[data-theme="light"] .class-hero h1,
[data-theme="light"] .hero-section h1,
[data-theme="light"] .region-hero .subtitle,
[data-theme="light"] .region-hero .tagline,
[data-theme="light"] .page-hero .lead,
[data-theme="light"] .npc-hero .lead {
    color: #f8eed8;
}

/* ============================================================
   4. GENERIC CARDS
   ============================================================ */

[data-theme="light"] .card {
    background: #fbf3e0;
    color: #2c1810;
    border-top-color: var(--accent-arcane);
    box-shadow: 0 4px 15px rgba(95, 70, 40, 0.12);
}

[data-theme="light"] .card h2,
[data-theme="light"] .card h3 {
    color: #2c1810;
    border-bottom-color: var(--accent-arcane-bright);
}

[data-theme="light"] .card p,
[data-theme="light"] .card li {
    color: #2c1810;
}

/* ============================================================
   5. REGION PAGE CARDS
   ============================================================ */

[data-theme="light"] .fact-card {
    background: #fbf3e0;
    border: 1px solid #c8b890;
}

[data-theme="light"] .fact-card .label {
    color: #8b5a96;
}

[data-theme="light"] .fact-card .value {
    color: #2c1810;
}

[data-theme="light"] .settlement-card {
    background: #fbf3e0;
    border: 1px solid #c8b890;
    border-left: 4px solid var(--accent-arcane, #9b59b6);
    box-shadow: 0 2px 8px rgba(95, 70, 40, 0.08);
}

[data-theme="light"] .settlement-card h3 {
    color: #2c1810;
}

[data-theme="light"] .settlement-card .settlement-type {
    color: #8b5a96;
}

[data-theme="light"] .settlement-card .settlement-stats {
    color: #5d4e37;
}

[data-theme="light"] .settlement-card p {
    color: #2c1810;
}

[data-theme="light"] .species-card {
    background: #fbf3e0;
    border: 1px solid #c8b890;
    box-shadow: 0 2px 8px rgba(95, 70, 40, 0.08);
}

[data-theme="light"] .species-card h4 {
    color: #8b5a96;
}

[data-theme="light"] .species-card p {
    color: #5d4e37;
}

[data-theme="light"] .region-card {
    background: #fbf3e0;
    border: 1px solid #c8b890;
    color: #2c1810;
    box-shadow: 0 2px 8px rgba(95, 70, 40, 0.08);
}

[data-theme="light"] .region-card:hover {
    border-color: var(--accent-arcane, #9b59b6);
    box-shadow: 0 8px 24px rgba(95, 70, 40, 0.18);
}

[data-theme="light"] .region-card h3,
[data-theme="light"] .region-card-body h3 {
    color: #2c1810;
}

[data-theme="light"] .region-card .card-subtitle,
[data-theme="light"] .region-card-body .sub {
    color: #8b5a96;
}

[data-theme="light"] .region-card p,
[data-theme="light"] .region-card-body p {
    color: #5d4e37;
}

/* ============================================================
   6. CLASS PAGE CARDS & SECTIONS
   ============================================================ */

[data-theme="light"] .class-card {
    background: #fbf3e0;
    border: 1px solid #c8b890;
    box-shadow: 0 2px 8px rgba(95, 70, 40, 0.08);
}

[data-theme="light"] .class-card:hover {
    border-color: rgba(139, 92, 246, 0.55);
    box-shadow: 0 8px 24px rgba(95, 70, 40, 0.2), 0 0 18px rgba(139, 92, 246, 0.1);
}

[data-theme="light"] .class-card-img {
    background: linear-gradient(135deg, #e8dcc0, #d9c9a8);
}

[data-theme="light"] .class-card-title {
    color: #2c1810;
}

[data-theme="light"] .class-card-stats {
    color: #5d4e37;
}

[data-theme="light"] .class-card-stats strong {
    color: #2c1810;
}

[data-theme="light"] .class-card-desc {
    color: #2c1810;
}

[data-theme="light"] .class-card-subclasses {
    color: #7a6a4f;
}

[data-theme="light"] .class-card-subclasses span {
    color: #5d4e37;
}

[data-theme="light"] .class-card-note {
    color: #b07a14;
}

[data-theme="light"] .class-card-note.resilient {
    color: #1a7547;
}

[data-theme="light"] .class-card-note.immune {
    color: #1e4d8b;
}

/* Path cards (subclass paths on class pages) */
[data-theme="light"] .path-card {
    background: #fbf3e0;
    border-left: 6px solid var(--accent-arcane, #9b59b6);
    box-shadow: 0 2px 8px rgba(95, 70, 40, 0.08);
}

[data-theme="light"] .path-card h3 {
    color: #6d3f8a;
}

[data-theme="light"] .path-card h4 {
    color: #2c1810;
}

[data-theme="light"] .path-card p,
[data-theme="light"] .path-card .subclass-description,
[data-theme="light"] .path-card .subclass-description p {
    color: #2c1810;
}

[data-theme="light"] .path-card .source-note {
    color: #7a6a4f;
}

[data-theme="light"] .path-card .thaumaturgis-note {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(59, 130, 246, 0.08));
    color: #4a3a78;
    border-left-color: #8b5cf6;
}

/* Class-specific path card accents */
[data-theme="light"] .pugilist-style .path-card h3 {
    color: #a83232;
}

[data-theme="light"] .shaman-style .path-card h3 {
    color: #2e6f43;
}

[data-theme="light"] .witch-style .path-card h3 {
    color: #6d3f8a;
}

[data-theme="light"] .sant-rakshak-style .path-card h3 {
    color: #a06a14;
}

[data-theme="light"] .pugilist-style .path-card .thaumaturgis-note {
    background: linear-gradient(135deg, rgba(229, 62, 62, 0.1), rgba(142, 68, 173, 0.08));
    color: #8b3a3a;
}

/* Subclass features */
[data-theme="light"] .subclass-feature {
    background: #f5ecd3;
    border-left: 3px solid #4fd1c5;
}

[data-theme="light"] .subclass-feature .feature-level {
    color: #5d4e37;
}

[data-theme="light"] .subclass-feature .feature-description,
[data-theme="light"] .subclass-feature .feature-description li,
[data-theme="light"] .subclass-feature .feature-description p {
    color: #2c1810;
}

[data-theme="light"] .subclass-features {
    border-top: 1px solid #c8b890;
}

[data-theme="light"] .subclass-intro {
    color: #5d4e37;
}

/* Feature blocks, quick-ref, famous-figures */
[data-theme="light"] .feature-block,
[data-theme="light"] .quick-ref-item,
[data-theme="light"] .famous-figures,
[data-theme="light"] .lore-section .famous-figures {
    background: #fbf3e0;
    border: 1px solid #c8b890;
    color: #2c1810;
    box-shadow: 0 2px 8px rgba(95, 70, 40, 0.08);
}

[data-theme="light"] .feature-block h3,
[data-theme="light"] .feature-block h4,
[data-theme="light"] .quick-ref-item h3,
[data-theme="light"] .quick-ref-item h4,
[data-theme="light"] .famous-figures h3,
[data-theme="light"] .famous-figures h4 {
    color: #2c1810;
}

[data-theme="light"] .feature-block p,
[data-theme="light"] .feature-block li,
[data-theme="light"] .quick-ref-item p,
[data-theme="light"] .quick-ref-item li,
[data-theme="light"] .famous-figures p,
[data-theme="light"] .famous-figures li,
[data-theme="light"] .lore-section .regional-list li {
    color: #2c1810;
}

/* Class quote box */
[data-theme="light"] .class-quote {
    background: #f5ecd3;
    color: #2c1810;
    border-left: 4px solid var(--accent-arcane, #9b59b6);
}

/* Class progression table */
[data-theme="light"] .class-table {
    background: #fbf3e0;
    color: #2c1810;
}

[data-theme="light"] .class-table thead,
[data-theme="light"] .class-table th {
    background: #e8dcc0;
    color: #2c1810;
}

[data-theme="light"] .class-table tr {
    border-color: #c8b890;
}

[data-theme="light"] .class-table tr:hover {
    background: #f5ecd3;
}

[data-theme="light"] .class-table td {
    color: #2c1810;
    border-color: #d9c9a8;
}

/* Error message blocks */
[data-theme="light"] .error-message {
    background: #faecec;
    color: #8a2424;
    border-color: #d99898;
}

[data-theme="light"] .error-message p {
    color: #8a2424;
}

/* ============================================================
   7. GALLERY
   ============================================================ */

[data-theme="light"] .gallery-card {
    background: #fbf3e0;
    border: 1px solid #c8b890;
    box-shadow: 0 2px 8px rgba(95, 70, 40, 0.1);
}

[data-theme="light"] .gallery-card:hover {
    border-color: rgba(245, 158, 11, 0.5);
    box-shadow: 0 12px 30px rgba(95, 70, 40, 0.18);
}

[data-theme="light"] .gallery-card-info h4 {
    color: #2c1810;
}

[data-theme="light"] .card-tag {
    background: rgba(95, 70, 40, 0.1);
    color: #5d4e37;
}

[data-theme="light"] .card-tag.race {
    background: rgba(245, 158, 11, 0.18);
    color: #8a5a05;
}

[data-theme="light"] .card-tag.gender-m {
    background: rgba(59, 130, 246, 0.18);
    color: #1e4d8b;
}

[data-theme="light"] .card-tag.gender-f {
    background: rgba(236, 72, 153, 0.18);
    color: #a52269;
}

[data-theme="light"] .card-tag.animated {
    background: rgba(168, 85, 247, 0.2);
    color: #6d3f8a;
}

[data-theme="light"] .gallery-item .caption {
    background: rgba(95, 70, 40, 0.85);
    color: #f8eed8;
}

/* Lightbox keeps dark — it's an overlay */
[data-theme="light"] .lightbox-overlay {
    background: rgba(20, 14, 8, 0.92);
}

[data-theme="light"] .lightbox-container {
    background: #2c1810;
    color: #f8eed8;
}

[data-theme="light"] .lightbox-nav {
    background: rgba(0, 0, 0, 0.4);
    color: #f8eed8;
}

/* ============================================================
   8. NPC GENERATOR
   ============================================================ */

[data-theme="light"] .npc-card {
    background: #fbf3e0;
    border: 1px solid #c8b890;
    box-shadow: 0 2px 8px rgba(95, 70, 40, 0.08);
}

[data-theme="light"] .npc-card:hover {
    border-color: rgba(139, 92, 246, 0.5);
}

[data-theme="light"] .npc-card-header {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.1), rgba(59, 130, 246, 0.06));
    border-bottom: 1px solid #d9c9a8;
}

[data-theme="light"] .npc-name {
    color: #2c1810;
}

[data-theme="light"] .npc-title,
[data-theme="light"] .npc-section p,
[data-theme="light"] .npc-list li {
    color: #2c1810;
}

[data-theme="light"] .npc-section p strong {
    color: #2c1810;
}

[data-theme="light"] .npc-faction-desc {
    color: #5d4e37 !important;
}

[data-theme="light"] .controls-panel {
    background: #fbf3e0;
    border: 1px solid #c8b890;
}

[data-theme="light"] .controls-panel h2 {
    color: #2c1810;
}

[data-theme="light"] .field label {
    color: #5d4e37;
}

[data-theme="light"] .field select,
[data-theme="light"] .field input[type="text"],
[data-theme="light"] .field input[type="number"] {
    background: #faf3e2;
    border: 1px solid #c8b890;
    color: #2c1810;
}

[data-theme="light"] .empty-state,
[data-theme="light"] .empty-state p {
    color: #5d4e37;
}

[data-theme="light"] .empty-state h2 {
    color: #2c1810;
}

[data-theme="light"] .empty-state i {
    color: #c8b890;
}

[data-theme="light"] .results-header {
    color: #5d4e37;
}

[data-theme="light"] .hook-section p {
    background: #f5ecd3;
    color: #2c1810;
}

[data-theme="light"] .portrait-lightbox {
    background: rgba(20, 14, 8, 0.9);
}

/* ============================================================
   9. CHARACTER CREATOR (cc-*)
   ============================================================ */

[data-theme="light"] {
    --cc-bg-deep: #e8dcc0;
    --cc-bg-panel: #fbf3e0;
    --cc-bg-card: #fbf3e0;
    --cc-bg-card-hover: #f5ecd3;
    --cc-bg-input: #faf3e2;
    --cc-bg: #f0e4c8;
    --cc-border: #c8b890;
    --cc-text: #2c1810;
    --cc-text-muted: #5d4e37;
    --cc-text-dim: #8a7960;
}

[data-theme="light"] .cc-card,
[data-theme="light"] .cc-subclass-card,
[data-theme="light"] .cc-feat-card {
    background: #fbf3e0;
    border-color: #c8b890;
    box-shadow: 0 2px 8px rgba(95, 70, 40, 0.06);
}

[data-theme="light"] .cc-card:hover,
[data-theme="light"] .cc-subclass-card:hover,
[data-theme="light"] .cc-feat-card:hover {
    background: #f5ecd3;
    border-color: rgba(139, 92, 246, 0.4);
}

[data-theme="light"] .cc-card.selected,
[data-theme="light"] .cc-subclass-card.selected {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(34, 211, 238, 0.05));
    border-color: var(--cc-accent);
}

[data-theme="light"] .cc-feat-card.selected {
    background: rgba(240, 180, 41, 0.12);
    border-color: var(--cc-gold);
}

[data-theme="light"] .cc-card-title {
    color: #2c1810;
}

[data-theme="light"] .cc-card-subtitle,
[data-theme="light"] .cc-card-desc {
    color: #5d4e37;
}

[data-theme="light"] .cc-toast {
    background: #2c1810;
    color: #f8eed8;
}

/* ============================================================
   10. CHARACTER DISPLAY / SHEET / FOUNDRY
   ============================================================ */

[data-theme="light"] .character-card {
    background: #fbf3e0;
    border: 1px solid #c8b890;
    box-shadow: 0 2px 8px rgba(95, 70, 40, 0.1);
}

[data-theme="light"] .item-card {
    background: #f5ecd3;
    color: #2c1810;
}

[data-theme="light"] .item-card.prepared {
    background: #e0eef5;
}

[data-theme="light"] .item-card.equipped {
    background: #e3f0e3;
}

[data-theme="light"] .stat-badge {
    background: #f5ecd3;
    color: #2c1810;
}

[data-theme="light"] .character-actions {
    background: #f5ecd3;
    border-top: 1px solid #d9c9a8;
}

[data-theme="light"] .btn-icon {
    background: #fbf3e0;
    border: 1px solid #d9c9a8;
    color: #5d4e37;
}

[data-theme="light"] .sheet-header {
    border-bottom: 2px solid #c8b890;
}

[data-theme="light"] .vital-box {
    background: #fbf3e0;
    border: 2px solid #c8b890;
}

/* Foundry sheet — keep its dark parchment-rune aesthetic since it's
   a distinct themed component. Only adjust for legibility. */
[data-theme="light"] .foundry-feature-item,
[data-theme="light"] .foundry-inventory-item,
[data-theme="light"] .foundry-spell-item,
[data-theme="light"] .foundry-ability-box,
[data-theme="light"] .skill-item,
[data-theme="light"] .save-item {
    background: #f5ecd3;
    border-color: #c8b890;
    color: #2c1810;
}

[data-theme="light"] .foundry-feature-item:hover,
[data-theme="light"] .foundry-inventory-item:hover,
[data-theme="light"] .foundry-spell-item:hover,
[data-theme="light"] .skill-item:hover {
    background: #ede0c0;
}

[data-theme="light"] .foundry-header,
[data-theme="light"] .foundry-vitals-bar,
[data-theme="light"] .foundry-tabs {
    background: #e8dcc0;
    border-color: #c8b890;
    color: #2c1810;
}

[data-theme="light"] .foundry-tab {
    color: #5d4e37;
}

[data-theme="light"] .foundry-tab.active {
    background: #fbf3e0;
    color: #2c1810;
}

[data-theme="light"] .features-header-row,
[data-theme="light"] .foundry-feature-row,
[data-theme="light"] .foundry-spell-row,
[data-theme="light"] .spell-level-header,
[data-theme="light"] .spell-level-header-row {
    background: #e8dcc0;
    color: #2c1810;
    border-color: #c8b890;
}

[data-theme="light"] .foundry-feature-row:hover,
[data-theme="light"] .foundry-spell-row:hover {
    background: #ede0c0;
}

[data-theme="light"] .foundry-abilities-row {
    background: #f5ecd3;
}

[data-theme="light"] .hp-bar {
    background: #e0d2b0;
}

[data-theme="light"] .inventory-category h4 {
    background: #e8dcc0;
    color: #2c1810;
}

[data-theme="light"] #character-modal,
[data-theme="light"] #character-modal.foundry-style {
    background: rgba(20, 14, 8, 0.85);
}

[data-theme="light"] #character-modal.foundry-style .modal-content {
    background: #fbf3e0;
    color: #2c1810;
}

[data-theme="light"] .upload-hint {
    background: #f5ecd3;
    color: #5d4e37;
}

[data-theme="light"] .upload-hint:hover {
    background: #ede0c0;
}

/* ============================================================
   11. CLASSES INDEX / REGIONS INDEX
   ============================================================ */

[data-theme="light"] .category-header.guide {
    background: linear-gradient(135deg, #e8dcc0, #d9c9a8);
    color: #2c1810;
}

[data-theme="light"] .legend-panel {
    background: #fbf3e0;
    border: 1px solid #c8b890;
    color: #2c1810;
}

[data-theme="light"] .featured-regions {
    background: #f5ecd3;
}

/* Alternating section on the home page (Threats) — cream, so the
   light theme keeps the light/lighter rhythm the white inline bg had */
[data-theme="light"] .featured-regions--alt {
    background: #fbf3e0;
}

/* Readability fix 2026-07-18: this was `background: #f5ecd3`, but the
   showcase's content is white text with dark text-shadows over a dark
   image overlay — parchment behind it made it unreadable in light mode.
   Keep the section dark in both themes (hero-style brand element);
   only the background-color longhand is set so the image + overlay
   from index-page.css still apply. */
[data-theme="light"] .visual-showcase {
    background-color: #14181f;
}

/* ...and since the section stays dark, keep its text light — the generic
   `[data-theme="light"] body p` brown would otherwise win the cascade. */
[data-theme="light"] .visual-showcase .showcase-content,
[data-theme="light"] .visual-showcase .showcase-content h2,
[data-theme="light"] .visual-showcase .showcase-content p {
    color: #f0e6d2;
}

/* Ghost-style .cta-secondary buttons (white text, white border) sit on
   parchment .featured-regions sections in light mode — restyle them as
   cream buttons with dark text there. Hero/final-cta instances keep the
   white-glass look (those sections stay dark/purple). */
[data-theme="light"] .featured-regions .cta-button.cta-secondary {
    background: #fbf3e0;
    color: #2c1810;
    border: 2px solid #b08410;
    backdrop-filter: none;
}

[data-theme="light"] .featured-regions .cta-button.cta-secondary:hover {
    background: #f5ecd3;
    color: #2c1810;
}

[data-theme="light"] .region-card-overlay {
    background: linear-gradient(to top, rgba(20, 14, 8, 0.92), transparent);
    color: #f8eed8;
}

/* Contrast fix 2026-07-05: earlier rule `.region-card p { color: #5d4e37 }`
   was landing dark-brown text on the overlay's near-black gradient (fails WCAG).
   Restore cream inside the overlay. Ratio #f8eed8 on #141210 ≈ 15.7:1. */
[data-theme="light"] .region-card-overlay p,
[data-theme="light"] .region-card-overlay h3,
[data-theme="light"] .region-card-overlay .region-badge {
    color: #f8eed8 !important;
}

/* ============================================================
   12. PROFILE
   ============================================================ */

[data-theme="light"] .characters-section {
    background: #fbf3e0;
    border: 1px solid #c8b890;
}

[data-theme="light"] .profile-header {
    background: linear-gradient(135deg, #e8dcc0, #d9c9a8);
    color: #2c1810;
}

[data-theme="light"] .modal {
    background: rgba(20, 14, 8, 0.85);
}

/* ============================================================
   13. AUTH / LOGIN / REGISTER
   ============================================================ */

[data-theme="light"] .auth-container {
    background: #fbf3e0;
    color: #2c1810;
    box-shadow: 0 8px 24px rgba(95, 70, 40, 0.15);
}

[data-theme="light"] .alert-success {
    background: #e3f0e3;
    color: #2e6f43;
    border-color: #99c9a3;
}

/* ============================================================
   14. TOOLTIPS / LORE NOTES
   ============================================================ */

[data-theme="light"] .lore-tooltip {
    background: #2c1810;
    color: #f8eed8;
    border: 1px solid #c8b890;
}

[data-theme="light"] .lore-note {
    background: rgba(139, 92, 246, 0.1);
    color: #4a3a78;
    border-left: 3px solid #8b5cf6;
}

[data-theme="light"] .map-tooltip {
    background: #2c1810;
    color: #f8eed8;
    border-color: #c8b890;
}

[data-theme="light"] .spell-icon {
    background: #f5ecd3;
    color: #2c1810;
}

/* ============================================================
   15. DICE ROLLER (overlay — keep dark, it's a dramatic moment)
   ============================================================ */

[data-theme="light"] #dice-overlay {
    background: rgba(20, 14, 8, 0.85);
}

[data-theme="light"] .dice-loading,
[data-theme="light"] .dice-result-bar,
[data-theme="light"] .dice-ability-banner {
    background: #2c1810;
    color: #f8eed8;
}

/* ============================================================
   16. FOOTER
   ============================================================ */

[data-theme="light"] .main-footer,
[data-theme="light"] footer.main-footer {
    background: linear-gradient(135deg, #2c1810 0%, #3d2814 100%);
    color: #f8eed8;
}

[data-theme="light"] .main-footer a,
[data-theme="light"] .main-footer p {
    color: #f8eed8;
}

[data-theme="light"] .main-footer a:hover {
    color: #f5c842;
}

/* ============================================================
   17. MISC TEXT/CONTENT
   ============================================================ */

[data-theme="light"] details.region-collapse {
    background: #fbf3e0;
    border: 1px solid #c8b890;
    color: #2c1810;
}

[data-theme="light"] details.region-collapse summary {
    color: #2c1810;
}

[data-theme="light"] .other-regions a {
    background: #fbf3e0;
    border: 1px solid #c8b890;
    color: #2c1810;
}

[data-theme="light"] .other-regions a:hover {
    background: #f5ecd3;
}

[data-theme="light"] tr:hover {
    background: #f5ecd3;
}

/* Inputs/selects across the board */
[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="email"],
[data-theme="light"] input[type="password"],
[data-theme="light"] input[type="number"],
[data-theme="light"] input[type="search"],
[data-theme="light"] textarea,
[data-theme="light"] select {
    background: #faf3e2;
    border: 1px solid #c8b890;
    color: #2c1810;
}

[data-theme="light"] input::placeholder,
[data-theme="light"] textarea::placeholder {
    color: #8a7960;
}

/* Generic section/aside/article fallbacks */
[data-theme="light"] section,
[data-theme="light"] article,
[data-theme="light"] aside {
    color: inherit;
}

/* ============================================================
   18. SMOOTH TRANSITION
   ============================================================ */

body,
.card,
.fact-card,
.settlement-card,
.species-card,
.region-card,
.class-card,
.path-card,
.gallery-card,
.npc-card,
.character-card,
.cc-card,
.feature-block,
.quick-ref-item {
    transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

/* ============================================================
   COMPREHENSIVE INLINE-STYLE OVERRIDES
   Class pages, factions, and other pages embed large inline <style>
   blocks with dark hardcoded colors that bypass external CSS unless
   we write exactly-matching selectors at higher specificity.
   Every rule here uses [data-theme="light"] + the original selector
   so it cleanly wins source order against the page's inline style.
   ============================================================ */

/* ---- Top-level containers (the biggest bug) ---- */

[data-theme="light"] body {
    background-color: #f0e4c8 !important;
    color: #2c1810 !important;
}

[data-theme="light"] main {
    background-color: #f0e4c8 !important;
    color: #2c1810;
}

/* ---- Class headers / hero gradients
       Keep dramatic dark gradients (these are hero sections with
       dark colored class backgrounds — leave them moody) ---- */

/* But ensure header text is readable. The inline <style> already
   gives them light text (#e2e8f0, #f5c842, etc.) which works on
   their dark gradient. So we leave .class-header alone. */

/* ---- Generic content section paragraphs ---- */

[data-theme="light"] .content-section,
[data-theme="light"] .content-section p,
[data-theme="light"] .content-section li,
[data-theme="light"] .content-section h2,
[data-theme="light"] .content-section h3,
[data-theme="light"] .content-section h4 {
    color: #2c1810;
}

[data-theme="light"] .class-subtitle {
    color: #5d4e37;
}

[data-theme="light"] .section-title,
[data-theme="light"] .subsection-title {
    color: #6d3f8a;
}

/* ---- Cards & boxes used across class pages ---- */

[data-theme="light"] .stat-box,
[data-theme="light"] .feature-block,
[data-theme="light"] .quick-ref-item,
[data-theme="light"] .path-card,
[data-theme="light"] .subclass-card,
[data-theme="light"] .coven-card,
[data-theme="light"] .pursuit-card,
[data-theme="light"] .spec-card,
[data-theme="light"] .spirit-card,
[data-theme="light"] .totem-card,
[data-theme="light"] .gambit-card,
[data-theme="light"] .college-card,
[data-theme="light"] .practica-card,
[data-theme="light"] .treatment-card,
[data-theme="light"] .grimoire-card,
[data-theme="light"] .hook-card,
[data-theme="light"] .region-block,
[data-theme="light"] .philosophy-note,
[data-theme="light"] .feat-card,
[data-theme="light"] .companion-table,
[data-theme="light"] .power-item,
[data-theme="light"] .faction-card {
    background: #fbf3e0 !important;
    color: #2c1810;
    box-shadow: 0 2px 8px rgba(95, 70, 40, 0.1) !important;
}

[data-theme="light"] .stat-box h3,
[data-theme="light"] .stat-box h4,
[data-theme="light"] .stat-box p,
[data-theme="light"] .feature-block h3,
[data-theme="light"] .feature-block h4,
[data-theme="light"] .feature-block p,
[data-theme="light"] .feature-block li,
[data-theme="light"] .quick-ref-item h3,
[data-theme="light"] .quick-ref-item h4,
[data-theme="light"] .quick-ref-item p,
[data-theme="light"] .path-card h3,
[data-theme="light"] .path-card h4,
[data-theme="light"] .path-card p,
[data-theme="light"] .subclass-card h3,
[data-theme="light"] .subclass-card h4,
[data-theme="light"] .subclass-card p,
[data-theme="light"] .coven-card h3,
[data-theme="light"] .coven-card h4,
[data-theme="light"] .coven-card p,
[data-theme="light"] .hook-card h3,
[data-theme="light"] .hook-card h4,
[data-theme="light"] .hook-card p,
[data-theme="light"] .region-block h3,
[data-theme="light"] .region-block h4,
[data-theme="light"] .region-block p,
[data-theme="light"] .feature-block strong,
[data-theme="light"] .feature-block em {
    color: #2c1810;
}

/* Special accent text — purple titles read fine on parchment too */
[data-theme="light"] .stat-box h3,
[data-theme="light"] .path-card h3,
[data-theme="light"] .coven-card h3,
[data-theme="light"] .subclass-card h3 {
    color: #6d3f8a;
}

/* ---- Quote/blockquote blocks ---- */

[data-theme="light"] .class-quote,
[data-theme="light"] .quote-block {
    background: #f5ecd3 !important;
    color: #2c1810 !important;
}

[data-theme="light"] .class-quote p,
[data-theme="light"] .quote-block p {
    color: #2c1810 !important;
}

/* ---- Info boxes & warning boxes (mostly gradient transparent — leave alone, just text)---- */

[data-theme="light"] .info-box,
[data-theme="light"] .warning-box,
[data-theme="light"] .race-restriction {
    color: #2c1810;
}

[data-theme="light"] .info-box h3,
[data-theme="light"] .info-box h4,
[data-theme="light"] .info-box p,
[data-theme="light"] .info-box li,
[data-theme="light"] .warning-box h3,
[data-theme="light"] .warning-box h4,
[data-theme="light"] .warning-box p,
[data-theme="light"] .warning-box li {
    color: #2c1810;
}

/* ---- Available Jinxes grid (and similar) — these are content cards ---- */

[data-theme="light"] .jinx-card,
[data-theme="light"] .jinxes-grid > *,
[data-theme="light"] .features-grid > *,
[data-theme="light"] .ability-card {
    background: #fbf3e0 !important;
    color: #2c1810 !important;
    border-color: #c8b890 !important;
}

[data-theme="light"] .jinx-card h4,
[data-theme="light"] .jinx-card h3,
[data-theme="light"] .jinx-card p {
    color: #2c1810 !important;
}

/* ---- Tables (used in level progression / spell tables) ---- */

[data-theme="light"] .class-table,
[data-theme="light"] .class-table table,
[data-theme="light"] .spell-spells-table,
[data-theme="light"] .companion-table,
[data-theme="light"] .spell-table {
    background: #fbf3e0 !important;
    color: #2c1810 !important;
    border-radius: 8px;
    overflow: hidden;
}

[data-theme="light"] .class-table th,
[data-theme="light"] .spell-spells-table th,
[data-theme="light"] .companion-table th,
[data-theme="light"] .spell-table th {
    background: linear-gradient(135deg, #e8dcc0 0%, #d9c9a8 100%) !important;
    color: #2c1810 !important;
    border-bottom: 2px solid #c8b890 !important;
}

[data-theme="light"] .class-table td,
[data-theme="light"] .spell-spells-table td,
[data-theme="light"] .companion-table td,
[data-theme="light"] .spell-table td {
    color: #2c1810 !important;
    border-color: #d9c9a8 !important;
}

[data-theme="light"] .class-table tbody tr:nth-child(even),
[data-theme="light"] .spell-spells-table tr:nth-child(even),
[data-theme="light"] .companion-table tbody tr:nth-child(even) {
    background: #f5ecd3 !important;
}

[data-theme="light"] .class-table tbody tr:nth-child(odd),
[data-theme="light"] .spell-spells-table tr:nth-child(odd),
[data-theme="light"] .companion-table tbody tr:nth-child(odd) {
    background: #fbf3e0 !important;
}

[data-theme="light"] .class-table tbody tr,
[data-theme="light"] .spell-spells-table tbody tr {
    background: #fbf3e0 !important;
}

[data-theme="light"] .class-table tr:hover,
[data-theme="light"] .spell-spells-table tr:hover {
    background: #ede0c0 !important;
}

/* ---- Subclass feature blocks (level features inside subclasses) ---- */

[data-theme="light"] .subclass-feature {
    background: #f5ecd3 !important;
    color: #2c1810 !important;
}

[data-theme="light"] .subclass-feature h4,
[data-theme="light"] .subclass-feature p,
[data-theme="light"] .subclass-feature li {
    color: #2c1810 !important;
}

/* ---- Thaumaturgis note inside path cards (purple-tinted callout) ---- */

[data-theme="light"] .path-card .thaumaturgis-note {
    background: rgba(139, 92, 246, 0.12) !important;
    color: #4a3a78 !important;
}

/* ---- Buttons ---- */

[data-theme="light"] .btn-secondary,
[data-theme="light"] a.btn-secondary {
    background: #fbf3e0 !important;
    color: #2c1810 !important;
    border: 2px solid #c8b890 !important;
}

[data-theme="light"] .btn-secondary:hover,
[data-theme="light"] a.btn-secondary:hover {
    background: #f5ecd3 !important;
    border-color: #6d3f8a !important;
}

/* ---- Factions page specific ---- */

[data-theme="light"] .faction-featured {
    background: linear-gradient(135deg, #fbf3e0 0%, #f5ecd3 100%) !important;
    color: #2c1810 !important;
    border-color: rgba(212, 175, 55, 0.5) !important;
}

[data-theme="light"] .faction-featured h2,
[data-theme="light"] .faction-featured h3,
[data-theme="light"] .faction-featured h4,
[data-theme="light"] .faction-featured p,
[data-theme="light"] .faction-featured em,
[data-theme="light"] .faction-featured li,
[data-theme="light"] .faction-featured strong {
    color: #2c1810 !important;
}

[data-theme="light"] .power-item {
    background: #fbf3e0 !important;
    color: #2c1810 !important;
}

[data-theme="light"] .power-item h3,
[data-theme="light"] .power-item h4,
[data-theme="light"] .power-item p {
    color: #2c1810 !important;
}

/* Categories and ecosystem labels remain colored (they're accent-driven) */

/* ---- Header/Hero overlays on factions and races pages ---- */
/* Hero sections with dark gradient overlays kept dark — they're brand. */

/* ---- Generic h1/h2/h3 in content areas ---- */

[data-theme="light"] main h1,
[data-theme="light"] main h2,
[data-theme="light"] main h3,
[data-theme="light"] main h4,
[data-theme="light"] main h5,
[data-theme="light"] main h6,
[data-theme="light"] main p,
[data-theme="light"] main li,
[data-theme="light"] main strong,
[data-theme="light"] main em {
    color: inherit;
}

[data-theme="light"] main {
    color: #2c1810;
}

/* But headers in dark hero sections should stay light */
[data-theme="light"] .class-header h1,
[data-theme="light"] .class-header h2,
[data-theme="light"] .class-header h3,
[data-theme="light"] .class-header p,
[data-theme="light"] .factions-hero h1,
[data-theme="light"] .factions-hero h2,
[data-theme="light"] .factions-hero p,
[data-theme="light"] .race-hero h1,
[data-theme="light"] .race-hero p,
[data-theme="light"] .region-hero h1,
[data-theme="light"] .region-hero p,
[data-theme="light"] .npc-hero h1,
[data-theme="light"] .npc-hero p,
[data-theme="light"] .page-hero h1,
[data-theme="light"] .page-hero p {
    color: inherit !important;
}

/* ============================================================
   AUTO-GENERATED OVERRIDES FROM INLINE STYLE BLOCKS
   Generated by _scan-inline-styles.ps1
   ============================================================ */

[data-theme="light"] .ability-list li {
    color: #2c1810;
}

[data-theme="light"] .back-link:hover {
    color: #2c1810;
}

[data-theme="light"] .btn-primary {
    color: #2c1810 !important;
}

[data-theme="light"] .btn-secondary {
    background: #fbf3e0 !important;
    background-color: #fbf3e0 !important;
    color: #2c1810 !important;
}

[data-theme="light"] .class-hero {
    color: #2c1810;
}

[data-theme="light"] .class-overview {
    color: #2c1810;
}

[data-theme="light"] .class-overview p {
    color: #2c1810;
}

[data-theme="light"] .class-quote {
    background: #f0e4c8;
    background-color: #f0e4c8;
    color: #2c1810;
}

[data-theme="light"] .class-subtitle {
    color: #5d4e37;
}

[data-theme="light"] .class-table {
    background: #fbf3e0 !important;
    background-color: #fbf3e0 !important;
}

[data-theme="light"] .class-table table {
    background: #fbf3e0 !important;
    background-color: #fbf3e0 !important;
}

[data-theme="light"] .class-table td {
    color: #2c1810 !important;
}

[data-theme="light"] .class-table td, [data-theme="light"] .spell-spells-table td {
    color: #2c1810 !important;
}

[data-theme="light"] .class-table th {
    background: #e8e8c0 !important;
    background-color: #e8e8c0 !important;
    color: #2c1810 !important;
}

[data-theme="light"] .class-table tr:hover {
    background: #f0e4c8;
    background-color: #f0e4c8;
}

[data-theme="light"] .college-card {
    background: #fbf3e0;
    background-color: #fbf3e0;
}

[data-theme="light"] .college-card p {
    color: #3d2e17;
}

[data-theme="light"] .companion-table {
    background: #fbf3e0;
    background-color: #fbf3e0;
}

[data-theme="light"] .companion-table td {
    color: #2c1810;
}

[data-theme="light"] .content-section li {
    color: #2c1810;
}

[data-theme="light"] .content-section p {
    color: #2c1810;
}

[data-theme="light"] .coven-card {
    background: #fbf3e0;
    background-color: #fbf3e0;
}

[data-theme="light"] .coven-card p {
    color: #2c1810;
}

[data-theme="light"] .coven-features p {
    color: #2c1810;
}

[data-theme="light"] .cta-section .btn-create {
    color: #2c1810;
}

[data-theme="light"] .eco-lohadhri .ecosystem-header {
    color: #5d4e37;
}

[data-theme="light"] .ecosystem-sigil {
    background: #f0e4c8;
    background-color: #f0e4c8;
}

[data-theme="light"] .ecosystem-subtitle {
    color: #5d4e37;
}

[data-theme="light"] .error-message {
    color: #2c1810;
}

[data-theme="light"] .error-message .btn-class {
    color: #2c1810;
}

[data-theme="light"] .faction-entry p {
    color: #3d2e17;
}

[data-theme="light"] .faction-featured {
    background: #fbf3e0;
    background-color: #fbf3e0;
}

[data-theme="light"] .faction-featured .featured-sigil {
    background: #f0e4c8;
    background-color: #f0e4c8;
}

[data-theme="light"] .faction-featured p {
    color: #3d2e17;
}

[data-theme="light"] .faction-sigil {
    background: #f0e4c8;
    background-color: #f0e4c8;
}

[data-theme="light"] .feat-card {
    background: #dde4f0;
    background-color: #dde4f0;
}

[data-theme="light"] .feature-block {
    background: #fbf3e0;
    background-color: #fbf3e0;
}

[data-theme="light"] .feature-block .feature-level {
    color: #5d4e37;
}

[data-theme="light"] .feature-block li, [data-theme="light"] .content-section li {
    color: #2c1810;
}

[data-theme="light"] .feature-block p {
    color: #2c1810;
}

[data-theme="light"] .feature-block ul, [data-theme="light"] .content-section ul {
    color: #2c1810;
}

[data-theme="light"] .feature-section h4 {
    color: #2c1810;
}

[data-theme="light"] .feature-section li {
    color: #2c1810;
}

[data-theme="light"] .feature-section p {
    color: #2c1810;
}

[data-theme="light"] .forgotten-entry h3 {
    color: #5d4e37;
}

[data-theme="light"] .forgotten-sigil {
    background: #f0e4c8;
    background-color: #f0e4c8;
}

[data-theme="light"] .gambit-card {
    background: #fbf3e0;
    background-color: #fbf3e0;
}

[data-theme="light"] .gambit-card p {
    color: #2c1810;
}

[data-theme="light"] .grimoire-card p {
    color: #2c1810;
}

[data-theme="light"] .hook-card {
    background: #fbf3e0;
    background-color: #fbf3e0;
}

[data-theme="light"] .hook-card p {
    color: #2c1810;
}

[data-theme="light"] .info-box p {
    color: #2c1810;
}

[data-theme="light"] .jinx-item {
    color: #2c1810;
}

[data-theme="light"] .loading-container {
    color: #2c1810;
}

[data-theme="light"] .loading-spinner {
    color: #2c1810;
}

[data-theme="light"] .lore-section li {
    color: #2c1810;
}

[data-theme="light"] .lore-section p {
    color: #2c1810;
}

[data-theme="light"] .lost-school-panel p {
    color: #2c1810;
}

[data-theme="light"] .overview-text p {
    color: #2c1810;
}

[data-theme="light"] .path-card {
    background: #fbf3e0;
    background-color: #fbf3e0;
}

[data-theme="light"] .path-card .source-note {
    color: #5d4e37;
}

[data-theme="light"] .path-card .subclass-description {
    color: #2c1810;
}

[data-theme="light"] .path-card .thaumaturgis-note {
    background: #f0e4c8;
    background-color: #f0e4c8;
}

[data-theme="light"] .path-card li {
    color: #2c1810;
}

[data-theme="light"] .path-card p {
    color: #2c1810;
}

[data-theme="light"] .path-features p {
    color: #2c1810;
}

[data-theme="light"] .philosophy-note {
    background: #fbf3e0;
    background-color: #fbf3e0;
}

[data-theme="light"] .power-column:nth-child(2) h3 {
    color: #2c1810;
}

[data-theme="light"] .power-item {
    background: #fbf3e0;
    background-color: #fbf3e0;
}

[data-theme="light"] .power-item span {
    color: #5d4e37;
}

[data-theme="light"] .practica-card {
    background: #fbf3e0;
    background-color: #fbf3e0;
}

[data-theme="light"] .practica-card p {
    color: #3d2e17;
}

[data-theme="light"] .pursuit-card {
    background: #fbf3e0;
    background-color: #fbf3e0;
}

[data-theme="light"] .pursuit-card p {
    color: #2c1810;
}

[data-theme="light"] .pursuit-features p {
    color: #2c1810;
}

[data-theme="light"] .quick-ref-item {
    background: #fbf3e0;
    background-color: #fbf3e0;
}

[data-theme="light"] .quick-ref-item p {
    color: #2c1810;
}

[data-theme="light"] .quote-block {
    background: #f0e4c8;
    background-color: #f0e4c8;
    color: #2c1810;
}

[data-theme="light"] .race-card__btn {
    color: #2c1810;
}

[data-theme="light"] .race-restriction p {
    color: #2c1810;
}

[data-theme="light"] .region-block {
    background: #fbf3e0;
    background-color: #fbf3e0;
}

[data-theme="light"] .region-block p {
    color: #2c1810;
}

[data-theme="light"] .spec-card {
    background: #fbf3e0;
    background-color: #fbf3e0;
}

[data-theme="light"] .spec-card li {
    color: #2c1810;
}

[data-theme="light"] .spec-card p {
    color: #2c1810;
}

[data-theme="light"] .spell-spells-table {
    background: #fbf3e0 !important;
    background-color: #fbf3e0 !important;
}

[data-theme="light"] .spell-spells-table td {
    color: #2c1810;
}

[data-theme="light"] .spell-table td {
    color: #2c1810;
}

[data-theme="light"] .spell-table th {
    background: #f0e4c8;
    background-color: #f0e4c8;
}

[data-theme="light"] .spirit-card {
    background: #f0e4c8;
    background-color: #f0e4c8;
}

[data-theme="light"] .stat-box {
    background: #fbf3e0;
    background-color: #fbf3e0;
}

[data-theme="light"] .stat-box p {
    color: #2c1810;
}

[data-theme="light"] .subclass-card {
    background: #fbf3e0;
    background-color: #fbf3e0;
}

[data-theme="light"] .subclass-card p {
    color: #2c1810;
}

[data-theme="light"] .subclass-feature {
    background: #f0e4c8;
    background-color: #f0e4c8;
}

[data-theme="light"] .subclass-features p {
    color: #2c1810;
}

[data-theme="light"] .subclass-intro {
    color: #5d4e37;
}

[data-theme="light"] .totem-card {
    background: #fbf3e0;
    background-color: #fbf3e0;
}

[data-theme="light"] .totem-card p {
    color: #3d2e17;
}

[data-theme="light"] .treatment-card {
    background: #fbf3e0;
    background-color: #fbf3e0;
}

[data-theme="light"] .treatment-card p {
    color: #2c1810;
}

[data-theme="light"] .voice-fragment p {
    color: #5d4e37;
}

[data-theme="light"] .warning-box p {
    color: #2c1810;
}

[data-theme="light"] body {
    background: #f0e4c8;
    background-color: #f0e4c8;
    color: #2c1810;
}

[data-theme="light"] main {
    background: #f0e4c8;
    background-color: #f0e4c8;
}


/* ============================================================
   HERO SECTIONS & FILTER BAR FIXES
   Some hero sections lost their text contrast when main flipped
   to parchment. Solution: give them a dark themed background in
   light mode too (treat heroes as 'always dark' regardless of theme),
   and force light text inside.
   ============================================================ */

/* Universal hero background — apply a dark themed gradient so
   originally-light text remains readable across all themes. */

[data-theme="light"] .npc-hero,
[data-theme="light"] .gallery-hero,
[data-theme="light"] .page-hero,
[data-theme="light"] .hero-section,
[data-theme="light"] .video-hero,
[data-theme="light"] .factions-hero {
    background: linear-gradient(135deg, #1a252f 0%, #2c1a4d 50%, #4a1e5c 100%) !important;
}

/* .race-hero now carries a per-race elite-unit banner — don't flatten it in
   light mode; its text is forced light below so it stays readable. */

/* .class-header pages (bard, ranger, scholar) carry their own dark banner
   image — do NOT flatten it to a gradient in light mode; keep the banner and
   just ensure the text over it stays light (handled below). */
[data-theme="light"] .class-header:not(.no-banner) {
    /* background comes from the page's own banner rule */
}

/* Force light text inside every hero, beating the cascade from main. */

[data-theme="light"] .npc-hero,
[data-theme="light"] .npc-hero *,
[data-theme="light"] .gallery-hero,
[data-theme="light"] .gallery-hero *,
[data-theme="light"] .page-hero,
[data-theme="light"] .page-hero *,
[data-theme="light"] .video-hero,
[data-theme="light"] .video-hero *,
[data-theme="light"] .hero-section,
[data-theme="light"] .hero-section *,
[data-theme="light"] .factions-hero,
[data-theme="light"] .factions-hero *,
[data-theme="light"] .race-hero,
[data-theme="light"] .race-hero *,
[data-theme="light"] .class-header,
[data-theme="light"] .class-header * {
    color: #f0e6d2 !important;
}

/* Then specific overrides for accent-coloured hero titles */

[data-theme="light"] .factions-hero h1,
[data-theme="light"] .class-header h1,
[data-theme="light"] .factions-hero .factions-hero h1 {
    color: #f5c842 !important;
}

[data-theme="light"] .gallery-hero h1 {
    /* Restore the orange gradient text */
    background: linear-gradient(135deg, #f59e0b, #f97316) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    color: transparent !important;
}

[data-theme="light"] .npc-hero h1 {
    color: #e2e8f0 !important;
}

[data-theme="light"] .npc-hero .lead,
[data-theme="light"] .gallery-hero .lead,
[data-theme="light"] .page-hero .lead,
[data-theme="light"] .hero-description {
    color: #c8b890 !important;
}

/* Hero CTA buttons / badges retain accent colors */

[data-theme="light"] .hero-section .btn,
[data-theme="light"] .video-hero .btn,
[data-theme="light"] .hero-content .btn {
    color: #f0e6d2 !important;
}

/* Hero stat numbers (gallery-hero has count badges) */

[data-theme="light"] .gallery-hero .stat-number,
[data-theme="light"] .gallery-hero .stat-label,
[data-theme="light"] .gallery-stats * {
    color: #f0e6d2 !important;
}

/* ============================================================
   FILTER BAR (gallery + other filter rows)
   ============================================================ */

[data-theme="light"] .filter-bar {
    background: #f5ecd3 !important;
    border-bottom: 1px solid #c8b890 !important;
}

[data-theme="light"] .filter-bar button,
[data-theme="light"] .filter-bar .filter-btn {
    background: #fbf3e0 !important;
    color: #2c1810 !important;
    border: 1px solid #c8b890 !important;
}

[data-theme="light"] .filter-bar button:hover,
[data-theme="light"] .filter-bar button.active,
[data-theme="light"] .filter-bar .filter-btn.active {
    background: #f0b429 !important;
    color: #2c1810 !important;
    border-color: #b08410 !important;
}

/* ============================================================
   GALLERY CATEGORY HEADERS
   ============================================================ */

[data-theme="light"] .category-header,
[data-theme="light"] .gallery-section .category-header {
    background: linear-gradient(135deg, #e8dcc0 0%, #d9c9a8 100%) !important;
    color: #2c1810 !important;
    border-left: 4px solid #f0b429 !important;
}

[data-theme="light"] .category-header h2,
[data-theme="light"] .category-header h3 {
    color: #2c1810 !important;
}

/* ============================================================
   FOOTER (stays dark for visual rest)
   ============================================================ */

[data-theme="light"] footer,
[data-theme="light"] .main-footer,
[data-theme="light"] .site-footer {
    background: linear-gradient(135deg, #1a252f 0%, #2c1810 100%) !important;
    color: #f0e6d2 !important;
}

[data-theme="light"] footer *,
[data-theme="light"] .main-footer *,
[data-theme="light"] .site-footer * {
    color: #f0e6d2 !important;
}

[data-theme="light"] footer a:hover,
[data-theme="light"] .main-footer a:hover {
    color: #f5c842 !important;
}

/* ============================================================
   CLASS BANNER HERO — title/subtitle readability
   All class heroes now sit on dark banner images, in BOTH
   light and dark themes. Force a consistent, high-contrast
   light title + subtitle with a strong shadow so text reads
   on any banner (dark imagery or bright warm highlights).
   Loaded last + !important so it beats per-page inline colors
   and the auto-generated light-mode overrides above.
   ============================================================ */

.class-hero h1,
.class-header h1,
[data-theme="light"] .class-hero h1,
[data-theme="light"] .class-header h1 {
    color: #ffffff !important;
    /* Same treatment the region banners use: tight dark outline +
       mid drop-shadow + broad dark glow, so the title stays crisp
       over both dark imagery and bright warm highlights. */
    text-shadow: 0 0 4px rgba(0,0,0,0.95),
                 2px 2px 8px rgba(0,0,0,0.9),
                 0 0 24px rgba(0,0,0,0.75) !important;
}

.class-hero .subtitle,
.class-hero p.subtitle,
.class-hero > p,
.class-header .class-subtitle,
.class-header .subtitle,
.class-header > p {
    color: #f4ecdd !important;
    opacity: 1 !important;
    text-shadow: 0 0 4px rgba(0,0,0,0.95),
                 1px 1px 6px rgba(0,0,0,0.9),
                 0 0 18px rgba(0,0,0,0.7) !important;
}

.class-hero .hero-badge {
    text-shadow: none !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}

/* ============================================================
   CLASSES INDEX PAGE — title readability (light mode)
   The hero now sits on a dark banner (kept light via the page's
   own rules). These panel headings sit on LIGHT panels in light
   mode, so their dark-theme light colors go invisible — give them
   readable dark accents matching the site's light palette.
   ============================================================ */

[data-theme="light"] .intro-panel h2 {
    color: #6d3f8a !important;   /* deep arcane purple */
}

[data-theme="light"] .legend-panel h3 {
    color: #2c1810 !important;   /* dark ink */
}

[data-theme="light"] .unavailable-panel h3 {
    color: #b45309 !important;   /* deep amber warning */
}

[data-theme="light"] .unavailable-item h4 {
    color: #92400e !important;   /* darker amber for card titles */
}

/* Keep the hero title/lead light over the dark banner even in light mode. */
[data-theme="light"] .classes-hero h1 {
    color: #ffffff !important;
}
[data-theme="light"] .classes-hero .lead {
    color: #f0e6d2 !important;
}

/* ============================================================
   CLASS FEATURE / SUBCLASS BODY TEXT — light mode readability
   formatDescription() only emits <p> wrappers for multi-paragraph
   text; single-paragraph descriptions are raw text inside their
   container, so the earlier "…-block p" overrides miss them and
   they keep the dark-theme light-grey (#e2e8f0) on cream. Set the
   color on the containers so the text (wrapped or not) reads dark.
   ============================================================ */

[data-theme="light"] .feature-description,
[data-theme="light"] .feature-description p,
[data-theme="light"] .feature-description li,
[data-theme="light"] .feature-description strong,
[data-theme="light"] .feature-description em,
[data-theme="light"] .subclass-description,
[data-theme="light"] .subclass-description p,
[data-theme="light"] .subclass-description li,
[data-theme="light"] .famous-figures,
[data-theme="light"] .famous-figures p {
    color: #2c1810 !important;
}

/* ============================================================
   RACE DETAIL PAGE (races/race.html) — light mode
   The page defines its own --race-* vars in an inline :root and
   the per-race script sets only --race-accent / --race-primary
   inline. In light mode the cards kept the dark --race-card-bg
   while generic rules darkened the text → dark-on-dark (unreadable).
   Flip the STRUCTURAL vars to the light palette so every card
   (trait/stat/feat/names/quote) becomes cream with dark body text.
   ============================================================ */

[data-theme="light"] {
    --race-dark: #f0e4c8;      /* page background */
    --race-text: #2c1810;      /* base text */
    --race-muted: #5d4e37;     /* card body / labels */
    --race-card-bg: #fbf3e0;   /* cards → cream */
    --race-border: #c8b890;    /* tan borders */
}

/* Per-race colored left border keeps each race's identity on the cream cards */
[data-theme="light"] .trait-card,
[data-theme="light"] .stat-card,
[data-theme="light"] .names-card,
[data-theme="light"] .feat-card {
    border-left: 4px solid var(--race-primary, #8b5a96);
}

/* Accent (--race-accent) is a LIGHT tint set inline for dark cards — it goes
   invisible on cream. Force accent-coloured headings/labels to dark ink.
   (The dark race-hero is untouched, so its badge/title stay light.) */
[data-theme="light"] .trait-card h4,
[data-theme="light"] .stat-card .stat-value,
[data-theme="light"] .names-card h4,
[data-theme="light"] .feat-card h4,
[data-theme="light"] .feat-card .prerequisite,
[data-theme="light"] .race-section h2,
[data-theme="light"] .race-section h3,
[data-theme="light"] .race-quote,
[data-theme="light"] .race-quote cite {
    color: #2c1810 !important;
}
