/*
Theme Name: CS Foundation
Theme URI: https://complyspec.com/theme
Author: ComplySpec
Author URI: https://complyspec.com
Description: Accessibility-first WordPress framework by ComplySpec. WCAG 2.1 AA compliant with Gutenberg blocks, PWA support, WooCommerce integration, form builder, animations, mega menu, and complete e-commerce capabilities.
Version: 2.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: cs-foundation
Tags: accessibility-ready, block-patterns, custom-colors, custom-logo, custom-menu, editor-style, featured-images, full-site-editing, one-column, two-columns, threaded-comments, translation-ready, wide-blocks, woocommerce, e-commerce, blog, portfolio

This theme, like WordPress, is licensed under the GPL.
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── CS Foundation Brand Tokens ─────────────────────────────────────────── */
:root {
    --cs-midnight: #07111C;
    --cs-slate:    #1F3A56;
    --cs-steel:    #426481;
    --cs-cyan:     #35C7F2;
    --cs-ice:      #A5D1E3;
    --cs-frost:    #E5EEF9;
    --cs-silver:   #F3F5FA;
    --cs-white:    #FFFFFF;

    --cs-font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

    /* Semantic aliases */
    --color-primary:     var(--cs-cyan);
    --color-primary-dk:  #1ba8d0;
    --color-text:        var(--cs-midnight);
    --color-text-muted:  var(--cs-steel);
    --color-heading:     var(--cs-midnight);
    --color-border:      #D1DCE8;
    --color-surface:     var(--cs-white);
    --color-surface-alt: var(--cs-silver);
    --color-nav-bg:      var(--cs-midnight);
    --color-nav-text:    var(--cs-silver);
    --color-footer-bg:   var(--cs-midnight);
}

/*
==========================================================================
TABLE OF CONTENTS
==========================================================================
1. Accessibility Core
2. Typography
3. Layout
4. Components
5. Navigation
6. Content
7. Forms
8. Responsive
9. Print Styles
*/

/*
==========================================================================
1. ACCESSIBILITY CORE
==========================================================================
*/

/* Skip to content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    z-index: 100000;
    padding: 8px 16px;
    background-color: var(--cs-cyan);
    color: var(--cs-midnight);
    text-decoration: none;
    font-weight: 600;
    border-radius: 0 0 4px 0;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid var(--cs-cyan);
    outline-offset: 2px;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus visible styles */
*:focus-visible {
    outline: 3px solid var(--cs-cyan);
    outline-offset: 2px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 3px solid var(--cs-cyan);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(53, 199, 242, 0.18);
}

/* High contrast support */
@media (prefers-contrast: high) {
    * {
        border-color: currentColor !important;
    }

    a {
        text-decoration: underline;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/*
==========================================================================
2. TYPOGRAPHY
==========================================================================
*/

/* Base font settings for optimal readability */
body {
    font-family: var(--cs-font-sans);
    font-size: 18px;
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-surface);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Proper heading hierarchy */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    margin-top: 2em;
    margin-bottom: 0.5em;
    color: var(--color-heading);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1.125rem; }

/* Ensure sufficient color contrast */
a {
    color: var(--cs-slate);
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 2px;
}

a:hover {
    color: var(--cs-cyan);
    text-decoration-thickness: 3px;
}

a:visited {
    color: var(--cs-steel);
}

/* Readable paragraph spacing */
p {
    margin-bottom: 1.5em;
}

/* Lists with proper spacing */
ul, ol {
    margin-bottom: 1.5em;
    padding-left: 2em;
}

li {
    margin-bottom: 0.5em;
}

/*
==========================================================================
3. LAYOUT
==========================================================================
*/

/* Semantic layout with ARIA landmarks */
.site {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.site-header {
    background-color: var(--color-nav-bg);
    border-bottom: 1px solid var(--cs-slate);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.site-content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    width: 100%;
}

.content-area {
    flex: 1;
}

.site-footer {
    background-color: var(--color-footer-bg);
    border-top: 1px solid var(--cs-slate);
    padding: 2rem 1rem;
    text-align: center;
    color: var(--cs-silver);
}

/* Container with accessible max-width */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/*
==========================================================================
4. COMPONENTS
==========================================================================
*/

/* Accessible buttons */
.button,
button,
input[type="submit"],
input[type="button"],
input[type="reset"] {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--cs-cyan);
    color: var(--cs-midnight);
    border: 2px solid var(--cs-cyan);
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, transform 0.1s;
    text-align: center;
}

.button:hover,
button:hover,
input[type="submit"]:hover {
    background-color: var(--color-primary-dk);
    border-color: var(--color-primary-dk);
    transform: translateY(-1px);
}

.button:active,
button:active {
    transform: translateY(0);
}

.button:disabled,
button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Card component with proper contrast */
.card {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.card-header {
    margin-bottom: 1rem;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0.5rem;
}

.card-title {
    margin: 0;
    font-size: 1.5rem;
}

.card-body {
    margin-bottom: 1rem;
}

/*
==========================================================================
5. NAVIGATION
==========================================================================
*/

/* Accessible navigation with keyboard support */
.main-navigation {
    position: relative;
}

.main-navigation ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 1rem;
}

.main-navigation li {
    margin: 0;
    position: relative;
}

.main-navigation a {
    display: block;
    padding: 1rem;
    color: var(--cs-silver);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.main-navigation a:hover,
.main-navigation a[aria-current="page"] {
    color: var(--cs-cyan);
}

/* Dropdown menus with proper ARIA */
.main-navigation ul ul {
    position: absolute;
    top: 100%;
    left: 0;
    flex-direction: column;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
}

.main-navigation li:hover > ul,
.main-navigation li:focus-within > ul {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Mobile menu toggle */
.menu-toggle {
    display: none;
    background-color: transparent;
    border: 2px solid var(--cs-cyan);
    color: var(--cs-cyan);
    padding: 0.5rem 1rem;
}

.menu-toggle[aria-expanded="true"] .icon-close {
    display: block;
}

.menu-toggle[aria-expanded="false"] .icon-close {
    display: none;
}

/*
==========================================================================
6. CONTENT
==========================================================================
*/

/* Article and post content */
.entry-header {
    margin-bottom: 2rem;
}

.entry-title {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.entry-meta {
    color: #6b7280;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.entry-content {
    line-height: 1.8;
}

/* Images with proper alt text support */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

figure {
    margin: 2rem 0;
}

figcaption {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.5rem;
    font-style: italic;
}

/* Tables with proper headers */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border: 1px solid #e5e7eb;
}

th {
    background-color: #f9fafb;
    font-weight: 600;
}

caption {
    caption-side: top;
    padding: 0.75rem;
    font-weight: 600;
    text-align: left;
}

/*
==========================================================================
7. FORMS
==========================================================================
*/

/* Accessible form styling */
label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #374151;
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="tel"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--cs-cyan);
    outline: none;
}

/* Required field indicator */
.required {
    color: #dc2626;
    font-weight: bold;
}

/* Error messages with proper association */
.error-message {
    color: #dc2626;
    background-color: #fee2e2;
    border: 2px solid #dc2626;
    border-radius: 4px;
    padding: 0.75rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.error-message::before {
    content: "⚠";
    font-size: 1.25rem;
}

/* Success messages */
.success-message {
    color: #047857;
    background-color: #d1fae5;
    border: 2px solid #047857;
    border-radius: 4px;
    padding: 0.75rem;
    margin-top: 0.5rem;
}

/* Fieldset styling */
fieldset {
    border: 2px solid #e5e7eb;
    border-radius: 4px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

legend {
    font-weight: 600;
    padding: 0 0.5rem;
    color: var(--color-heading);
}

/*
==========================================================================
8. RESPONSIVE
==========================================================================
*/

@media (max-width: 768px) {
    body {
        font-size: 16px;
    }

    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    h4 { font-size: 1.25rem; }

    .site-content {
        padding: 1rem;
    }

    .menu-toggle {
        display: block;
    }

    .main-navigation ul {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--cs-midnight);
        border: 1px solid var(--cs-slate);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }

    .main-navigation.toggled ul {
        display: flex;
    }

    .main-navigation ul ul {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        border-top: 1px solid #e5e7eb;
    }
}

/*
==========================================================================
9. PRINT STYLES
==========================================================================
*/

@media print {
    .skip-link,
    .site-header,
    .site-navigation,
    .site-footer,
    .menu-toggle,
    button {
        display: none !important;
    }

    body {
        color: #000000;
        background-color: #ffffff;
        font-size: 12pt;
    }

    a {
        text-decoration: underline;
        color: #000000;
    }

    a[href]:after {
        content: " (" attr(href) ")";
    }
}
