/* debug {
    border: 1px solid red;
} */

/* Global Variables */
:root {
    /* Primary colours */

    /* Backgorund colours */
    --background-main: #F3EADC;
    --background-dark: #F0E2D1;

    /* Text colours */
    --text-main: #0B0903;

    /* Fonts styling */
    --primary-font: "Grenze", serif;

    /* Element styling */
    --border-lines: 1px solid var(--text-main);
}

/* Default Styles */
body {
    margin: 0;
    
}

html {
    background-color: var(--background-main);
    color: var(--text-main);
}

h1, h2, h3, h4, p, a, span, ul {
    margin: 0;
    font-family: var(--primary-font);
}

h1 {
    font-size: 4rem;
    font-weight: 400;
}

h2 {
    font-size: 3rem;
    font-weight: 400;
}

h3 {
    font-size: 2rem;
    font-weight: 400;
}

h4 {
    font-size: 1rem;
    font-weight: 400;
}

p, span, a, ul {
    font-size: 1rem;
    font-weight: 300;
}

.table {    /* Make generic */
    width: 90%;
    margin: 0 auto;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.table-body {
    background-color: var(--background-dark);
    border: var(--border-lines);
    padding: 10px 20px;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.table-head span {   /* Make generic */
    font-size: 1.1rem;
    font-weight: 400;
}

.table-row-separator {
    height: 1px;
    width: 100%;
    background-color: var(--text-main);
}

/* Header Section */
#header {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2rem 0;
}

/* Nav Bar */
nav {
    width: 100%;
    border-top: var(--border-lines);
    border-bottom: var(--border-lines);
    /* padding-top: .5rem;
    padding-bottom: .5rem; */
    margin-bottom: 2rem;
}

.hamburger {
    display: none;
}

nav ul {
    width: 100%;
    display: flex;
    justify-content: space-around;
    margin: 0;
    padding: 0;
}

nav li {
    list-style: none;
    padding: .5rem 1rem;
}

nav li:has(a.active) {
    background-color: var(--background-dark);
}

nav a {
    font-size: 1.5rem;
    text-decoration: none;
}

nav a:hover {
    color: var(--text-main);
}

nav a:visited {
    color: var(--text-main);
}

/* Main Tab Navigation */
.main-tab {
    display: none;
}

.main-tab.active {
    display: block;
}

/* OVERVIEW TAB */
#overview {
    width: 100%;
}

#overview-container {
    width: 100%;
    display: flex;
    flex-direction: row;
    gap: 3rem;
    align-items: flex-start;
    justify-content: center;
}

#left-sidebar {
    display: flex;
    flex-direction: column;
    max-width: 300px;
    flex: 1;
    gap: 1rem;
}

#character-profile {
    display: flex;
    gap: 1rem;
    align-items: center;
    line-height: 1;
}

#character-profile img {
    height: 4rem;
    width: auto;
}

#character-profile-copy {
    display: flex;
    flex-direction: column;
    text-align: left;
    justify-content: space-around;
}

#character-stats {
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

#quick-stats {
    display: flex;
    flex-direction: row;
    gap: 2rem;
    align-items: center;
}

#quick-stats div {
    display: flex;
    flex-direction: row;
    gap: .25rem;
    align-items: center;
}

#conditions {
    display: flex;
    flex-direction: row;
    gap: .25rem;
}

#money {
    display: flex;
    flex-direction: column;
}

#environment-overview {
    display: flex;
    gap: 1rem;
    align-items: center;
}

#environment-overview-details {
    display: flex;
    flex-direction: column;
    text-align: left;
    justify-content: space-around;
}

#location {
    display: flex;
    flex-direction: row;
    gap: .25rem;
    align-items: center;
}

#location svg {
    height: 1em;
    width: auto;
    color: rgb(210, 15, 15);
}

#weather-icon {
    height: 3rem;
    width: 3rem;
}

/* Bluesky Embed Styling */
#bluesky-embed-container {
    flex: 2;
    max-width: 600px;
}

#bluesky-embed {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

#root-post {
    width: 100%;
    border: var(--border-lines);
}

#top-replies-header {   /* So inelegent lol target this properly */
    align-self: baseline;
}

#replies {
    display: grid;
    gap: 1px;
    border: var(--border-lines);
    background-color: var(--text-main);
}

.bluesky-post {
    display: flex;
    flex-direction: row;
    gap: .5rem;
    padding: 15px 10px;
    background-color: var(--background-dark);
}

.post-profile-picture .profile-picture {
    width: 42px;
    height: 42px;
    border-radius: 50%;
}

.post-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

.post-header {
    display: flex;
    flex-direction: row;
    gap: .3rem;
}

.post-author {
    display: flex;
    flex-direction: row;
    gap: .3rem;
    flex-wrap: wrap;
}

.post-stats {
    display: flex;
    flex-direction: row;
    gap: 2rem;
}

.post-stat-container {
    display: flex;
    flex-direction: row;
    gap: .25rem;
    align-items: center;
}

.post-stat-icon {

}

.post-stat-value {

}

#replies #no-of-comments, #replies #no-of-reposts {
    display: none;
}

#right-sidebar {
    display: flex;
    flex-direction: column;
    flex: 1;
    max-width: 300px;
    gap: 1rem;
    align-items: flex-end;
    text-align: right;
}

.coin {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.25rem;
}

#gold svg {
    color: rgb(241, 203, 52);
}

#silver svg {
    color: rgb(202, 201, 201);
}

#copper svg {
    color: rgb(194, 130, 71);
}

#electrum svg {
    color: rgb(100, 186, 100);
}

/* STATS TAB */
#stats {
    width: 100%;
}

#stats-container {
    width: 100%;
    margin: 0 auto;
    display: grid;
    grid-template-columns: auto auto;
    gap: 5rem;
    justify-content: center;
}

.score {
    font-size: 2rem;
}

/* Ability Stats */
#ability-stats { 
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    gap: 1.5rem 1.5rem;
}

.ability-container {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1.5rem;
    justify-content: center;
}

.stat-box {
    position: relative;
    height: 5.75rem;
    /* aspect-ratio: 1; */
    min-width: 5.75rem;
    border: var(--border-lines);
    background-color: var(--background-dark);
    align-self: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
}

.stat-box::before { /*Creates a fake element in order to space ability contents using space-between, i.e. score is centered vertically */
    content: " ";
    height: 1em;
}

.ability-modifier {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 35%;
    aspect-ratio: 1;
    border: var(--border-lines);
    background-color: var(--background-dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.skills-container {
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: .2rem;
}

.skill {
    display: flex;
    flex-direction: row;
    gap: .3rem;
    /* min-width: 10rem;  to prevent skill-name from wrapping to two lines */
    align-items: flex-end;
}

.checkbox {
    border: var(--border-lines);
    border-radius: 50%;
    height: .7rem;
    width: .7rem;
    /* aspect-ratio: 1; */
}

.diamond {
    border-radius: 0%;
    rotate: 45deg;
}

.checkbox.active {
    background-color: var(--text-main);
    box-shadow: inset 0 0 0 1.5px var(--background-main);    /* Gives checkbox fill a slight gap between the fill and the border */
}

.underline {
    border-bottom: var(--border-lines);
    width: .85rem;
}

.stat-name, .skill-name {
    font-size: .85rem;
} 

/* Derived Stats */
#derived-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    gap: 1.5rem 2rem;
}

#health-points {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

#current-max-hp {
    grid-column: span 2;
}

#prof-ac-speed {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

/* Change to spellcasting */
#spell-scores {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;  
}

#hitdice-deathsaves {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;    
}

#death-saves-counter {
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

#death-saves-successes, #death-saves-failures {
    text-align: right;
    display: grid;
    grid-template-columns: 4fr 1fr 1fr 1fr;
    gap: .25rem;
}

#more-skills-profs {
    grid-row: span 2;
    grid-column: 2;
    grid-row: 2/4;
}

#more-skills-profs .stat-box {
    height: 100%;
}

#more-skills-profs .stat-box::before {  /* Remove hidden character */
    display: none;
}

#more-skills-profs ul {
    align-self: baseline;
    margin: 1rem 0rem;
}

/* INVENTORY TAB */
#inventory {
    width: 100%;
}

#inventory-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.inventory-table-row {
    width: 100%;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 3fr 1fr;
    grid-template-rows: auto auto;
}

.expanding-row {    /* These allow second row to display/hide */
    grid-column: 1/-1;
    grid-row: 2;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.expanding-row.collapsed {  /* Will need to use a .expanded class and heights to achieve animations */
    display: none;
}

/* ABILITIES & SPELLCASTING TAB */
#abilities-and-spellcating {
    width: 100%;
}

#abilities-and-spellcasting-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.abilities-table-row {  /* Swap out for generic table row class and specify the id to define rows and columns */
    width: 100%;
    display: grid;
    grid-template-columns: 3fr 1fr 2fr;
}

#spell-slots {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
}

.spells-table-row {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 3fr 2fr 2fr 2fr 2fr 2fr 1fr;
    grid-template-rows: auto auto;
}

.spell-details {
    display: flex;
    flex-direction: row;
    gap: 2rem;
}

.feats-table-row {
    width: 100%;
    display: grid;
    grid-template-columns: 2fr 3fr 1fr;
    grid-template-rows: auto auto;
}

/* MAPS TAB */
#maps {
    width: 100%;
}

#maps-container {
    width: 95%;
    margin: 0 auto;
    /* aspect-ratio: 16 / 9; */
    display: grid;
    grid-template-columns: 1fr 4fr;
    gap: 3rem;
}

#map-category-tabs {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.accordion-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0 .5rem;
}

.map-list span {
    padding: 0 1rem;
}

/* Highlights active category */
.map-tab.selected .accordion-header {
    background-color: var(--background-dark);
}

/* Allow map category expansion/hide and display */
.map-list {
    display: none;
}

/* Highlights active map */
.map-tab.active .map-list {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.map-list span.active-map {
    background-color: var(--background-dark);
}

#map-viewport {
    aspect-ratio: 16 / 9;
    background-color: var(--background-dark);
    border: var(--border-lines);
    min-height: 0;  /* prevents viewport size from shifting when empty/full */
    padding: 2rem 3rem;
}


/* ADVENTURE LOG TAB */
#adventure-log {
    width: 100;
}

#adventure-log-container {
    width: 95%;
    margin: 0 auto;
    /* aspect-ratio: 16 / 9; */
    display: grid;
    grid-template-columns: 1fr 4fr;
    gap: 3rem;
}

#adventure-log-tabs {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.adventure-list span {
    padding: 0 1rem;
}

.adventure-tab.selected .accordion-header {
    background-color: var(--background-dark);
}

/* Allow adventure tab expansion/hide and display */
.adventure-list {
    display: none;
}

.adventure-tab.active .adventure-list {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.adventure-list span.active-adventure-item {
    background-color: var(--background-dark);
}

#adventure-log-viewport {
    aspect-ratio: 16 / 9;
    background-color: var(--background-dark);
    border: var(--border-lines);
    padding: 2rem 3rem;
}


/* ABOUT TAB */
#about {
    width: 100%;
}

#about-container {
    width: 95%;
    margin: 0 auto;
}


/* MOBILE STYLES */
@media (max-width: 760px) {

    /* DEFAULT STYLES */
    h1 {
        font-size: 3rem;
    }

    h2 {
        font-size: 2rem;
    }

    h3 {
        font-size: 1.5rem;
    }

    /* NAVIGATION */
    nav {
        position: fixed;
        z-index: 1;
        top: 0;
        left: 0;
        width: 100%;
        display: flex;
        justify-content: flex-end;
        border: none;
    }
    
    .hamburger {
        display: block;
        background: var(--background-dark);
        border: var(--border-lines);
        border-radius: 50%;
        font-size: 2rem;
        padding: 0.5rem 1rem;
        cursor: pointer;
    }

    nav ul {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: var(--background-main);
        border-bottom: var(--border-lines);
        z-index: 100;
    }

    /* Show menu when active */
    nav ul.active {
        display: flex;
    }
    
    nav li {
        width: 100%;
        border-bottom: var(--border-lines);
    }

    /* OVERVIEW TAB */
    #overview-container {
        flex-direction: column;
        align-items: center;
        padding: 1rem;
    }

    #left-sidebar {
        display: grid;
        grid-template-columns: auto auto;
        grid-template-rows: auto auto auto;
        align-items: center;
    }

    #character-profile {
        grid-column: 1;
        grid-row: 1;
    }

    #character-stats {
        grid-row: 2;
        grid-column: 1;
    }

    #quick-stats {
        display: grid;
        grid-template-rows: auto auto;
        grid-template-columns: auto auto;
        gap: 0.25rem;
    }

    #inspiration {
        grid-column: span 2;
    }

    #conditions {
        grid-row: 3;
        grid-column: 1;
    }

    #money {
        grid-row: 2;
        grid-column: 2;
    }

    #environment-overview {
        grid-row: 1;
        grid-column: 2;
        gap: 0rem;
        line-height: 1;
    }

    /* STATS TAB */
    #stats-container {
        display: flex;
        flex-direction: column;
    }

    #derived-stats {
        display: flex;
        flex-direction: column;
    }
}