/* Main CSS for PrimetimePokemon Theme
 * Contains core styles for the theme
 */

/* Base Styles */
html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--current-text-primary);
    background-color: var(--current-bg-primary);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Accessibility */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--type-electric);
    color: #000;
    padding: 8px;
    z-index: var(--z-50);
    transition: top 0.3s;
}

.skip-to-content:focus {
    top: 0;
}

.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

.screen-reader-text:focus {
    background-color: var(--current-bg-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    clip: auto !important;
    clip-path: none;
    color: var(--current-text-primary);
    display: block;
    font-size: var(--font-size-base);
    height: auto;
    left: 5px;
    line-height: normal;
    padding: 15px 23px 14px;
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: 100000;
}

/* Focus styles for keyboard navigation */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus,
[tabindex]:focus {
    outline: 3px solid var(--type-electric);
    outline-offset: 2px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    margin-bottom: var(--space-4);
    font-weight: 700;
    line-height: 1.2;
}

h1 {
    font-size: var(--font-size-4xl);
}

h2 {
    font-size: var(--font-size-3xl);
}

h3 {
    font-size: var(--font-size-2xl);
}

h4 {
    font-size: var(--font-size-xl);
}

h5 {
    font-size: var(--font-size-lg);
}

h6 {
    font-size: var(--font-size-base);
}

p {
    margin-top: 0;
    margin-bottom: var(--space-4);
}

/* Base link styles
 * All links are underlined by default to improve discoverability and meet
 * accessibility best practices. The color for visited links differs from
 * unvisited links to provide additional context. Specific contexts such as
 * navigation menus override the underline to maintain their design.
 */
a {
    color: var(--type-electric);
    text-decoration: underline;
    transition: color var(--transition-fast);
}

a:hover,
a:focus {
    color: var(--type-fire);
    text-decoration: underline;
}

a:visited {
    color: var(--link-visited);
}

/* Header */
.header {
    background-color: var(--current-bg-secondary);
    border-bottom: 1px solid var(--current-border-color);
    padding: var(--space-3) 0;
    position: sticky;
    top: 0;
    z-index: var(--z-30);
}

.nav-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-4);
}

.logo {
    display: block;
    margin-right: var(--space-4);
}

.logo img {
    max-height: 50px;
    width: auto;
}

.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}

.nav-menu li {
    margin-right: var(--space-4);
}

.nav-menu a {
    color: var(--current-text-primary);
    font-weight: 500;
    padding: var(--space-2) 0;
    display: block;
    position: relative;
    text-decoration: none; /* override global underline */
}

.nav-menu a:hover {
    color: var(--type-electric);
    text-decoration: none;
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--type-electric);
    transition: width var(--transition-base);
}

.nav-menu a:hover::after {
    width: 100%;
}

.search-form {
    display: flex;
    margin-left: auto;
}

.search-field {
    background-color: var(--current-bg-input);
    border: 1px solid var(--current-border-color);
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    color: var(--current-text-primary);
    padding: var(--space-2) var(--space-3);
    min-width: 200px;
}

.search-submit {
    background-color: var(--type-electric);
    border: none;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    color: #000;
    cursor: pointer;
    font-weight: 500;
    padding: var(--space-2) var(--space-3);
    transition: background-color var(--transition-fast);
}

.search-submit:hover {
    background-color: var(--type-fire);
}

/* Mobile menu toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--current-text-primary);
    font-size: var(--font-size-xl);
    cursor: pointer;
    padding: var(--space-2);
}

/* Main Content */
.site-content {
    flex: 1;
    padding: var(--space-6) 0;
}

/* Footer */
.site-footer {
    background-color: var(--current-bg-secondary);
    border-top: 1px solid var(--current-border-color);
    padding: var(--space-8) 0 var(--space-4);
    margin-top: auto;
}

.footer-widgets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-6);
    margin-bottom: var(--space-6);
}

.footer-widget h3 {
    font-size: var(--font-size-lg);
    margin-bottom: var(--space-4);
    position: relative;
    padding-bottom: var(--space-2);
}

.footer-widget h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 2px;
    background: var(--type-electric);
}

.footer-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-menu li {
    margin-bottom: var(--space-2);
}

.footer-menu a {
    color: var(--current-text-secondary);
    text-decoration: none; /* override global underline */
}

.footer-menu a:hover {
    color: var(--type-electric);
    text-decoration: none;
}

.social-links {
    display: flex;
    gap: var(--space-3);
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--current-bg-tertiary);
    color: var(--current-text-primary);
    transition: all var(--transition-fast);
}

.social-link:hover {
    background-color: var(--type-electric);
    color: #000;
    text-decoration: none;
}

.newsletter-form {
    display: flex;
    margin-top: var(--space-3);
}

.newsletter-input {
    background-color: var(--current-bg-input);
    border: 1px solid var(--current-border-color);
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    color: var(--current-text-primary);
    padding: var(--space-2) var(--space-3);
    flex: 1;
}

.newsletter-submit {
    background-color: var(--type-electric);
    border: none;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    color: #000;
    cursor: pointer;
    font-weight: 500;
    padding: var(--space-2) var(--space-3);
    transition: background-color var(--transition-fast);
}

.newsletter-submit:hover {
    background-color: var(--type-fire);
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: var(--space-4);
    border-top: 1px solid var(--current-border-color);
    color: var(--current-text-muted);
    font-size: var(--font-size-sm);
}

.footer-links {
    display: flex;
    gap: var(--space-4);
}

.footer-links a {
    color: var(--current-text-muted);
    text-decoration: none; /* override global underline */
}

.footer-links a:hover {
    color: var(--type-electric);
    text-decoration: none;
}

/* Theme Toggle */
.theme-toggle-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: var(--z-40);
    display: flex;
    align-items: center;
    background: var(--current-bg-secondary);
    border: 1px solid var(--current-border-color);
    border-radius: 30px;
    padding: 5px 15px;
    box-shadow: var(--shadow-md);
}

.theme-toggle-label {
    margin-right: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--current-text-secondary);
}

/* Accessibility Controls */
.accessibility-controls {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: var(--z-40);
    display: flex;
    align-items: center;
    background: var(--current-bg-secondary);
    border: 1px solid var(--current-border-color);
    border-radius: 30px;
    padding: 5px 15px;
    box-shadow: var(--shadow-md);
}

.accessibility-controls span {
    margin-right: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--current-text-secondary);
}

.accessibility-controls label {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 26px;
}

.accessibility-controls input {
    opacity: 0;
    width: 0;
    height: 0;
}

.accessibility-controls span:last-child {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-primary);
    transition: 0.4s;
    border-radius: 34px;
}

.accessibility-controls span:last-child:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

.accessibility-controls input:checked + span:last-child:before {
    transform: translateX(26px);
}

/* Responsive styles */
@media (max-width: 1200px) {
    .nav-container {
        padding: 0 var(--space-3);
    }
}

@media (max-width: 992px) {
    .footer-widgets {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .nav-menu {
        margin-right: var(--space-3);
    }
    
    .nav-menu li {
        margin-right: var(--space-3);
    }
}

@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }
    
    .nav-menu {
        flex-basis: 100%;
        flex-direction: column;
        display: none;
        margin-top: var(--space-3);
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .nav-menu li {
        margin-right: 0;
        margin-bottom: var(--space-2);
    }
    
    .search-form {
        flex-basis: 100%;
        margin-top: var(--space-3);
        margin-left: 0;
    }
    
    .search-field {
        flex: 1;
    }
}

@media (max-width: 576px) {
    .footer-widgets {
        grid-template-columns: 1fr;
    }
    
    .footer-bottom {
        flex-direction: column;
        gap: var(--space-3);
        text-align: center;
    }
    
    h1 {
        font-size: var(--font-size-3xl);
    }
    
    h2 {
        font-size: var(--font-size-2xl);
    }
    
    h3 {
        font-size: var(--font-size-xl);
    }
}

/* Print styles */
@media print {
    .header,
    .site-footer,
    .theme-toggle-container,
    .accessibility-controls {
        display: none;
    }
    
    body {
        background-color: #fff;
        color: #000;
    }
    
    a {
        color: #000;
        text-decoration: underline;
    }
    
    .container {
        max-width: 100%;
        width: 100%;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
