/* General Body and Heading Styles */
html {
    overflow-x: hidden; /* Prevent horizontal overflow on search and other pages */
}

body {
    background-color: var(--bg-primary);
    padding: 2rem;
    overflow-x: hidden; /* Prevents horizontal scrollbars from hover effect */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1 0 auto;
}

h1, h3, h4 {
    text-align: center;
    color: var(--text-primary);
    font-family: system-ui, sans-serif;
}

h1 {
    font-family: 'Courier New', Courier, monospace;
    font-size: 3rem;
    font-weight: bolder;
}

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

h4 {
    font-size: 1rem;
    font-weight: 400;
    margin-bottom: 4rem; /* Reduced margin to prevent vertical overflow */
}

.MainButtonParent {
   width: 100%;
   display: flex;
   justify-content: space-evenly;
   font-size: 3rem;
}

/* Button Grid Layout */
.buttons {
    display: grid;
    width: min(75rem, 100%);
    margin-inline: auto;
    grid-template-columns: repeat(auto-fit, minmax(min(8rem, 100%), 1fr));
    gap: 2rem;
}

/* Neumorphic Button Styles - Works for both buttons and links */
button.neumorphic,
a.neumorphic {
    /* Layout properties for icon/text alignment */
    display: flex;
    flex-direction: column;
    place-content: center;
    text-decoration: none;

    /* Core button styles */
    container-type: inline-size;
    aspect-ratio: 1/1;
    border: 0.5rem solid transparent;
    border-radius: 1rem;
    color: var(--button-text);
    background: var(--button-bg);
    gap: 0.5rem;
    cursor: pointer;
    
    --shadow: 
      -.5rem -.5rem 1rem var(--shadow-light),
      .5rem .5rem 1rem var(--shadow-dark);
    box-shadow: var(--shadow);
    outline: none;  
    transition: all 0.1s;
}

/* Button States: Hover, Focus, Active */
button.neumorphic:hover, 
button.neumorphic:focus-visible,
a.neumorphic:hover,
a.neumorphic:focus-visible {
    color: var(--button-text-hover);
    scale: 1.1;
}

button.neumorphic:active, 
button.neumorphic.active,
a.neumorphic:active,
a.neumorphic.active {
    box-shadow:
        var(--shadow),
        inset .5rem .5rem 1rem var(--shadow-dark),
        inset -.5rem -.5rem 1rem var(--shadow-light);
    color: var(--button-text-hover);
}

/* Icon & Text Styling */
.button-icon {
    height: 31cqi; /* Use height with container query units */
}

button.neumorphic > span,
a.neumorphic > span {
    font-family: 'Courier New', Courier, monospace;
    font-size: 16cqi;
    font-weight: 400;
}

/* Icon and text size on active/pressed state */
button.neumorphic:active > .button-icon,
button.neumorphic.active > .button-icon,
a.neumorphic:active > .button-icon,
a.neumorphic.active > .button-icon {
    height: 28cqi;
}

button.neumorphic:active > span,
button.neumorphic.active > span,
a.neumorphic:active > span,
a.neumorphic.active > span {
    font-size: 13cqi;
}

/* Layout tiers: Mobile, Tablet, Desktop */
@media (max-width: 480px) {
body {
    padding: 1rem;
}

.buttons {
    width: 100%;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

button.neumorphic {
    border-width: 0.4rem;
    border-radius: 0.8rem;
}

.button-icon {
    height: 33cqi;
}

button.neumorphic > span {
    font-size: 16cqi;
}
}

@media (min-width: 481px) and (max-width: 768px) {
body {
    padding: 1.25rem;
}

.buttons {
    width: min(40rem, 100%);
    grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
}
}

@media (min-width: 769px) and (max-width: 1199px) {
.buttons {
    width: min(68rem, 100%);
    grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
}
}

@media (min-width: 1200px) {
.buttons {
    width: min(80rem, 100%);
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
}
}

/* Footer — neutral only (surfaces + borders; link hover uses global --link-color) */
.site-footer {
    margin-top: 0;
    padding: 0;
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    font-family: Inter, system-ui, -apple-system, sans-serif;
    border-top: 1px solid var(--border-light);
    box-shadow: 0 -0.35rem 0.9rem -0.5rem var(--shadow-card);
}

.footer-container {
    width: min(75rem, 100%);
    max-width: 100%;
    margin-inline: auto;
    background-color: var(--bg-primary);
    padding: 1.75rem 1.25rem 1.25rem;
    box-sizing: border-box;
    overflow: visible;
}

.footer-main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
}

/* Brand Section - Left */
.footer-brand-section {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.footer-logo-link {
    display: flex;
    flex-shrink: 0;
    border-radius: 0.65rem;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.footer-logo-link:hover,
.footer-logo-link:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--border-medium);
}

.footer-logo {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    display: block;
}

.footer-brand-title {
    font-family: Inter, system-ui, -apple-system, sans-serif;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.footer-description {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    line-height: 1.5;
    margin: 0;
    max-width: 36rem;
}

/* Stats + CTAs in one inset panel — less vertical stack, clearer grouping */
.footer-meta-panel {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    margin-top: 0.35rem;
    padding: 0.7rem 0.75rem;
    border-radius: 0.55rem;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-medium);
    box-shadow:
        inset 0 1px 0 0 var(--shadow-light-alt),
        0 0.06rem 0.35rem -0.06rem var(--shadow-card);
}

.footer-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

@media (min-width: 380px) {
    .footer-stats {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.footer-stat {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    min-height: 2rem;
    padding: 0.3rem 0.35rem;
    border-radius: 0.4rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-medium);
    box-shadow:
        inset 0 1px 0 0 var(--shadow-light-alt),
        0 0.04rem 0.2rem -0.04rem var(--shadow-card);
    font-size: 0.75rem;
    line-height: 1.15;
    text-align: center;
    color: var(--text-secondary);
}

.footer-stat-value {
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.footer-stat-label {
    color: var(--text-tertiary);
    font-weight: 500;
    text-transform: lowercase;
}

.footer-lead {
    margin: 0;
    padding: 0.5rem 0 0;
    border-top: 1px solid var(--border-medium);
    flex: 1;
    min-width: min(100%, 11rem);
}

.footer-lead-text {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-quaternary);
    margin: 0 0 0.4rem 0;
}

.footer-lead-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.footer-lead-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0.3rem 0.75rem;
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--link-color);
    text-decoration: none;
    border-radius: 0.45rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-medium);
    --shadow-light: var(--shadow-light-alt);
    --shadow-dark: var(--shadow-dark-alt);
    box-shadow:
        inset 0 1px 0 0 var(--shadow-light-alt),
        -0.08rem -0.08rem 0.2rem var(--shadow-light),
        0.08rem 0.08rem 0.25rem var(--shadow-dark);
    transition: color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

@media (min-width: 520px) {
    .footer-meta-panel {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-end;
        justify-content: space-between;
        gap: 0.65rem 1rem;
        padding: 0.65rem 0.85rem;
    }

    .footer-stats {
        flex: 1 1 12rem;
        min-width: min(100%, 20rem);
    }

    .footer-lead {
        padding: 0;
        border-top: 0;
        border-left: 1px solid var(--border-medium);
        margin: 0;
        padding-left: 0.85rem;
        flex: 0 1 auto;
        min-width: unset;
    }

    .footer-lead-text {
        margin: 0 0 0.35rem 0;
    }
}

.footer-lead-cta:hover,
.footer-lead-cta:focus {
    color: var(--link-hover);
    background-color: var(--bg-secondary);
    transform: translateY(-1px);
    box-shadow:
        inset 0 1px 0 0 var(--shadow-light-alt),
        -0.18rem -0.18rem 0.35rem var(--shadow-light),
        0.18rem 0.18rem 0.4rem var(--shadow-dark);
    outline: none;
}

.footer-lead-cta:focus-visible {
    outline: 2px solid var(--link-color);
    outline-offset: 2px;
}

/* Navigation Section - Right */
.footer-nav-section {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem 2rem;
}

.footer-nav-column {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.footer-nav-title {
    font-family: Inter, system-ui, -apple-system, sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-quaternary);
    margin: 0 0 0.5rem 0;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-align: left;
}

.footer-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.footer-nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 500;
    transition: color 0.2s ease;
    display: inline-block;
    line-height: 1.4;
}

.footer-nav-link:hover,
.footer-nav-link:focus {
    color: var(--link-color);
    outline: none;
}

.footer-nav-link:focus-visible {
    outline: 2px solid var(--link-color);
    outline-offset: 3px;
    border-radius: 2px;
}

/* Footer Bottom */
.footer-bottom {
    padding-top: 0.85rem;
    margin-top: 0;
    border-top: 1px solid var(--border-light);
    text-align: center;
}

.footer-bottom-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.footer-copyright {
    font-size: 0.78rem;
    color: var(--text-quaternary);
    margin: 0;
    font-weight: 400;
    line-height: 1.5;
}

/* Responsive Footer */
@media (min-width: 600px) {
    .footer-nav-section {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 992px) {
    .footer-main {
        grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
        gap: 2.5rem;
        align-items: start;
    }
    
    .footer-description {
        max-width: 22rem;
    }
    
    .footer-container {
        padding: 2rem 2rem 1.5rem;
        width: min(80rem, 100%);
    }
    
    .footer-nav-section {
        gap: 1.5rem 2.5rem;
    }

    .footer-meta-panel {
        max-width: 28rem;
    }
}

@media (max-width: 768px) {
    .footer-container {
        padding: 1.5rem 1.15rem 1.2rem;
    }

    .footer-brand-title {
        font-size: 1.25rem;
    }

    .footer-description {
        font-size: 0.84rem;
    }
}

/* History page link styles */
.history-item-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.history-item-link:hover,
.history-item-link:focus {
    text-decoration: none;
}

/* Header link styles for history page */
header h1 a {
    color: inherit;
    text-decoration: none;
}

header h1 a:hover,
header h1 a:focus {
    text-decoration: underline;
}

/* Main Navigation Styles */
.main-navigation {
    margin-top: 2rem;
    padding: 1rem 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

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

.nav-item {
    margin: 0;
}

.nav-item-theme {
    display: flex;
    align-items: center;
}

.nav-link {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    color: var(--text-primary);
    text-decoration: none;
    font-family: system-ui, sans-serif;
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    background: var(--bg-primary);
    border: 1px solid transparent;
}

.nav-link:hover,
.nav-link:focus {
    color: var(--link-color);
    background: var(--bg-secondary);
    outline: none;
}

.nav-link.active {
    color: var(--link-color);
    font-weight: 600;
    border-color: var(--link-color);
}

/* Homepage Intro Styles */
.homepage-intro {
    max-width: min(75rem, 100%);
    margin: 2rem auto 3rem;
    padding: 0 1rem;
}

.intro-text {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    text-align: left;
}

.intro-text:last-child {
    margin-bottom: 0;
}

.intro-text strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Category Description Styles */
.category-description {
    max-width: min(75rem, 100%);
    margin: 2rem auto 2.5rem;
    padding: 0 1rem;
    text-align: center;
}

.category-intro {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-secondary);
    max-width: 60rem;
    margin: 1rem auto 0;
    text-align: left;
}

.category-intro strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Breadcrumb Navigation Styles */
.breadcrumbs {
    max-width: min(75rem, 100%);
    margin: 1.5rem auto 1rem;
    padding: 0 1rem;
}

.breadcrumb-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 0.875rem;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    color: var(--text-secondary);
}

.breadcrumb-item:not(:last-child)::after {
    content: "/";
    margin-left: 0.5rem;
    color: var(--text-tertiary);
}

.breadcrumb-item a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb-item a:hover,
.breadcrumb-item a:focus {
    color: var(--link-color);
    outline: none;
}

.breadcrumb-current {
    color: var(--text-primary);
    font-weight: 500;
}

/* External Link Indicators */
.external-link {
    position: relative;
}

.external-link-indicator {
    display: inline-block;
    margin-left: 0.25rem;
    font-size: 0.75em;
    opacity: 0.6;
    vertical-align: middle;
    line-height: 1;
}

.external-link:hover .external-link-indicator,
.external-link:focus .external-link-indicator {
    opacity: 1;
}

/* FAQ: homepage accordion styles live in home.css (#main-content) */

/* Responsive Navigation */
@media (max-width: 768px) {
    .nav-list {
        gap: 0.5rem;
    }
    
    .nav-link {
        padding: 0.4rem 1rem;
        font-size: 0.875rem;
    }
    
    .homepage-intro,
    .category-description {
        margin: 1.5rem auto 2rem;
    }
    
    .intro-text,
    .category-intro {
        font-size: 1rem;
    }
    
    .breadcrumbs {
        margin: 1rem auto 0.75rem;
    }
    
    .breadcrumb-list {
        font-size: 0.8125rem;
    }
    
}