:root {
    --primary-color: #13171B;
    --secondary-color: #A32633;
    --accent-color: #343339;
    --background-color: #20252C;
    --text-color: #f4f4f4;
}

/* Add a universal box-sizing reset */
* {
    box-sizing: border-box;
}

/* General Reset and Base Styles */
html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;  /* removed horizontal padding */
    background: var(--background-color);
    color: var(--text-color);
    font-family: 'Roboto', sans-serif; /* Updated font */
    line-height: 1.6;
    scroll-behavior: smooth; /* Smooth scrolling for better UX */
    display: block; /* Ensure it behaves as a block element */
    min-height: 100px; /* Set a minimum height */
    overflow: visible; /* Ensure no overflow restrictions */
    overflow-x: hidden;  /* prevent horizontal scrolling */
}

/* Layout and Containers */
.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin: 1.5rem 0;
    font-weight: bold;
}

p, ul, ol {
    margin: 1rem 0;
    line-height: 1.8; /* Unified line height for readability */
}

ul, ol {
    padding-left: 1.5rem;
}

ul li, ol li {
    margin-bottom: 0.5rem;
}

/* Links */
a {
    text-decoration: none;
}

a:hover {
    text-decoration: underline; /* Add hover effect for better UX */
}

.cards {
    display: flex; /* Use flexbox for better alignment */
    flex-wrap: wrap; /* Allow wrapping to the next line */
    justify-content: center; /* Center-align cards */
    gap: 1.5rem; /* Maintain spacing between cards */
    margin: 2rem 0;
}

.card {
    flex: 1 1 calc(33.333% - 1.5rem); /* Ensure cards take up equal space */
    max-width: calc(33.333% - 1.5rem); /* Prevent cards from exceeding their allocated space */
    background-color: var(--accent-color);
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card h3 {
    margin-bottom: 1rem;
    color: #A32633;
}

.card p {
    color: var(--text-color);
}

/* Hover effect for cards */
.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

/* Section Headers */
.about-header, .abilities-header, .weapons-header, .friends-header, .profile-header{
    background-color: var(--accent-color); /* Jet */
    text-align: center;
    padding: 2rem 0;
    border: 3px solid #962333; /* Japanese Carmine */
    border-radius: 40px;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
    margin: 1rem auto;
    max-width: 90%;
}

/* Header */
header {
    width: 100%;
    box-sizing: border-box;
    background-color: var(--accent-color);
    color: var(--text-color);
    text-align: center;
    padding: 2rem 0;
    display: block; /* Ensure it behaves as a block element */
    min-height: 100px; /* Set a minimum height */
    overflow: visible; /* Ensure no overflow restrictions */
    position: static; /* Reset position */
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

header h2 {
    font-size: 1.5rem;
    font-style: italic;
    color: #ccc;
}

/* Sticky Navigation */
.nav-container {
    width: 100%;
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--primary-color); /* Ensures visibility when sticky */
    padding: 1rem 0;
    margin: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    transition: background-color 0.3s;
    border-bottom: 2px solid var(--secondary-color); /* keeps deadpool red as border */
}

.nav-container ul {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin: 0; /* Ensure no margin conflicts */
    padding: 1rem 0; /* Add padding for spacing */
}

/* Consolidated Nav Link Styles */
.nav-container ul li a {
    color: var(--text-color);
    background: linear-gradient(45deg, var(--background-color), var(--primary-color));
    border-radius: 20px;
    font-weight: bold;
    padding: 0.75rem 1.8rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
    transition: background 0.3s, transform 0.2s, box-shadow 0.2s;
}

.nav-container ul li a:hover {
    transform: translateY(-2px);
    /* Reversed gradient order to remove the unwanted red stripe */
    background: linear-gradient(45deg, var(--accent-color), var(--secondary-color));
    box-shadow: 0 4px 8px rgba(0,0,0,0.5);
}

header figure img {
    border-radius: 50%;
    border: 5px solid #A32633;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

/* Header Section */
.header-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 2rem 0;
    background-color: var(--accent-color);
    color: var(--text-color);
}

.header-container figure {
    margin: 0;
    text-align: center;
}

.header-container img {
    border-radius: 50%;
    border: 5px solid #A32633;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.header-container .header-text {
    text-align: left;
}

.header-container h1 {
    font-size: 2.5rem;
    margin: 0;
}

.header-container h2 {
    font-size: 1.5rem;
    font-style: italic;
    color: #ccc;
    margin: 0.5rem 0 0;
}

/* Main Content */
main {
    margin: 2rem auto;
    max-width: 800px;
    padding: 2rem;
    background-color: var(--primary-color);
    color: var(--text-color);
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    border-top: 1px solid transparent;
}

main section, main article {
    margin-bottom: 2rem;
}

main h2 {
    background-color: var(--accent-color);
    margin: 1.5rem 0;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

table th, table td {
    border: 1px solid #ddd;
    padding: 0.75rem;
    text-align: left;
}

table th {
    background-color: #A32633;
    color: var(--text-color);
}

table td {
    background-color: var(--background-color);
    color: var(--text-color);
}

table caption {
    margin-bottom: 0.5rem;
    font-weight: bold;
}

/* Footer */
footer {
    width: 100%;
    text-align: center;
    padding: 1rem 0;
    background-color: var(--accent-color);
    color: var(--text-color);
    margin-top: 2rem;
}

footer a {
    color: var(--text-color);
    background-color: #A32633;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
}

footer a:hover {
    background-color: #962333;
}

footer .social-icons {
    margin-top: 1rem;
}

footer .social-icons a {
    margin: 0 0.5rem;
    display: inline-flex; /* Use flexbox for centering */
    align-items: center; /* Center image vertically */
    justify-content: center; /* Center image horizontally */
    width: 50px; /* Set a fixed width */
    height: 50px; /* Set a fixed height */
    background-color: #A32633; /* Ensure background color matches */
    border-radius: 50%; /* Make the background fully rounded */
    transition: transform 0.3s, background-color 0.3s, box-shadow 0.3s;
}

footer .social-icons img {
    width: 24px;
    height: 24px;
    transition: transform 0.3s;
}

footer .social-icons img:hover {
    transform: scale(1.2);
}

footer .social-icons a:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

/* Friends Section */
.friends-section a {
    color: var(--text-color);
    background-color: #A32633;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: background-color 0.3s, color 0.3s;
}

.friends-section li {
    list-style: none;
    display: inline-block;
    margin: 1rem;
    text-align: center;
}

.friends-section a:hover {
    background-color: #962333;
    color: #fff;
}

/* Additional responsiveness for larger screens */
@media (min-width: 1200px) {
    .container {
        width: 80%;
    }
    main {
        max-width: 900px;
    }
    header h1 {
        font-size: 3rem;
    }
    header h2,
    .header-container h2 {
        font-size: 2rem;
    }
    .nav-container ul li a {
        padding: 0.75rem 1.25rem;
        font-size: 1.1rem;
    }
    /* Adjust anchor scroll offset on large screens so headers align at the top */
    h2[id] {
        scroll-margin-top: 170px;
    }
}

/* Additional Responsiveness */

/* Mobile devices (max-width: 767px) */
@media (max-width: 767px) {
    html, body {
        /* Ensure content scales well */
        font-size: 14px;
    }
    header h1 {
        font-size: 1.8rem;
    }
    header h2 {
        font-size: 1.2rem;
    }
    .nav-container ul {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }
    .nav-container ul li a {
        padding: 0.5rem 0.75rem;
        font-size: 1rem;
    }
    main {
        padding: 1.5rem;
        max-width: 95%;
    }
    .cards {
        flex-direction: column;
    }
    .card {
        flex: 1 1 100%;
        max-width: 100%;
        margin-bottom: 1rem;
        padding: 1rem; /* reduce padding for smaller screens */
    }
    .card h3 {
        font-size: 1.2rem; /* adjust header size */
        margin-bottom: 0.5rem;
    }
    .card p {
        font-size: 0.9rem; /* adjust text size */
    }
    h2[id] {
        scroll-margin-top: 80px; /* Adjust mobile offset */
    }
}

/* Tablet devices (min-width: 768px and max-width: 1199px) */
@media (min-width: 768px) and (max-width: 1199px) {
    html, body {
        font-size: 15px;
    }
    header h1 {
        font-size: 2rem;
    }
    header h2 {
        font-size: 1.3rem;
    }
    .nav-container ul {
        flex-direction: row;
        gap: 1rem;
    }
    .nav-container ul li a {
        padding: 0.6rem 1rem;
        font-size: 1.05rem;
    }
    main {
        max-width: 90%;
    }
    .cards {
        flex-wrap: wrap;
    }
    .card {
        flex: 1 1 calc(50% - 1.5rem);
        max-width: calc(50% - 1.5rem);
        margin-bottom: 1.5rem;
        padding: 1rem;
    }
    .card h3 {
        font-size: 1.4rem;
    }
    .card p {
        font-size: 1rem;
    }
    h2[id] {
        scroll-margin-top: 80px; /* Adjust tablet offset */
    }
}

/* Large screens (min-width: 1200px) */
@media (min-width: 1200px) {
    html, body {
        font-size: 16px;
    }
    .container {
        width: 80%;
    }
    main {
        max-width: 900px;
    }
    header h1 {
        font-size: 3rem;
    }
    header h2, .header-container h2 {
        font-size: 2rem;
    }
    .nav-container ul li a {
        padding: 0.75rem 1.25rem;
        font-size: 1.1rem;
    }
}

/* Mobile Navigation Base Styles */
.mobile-nav {
    background-color: var(--primary-color);
    color: var(--text-color);
    width: 200px;           /* desired width for mobile nav */
    height: 100%;
    padding: 2rem 1rem;
    position: fixed;        /* ensure it stays fixed */
    top: 0;
    left: -200px;           /* hidden off-screen by default */
    transition: left 0.3s ease;
    z-index: 1100;
}

/* Mobile Navigation Active State */
.mobile-nav.active {
    left: 0;
}

/* Styles for mobile nav links */
.mobile-nav nav ul {
    list-style: none;
    margin: 0;
    padding: 1rem 0;
    margin-top: 1.5rem;  /* extra space from the hamburger button */
}

.mobile-nav nav ul li {
    margin-bottom: 1rem;
}

.mobile-nav nav ul li a {
    color: var(--text-color);
    background-color: var(--background-color);
    padding: 0.5rem 1rem;
    border-radius: 5px;
    display: block;
    text-decoration: none;
    transition: background-color 0.3s;
    background: linear-gradient(45deg, var(--background-color), var(--primary-color));
    padding: 0.75rem 1.2rem;
    border-radius: 10px;
    display: block;
    text-decoration: none;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
    transition: background 0.3s, transform 0.3s, box-shadow 0.3s;
}

.mobile-nav nav ul li a:hover {
    background-color: var(--accent-color);
    background: linear-gradient(45deg, var(--accent-color), var(--secondary-color));
    transform: translateX(8px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.6);
}

/* Responsive Overrides for Mobile & Tablet */
@media (max-width: 1199px) {
    .nav-container {
        display: none;
    }
    #hamburger-toggle {
        display: block;
        position: fixed;
        top: 1rem;
        left: 1rem;
        z-index: 1200;
        background: var(--primary-color);
        border: none;
        border-radius: 50%;
        width: 50px;
        height: 50px;
        transition: transform 0.3s ease;
        font-size: 1.5rem;
        color: var(--text-color);
        cursor: pointer;
        background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
        border: 2px solid var(--secondary-color);
        box-shadow: 0 4px 8px rgba(0,0,0,0.5);
        transition: background 0.3s, transform 0.3s, box-shadow 0.3s;
    }
    #hamburger-toggle:hover {
        transform: scale(1.1);
        background: linear-gradient(45deg, var(--accent-color), var(--secondary-color));
    }
}
@media (min-width: 1200px) {
    .mobile-nav,
    #hamburger-toggle {
        display: none;
    }
}

/* Additional Responsiveness for Mobile & Tablet */
@media (max-width: 1199px) {
    /* Hide the desktop nav remains unchanged */
    .nav-container {
        display: none;
    }
    /* Ensure mobile nav is positioned off-screen by default */
    .mobile-nav {
        position: fixed;
        top: 0;
        left: -200px;  /* hidden by default */
        width: 200px;  /* adjust width as needed */
        height: 100%;
        background-color: var(--primary-color);
        padding: 2rem 1rem;
        transition: left 0.3s ease;
        z-index: 1100;
    }
    .mobile-nav.active {
        left: 0;
    }
    /* Increase top margin for the mobile nav list so items appear further from the hamburger */
    .mobile-nav nav ul {
        margin-top: 1.5rem;
    }
    /* Hamburger Toggle Button remains unchanged */
    #hamburger-toggle {
        display: block;
        position: fixed;
        top: 1rem;
        left: 1rem;
        z-index: 1200;
        background: var(--primary-color);
        border: none;
        border-radius: 50%;
        width: 50px;
        height: 50px;
        transition: transform 0.3s ease;
        font-size: 1.5rem;
        color: var(--text-color);
        cursor: pointer;
    }
    #hamburger-toggle:hover {
        transform: scale(1.1);
    }
}
@media (min-width: 1200px) {
    .mobile-nav,
    #hamburger-toggle {
        display: none;
    }
}