/*
Theme Name: Norse By God
Author: Josh King
Description: A custom theme for the Norse by God project.
Version: 1.0
*/


/* GLOBAL & SETUP */
:root {
    --dark-background: #1a2223;
    --card-background: #253334;
    --accent-gold: #bda165;
    --accent-silver: #a8b2b2;
    --accent-wood-brown: #4a3f35;
    --text-primary: #cccccc;
    --text-heading: #e0e0e0;
    --border-color: rgba(255, 255, 255, 0.1);
}

body {
    background-color: var(--dark-background);
    font-family: 'EB Garamond', serif;
    color: var(--text-primary);
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.7;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

h1, h2, h3, h4 {
    font-family: 'IM Fell English SC', serif;
    color: var(--text-heading);
    font-weight: 400;
    line-height: 1.3;
}

a {
    color: var(--accent-gold);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* HEADER AND FOOTER */
.site-header {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-title a {
    font-family: 'IM Fell English SC', serif;
    font-size: 1.8rem;
    color: var(--text-heading);
    text-decoration: none;
}

.main-navigation ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    gap: 2rem;
}

.main-navigation a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1rem;
    padding-bottom: 5px;
    border-bottom: 2px solid transparent;
    transition: color 0.3s, border-bottom-color 0.3s;
}

.main-navigation a:hover {
    color: #ffffff;
    border-bottom-color: var(--accent-gold);
}

.site-footer {
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-top: 2rem;
}

.site-footer p {
    text-align: center;
    margin: 0;
    color: var(--text-primary);
    opacity: 0.7;
    font-size: 1rem;
    height: 2em;
    display: flex;
    align-items: center;
    justify-content: center;
}

main {
    padding: 2rem 0;
}

/* HOMEPAGE HERO IMAGE */
.site-hero {
    position: relative; /* Required for the overlay */
    text-align: center;
    padding: 6rem 2rem;
    color: #fff; /* Text should be light to show up on the dark background */
    
    /* --- The Background Image --- */
    background-image: url('assets/cloudy_fjord.jpg'); /* Your background image */
    background-size: cover;
    background-position: center;
}

/* TINT OVER PAGE HERO IMAGES (not home) */
.site-hero::before {
    content: '';
    position: absolute;
    inset: 0; /*for top:0, right:0, bottom:0, left:0 */
    background-color: rgba(26, 34, 35, 0.65); /* 65% opaque */
    z-index: 1;
}

/* Move the content sits on top of the tint */
.site-hero-content {
    position: relative;
    z-index: 2;
}

.site-hero h2 {
    font-size: 2.8rem;
    color: var(--text-heading);
    max-width: 800px;
    margin: 0 auto 1rem auto;
    line-height: 1.4;
}

.site-hero p {
    font-size: 1.3rem;
    max-width: 700px;
    margin: 0 auto 2.5rem auto;
    opacity: 0.9;
}

.button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--accent-gold);
    border-radius: 4px;
    color: var(--accent-gold);
    font-weight: bold;
    text-decoration: none;
    transition: background-color 0.3s, color 0.3s;
}

.button:hover {
    background-color: var(--accent-gold);
    color: var(--dark-background);
}


.latest-post-hero {
    min-height: 60vh;
    display: flex;
    align-items: flex-end;
    background-size: cover;
    background-position: center;
    position: relative;
    padding: 3rem;
    color: #fff;
    border-radius: 4px;
    overflow: hidden;
    box-sizing: border-box;
}

.latest-post-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8), rgba(0,0,0,0.1));
    z-index: 1; /* Make sure the overlay is on a lower layer */
}

.hero-content {
    position: relative;
    z-index: 2; /* This puts the content ON TOP of the overlay */
}

.hero-content h1 {
    font-size: 3.5rem;
    margin: 0 0 1rem 0;
}
.hero-content h1 a {
    color: #fff;
    text-decoration: none;
}

.section-title {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.article-card {
    background-color: var(--card-background);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.article-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}
.article-card-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.article-card-content h3 {
    margin-top: 0;
    font-size: 1.6rem;
}
.article-card-content p {
    flex-grow: 1;
}

/* READ MORE! */
.read-more {
    display: block; /* Makes the link take up its own line */
    margin-top: 1.5rem;
    padding-top: 1rem;
    padding-bottom: 0.5rem;
    text-align: center;
    font-weight: bold;
    text-decoration: none;
    border-top: 1px solid var(--border-color); /* A subtle line */
    transition: border-top-color 0.3s;
}

.read-more:hover {
    border-top-color: var(--accent-gold); /* The line lights up on hover */
    text-decoration: none;
}

/* SINGLE ARTICLE LAYOUT*/
.article-hero {
    height: 50vh;
    background-size: cover;
    background-position: center;
}

.article-container {
    max-width: 1100px;
    margin: -100px auto 0 auto;
    position: relative;
    z-index: 2;
}

.title-block {
    background-color: var(--card-background);
    padding: 2rem 3rem;
    text-align: center;
    margin-bottom: 3rem;
    border-top: 4px solid var(--accent-gold);
}

.title-block .category {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.title-block h1 {
    font-size: 3.5rem;
    margin: 0.5rem 0 1rem 0;
}

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 300px; /* Main content and sidebar */
    gap: 3rem;
    align-items: flex-start;
}

.main-content {
    max-width: 750px; /* Best reading width */
}

.main-content blockquote {
    border-left: 4px solid var(--accent-gold);
    padding-left: 1.5rem;
    font-style: italic;
    font-size: 1.3rem;
    color: var(--text-heading);
}

.sidebar {
    position: sticky; /* Sticky sidebar */
    top: 2rem;
}

.sidebar-widget {
    background-color: var(--card-background);
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-radius: 4px;
}

.sidebar-widget h4 {
    margin-top: 0;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.8rem;
}

.sidebar-widget ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.sidebar-widget ul li a {
    display: block;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}
.sidebar-widget ul li:last-child a {
    border-bottom: 0;
}

/* DEFAULT PAGE LAYOUT */
.page-hero {
    height: 40vh;
    background-size: cover;
    background-position: center;
}

.page-hero::before,
.article-hero::before {
    content: '';
    position: absolute;
    inset: 0; /* shorthand for top:0, right:0, bottom:0, left:0 */
    background-color: rgba(26, 34, 35, 0.6); /* 60% opaque tint */
}

/* added position: relative to the parent elements */
.page-hero,
.article-hero {
    position: relative;
}

/* Default state for pages WITHOUT a hero */
.page-container {
    max-width: 1100px;
    margin: 4rem auto 0 auto; /* Adds top margin for proper spacing */
    position: relative;
    z-index: 2;
    padding: 0 2rem;
}

/* Overlap state ONLY for pages WITH a hero */
.page-has-hero .page-container {
    margin-top: -80px;
}

.page-title-block {
    background-color: var(--card-background);
    padding: 2rem 3rem;
    text-align: center;
    border-top: 4px solid var(--accent-gold);
    border-radius: 4px;
}

.page-title-block h1 {
    font-size: 3rem;
    margin: 0;
}

.page-content-wrapper {
    background-color: var(--card-background);
    padding: 3rem;
    margin-top: 2rem;
    border-radius: 4px;
}

.page-content {
    max-width: 800px;
    margin: 0 auto;
}

.page-content * {
    max-width: 100%;
    height: auto;
}

/* ABOUT PAGE LAYOUT */
.about-content {
    max-width: 800px;
    margin: 0 auto 4rem auto;
    text-align: center;
    line-height: 1.8;
}

.about-content p:first-child {
    font-size: 1.3rem;
    color: var(--text-heading);
}

.scholar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.scholar-card {
    background-color: var(--card-background);
    padding: 2rem;
    text-align: center;
    border-radius: 4px;
}

.scholar-card img {
    width: 150px;
    height: 150px;
    border-radius: 50%; /* Makes the image a circle */
    object-fit: cover;
    border: 4px solid var(--accent-gold);
    margin-bottom: 1.5rem;
}

.scholar-card h3 {
    margin: 0 0 0.5rem 0;
}

.scholar-card .scholar-title {
    margin: 0 0 1rem 0;
    font-style: italic;
    color: var(--accent-gold);
}

.scholar-card .scholar-bio {
    font-size: 1rem;
    opacity: 0.8;
}

/* SEARCH OVERLAY */

.header-search {
    position: relative; /* Context for the overlay */
}

/* A robust way to hide the checkbox visually but keep it functional */
.search-toggle-checkbox {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.search-toggle {
    cursor: pointer;
    padding: 0.5rem;
    margin-left: 1rem;
    opacity: 0.8;
    transition: opacity 0.3s, color 0.3s;
    color: var(--text-primary);
}

.search-toggle:hover {
    opacity: 1;
    color: var(--accent-gold);
}

.search-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background-color: rgba(26, 34, 35, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

/* When the checkbox is checked, find .search-overlay and show it */
#search-toggle-checkbox:checked ~ .search-overlay {
    opacity: 1;
    visibility: visible;
}

.search-overlay .search-form {
    width: 100%;
    max-width: 600px;
}

.search-overlay .search-field {
    width: 100%;
    background: none;
    border: none;
    border-bottom: 2px solid var(--border-color);
    padding: 1rem 0;
    font-size: 2.5rem;
    color: var(--text-heading);
    text-align: center;
    font-family: 'IM Fell English SC', serif;
}

.search-overlay .search-field:focus {
    outline: none;
    border-bottom-color: var(--accent-gold);
}

.search-overlay .search-submit {
    display: none;
}

.search-overlay-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    color: var(--text-primary);
    font-size: 3rem;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.3s, color 0.3s, transform 0.3s;
}

.search-overlay-close:hover {
    opacity: 1;
    color: #fff;
    transform: rotate(90deg);
}

/* RESPONSIVE AND MOBILE!!! */

/* --- Hide mobile elements by default on desktop --- */
.mobile-menu-container {
    display: flex;
    align-items: center;
}

.mobile-nav-toggle {
    display: none; /* Hide the hamburger icon on desktop */
}


@media (max-width: 900px) {

    /* --- Hamburger menu --- */
    .mobile-menu-container {
        margin-left: auto; /* Push menu elements to the right */
    }
    
    .mobile-nav-toggle {
        display: flex; /* Show the hamburger icon on mobile */
        flex-direction: column;
        justify-content: space-around;
        width: 30px;
        height: 24px;
        cursor: pointer;
        z-index: 1001; /* Ensure it's on top of other content */
        position: relative;
        background: none;
        border: none;
    }

    .mobile-nav-toggle span {
        width: 100%;
        height: 3px;
        background-color: var(--text-heading);
        border-radius: 2px;
        transition: transform 0.3s, opacity 0.3s;
    }

    /* Hide the desktop nav on mobile */
    .main-navigation {
        display: none;
    }

    /* When the body has JS class, show the mobile overlay menu */
    body.mobile-menu-active .main-navigation {
        display: flex;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 1000;
        background-color: var(--dark-background);
        align-items: center;
        justify-content: center;
    }
    
    /* Style the nav links for the overlay menu */
    .main-navigation ul {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    .main-navigation a {
        font-size: 2rem;
        font-family: 'IM Fell English SC', serif;
    }
    
    /* Animate the hamburger icon into an "X" when open */
    body.mobile-menu-active .mobile-nav-toggle span:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    body.mobile-menu-active .mobile-nav-toggle span:nth-child(2) {
        opacity: 0;
    }
    body.mobile-menu-active .mobile-nav-toggle span:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }

    /* --- Stack article sidebar --- */
    
    .content-wrapper {
        grid-template-columns: 1fr;
    }

    .sidebar {
        margin-top: 3rem;
        position: static;
    }
    
    /* --- Minor hero section tweaks --- */
    .site-hero h2, .latest-post-hero h1 {
        font-size: 2.2rem;
    }
}

/* BIFROST - LINKS PAGE */
.link-category {
    margin-bottom: 3rem;
}
.link-category-title {
    font-size: 2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}
.links-container ul {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}
.links-container li {
    background-color: var(--card-background);
    padding: 1.5rem;
    border-radius: 4px;
    border-left: 4px solid var(--accent-gold);
}
.links-container li a {
    font-family: 'IM Fell English SC', serif;
    font-size: 1.3rem;
    font-weight: bold;
}
.links-container li .link-description {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 0.5rem;
}

/* SOCIAL MEDIA */
.share-buttons {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}
.share-buttons h4 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}
.share-buttons a {
    display: inline-block;
    margin: 0 0.5rem;
    padding: 0.5rem 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.9rem;
    text-decoration: none;
}
.share-buttons a:hover {
    background-color: var(--accent-gold);
    color: var(--dark-background);
    border-color: var(--accent-gold);
}

.site-footer .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}
.social-links a {
    color: var(--text-primary);
    opacity: 0.7;
    transition: opacity 0.3s, color 0.3s;
}
.social-links a:hover {
    opacity: 1;
    color: #fff;
}

/* COMMENTS SECTION */
.comments-wrapper {
    margin-top: 4rem;
    padding-top: 3rem;
    border-top: 1px solid var(--border-color);
}

.comments-title, .comment-reply-title {
    font-size: 2rem;
    margin-bottom: 2rem;
}

/* The comment list */
.comment-list {
    list-style: none;
    padding: 0;
    margin: 0 0 3rem 0;
}
.comment-list li {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border-color);
}
.comment-list .children { /*threaded comments */
    list-style: none;
    padding-left: 2rem;
    margin-top: 1.5rem;
}
.comment-body {
    display: grid;
    grid-template-columns: 50px 1fr; /* Avatar and content */
    gap: 1.5rem;
}
.comment-author img {
    border-radius: 50%;
}
.comment-meta {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    opacity: 0.8;
}
.comment-meta b { /* Author's name */
    font-style: normal;
    color: var(--text-heading);
}
.comment-content p {
    margin: 0;
}
.reply a {
    font-size: 0.9rem;
    font-weight: bold;
}

/* Comment form */
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    background-color: var(--dark-background);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}
.comment-form input[type="submit"] {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--accent-gold);
    border-radius: 4px;
    background: none;
    color: var(--accent-gold);
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
}
.comment-form input[type="submit"]:hover {
    background-color: var(--accent-gold);
    color: var(--dark-background);
}

/* COMMENTS TOGGLE */
.comments-toggle-wrapper {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    display: flex; /* Use flexbox for alignment */
    justify-content: space-between; /* Pushes items to opposite ends */
    align-items: center;
    flex-wrap: wrap; /* wraps items to smaller screens */
}

.comments-toggle-button {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem 1.5rem;
    border-radius: 30px;
    font-size: 1rem;
    font-family: 'EB Garamond', serif;
    cursor: pointer;
    transition: background-color 0.3s, border-color 0.3s;
}

.comments-toggle-button:hover {
    background-color: var(--dark-background);
    border-color: var(--accent-gold);
}

.comments-container {
    /* Hidden by default */
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-in-out;
    text-align: left; /* Reset text alignment for the content */
    width: 100%; /* Make the container take up the full width */
}

.comments-container.is-visible {
    max-height: 5000px; /* A large number to allow for expansion */
    padding-top: 3rem;
}

/* SOCIAL MEDIA BUTTON FIXES */
.share-buttons {
    /* Remove margins and borders from the container */
    margin: 0;
    padding: 0;
    border: none;
    text-align: right;
}
.share-buttons h4 {
    display: none; /* Hide share this story */
}
.share-buttons a {
    display: inline-block;
    margin: 0 0 0 0.5rem; /* Only add margin to the left */
    padding: 0.5rem 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.9rem;
    text-decoration: none;
}
.share-buttons a:hover {
    background-color: var(--accent-gold);
    color: var(--dark-background);
    border-color: var(--accent-gold);
}

/* DROPDOWN NAV */
.main-navigation ul li {
    position: relative;
}

.main-navigation ul .sub-menu {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--card-background);
    border-top: 2px solid var(--accent-gold);
    border-radius: 0 0 4px 4px;
    min-width: 200px;
    padding: 0.5rem 0;
    z-index: 100;
    list-style: none;
    margin: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.main-navigation ul li:hover > .sub-menu,
.main-navigation ul li:focus-within > .sub-menu {
    display: flex;
    flex-direction: column;
}

.main-navigation ul .sub-menu li {
    display: block;
    width: 100%;
}

.main-navigation ul .sub-menu a {
    display: block;
    padding: 0.6rem 1.25rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    border-bottom: none;
    white-space: nowrap;
    transition: color 0.2s, background-color 0.2s;
}

.main-navigation ul .sub-menu a:hover {
    color: var(--accent-gold);
    background-color: var(--dark-background);
}

@media (max-width: 900px) {
    .main-navigation ul .sub-menu {
        display: flex;
        flex-direction: column;
        position: static;
        background-color: transparent;
        border-top: none;
        border-left: 2px solid var(--accent-gold);
        border-radius: 0;
        box-shadow: none;
        padding: 0.25rem 0 0.25rem 1rem;
        margin-top: 0.5rem;
        min-width: unset;
    }

    .main-navigation ul .sub-menu a {
        font-size: 1.4rem;
        padding: 0.4rem 0;
    }
}