/* CSS Variables for Theme */
:root {
    /* Dark wood and metal tones */
    --bg-primary: #0d0907;
    --bg-secondary: #1a1210;
    --bg-tertiary: #2a1f1a;
    --bg-wood: #3e2723;
    
    /* Text colors */
    --text-primary: #e8dcc0;
    --text-secondary: #c0a878;
    
    /* Brass and copper accents */
    --brass: #b8860b;
    --brass-light: #daa520;
    --brass-dark: #8b6508;
    --copper: #b87333;
    --copper-patina: #4d7c7b;
    
    /* Ocean and magic colors */
    --ocean-blue: #77b0d8;
    --ocean-deep: #164058;
    --magic-purple: #a27bfc;
    --magic-pink: #c13b9a;
    
    /* Effects */
    --glow-brass: 0 0 10px rgba(184, 134, 11, 0.4);
    --glow-ocean: 0 0 10px rgba(30, 95, 142, 0.3);
    --text-shadow-brass: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Hide JS-enhanced elements until ready to prevent FOUC */
.js-enabled .system-sidebar,
.js-enabled .system-menu-toggle {
    visibility: hidden;
}

ul {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

li {
    list-style: none;
}

a {
    color: var(--ocean-blue);
    font-weight: bold;
    transition-duration: .5s;
}

a:hover {
    color: white;
}

h1 > a, h2 > a, h3 > a, h4 > a {
    color: var(--brass-light);
        text-shadow: 
            var(--text-shadow-brass),
            0 0 30px var(--ocean-blue),
            0 0 10px var(--ocean-blue);
    text-decoration: none;
}

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    background-image: 
        url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><rect width="100" height="100" fill="%23000000" opacity="0.03"/><circle cx="50" cy="50" r="40" fill="none" stroke="%23b8860b" stroke-width="0.1" opacity="0.1"/></svg>'),
        linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, var(--bg-primary) 100%);
    background-size: 200px 200px, cover;
}

/* Victorian-style ornamental border */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 20px solid transparent;
    border-image: linear-gradient(45deg, var(--brass-dark), var(--brass), var(--brass-light), var(--brass)) 1;
    pointer-events: none;
    z-index: 10;
    opacity: 0.3;
    view-transition-name: page-border;
}

/* Header Styles */
header {
    background: linear-gradient(180deg, var(--bg-wood) 0%, var(--bg-tertiary) 100%);
    border-bottom: 4px solid var(--brass);
    box-shadow: 
        inset 0 -1px 0 var(--brass-light),
        0 4px 10px rgba(0, 0, 0, 0.7);
    position: relative;
    overflow: hidden;
}

/* Atlas Link in Header */
.atlas-link-header {
    position: absolute;
    top: 2rem;
    right: 2rem;
    z-index: 2;
}

.atlas-link-header a {
    display: flex;
    align-items: center;
    gap: .75rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--brass-dark);
    transition: all 0.3s ease;
    letter-spacing: 0.05em;
}

.atlas-link-header a::before {
    content: '📜';
    font-size: 1.1rem;
    opacity: 0.7;
}

.atlas-link-header a:hover {
    background: rgba(0, 0, 0, 0.5);
    border-color: var(--brass);
    color: var(--brass-light);
    box-shadow: 0 0 10px rgba(184, 134, 11, 0.3);
}

.atlas-link-header a:hover::before {
    opacity: 1;
}

/* Gear decoration */
header::before,
header::after {
    /*
Gear vector by <a href="https://github.com/nagoshiashumari/Rpg-Awesome?ref=svgrepo.com" target="_blank">Nagoshiashumari</a> in GPL License via <a href="https://www.svgrepo.com/" target="_blank">SVG Repo</a>
    */
    content: url("/angrea/images/gear-hammer.svg");
    position: absolute;
    opacity: 0.2;
}

header::before {
    animation: rotate-gear 60s linear infinite;
}

header::after {
    bottom: -125px;
    right: -75px;
    filter: hue-rotate(100deg);
    animation: rotate-gear 60s linear infinite reverse;
}

@media (max-width: 1390px) {
    
    header::before {
        top: 0;
        left: -500px;
    }

    header::after {
        bottom: 0;
        right: -500px;
    }
}

@keyframes rotate-gear {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.header-content {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem;
    text-align: center;
    z-index: 1;
}

h1, h2, h3, h4, h5 {
    color: var(--brass-light);
}

.subh1, .subh2, .subh3, .subh4, .subh5 {
    color: var(--ocean-blue);
    font-weight: bold;
    font-style: italic;
}

h1 {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-family: 'Georgia', serif;
    font-weight: normal;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 1rem;
    color: var(--brass-light);
    text-shadow: 
        var(--text-shadow-brass),
        0 0 30px var(--brass);
    animation: brass-glow 4s ease-in-out infinite alternate;
}

@keyframes brass-glow {
    from { 
        text-shadow: 
            var(--text-shadow-brass),
            0 0 30px var(--brass);
    }
    to { 
        text-shadow: 
            var(--text-shadow-brass),
            0 0 30px var(--ocean-blue),
            0 0 10px var(--ocean-blue);
    }
}

.tagline {
    font-size: 1.3rem;
    color: var(--text-secondary);
    font-style: italic;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    letter-spacing: 0.05em;
}

.tagline span {
    color: var(--ocean-blue);
    font-weight: bold;
}

/* Navigation Styles */
nav {
    background: var(--bg-wood);
    border-bottom: 2px solid var(--brass-dark);
    border-top: 1px solid var(--brass);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 
        0 2px 5px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 var(--brass-dark);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.nav-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 3rem;
    padding: 1.2rem 0;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-family: 'Georgia', serif;
    position: relative;
    transition: all 0.3s ease;
    padding: 0.5rem 0;
}

.nav-link::before,
.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    background: var(--brass);
    transition: width 0.3s ease;
}

.nav-link::before {
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
}

.nav-link:hover {
    color: var(--brass-light);
    text-shadow: 0 0 10px var(--brass);
}

.nav-link:hover::before {
    width: 100%;
    left: 0;
    transform: translateX(0);
}

.nav-link.active {
    color: var(--brass-light);
    text-shadow: var(--text-shadow-brass);
}

.nav-link.active::after {
    content: '◆';
    position: absolute;
    top: -15px;
    left: 40%;
    color: var(--brass);
    font-size: 0.8rem;
}

/* Main Content */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

/* Ornate Section Styling */
.content-section {
    background: var(--bg-secondary);
    border: 2px solid var(--brass-dark);
    border-radius: 0;
    padding: 2.5rem;
    margin-bottom: 2rem;
    position: relative;
    box-shadow: 
        inset 0 0 0 1px var(--brass),
        0 4px 8px rgba(0, 0, 0, 0.6);
}

.content-section > p {
    font-size: 1.15rem;
    padding: 2rem 2rem;
    padding-top: 0;
}

/* Corner ornaments */
.content-section::before,
.content-section::after {
    content: '❦';
    position: absolute;
    font-size: 1.5rem;
    color: var(--brass);
    text-shadow: var(--text-shadow-brass);
}

.content-section::before {
    top: 0.5rem;
    left: 0.5rem;
}

.content-section::after {
    bottom: 0.5rem;
    right: 0.5rem;
    transform: rotate(180deg);
}

.content-section h2 {
    font-size: 2.2rem;
    font-family: 'Georgia', serif;
    margin-bottom: 1.5rem;
    color: var(--brass-light);
    text-shadow: var(--text-shadow-brass);
    text-align: center;
    position: relative;
    padding-bottom: 1rem;
}

/* Decorative underline */
.content-section h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 150px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--brass), transparent);
}

.content-section h3 {
    font-size: 1.8rem;
    font-family: 'Georgia', serif;
    margin: 2rem 0 1rem;
    color: var(--brass);
    text-shadow: var(--text-shadow-brass);
}

.intro-text {
    line-height: 1.9;
    color: var(--text-primary);
    text-align: balance;
}

strong {
    color: var(--ocean-blue);
    font-weight: bold;
    text-shadow: 0 0 10px var(--ocean-deep);
}

/* Feature Grid */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2.5rem;
}

.content-section > .feature-card {
    margin: 1.25rem 0;
}

.feature-card {
    background: var(--bg-wood);
    border: 2px solid var(--brass-dark);
    padding: 2rem;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 
        inset 0 0 0 1px var(--brass),
        0 2px 5px rgba(0, 0, 0, 0.5);
}

.feature-card::before {
    content: '⚙';
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    color: var(--brass-dark);
    opacity: 0.3;
    font-size: 1.2rem;
}

.feature-card:hover {
    transform: translateY(-3px);
    box-shadow: 
        inset 0 0 0 1px var(--brass-light),
        0 5px 15px rgba(184, 134, 11, 0.3),
        var(--glow-brass);
}

.feature-card h4 {
    color: var(--brass-light);
    margin-bottom: 0.8rem;
    font-size: 1.3rem;
    font-family: 'Georgia', serif;
    text-shadow: var(--text-shadow-brass);
}

.feature-card p {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Victorian divider */
.ornate-divider {
    text-align: center;
    margin: 3rem 0;
    color: var(--brass);
    font-size: 1.5rem;
    text-shadow: var(--text-shadow-brass);
    letter-spacing: 0.5em;
}

/* Call to action */
.cta-section {
    text-align: center;
    margin-top: 3rem;
    padding: 2rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--brass-dark);
    box-shadow: inset 0 0 20px rgba(184, 134, 11, 0.1);
}

.cta-text {
    font-size: 1.3rem;
    color: var(--brass-light);
    font-style: italic;
    margin-bottom: 2rem;
    text-shadow: var(--text-shadow-brass);
}

.explore-button {
    display: inline-block;
    margin-top: 1.5rem;
    padding: 1rem 2.5rem;
    background: linear-gradient(135deg, var(--brass-dark), var(--brass));
    color: var(--bg-primary);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border: 2px solid var(--brass-light);
    box-shadow: 
        inset 0 1px 0 var(--brass-light),
        0 4px 8px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.explore-button:hover {
    transform: translateY(-2px);
    box-shadow: 
        inset 0 1px 0 var(--brass-light),
        0 6px 12px rgba(0, 0, 0, 0.6),
        var(--glow-brass);
}

/* Atlas Portal Styles */
.atlas-portal {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--brass-dark);
}

.atlas-text {
    font-size: 1rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 1rem;
}

.atlas-button {
    display: inline-block;
    padding: 0.8rem 2rem;
    background: var(--bg-tertiary);
    color: var(--brass);
    text-decoration: none;
    font-size: 1rem;
    letter-spacing: 0.05em;
    border: 1px solid var(--brass-dark);
    transition: all 0.3s ease;
    position: relative;
}

.atlas-button::before {
    content: '📜';
    position: absolute;
    left: 0.8rem;
    opacity: 0.5;
}

.atlas-button:hover {
    background: var(--bg-wood);
    border-color: var(--brass);
    box-shadow: 
        0 2px 5px rgba(0, 0, 0, 0.4),
        inset 0 0 10px rgba(184, 134, 11, 0.2);
    transform: translateY(-1px);
}

/* Atlas-specific navigation */
.atlas-nav {
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--brass-dark);
    padding: 1rem 0;
    margin-bottom: 2rem;
}

.atlas-nav-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.atlas-breadcrumb {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.atlas-breadcrumb a {
    color: var(--brass);
    text-decoration: none;
    transition: color 0.3s ease;
}

.atlas-breadcrumb a:hover {
    color: var(--brass-light);
    text-shadow: 0 0 5px var(--brass);
}

.atlas-search {
    display: flex;
    gap: 0.5rem;
}

.atlas-search input {
    background: var(--bg-secondary);
    border: 1px solid var(--brass-dark);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    font-family: inherit;
    font-size: 0.9rem;
    width: 200px;
    transition: all 0.3s ease;
}

.atlas-search input:focus {
    outline: none;
    border-color: var(--brass);
    box-shadow: 0 0 5px rgba(184, 134, 11, 0.3);
}

.atlas-search button {
    background: var(--brass-dark);
    border: 1px solid var(--brass);
    color: var(--bg-primary);
    padding: 0.5rem 1rem;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.atlas-search button:hover {
    background: var(--brass);
    box-shadow: 0 0 5px var(--brass);
}

/* Atlas sidebar */
.atlas-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.atlas-sidebar {
    background: var(--bg-secondary);
    border: 1px solid var(--brass-dark);
    padding: 1.5rem;
    height: fit-content;
    position: sticky;
    top: 20px;
}

.atlas-sidebar h3 {
    color: var(--brass);
    font-size: 1.2rem;
    margin-bottom: 1rem;
    text-shadow: var(--text-shadow-brass);
}

.atlas-sidebar ul {
    list-style: none;
    padding: 0;
}

.atlas-sidebar li {
    margin-bottom: 0.5rem;
}

.atlas-sidebar a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    display: block;
    padding: 0.3rem 0;
}

.atlas-sidebar a:hover {
    color: var(--brass-light);
    padding-left: 0.5rem;
}

.atlas-sidebar a.active {
    color: var(--brass-light);
    border-left: 2px solid var(--brass);
    padding-left: 0.5rem;
}

/* Atlas content area */
.atlas-content {
    min-height: 80vh;
}

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

.card-item {
    display: flow-root;
    background: var(--bg-wood);
    border: 1px solid var(--brass-dark);
    border-left: 4px solid var(--ocean-blue);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.card-item:hover {
    transform: translateX(5px);
    border-left-color: var(--brass-light);
    box-shadow: 
        0 3px 8px rgba(0, 0, 0, 0.4),
        var(--glow-brass);
}

.card-item h4 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    text-shadow: var(--text-shadow-brass);
}

.card-item .subh4 {
    color: var(--ocean-blue);
    font-size: 0.9rem;
    font-style: italic;
    display: block;
    margin-bottom: 0.5rem;
}

.card-item p {
    color: var(--text-secondary);
    line-height: 1.7;
}

.card-item > *:not(:last-child) {
    margin-bottom: 1.25rem;
}

/* Old stuff. */
.ancestry-list {
    list-style: none;
    padding: 0;
}

.ancestry-item {
    background: var(--bg-wood);
    border: 1px solid var(--brass-dark);
    border-left: 4px solid var(--ocean-blue);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.ancestry-item:hover {
    transform: translateX(5px);
    border-left-color: var(--brass-light);
    box-shadow: 
        0 3px 8px rgba(0, 0, 0, 0.4),
        var(--glow-brass);
}

.ancestry-item h4 {
    color: var(--brass-light);
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    text-shadow: var(--text-shadow-brass);
}

.ancestry-item .lifespan {
    color: var(--ocean-blue);
    font-size: 0.9rem;
    font-style: italic;
    display: block;
    margin-bottom: 0.5rem;
}

.ancestry-item p {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        padding: 2rem 1.5rem;
    }
    
    .nav-list {
        gap: 1.5rem;
        padding: 1rem 0;
    }
    
    .nav-link {
        font-size: 1rem;
    }
    
    .content-section {
        padding: 2rem 1.5rem;
    }

    .feature-grid {
        gap: 1.5rem;
    }
    
    /* Atlas responsive */
    .atlas-layout {
        grid-template-columns: 1fr;
    }
    
    .atlas-sidebar {
        position: relative;
        top: 0;
        margin-bottom: 2rem;
    }
    
    .atlas-nav-content {
        flex-direction: column;
        align-items: stretch;
    }
    
    .atlas-search input {
        width: 100%;
    }
    
    /* Atlas link in header - mobile */
    .atlas-link-header {
        position: static;
        margin-top: 1rem;
        text-align: center;
    }
    
    .atlas-link-header a {
        display: inline-flex;
    }
}

@media (max-width: 480px) {
    body::before {
        border-width: 10px;
    }
    
    .nav-list {
        gap: 1rem;
        font-size: 0.9rem;
    }
    
    .content-section {
        padding: 1.5rem;
    }
    
    .ancestry-item {
        padding: 1.2rem;
    }
}

/* Footer Styles */
footer {
    background: linear-gradient(135deg, #1a1a1a 0%, #2c2416 100%);
    border-top: 3px solid var(--brass);
    margin-top: 4rem;
    padding: 2rem 0;
    position: relative;
    box-shadow: 0 -4px 8px rgba(0, 0, 0, 0.3);
}

footer::before {
    content: '';
    position: absolute;
    top: -3px;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        var(--brass-light) 25%, 
        var(--brass) 50%, 
        var(--brass-light) 75%, 
        transparent 100%);
    animation: shimmer 3s ease-in-out infinite;
}

.footer-content {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 2rem;
}

.footer-content p {
    margin: 0.5rem 0;
    color: var(--brass-light);
    font-size: 0.9rem;
    line-height: 1.6;
}

.footer-content a {
    color: var(--brass);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    font-weight: 500;
}

.footer-content a:visited {
    color: var(--brass);
}

.footer-content a:hover {
    color: var(--accent);
    text-shadow: 0 0 8px var(--accent-glow);
}

.footer-content a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent);
    transition: width 0.3s ease;
}

.footer-content a:hover::after {
    width: 100%;
}

.footer-tagline {
    font-style: italic;
    font-family: var(--font-accent);
    color: rgba(212, 175, 55, 0.7) !important;
    margin-top: 1rem !important;
    font-size: 0.85rem !important;
    letter-spacing: 0.05em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Responsive Footer */
@media (max-width: 768px) {
    footer {
        margin-top: 3rem;
        padding: 1.5rem 0;
    }
    
    .footer-content {
        padding: 0 1rem;
    }
    
    .footer-content p {
        font-size: 0.85rem;
    }
    
    .footer-tagline {
        font-size: 0.8rem !important;
    }
}

/* Shimmer Animation */
@keyframes shimmer {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.divine-symbols {
    float: right;
    inline-size: 15rem;
    aspect-ratio: 1;
    margin-left: 1rem;
    filter: drop-shadow(0 0 .75rem var(--brass-light));
    animation: divine-glow 2s ease-out infinite alternate;
}

@keyframes divine-glow {
    from { 
        filter: drop-shadow(0 0 .75rem var(--brass-dark));
    }
    to { 
        filter: drop-shadow(0 0 0.5rem var(--brass-light));
    }
}

/* =============================================
   CSS View Transitions API
   ============================================= */

/* Enable automatic transitions for all same-origin navigations */
@view-transition { 
    navigation: auto; 
}

/* Define view transition names for persistent elements */
nav {
    view-transition-name: site-nav;
}

header {
    view-transition-name: site-header;
}


footer {
    view-transition-name: site-footer;
}

/* Main content area that will transition */
main {
    view-transition-name: main-content;
}

/* Slide animations */
@keyframes slide-out-right {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes slide-in-bottom {
    from {
        transform: translateY(100vh);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* View transition animations for main content */
::view-transition-old(main-content) {
    animation: slide-out-right 0.5s ease-in-out forwards;
}

::view-transition-new(main-content) {
    animation: slide-in-bottom 0.8s ease-out 0.4s both;
}
