/* =========================
   RESET + BASE
========================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Rubik', sans-serif;
    color: #ffffff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    background-color: #0b0b0b;
    background-image: url('../img/fondo.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

/* =========================
   VARIABLES
========================= */
:root {
    --black: #0b0b0b;
    --white: #ffffff;
    --gray: #ffffff;
    --autobot-red: #e10600;
    --decepticon-purple: #6a00ff;
    --terrorcon-orange: #ff6a00;
    --predacon-blue: #0080ff;
    --maximal-green: #00b36b;
    --mercenary-white: #f5f5f5;
    --transition-fast: 0.3s ease;
}

/* =========================
   HEADER
========================= */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: #000;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #222;
}

.header__icon { width: 50px; }

.header__title {
    height: 60px;
    cursor: pointer;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.header__title:hover {
    transform: scale(1.15);
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.5));
}

/* Enlace derecho del Header */
.header__link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--white);
    margin-right: 0;
    transition: transform 0.3s ease;
}

.header__link img {
    width: 35px;
    height: auto;
    margin-bottom: 2px;
    opacity: 0.9;
    transition: opacity 0.3s;
}

.header__link p {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
    margin: 0;
}

.header__link:hover {
    transform: scale(1.1);
    cursor: pointer;
}

.header__link:hover img {
    opacity: 1;
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.8));
}

/* =========================
   INTRO & TÍTULO
========================= */
.intro {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    
    /* Fondo específico de esta página */
    background-image: url('../img/personajesfondo.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    
    padding: 4rem 2rem;
    text-align: center;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    border-bottom: 2px solid #333;
}

/* Velo oscuro para legibilidad */
.intro::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 0;
}

.intro__img, 
.intro__text,
.intro__title {
    position: relative;
    z-index: 1; 
}

.intro__img {
    max-width: 90%;
    height: auto;
    display: block;
}

.intro__text {
    max-width: 900px;
    margin: auto;
    font-size: 1rem;
    color: var(--gray);
    line-height: 1.6;
}

.intro__title {
    font-size: 2.5rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 4px;
    margin-bottom: 1.5rem;
    color: var(--gray);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    animation: fadeInUp 1s ease-out;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    .intro__title {
        font-size: 1.5rem;
        letter-spacing: 2px;
    }
}

input[type="radio"] {
    display: none;
}

/* =========================
   FACTIONS BAR (MENÚ)
========================= */
.factions {
    background-color: #000;
    padding: 1.5rem 3rem;
    border-top: 1px solid #1a1a1a;
    border-bottom: 1px solid #1a1a1a;
}

.factions__list {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 3rem;
}

.faction {
    display: flex;
    flex-direction: column;   
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    color: #fff;
    text-align: center;
    transition: transform var(--transition-fast), filter var(--transition-fast);
}

.faction img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 0.5rem;
    transition: filter 0.3s ease, transform 0.3s ease;
}

.faction span {
    font-size: 0.9rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 600;
}

.faction:hover {
    transform: scale(1.1);
}

/* =========================
   ESTADOS ACTIVOS (FACTIONS)
========================= */
/* Autobots */
#autobots:checked ~ .factions .faction--autobots img {
    filter: drop-shadow(0 0 15px var(--autobot-red));
    transform: scale(1.2);
}
#autobots:checked ~ .factions .faction--autobots span {
    color: var(--autobot-red);
    font-weight: 800;
    text-shadow: 0 0 10px rgba(225, 6, 0, 0.6);
}

/* Decepticons */
#decepticons:checked ~ .factions .faction--decepticons img {
    filter: drop-shadow(0 0 15px var(--decepticon-purple));
    transform: scale(1.2);
}
#decepticons:checked ~ .factions .faction--decepticons span {
    color: var(--decepticon-purple);
    font-weight: 800;
    text-shadow: 0 0 10px rgba(106, 0, 255, 0.6);
}

/* Maximals */
#maximals:checked ~ .factions .faction--maximals img {
    filter: drop-shadow(0 0 15px var(--maximal-green));
    transform: scale(1.2);
}
#maximals:checked ~ .factions .faction--maximals span {
    color: var(--maximal-green);
    font-weight: 800;
    text-shadow: 0 0 10px rgba(0, 179, 107, 0.6);
}

/* Predacons */
#predacons:checked ~ .factions .faction--predacons img {
    filter: drop-shadow(0 0 15px var(--predacon-blue));
    transform: scale(1.2);
}
#predacons:checked ~ .factions .faction--predacons span {
    color: var(--predacon-blue);
    font-weight: 800;
    text-shadow: 0 0 10px rgba(0, 128, 255, 0.6);
}

/* Terrorcons */
#terrorcons:checked ~ .factions .faction--terrorcons img {
    filter: drop-shadow(0 0 15px var(--terrorcon-orange));
    transform: scale(1.2);
}
#terrorcons:checked ~ .factions .faction--terrorcons span {
    color: var(--terrorcon-orange);
    font-weight: 800;
    text-shadow: 0 0 10px rgba(255, 106, 0, 0.6);
}

/* Mercenarios */
#mercenaries:checked ~ .factions .faction--mercenaries img {
    filter: drop-shadow(0 0 15px var(--mercenary-white));
    transform: scale(1.2);
}
#mercenaries:checked ~ .factions .faction--mercenaries span {
    color: var(--mercenary-white);
    font-weight: 800;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.6);
}

/* =========================
   CONTENEDOR PRINCIPAL
========================= */
.faction-content {
    position: relative;
    height: 600px; 
    width: 100%;
    max-width: 1200px;
    margin: 2rem auto;
    overflow: hidden;
}

/* Estilo base de cada facción */
.content {
    position: absolute;
    inset: 0;
    padding: 2rem 4rem;
    
    /* Display BLOCK importante para sistema de personajes internos */
    display: block !important; 
    
    opacity: 0;
    pointer-events: none;
    transform: translateY(30px) scale(0.98);
    filter: blur(8px);
    z-index: 1;

    transition: opacity 0.5s ease-out, transform 0.5s ease-out, filter 0.5s ease-out;
}

/* Activación de Facciones Principales */
#autobots:checked ~ .faction-content .content--autobots,
#decepticons:checked ~ .faction-content .content--decepticons,
#maximals:checked ~ .faction-content .content--maximals,
#predacons:checked ~ .faction-content .content--predacons,
#terrorcons:checked ~ .faction-content .content--terrorcons,
#mercenaries:checked ~ .faction-content .content--mercenaries {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    filter: blur(0);
    z-index: 10;
}

/* Colores de Títulos por Facción */
.content--autobots h2 { color: var(--autobot-red); text-shadow: 0 0 25px rgba(225, 6, 0, 0.4); }
.content--decepticons h2 { color: var(--decepticon-purple); text-shadow: 0 0 25px rgba(106, 0, 255, 0.4); }
.content--maximals h2 { color: var(--maximal-green); text-shadow: 0 0 25px rgba(0, 179, 107, 0.4); }
.content--predacons h2 { color: var(--predacon-blue); text-shadow: 0 0 25px rgba(0, 128, 255, 0.4); }
.content--terrorcons h2 { color: var(--terrorcon-orange); text-shadow: 0 0 25px rgba(255, 106, 0, 0.4); }
.content--mercenaries h2 { color: var(--mercenary-white); text-shadow: 0 0 25px rgba(245, 245, 245, 0.4); }

/* =======================================================
   SISTEMA DE PERSONAJES INTERNOS (SLIDES)
======================================================= */
.character-slide {
    display: none; /* Ocultos por defecto */
    grid-template-columns: 45% 55%; 
    align-items: center;
    gap: 4rem;
    height: 100%;
    animation: fadeInChar 0.5s ease;
}

@keyframes fadeInChar {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Lógica de visualización de personajes */
#auto_optimus:checked ~ .slide-optimus,
#auto_bee:checked ~ .slide-bee,
#auto_ratchet:checked ~ .slide-ratchet,
#decep_megatron:checked ~ .slide-megatron,
#decep_starscream:checked ~ .slide-starscream,
#decep_soundwave:checked ~ .slide-soundwave,
#max_primal:checked ~ .slide-primal,
#max_rhinox:checked ~ .slide-rhinox,
#max_cheetor:checked ~ .slide-cheetor,
#pred_megatron:checked ~ .slide-pred-megatron,
#pred_waspinator:checked ~ .slide-waspinator,
#pred_dinobot:checked ~ .slide-dinobot,
#terr_scourge:checked ~ .slide-scourge,
#terr_battletrap:checked ~ .slide-battletrap,
#terr_nightbird:checked ~ .slide-nightbird,
#merc_lockdown:checked ~ .slide-lockdown,
#merc_doubledealer:checked ~ .slide-doubledealer,
#merc_swindle:checked ~ .slide-swindle {
    display: grid;
}

/* Estilos de Contenido Interno */
.leader {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.leader img {
    max-width: 100%;
    max-height: 500px;
    object-fit: contain;
    filter: drop-shadow(0 15px 30px rgba(0,0,0,0.6));
}

.content article h2 {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    font-weight: 800;
    line-height: 1;
}

.content article p {
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--gray);
    text-align: justify;
}

/* =========================
   FLECHAS DE NAVEGACIÓN
========================= */
.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    user-select: none;
    transition: 0.3s;
    z-index: 20;
    border: 1px solid rgba(255,255,255,0.2);
}

.nav-arrow.left { left: 0px; }
.nav-arrow.right { right: 0px; }

/* Colores de flechas por facción */
.nav-arrow:hover {
    background: #e10600; /* Default Autobot */
    transform: translateY(-50%) scale(1.1);
}

.content--decepticons .nav-arrow:hover {
    background-color: #6a00ff;
    border-color: #6a00ff;
    box-shadow: 0 0 15px #6a00ff;
}

.content--maximals .nav-arrow:hover {
    background-color: #00b36b;
    border-color: #00b36b;
    box-shadow: 0 0 15px #00b36b;
}

.content--predacons .nav-arrow:hover {
    background-color: #0080ff;
    border-color: #0080ff;
    box-shadow: 0 0 15px #0080ff;
}

.content--terrorcons .nav-arrow:hover {
    background-color: #ff6a00;
    border-color: #ff6a00;
    box-shadow: 0 0 15px #ff6a00;
}

.content--mercenaries .nav-arrow:hover {
    background-color: #f5f5f5;
    border-color: #f5f5f5;
    box-shadow: 0 0 15px #f5f5f5;
}

/* =========================
   FOOTER
========================= */
.footer {
    background-color: #000;
    padding: 3rem 0;
    margin-top: auto;
    border-top: 1px solid #222;
}

.footer__links {
    max-width: 800px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.footer__link {
    text-decoration: none;
    color: var(--white);
    text-align: center;
    transition: transform var(--transition-fast);
}

.footer__link img {
    width: 50px;
    margin-bottom: 0.8rem;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.footer__link:hover {
    transform: translateY(-5px);
}

.footer__link:hover img {
    opacity: 1;
}

/* =========================
   REPRODUCTOR DE AUDIO
========================= */
.audio-player {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    width: 300px;
    height: 40px;
    opacity: 0.6;
    filter: invert(1) hue-rotate(180deg);
    border-radius: 20px;
    transition: opacity 0.3s ease;
}

.audio-player:hover {
    opacity: 1;
    box-shadow: 0 0 15px rgba(0, 128, 255, 0.5);
}