/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CSS Variables for theming */
:root {
    --bg-primary: #F3F0EA;
    --bg-secondary: #FFFFFF;
    --text-primary: #1B1B1B;
    --text-secondary: rgba(27, 27, 27, 0.7);
    --text-tertiary: rgba(27, 27, 27, 0.6);
    --text-quaternary: rgba(27, 27, 27, 0.5);
    --border-color: rgba(27, 27, 27, 0.08);
    --border-color-hover: rgba(27, 27, 27, 0.15);
    --shadow-color: rgba(27, 27, 27, 0.06);
    --shadow-color-strong: rgba(27, 27, 27, 0.15);
    --input-bg: #FFFFFF;
    --input-border: rgba(27, 27, 27, 0.15);
    --section-bg: rgba(27, 27, 27, 0.03);
    --badge-bg: rgba(27, 27, 27, 0.08);
    --badge-border: rgba(27, 27, 27, 0.15);
    --contrast-bg: linear-gradient(135deg, #1B1B1B 0%, #000000 100%);
    --contrast-text: #F3F0EA;
    --contrast-text-secondary: rgba(243, 240, 234, 0.7);
}

/* Dark mode variables */
body.dark-mode {
    --bg-primary: #1B1B1B;
    --bg-secondary: #2A2A2A;
    --text-primary: #F3F0EA;
    --text-secondary: rgba(243, 240, 234, 0.8);
    --text-tertiary: rgba(243, 240, 234, 0.6);
    --text-quaternary: rgba(243, 240, 234, 0.5);
    --border-color: rgba(243, 240, 234, 0.12);
    --border-color-hover: rgba(243, 240, 234, 0.25);
    --shadow-color: rgba(0, 0, 0, 0.3);
    --shadow-color-strong: rgba(0, 0, 0, 0.5);
    --input-bg: #2A2A2A;
    --input-border: rgba(243, 240, 234, 0.2);
    --section-bg: rgba(243, 240, 234, 0.05);
    --badge-bg: rgba(243, 240, 234, 0.1);
    --badge-border: rgba(243, 240, 234, 0.2);
    --contrast-bg: linear-gradient(135deg, #F3F0EA 0%, #FFFFFF 100%);
    --contrast-text: #1B1B1B;
    --contrast-text-secondary: rgba(27, 27, 27, 0.7);
}

/* Smooth transitions for interactive elements */
button, input, .badge {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'PT Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    padding: 0;
    margin: 0;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Playful background elements */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(27, 27, 27, 0.03) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    transition: background 0.3s ease;
}

body.dark-mode::before {
    background: radial-gradient(circle, rgba(243, 240, 234, 0.05) 0%, transparent 70%);
}

body::after {
    content: '';
    position: fixed;
    bottom: -30%;
    left: -5%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(27, 27, 27, 0.02) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    transition: background 0.3s ease;
}

body.dark-mode::after {
    background: radial-gradient(circle, rgba(243, 240, 234, 0.03) 0%, transparent 70%);
}

/* Dark mode toggle button */
.dark-mode-toggle {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    z-index: 1000;
    box-shadow: 0 4px 12px var(--shadow-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    touch-action: manipulation;
}

.dark-mode-toggle:hover {
    transform: scale(1.1) rotate(15deg);
    border-color: var(--border-color-hover);
    box-shadow: 0 8px 24px var(--shadow-color-strong);
}

.dark-mode-toggle:active {
    transform: scale(0.95) rotate(0deg);
}

.dark-mode-icon {
    transition: transform 0.3s ease;
}

body.dark-mode .dark-mode-icon {
    transform: rotate(180deg);
}

/* Header */
header {
    background: transparent;
    color: var(--text-primary);
    padding: 4rem 1rem 2rem;
    text-align: center;
    position: relative;
    z-index: 1;
}

header h1 {
    font-family: 'Anton', sans-serif;
    font-size: clamp(2rem, 5vw, 3.5rem);
    margin-bottom: 1.5rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    line-height: 1.1;
    color: var(--text-primary);
}


.intro {
    font-size: 1.125rem;
    max-width: 700px;
    margin: 0 auto;
    color: var(--text-secondary);
    font-weight: 400;
    line-height: 1.7;
}



/* Container and layout */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
    position: relative;
    z-index: 1;
}

.content {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
}

/* Legal pages content wrapper - wider */
.content .legal-section {
    max-width: 1000px;
}

/* Desktop: 3-column layout */
@media (min-width: 1024px) {
    .container {
        display: grid;
        grid-template-columns: 300px 300px 300px;
        gap: 2rem;
        padding: 2rem;
        justify-content: center;
    }
    
    /* Legal pages - use block layout instead of grid */
    body.legal-page .container {
        display: block !important;
        grid-template-columns: none !important;
        max-width: 1200px !important;
    }
    
    .container:has(.legal-section) {
        display: block !important;
        grid-template-columns: none !important;
        max-width: 1200px !important;
    }

    .content {
        max-width: none;
        display: contents;
    }
    
    body.legal-page .content {
        display: block !important;
        max-width: 1200px !important;
        width: 100% !important;
    }
    
    .content:has(.legal-section) {
        display: block !important;
        max-width: 1200px !important;
        width: 100% !important;
    }
    
    /* Override for legal pages - disable grid layout completely */
    .container:has(.legal-section) {
        display: block !important;
        grid-template-columns: none !important;
        max-width: 1200px !important;
    }
    
    /* Ensure content wrapper doesn't constrain legal sections */
    .content:has(.legal-section) {
        display: block !important;
        max-width: 1200px !important;
        width: 100% !important;
    }
    
    /* Direct override for legal sections - break out of grid */
    .container .legal-section {
        max-width: 1000px !important;
        margin-left: auto !important;
        margin-right: auto !important;
        width: 100% !important;
    }
    
    /* Fallback for browsers without :has() support */
    .container > .content > .legal-section {
        max-width: 1000px !important;
        margin-left: auto !important;
        margin-right: auto !important;
        width: 100% !important;
    }
    
    /* Additional fallback - if content has display: contents, legal-section is direct child */
    .container > .legal-section {
        max-width: 1000px !important;
        margin-left: auto !important;
        margin-right: auto !important;
        width: 100% !important;
    }
    
    .input-section,
    .results-section,
    .preview-section {
        width: 300px;
        height: 417px;
        margin-top: 2rem;
        margin-bottom: 0;
    }
    
    .info-section {
        grid-column: 1 / -1;
        width: 100%;
        max-width: 1200px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .faq-section {
        grid-column: 1 / -1;
        width: 100%;
        max-width: 900px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* Mobile: stack sections */
@media (max-width: 1023px) {
    .container {
        display: block;
        padding: 1rem;
    }
    
    .content {
        display: block;
    }
    
    .input-section,
    .results-section,
    .preview-section {
        width: 100%;
        height: auto;
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
    }
}

/* Sections */
section {
    background: var(--bg-secondary);
    border-radius: 32px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px var(--shadow-color), 0 2px 8px var(--shadow-color);
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* Chunking: Clear visual boundaries for content groups */
}

section h2 {
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    margin-bottom: 2rem;
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
    /* Cognitive Load: Improved visual hierarchy */
}

section h3 {
    font-size: 1.125rem;
    margin-bottom: 0.875rem;
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* Info section spacing */
.info-section {
    margin-top: 5px;
}

.info-section p {
    margin-bottom: 2rem;
    line-height: 1.8;
}

.info-section h3 {
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

.info-section h3:first-of-type {
    margin-top: 0;
}

/* Input section */
.input-section {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
    overflow: hidden;
    width: 300px;
    height: 417px;
    box-sizing: border-box;
}

@media (max-width: 1023px) {
    .input-section {
        width: 100%;
        height: auto;
        max-width: 100%;
        padding: 2rem 1.5rem;
    }
}

/* Chunking: Group related color inputs visually */
.input-group-wrapper {
    background: transparent;
    border-radius: 24px;
    padding: 0;
    margin-bottom: 0;
    border: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
    flex: 1;
    overflow: visible;
    width: 100%;
    min-height: 0;
}

@media (max-width: 640px) {
    .input-group-wrapper {
        gap: 1.25rem;
    }
}


.color-input-group {
    margin-bottom: 0;
    position: relative;
    /* Law of Proximity: Label, input, and error grouped together */
}


/* Law of Proximity: Swap button closer to color inputs */
.input-section .button-group,
.input-group-wrapper .button-group {
    margin-top: auto;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
    flex-shrink: 0;
    width: 100%;
}

@media (max-width: 640px) {
    .input-section .button-group,
    .input-group-wrapper .button-group {
        flex-direction: column;
        gap: 0.875rem;
    }
}

.input-section .btn {
    padding: 0.75rem 1.25rem;
    min-height: 44px;
    font-size: 0.875rem;
    width: 100%;
}

.color-input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    font-size: 0.9375rem;
    text-align: center;
}

.color-input-group label > span:first-child {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-tertiary);
    font-size: 0.8125rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input-wrapper {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
    /* Fitts's Law: Better spacing between related elements */
    width: 100%;
}

input[type="color"] {
    width: 56px;
    height: 56px;
    min-width: 48px;
    min-height: 48px;
    border: 2px solid var(--input-border);
    border-radius: 16px;
    cursor: pointer;
    background: var(--input-bg);
    padding: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px var(--shadow-color);
    /* Fitts's Law: Ensure adequate touch target */
    touch-action: manipulation;
    flex-shrink: 0;
}

input[type="color"]:hover {
    border-color: var(--text-primary);
    opacity: 0.9;
    transform: scale(1.02);
}

input[type="color"]:active {
    transform: scale(0.95) rotate(0deg);
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 12px;
}

input[type="text"] {
    flex: 1;
    padding: 0.75rem 1rem;
    min-height: 48px;
    border: 2px solid var(--input-border);
    border-radius: 16px;
    font-size: 0.875rem;
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px var(--shadow-color);
    /* Fitts's Law: Adequate touch target size */
    touch-action: manipulation;
    min-width: 0;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--text-primary);
    background: var(--input-bg);
    box-shadow: 0 4px 16px var(--shadow-color-strong), 0 0 0 4px var(--section-bg);
    transform: translateY(-2px);
}

input[type="text"]::placeholder {
    color: var(--text-quaternary);
}

input[type="text"].error {
    border-color: #ff453a;
    background: #fff5f5;
    box-shadow: 0 4px 16px rgba(255, 69, 58, 0.15);
}

.error-message {
    display: block;
    color: #ff453a;
    font-size: 0.75rem;
    margin-top: 0.5rem;
    min-height: 1rem;
    font-weight: 500;
    text-align: center;
}

/* Buttons */
.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 2rem;
    /* Fitts's Law: Increased spacing between interactive elements */
}

.btn {
    padding: 1rem 2rem;
    min-height: 56px;
    min-width: 56px;
    border: none;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    letter-spacing: -0.01em;
    /* Fitts's Law: WCAG minimum touch target size */
    touch-action: manipulation;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background-color: var(--text-primary);
    color: var(--bg-primary);
    box-shadow: 0 4px 16px var(--shadow-color-strong);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--text-primary);
    opacity: 0.9;
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 8px 24px var(--shadow-color-strong);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(-2px) scale(1);
    box-shadow: 0 4px 12px rgba(27, 27, 27, 0.25);
}

.btn-primary:disabled {
    background-color: var(--section-bg);
    color: var(--text-quaternary);
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    box-shadow: 0 2px 8px var(--shadow-color);
}

.btn-secondary:hover {
    background-color: var(--section-bg);
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 8px 24px var(--shadow-color-strong);
    border-color: var(--border-color-hover);
}

.btn-secondary:active {
    transform: translateY(-2px) scale(1);
    box-shadow: 0 4px 12px rgba(27, 27, 27, 0.12);
}

/* Results section sizing */
.results-section {
    width: 300px;
    height: 417px;
    box-sizing: border-box;
}

@media (max-width: 1023px) {
    .results-section {
        width: 100%;
        height: auto;
        max-width: 100%;
    }
}

/* Preview section */
.preview-section {
    margin-top: 2rem;
    padding: 1.5rem;
    box-sizing: border-box;
}

.preview-section h2 {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    margin-bottom: 1rem;
}

@media (min-width: 1024px) {
    .preview-section {
        width: 300px;
        height: 417px;
        overflow: hidden;
    }
}

@media (max-width: 1023px) {
    .preview-section {
        width: 100%;
        height: auto;
        max-width: 100%;
    }
}

.preview-card {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 24px;
    padding: 1.5rem;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    /* Chunking: Preview content visually separated */
    margin-top: 1rem;
    box-shadow: 0 8px 32px var(--shadow-color);
    position: relative;
    overflow: hidden;
    flex: 1;
    /* Aesthetic-Usability: Smooth color transitions */
}

@media (min-width: 1024px) {
    .preview-card {
        margin-top: 0.75rem;
    }
}

.preview-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, var(--section-bg) 0%, transparent 70%);
    pointer-events: none;
}

.preview-text {
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.6;
    transition: color 0.3s ease;
    position: relative;
    z-index: 1;
}

@media (min-width: 1024px) {
    .preview-text {
        font-size: 0.9375rem;
    }
}

.preview-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
    position: relative;
    z-index: 1;
}

.preview-btn {
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    font-family: inherit;
    letter-spacing: -0.01em;
    touch-action: manipulation;
    min-height: 44px;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.preview-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.preview-btn:active {
    transform: translateY(0);
}

.preview-btn-primary {
    background-color: var(--preview-btn-bg, var(--text-primary));
    color: var(--preview-btn-text, var(--bg-primary));
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.preview-btn-secondary {
    background-color: var(--preview-btn-secondary-bg, rgba(27, 27, 27, 0.1));
    color: var(--preview-btn-secondary-text, var(--text-primary));
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.preview-btn-outline {
    background-color: transparent;
    color: var(--preview-btn-outline-text, var(--text-primary));
    border: 2px solid var(--preview-btn-outline-border, var(--text-primary));
    box-shadow: none;
}

.preview-btn-outline:hover {
    background-color: var(--preview-btn-outline-hover-bg, rgba(27, 27, 27, 0.05));
}

@media (min-width: 1024px) {
    .preview-btn {
        font-size: 0.8125rem;
        padding: 0.625rem 1rem;
        min-height: 40px;
    }
}


/* Results section */
.results-section {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 1.5rem;
}

.results-section h2 {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.results-section .contrast-ratio {
    padding: 1rem 0.75rem;
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}

.results-section .ratio-label {
    font-size: 0.6875rem;
    margin-bottom: 0.375rem;
}

.results-section .ratio-value {
    font-size: clamp(1.5rem, 4vw, 2rem);
}

.results-section .wcag-results {
    padding: 0.75rem;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    grid-template-columns: 1fr;
}

.results-section .wcag-group h3 {
    font-size: 0.75rem;
    margin-bottom: 0.375rem;
}

.results-section .badge {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    min-width: 50px;
}

.results-section .results-actions {
    margin-top: 0;
    flex-shrink: 0;
}

.results-section .results-actions .btn {
    padding: 0.625rem 1.25rem;
    min-height: 40px;
    font-size: 0.8125rem;
    width: 100%;
}

.results-actions {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    position: relative;
}

.results-actions::before {
    content: '';
    position: absolute;
    top: -1rem;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
    border-radius: 1px;
}

/* Aesthetic-Usability: Enhanced copy button feedback */
.btn-primary.btn-copied {
    background-color: #30d158;
    color: #1B1B1B;
    animation: copySuccess 0.5s ease;
}

@keyframes copySuccess {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.contrast-ratio {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--contrast-bg);
    border-radius: 32px;
    margin-bottom: 2rem;
    border: none;
    position: relative;
    overflow: hidden;
    /* Von Restorff Effect: Enhanced visual prominence */
    box-shadow: 0 12px 48px var(--shadow-color-strong), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.contrast-ratio::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.05) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.ratio-label {
    display: block;
    font-size: 0.9375rem;
    color: var(--contrast-text-secondary);
    margin-bottom: 1rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    position: relative;
    z-index: 1;
}

.ratio-value {
    display: block;
    font-size: clamp(3rem, 8vw, 5rem);
    font-weight: 900;
    color: var(--contrast-text);
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
    letter-spacing: -0.03em;
    /* Von Restorff Effect: Most prominent element */
    text-shadow: 0 4px 16px var(--shadow-color-strong);
    transition: transform 0.3s ease, font-size 0.3s ease;
    position: relative;
    z-index: 1;
    line-height: 1;
}

.ratio-value.ratio-updated {
    animation: ratioPulse 0.3s ease;
}

@keyframes ratioPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.wcag-results {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    /* Law of Proximity: Related WCAG results grouped together */
    padding: 2rem;
    background: var(--section-bg);
    border-radius: 24px;
    border: 1px solid var(--border-color);
}

.wcag-group {
    /* Law of Proximity: Badges grouped with their label */
    position: relative;
}


.wcag-group h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.badge {
    display: inline-block;
    padding: 0.875rem 1.75rem;
    border-radius: 16px;
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    min-width: 90px;
    letter-spacing: 0.05em;
    /* Von Restorff Effect: Enhanced visibility */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 2px solid transparent;
}

.badge.pass {
    background-color: #30d158;
    color: #1B1B1B;
    border-color: rgba(48, 209, 88, 0.4);
    /* Von Restorff: Stand out with stronger color */
    box-shadow: 0 4px 16px rgba(48, 209, 88, 0.3);
}

.badge.fail {
    background-color: #ff453a;
    color: #FFFFFF;
    border-color: rgba(255, 69, 58, 0.4);
    /* Von Restorff: Stand out with stronger color */
    box-shadow: 0 4px 16px rgba(255, 69, 58, 0.3);
}

.badge.neutral {
    background-color: var(--badge-bg);
    color: var(--text-quaternary);
    border: 2px solid var(--badge-border);
    box-shadow: 0 2px 8px var(--shadow-color);
}

/* FAQ section - Progressive Disclosure (Cognitive Load) */
/* SEO: Using semantic <details><summary> for better SEO and accessibility */
.faq-section {
    margin-top: 3rem;
}

.faq-item {
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 1rem;
    transition: all 0.3s ease;
}

.faq-item:hover {
    border-bottom-color: var(--border-color-hover);
}

.faq-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Style details element */
.faq-item details {
    display: block;
}

/* Remove default summary marker and style it like the old button */
.faq-toggle {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: none;
    border: none;
    padding: 1.25rem 0;
    cursor: pointer;
    text-align: left;
    color: var(--text-primary);
    transition: all 0.3s ease;
    border-radius: 12px;
    list-style: none;
}

/* Remove default summary marker */
.faq-toggle::-webkit-details-marker {
    display: none;
}

.faq-toggle::marker {
    display: none;
}

.faq-toggle:hover {
    color: var(--text-primary);
    background: var(--section-bg);
    padding-left: 1rem;
    padding-right: 1rem;
}

.faq-toggle h3 {
    color: inherit;
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    flex: 1;
    line-height: 1.4;
}

.faq-icon {
    font-size: 1.75rem;
    font-weight: 300;
    color: var(--text-quaternary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 32px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--section-bg);
}

.faq-icon::before {
    content: '+';
}

.faq-toggle:hover .faq-icon {
    color: var(--text-primary);
    background: var(--badge-bg);
    transform: rotate(90deg);
}

/* Change icon when details is open */
.faq-item[open] .faq-icon {
    transform: rotate(45deg);
    color: var(--text-primary);
}

.faq-item[open] .faq-icon::before {
    content: '−';
}

.faq-item:not([open]) .faq-icon::before {
    content: '+';
}

.faq-item[open] .faq-toggle:hover .faq-icon {
    transform: rotate(90deg);
}

.faq-content {
    padding-bottom: 1.5rem;
    padding-left: 0;
    padding-top: 0.5rem;
}

.faq-content p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin: 0;
    font-size: 1rem;
}

/* Sponsored / ads section - clearly separated and placed below main content */
.sponsored-section {
    grid-column: 1 / -1;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.sponsored-section p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.ad-wrapper {
    min-height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Footer */
footer {
    text-align: center;
    padding: 4rem 1rem 3rem;
    color: var(--text-tertiary);
    font-size: 0.9375rem;
    margin-top: 4rem;
    border-top: 1px solid var(--border-color);
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

footer > p {
    margin: 0;
    text-align: center;
}

/* Footer Navigation */
.footer-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin: 0 auto 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
}

.footer-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9375rem;
    transition: color 0.3s ease;
    position: relative;
    display: inline-block;
}

.footer-nav a:hover {
    color: var(--text-primary);
}

.footer-nav a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: var(--text-primary);
    transition: width 0.3s ease;
}

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


/* Smooth page transitions */
* {
    transition-property: background-color, border-color, color, transform, box-shadow, opacity;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Playful entrance animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

section {
    animation: fadeInUp 0.6s ease-out;
}

section:nth-child(1) { animation-delay: 0.1s; }
section:nth-child(2) { animation-delay: 0.2s; }
section:nth-child(3) { animation-delay: 0.3s; }
section:nth-child(4) { animation-delay: 0.4s; }

/* Responsive adjustments */
@media (max-width: 768px) {
    .dark-mode-toggle {
        top: 1rem;
        right: 1rem;
        width: 44px;
        height: 44px;
        font-size: 1.25rem;
    }

    header {
        padding: 3.5rem 1rem 2rem;
    }

    section {
        padding: 2rem 1.5rem;
    }

    .container {
        padding: 1.5rem 1rem;
    }
}

@media (max-width: 640px) {
    header {
        padding: 3.5rem 1rem 1.5rem;
    }
    
    .dark-mode-toggle {
        top: 0.75rem;
        right: 0.75rem;
        width: 44px;
        height: 44px;
        font-size: 1.25rem;
    }

    header h1 {
        font-size: clamp(1.75rem, 6vw, 2.5rem);
        margin-bottom: 1rem;
    }

    .intro {
        font-size: 1rem;
        line-height: 1.6;
        padding: 0 0.5rem;
    }

    section {
        padding: 1.5rem 1.25rem;
        border-radius: 20px;
        margin-bottom: 1.5rem;
    }

    section h2 {
        font-size: clamp(1.5rem, 5vw, 2rem);
        margin-bottom: 1.5rem;
    }

    .input-section {
        padding: 1.5rem 1.25rem;
    }

    .input-group-wrapper {
        padding: 0;
        gap: 1.25rem;
    }

    .color-input-group label {
        font-size: 0.875rem;
        margin-bottom: 0.625rem;
    }

    .color-input-group label > span:first-child {
        font-size: 0.75rem;
        margin-bottom: 0.375rem;
    }

    .input-wrapper {
        gap: 0.625rem;
    }

    input[type="color"] {
        width: 56px;
        height: 56px;
        min-width: 56px;
        min-height: 56px;
        flex-shrink: 0;
    }

    input[type="text"] {
        padding: 0.875rem 1rem;
        min-height: 56px;
        font-size: 0.9375rem;
    }

    .input-section .button-group {
        margin-top: 1.5rem;
        gap: 0.875rem;
        width: 100%;
    }

    .input-section .btn {
        padding: 0.875rem 1.5rem;
        min-height: 56px;
        font-size: 0.9375rem;
        width: 100%;
    }

    .wcag-results {
        grid-template-columns: 1fr;
        padding: 1.5rem;
        gap: 1.25rem;
    }

    .wcag-group h3 {
        font-size: 0.9375rem;
        margin-bottom: 0.875rem;
    }

    .badge {
        padding: 0.75rem 1.5rem;
        font-size: 0.9375rem;
        min-width: 80px;
    }

    .button-group {
        flex-direction: column;
        gap: 0.875rem;
    }

    .btn {
        width: 100%;
        min-height: 56px;
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }

    .ratio-value {
        font-size: clamp(2.5rem, 12vw, 4rem);
    }
    
    .contrast-ratio {
        padding: 2rem 1.5rem;
        margin-bottom: 1.5rem;
    }

    .ratio-label {
        font-size: 0.875rem;
        margin-bottom: 0.875rem;
    }

    .preview-card {
        padding: 2rem 1.5rem;
        border-radius: 20px;
        gap: 1.25rem;
    }

    .preview-text {
        font-size: 0.9375rem;
        line-height: 1.6;
    }

    .preview-buttons {
        gap: 0.875rem;
        margin-top: 0.75rem;
    }

    .preview-btn {
        padding: 0.875rem 1.25rem;
        min-height: 56px;
        font-size: 0.9375rem;
    }

    /* Reset scaled styles on mobile for results-section */
    .results-section {
        padding: 1.5rem 1.25rem;
    }

    .results-section h2 {
        font-size: clamp(1.5rem, 5vw, 2rem);
        margin-bottom: 1.25rem;
    }

    .results-section .contrast-ratio {
        padding: 2rem 1.5rem;
        margin-bottom: 1.5rem;
    }

    .results-section .ratio-label {
        font-size: 0.875rem;
        margin-bottom: 0.875rem;
    }

    .results-section .ratio-value {
        font-size: clamp(2.5rem, 12vw, 4rem);
    }

    .results-section .wcag-results {
        padding: 1.5rem;
        gap: 1.25rem;
        margin-bottom: 1.5rem;
    }

    .results-section .wcag-group h3 {
        font-size: 0.9375rem;
        margin-bottom: 0.875rem;
    }

    .results-section .badge {
        padding: 0.75rem 1.5rem;
        font-size: 0.9375rem;
        min-width: 80px;
    }

    .results-section .results-actions {
        margin-top: 1.5rem;
    }

    .results-section .results-actions .btn {
        padding: 1rem 1.5rem;
        min-height: 56px;
        font-size: 1rem;
        width: 100%;
    }

    .container {
        padding: 0.75rem;
    }

    .info-section {
        padding: 1.5rem 1.25rem;
    }

    .info-section h3 {
        font-size: 1.125rem;
        margin-top: 2rem;
        margin-bottom: 0.875rem;
    }

    .info-section p {
        font-size: 0.9375rem;
        line-height: 1.7;
        margin-bottom: 1.5rem;
    }

    .faq-section {
        padding: 1.5rem 1.25rem;
    }

    .faq-toggle {
        padding: 1rem 0;
    }

    .faq-toggle h3 {
        font-size: 1rem;
    }

    .faq-content {
        padding-top: 0.75rem;
        padding-bottom: 1.25rem;
    }

    .faq-content p {
        font-size: 0.9375rem;
        line-height: 1.7;
    }
    
    .footer-nav {
        flex-direction: column;
        gap: 1rem;
        padding-bottom: 1.25rem;
    }

    footer {
        padding: 3rem 1rem 2rem;
        font-size: 0.875rem;
    }
}

/* Cookie Consent Banner */
.consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 2px solid var(--border-color);
    box-shadow: 0 -4px 24px var(--shadow-color-strong);
    z-index: 10000;
    transform: translateY(100%);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
    max-height: 90vh;
    overflow-y: auto;
}

.consent-banner-visible {
    transform: translateY(0);
    opacity: 1;
}

.consent-banner-hidden {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}

.consent-banner-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.consent-banner-text {
    flex: 1;
}

.consent-banner-text p {
    margin: 0;
    color: var(--text-primary);
    font-size: 0.9375rem;
    line-height: 1.6;
}

.consent-banner-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: flex-end;
}

.consent-btn {
    padding: 0.75rem 1.5rem;
    min-height: 44px;
    border: none;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    touch-action: manipulation;
    white-space: nowrap;
}

.consent-btn-accept {
    background-color: var(--text-primary);
    color: var(--bg-primary);
    box-shadow: 0 2px 8px var(--shadow-color);
}

.consent-btn-accept:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-color-strong);
}

.consent-btn-reject {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    box-shadow: 0 2px 8px var(--shadow-color);
}

.consent-btn-reject:hover {
    background-color: var(--section-bg);
    border-color: var(--border-color-hover);
    transform: translateY(-2px);
}

.consent-btn-customize {
    background-color: var(--section-bg);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.consent-btn-customize:hover {
    background-color: var(--badge-bg);
    border-color: var(--border-color-hover);
    transform: translateY(-2px);
}

.consent-btn-save {
    background-color: var(--text-primary);
    color: var(--bg-primary);
    width: 100%;
    margin-top: 1rem;
}

.consent-btn-save:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-color-strong);
}

/* Customize Panel */
.consent-customize {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-top: 1px solid var(--border-color);
    background: var(--section-bg);
}

.consent-customize-open {
    max-height: 600px;
}

.consent-customize-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.consent-customize-content h3 {
    margin: 0 0 0.75rem 0;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.consent-customize-content > p {
    margin: 0 0 1.5rem 0;
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.consent-toggle-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.consent-toggle-item {
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.consent-toggle-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    gap: 1rem;
}

.consent-toggle-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.consent-toggle-text strong {
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-weight: 600;
}

.consent-toggle-desc {
    color: var(--text-tertiary);
    font-size: 0.8125rem;
    line-height: 1.4;
}

/* Toggle Switch */
.consent-toggle {
    position: relative;
    width: 48px;
    height: 28px;
    appearance: none;
    background: var(--badge-bg);
    border-radius: 14px;
    outline: none;
    cursor: pointer;
    transition: background 0.3s ease;
    flex-shrink: 0;
}

.consent-toggle:checked {
    background: var(--text-primary);
}

.consent-toggle:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.consent-toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    background: var(--bg-primary);
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px var(--shadow-color);
}

.consent-toggle:checked + .consent-toggle-slider {
    transform: translateX(20px);
}

.consent-customize-actions {
    margin-top: 1.5rem;
}

/* Legal Pages Styling */
.legal-section {
    max-width: 1000px !important;
    margin: 0 auto !important;
    padding: 2.5rem;
    width: 100% !important;
    box-sizing: border-box;
}

/* Ensure legal sections are not constrained by parent max-widths */
.content .legal-section {
    max-width: 1000px !important;
    width: 100% !important;
}

.legal-section h2 {
    margin-top: 2.5rem;
    margin-bottom: 1.5rem;
    font-size: clamp(1.5rem, 4vw, 2rem);
}

.legal-section h2:first-of-type {
    margin-top: 0;
}

.legal-section h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.legal-section p {
    margin-bottom: 1.25rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

.legal-section ul,
.legal-section ol {
    margin-bottom: 1.25rem;
    padding-left: 2rem;
    line-height: 1.8;
}

.legal-section li {
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}

.legal-section a {
    color: var(--text-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: opacity 0.3s ease;
}

.legal-section a:hover {
    opacity: 0.7;
}

.legal-action {
    margin: 2rem 0;
    text-align: center;
}

/* Contact Page Specific */
.contact-info {
    margin: 2rem 0;
    padding: 2rem;
    background: var(--section-bg);
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.contact-email {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin: 1rem 0;
}

.email-address {
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
    font-size: 1.125rem;
    color: var(--text-primary);
    margin: 0;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    flex: 1;
    min-width: 200px;
}

.contact-note {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    font-style: italic;
    margin-top: 0.5rem;
}

/* Responsive: Cookie Banner */
@media (max-width: 640px) {
    .consent-banner-content {
        padding: 1.25rem;
    }
    
    .consent-banner-actions {
        flex-direction: column;
    }
    
    .consent-btn {
        width: 100%;
    }
    
    .consent-customize-content {
        padding: 1.5rem 1.25rem;
    }
    
    .legal-section {
        padding: 2rem 1.5rem;
    }
    
    .contact-email {
        flex-direction: column;
    }
    
    .email-address {
        width: 100%;
    }
}
