
/* Add specific styling for category description elements */
.lore-meta a, .category-card p a {
    color: var(--color-gold);
    text-decoration: underline;
    transition: all 0.2s ease-in-out;
}

.lore-meta a:hover, .category-card p a:hover {
    color: #fff;
    text-decoration: underline;
}

.lore-meta p, .category-card p p {
    margin-bottom: 1em;
}

.lore-meta strong, .lore-meta b, .category-card p strong, .category-card p b {
    color: var(--color-gold);
    font-weight: bold;
}

.lore-meta em, .lore-meta i, .category-card p em, .category-card p i {
    font-style: italic;
}

.featured-image {
    max-width: 75%;
    width: 75%;
    height: auto;
    max-height: 500px;
    object-fit: contain;
    object-position: top right;
    border-radius: 8px;
    margin: 0 0 20px 20px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    float: right;
}

.lore-content-text {
    line-height: 1.7;
    font-size: 1.1rem;
}

.lore-content-text::after {
    content: "";
    display: table;
    clear: both;
}

.lore-content-text p {
    margin-bottom: 1.5em;
}

.lore-content-text img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 20px 0;
}

.lore-nav-category {
    font-family: 'Cinzel', serif;
    color: var(--color-gold);
    margin: 20px 0 10px;
    font-weight: bold;
    border-bottom: 1px solid var(--color-purple-light);
    padding-bottom: 5px;
}

/* Special h2 heading without bottom border */
h2.no-border {
    font-family: 'Cinzel', serif;
    color: var(--color-gold);
    margin: 30px 0 20px;
    border-bottom: none;
}

.lore-search {
    margin-bottom: 20px;
}

.lore-search input {
    width: 100%;
    padding: 8px 10px;
    background: rgba(30, 20, 50, 0.7);
    border: 1px solid var(--color-purple-light);
    border-radius: 4px;
    color: var(--color-text);
}

.lore-search button {
    margin-top: 10px;
    width: 100%;
    padding: 8px;
    background: linear-gradient(135deg, var(--color-purple-dark), var(--color-purple-light));
    border: 1px solid var(--color-gold);
    border-radius: 4px;
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.3s ease;
}

.lore-search button:hover {
    background: var(--color-purple-light);
}

.category-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.category-card {
    background: rgba(30, 20, 50, 0.5);
    border-radius: 8px;
    border: 1px solid var(--color-purple-light);
    padding: 20px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.category-card h3 {
    font-family: 'Cinzel', serif;
    color: var(--color-gold);
    margin-bottom: 10px;
}

.category-card p {
    color: var(--color-text-muted);
    font-family: Verdana, sans-serif;
    font-size: 16px;
    margin-bottom: 15px;
    flex-grow: 1;
}

/* Preserve line breaks and formatting in category descriptions */
.category-card p, .lore-meta {
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.6;
}

.category-card:hover {
    box-shadow: 0 0 15px rgba(76, 47, 117, 0.5);
    transform: translateY(-5px);
}

.category-card h3 a {
    color: var(--color-gold);
    text-decoration: none;
    transition: all 0.3s ease;
}

.category-card h3 a:hover {
    color: var(--color-text);
}

.entry-list {
    list-style: none;
    padding: 0;
}

.entry-list li {
    margin-bottom: 8px;
}

.entry-list a {
    color: var(--color-text);
    text-decoration: none;
    display: block;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.entry-list a:hover {
    background: rgba(46, 34, 80, 0.6);
    color: var(--color-gold);
}

.entry-card {
    background: rgba(30, 20, 50, 0.5);
    border-radius: 8px;
    border: 1px solid var(--color-purple-light);
    padding: 20px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.entry-card:hover {
    box-shadow: 0 0 15px rgba(76, 47, 117, 0.5);
}

.entry-card h3 {
    font-family: 'Cinzel', serif;
    color: var(--color-gold);
    margin-bottom: 10px;
}

.entry-card h3 a {
    color: var(--color-gold);
    text-decoration: none;
    transition: all 0.3s ease;
}

.entry-card h3 a:hover {
    color: var(--color-text);
}

.entry-card-content {
    color: var(--color-text);
    margin-bottom: 15px;
    max-height: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
}

.entry-card-meta {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid rgba(76, 47, 117, 0.3);
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.related-entries {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--color-purple-light);
}

.related-entries h3 {
    font-family: 'Cinzel', serif;
    color: var(--color-gold);
    margin-bottom: 15px;
}

.related-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}
/* Category navigation */
.category-children {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.category-parent {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dropdown-icon {
    font-size: 0.7rem;
    transition: transform 0.3s ease;
}

.category-parent.expanded .dropdown-icon {
    transform: rotate(180deg);
}

.category-children ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-children li {
    margin-bottom: 0;
}

.category-children a {
    padding-left: 20px;
    font-size: 0.95rem;
}

/* Parent and child category visual distinction */
.category-parent {
    font-weight: 600;
    color: var(--color-gold);
}

/* Base styling for all child categories */
.category-children a {
    color: var(--color-text-muted);
    font-size: 0.92rem;
}

/* Progressive indentation for parent categories */
.nested-level-0 > a {
    padding-left: 10px;
}

.nested-level-1 > a {
    padding-left: 25px;
}

.nested-level-2 > a {
    padding-left: 40px;
}

.nested-level-3 > a {
    padding-left: 55px;
}

/* Progressive indentation for nested levels */
.nested-level-0 .category-children a {
    border-left: 2px solid var(--color-purple-light);
    margin-left: 10px;
    padding-left: 15px !important;
}

.nested-level-1 .category-children a {
    border-left: 2px solid var(--color-purple-light);
    margin-left: 15px;
    padding-left: 25px !important;
}

.nested-level-2 .category-children a {
    border-left: 2px solid var(--color-purple-light);
    margin-left: 20px;
    padding-left: 35px !important;
}

.nested-level-3 .category-children a {
    border-left: 2px solid var(--color-purple-light);
    margin-left: 25px;
    padding-left: 45px !important;
}

.category-children a:hover, 
.category-children a.active {
    color: var(--color-text);
    background: rgba(46, 34, 80, 0.4);
}

/* Make sure all content has consistent font styling */
.lore-content-text {
    line-height: 1.7;
    font-family: Verdana, sans-serif !important;
    font-size: 16px !important;
}

.lore-content-text *:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6) {
    font-family: Verdana, sans-serif !important;
    font-size: 16px !important;
}

.lore-content-text p, 
.lore-content-text span, 
.lore-content-text div, 
.lore-content-text li, 
.lore-content-text td {
    font-family: Verdana, sans-serif !important;
    font-size: 16px !important;
    margin-bottom: 1.5em;
}

.lore-content-text h1, 
.lore-content-text h2, 
.lore-content-text h3, 
.lore-content-text h4, 
.lore-content-text h5, 
.lore-content-text h6 {
    font-family: 'Cinzel', serif !important; /* Keep headers in Cinzel */
}

.lore-content-text img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 20px 0;
}

.entry-featured-image {
    position: relative;
    margin: -20px -20px 15px -20px;
    border-radius: 8px 8px 0 0;
    background: rgba(15, 10, 26, 0.5);
    overflow: hidden;
    /* Fixed 16:9 aspect ratio */
    padding-bottom: 56.25%; 
    height: 0;
}

.entry-featured-image a {
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    cursor: pointer;
}

.entry-featured-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Use cover to fill the space but prioritize showing the top of the image */
    object-fit: cover;
    object-position: center top;
    transition: transform 0.3s ease;
}

.category-card:hover .entry-featured-image img {
    transform: scale(1.05);
}


/* Add rotate-border animation for rainbow effects */
@keyframes rotate-border {
    0% {
        background-position: 0% 0%;
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
    }
    25% {
        box-shadow: 0 0 15px rgba(138, 43, 226, 0.3);
    }
    50% {
        background-position: 100% 100%;
        box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
    }
    75% {
        box-shadow: 0 0 15px rgba(0, 255, 0, 0.3);
    }
    100% {
        background-position: 0% 0%;
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
    }
}

.chat-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 45px;
    height: 45px;
    background: rgba(15, 10, 26, 0.9);
    border-radius: 50%;
    border: 2px solid var(--color-gold);
    cursor: pointer;
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.3), 0 0 25px rgba(74, 43, 124, 0.4);
    opacity: 0.95;
    transform: scale(1);
    transition: all 0.3s ease;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}



.chat-frame-container {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 500px;
    background: rgba(15, 10, 26, 0.9);
    border-radius: 12px;
    border: 2px solid var(--color-gold);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    z-index: 99;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    transform-origin: bottom right;
    transition: opacity 0.4s ease, transform 0.4s ease;
    pointer-events: none;
}

.chat-frame-container.visible {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: all;
}

.chat-frame {
    width: 100%;
    height: 100%;
    border: none;
}

/* Responsive styles for chat container */
@media (max-width: 768px) {
    .chat-frame-container {
        width: 320px;
        height: 450px;
        bottom: 80px;
    }
}

@media (max-width: 480px) {
    .chat-frame-container {
        width: calc(100% - 60px);
        height: 400px;
        right: 20px;
        bottom: 80px;
    }
    
    .scroll-top, .chat-button {
        width: 45px;
        height: 45px;
        right: 20px;
    }
    
    .chat-button {
        bottom: 30px;
    }
    
    .scroll-top {
        bottom: 90px;
    }
}

/* Speech bubble styles */
.speech-bubble {
    position: fixed;
    bottom: 90px;
    right: 50px;
    background: linear-gradient(135deg, var(--color-purple-dark), var(--color-purple-light));
    color: var(--color-gold);
    border: 3px solid transparent;
    border-radius: 20px;
    padding: 10px 16px;
    font-family: 'MedievalSharp', cursive;
    font-size: 0.9rem;
    max-width: 200px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    transform-origin: bottom right;
    transition: opacity 0.4s ease, transform 0.4s ease;
    pointer-events: none;
    z-index: 98;
    white-space: normal;
    text-align: center;
    background-origin: padding-box;
    background-clip: padding-box;
    background: 
        linear-gradient(to right, var(--color-purple-dark), var(--color-purple-light)) padding-box,
        linear-gradient(135deg, 
            gold 0%, 
            purple 25%,
            cyan 50%, 
            lime 75%, 
            gold 100%) border-box;
    animation: rotate-border 6s linear infinite;
}

.speech-bubble:after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 24px;
    border-width: 10px 10px 0;
    border-style: solid;
    border-color: var(--color-purple-light) transparent;
    display: block;
    width: 0;
}

.speech-bubble:before {
    content: '';
    position: absolute;
    bottom: -13px;
    right: 22px;
    border-width: 12px 12px 0;
    border-style: solid;
    border-color: gold transparent;
    display: block;
    width: 0;
    z-index: -1;
}

.speech-bubble.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Mobile styles for speech bubbles */
@media (max-width: 768px) {
    .speech-bubble {
        max-width: 160px;
        font-size: 0.8rem;
        right: 40px;
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    .speech-bubble {
        max-width: 140px;
        font-size: 0.75rem;
        right: 25px;
        bottom: 85px;
    }
}

@keyframes rotate-border {
    0% {
        background-position: 0% 0%;
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
    }
    25% {
        box-shadow: 0 0 15px rgba(138, 43, 226, 0.3);
    }
    50% {
        background-position: 100% 100%;
        box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
    }
    75% {
        box-shadow: 0 0 15px rgba(0, 255, 0, 0.3);
    }
    100% {
        background-position: 0% 0%;
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
    }
}

@keyframes shimmer {
    0% {
        filter: brightness(1) saturate(1);
        transform: scale(1);
    }
    25% {
        filter: brightness(1.3) saturate(1.1);
        transform: scale(1.02);
    }
    50% {
        filter: brightness(1.1) saturate(1.2);
        transform: scale(1);
    }
    75% {
        filter: brightness(1.2) saturate(1.1);
        transform: scale(1.03);
    }
    100% {
        filter: brightness(1) saturate(1);
        transform: scale(1);
    }
}

/* Form elements styling - specifically for Safari compatibility */
input[type="text"],
input[type="search"],
input[type="email"],
input[type="password"],
textarea,
select {
    font-size: 16px !important; /* Prevent auto-zoom on mobile and ensure consistent sizing in Safari */
    -webkit-appearance: none; /* Remove Safari's default styling */
    -moz-appearance: none;
    appearance: none;
    border-radius: 4px;
    font-family: Verdana, sans-serif;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* Styles for timeline event cards on lore entry pages */
.related-timeline-event,
.related-timeline-events {
    margin-top: 30px;
    padding: 20px;
    background: rgba(15, 10, 26, 0.8);
    border-radius: 10px;
    border: 2px solid var(--color-gold);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
}

.related-timeline-event h3,
.related-timeline-events h3 {
    font-family: 'Cinzel', serif;
    color: var(--color-gold);
    margin-top: 0;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.5rem;
}

.timeline-events-list {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
}

.timeline-event-card {
    background: linear-gradient(135deg, var(--color-purple-dark), var(--color-purple-light));
    border: 1px solid var(--color-purple-light);
    border-radius: 8px;
    padding: 15px;
    transition: all 0.3s ease;
    max-width: 300px;
    flex: 1 1 300px;
}

.timeline-event-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
    border-color: var(--color-gold);
}

.timeline-event-card h4 {
    font-family: var(--font-medieval);
    font-size: 1.2rem;
    color: var(--color-gold);
    margin-top: 0;
    margin-bottom: 10px;
}

.timeline-event-details {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.timeline-event-era {
    font-size: 0.9rem;
    color: var(--color-gold);
    background: rgba(15, 10, 26, 0.5);
    padding: 3px 8px;
    border-radius: 4px;
}

.timeline-event-year {
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.timeline-event-description {
    font-size: 0.95rem;
    margin-bottom: 15px;
}

.view-timeline-event {
    display: inline-block;
    background: rgba(15, 10, 26, 0.8);
    border: 1px solid var(--color-gold);
    color: var(--color-gold);
    padding: 5px 10px;
    border-radius: 5px;
    text-decoration: none;
    transition: all 0.3s ease;
    font-family: var(--font-medieval);
    font-size: 0.9rem;
}

.view-timeline-event:hover {
    background: var(--color-gold);
    color: var(--color-background);
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
}