/* ==========================================================================
   1. SETUP & CONFIGURATION
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital@0;1&family=Grenze:wght@600;800&family=Playfair+Display&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap'); /* ADDED FONT */

:root {
  --font-primary: "EB Garamond", serif;
  --font-display: "Grenze", serif;
  --font-ui: "Inter", sans-serif; /* ADDED FONT VARIABLE */
  --color-white: #fff;
  --color-black: #000;
  --color-gold-primary: #FDB931;
  --color-brown-dark: #783000;
  --color-brown-medium: #9f7928;
  --color-always-white: #ffffff;
  --gradient-gold-animated: repeating-linear-gradient(to right, #FDB931 0%, #be8c3c 8%, #FEDB37 18%, #d3b15f 27%, #8A6E2F 35%, #9f7928 40%, #faf0a0 50%, #d3b15f 58%, #D1B464 67%, #b17b32 77%, #bb8332 83%, #d4a245 88%, #e1b453 93%, #5d4a1f 100%);
  --gradient-tag-hover: radial-gradient(ellipse farthest-corner at right bottom, #FEDB37 0%, #FDB931 8%, #9f7928 30%, #8A6E2F 40%, transparent 80%),
                        radial-gradient(ellipse farthest-corner at left top, #FFFFFF 0%, #FFFFAC 8%, #D1B464 25%, #5d4a1f 62.5%, #5d4a1f 100%);
}


/* ==========================================================================
   2. GLOBAL STYLES & RESETS
   ========================================================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-primary);
  padding: 8em 0;
  width: 100%;
  transition: margin-left 0.3s ease; /* Added for sidebar push effect */
}

/* New body class when sidebar is open */
body.sidebar-open {
    overflow: hidden;
}

a {
  color: darkred;
  text-decoration: none;
}

a:hover {
  color: var(--color-gold-primary);
}

.footer {
    font-family: var(--font-display);
    text-transform: uppercase;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--color-brown-dark);
    color: var(--color-white);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.3em 0;
    z-index: 998;
}

.footer a {
    color: var(--color-white);
}

.footer a:hover {
    color: var(--color-gold-primary);
}

img {
  max-height: 275px;
  margin: auto;
  display: inline-block;
}

.hidden {
  display: none;
}


/* ==========================================================================
   3. TYPOGRAPHY
   ========================================================================== */

h1 {
  font-family: var(--font-display);
  text-transform: uppercase;
  text-align: center;
  color: var(--color-white);
}


h2, h3, h6 {
  font-family: var(--font-display);
  text-transform: uppercase;
  text-align: center;
  margin-top: 1em;
  color: var(--color-white);
}

h1 { font-size: 7em; font-weight: 800; }
h2 { font-size: 5em; font-weight: 600; }
h3 { font-size: 3em; font-weight: 400; }
h4, h5 { margin: 0; font-weight: 600; }
h6 { font-size: 7em; font-weight: 800; margin: 0; }

p {
  font-family: var(--font-primary);
  text-align: left;
  font-size: 2em;
  margin: .5em 0 0 1em;
  color: var(--color-white);
}


/* ==========================================================================
   4. LAYOUT & CONTAINERS
   ========================================================================== */

.background-image {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -5;
    background-image: url('parchment.webp');
    background-size: cover;
    filter: brightness(.8);
    transition: filter 0.3s;
}

body.dark-mode .background-image {
    filter: grayscale(1) brightness(.25);
}

.text-container {
  width: 80%;
  margin: 0 auto;
  text-align: left;
}

.lead-white-space {
  margin-top: 2.5em;
}


/* ==========================================================================
   5. COMPONENTS
   ========================================================================== */

/* --- Navigation & Menu --- */
.navigation-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--gradient-gold-animated);
    background-size: 150%;
    animation: MoveBackgroundPosition 30s ease-in-out infinite;
    padding: 1em;
    font-family: var(--font-display);
    font-size: 2em;
    z-index: 999;
    transition: padding 0.3s ease;
}

.navigation-menu a {
    color: var(--color-white);
}

.navigation-menu__labels {
    list-style: none;
    display: flex;
    gap: .75em;
    margin: 0;
    padding: 0;
}

.navigation-menu__labels > li > a:hover {
    color: var(--color-brown-dark);
}

.site-identity {
    font-size: 1em;
    display: block;
    padding-right: 1em;
}

/* --- Mobile Menu (Hamburger) --- */
.hamburger, #closeIcon {
    display: none;
    cursor: pointer;
    border: none;
    background: none;
}

/* --- Horizontal Card Style (.monstercard) --- */
.monstercard-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 4em auto;
  width: 90%;
}

.monstercard {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 1 450px;
  max-width: 500px;
  min-width: 350px;
  border-radius: 15px;
  background: linear-gradient(110deg, #515B75 0%, #222736 100%);
  text-align: left;
  padding: 0 0 .75em 0;
  box-shadow: 0px 5px 20px -10px #111111;
  animation: slideInAndFlipIn 0.4s ease-in-out forwards;
  overflow: hidden;
  transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
}

.monstercard:hover {
  box-shadow: 0px 10px 25px -10px var(--color-black);
  transform: translateY(-3px);
}

.monstercard__image-container {
  flex-shrink: 0;
  width: 100%;
  max-height: 190px;
  background-color: rgba(0, 0, 0, 0.7);
}

.monstercard__image-container img {
  display: block;
  width: 100%;
  height: 190px;
  object-fit: cover;
  object-position: top;
  border-radius: 15px 15px 0 0;
}

.monstercard__caption {
  flex-grow: 1;
  padding: 1em 1.5em 1.5em;
  display: flex;
  flex-direction: column;
}

.monstercard__caption p {
  font-size: 0.9em;
  margin: 0.5em 0 1em 0;
  line-height: 1.4;
  color: #fff;
}

.monstercard__name {
  font-family: var(--font-primary);
  color: var(--color-always-white);
  text-align: center;
  font-size: 1.5em;
  font-weight: 700;
  letter-spacing: -0.02em;
  padding-bottom: .25em;
  margin-top: 1em;
  margin-bottom: 0.5em;
  order: 1;
}

.monstercard__type {
  position: absolute;
  top: 0.75em;
  right: 0.75em;
  color: var(--color-black);
  background: var(--color-always-white);
  font-family: var(--font-primary);
  text-transform: uppercase;
  font-size: .75em;
  letter-spacing: 0.1em;
  padding: 0.25em 0.5em;
  border-radius: 2px;
  z-index: 2;
}

.monstercard__abilities {
  display: flex;
  justify-content: space-around;
  gap: 1em;
  margin-bottom: 1em;
  order: 2;
  text-align: center;
  color: var(--color-always-white);
}

.monstercard__ability h4 {
  font-size: 1em;
  font-weight: 400;
  line-height: 1.2;
  margin: 0;
  color: var(--color-always-white);
}

.monstercard__label {
  display: block;
  font-size: 0.7em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--color-always-white);
  padding: 0;
  margin-bottom: .75em;
  font-size: .9em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.monstercard__stats,
.monstercard__weapons-table {
  width: 100%;
  color: var(--color-always-white);
  font-style: normal;
  border-collapse: collapse;
}

.monstercard__stats {
  order: 3;
  margin: 0.5em 0 1em 0;
}

.monstercard__combat-details {
  order: 4;
  margin-top: 0.5em;
  color: var(--color-always-white);
}

.monstercard__combat-details[open]::after {
    content: '';
    display: block;
    height: 1.5em;
}

.monstercard__combat-summary {
  cursor: pointer;
  display: inline-block;
  font-weight: bold;
  list-style: none;
  font-style: normal;
  color: var(--color-always-white);
  font-size: 0.9em;
  padding: 0.2em 0;
}

.monstercard__combat-summary::-webkit-details-marker,
.monstercard__combat-summary::marker {
  display: none;
}

.monstercard__combat-summary::after {
  content: '>';
  display: inline-block;
  margin-left: 0.5em;
  margin-bottom: 4em;
  transition: transform 0.1s ease-in-out;
  font-weight: bold;
}

.monstercard__combat-details[open] > .monstercard__combat-summary::after {
  transform: rotate(90deg);
}

.monstercard__weapons-table {
  margin: 0.3em 0 0.8em 0;
}

.monstercard__weapons-table .weapon-note,
.modal-content .weapon-note {
  font-style: italic;
  font-size: 0.9em;
  padding: 0.2em 0.5em 1em 0.5em;
  color: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

tr:has(+ tr .weapon-note) > th,
tr:has(+ tr .weapon-note) > td {
    border-bottom: none;
}

.monstercard__stats th,
.monstercard__stats td {
  padding: 0.5em;
  vertical-align: top;
  line-height: 1.3;
}

.monstercard__stats th {
  text-align: left;
  font-weight: bold;
  width: 25%;
  text-transform: uppercase;
  font-size: .8em;
}

.monstercard__stats td {
  width: 75%;
}

.monstercard__weapons-table {
    width: 100%;
}
.monstercard__weapons-table th {
    font-weight: bold;
    width: 25%;
    padding: 0.25em .5em 0.25em 0;
    vertical-align: top;
    text-align: left;
}
.monstercard__weapons-table td {
    padding: 0.25em .5em;
    vertical-align: top;
    line-height: 1.3;
    text-align: left;
    word-break: break-word;
}

.monstercard__stats tr:nth-of-type(even),
.monstercard__weapons-table tr:nth-of-type(even) {
  background-color: rgba(255, 255, 255, 0.1);
}

.monstercard__wounds-container {
    display: flex;
    justify-content: space-around;
    margin-bottom: 1em;
}

.monstercard__wounds {
    flex: 1 1 auto;
    text-align: left;
}

.monstercard__lp {
    position: absolute;
    bottom: 0.75em;
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    color: #000000;
    padding: 0.25em 0.75em;
    border-radius: 3px;
    max-width: 90%;
    font-family: "EB Garamond", serif;
    font-size: 0.75em;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-align: center;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* --- Card Coloring by Type --- */
/* LD Characters */
.card--nobility  { background: linear-gradient(110deg, #655470 0%, #2b004a 100%); }
.card--courtier { background: linear-gradient(110deg, #897496 0%, #160063 100%); }
.card--church {  background: linear-gradient(110deg, #E0E0E0 0%, #730000 100%); }
.card--city {  background: linear-gradient(110deg, #b0b0b0 0%, #291b13 100%); }
.card--village {  background: linear-gradient(110deg, #a6906f 0%, #402700 100%); }
.card--peasant {  background: linear-gradient(110deg, #5e804e 0%, #293d1d 100%); }
.card--sea {  background: linear-gradient(110deg, #27826e 0%, #120b36 100%); }
.card--army {  background: linear-gradient(110deg, #a6a6a6 0%, #470000 100%); }
.card--cult {  background: linear-gradient(110deg, #5c5c5c 0%, #000000 100%); }
.card--slave {  background: linear-gradient(110deg, #9e857b 0%, #403324 100%); }
.card--outcast {  background: linear-gradient(110deg, #9BA167 0%, #514A0F 100%); }
.card--doctor {  background: linear-gradient(110deg, #865050 0%, #1F2246 100%); }
.card--criminal {  background: linear-gradient(110deg, #6b6400 0%, #241f0f 100%); }
.card--merchant {  background: linear-gradient(110deg, #ba9800 0%, #704d00 100%); }
.card--mage {  background: linear-gradient(110deg, #ffffff 0%, #800800 50%, #000000 100%); }
.card--clansman {  background: linear-gradient(110deg, #3e5d3a 0%, #452b00 100%); }
/* Monsters */
.card--boss {  background: linear-gradient(110deg, #ff0000 0%, #000000 100%); }
.card--hybrid {  background: linear-gradient(110deg, #AAAD8E 0%, #8F5000 100%); }
.card--horror {  background: linear-gradient(110deg, #85967B 0%, #0F170E 100%); }
.card--magical {  background: linear-gradient(110deg, #E6FF94 0%, #401282 100%); }
.card--beast {  background: linear-gradient(110deg, #82C429 0%, #522F14 100%); }
.card--empyrean {  background: linear-gradient(110deg, #FFD900 0%, #D97700 100%); }
.card--spirits {  background: linear-gradient(110deg, #8B4E96 0%, #000000 100%); }
.card--demons {  background: linear-gradient(110deg, #6E2929 0%, #1F0C0C 100%); }
.card--undead {  background: linear-gradient(110deg, #585C44 0%, #243021 100%); }
.card--artificial {  background: linear-gradient(110deg, #4F8057 0%, #5A5D5E 100%); }
.card--humanoid {  background: linear-gradient(110deg, #F5E5D5 0%, #3D250F 100%); }
.card--ocean {  background: linear-gradient(110deg, #2ED5FF 0%, #00203D 100%); }
.card--giants {  background: linear-gradient(110deg, #77C9C4 0%, #4A3912 100%); }
.card--giant {  background: linear-gradient(110deg, #77C9C4 0%, #4A3912 100%); }
.card--dragon {  background: linear-gradient(110deg, #002EFF 0%, #FF0000 100%); }
.card--myth {  background: linear-gradient(110deg, #B4864B 0%, #000000 100%); }
.card--mythological {  background: linear-gradient(110deg, #B4864B 0%, #000000 100%); }
.card--interesting {  background: linear-gradient(110deg, #FAC341 0%, #F74FA3 100%); }
/* Community NPCs */
.card--villager {  background: linear-gradient(110deg, #a6906f 0%, #402700 100%); }
.card--colorful-and-unusual {  background: linear-gradient(110deg, #F7F74F 0%, #F74FA3 100%); }
.card--slave-and-captive {  background: linear-gradient(110deg, #9e857b 0%, #403324 100%); }
.card--seafarer {  background: linear-gradient(110deg, #27826e 0%, #120b36 100%); }
.card--professional-soldier {  background: linear-gradient(110deg, #a6a6a6 0%, #470000 100%); }
.card--religious {  background: linear-gradient(110deg, #E0E0E0 0%, #730000 100%); }
.card--noble-court { background: linear-gradient(110deg, #897496 0%, #160063 100%); }
.card--noble  { background: linear-gradient(110deg, #655470 0%, #2b004a 100%); }
.card--city-dweller {  background: linear-gradient(110deg, #b0b0b0 0%, #291b13 100%); }
.card--etharch  { background: linear-gradient(110deg, #655470 0%, #2b004a 100%); }
.card--wilderlands {  background: linear-gradient(110deg, #5e804e 0%, #293d1d 100%); }
.card--etharch  { background: linear-gradient(110deg, #655470 0%, #2b004a 100%); }
.card--protector {  background: linear-gradient(110deg, #a6a6a6 0%, #470000 100%); }
.card--citadel { background: linear-gradient(110deg, #897496 0%, #160063 100%); }
.card--guilder {  background: linear-gradient(110deg, #5e804e 0%, #293d1d 100%); }
.card--artificer {  background: linear-gradient(110deg, #b0b0b0 0%, #291b13 100%); }
.card--host {  background: linear-gradient(110deg, #a6a6a6 0%, #470000 100%); }
.card--chattel {  background: linear-gradient(110deg, #EDB9B2 0%, #403534 100%); }
.card--great-and-black {  background: linear-gradient(110deg, #26012B 0%, #000000 100%); }
.card--black-legion {  background: linear-gradient(110deg, #3D0000 0%, #000000 100%); }
.card--servant-of-the-dark-blood {  background: linear-gradient(110deg, #7D0000 0%, #3D0000 100%); }

/* --- Community Bestiary Page Specific Styles --- */

.community-bestiary .monstercard__image-container {
  display: none;
}

/* Adds space to the top of image-less cards */
.community-bestiary .monstercard__name {
  padding-top: 1.5em;
}

/* --- FAQ Accordion Styles --- */
.faq-accordion {
    column-count: 2;
    column-gap: 2.5rem;
    max-width: 1200px;
    margin: 2rem auto;
    text-align: left;
}

.faq-item {
    break-inside: avoid;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.faq-item:last-of-type {
    border-bottom: none;
}

.faq-question {
    font-family: var(--font-display);
    font-size: 2em;
    font-weight: 600;
    color: var(--color-white);
    padding: 1.5rem 0;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.faq-question::-webkit-details-marker {
    display: none;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    margin: 0 -1.5rem;
}

.faq-question::after {
    content: '+';
    font-size: 2.5rem;
    font-weight: 200;
    margin-left: 1rem;
    transition: transform 0.2s ease-in-out;
}

.faq-item[open] > .faq-question::after {
    content: '+';
    transform: rotate(45deg);
}

.faq-answer {
    padding: 0 1rem 1.5rem 1rem;
    font-size: .75em;
    line-height: 1.6;
}

.faq-answer p {
    color: var(--color-white);
    margin: 0 0 1em 0;
}

.faq-answer ul {
    font-family: var(--font-primary);
    font-size: 2em;
    color: var(--color-white);
    list-style-position: outside;
    padding-left: 2em;
    margin: 0 0 1em 0;
}

.faq-answer li {
    margin-bottom: 0.75em;
}

.faq-answer li:last-child {
    margin-bottom: 0;
}

.term {
    color: var(--color-gold-primary);
    font-weight: 900;
}

/* ==========================================================================
   SIDEBAR STYLES (FILTER & NAV)
   ========================================================================== */

/* --- Overlay --- */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: transparent;
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}
.sidebar-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

/* --- Shared Sidebar Styles --- */
.filter-sidebar,
.nav-sidebar {
    position: fixed;
    top: 0;
    width: 350px;
    height: 100%;
    background-color: var(--color-brown-dark);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}
body.dark-mode .filter-sidebar,
body.dark-mode .nav-sidebar {
    background-color: var(--color-brown-dark); /* This is now #000 in dark mode */
}

/* --- Filter Sidebar (Left) --- */
.filter-sidebar {
    left: -350px;
    transition: left 0.3s ease;
}
.filter-sidebar.is-open {
    left: 0;
}
.filter-slideout-toggle {
    position: fixed;
    top: 100px;
    left: 0;
    transform: rotate(-90deg) translateX(-100%);
    transform-origin: top left;
    background-color: var(--color-brown-dark);
    color: var(--color-always-white);
    padding: 0.75rem 1.5rem;
    font-family: var(--font-ui);
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    z-index: 998;
    border-radius: 0 0 8px 8px;
    border: 1px solid rgba(255,255,255,0.2);
    border-top: none;
    transition: background-color 0.2s;
}
.filter-slideout-toggle:hover {
    background-color: var(--color-brown-medium);
}
body.dark-mode .filter-slideout-toggle {
    background-color: var(--color-brown-dark);
}

/* --- Navigation Sidebar (Right) --- */
.nav-sidebar {
    right: -350px;
    transition: right 0.3s ease;
}
.nav-sidebar.is-open {
    right: 0;
}

/* --- Sidebar Header & Close Buttons --- */
.filter-sidebar__header,
.nav-sidebar__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}
.filter-sidebar__header h2,
.nav-sidebar__header h2 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    margin: 0;
    color: var(--color-always-white);
}
.filter-sidebar__close-btn,
.nav-sidebar__close-btn {
    font-size: 2.5rem;
    font-weight: lighter;
    color: var(--color-always-white);
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
}

/* --- Sidebar Content --- */
.filter-sidebar__content,
.nav-sidebar__content {
    overflow-y: auto;
    flex-grow: 1;
}

/* --- Filter-Specific Content Styles --- */
#filter-search-input {
    width: 100%;
    padding: 0.75rem;
    font-family: var(--font-ui);
    font-size: 1rem;
    border-radius: 5px;
    border: 1px solid var(--color-gold-primary);
    background-color: #fff;
    color: #000;
    margin-bottom: 1.5rem;
}
body.dark-mode #filter-search-input {
    background-color: #333;
    color: #fff;
    border-color: var(--color-gold-primary);
}
.filter-sidebar h3 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: var(--color-gold-primary);
    margin: 1.5rem 0 0.75rem 0;
    text-align: left;
    text-transform: uppercase;
}
.filter-sidebar__taglist {
    list-style: none;
    padding: 0;
    margin: 0;
}
.filter-sidebar__taglist li button {
    width: 100%;
    background: none;
    border: 1px solid rgba(255,255,255,0.3);
    color: var(--color-always-white);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 5px;
    text-align: left;
    font-family: var(--font-ui);
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s, padding 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.filter-sidebar__taglist li button:hover {
    background-color: var(--color-brown-medium);
}
.filter-sidebar__taglist li button.selected {
    background-color: var(--color-gold-primary);
    color: var(--color-brown-dark);
    font-weight: 700;
    border-color: var(--color-gold-primary);
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
}
.clear-tag-btn {
    font-size: 1.5rem;
    font-weight: normal;
    padding: 0 0.5rem;
    border-radius: 50%;
}
.clear-tag-btn:hover {
    color: #c0392b;
}
.filter-sidebar__footer {
    padding-top: 1rem;
    margin-top: 1rem;
    border-top: 1px solid rgba(255,255,255,0.2);
}
#clear-filters-btn {
    width: 100%;
    background: none;
    border: 1px solid var(--color-gold-primary);
    color: var(--color-gold-primary);
    padding: 0.75rem;
    border-radius: 5px;
    font-family: var(--font-ui);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}
#clear-filters-btn:hover {
    background-color: var(--color-gold-primary);
    color: var(--color-brown-dark);
}
body.dark-mode .filter-sidebar__taglist li button {
    border-color: rgba(253, 185, 49, 0.4);
    color: var(--color-always-white);
}
body.dark-mode .filter-sidebar__taglist li button:hover {
    background-color: var(--color-brown-medium);
}
body.dark-mode .filter-sidebar__taglist li button.selected {
    background-color: var(--color-gold-primary);
    color: #000;
}

/* --- Nav-Specific Content Styles --- */
.nav-sidebar .navigation-menu__labels {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
}
.nav-sidebar .navigation-menu__labels a {
    display: block;
    font-size: 2rem;
    padding: 0.75rem 0;
    color: var(--color-always-white);
    width: 100%;
}
.nav-sidebar .navigation-menu__labels a:hover {
    color: var(--color-gold-primary);
}


/* ==========================================================================
   6. ANIMATIONS
   ========================================================================== */

@keyframes MoveBackgroundPosition {
  0%, 100% { background-position: 0% 50% }
  16%      { background-position: 12% 50% }
  23%      { background-position: 8% 50% }
  37%      { background-position: 45% 50% }
  42%      { background-position: 37% 50% }
  50%      { background-position: 80% 50% }
  57%      { background-position: 84% 49% }
  73%      { background-position: 62% 50% }
}

@keyframes slideInAndFlipIn {
  0% {
    transform: translateX(100%) rotate(10deg) perspective(800px) rotateY(90deg);
    opacity: 0;
  }
  100% {
    transform: translateX(0) rotate(0deg) perspective(800px) rotateY(0deg);
    opacity: 1;
  }
}


/* ==========================================================================
   7. RESPONSIVE STYLES (MEDIA QUERIES)
   ========================================================================== */

@media screen and (min-width: 1921px) {
    .navigation-menu {
        font-size: 1.5rem;
        padding: 0.75em 2em;
    }
}

@media screen and (max-width: 1920px) {
    .navigation-menu { 
        padding: 0.2em; 
        font-size: 1.6em;
    }
    .monstercard {
        /* Reduce the base and minimum width to allow more cards per line */
        flex-basis: 380px; /* Down from 450px */
        min-width: 320px; /* Down from 350px */
    }

    .monstercard__caption {
        /* Reduce padding inside the card */
        padding: 0.75em 1em 1em;
    }

    .monstercard__name {
        font-size: 1.3em;
    }

    .monstercard__abilities {
        gap: 0.5em;
        margin-bottom: 0.75em;
    }

    /* Reduce the font size for all ability text and labels */
    .monstercard__ability,
    .monstercard__label,
    .monstercard__stats th,
    .monstercard__stats td,
    .monstercard__weapons-table th,
    .monstercard__weapons-table td,
    .monstercard__combat-summary,
    .monstercard__wounds {
        font-size: 0.85em;
    }
    h1 {font-size: 5em; }
}

@media screen and (max-width: 1280px) {
  .navigation-menu { padding: 0.5em; font-size: 1.4em; }
}

@media screen and (max-width: 1024px) {
  .monstercard-container {
    width: 95%;
    margin-top: 2em;
    margin-bottom: 2em;
    gap: 15px;
  }
}

@media screen and (max-width: 768px) {
    p { font-size: 1.3rem; }
    h1 {font-size: 2.5rem; }
    h2 { font-size: 1.75rem; }
    
    .monstercard-container {
        margin-top: 1em;
        width: 95%;
        gap: 10px;
    }

    .navigation-menu {
        background: transparent;
        padding: 0;
    }
    .navigation-menu__labels, .site-identity { display: none; }
    
    .hamburger {
        display: block;
        position: fixed;
        top: 15px;
        right: 15px;
        background-color: var(--color-brown-dark);
        color: var(--color-always-white);
        padding: 0.6em 1.5em;
        border-radius: 50px;
        font-family: var(--font-ui);
        font-size: 1rem;
        font-weight: 600;
        border: 1px solid rgba(255, 255, 255, 0.5);
        z-index: 998;
    }
    
    .filter-slideout-toggle {
        display: block;
        top: 15px;
        left: 50%;
        transform: translateX(-50%);
        transform-origin: center;
        width: auto;
        white-space: nowrap;
        padding: 0.6em 1.5em;
        border-radius: 50px;
        font-size: 1rem;
        border: 1px solid rgba(255, 255, 255, 0.5);
    }
    
    .mobile-search-container {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        justify-content: center;
        padding: 3.25em;
    }
    #mobileSearchInput {
        display: block;
        position: fixed;
        top: 60px;
        left: 12.5%;
        right: 12.5%;
        transform: none;
        width: auto;
        font-size: 1.1em;
        padding: .5em 1em;
        color: var(--color-white);
        background-color: var(--color-brown-dark);
        border: .1em solid var(--color-white);
        border-radius: 3em;
    }
    #mobileSearchInput::placeholder {
        color: var(--color-white); opacity: 0.8;
    }
    
    .monstercard {
        flex: 1 1 90%;
        width: 90%;
        max-width: 400px;
    }
    .monstercard__image-container { height: 180px; }
    .monstercard__caption { padding: 1em; }
    .monstercard__type { top: 0.5em; right: 0.5em; font-size: 0.7em; }
    .monstercard__stats, .monstercard__wounds, .monstercard__ability, .monstercard__label, .monstercard__heading, h4 {
        font-size: 0.8em;
    }
    
    .faq-accordion {
        column-count: 1;
    }

    .resource-card {
      min-width: unset;
      max-width: 90%;
    }
    
    .resources-grid {
        grid-template-columns: 1fr;
    }
}


/* ==========================================================================
   8. DISPLAY TOGGLES
   ========================================================================== */

body.dark-mode {
    --color-white: var(--color-gold-primary);
    --color-brown-dark: #000000;
}

body.dark-mode a {
  color: #870c01;
}

body.dark-mode a:hover {
  color: #d31302;
}

body.dark-mode .footer {
    background-color: #000000;
}

body.dark-mode .resource-card {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .resource-link {
    background-color: var(--color-gold-primary);
    color: #870c01;
}

body.dark-mode .resource-link:hover {
    background-color: #d31302;
    color: var(--color-white);
}

.dark-mode-toggle {
    position: fixed;
    bottom: 3.5rem;
    right: 20px;
    z-index: 1000;
}

.dark-mode-toggle label {
    display: inline-block;
    width: 50px;
    height: 26px;
    position: relative;
}

.dark-mode-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.dark-mode-toggle .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    border-radius: 26px;
    transition: .4s;
}

.dark-mode-toggle .slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: .4s;
}

.dark-mode-toggle input:checked + .slider {
    background-color: #000000;
}

.dark-mode-toggle input:checked + .slider:before {
    transform: translateX(24px);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.settings-toggles {
    position: fixed;
    bottom: 6.5rem;
    right: 20px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.setting-toggle label {
    display: inline-block;
    width: 50px;
    height: 26px;
    position: relative;
}

.setting-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.setting-toggle .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    border-radius: 26px;
    transition: .4s;
}

.setting-toggle .slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: .4s;
}

.setting-toggle input:checked + .slider:before {
    transform: translateX(24px);
}

.setting-toggle .art-slider:before {
    background-color: #c0392b;
}

.setting-toggle input:checked + .art-slider {
    background-color: #2980b9;
}

.setting-toggle .gradient-slider:before {
    background-color: #666;
}

.setting-toggle input:checked + .gradient-slider {
    background-color: #333;
}

body.no-art-page .monstercard__name,
body.art-hidden .monstercard__name {
  padding-top: 1.5em;
}

body.art-hidden .card__image-container,
body.art-hidden .monstercard__image-container {
    display: none;
}

body.grayscale-gradients .card,
body.grayscale-gradients .monstercard {
    background: linear-gradient(110deg, #857D6B 0%, #1C1C1A 100%) !important;
}


/* ==========================================================================
  9. RESOURCES PAGE STYLES
   ========================================================================== */

.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
    text-align: left;
}

.resource-card {
    background: rgba(120, 48, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
}

.resource-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.resource-card h2, .resource-card h3 {
    text-align: left;
    margin-bottom: 0.5rem;
}

.resource-title {
    font-size: 2em;
    font-weight: 600;
}

.resource-subtitle {
    font-size: 1.2em;
    font-weight: 600;
    margin-top: 1rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.resource-description {
    font-family: var(--font-primary);
    font-size: 1.2em;
    line-height: 1.5;
    color: var(--color-white);
    margin: 0;
    flex-grow: 1;
}

.resource-sub-group {
    margin-top: 1rem;
}

.resource-links {
    padding-top: 1rem;
}

.resource-link {
    display: inline-block;
    background-color: var(--color-brown-dark);
    color: var(--color-white);
    font-family: var(--font-display);
    text-decoration: none;
    padding: 0.6em 1.2em;
    margin: 0.25em 0.5em 0.25em 0;
    border-radius: 5px;
    transition: background-color 0.2s ease;
}

.resource-link:hover {
    background-color: var(--color-brown-medium);
    color: var(--color-white);
}


/* ==========================================================================
  10. HOME PAGE STYLES
   ========================================================================== */

.hero-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 2rem;
}

.hero-panels {
    display: flex;
    width: 100%;
    height: 60vh;
    min-height: 350px;
}

.hero-panel {
    position: relative;
    flex: 1;
    overflow: hidden;
    cursor: pointer;
    transition: flex 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
    text-decoration: none;
}

.hero-panel img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    min-height: 100%;
    max-height: none;
    object-fit: cover;
    object-position: center center;
    transition: filter 0.4s ease-in-out;
}

.hero-panel:first-child { margin-left: 0; }
.hero-panel:last-child { margin-right: 0; }

.hero-panel:hover {
    flex: 5;
}

.hero-panel:hover img {
    filter: brightness(1.1);
}

.hero-panel h3 {
    position: absolute;
    bottom: 20px;
    left: 20px;
    color: white;
    font-size: 2em;
    font-family: var(--font-display), sans-serif;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.9);
    margin: 0;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.hero-panel:hover h3 {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 768px) {
    .hero-panels {
        flex-direction: column; 
        height: auto;           
    }
    .hero-panel {
        flex: 1;                
        height: 25vh;          
        min-height: 150px;      
        margin-bottom: 10px;    
    }
    .hero-panel:hover {
        flex: 1; 
    }
    .hero-panel h3 {
        opacity: 1;
        transform: none;
        font-size: 1.8em;       
        text-align: left;
    }
    .hero-panel:last-child {
        margin-bottom: 0; 
    }
}

.hero-cta {
    margin-top: -50px;
    position: relative;
    z-index: 10;
}

.cta-button {
    background-color: var(--color-brown-dark);
    color: var(--color-white);
    font-family: var(--font-display);
    text-decoration: none;
    padding: 0.8em 2em;
    border-radius: 50px;
    transition: background-color 0.2s ease, transform 0.2s ease;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    font-size: 1.2em;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.cta-button:hover {
    background-color: var(--color-brown-medium);
    transform: translateY(-3px);
}

.rules-section {
    padding: 4rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.rules-section h2 {
    text-align: center;
    font-size: 2.5em;
    margin-bottom: 2rem;
}

.rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.rules-footnote {
    text-align: center;
    margin-top: 2rem;
    font-style: italic;
    opacity: 0.8;
}

.rule-card {
    background: rgba(120, 48, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
}

.rule-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

body.dark-mode .rule-card {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.1);
}

.rule-card-title {
    font-family: var(--font-display);
    font-size: 1.5em;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.rule-card-text {
    font-family: var(--font-primary);
    font-size: 1.1em;
    line-height: 1.6;
    color: var(--color-white);
    margin: 0;
    flex-grow: 1; 
}


/* ==========================================================================
  11. MONSTER CARD HOVER & MODAL STYLES
   ========================================================================== */

.monstercard:hover {
  cursor: pointer;
}

.modal-overlay {
  position: fixed; 
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000; 
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  padding: 1em;
  box-sizing: border-box;
}

.modal-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  position: relative;
  color: var(--color-always-white);
  padding: 2rem 2rem 4rem 2rem;
  border-radius: 15px;
  width: 100%;
  max-width: 1400px;
  max-height: 95vh;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 2.5rem;
  font-weight: bold;
  color: var(--color-always-white);
  cursor: pointer;
  line-height: 1;
  border: none;
  background: none;
  text-shadow: 0 0 5px rgba(0,0,0,0.5);
}

.modal-header {
  text-align: center;
  margin-bottom: 2rem;
}

.modal-header h3 {
  font-family: var(--font-primary);
  font-size: 2em;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  color: var(--color-always-white);
}

.modal-header-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  font-size: 1.1em;
}

.modal-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  text-align: left;
}

.modal-column h2 {
  font-family: var(--font-display);
  font-weight: 600;
  text-transform: uppercase;
  text-align: center;
  font-size: 1.75em;
  margin-top: 0;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--color-always-white);
}

.modal-column h3 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.25em;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--color-always-white);
}

.modal-column p, .modal-column li {
  font-family: var(--font-primary);
  font-size: 1.1em;
  line-height: 1.6;
  margin-bottom: 1em;
  color: var(--always-white);
}

.modal-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1em;
}

.modal-content table th, .modal-content table td {
    text-align: left;
    vertical-align: top;
    padding: 0.5em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-content table th {
    font-weight: bold;
    width: 30%;
}

.modal-content table tr:nth-of-type(even) {
    background-color: rgba(255, 255, 255, 0.1);
}

@media (max-width: 900px) {
  .modal-grid {
    grid-template-columns: 1fr;
  }
}