/* =====================================================
   Spellmonger's Hall — Wiki Theme
   ===================================================== */

/* --- Custom Properties --- */
:root {
    --smh-dark:        #1a1208;
    --smh-darker:      #0f0b05;
    --smh-gold:        #c9a84c;
    --smh-gold-light:  #e8c97a;
    --smh-parchment:   #f5f0e0;
    --smh-parchment-dk:#e8dfc8;
    --smh-brown:       #5c3d1e;
    --smh-brown-light: #8b6340;
    --smh-text:        #2c2008;
    --smh-border:      #8b7355;
    --smh-red:         #8b1a1a;
    --smh-muted:       #6b5c3a;
}

/* --- Base --- */
body {
    background-color: var(--smh-parchment);
    color: var(--smh-text);
    font-family: 'Lato', sans-serif;
}

/* --- Navigation --- */
.smh-navbar {
    background-color: var(--smh-darker);
    border-bottom: 2px solid var(--smh-gold);
    padding: 0.5rem 0;
}

.smh-navbar .navbar-brand {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--smh-gold) !important;
    letter-spacing: 0.05em;
    text-decoration: none;
}

.smh-navbar .navbar-brand:hover {
    color: var(--smh-gold-light) !important;
}

.smh-navbar .nav-link {
    color: #d4c5a0 !important;
    font-weight: 500;
    padding: 0.6rem 1rem !important;
    transition: color 0.2s;
}

.smh-navbar .nav-link:hover,
.smh-navbar .nav-link.active {
    color: var(--smh-gold) !important;
}

.smh-navbar .navbar-toggler {
    border-color: var(--smh-gold);
}

.smh-navbar .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28201, 168, 76, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.smh-navbar .dropdown-menu {
    background-color: #1e1508;
    border: 1px solid var(--smh-gold);
    border-radius: 0;
}

.smh-navbar .dropdown-item {
    color: #d4c5a0;
    font-size: 0.9rem;
}

.smh-navbar .dropdown-item:hover {
    background-color: rgba(201, 168, 76, 0.15);
    color: var(--smh-gold);
}

/* --- Hero Banner --- */
.smh-hero {
    background: linear-gradient(to bottom, var(--smh-darker) 0%, #2a1a08 100%);
    border-bottom: 3px solid var(--smh-gold);
    padding: 3rem 0 2.5rem;
    text-align: center;
}

.smh-hero h1 {
    font-family: 'Cinzel', serif;
    font-size: 3rem;
    color: var(--smh-gold);
    text-shadow: 2px 2px 8px rgba(0,0,0,0.8);
    letter-spacing: 0.08em;
    margin-bottom: 0.5rem;
}

.smh-hero p.lead {
    color: #c8b89a;
    font-size: 1.05rem;
    max-width: 680px;
    margin: 0 auto 1.5rem;
}

.smh-hero .hero-divider {
    width: 120px;
    height: 2px;
    background: linear-gradient(to right, transparent, var(--smh-gold), transparent);
    margin: 0.75rem auto 1.5rem;
}

/* --- Stat Tiles (Homepage) --- */
.smh-stat-tiles {
    margin: 2rem 0;
}

.smh-stat-tile {
    background: white;
    border: 1px solid var(--smh-border);
    border-top: 4px solid var(--smh-gold);
    border-radius: 4px;
    padding: 1.5rem 1rem;
    text-align: center;
    text-decoration: none;
    color: var(--smh-text);
    display: block;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.smh-stat-tile:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    color: var(--smh-text);
    border-top-color: var(--smh-brown);
}

.smh-stat-tile .stat-number {
    font-family: 'Cinzel', serif;
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--smh-gold);
    line-height: 1;
    display: block;
}

.smh-stat-tile .stat-label {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--smh-muted);
    display: block;
    margin-top: 0.4rem;
}

.smh-stat-tile .stat-icon {
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
    display: block;
}

/* --- Section Headings --- */
.smh-section-title {
    font-family: 'Cinzel', serif;
    color: var(--smh-brown);
    font-size: 1.3rem;
    border-bottom: 2px solid var(--smh-gold);
    padding-bottom: 0.4rem;
    margin-bottom: 1.25rem;
}

/* --- Character Cards (Characters listing page) --- */
.smh-char-card {
    background: white;
    border: 1px solid var(--smh-border);
    border-radius: 4px;
    overflow: hidden;
    text-decoration: none;
    color: var(--smh-text);
    display: block;
    transition: transform 0.15s, box-shadow 0.15s;
    height: 100%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.07);
}

.smh-char-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    color: var(--smh-text);
}

.smh-char-card .char-card-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    object-position: top center;
    background-color: var(--smh-parchment-dk);
}


.smh-char-card .char-card-body {
    padding: 0.75rem 1rem;
}

.smh-char-card .char-name {
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--smh-brown);
    margin-bottom: 0.2rem;
}

.smh-char-card .char-role {
    font-size: 0.8rem;
    color: var(--smh-brown);
    font-style: italic;
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.smh-char-card .char-meta {
    font-size: 0.78rem;
    color: var(--smh-muted);
}

.smh-char-card .char-badge {
    display: inline-block;
    background: var(--smh-parchment-dk);
    border: 1px solid var(--smh-border);
    border-radius: 3px;
    font-size: 0.7rem;
    padding: 1px 6px;
    margin-top: 0.3rem;
    color: var(--smh-brown);
    font-weight: 600;
}

/* --- Wiki Infobox (Character Sidebar) --- */
.smh-infobox {
    background: white;
    border: 1px solid var(--smh-border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.smh-infobox .infobox-title {
    background: var(--smh-dark);
    color: var(--smh-gold);
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    padding: 0.6rem 1rem;
    letter-spacing: 0.05em;
}

.smh-infobox .infobox-img {
    width: 100%;
    max-height: 280px;
    object-fit: cover;
    object-position: top;
}

.smh-infobox .infobox-section-title {
    background: var(--smh-parchment-dk);
    border-top: 1px solid var(--smh-border);
    border-bottom: 1px solid var(--smh-border);
    color: var(--smh-brown);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.35rem 0.75rem;
    margin: 0;
}

.smh-infobox table {
    width: 100%;
    font-size: 0.85rem;
    margin: 0;
}

.smh-infobox table td {
    padding: 0.3rem 0.75rem;
    vertical-align: top;
    border-bottom: 1px solid #f0ead8;
}

.smh-infobox table td:first-child {
    font-weight: 600;
    color: var(--smh-muted);
    white-space: nowrap;
    width: 40%;
}

.smh-infobox .infobox-list {
    list-style: none;
    padding: 0.4rem 0.75rem;
    margin: 0;
    font-size: 0.85rem;
}

.smh-infobox .infobox-list li {
    padding: 0.15rem 0;
    border-bottom: 1px dotted #ddd;
    color: var(--smh-text);
}

.smh-infobox .infobox-list li:last-child {
    border-bottom: none;
}

.smh-rajira-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 700;
}

.smh-rajira-yes {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.smh-rajira-no {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* --- Character page main content --- */
.smh-char-header {
    border-bottom: 2px solid var(--smh-gold);
    padding-bottom: 0.75rem;
    margin-bottom: 1.5rem;
}

.smh-char-header h1 {
    font-family: 'Cinzel', serif;
    color: var(--smh-brown);
    font-size: 2rem;
    margin-bottom: 0.25rem;
}

.smh-char-header .char-subtitle {
    color: var(--smh-muted);
    font-style: italic;
    font-size: 0.95rem;
}

.smh-book-entry {
    margin-bottom: 2rem;
}

.smh-book-entry h2 {
    font-family: 'Cinzel', serif;
    font-size: 1.15rem;
    color: var(--smh-brown);
    border-left: 4px solid var(--smh-gold);
    padding-left: 0.75rem;
    margin-bottom: 0.75rem;
}

.smh-book-entry p {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--smh-text);
}

/* --- Books page --- */
.smh-book-card {
    background: white;
    border: 1px solid var(--smh-border);
    border-left: 5px solid var(--smh-gold);
    border-radius: 4px;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.smh-book-card .book-number {
    font-family: 'Cinzel', serif;
    font-size: 0.75rem;
    color: var(--smh-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.smh-book-card .book-title {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    color: var(--smh-brown);
    font-weight: 700;
    margin: 0.1rem 0 0.25rem;
}

.smh-book-card .book-meta {
    font-size: 0.83rem;
    color: var(--smh-muted);
}

.smh-series-heading {
    font-family: 'Cinzel', serif;
    color: var(--smh-gold);
    background: var(--smh-dark);
    padding: 0.6rem 1.25rem;
    border-radius: 4px;
    margin: 1.75rem 0 1rem;
    font-size: 1.1rem;
    letter-spacing: 0.05em;
}

/* --- Sidebar widgets --- */
.smh-sidebar-widget {
    background: white;
    border: 1px solid var(--smh-border);
    border-radius: 4px;
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.smh-sidebar-widget .widget-title {
    background: var(--smh-dark);
    color: var(--smh-gold);
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    font-weight: 700;
    padding: 0.5rem 0.9rem;
    letter-spacing: 0.05em;
}

.smh-sidebar-widget .widget-body {
    padding: 0.75rem 0.9rem;
}

.smh-char-list-item {
    display: block;
    padding: 0.3rem 0.5rem;
    font-size: 0.88rem;
    color: var(--smh-text);
    text-decoration: none;
    border-bottom: 1px solid var(--smh-parchment-dk);
    transition: background 0.1s;
}

.smh-char-list-item:hover {
    background: var(--smh-parchment-dk);
    color: var(--smh-brown);
}

.smh-char-list-item:last-child {
    border-bottom: none;
}

/* --- Search bar --- */
.smh-search-wrap {
    padding: 0.75rem 0.9rem;
}

.smh-search-wrap .form-control {
    border-color: var(--smh-border);
    background: var(--smh-parchment);
    font-size: 0.9rem;
}

.smh-search-wrap .btn-search {
    background: var(--smh-brown);
    border-color: var(--smh-brown);
    color: white;
}

.smh-search-wrap .btn-search:hover {
    background: var(--smh-dark);
    border-color: var(--smh-dark);
}

/* --- Footer --- */
.smh-footer {
    background: var(--smh-darker);
    border-top: 2px solid var(--smh-gold);
    padding: 2rem 0;
    color: #a09070;
    text-align: center;
    font-size: 0.88rem;
}

.smh-footer a {
    color: var(--smh-gold);
    text-decoration: none;
}

.smh-footer a:hover {
    color: var(--smh-gold-light);
}

/* --- Alert / Notice --- */
.smh-alert-not-found {
    background: #fef3cd;
    border: 1px solid #ffc107;
    border-left: 5px solid #ffc107;
    border-radius: 4px;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    color: #664d03;
    margin-bottom: 1.25rem;
}

/* --- Alphabetical filter bar (characters page) --- */
.smh-alpha-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 1.25rem;
}

.smh-alpha-bar .alpha-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    background: white;
    border: 1px solid var(--smh-border);
    border-radius: 3px;
    color: var(--smh-brown);
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
}

.smh-alpha-bar .alpha-btn:hover,
.smh-alpha-bar .alpha-btn.active {
    background: var(--smh-dark);
    color: var(--smh-gold);
    border-color: var(--smh-dark);
}

/* --- Search filter input (characters page) --- */
.smh-filter-input {
    border: 1px solid var(--smh-border);
    background: var(--smh-parchment);
    border-radius: 4px;
    padding: 0.5rem 0.9rem;
    font-size: 0.95rem;
    width: 100%;
    margin-bottom: 1.25rem;
    outline: none;
    color: var(--smh-text);
}

.smh-filter-input:focus {
    border-color: var(--smh-gold);
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.2);
}

/* =====================================================
   "Get the Books" CTA button (navbar)
   ===================================================== */

a.smh-buy-btn {
    display: inline-block;
    background: var(--smh-gold);
    color: var(--smh-darker) !important;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0.4rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    letter-spacing: 0.03em;
    border: 2px solid var(--smh-gold);
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

a.smh-buy-btn:hover {
    background: transparent;
    color: var(--smh-gold) !important;
    border-color: var(--smh-gold);
}

/* Mobile: full-width pill under the nav links */
@media (max-width: 991px) {
    a.smh-buy-btn {
        display: block;
        text-align: center;
        margin: 0.5rem 0;
    }
}

/* ── "Buy the Books" sidebar widget ── */
.smh-buy-widget {
    background: var(--smh-dark);
    border: 2px solid var(--smh-gold);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 1.25rem;
}

.smh-buy-widget .bw-header {
    background: var(--smh-gold);
    color: var(--smh-darker);
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    font-weight: 700;
    padding: 0.5rem 0.9rem;
    letter-spacing: 0.05em;
}

.smh-buy-widget .bw-body {
    padding: 0.85rem 0.9rem;
    color: #c8b89a;
    font-size: 0.85rem;
    line-height: 1.55;
}

.smh-buy-widget .bw-body p {
    margin-bottom: 0.65rem;
}

.smh-buy-widget .bw-link {
    display: block;
    background: var(--smh-gold);
    color: var(--smh-darker);
    font-weight: 700;
    font-size: 0.88rem;
    text-align: center;
    padding: 0.5rem;
    border-radius: 4px;
    text-decoration: none;
    letter-spacing: 0.03em;
    transition: background 0.15s;
    margin-top: 0.5rem;
}

.smh-buy-widget .bw-link:hover {
    background: var(--smh-gold-light);
    color: var(--smh-darker);
}

/* =====================================================
   Book Timeline Slider
   ===================================================== */

/* Sticky bar containing the slider */
.smh-timeline-bar {
    position: sticky;
    top: 0;
    z-index: 200;
    background: var(--smh-darker);
    border-bottom: 2px solid var(--smh-gold);
    padding: 0.65rem 0 0.75rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}

.tl-header {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.55rem;
}

.tl-reading-label {
    font-size: 0.78rem;
    color: #a09070;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
}

.tl-book-name {
    font-family: 'Cinzel', serif;
    color: var(--smh-gold);
    font-size: 0.95rem;
    font-weight: 700;
}

.tl-hint {
    font-size: 0.72rem;
    color: #6b5c3a;
    font-style: italic;
    margin-left: auto;
}

/* The range input */
.tl-range-wrap {
    position: relative;
}

input.tl-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    background: linear-gradient(
        to right,
        var(--smh-gold) 0%,
        var(--smh-gold) var(--tl-pct, 0%),
        #3a2810 var(--tl-pct, 0%),
        #3a2810 100%
    );
    margin-bottom: 0.5rem;
}

input.tl-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--smh-gold);
    cursor: grab;
    border: 3px solid var(--smh-darker);
    box-shadow: 0 0 8px rgba(201, 168, 76, 0.7), 0 0 0 2px var(--smh-gold);
    transition: transform 0.1s, box-shadow 0.1s;
}

input.tl-range::-webkit-slider-thumb:active {
    cursor: grabbing;
    transform: scale(1.2);
}

input.tl-range::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--smh-gold);
    cursor: grab;
    border: 3px solid var(--smh-darker);
    box-shadow: 0 0 8px rgba(201, 168, 76, 0.7);
}

/* Tick marks + labels row */
.tl-ticks {
    display: flex;
    justify-content: space-between;
    position: relative;
}

.tl-tick {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 0;
    overflow: visible;
    cursor: pointer;
}

.tl-tick-mark {
    width: 2px;
    height: 6px;
    background: #5a4a2a;
    margin-bottom: 2px;
    border-radius: 1px;
    transition: background 0.2s, height 0.2s;
}

.tl-tick.tl-tick-active .tl-tick-mark {
    background: var(--smh-gold);
    height: 9px;
}

.tl-tick.tl-tick-has-content .tl-tick-mark {
    background: #c9a84c;
    width: 3px;
}

.tl-tick-label {
    font-size: 0.6rem;
    color: #5a4a2a;
    white-space: nowrap;
    text-align: center;
    transform: rotate(-35deg) translateX(-4px);
    transform-origin: top center;
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s;
    /* Only show every few labels on small screens */
}

.tl-tick.tl-tick-active .tl-tick-label {
    color: var(--smh-gold);
}

/* Content sections */
.smh-book-entry {
    transition: opacity 0.35s ease;
}

.smh-book-entry.tl-hidden {
    display: none;
}

/* Spoiler lock banner between revealed and hidden content */
.tl-spoiler-gate {
    display: none;
    text-align: center;
    padding: 1.5rem;
    border: 2px dashed var(--smh-border);
    border-radius: 6px;
    margin: 1.5rem 0;
    background: rgba(201, 168, 76, 0.05);
}

.tl-spoiler-gate.tl-visible {
    display: block;
}

.tl-spoiler-gate p {
    margin: 0;
    color: var(--smh-muted);
    font-style: italic;
    font-size: 0.9rem;
}

.tl-spoiler-gate .tl-spoiler-icon {
    font-size: 1.8rem;
    display: block;
    margin-bottom: 0.4rem;
}

/* Infobox row transitions */
.smh-infobox tr[data-infobox-row] {
    transition: opacity 0.3s ease;
}

.smh-infobox tr[data-infobox-row].tl-row-hidden {
    display: none;
}

/* "Appears in" book dots on timeline */
.tl-tick.tl-tick-has-content .tl-tick-mark::after {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    background: var(--smh-gold);
    border-radius: 50%;
    position: relative;
    top: -8px;
    left: -2px;
}

/* =====================================================
   Responsive adjustments
   ===================================================== */
/* --- Responsive adjustments --- */
@media (max-width: 768px) {
    .smh-hero h1 {
        font-size: 2rem;
    }
    .smh-stat-tile .stat-number {
        font-size: 1.7rem;
    }
}
