/* Variables CSS para temas claro y oscuro */
:root {
    /* Colores de texto - WCAG AA compliant */
    --color-text-primary: #1f2937;      /* 16.1:1 AAA */
    --color-text-secondary: #4b5563;    /* 7.21:1 AAA */
    --color-link: #2563eb;              /* 7.0:1 AA */
    --color-link-hover: #1d4ed8;

    /* Colores de fondo */
    --color-bg-white: #ffffff;
    --color-bg-light: #f9fafb;
    --color-bg-header: #667eea;

    /* Colores de estado */
    --color-success: #10b981;
    --color-focus: #667eea;

    /* Sombras */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
}

/* Modo oscuro */
@media (prefers-color-scheme: dark) {
    :root {
        --color-text-primary: #f9fafb;        /* 14.7:1 AAA */
        --color-text-secondary: #e5e7eb;      /* 12.6:1 AAA */
        --color-link: #60a5fa;                /* 7.5:1 AAA */
        --color-link-hover: #93c5fd;

        --color-bg-white: #1f2937;
        --color-bg-light: #374151;
        --color-bg-header: #1e293b;

        --color-success: #34d399;
        --color-focus: #818cf8;
    }
}

/* Reset y estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Clase para ocultar visualmente pero mantener accesible */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Skip link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--color-focus);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 0 0 8px 0;
    font-weight: 600;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid #fff;
    outline-offset: 2px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--color-text-primary);
    background: var(--color-bg-light);
    padding: 0;
    margin: 0;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: var(--color-bg-white);
    min-height: 100vh;
    box-shadow: var(--shadow-lg);
}

/* Header */
.header {
    background: var(--color-bg-header);
    color: white;
    padding: 30px 40px;
    box-shadow: var(--shadow-md);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

.escudo-logo {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
}

.header h1 {
    font-size: 32px;
    font-weight: 700;
    margin: 0;
}

/* Main content */
main {
    padding: 40px;
}

/* Secciones */
section {
    margin-bottom: 40px;
}

section:last-child {
    margin-bottom: 0;
}

/* Encabezados */
h2 {
    color: var(--color-text-primary);
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 3px solid var(--color-bg-header);
}

h3 {
    color: var(--color-text-primary);
    font-size: 22px;
    font-weight: 600;
    margin-top: 24px;
    margin-bottom: 12px;
}

h4 {
    color: var(--color-text-secondary);
    font-size: 18px;
    font-weight: 600;
    margin-top: 16px;
    margin-bottom: 8px;
}

/* Párrafos */
p {
    color: var(--color-text-secondary);
    margin-bottom: 16px;
    font-size: 16px;
}

p:last-child {
    margin-bottom: 0;
}

/* Estado de cumplimiento */
.status-compliant {
    background: var(--color-bg-light);
    padding: 16px 20px;
    border-left: 4px solid var(--color-success);
    border-radius: 4px;
    font-size: 17px;
}

/* Listas */
ul, ol {
    margin-left: 24px;
    margin-bottom: 16px;
    color: var(--color-text-secondary);
}

ul li, ol li {
    margin-bottom: 8px;
    padding-left: 8px;
}

ul ul, ol ul, ul ol, ol ol {
    margin-top: 8px;
    margin-bottom: 8px;
}

/* Enlaces */
a {
    color: var(--color-link);
    text-decoration: underline;
    font-weight: 500;
}

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

a:focus {
    outline: 3px solid var(--color-focus);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Código */
code {
    background: var(--color-bg-light);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    color: var(--color-text-primary);
}

/* Address */
address {
    font-style: normal;
    background: var(--color-bg-light);
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

address p {
    margin-bottom: 12px;
}

address p:last-child {
    margin-bottom: 0;
}

/* Time */
time {
    font-weight: 600;
    color: var(--color-text-primary);
}

/* Strong */
strong {
    font-weight: 600;
    color: var(--color-text-primary);
}

/* Footer */
.footer {
    background: var(--color-bg-light);
    padding: 30px 40px;
    border-top: 1px solid #e5e7eb;
}

@media (prefers-color-scheme: dark) {
    .footer {
        border-top-color: #4b5563;
    }
}

.footer nav ul {
    list-style: none;
    margin: 0 0 20px 0;
    padding: 0;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.footer nav li {
    margin: 0;
    padding: 0;
}

.footer nav a {
    display: inline-block;
    padding: 8px 16px;
    background: var(--color-bg-white);
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.2s ease;
}

@media (prefers-reduced-motion: reduce) {
    .footer nav a {
        transition: none;
    }
}

.footer nav a:hover {
    transform: translateY(-2px);
}

@media (prefers-reduced-motion: reduce) {
    .footer nav a:hover {
        transform: none;
    }
}

.footer-credits {
    color: var(--color-text-secondary);
    font-size: 14px;
    text-align: center;
}

/* Focus visible para teclado */
*:focus {
    outline: none;
}

*:focus-visible {
    outline: 3px solid var(--color-focus);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Alto contraste */
@media (prefers-contrast: high) {
    *:focus-visible {
        outline-width: 4px;
        outline-color: CanvasText;
    }

    .header {
        border-bottom: 2px solid;
    }

    h2 {
        border-bottom-width: 4px;
    }
}

/* Responsive - Móvil */
@media (max-width: 640px) {
    .header {
        padding: 20px;
    }

    .header h1 {
        font-size: 24px;
    }

    .escudo-logo {
        width: 50px;
        height: 50px;
    }

    main {
        padding: 20px;
    }

    h2 {
        font-size: 24px;
    }

    h3 {
        font-size: 20px;
    }

    h4 {
        font-size: 16px;
    }

    p, ul, ol {
        font-size: 15px;
    }

    .footer {
        padding: 20px;
    }

    .footer nav ul {
        flex-direction: column;
        gap: 10px;
    }

    .footer nav a {
        display: block;
        text-align: center;
    }
}

/* Responsive - Tablet */
@media (min-width: 641px) and (max-width: 1024px) {
    .header {
        padding: 25px 30px;
    }

    main {
        padding: 30px;
    }

    .footer {
        padding: 25px 30px;
    }
}

/* Touch targets mínimos 44x44px */
@media (pointer: coarse) {
    a {
        min-height: 44px;
        min-width: 44px;
        display: inline-block;
        padding: 8px 12px;
    }

    .footer nav a {
        min-height: 44px;
        padding: 12px 16px;
    }
}

/* Impresión */
@media print {
    body {
        background: white;
        color: black;
    }

    .container {
        box-shadow: none;
    }

    .header {
        background: white;
        color: black;
        border-bottom: 2px solid black;
    }

    .skip-link,
    .footer nav {
        display: none;
    }

    a {
        color: black;
        text-decoration: underline;
    }

    a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 12px;
    }

    section {
        page-break-inside: avoid;
    }

    h2 {
        page-break-after: avoid;
    }
}
