/**
 * tpl_vco24 - Template CSS
 * Layout: CSS Grid, responsive scaling (no reflow)
 * Sfondo: tema colore configurabile via parametro backend
 */

:root {
    --menu-visible-items: 8;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body.site {
    background-color: var(--theme-bg);
    color: var(--theme-text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.5;
    min-height: 100vh;
}

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

a {
    color: var(--theme-text);
    text-decoration: none;
}

a:hover {
    opacity: 0.85;
}

.align-center {
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ============================================================
   PAGE WRAPPER
   ============================================================ */
.page-wrapper {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: var(--gap);
}

/* ============================================================
   FASCIA (sezione generica)
   ============================================================ */
.fascia {
    margin-bottom: var(--gap-ssm);
}

.fascia-inner {
    width: 100%;
}

/* ============================================================
   FASCIA 1 — TG Live (2 colonne uguali)
   ============================================================ */
.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap);
}

.position-tg-vco,
.position-tg-novara {
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: 6px;
    overflow: hidden;
    min-height: 80px;
}

.position-tg-vco iframe,
.position-tg-novara iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    display: block;
    border: 0;
}

.position-tg-vco > div,
.position-tg-novara > div {
    width: 100%;
}

/* ============================================================
   FASCIA 2 — Header (logo | search | banner)
   ============================================================ */
.grid-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: var(--gap-sm);
    align-items: center;
}

.position-logo {
    min-width: 100px;
}

.site-logo-fallback {
    display: flex;
    align-items: center;
}

.site-name {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.position-search-links {
    display: flex;
    align-items: center;
}

.position-banner-header {
    border-radius: 6px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================================
   MENU — Voci visibili + dropdown "Altro"
   ============================================================ */
.position-search-links .mod-menu {
    list-style: none;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0;
    margin: 0;
    padding: 0;
}

.position-search-links .mod-menu > li {
    position: relative;
}

.position-search-links .mod-menu > li a {
    display: block;
    padding: 8px 4px;
    color: var(--theme-text);
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    transition: background 0.2s;
    white-space: nowrap;
}

.position-search-links .mod-menu > li a:hover,
.position-search-links .mod-menu > li.active > a {
    background: var(--theme-surface-hover);
    border-radius: 4px;
}

/* Separatore tra voci */
.position-search-links .mod-menu > li + li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 25%;
    height: 50%;
    width: 1px;
    background: var(--theme-border);
}

/* Niente separatore su "Altro" */
.position-search-links .mod-menu > li.menu-more-wrapper::before {
    display: none;
}

/* Bottone "Altro" */
.menu-more-btn {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    color: var(--theme-text);
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    cursor: pointer;
    white-space: nowrap;
    background: none;
    border: none;
    transition: background 0.2s;
}

.menu-more-btn:hover {
    background: var(--theme-surface-hover);
    border-radius: 4px;
}

.menu-more-btn::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 6px;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--theme-text);
}

/* Dropdown */
.menu-more-wrapper {
    position: relative;
}

.menu-more-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--theme-bg);
    border: 1px solid var(--theme-border);
    border-radius: 6px;
    padding: 6px 0;
    min-width: 180px;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.menu-more-dropdown.open {
    display: block;
}

.menu-more-dropdown a {
    display: block;
    padding: 8px 16px;
    color: var(--theme-text);
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    transition: background 0.2s;
}

.menu-more-dropdown a:hover {
    background: var(--theme-surface-hover);
}

/* ============================================================
   RICERCA nella position search-links
   ============================================================ */
.position-search-links .mod-finder,
.position-search-links .mod-search {
    display: flex;
    align-items: center;
}

.position-search-links .mod-finder label,
.position-search-links .mod-search label {
    display: none;
}

.position-search-links search
{
  margin:auto;
}

.position-search-links .mod-finder input[type="search"],
.position-search-links .mod-finder input[type="text"],
.position-search-links .mod-search input[type="search"],
.position-search-links .mod-search input[type="text"] {
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: 20px;
    color: var(--theme-text);
    padding: 6px 16px;
    font-size: 0.8rem;
    width: auto;/*150px*/
    outline: none;
    transition: border-color 0.2s, width 0.2s;
}

.position-search-links .mod-finder input:focus,
.position-search-links .mod-search input:focus {
    border-color: rgba(255, 255, 255, 0.4);
    width: auto;/*200px change this to have a resize effect*/
}

.position-search-links .mod-finder input::placeholder,
.position-search-links .mod-search input::placeholder {
    color: var(--theme-text-muted);
}

.position-search-links .mod-finder button[type="submit"],
.position-search-links .mod-search button[type="submit"] {
    display: none;
}

/* ============================================================
   FASCIA 3 — Hero Slideshow (full-width)
   ============================================================ */
.fascia-hero .fascia-inner {
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: 8px;
    min-height: 300px;
    overflow: hidden;
    position: relative;
}

/* ============================================================
   FASCIA 4 — News Flash (2 colonne: sinistra 2 righe, destra foto)
   ============================================================ */
.grid-newsflash {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: var(--gap);
}

.newsflash-left {
    display: flex;
    flex-direction: column;
    gap: var(--gap);
}

.position-sommario-tg,
.position-meteo {
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: 6px;
    overflow: hidden;
    flex: 1;
}

.position-sommario-tg iframe,
.position-sommario-tg video,
.position-meteo iframe,
.position-meteo video {
    width: 100%;
    height: 100%;
    aspect-ratio: 16 / 9;
    display: block;
    object-fit: cover;
    border: 0;
}

.position-sommario-tg > div,
.position-meteo > div {
    width: 100%;
    height: 100%;
}

.position-sommario-tg .video-wrapper,
.position-meteo .video-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
}

.position-sommario-tg .video-wrapper iframe,
.position-meteo .video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.position-foto-notizie {
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: 6px;
    padding: var(--gap-sm);
    min-height: 170px;
}

/* ============================================================
   FASCE 5-7 — Macro sezione con sidebar
   ============================================================ */
.grid-macro {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--gap);
}

.macro-main {
    display: flex;
    flex-direction: column;
    gap: var(--gap);
    min-width: 0;
}

.position-banner-ads-main {
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: 6px;
    padding: var(--gap-sm);
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.position-provincia .hero-slideshow-wrapper {
    max-height: 300px;
    overflow: hidden;
}

.position-provincia .hero-swiper {
    height: 300px;
}

.position-provincia {
    overflow: hidden;
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: 6px;
    padding: 0;
    min-width: 0;
}

.position-foto-precedenti-1 {
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: 6px;
    padding: var(--gap-sm);
    min-height: 120px;
}

.macro-sidebar {
    width: 220px;
    display: flex;
    flex-direction: column;
    gap: var(--gap);
}

.position-reel-embed {
    background: black;
    border: 1px solid var(--theme-border);
    border-radius: 20px;
    padding: var(--gap-sm);
    min-height: 300px;
    flex: 1;
}

.position-funebri,
.position-pdf {
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: 6px;
    padding: var(--gap-sm);
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================================
   FASCIA 8 & 12 — Redazionale + Banner (proporzioni variabili)
   ============================================================ */
.grid-redazionale {
    display: grid;
    grid-template-columns: var(--redazionale-columns);
    gap: var(--gap);
}

.position-redazionale {
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: 6px;
    padding: var(--gap);
    min-height: 100px;
}

.position-redazionale::before {
    content: '';
    display: block;
    width: 40px;
    height: 3px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 2px;
    margin-bottom: var(--gap-sm);
}

.position-banner-agenzie {
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: 6px;
    padding: var(--gap-sm);
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================================
   FASCIA 9 — Foto articoli precedenti (full-width)
   ============================================================ */
.fascia-archivio .fascia-inner {
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: 6px;
    padding: var(--gap-sm);
    min-height: 120px;
}

/* ============================================================
   FASCIA 10 — Categorie (full-width)
   ============================================================ */
.fascia-categorie .fascia-inner {
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: 6px;
    padding: var(--gap);
    min-height: 60px;
}

/* ============================================================
   FASCIA 11 & 13 — Banner Classico (full-width)
   ============================================================ */
.fascia-banner .fascia-inner {
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: 6px;
    padding: var(--gap-sm);
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================================
   CONTENUTO ARTICOLI (solo pagine interne, nascosto in homepage)
   ============================================================ */
.fascia-content .fascia-inner {
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: 8px;
    padding: var(--gap);
}

/* ============================================================
   VISTA ARTICOLO
   ============================================================ */
.article-view {
    max-width: 800px;
    margin: 0 auto;
}

.article-header {
    margin-bottom: 24px;
}

.article-title {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--theme-text);
    margin: 0 0 8px;
}

.article-subtitle {
    font-size: 1.15rem;
    font-weight: 400;
    line-height: 1.4;
    color: var(--theme-text-muted);
    margin: 0 0 12px;
    font-style: italic;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--theme-text-muted);
}

.article-meta time {
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.article-author::before {
    content: '·';
    margin-right: 12px;
}

.article-hero-video {
    margin-bottom: 24px;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    aspect-ratio: 16 / 9;
}

.article-hero-video iframe,
.article-hero-video video {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.article-hero-image {
    margin-bottom: 24px;
    border-radius: 8px;
    overflow: hidden;
}

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

.article-body {
    font-size: 1.05rem;
    line-height: 1.75;
    color: var(--theme-text);
}

.article-body p {
    margin: 0 0 1em;
}

.article-body img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 1em 0;
}

.article-body a {
    color: var(--theme-text);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.article-body a:hover {
    opacity: 0.8;
}

.article-body h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 1.5em 0 0.5em;
}

.article-body h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 1.2em 0 0.4em;
}

.article-body blockquote {
    border-left: 3px solid var(--theme-border);
    padding-left: 16px;
    margin: 1em 0;
    font-style: italic;
    color: var(--theme-text-muted);
}

/* ============================================================
   BANNER REEL FLOATING (stile smartphone)
   ============================================================ */
.banner-reel-float {
    float: right;
    width: 240px;
    margin: 0 0 20px 24px;
    padding: 12px;
    background: #111;
    border-radius: 28px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    position: relative;
    shape-outside: margin-box;
}

.banner-reel-float::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 5px;
    background: #333;
    border-radius: 3px;
    z-index: 2;
}

.banner-reel-float iframe,
.banner-reel-float video {
    width: 100%;
    aspect-ratio: 9 / 16;
    border-radius: 18px;
    display: block;
    border: 0;
    background: #000;
}

.banner-reel-float:empty {
    display: none;
}

/* ============================================================
   BANNER24 TYPE WRAPPERS
   ============================================================ */
.banner24-type-category {
    margin: 16px 0;
    overflow: hidden;
}

.banner24-type-category iframe {
    width: 100%;
    border: 0;
    display: block;
}

.banner24-type-reel {
    width: 100%;
    overflow: hidden;
}

.banner24-type-reel iframe,
.banner24-type-reel video {
    width: 100%;
    aspect-ratio: 9 / 16;
    border: 0;
    display: block;
}

.banner24-type-reel .avPlayerWrapper .avPlayerContainer .avPlayerBlock iframe {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 9 / 16 !important;
    position: static !important;
    top: auto !important;
    left: auto !important;
    display: block !important;
    border: 0 !important;
}

.banner24-type-reel .avPlayerWrapper .avPlayerContainer .avPlayerBlock {
    padding: 0 !important;
}

/* ============================================================
   FOOTER
   ============================================================ */
.fascia-footer {
    margin-top: var(--gap);
    padding-top: var(--gap);
    border-top: 1px solid var(--theme-border);
}

.footer-text {
    text-align: center;
    font-size: 0.85rem;
    color: var(--theme-text-muted);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    :root {
        --content-max-width: 100%;
        --gap: 12px;
        --gap-sm: 8px;
        --menu-visible-items: 3;
    }

    html {
        font-size: 14px;
    }

    .macro-sidebar {
        width: 180px;
    }

    .position-reel-embed {
        min-height: 240px;
    }

    .article-title {
        font-size: 1.7rem;
    }

    .banner-reel-float {
        width: 200px;
        padding: 10px;
        border-radius: 22px;
    }

    .banner-reel-float::before {
        width: 48px;
        height: 4px;
    }

    .banner-reel-float iframe,
    .banner-reel-float video {
        border-radius: 14px;
    }
}

@media (max-width: 768px) {
    :root {
        --gap: 8px;
        --gap-sm: 6px;
        --menu-visible-items: 2;
    }

    html {
        font-size: 12px;
    }

    .page-wrapper {
        padding: var(--gap-sm);
    }

    .macro-sidebar {
        width: 140px;
    }

    .position-reel-embed {
        min-height: 180px;
    }

    .site-name {
        font-size: 1.2rem;
    }

    .article-title {
        font-size: 1.4rem;
    }

    .article-subtitle {
        font-size: 1rem;
    }

    .banner-reel-float {
        width: 160px;
        margin: 0 0 16px 16px;
        padding: 8px;
        border-radius: 18px;
    }

    .banner-reel-float::before {
        width: 40px;
        height: 3px;
    }

    .banner-reel-float iframe,
    .banner-reel-float video {
        border-radius: 12px;
    }
}

@media (max-width: 480px) {
   :root {
        --menu-visible-items: 1;
    }
  
    html {
        font-size: 10px;
    }

    .macro-sidebar {
        width: 110px;
    }

    .position-reel-embed {
        min-height: 140px;
    }

    .fascia-hero .fascia-inner {
        min-height: 160px;
    }

    .article-title {
        font-size: 1.2rem;
    }

    .banner-reel-float {
        float: none;
        width: 200px;
        margin: 16px auto;
    }
}

/* ============================================================
   PLACEHOLDER LABELS (debug)
   ============================================================ */
[class^="position-"]:empty::after {
    content: attr(data-position);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: inherit;
    font-size: 0.75rem;
    color: var(--theme-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}