/* ==========================================================================
   Preguntas frecuentes
   ========================================================================== */

.faq {
    /* Ajustá estos valores a la paleta de tu theme */
    --faq-gold: var(--color-second, #a8874f);   /* dorado de la marca */
    --faq-text: inherit;
    --faq-strong: #111111;
    --faq-muted: #6b7280;
    --faq-border: #e5e7eb;
    --faq-media-bg: #f3f2f0;
    --faq-radius: 12px;
    --faq-nav-width: 280px;
    --faq-scroll-offset: 2rem;   /* si tu header es sticky, poné acá su altura + margen */

    padding-block: 3rem;
    color: var(--faq-text);
    interpolate-size: allow-keywords;   /* permite animar hasta height: auto */
}

/* Grilla general
   - Mobile:  encabezado / todos los temas seguidos / contacto
   - Desktop: [encabezado] / [temas + contacto | preguntas]
   -------------------------------------------------------------------------- */

.faq__grid {
    display: grid;
    gap: 2.5rem;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
        "header"
        "content"
        "cta";
}

/* En mobile el sidebar se "disuelve" para ubicar el contacto al final */
.faq__sidebar { display: contents; }

.faq__header  { grid-area: header; }
.faq__content { grid-area: content; }
.faq__cta     { grid-area: cta; }

/* En mobile no hay navegación por temas: cada tema se muestra con su título */
.faq__nav { display: none; }

@media (min-width: 900px) {
    .faq__grid {
        grid-template-columns: var(--faq-nav-width) minmax(0, 1fr);
        grid-template-areas:
            "header  header"
            "sidebar content";
        column-gap: clamp(3rem, 6vw, 6rem);
        row-gap: clamp(2.5rem, 4vw, 3.5rem);
        align-items: start;
    }

    .faq__sidebar {
        display: block;
        grid-area: sidebar;
        position: sticky;
        top: var(--faq-scroll-offset);
    }

    .faq__nav { display: block; }
}

/* Encabezado: título y subtítulo apilados, con línea inferior
   -------------------------------------------------------------------------- */

.faq__header {
    padding-bottom: clamp(2rem, 4vw, 3rem);
    border-bottom: 1px solid var(--faq-border);
}

.faq__title {
    margin: 0;
    color: var(--faq-strong);
    font-size: clamp(2.25rem, 4.5vw, 3.25rem);
    font-weight: 500;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.faq__subtitle {
    max-width: 56ch;
    margin-top: 1rem;
    color: var(--faq-muted);
    font-size: 1.0625rem;
    line-height: 1.7;
}

.faq__subtitle > :first-child { margin-top: 0; }
.faq__subtitle > :last-child  { margin-bottom: 0; }

/* Navegación por temas (solo desktop): lista vertical con guion dorado
   -------------------------------------------------------------------------- */

.faq__nav-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.faq__nav-link {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.5rem 0;
    color: var(--faq-muted);
    font-size: 1.125rem;
    line-height: 1.4;
    text-decoration: none;
    transition: color 0.2s;
}

.faq__nav-link::before {
    content: "";
    flex-shrink: 0;
    width: 16px;
    height: 1px;
    margin-top: 0.7em;
    background: transparent;
    transition: background-color 0.2s, width 0.2s;
}

.faq__nav-link:hover {
    color: var(--faq-strong);
}

.faq__nav-link:hover::before {
    background: var(--faq-border);
}

.faq__nav-link:focus-visible {
    outline: 2px solid var(--faq-gold);
    outline-offset: 2px;
}

/* Tema activo (lo marca el JS) */
.faq__nav-link[aria-selected="true"] {
    color: var(--faq-strong);
    font-weight: 500;
}

.faq__nav-link[aria-selected="true"]::before {
    width: 24px;
    background: var(--faq-gold);
}

/* Grupos
   -------------------------------------------------------------------------- */

.faq__group {
    scroll-margin-top: var(--faq-scroll-offset);
}

.faq__group + .faq__group {
    margin-top: 3.5rem;
}

/* Título de cada tema: visible en mobile y sin JS; oculto en modo pestañas */
.faq__topic {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0 0 0.25rem;
    color: var(--faq-strong);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.faq__topic::before {
    content: "";
    flex-shrink: 0;
    width: 24px;
    height: 1px;
    background: var(--faq-gold);
}

/* Modo pestañas (lo activa el JS solo en desktop): un tema visible a la vez */
.faq--tabs .faq__group + .faq__group {
    margin-top: 0;
}

.faq--tabs .faq__group:focus-visible {
    outline: none;
}

.faq--tabs .faq__topic {
    display: none;
}

.faq--tabs .faq__group:not([hidden]) {
    animation: faq-fade-in 0.5s ease-out both;
}

@keyframes faq-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Acordeón: número | pregunta | ícono
   -------------------------------------------------------------------------- */

.faq__item {
    --faq-num-col: 2rem;
    --faq-col-gap: 0.75rem;

    border-bottom: 1px solid var(--faq-border);
}

@media (min-width: 900px) {
    .faq__item {
        --faq-num-col: 2.5rem;
    }
}

.faq__question {
    display: grid;
    grid-template-columns: var(--faq-num-col) minmax(0, 1fr) auto;
    align-items: baseline;
    column-gap: var(--faq-col-gap);
    padding-block: 1.375rem;
    color: var(--faq-strong);
    font-size: clamp(1.0625rem, 1.4vw, 1.25rem);
    font-weight: 500;
    line-height: 1.4;
    cursor: pointer;
    list-style: none;
}

.faq__question::-webkit-details-marker {
    display: none;
}

.faq__question:focus-visible {
    outline: 2px solid var(--faq-gold);
    outline-offset: 4px;
    border-radius: 4px;
}

.faq__num {
    color: var(--faq-gold);
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    font-variant-numeric: tabular-nums;
}

/* Ícono + que rota a × al abrir */
.faq__icon {
    position: relative;
    align-self: center;
    width: 14px;
    height: 14px;
    margin-left: 1rem;
    color: var(--faq-muted);
    transition: transform 0.3s ease, color 0.2s;
}

.faq__icon::before,
.faq__icon::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    background: currentColor;
    transform: translateY(-50%);
}

.faq__icon::after {
    transform: translateY(-50%) rotate(90deg);
}

.faq__question:hover .faq__icon {
    color: var(--faq-strong);
}

.faq__item[open] .faq__icon {
    color: var(--faq-gold);
    transform: rotate(45deg);
}

.faq__answer {
    padding: 0 2.5rem 1.75rem calc(var(--faq-num-col) + var(--faq-col-gap));
    color: var(--faq-muted);
    line-height: 1.75;
}

.faq__answer > :first-child { margin-top: 0; }
.faq__answer > :last-child  { margin-bottom: 0; }

.faq__answer a {
    color: var(--faq-strong);
    text-decoration-color: var(--faq-gold);
    text-underline-offset: 3px;
}

/* Animación de apertura (navegadores modernos; el resto abre sin animar) */
@supports selector(::details-content) {
    .faq__item::details-content {
        block-size: 0;
        overflow: hidden;
        transition: block-size 0.3s ease, content-visibility 0.3s allow-discrete;
    }

    .faq__item[open]::details-content {
        block-size: auto;
    }
}

/* Videos: tarjetas horizontales debajo de las preguntas
   Columnas según el ancho de la columna de contenido: 1 / 2 / 3 / 4
   -------------------------------------------------------------------------- */

/* La columna de contenido es la referencia de ancho para la grilla de videos */
.faq__content {
    container-type: inline-size;
}

.faq__videos {
    margin-top: 2.5rem;
}

.faq__videos-title {
    margin: 0 0 1.25rem;
    color: var(--faq-muted);
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.faq__video-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.75rem 1.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

@container (min-width: 400px) {
    .faq__video-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@container (min-width: 620px) {
    .faq__video-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@container (min-width: 760px) {
    .faq__video-list {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.faq__video-card {
    display: block;
    color: var(--faq-strong);
    text-decoration: none;
}

.faq__video-media {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--faq-media-bg);
    border-radius: var(--faq-radius);
}

.faq__video-poster {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.faq__video-card:hover .faq__video-poster {
    transform: scale(1.04);
}

/* Botón de play: círculo blanco con triángulo dorado */
.faq__video-play {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 52px;
    height: 52px;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: transform 0.3s ease, background-color 0.3s ease;
}

.faq__video-play::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 54%;
    border-style: solid;
    border-width: 8px 0 8px 13px;
    border-color: transparent transparent transparent var(--faq-gold);
    transform: translate(-50%, -50%);
}

.faq__video-card:hover .faq__video-play {
    background: #ffffff;
    transform: translate(-50%, -50%) scale(1.08);
}

.faq__video-name {
    display: block;
    margin-top: 0.75rem;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.4;
}

.faq__video-card:focus-visible {
    outline: none;
}

.faq__video-card:focus-visible .faq__video-media {
    outline: 2px solid var(--faq-gold);
    outline-offset: 3px;
}

/* Contacto: bloque de texto discreto
   - Mobile: al final, separado por una línea
   - Desktop: debajo de los temas, en la columna lateral
   -------------------------------------------------------------------------- */

.faq__cta {
    margin-top: 1rem;
    padding-top: 2rem;
    border-top: 1px solid var(--faq-border);
}

@media (min-width: 900px) {
    .faq__cta {
        margin-top: 2.5rem;
        padding-top: 1.75rem;
    }

    /* Si no hay temas, el contacto arranca arriba sin línea */
    .faq__sidebar > .faq__cta:first-child {
        margin-top: 0;
        padding-top: 0;
        border-top: 0;
    }
}

.faq__cta-title {
    margin: 0 0 0.375rem;
    color: var(--faq-strong);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
}

.faq__cta-desc {
    margin: 0 0 1rem;
    color: var(--faq-muted);
    font-size: 0.9375rem;
    line-height: 1.6;
}

.faq__cta-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 3px;
    border-bottom: 1px solid var(--faq-gold);
    color: var(--faq-strong);
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
}

.faq__cta-arrow {
    color: var(--faq-gold);
    transition: transform 0.25s ease;
}

.faq__cta-link:hover .faq__cta-arrow {
    transform: translateX(4px);
}

.faq__cta-link:focus-visible {
    outline: 2px solid var(--faq-gold);
    outline-offset: 4px;
}

/* Modal de video
   -------------------------------------------------------------------------- */

/* Bloquea el scroll de la página mientras el modal está abierto */
:root:has(.faq-video-modal[open]) {
    overflow: hidden;
}

/* Centrado explícito: no depende de los estilos del navegador ni del reset del theme */
.faq-video-modal {
    position: fixed;
    inset: 0;
    width: fit-content;
    height: fit-content;
    max-width: none;
    max-height: none;
    margin: auto;
    padding: 0;
    overflow: visible;
    background: transparent;
    border: 0;
}

.faq-video-modal::backdrop {
    background: rgba(12, 12, 12, 0.88);
}

.faq-video-modal[open] {
    animation: faq-fade-in 0.3s ease-out both;
}

.faq-video-modal[open]::backdrop {
    animation: faq-fade-in 0.3s ease-out both;
}

.faq-video-modal__inner {
    position: relative;
    /* Ancho según el alto disponible, para que el 9:16 siempre entre en pantalla */
    width: min(90vw, calc((100dvh - 9rem) * 9 / 16));
}

.faq-video-modal__frame {
    aspect-ratio: 9 / 16;
    overflow: hidden;
    background: #000000;
    border-radius: var(--faq-radius);
}

.faq-video-modal__frame iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.faq-video-modal__title {
    margin: 1rem 0 0;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9375rem;
    line-height: 1.4;
    text-align: center;
}

.faq-video-modal__close {
    position: absolute;
    top: -3.25rem;
    right: 0;
    width: 40px;
    height: 40px;
    padding: 0;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    cursor: pointer;
    transition: border-color 0.2s;
}

.faq-video-modal__close::before,
.faq-video-modal__close::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 1px;
    background: #ffffff;
}

.faq-video-modal__close::before { transform: translate(-50%, -50%) rotate(45deg); }
.faq-video-modal__close::after  { transform: translate(-50%, -50%) rotate(-45deg); }

.faq-video-modal__close:hover {
    border-color: #ffffff;
}

.faq-video-modal__close:focus-visible {
    outline: 2px solid var(--faq-gold);
    outline-offset: 3px;
}

/* Movimiento reducido
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    .faq__icon,
    .faq__nav-link,
    .faq__nav-link::before,
    .faq__cta-arrow,
    .faq__video-poster,
    .faq__video-play,
    .faq__item::details-content {
        transition: none;
    }

    .faq--tabs .faq__group:not([hidden]),
    .faq-video-modal[open],
    .faq-video-modal[open]::backdrop {
        animation: none;
    }
}