/* PROTEXIA - Prototype multi-page additions */

.skip-link {
    position: absolute;
    left: -999px;
    top: 12px;
    background: var(--primary-color);
    color: var(--bg-white);
    padding: 8px 12px;
    border-radius: 6px;
    z-index: 2000;
    text-decoration: none;
    font-weight: 600;
}

.skip-link:focus {
    left: 12px;
}

.logo {
    text-decoration: none;
    color: inherit;
}

.logo-text-wrap {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.logo-mark {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: cover;
    background: var(--primary-color);
    padding: 6px;
    box-shadow: var(--shadow-sm);
}

.nav-link.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

.menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 1px solid #e5e5e5;
    background: var(--bg-white);
    cursor: pointer;
}

.menu-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-dark);
    margin: 4px 0;
    border-radius: 2px;
}

.hero {
    /* Directional overlay: strongly dark under the left-aligned text for WCAG AA
       contrast, fading right so the brand hero image stays visible. */
    background-image: linear-gradient(to right, rgba(12, 20, 28, 0.95) 0%, rgba(15, 26, 38, 0.88) 42%, rgba(18, 32, 46, 0.60) 100%), var(--hero-image);
    background-size: cover;
    background-position: center;
}

.hero-tag {
    display: inline-block;
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    margin-bottom: var(--spacing-sm);
}

.page-hero {
    position: relative;
    min-height: 400px; /* Prevent CLS */
    padding: 120px 0 90px; /* 120px top accounts for sticky header */
    color: #ffffff;
    /* Directional overlay: dark under the left-aligned text, fading right so each
       page's distinct hero image shows through (reduces inner-hero monotony). */
    background-image: linear-gradient(to right, rgba(12, 20, 28, 0.95) 0%, rgba(15, 26, 38, 0.88) 42%, rgba(18, 32, 46, 0.60) 100%), var(--hero-image);
    background-size: cover;
    background-position: center;
}

/* Capa de patrón Nazca en los heros de páginas internas (igual que .hero en la home) */
.page-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('assets/nazca-network.svg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.85;
    z-index: 1;
    animation: nazcaPulse 12s ease-in-out infinite, subtleMove 30s ease-in-out infinite;
    pointer-events: none;
}

.page-hero-inner {
    max-width: 720px;
    position: relative;
    z-index: 2; /* por encima de la capa Nazca (::before) */
}

@media (prefers-reduced-motion: reduce) {
    .page-hero::before { animation: none; }
}

.page-hero-title {
    font-size: 44px;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5),
                 0 4px 16px rgba(0, 0, 0, 0.3);
}

.page-hero-subtitle {
    font-size: 18px;
    color: #ffffff;
    margin-bottom: var(--spacing-lg);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.page-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.page-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
}

.meta-card {
    background: rgba(255, 255, 255, 0.24);
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.section {
    padding: var(--spacing-3xl) 0;
}

.section-light {
    background: var(--bg-light);
}

.section-dark {
    background: var(--bg-darker);
    color: #ffffff;
}

.section-dark .section-title,
.section-dark .section-subtitle {
    color: #ffffff;
}

.section-dark .section-subtitle {
    color: rgba(255, 255, 255, 0.7);
}

.section-title.align-left,
.section-subtitle.align-left {
    text-align: left;
}

.center-actions {
    text-align: center;
    margin-top: var(--spacing-lg);
}

.split {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-xl);
    align-items: center;
}

.panel {
    background: var(--bg-white);
    border-radius: 16px;
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
}

.panel-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
}

.panel-text {
    color: var(--text-medium);
}

.icon-badge {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: var(--spacing-sm);
}

/* Alternar color de icon-badge */
.feature-card:nth-child(2n) .icon-badge {
    background: var(--secondary-light);
}

.feature-card:nth-child(3n) .icon-badge {
    background: #FEF5E7;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-lg);
}

.feature-card {
    background: var(--bg-white);
    border-radius: 14px;
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid #f0f0f0;
}

/* Subtle interactive depth so the repeated white card grids feel less flat
   and gain a clear hover affordance (reduces the "monotony" UX finding). */
.feature-card,
.post-card,
.meta-card,
.team-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.feature-card:hover,
.post-card:hover,
.meta-card:hover,
.team-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

@media (prefers-reduced-motion: reduce) {
    .feature-card,
    .post-card,
    .meta-card,
    .team-card {
        transition: none;
    }
    .feature-card:hover,
    .post-card:hover,
    .meta-card:hover,
    .team-card:hover {
        transform: none;
    }
}

.feature-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
}

.feature-description {
    color: var(--text-medium);
    font-size: 15px;
    line-height: 1.6;
}

.list-check {
    list-style: none;
    display: grid;
    gap: var(--spacing-xs);
}

.list-check li {
    position: relative;
    padding-left: 24px;
    color: var(--text-medium);
}

.list-check li:before {
    content: "✓";
    position: absolute;
    left: 0;
    top: 0;
    color: var(--primary-color);
    font-weight: 700;
}

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: var(--spacing-sm);
}

.tag {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-md);
}

.stat-card {
    background: var(--bg-white);
    border-radius: 12px;
    padding: var(--spacing-md);
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.stat-number {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: 14px;
    color: var(--text-medium);
}

.service-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    margin-top: var(--spacing-sm);
}

.featured-article {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: var(--spacing-xl);
    align-items: center;
}

.featured-image {
    min-height: 280px;
    border-radius: 18px;
    background: var(--gradient-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 40px;
}

.featured-meta {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-light);
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-xs);
}

.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: var(--spacing-xl);
}

.chip {
    padding: 8px 14px;
    min-height: 44px; /* WCAG touch target minimum */
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    border: 1px solid #e4e4e4;
    font-size: 14px;
    color: var(--text-medium);
    background: var(--bg-white);
    cursor: pointer;
}

.chip.active {
    background: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
}

.post-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-lg);
}

.post-card {
    background: var(--bg-white);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
}

.post-image {
    min-height: 160px;
    background: var(--gradient-teal);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 28px;
}

.post-content {
    padding: var(--spacing-md);
    flex: 1;
}

.post-meta {
    font-size: 12px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-xs);
}

.post-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
}

.post-excerpt {
    font-size: 15px;
    color: var(--text-medium);
    margin-bottom: var(--spacing-sm);
}

.post-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
}

/* Atribución de fuente del feed dinámico "Seguridad Perú" */
.post-source {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: var(--spacing-xs);
}

.feed-updated {
    text-align: center;
    font-size: 13px;
    color: var(--text-light);
    margin-top: calc(-1 * var(--spacing-sm));
    margin-bottom: var(--spacing-lg);
}

.contact-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: var(--spacing-xl);
    align-items: start;
}

.contact-card {
    background: var(--bg-white);
    border-radius: 16px;
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
}

.contact-list {
    list-style: none;
    display: grid;
    gap: var(--spacing-sm);
}

.map-panel {
    border-radius: 16px;
    min-height: 280px;
    background: repeating-linear-gradient(135deg, #f4f6f8 0 16px, #e9edf1 16px 32px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-medium);
    font-weight: 600;
    text-align: center;
    padding: var(--spacing-lg);
}

.contact-map-card {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-light, #e5e9ed);
}

.contact-map-card .panel-title {
    margin-bottom: var(--spacing-xs);
}

.contact-map-note {
    color: var(--text-medium);
    font-size: 0.9rem;
    margin-bottom: var(--spacing-sm);
}

.map-container {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.map-container iframe {
    display: block;
    width: 100%;
}

.team-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-lg);
}

.team-card {
    background: var(--bg-white);
    border-radius: 16px;
    padding: var(--spacing-lg);
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.team-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: var(--primary-dark);
    margin: 0 auto var(--spacing-sm);
}

.team-name {
    font-weight: 700;
}

.team-role {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: var(--spacing-sm);
}

.faq details {
    background: var(--bg-white);
    border-radius: 12px;
    padding: var(--spacing-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid #f0f0f0;
}

.faq details + details {
    margin-top: var(--spacing-sm);
}

.faq summary {
    cursor: pointer;
    font-weight: 600;
    list-style: none;
}

.faq summary::-webkit-details-marker {
    display: none;
}

.faq summary:after {
    content: "+";
    float: right;
    color: var(--primary-color);
    font-weight: 700;
}

.faq details[open] summary:after {
    content: "–";
}

.stagger > * {
    animation: fadeInUp 0.8s ease both;
    animation-delay: var(--delay, 0s);
}

@media (max-width: 1024px) {
    .feature-grid,
    .post-grid,
    .team-grid,
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .featured-article,
    .split {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .menu-toggle {
        display: inline-flex;
    }

    .header-content {
        position: relative;
    }

    .nav {
        position: absolute;
        top: 64px;
        right: 16px;
        background: var(--bg-white);
        box-shadow: var(--shadow-lg);
        padding: var(--spacing-md);
        border-radius: 12px;
        flex-direction: column;
        gap: var(--spacing-sm);
        display: none;
        max-width: calc(100vw - 32px);
    }

    .nav.is-open {
        display: flex;
    }

    .header-cta {
        gap: 8px;
    }

    .header-cta .btn {
        padding: 10px 14px;
        font-size: 13px;
    }

    .page-hero {
        padding: 100px 0 60px;
    }

    /* On mobile the hero text spans full width, so restore a uniform dark
       overlay (the directional desktop gradient would leave text over the
       lighter right edge). */
    .hero,
    .page-hero {
        background-image: linear-gradient(rgba(12, 20, 28, 0.92), rgba(18, 32, 46, 0.90)), var(--hero-image);
    }

    .page-hero-title {
        font-size: 28px;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .page-hero-subtitle {
        font-size: 15px;
    }

    .page-hero-actions {
        flex-direction: column;
    }

    .page-hero-actions .btn {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    .feature-grid,
    .post-grid,
    .team-grid,
    .stats-row {
        grid-template-columns: 1fr;
    }

    /* Standalone card CTAs need a comfortable touch target on mobile. */
    .post-link,
    .service-link {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    .contact-grid {
        grid-template-columns: 1fr;
    }

    .split {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .featured-article {
        grid-template-columns: 1fr;
    }

    .chip-row {
        gap: 8px;
    }

    .chip {
        font-size: 13px;
        padding: 10px 14px; /* Maintain touch-friendly size on mobile */
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .page-hero-title {
        font-size: 24px;
    }

    .page-hero-meta {
        flex-direction: column;
        gap: var(--spacing-xs);
    }

    .meta-card {
        text-align: center;
    }

    .logo-text {
        font-size: 18px;
    }

    .logo-tagline {
        font-size: 11px;
    }
}

/* Legal Content Pages */
.legal-content {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--spacing-lg) 0;
}

.legal-content h2 {
    font-size: 1.5rem;
    color: var(--text-dark);
    margin-top: var(--spacing-lg);
    margin-bottom: var(--spacing-sm);
    padding-bottom: var(--spacing-xs);
    border-bottom: 2px solid var(--primary-light);
}

.legal-content h3 {
    font-size: 1.125rem;
    color: var(--text-dark);
    margin-top: var(--spacing-md);
    margin-bottom: var(--spacing-xs);
}

.legal-content p {
    color: var(--text-medium);
    line-height: 1.7;
    margin-bottom: var(--spacing-sm);
}

.legal-content ul {
    color: var(--text-medium);
    margin-bottom: var(--spacing-sm);
    padding-left: var(--spacing-md);
}

.legal-content li {
    margin-bottom: var(--spacing-xs);
    line-height: 1.6;
}

.legal-content a {
    color: var(--primary-color);
    text-decoration: underline;
}

.legal-content a:hover {
    color: var(--primary-dark);
}

/* Disabled state for chips and buttons */
.chip:disabled,
.chip[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.chip:disabled:hover,
.chip[disabled]:hover {
    background: transparent;
    color: var(--text-medium);
}

/* Newsletter form improvements */
.newsletter-input-group {
    display: flex;
    gap: var(--spacing-xs);
    flex-wrap: wrap;
}

.newsletter-error {
    display: block;
    margin-top: var(--spacing-xs);
    font-size: 14px;
}

.newsletter-success {
    display: none;
    margin-top: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--primary-light);
    border-radius: var(--border-radius);
    color: var(--primary-dark);
    font-weight: 500;
}

.newsletter-success.visible {
    display: block;
}

/* Disabled button outline variant */
.btn-outline:disabled,
.btn-outline[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ==========================================
   DARK MODE - CONTACT & CARDS
   ========================================== */

[data-theme="dark"] .contact-card {
    background-color: #161B22;
    border: 1px solid #30363D;
}

[data-theme="dark"] .contact-card h2,
[data-theme="dark"] .contact-card h3,
[data-theme="dark"] .panel-title {
    color: #F0F6FC;
}

[data-theme="dark"] .contact-card p,
[data-theme="dark"] .section-subtitle.align-left {
    color: #C9D1D9;
}

[data-theme="dark"] .contact-list li {
    color: #C9D1D9;
}

[data-theme="dark"] .contact-list li strong {
    color: #F0F6FC;
}

[data-theme="dark"] .tag {
    background-color: rgba(46, 204, 113, 0.15);
    color: #2ECC71;
    border: 1px solid rgba(46, 204, 113, 0.3);
}

[data-theme="dark"] .diagnostic-form {
    background-color: transparent;
}

[data-theme="dark"] .section-title.align-left {
    color: #F0F6FC;
}

/* ==========================================
   LANGUAGE SWITCHER
   ========================================== */

.lang-switcher {
    margin-left: var(--spacing-sm);
}

.lang-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    background: var(--primary-light);
    border: 2px solid var(--primary-color);
    border-radius: 6px;
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 44px;
    min-height: 44px;
}

.lang-btn:hover {
    background: var(--primary-color);
    color: white;
}

[data-theme="dark"] .lang-btn {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

[data-theme="dark"] .lang-btn:hover {
    background: var(--primary-color);
    color: #0D1117;
}

@media (max-width: 768px) {
    .lang-switcher {
        position: absolute;
        top: 16px;
        right: 60px;
    }
}

/* ==========================================
   404 ERROR PAGE
   ========================================== */

.error-page {
    min-height: 60vh;
    display: flex;
    align-items: center;
    text-align: center;
}

.error-page h1 {
    font-size: 120px;
    color: var(--primary-color);
    margin: 0;
    line-height: 1;
}

.error-page h2 {
    font-size: 32px;
    margin: var(--spacing-md) 0;
    color: var(--text-dark);
}

.error-page p {
    color: var(--text-medium);
    font-size: 18px;
    max-width: 480px;
    margin: 0 auto;
}

.error-actions {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    margin-top: var(--spacing-lg);
}

@media (max-width: 768px) {
    .error-page h1 {
        font-size: 80px;
    }

    .error-page h2 {
        font-size: 24px;
    }

    .error-page p {
        font-size: 16px;
    }

    .error-actions {
        flex-direction: column;
        align-items: center;
    }

    .error-actions .btn {
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }
}

/* Dark mode for error page */
[data-theme="dark"] .error-page h2 {
    color: #F0F6FC;
}

[data-theme="dark"] .error-page p {
    color: #C9D1D9;
}

/* ==========================================
   WEBP FALLBACK FOR OLDER BROWSERS
   ========================================== */

@supports not (background-image: url("test.webp")) {
    .hero {
        background-image: linear-gradient(to right, rgba(12, 20, 28, 0.95) 0%, rgba(15, 26, 38, 0.88) 42%, rgba(18, 32, 46, 0.60) 100%), var(--hero-image-fallback, url('assets/hero-home.png'));
    }

    .page-hero {
        background-image: linear-gradient(to right, rgba(12, 20, 28, 0.95) 0%, rgba(15, 26, 38, 0.88) 42%, rgba(18, 32, 46, 0.60) 100%), var(--hero-image-fallback, url('assets/hero-servicios.png'));
    }
}
