/*
Theme Name: Cádiz Noticias
Theme URI: https://cadiznoticias.es
Author: Cádiz Noticias
Description: Tema propio ligero para periódico digital local.
Version: 1.0
Text Domain: cadiznoticias
*/

/* =========================
   BASE
========================= */

:root {
    --cn-primary: #970900;
    --cn-menu: #c40000;
    --cn-text: #111;
    --cn-muted: #777;
    --cn-border: #ddd;
    --cn-bg: #f4f4f4;
    --cn-white: #fff;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--cn-bg);
    color: var(--cn-text);
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
}

.container,
.cn-container {
    max-width: 1180px;
    margin: 30px auto;
    padding: 0 15px;
}

/* =========================
   HEADER
========================= */

.site-header {
    background: var(--cn-white);
    border-bottom: 1px solid var(--cn-border);
}

.top-billboard {
    max-width: 970px;
    margin: 0 auto;
    padding: 10px 15px 0;
    text-align: center;
}

.ad-label {
    display: block;
    font-size: 12px;
    color: #aaa;
    text-align: center;
    margin-bottom: 4px;
}

.cn-ad-widget,
.cn-widget,
.top-billboard img,
.header-banner img,
.header-banner iframe,
.header-banner ins {
    max-width: 100%;
}

.news-ticker-bar {
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    background: var(--cn-white);
}

.ticker-inner {
    max-width: 1180px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    min-height: 42px;
    font-size: 15px;
    padding: 0 15px;
}

.today-date {
    padding-right: 18px;
    color: #222;
    white-space: nowrap;
}

.ticker-label {
    background: #ef3f3f;
    color: #fff;
    padding: 13px 16px;
    font-weight: bold;
    white-space: nowrap;
}

.ticker-news {
    overflow: hidden;
    white-space: nowrap;
    padding-left: 14px;
}

.ticker-news a {
    margin-right: 35px;
    color: #222;
}

.header-main {
    max-width: 1180px;
    margin: 0 auto;
    padding: 35px 15px 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
}

.site-logo img {
    max-width: 260px;
    height: auto;
}

.site-logo a,
.logo {
    font-size: 34px;
    font-weight: 800;
    color: var(--cn-primary);
}

.header-banner {
    width: 728px;
    max-width: 100%;
    text-align: center;
}

.main-menu {
    max-width: 1180px;
    margin: 0 auto;
    background: var(--cn-menu);
}

.main-menu ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
}

.main-menu li {
    position: relative;
}

.main-menu li a {
    display: block;
    padding: 17px 18px;
    color: #fff;
    font-weight: 700;
    font-size: 15px;
}

.main-menu li a:hover {
    background: var(--cn-primary);
}

/* =========================
   PORTADA: BLOQUE PRINCIPAL
========================= */

.cn-hero {
    display: grid;
    grid-template-columns: minmax(0, 2fr) 320px;
    gap: 30px;
    align-items: start;
    margin-bottom: 50px;
}

.cn-hero-card {
    background: var(--cn-white);
}

.cn-hero-card h1 {
    font-size: 38px;
    line-height: 1.15;
    margin: 12px 0 0;
    color: var(--cn-text);
}

.cn-hero-image img {
    width: 100%;
    height: auto;
    display: block;
}

.cn-hero-ad {
    text-align: center;
}

.cn-hero-ad img,
.cn-hero-ad iframe,
.cn-hero-ad ins {
    max-width: 100%;
}

/* =========================
   FECHAS
========================= */

.cn-post-date,
.post-date {
    margin-top: 10px;
    font-size: 13px;
    color: var(--cn-muted);
}

/* =========================
   SECCIONES PORTADA
========================= */

.cn-home-section {
    margin-bottom: 50px;
}

.cn-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--cn-primary);
    margin-bottom: 20px;
}

.cn-section-header h2 {
    margin: 0;
    padding: 0 0 8px;
    font-size: 28px;
    color: var(--cn-primary);
}

.cn-section-header a {
    color: var(--cn-primary);
    font-size: 14px;
    font-weight: bold;
}

.cn-section-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.cn-news-card {
    background: var(--cn-white);
}

.cn-news-image {
    overflow: hidden;
    background: #eee;
}

.cn-news-image img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
}

.cn-news-card h3 {
    font-size: 22px;
    line-height: 1.25;
    margin: 10px 0 0;
    color: var(--cn-text);
}

.cn-between-ad {
    margin: 40px 0;
    text-align: center;
}

/* =========================
   PLANTILLAS ANTIGUAS / FALLBACK
========================= */

.news-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 25px;
}

.main-story,
.news-card,
.article {
    background: var(--cn-white);
    padding: 15px;
    border: 1px solid var(--cn-border);
}

.main-story h1 {
    font-size: 34px;
    margin: 10px 0;
}

.news-card h2 {
    font-size: 20px;
    margin: 10px 0;
}

.post-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
}

.article {
    padding: 25px;
}

.article h1 {
    font-size: 38px;
    margin-top: 0;
}

.article-content {
    font-size: 19px;
    line-height: 1.65;
}

/* =========================
   FOOTER
========================= */

.footer-ad {
    text-align: center;
    margin-top: 40px;
}

.site-footer {
    background: #222;
    color: #fff;
    text-align: center;
    padding: 25px;
    margin-top: 40px;
}

/* =========================
   TABLET
========================= */

@media (max-width: 1024px) {
    .cn-hero {
        grid-template-columns: 1fr;
    }

    .cn-section-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .header-main {
        display: block;
        text-align: center;
    }

    .header-banner {
        width: 100%;
        margin-top: 20px;
    }
}

/* =========================
   MÓVIL
========================= */

@media (max-width: 768px) {
    .container,
    .cn-container {
        margin: 20px auto;
        padding: 0 12px;
    }

    .ticker-inner {
        display: block;
        padding: 0;
    }

    .today-date,
    .ticker-label,
    .ticker-news {
        display: block;
        padding: 10px 15px;
    }

    .ticker-news {
        overflow-x: auto;
    }

    .header-main {
        padding: 25px 12px 20px;
    }

    .site-logo img {
        max-width: 230px;
    }

    .site-logo a,
    .logo {
        font-size: 28px;
    }

    .header-banner {
        width: 100%;
        overflow: hidden;
    }

    .main-menu {
        max-width: 100%;
    }

    .main-menu ul {
        display: block;
    }

    .main-menu li a {
        padding: 14px 15px;
        border-bottom: 1px solid rgba(255,255,255,.15);
    }

    .cn-section-grid,
    .news-grid {
        grid-template-columns: 1fr;
    }

    .cn-hero-card h1 {
        font-size: 30px;
    }

    .cn-section-header h2 {
        font-size: 24px;
    }

    .cn-news-card h3 {
        font-size: 21px;
    }
}


/* =========================
   TICKER ÚLTIMAS NOTICIAS - SLIDER
========================= */

.news-ticker-bar {
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    background: var(--cn-white);
}

.ticker-inner {
    max-width: 1180px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    align-items: center;
    min-height: 42px;
    font-size: 15px;
    padding: 0 15px;
    gap: 0;
}

.today-date {
    padding-right: 18px;
    color: #222;
    white-space: nowrap;
}

.ticker-label {
    background: #ef3f3f;
    color: #fff;
    padding: 13px 16px;
    font-weight: bold;
    white-space: nowrap;
}

.ticker-news {
    min-width: 0;
    height: 42px;
    line-height: 42px;
    overflow: hidden;
    white-space: nowrap;
    padding: 0 14px;
    position: relative;
}

.ticker-news a,
.ticker-news .ticker-slide {
    display: none;
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    margin: 0;
    color: #222;
}

.ticker-news a.is-active,
.ticker-news .ticker-slide.is-active,
.ticker-news a:first-child {
    display: block;
}

.ticker-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ticker-button,
.ticker-prev,
.ticker-next {
    width: 26px;
    height: 26px;
    border: 1px solid #ddd;
    background: #fff;
    color: #333;
    font-size: 15px;
    line-height: 22px;
    cursor: pointer;
    border-radius: 2px;
}

.ticker-button:hover,
.ticker-prev:hover,
.ticker-next:hover {
    background: #f5f5f5;
}

/* Si el header actualizado usa botones fuera del contenedor, los recolocamos */
.news-ticker-bar button {
    flex: 0 0 auto;
}

/* =========================
   AJUSTE DE IMÁGENES CON PROPORCIÓN FIJA
========================= */

.cn-hero-image img,
.cn-news-image img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
}

/* =========================
   RESPONSIVE DEL TICKER
========================= */

@media (max-width: 768px) {
    .ticker-inner {
        display: grid;
        grid-template-columns: 1fr auto;
        padding: 0 12px;
        row-gap: 0;
    }

    .today-date {
        grid-column: 1 / -1;
        padding: 9px 0;
    }

    .ticker-label {
        grid-column: 1 / -1;
        padding: 10px 12px;
        text-align: center;
    }

    .ticker-news {
        height: 40px;
        line-height: 40px;
        padding: 0 8px 0 0;
        overflow: hidden;
    }

    .ticker-controls {
        justify-content: flex-end;
    }
}


/* =========================
   TICKER DEFINITIVO - HEADER(2).PHP
   Compatible con:
   .ticker-slider > button + .ticker-window > .ticker-track > .ticker-item
========================= */

.news-ticker-bar {
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    background: var(--cn-white);
}

.ticker-inner {
    max-width: 1180px;
    margin: 0 auto;
    min-height: 42px;
    padding: 0 15px;
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    align-items: center;
    font-size: 15px;
}

.today-date {
    padding-right: 18px;
    color: #222;
    white-space: nowrap;
}

.ticker-label {
    background: #ef3f3f;
    color: #fff;
    padding: 13px 16px;
    font-weight: 700;
    white-space: nowrap;
}

.ticker-slider {
    min-width: 0;
    height: 42px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding-left: 12px;
}

.ticker-window {
    min-width: 0;
    flex: 1 1 auto;
    height: 42px;
    overflow: hidden;
}

.ticker-track {
    position: relative;
    height: 42px;
    overflow: hidden;
}

.ticker-item {
    display: none;
    width: 100%;
    height: 42px;
    line-height: 42px;
    color: #222;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.ticker-item.is-active {
    display: block;
}

.ticker-button {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 1px solid #ddd;
    background: #fff;
    color: #333;
    font-size: 17px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    border-radius: 2px;
}

.ticker-button:hover {
    background: #f5f5f5;
}

/* Anulamos reglas antiguas del primer ticker */
.ticker-news {
    display: none;
}

/* =========================
   MÓVIL - TICKER
========================= */

@media (max-width: 768px) {
    .ticker-inner {
        display: grid;
        grid-template-columns: 1fr;
        padding: 0 12px 8px;
    }

    .today-date {
        padding: 9px 0;
    }

    .ticker-label {
        display: inline-block;
        width: max-content;
        max-width: 100%;
        padding: 10px 12px;
    }

    .ticker-slider {
        width: 100%;
        padding-left: 0;
        margin-top: 6px;
    }

    .ticker-window,
    .ticker-track,
    .ticker-item {
        height: 38px;
        line-height: 38px;
    }
}

/* =========================
   MENÚ DESPLEGABLE
========================= */

.main-menu {
    position: relative;
    z-index: 1000;
}

.main-menu ul {
    list-style: none;
}

.main-menu > ul,
.main-menu .menu {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

/* Primer nivel */
.main-menu > ul > li,
.main-menu .menu > li {
    position: relative;
}

/* Submenús */
.main-menu ul ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    margin: 0;
    padding: 0;
    background: var(--cn-menu);
    box-shadow: 0 8px 18px rgba(0,0,0,.18);
    z-index: 9999;
    flex-wrap: nowrap;
}

.main-menu ul li:hover > ul,
.main-menu ul li:focus-within > ul {
    display: block;
}

.main-menu ul ul li {
    position: relative;
    width: 100%;
}

.main-menu ul ul li a {
    display: block;
    padding: 13px 16px;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    border-bottom: 1px solid rgba(255,255,255,.12);
}

.main-menu ul ul li a:hover {
    background: var(--cn-primary);
}

/* Tercer nivel */
.main-menu ul ul ul {
    top: 0;
    left: 100%;
}

/* Indicador visual de que hay desplegable */
.main-menu li.menu-item-has-children > a::after {
    content: " ▾";
    font-size: 11px;
}

.main-menu ul ul li.menu-item-has-children > a::after {
    content: " ›";
    float: right;
}

/* =========================
   MENÚ EN MÓVIL
========================= */

@media (max-width: 768px) {
    .main-menu > ul,
    .main-menu .menu {
        display: block;
    }

    .main-menu li {
        width: 100%;
    }

    .main-menu ul ul {
        position: static;
        display: block;
        min-width: 0;
        width: 100%;
        box-shadow: none;
        background: rgba(0,0,0,.12);
    }

    .main-menu ul ul li a {
        padding-left: 30px;
        white-space: normal;
    }

    .main-menu ul ul ul li a {
        padding-left: 45px;
    }

    .main-menu li.menu-item-has-children > a::after,
    .main-menu ul ul li.menu-item-has-children > a::after {
        content: "";
        float: none;
    }
}

/* =========================
   FOOTER DEFINITIVO
========================= */

.footer-ad {
    max-width: 1180px;
    margin: 40px auto 0;
    padding: 0 15px;
    text-align: center;
}

.site-footer {
    background: #151515;
    color: #fff;
    margin-top: 60px;
    padding: 0;
    font-size: 15px;
}

.footer-menu {
    border-bottom: 1px solid rgba(255,255,255,.12);
}

.footer-menu ul {
    max-width: 1180px;
    margin: 0 auto;
    padding: 18px 15px;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 24px;
}

.footer-menu li {
    margin: 0;
    padding: 0;
}

.footer-menu a {
    color: #fff;
    font-weight: 700;
    font-size: 15px;
}

.footer-menu a:hover {
    color: #ddd;
}

.footer-bottom {
    max-width: 1180px;
    margin: 0 auto;
    padding: 28px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 25px;
}

.footer-copy,
.footer-legal {
    margin: 0;
    color: #fff;
}

.footer-legal {
    text-align: right;
}

/* Submenús del footer en formato simple */
.footer-menu ul ul {
    display: none;
}

/* =========================
   FOOTER MÓVIL
========================= */

@media (max-width: 768px) {
    .site-footer {
        margin-top: 40px;
    }

    .footer-menu ul {
        display: block;
        text-align: center;
        padding: 16px 12px;
    }

    .footer-menu li {
        margin: 0;
    }

    .footer-menu a {
        display: block;
        padding: 10px 0;
        border-bottom: 1px solid rgba(255,255,255,.10);
    }

    .footer-bottom {
        display: block;
        text-align: center;
        padding: 24px 12px;
    }

    .footer-legal {
        text-align: center;
        margin-top: 12px;
    }
}

