@import url('https://fonts.googleapis.com/css2?family=Alegreya+Sans:ital,wght@0,400;0,700;1,400;1,700&family=Marcellus+SC&display=swap');

/* ============================================ */
/* D&D 2024 MONSTER STAT BLOCK STYLES */
/* ============================================ */
/* 
 * PURPOSE: Styles for D&D monster stat blocks in the compendium
 * DEPENDENCIES: 
 *   - CSS variables from style.css (--color-primary, --font-header, etc.)
 *   - Markdown blockquote structure for stat blocks
 * SCOPE: Only statblock-specific styles; site-wide styles in style.css
 * USAGE: Applied to .monster-page and blockquote elements

 * Location: \assets\css\statblock.css
 */


/* ============================================ */
/* MONSTER COMPENDIUM PAGE BACKGROUND */
/* ============================================ */
/* 
 * Styling for the main page container on monster pages
 * Creates parchment-like appearance with texture
 */

.monster-page .page {
  max-width: 1400px; /* Match standard site width */
  background: var(--statblock-page-bg) var(--statblock-texture);
  padding: 20px;
  box-shadow: 0 0 15px var(--statblock-box-shadow);
  border-radius: 6px;
  margin: 20px auto;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}


/* ============================================ */
/* STAT BLOCK CONTAINER (BLOCKQUOTE) */
/* ============================================ */
/* 
 * Main container for monster stat blocks
 * Uses blockquote for markdown compatibility
 * Creates card-like appearance with border and shadow
 */

blockquote.stat-block,
.stat-block blockquote,
.monster-page blockquote {
  background: var(--color-bg-light);
  border: 5px double var(--color-primary);
  border-radius: 12px;
  padding: 0; /* Padding added to children instead */
  margin: 1em 0;
  box-shadow: 0 0 8px var(--statblock-card-shadow);
  font-family: 'Alegreya Sans', 'Source Sans 3', Arial, sans-serif;
  font-style: normal; /* Override default blockquote italic */
  overflow: hidden;
  page-break-inside: avoid; /* Keep stat block together when printing */
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}


/* ============================================ */
/* STAT BLOCK HEADER (MONSTER NAME) */
/* ============================================ */
/* 
 * Monster name at top of stat block
 * Full-width colored banner with decorative font
 */

.monster-page blockquote h2,
blockquote.stat-block h2 {
  font-family: 'Marcellus SC', 'Cinzel Decorative', 'Cinzel', Georgia, serif;
  font-size: 1.6em;
  color: var(--statblock-header-text);
  background: var(--color-primary);
  border: none;
  margin: 0;
  padding: 8px 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  font-style: normal; /* Override default blockquote h2 style */
  transition: color 0.3s ease, background-color 0.3s ease;
}


/* ============================================ */
/* STAT BLOCK CONTENT SPACING */
/* ============================================ */
/* 
 * Horizontal padding for all content except headers
 * Ensures consistent indentation throughout stat block
 */

.monster-page blockquote > *:not(h2):not(h3),
blockquote.stat-block > *:not(h2):not(h3) {
  padding-left: 8px;
  padding-right: 8px;
}


/* ============================================ */
/* STAT BLOCK PARAGRAPHS */
/* ============================================ */

/* 
 * First paragraph: creature type/size/alignment
 * Example: "Medium humanoid, lawful good"
 * Italicized for emphasis
 */
.monster-page blockquote p:first-of-type,
blockquote.stat-block p:first-of-type {
  font-style: italic;
  margin: 8px 0 4px 0;
  font-size: 1em;
  color: var(--color-text);
  transition: color 0.3s ease;
}

/* 
 * All other paragraphs in stat block
 * Used for abilities, actions, reactions, etc.
 */
.monster-page blockquote p,
blockquote.stat-block p {
  margin: 6px 0;
  font-size: 1em;
  line-height: 1.4;
  font-style: normal; /* Override blockquote default */
  color: var(--color-text);
  transition: color 0.3s ease;
}


/* ============================================ */
/* STAT BLOCK SECTION HEADERS */
/* ============================================ */
/* 
 * Section dividers (TRAITS, ACTIONS, REACTIONS, etc.)
 * Uppercase text with bottom border for visual separation
 */

.monster-page blockquote h3,
blockquote.stat-block h3 {
  font-family: var(--font-header);
  font-size: 1em;
  color: var(--color-primary);
  background: none;
  border: none;
  border-bottom: 1.5px solid var(--color-primary); /* Only bottom border */
  border-top: none;
  margin: 12px 0 8px 0;
  padding: 5px 8px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 700;
  font-style: normal;
  transition: color 0.3s ease, border-color 0.3s ease;
}


/* ============================================ */
/* STAT BLOCK TEXT FORMATTING */
/* ============================================ */

/* Bold text (ability names, important terms) */
.monster-page blockquote strong,
blockquote.stat-block strong {
  font-weight: 700;
  font-style: normal;
  color: var(--color-text);
  transition: color 0.3s ease;
}

/* Italic text (flavor text, conditions) */
.monster-page blockquote em,
blockquote.stat-block em {
  font-style: italic;
  color: var(--color-text);
  transition: color 0.3s ease;
}

/* Bold italic combination */
.monster-page blockquote strong em,
.monster-page blockquote em strong,
blockquote.stat-block strong em,
blockquote.stat-block em strong {
  font-weight: 700;
  font-style: italic;
  color: var(--color-text);
  transition: color 0.3s ease;
}


/* ============================================ */
/* STAT BLOCK LISTS */
/* ============================================ */
/* 
 * Unordered lists for multi-attack actions, etc.
 * No bullets, consistent spacing
 */

.monster-page blockquote ul,
blockquote.stat-block ul {
  list-style: none; /* Remove default bullets */
  padding: 0 8px;
  margin: 6px 0;
}

.monster-page blockquote ul li,
blockquote.stat-block ul li {
  margin: 4px 0;
  font-size: 1em;
  line-height: 1.4;
  font-style: normal;
  color: var(--color-text);
  transition: color 0.3s ease;
}


/* ============================================ */
/* STAT BLOCK ABILITY SCORES TABLE */
/* ============================================ */
/* 
 * Table displaying 6 ability scores with modifiers and saves
 * Layout: Two rows of 3 abilities each
 * Each ability has: Name | Score | Modifier | Save
 */

.monster-page blockquote table,
blockquote.stat-block table {
  width: calc(100% - 16px); /* Account for horizontal padding */
  margin: 8px 8px;
  border-collapse: collapse;
  font-size: 0.95em;
  background: none;
  table-layout: fixed; /* Equal column distribution */
  border: none;
}

/* Basic table cell styling */
.monster-page blockquote table th,
.monster-page blockquote table td,
blockquote.stat-block table th,
blockquote.stat-block table td {
  padding: 4px 1px;
  text-align: center;
  border: none;
  background: none;
  min-width: 0;
  font-family: 'Alegreya Sans', 'Source Sans 3', Arial, sans-serif;
  font-style: normal;
  color: var(--color-text);
  transition: color 0.3s ease, background-color 0.3s ease;
}

/* Table headers (MOD, SAVE labels) */
.monster-page blockquote table th,
blockquote.stat-block table th {
  font-weight: 700;
  color: var(--color-bg-light);
  background: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.8em;
  padding: 4px 2px;
  text-align: center;
  border-radius: 2px;
}

/* Table data cells */
.monster-page blockquote table td,
blockquote.stat-block table td {
  font-weight: 400;
}


/* ============================================ */
/* ABILITY TABLE COLUMN WIDTHS */
/* ============================================ */
/* 
 * Table has 12 columns in 3 groups of 4
 * Row 1: Str, Dex, Con (columns 1-4, 5-8, 9-12)
 * Row 2: Int, Wis, Cha (columns 1-4, 5-8, 9-12)
 * 
 * Each group structure:
 *   - Column 1,5,9: Ability name (12% width, left-aligned)
 *   - Column 2,6,10: Score value (8% width)
 *   - Column 3,7,11: Modifier (8% width, gray background)
 *   - Column 4,8,12: Save bonus (8% width, gray background)
 * 
 * Total: 3 × (12% + 8% + 8% + 8%) = 108% (slight overflow handled by calc)
 */

/* Ability name columns (Str, Dex, Con, Int, Wis, Cha) */
.monster-page blockquote table td:nth-child(1),
.monster-page blockquote table td:nth-child(5),
.monster-page blockquote table td:nth-child(9),
blockquote.stat-block table td:nth-child(1),
blockquote.stat-block table td:nth-child(5),
blockquote.stat-block table td:nth-child(9) {
  width: 10%;
  text-align: left;
  font-weight: 700;
  padding-left: 6px;
}

/* Ability score value columns (the numbers: 10, 14, etc.) */
.monster-page blockquote table td:nth-child(2),
.monster-page blockquote table td:nth-child(6),
.monster-page blockquote table td:nth-child(10),
blockquote.stat-block table td:nth-child(2),
blockquote.stat-block table td:nth-child(6),
blockquote.stat-block table td:nth-child(10) {
  width: 7%;
  font-weight: 600;
}

/* Modifier and Save columns - gray background for contrast */
.monster-page blockquote table td:nth-child(3),
.monster-page blockquote table td:nth-child(4),
.monster-page blockquote table td:nth-child(7),
.monster-page blockquote table td:nth-child(8),
.monster-page blockquote table td:nth-child(11),
.monster-page blockquote table td:nth-child(12),
blockquote.stat-block table td:nth-child(3),
blockquote.stat-block table td:nth-child(4),
blockquote.stat-block table td:nth-child(7),
blockquote.stat-block table td:nth-child(8),
blockquote.stat-block table td:nth-child(11),
blockquote.stat-block table td:nth-child(12) {
  width: 7%;
  font-weight: 400;
  background: var(--statblock-modifier-bg);
}


/* ============================================ */
/* STAT BLOCK DIVIDERS */
/* ============================================ */
/* 
 * Horizontal rules for visual separation
 * Used between major stat block sections
 */

.monster-page blockquote hr,
blockquote.stat-block hr {
  border: none;
  border-top: 1.5px solid var(--color-primary);
  margin: 8px 8px;
  transition: border-color 0.3s ease;
}


/* ============================================ */
/* STAT BLOCK CREATOR CREDIT */
/* ============================================ */
/* 
 * Attribution line at bottom of stat block
 * Shows creator name with top border separator
 */

.statblock-creator {
  font-family: 'Alegreya Sans', 'Source Sans 3', Arial, sans-serif;
  font-size: 0.9em;
  font-style: italic;
  color: var(--color-primary);
  padding: 5px 8px;
  margin: 8px 8px;
  text-align: center;
  border-top: 1.5px solid var(--color-primary);
  border-bottom: none;
  width: calc(100% - 16px);
  transition: color 0.3s ease, border-color 0.3s ease;
}


/* ============================================ */
/* GENERAL DIVIDERS */
/* ============================================ */
/* 
 * Subtle divider lines used throughout page
 * Lighter than stat block dividers
 */

.statblock-divider {
  border: 0;
  height: 1px;
  background: var(--color-border);
  margin: 10px 0;
  transition: background-color 0.3s ease;
}

/* Extra spacing for first divider on page */
.page > .statblock-divider:first-of-type {
  margin-top: 20px;
}


/* ============================================ */
/* MONSTER IMAGES */
/* ============================================ */
/* 
 * Full-width monster artwork display
 * Appears below stat block with border and shadow
 */

.monster-image-container {
  width: 100%;
  margin: 2em 0;
  text-align: center;
}

/* Responsive image with decorative border */
.monster-image-container img {
  max-width: 100%;
  height: auto;
  border: 5px solid var(--color-primary);
  border-radius: 8px;
  box-shadow: 0 4px 10px var(--statblock-image-shadow);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Image attribution text */
.image-credit {
  font-size: 0.9em;
  color: var(--color-text-secondary);
  font-style: italic;
  margin-top: 0.5em;
  transition: color 0.3s ease;
}


/* ============================================ */
/* MONSTER DESCRIPTION/LORE */
/* ============================================ */
/* 
 * Flavor text and lore sections
 * Appears separate from mechanical stat block
 */

.monster-description {
  font-family: var(--font-body);
  font-size: 1em;
  line-height: 1.7;
  color: var(--color-text);
  padding: 2em 1em;
  margin-top: 2em;
  background: var(--color-bg-light);
  border: none;
  border-radius: 0;
  text-align: justify; /* Book-like text alignment */
  transition: color 0.3s ease, background-color 0.3s ease;
}

/* Section headers within descriptions */
.monster-description h4 {
  font-family: var(--font-header);
  color: var(--color-primary);
  font-size: 1.4em;
  margin-top: 1.2em;
  margin-bottom: 0.5em;
  text-transform: uppercase;
  transition: color 0.3s ease;
}

/* First paragraph (no extra top margin) */
.monster-description p:first-child {
  margin-top: 0;
}

/* Paragraph spacing */
.monster-description p {
  margin-bottom: 1em;
}

/* ============================================ */
/* RESPONSIVE DESIGN - MOBILE */
/* ============================================ */
/* 
 * Adjustments for screens 768px wide or smaller
 * Reduces sizes and removes unnecessary spacing
 */

@media (max-width: 768px) {
  /* Reduce base font size for smaller screens */
  .monster-page {
    font-size: 12px;
    padding: 10px;
  }

  /* Full-width page with minimal margins */
  .monster-page .page {
    padding: 12px;
    margin: 0;
    box-shadow: none;
    border-radius: 0;
  }

  /* Thinner borders on mobile */
  .monster-page blockquote,
  blockquote.stat-block {
    border-width: 1.5px;
    margin: 0.8em 0;
    border-radius: 6px;
  }

  /* Smaller header text */
  .monster-page blockquote h2,
  blockquote.stat-block h2 {
    font-size: 1.1em;
    padding: 6px 8px;
  }

  /* Smaller section headers */
  .monster-page blockquote h3,
  blockquote.stat-block h3 {
    font-size: 0.9em;
    padding: 4px 8px;
    border-bottom: 1px solid var(--color-primary);
    border-top: none;
  }

  /* Enable horizontal scrolling for ability table if needed */
  .monster-page blockquote table,
  blockquote.stat-block table {
    font-size: 0.8em;
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
  }

  /* Tighter table padding */
  .monster-page blockquote table th,
  .monster-page blockquote table td,
  blockquote.stat-block table th,
  blockquote.stat-block table td {
    padding: 3px 5px;
  }

  /* Reduced description padding */
  .monster-description {
    padding: 1.5em 0.8em;
    font-size: 1em;
  }

  /* Single column card layout on mobile */
  .monster-list {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  /* Larger touch targets for cards */
  .monster-card {
    padding: 1em;
  }
}


/* ============================================ */
/* PRINT STYLES FOR STAT BLOCKS */
/* ============================================ */
/* 
 * Optimizations for printing monster stat blocks
 * Removes shadows and interactive elements
 */

@media print {
  /* Clean white background for printing */
  .monster-page {
    background: white;
  }

  /* Remove digital styling for print */
  .monster-page .page {
    box-shadow: none;
    margin: 0;
    padding: 0.5in; /* Standard print margin */
  }
  
  /* Hide interactive buttons when printing */
  .export-button-container,
  .export-json-button {
    display: none;
  }
  
  /* Keep stat blocks together on same page */
  blockquote.stat-block,
  .monster-page blockquote {
    page-break-inside: avoid;
  }
}
/* ============================================ */
/* MONSTER DETAIL VIEW / LAYOUT HELPERS */
/* ============================================ */

.monster-detail-layout {
    width: 100%;
}

.stat-row, .stat-row-split {
    margin: 6px 0; 
    font-size: 1em;
    line-height: 1.4;
    color: var(--color-text);
}

.stat-row-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.feature-item p { 
    display: inline-block; 
    margin-bottom: 0.5em; 
    font-style: normal !important; 
}

.feature-item li p { 
    display: block; 
    margin-bottom: 0; 
}

.monster-lore-container {
    margin-bottom: 2rem;
}

.image-caption {
    font-size: 0.9em;
    color: var(--color-text-secondary);
    font-style: italic;
    margin-top: 0.5em;
}

/* Ability Table Overrides */
.ability-table { 
    width: 100%; 
    text-align: center; 
    border-collapse: collapse; 
    margin-bottom: 0.5em; 
}

/* MOBILE RESPONSIVENESS */
@media (max-width: 1000px) {
    .monster-header {
        margin-top: 4rem; 
    }

    .monster-detail-layout { 
        display: flex !important; 
        flex-direction: column !important;
        gap: 2rem !important;
    }
    
    .left-col, .right-col {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0;
    }
}

@media (max-width: 400px) {
    .stat-row-split {
        grid-template-columns: 1fr;
    }
}

