/*
   Meeple Dates - Shared Design System
   Common variables, reset, typography, and components
*/

:root {
    /* Palette */
    --c-primary: #3A3A57;
    --c-secondary: #008080;
    --c-accent: #D50C27;
    --c-text: #3A3A57;
    --c-text-light: #5A5A72;
    --c-bg: #FFFFFF;
    --c-bg-alt: #F8F9FA;
    --c-bg-highlight: rgba(132, 200, 198, 0.15);

    /* Typography */
    --font-main: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --h1: clamp(2.5rem, 5vw, 4rem);
    --h2: clamp(2rem, 4vw, 3rem);
    --h3: 1.5rem;
    --p: 1.125rem;

    /* Layout */
    --header-height: 3.25rem;
    --container: 75rem;
    --container-reading: 50rem;
    --radius: 1.25rem;
    --shadow: 0 10px 30px rgba(58, 58, 87, 0.08);
}

/* Reset */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    color: var(--c-text);
    background-color: var(--c-bg);
    overflow-x: hidden;
    padding-top: var(--header-height);
}

a {
    text-decoration: none;
    color: inherit;
}

/* Typography */
h1, h2, h3 {
    color: var(--c-primary);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

h1 { font-size: var(--h1); }
h2 { font-size: var(--h2); }
h3 { font-size: var(--h3); }

p {
    font-size: var(--p);
    line-height: 1.6;
    color: var(--c-text-light);
    margin-bottom: 1.5rem;
}

/* Site Header */
.site-header {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 100;
    background: var(--c-primary);
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.site-header nav {
    display: flex;
    align-items: center;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 1.5rem;
    gap: 1.5rem;
    height: var(--header-height);
}

.site-header .site-logo {
    height: 2.25rem;
    width: auto;
    flex-shrink: 0;
}

.site-logo-link {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.site-header nav ul {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
}

.site-header nav ul li {
    display: flex;
    align-items: center;
}

.site-header nav a {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.0625rem;
    color: #fff;
    text-decoration: none;
    transition: color 0.2s;
    white-space: nowrap;
}

.site-header nav a:hover {
    color: var(--c-secondary);
}

/* Nav Actions (login + join grouped) */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
    flex-shrink: 0;
}

.nav-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 2rem;
    padding: 0 1.25rem;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.0625rem;
    border-radius: 50px;
    border: 1px solid transparent;
    white-space: nowrap;
    transition: all 0.3s ease;
    flex-shrink: 0;
    box-shadow: none;
}

.site-header .btn-secondary {
    background: transparent;
    color: #fff;
    border-color: var(--c-secondary);
}

.site-header .btn-secondary:hover {
    border-color: var(--c-secondary);
    animation: btn-glow 1.5s ease-in-out infinite;
    color: var(--c-secondary);
}

.site-header .btn-primary {
    background: var(--c-secondary);
    color: #fff;
    border-color: transparent;
}

.site-header .btn-primary:hover {
    transform: scale(1.05);
    animation: btn-glow 1.5s ease-in-out infinite;
    color: #fff;
}

@keyframes btn-glow {
    0%, 100% { box-shadow: 0 6px 16px rgba(199, 81, 192, 0.4); }
    50% { box-shadow: 0 8px 24px rgba(199, 81, 192, 0.7), 0 0 12px rgba(199, 81, 192, 0.3); }
}

/* Hamburger (hidden on desktop) */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 0.3rem;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 0.375rem;
    cursor: pointer;
    padding: 0.5rem;
}

.hamburger span {
    display: block;
    width: 1.25rem;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-open .hamburger span:nth-child(1) {
    transform: rotate(45deg) translate(0.25rem, 0.25rem);
}
.nav-open .hamburger span:nth-child(2) {
    opacity: 0;
}
.nav-open .hamburger span:nth-child(3) {
    transform: rotate(-45deg) translate(0.25rem, -0.25rem);
}

/* Articles Dropdown */
.nav-articles {
    position: relative;
}

.nav-articles > a {
    cursor: pointer;
}

.nav-articles .articles-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 18rem;
    max-height: 70vh;
    overflow-y: auto;
    background: var(--c-primary);
    border-radius: 0.5rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    padding: 0.5rem 0;
    z-index: 200;
    list-style: none;
    margin-top: 0.5rem;
}

.nav-articles:hover .articles-dropdown,
.nav-articles:focus-within .articles-dropdown {
    display: block;
}

.nav-articles .articles-dropdown li {
    margin: 0;
    padding: 0;
}

.nav-articles .articles-dropdown a {
    display: block;
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    white-space: normal;
    color: #fff;
    transition: background 0.2s;
}

.nav-articles .articles-dropdown a:hover {
    background: rgba(255,255,255,0.1);
    color: var(--c-secondary);
}

/* Canvas Navigation Menu with Collapsible Submenus */
.canvas-navigation-menu {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
}

.canvas-navigation-menu > li {
    display: flex;
    align-items: center;
    position: relative;
}

.canvas-navigation-menu > li > a {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.0625rem;
    color: #fff;
    text-decoration: none;
    transition: color 0.2s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem 0;
}

.canvas-navigation-menu > li > a:hover {
    color: var(--c-secondary);
}

/* Submenu Toggle Indicator - More Visible */
.canvas-navigation-menu .has-submenu > a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.canvas-navigation-menu .has-submenu > a::after {
    content: '▼';
    font-size: 0.6rem;
    transition: transform 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    opacity: 0.8;
    order: -1;
}

.canvas-navigation-menu .has-submenu:hover > a::after,
.canvas-navigation-menu .has-submenu.open > a::after {
    opacity: 1;
}

.canvas-navigation-menu .has-submenu.open > a::after {
    transform: rotate(180deg);
}

/* Submenu Container */
.canvas-navigation-submenu {
    display: none !important;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 20rem;
    max-width: 24rem;
    background: var(--c-primary);
    border-radius: 0.5rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    padding: 0.5rem 0;
    z-index: 200;
    list-style: none;
    margin-top: 0.5rem;
}

/* Show submenu on hover or when .open class is present */
.canvas-navigation-menu .has-submenu:hover .canvas-navigation-submenu,
.canvas-navigation-menu .has-submenu.open .canvas-navigation-submenu {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
}

/* Submenu Items Container with Scroll */
.canvas-navigation-submenu-items {
    max-height: 60vh;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Custom Scrollbar for Submenu */
.canvas-navigation-submenu-items::-webkit-scrollbar {
    width: 0.375rem;
}

.canvas-navigation-submenu-items::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
    border-radius: 0.5rem;
}

.canvas-navigation-submenu-items::-webkit-scrollbar-thumb {
    background: rgba(132, 200, 198, 0.5);
    border-radius: 0.5rem;
}

.canvas-navigation-submenu-items::-webkit-scrollbar-thumb:hover {
    background: rgba(132, 200, 198, 0.8);
}

.canvas-navigation-submenu li {
    margin: 0;
    padding: 0;
    display: none;
    position: relative;
    list-style: none;
    width: 100%;
}

/* Show only first 10 items by default */
.canvas-navigation-submenu li:nth-child(-n+10) {
    display: block;
}

/* Always show View More button when it exists */
.canvas-navigation-submenu li.canvas-navigation-view-more-item {
    display: block !important;
}

.canvas-navigation-submenu a {
    display: block;
    width: 100%;
    padding: 0.625rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    white-space: normal;
    text-align: left;
    color: #fff;
    text-decoration: none;
    transition: all 0.2s;
    position: relative;
}

/* Fixed-width indicator bar on the left */
.canvas-navigation-submenu a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: transparent;
    transition: background-color 0.2s;
}

.canvas-navigation-submenu a:hover::before {
    background-color: var(--c-secondary);
}

.canvas-navigation-submenu a:hover {
    background: rgba(255,255,255,0.1);
    color: var(--c-secondary);
}

/* Hidden items for View More functionality */
.canvas-navigation-submenu li.hidden-item {
    display: none !important;
}

/* When show-all is active, show all items including hidden ones */
.canvas-navigation-submenu.show-all li {
    display: block !important;
}

/* View More Button */
.canvas-navigation-view-more {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(132, 200, 198, 0.1);
    border: none;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: var(--c-secondary);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    margin-top: 0.25rem;
}

.canvas-navigation-view-more:hover {
    background: rgba(132, 200, 198, 0.2);
    color: #fff;
}

.canvas-navigation-view-more::after {
    content: ' ▼';
    font-size: 0.6rem;
    margin-left: 0.25rem;
    display: inline-block;
    transition: transform 0.3s ease;
}

.canvas-navigation-submenu.show-all .canvas-navigation-view-more::after {
    transform: rotate(180deg);
}

/* Item Counter Badge */
.canvas-navigation-counter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.375rem;
    background: var(--c-accent);
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    border-radius: 50%;
    order: 10;
}

/* Responsive Header — Hamburger Menu */
@media (max-width: 40em) {
    :root {
        --header-height: 4.875rem;
    }
    .site-header nav {
        padding: 0 1.5rem;
        gap: 1rem;
        flex-wrap: wrap;
    }
    .site-header .site-logo {
        height: 2.625rem;
        order: 1;
    }
    .hamburger {
        display: flex;
        order: 2;
        margin-left: auto;
        padding: 0.75rem;
        gap: 0.45rem;
    }
    .hamburger span {
        width: 1.875rem;
        height: 3px;
    }
    .nav-actions {
        order: 3;
        gap: 0.75rem;
        margin-left: 0;
    }
    .nav-actions .btn-secondary {
        display: none;
    }
    .nav-actions a {
        padding: 0 1.125rem;
        font-size: 1.05rem;
        height: 2.4rem;
    }
    .site-header nav ul {
        display: none;
        order: 10;
        flex-direction: column;
        width: 100%;
        gap: 0;
        padding: 0.5rem 0;
        background: var(--c-primary);
        border-top: 1px solid rgba(255,255,255,0.1);
    }
    .site-header nav.nav-open ul {
        display: flex;
    }
    .site-header nav ul li {
        width: 100%;
    }
    .site-header nav ul li a {
        display: block;
        padding: 1.125rem 1.5rem;
        font-size: 1.275rem;
    }
    .nav-articles .articles-dropdown {
        position: static;
        min-width: 0;
        box-shadow: none;
        margin-top: 0;
        border-radius: 0;
        background: rgba(255,255,255,0.05);
        max-height: 50vh;
    }
    
    /* Canvas Navigation Menu - Mobile */
    .canvas-navigation-menu {
        display: none;
        order: 10;
        flex-direction: column;
        width: 100%;
        gap: 0;
        padding: 0.5rem 0;
        background: var(--c-primary);
        border-top: 1px solid rgba(255,255,255,0.1);
    }
    
    .site-header nav.nav-open .canvas-navigation-menu {
        display: flex;
    }
    
    .canvas-navigation-menu > li {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }
    
    .canvas-navigation-menu > li > a {
        width: 100%;
        padding: 1.125rem 1.5rem;
        font-size: 1.275rem;
        justify-content: space-between;
    }
    
    .canvas-navigation-menu .has-submenu > a::after {
        font-size: 1.05rem;
        width: 2.25rem;
        height: 2.25rem;
    }
    
    .canvas-navigation-submenu {
        display: block !important;
        position: static;
        min-width: 0;
        max-width: none;
        box-shadow: none;
        margin-top: 0;
        border-radius: 0;
        background: rgba(255,255,255,0.05);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        padding: 0;
    }
    
    .canvas-navigation-menu .has-submenu.open .canvas-navigation-submenu {
        max-height: 500px;
        padding: 0.5rem 0;
    }
    
    .canvas-navigation-submenu-items {
        max-height: none;
    }
    
    .canvas-navigation-submenu a {
        padding-left: 3rem;
        font-size: 1.05rem;
    }
    
    .canvas-navigation-view-more {
        font-size: 0.7rem;
        padding: 0.625rem 1rem;
        padding-left: 2rem;
    }
}

/* Button */
.btn {
    display: inline-block;
    padding: 1rem 2.5rem;
    background: var(--c-accent);
    color: white;
    border-radius: 50px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 10px 20px rgba(199, 81, 192, 0.3);
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 15px 30px rgba(199, 81, 192, 0.4);
    background: #d66cd0;
}

/* Site Footer */
.site-footer {
    background: var(--c-bg-alt);
    padding: 3rem 1.5rem;
    text-align: center;
    margin-top: 4rem;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.site-footer p {
    margin-bottom: 1rem;
}

.site-footer nav,
.site-footer .footer-socials {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem 2rem;
}

.site-footer nav {
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.site-footer nav a,
.site-footer .footer-socials a {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--c-text-light);
    text-decoration: none;
    transition: color 0.2s;
    white-space: nowrap;
}

.site-footer nav a:hover,
.site-footer .footer-socials a:hover {
    color: var(--c-accent);
}

/* Nested .site-footer (CMS footer menu wrapper) */
.site-footer .site-footer {
    background: none;
    padding: 0;
    margin-top: 0;
    border-top: none;
}

/* Canvas Footer Menu — matches nav row styling */
.canvas-footer-menu {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem 2rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.canvas-footer-menu a {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--c-text-light);
    text-decoration: none;
    transition: color 0.2s;
    white-space: nowrap;
}

.canvas-footer-menu a:hover {
    color: var(--c-accent);
}
