/*
 * Chiamarsi Bomber — main stylesheet.
 * Single bundle, native CSS nesting, no build step (no merge/minify).
 *
 * Token architecture (3 layers): primitives → semantic tokens → bridge to the
 * variable names consumed by core/modules (--color-*, --font-*). This :root is the
 * AUTHORITATIVE token source; template-parts/style-variables.php inlines the critical
 * subset for first paint and must stay in sync with it.
 */

/* =========================================================================
   TOKENS
   ========================================================================= */
:root {
    /* Layer 1: primitives */
    --cb-black: #000;
    --cb-white: #fff;
    --cb-red: #e81b55;      /* magenta accent (--cbmagenta) */
    --cb-red-2: #e80016;    /* secondary accent */
    --cb-red-dark: #b0113f;
    --cb-grey-800: #303030; /* footer/prefooter surface */
    --cb-navy: #0b141c;     /* image placeholder box */
    --cb-hairline: rgba(255, 255, 255, 0.1);

    /* Layer 2: semantic */
    --bg-base: var(--cb-black);
    --bg-surface: var(--cb-grey-800);
    --text-body: var(--cb-white);
    --text-title: var(--cb-white);
    --text-muted: #aaa;
    --accent: var(--cb-red);
    --accent-2: var(--cb-red-2);
    /* Alias for the site's custom CSS (ported verbatim from the old theme). */
    --cbmagenta: var(--cb-red);
    --footer-bg: var(--cb-grey-800);
    --footer-text: var(--cb-white);

    /* Typography */
    --font-body: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif,
        "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    --font-display: var(--font-body);
    --line-height-base: 1.462;
    --line-height-tight: 1.2;
    --line-height-content: 1.6;

    /* Type scale — one structured set of steps. The medium/large steps scale down at
       breakpoints via :root overrides (see the @media blocks below) instead of clamp(),
       so every text has a defined size at every viewport. Small/body steps are constant. */
    --fs-2xs: 0.75rem;    /* meta, tiny labels */
    --fs-xs: 0.8rem;      /* tags, small labels */
    --fs-sm: 0.9rem;      /* excerpts, small body */
    --fs-base: 1rem;      /* body, card titles */
    --fs-md: 1.2rem;      /* lead text, sidebar/section sub-titles */
    --fs-lg: 1.5rem;      /* section headings, archive overlay titles */
    --fs-xl: 2rem;        /* sub-hero titles, 404 title */
    --fs-2xl: 2.375rem;   /* page/single/archive H1 */
    --fs-display: 7rem;   /* 404 code */

    /* Layout & spacing */
    --container: 1280px;
    --container-padding: 40px;
    --spacing-unit: 16px;
    --gap: 1.5rem;
    --radius-md: 0.3rem;
    --radius-lg: 0.5rem;
    --transition: 0.2s ease;

    /* Contact Form 7 layout */
    --form-gap: 0.75em;
    --field-half-width: calc(50% - calc(var(--form-gap) / 2));

    /* Layer 3: bridge */
    --color-background: var(--bg-base);
    --color-text: var(--text-body);
    --color-black: var(--text-title);
    --color-primary: var(--accent);
    --color-primary-light: var(--accent-2);
    --color-primary-dark: var(--cb-red-dark);
    --color-lightgrey: var(--bg-surface);
    --color-border: var(--cb-hairline);
    --font-headings: var(--font-display);
}

/* Responsive type scale: the larger steps step down at each breakpoint. */
@media (max-width: 1024px) {
    :root { --fs-lg: 1.4rem; --fs-xl: 1.8rem; --fs-2xl: 2.1rem; }
}
@media (max-width: 768px) {
    :root {
        --container-padding: 20px;
        --fs-md: 1.1rem; --fs-lg: 1.3rem; --fs-xl: 1.6rem; --fs-2xl: 1.9rem; --fs-display: 5rem;
    }
}
@media (max-width: 575px) {
    :root { --fs-lg: 1.25rem; --fs-xl: 1.5rem; --fs-2xl: 1.6rem; --fs-display: 3.5rem; }
}

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

html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }

body {
    margin: 0;
    background-color: var(--color-background);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: var(--fs-base);
    line-height: var(--line-height-base);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

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

    &:hover { color: var(--color-primary); }
}

p { margin: 0 0 1rem; }

h1, h2, h3, h4, h5, h6 {
    color: var(--color-black);
    font-family: var(--font-headings);
    line-height: var(--line-height-tight);
    margin: 0 0 0.75rem;
}
h1 { font-size: var(--fs-2xl); }

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background-color: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-primary); border-radius: 5px; }

/* =========================================================================
   LAYOUT
   ========================================================================= */
.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--container-padding);
}

.site-content { display: block; }

.screen-reader-text {
    position: absolute !important;
    width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link {
    position: absolute; left: -9999px; z-index: 100000;

    &:focus {
        left: 6px; top: 6px; padding: 0.5rem 1rem;
        background: var(--color-primary); color: var(--cb-white);
    }
}

/* =========================================================================
   HEADER
   ========================================================================= */
.site-header {
    position: sticky;
    top: 0;
    z-index: 99;
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.site-header__inner {
  position:relative;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.5rem 0;
}

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

    .custom-logo-link { display: flex; padding: 2px 0; }
    & img, & .custom-logo { height: 48px; width: auto; }
    & .site-logo__text { font-weight: 800; font-size: var(--fs-md); color: var(--cb-white); }
}

.main-nav { flex-grow: 1; }
.main-nav__list {
    display: flex; flex-wrap: wrap; gap: 1rem; margin: 0; padding: 0; list-style: none;

    & a { color: var(--cb-white); font-weight: 600; }
    & a:hover { color: var(--accent); }
}

/* Search (native <details>) */
.header-search__toggle {
    list-style: none; cursor: pointer; color: var(--cb-white); display: flex; align-items: center;

    &::-webkit-details-marker { display: none; }
}
.header-search__panel {
    position: absolute; left: 0; right: 0; top: 100%; border-radius: var(--radius-lg); z-index: 120;
    background: var(--accent); padding: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);

    & form { display: flex; align-items: center; }
    & input {
        flex: 1; background: transparent; border: none;
        font-size: var(--fs-base); color: var(--cb-white); padding: 8px;
    }
    & input::placeholder { color: rgba(255, 255, 255, 0.8); }
    & input:focus { outline: none; }
    & button {
        display: flex; align-items: center; justify-content: center;
        background: transparent; border: none; color: var(--cb-white);
        cursor: pointer; width: 42px; height: 42px;
    }
}

/* Hamburger / offcanvas toggle */
.nav-toggle { display: none; cursor: pointer; color: var(--cb-white); }

.offcanvas {
    position: fixed; inset: 0; z-index: 200;
    visibility: hidden; pointer-events: none;
}
.offcanvas__backdrop {
    position: absolute; inset: 0; background: rgba(0, 0, 0, 0.5);
    opacity: 0; transition: opacity 0.3s ease;
}
.offcanvas__panel {
    position: absolute; top: 0; right: 0; height: 100%;
    width: min(320px, 85vw); background: var(--color-background);
    transform: translateX(100%); transition: transform 0.3s ease;
    padding: 1rem; overflow-y: auto;
}
.offcanvas__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.offcanvas__close { cursor: pointer; color: var(--cb-white); }
.offcanvas__list {
    list-style: none; margin: 0; padding: 0;

    & li { border-bottom: 1px solid var(--cb-hairline); }
    & a { display: block; padding: 0.75rem 0; color: var(--cb-white); }
}

.offcanvas-toggle:checked ~ .offcanvas {
    visibility: visible; pointer-events: auto;

    & .offcanvas__backdrop { opacity: 1; }
    & .offcanvas__panel { transform: translateX(0); }
}

@media (max-width: 1024px) {
    .site-header {
      .site-logo {flex-grow:1;}
    }
    .main-nav { display: none; }
    .nav-toggle { display: flex; }
}

/* =========================================================================
   POST META
   ========================================================================= */
.post-meta {
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px;
    font-size: var(--fs-2xs);

    & .cb-icon { width: 13px; height: 13px; }
}
.post-meta__cat {
    color: var(--accent); font-weight: 600; letter-spacing: 0.5px;

    &:hover { color: var(--accent); opacity: 0.85; }
}
.post-meta__author {
    display: inline-flex; align-items: center; gap: 0.3rem; color: var(--color-text);

    & img { width: 15px; height: 15px; border-radius: 50%; object-fit: cover; }
}
.post-meta__date { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--cb-white); }

@media only screen and (max-width:480px) {
  .post-meta__date .time {display:none;}
}

/* =========================================================================
   MEDIA / FALLBACK
   ========================================================================= */
.entry-media {
    position: relative; display: block; overflow: hidden;
    aspect-ratio: 5 / 3; border-radius: var(--radius-lg);
    /* Logo fallback lives in the BACKGROUND (centered, capped at the logo's native height
       of 150px so it never upscales / pixelates). A loaded featured image covers it; a
       missing or broken <img> is transparent, so the logo shows through — one uniform
       CSS-only fallback for every failure mode (no thumbnail, missing file, uploads-proxy
       404, network error), working in Chrome too. */
    background: var(--cb-navy) var(--fallback-logo, none) no-repeat center / auto min(150px, 55%);

    /* Real featured image: fills the box on top of the logo background. */
    & img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; }
    &.has-overlay::after {
        content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 60%;
        background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.7) 40%, rgba(0,0,0,0) 100%);
        pointer-events: none; z-index: 1;
    }
}

/* =========================================================================
   POST CARDS
   ========================================================================= */
.post-card {
    display: flex; flex-direction: column; gap: 0.5rem;

    & .post-card__title {
        font-size: var(--fs-base); line-height: 1.4; margin: 0 0 16px;
        display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    }
    & .post-card__title a { color: var(--cb-white); }
    & .post-card__title a:hover { color: var(--accent); }
    & .post-card__excerpt { font-size: var(--fs-sm); color: var(--text-muted); margin: 0.25rem 0 0; }
}

.post-card--overlay {
    position: relative;

    & .post-card__body {
        position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
        padding: 1rem; color: var(--cb-white);
    }
    & .post-card__title { font-size: var(--fs-md); }
    & .post-card__title a { color: var(--cb-white); }
}

.post-card--small {
    flex-direction: row; gap: 1rem;

    & .post-card__media { flex: 0 0 28%; max-width: 28%; }
    & .post-card__title { font-size: var(--fs-sm); line-height: 1.4; margin-bottom: 8px; }
}

.post-card--list {
    flex-direction: row; gap: 1rem;

    & .post-card__media { flex: 0 0 40%; max-width: 40%; }
}

.post-card--half-small .post-card__title { font-size: var(--fs-base); }

@media (min-width: 992px) {
    .post-card--overlay .post-card__title { font-size: var(--fs-xl); }
    .post-card--half-small .post-card__title { font-size: var(--fs-lg); }
    .module-featured .post-card--overlay .post-card__title,
    .module-two-smalls__main .post-card--overlay .post-card__title { font-size: var(--fs-lg); }
}

/* =========================================================================
   SECTION HEADING (module titles)
   ========================================================================= */
.section-heading {
    display: flex; align-items: center; gap: 12px; margin-bottom: 1rem;

    & .section-heading__title { color: var(--cb-white); font-size: var(--fs-lg); font-weight: 700; margin: 0; }
    & .section-heading__link { margin-left: auto; color: var(--accent); font-size: var(--fs-base); }
}

.blog-title { display:none; }

/* =========================================================================
   SINGLE / PAGE
   ========================================================================= */
.content-sidebar-layout {
    display: grid; grid-template-columns: 1fr 360px; gap: 2.5rem; margin: 1.5rem 0;
}
@media (max-width: 1024px) { .content-sidebar-layout { grid-template-columns: 1fr; } }

.single-post__header { margin-bottom: 1rem; }
.single-post__title,
.single-page__title { font-size: var(--fs-2xl); line-height: 1.3; margin: 0.5rem 0; }
/* Manual excerpt used as the article intro, between title and meta. */
.single-post__excerpt { color: var(--text-muted); font-size: var(--fs-sm); line-height: 1.6; margin: 0.5rem 0 0.75rem; }
/* Single featured shows the image at its natural ratio (as in production), not a crop. */
.single-post__media { margin: 1rem 0; border-radius: var(--radius-lg); overflow: hidden; }
.single-post__media img { width: 100%; height: auto; display: block; }

.post_content {
    line-height: var(--line-height-content);

    & a { color: var(--accent); text-decoration: underline; }
    & img { border-radius: var(--radius-lg); }
    & h2, & h3 { margin-top: 1.5rem; }
}

/* Tags + social share, below the featured image (as in production). */
.post-share-meta {
    display: flex; justify-content: space-between; align-items: flex-start;
    flex-wrap: wrap; gap: 1rem; margin: 1.25rem 0;
}
.post-share-meta__label {
    display: block; margin-bottom: 0.4rem; font-size: var(--fs-xs); font-weight: 600; color: var(--cb-white);
}
.tag-cloud { display: flex; flex-flow: row wrap; gap: 0.35rem; }
.tag-cloud__item {
    display: inline-block; padding: 0.2rem 0.5rem;
    border: 1px solid var(--accent); border-radius: var(--radius-lg);
    color: var(--accent); font-size: var(--fs-xs);

    &:hover { background: var(--accent); color: var(--cb-white); }
}
.post-share-meta__share { margin-left: auto; text-align: right; }
.share-buttons {
    display: flex; align-items: center; justify-content: flex-end; gap: 1rem;

    & .share-buttons__item { color: var(--cb-white); display: inline-flex; }
    & .cb-icon { width: 20px; height: 20px; }
    & .share-buttons__item:hover { color: var(--accent); }
}
@media (max-width: 768px) {
    .post-share-meta__share { margin-left: 0; text-align: left; }
    .share-buttons { justify-content: flex-start; }
}

section.related-posts { margin-top: 2rem; }

/* =========================================================================
   CONTACT FORM 7 (ported from production)
   ========================================================================= */
.wpcf7 {
    padding: 32px; border: solid 2px var(--accent); border-radius: 12px; margin: 40px 0;
}
.wpcf7 form.wpcf7-form { display: flex; flex-flow: row wrap; gap: var(--form-gap); }
.wpcf7 form.wpcf7-form .form-field { width: 100%; }
.wpcf7 form.wpcf7-form .form-field.half { width: var(--field-half-width); }
.wpcf7 form.wpcf7-form .form-field .wpcf7-form-control-wrap,
.wpcf7 form.wpcf7-form .form-field .wpcf7-form-control-wrap > * {
    width: 100%; display: block; border-radius: 4px; border: unset;
    box-sizing: border-box; font-size: 1em; outline: none;
}
.wpcf7 form.wpcf7-form .form-field .wpcf7-form-control-wrap > * { padding: 8px 12px; }
.wpcf7 form.wpcf7-form .form-field.check { display: flex; flex-direction: column; gap: calc(var(--form-gap) / 2); }
.wpcf7 form.wpcf7-form .form-field.check .wpcf7-list-item { margin: 0 !important; }
.wpcf7 form.wpcf7-form .form-field.check .wpcf7-list-item .wpcf7-list-item-label { line-height: 1.4em; }
.wpcf7-form .form-submit {
    width: 100%; border: none; padding: 12px; font-size: 1.1em; cursor: pointer;
    background: var(--accent); color: #fff; border-radius: 6px; transition: background 0.3s ease;
}

@media (max-width: 768px) {
  .wpcf7 form.wpcf7-form .form-field.half { width: 100%; }
}

/* =========================================================================
   ARCHIVE / AUTHOR / SEARCH
   ========================================================================= */
.archive-header { margin: 1.5rem 0; }
.archive-header__title { margin: 0; }
.archive-header__desc { margin-top: 0.5rem; font-size: var(--fs-md); color: var(--text-muted); }

.author-header { display: flex; align-items: center; gap: 1.5rem; }
.author-header__avatar img { width: 96px; height: 96px; border-radius: 50%; }

/* 6-col grid: first two overlay cards span 3 (half), the rest span 2 (third) */
.archive-grid {
    display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--gap);

    & .post-card--overlay { grid-column: span 3; }
    & .post-card--default { grid-column: span 2; margin-bottom: 1.5rem; }
    & .archive-adv { grid-column: 1 / -1; }
}
.archive-grid--simple {
    grid-template-columns: repeat(3, 1fr);

    & .post-card--default { grid-column: auto; }
}

/* Archive big overlay cards use a 24px title (production), not the 32px hero size. */
.archive-grid .post-card--overlay .post-card__title { font-size: var(--fs-lg); }
@media (max-width: 768px) {
    .archive-grid, .archive-grid--simple { grid-template-columns: repeat(2, 1fr); }
    .archive-grid > * { grid-column: auto !important; }
    .archive-grid .archive-adv { grid-column: 1 / -1 !important; }
}
/* Mobile (<576px, like Bootstrap col-sm): everything stacks to a single column. */
@media (max-width: 575px) {
    .archive-grid, .archive-grid--simple,
    .module-grid, .grid-cols-3, .grid-cols-4 { grid-template-columns: 1fr; }
}

/* =========================================================================
   BREADCRUMBS / PAGINATION
   ========================================================================= */
.breadcrumbs__list {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem;
    list-style: none; margin: 0; padding: 10px 0 20px;
    font-size: var(--fs-xs); border-bottom: 1px solid var(--cb-hairline);

    & li { display: inline-flex; align-items: center; gap: 0.4rem; }
    & a { color: var(--text-muted); }
    & a:hover { color: var(--accent); }
}
.breadcrumbs__sep { color: var(--text-muted); }

.pagination__list {
    display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 0.4rem;
    list-style: none; margin: 0; padding: 2rem 0; margin-top: 2rem;

    & a, & span {
        display: flex; min-width: 42px; height: 40px; align-items: center; justify-content: center;
        border: 2px solid var(--accent); border-radius: var(--radius-md); color: var(--cb-white);
        padding: 0 12px; font-size: var(--fs-base);
    }
    & .current { background: var(--accent); }
    & a:hover { background: var(--accent); }
}

/* =========================================================================
   SIDEBAR / WIDGETS
   ========================================================================= */
.sidebar .widget { margin-bottom: 2rem; }
.sidebar .widget-title { font-size: var(--fs-md); margin-bottom: 1rem; }

/* "Articoli recenti" list (sidebar + single) */
.latest-posts__list { display: flex; flex-direction: column; gap: 0.75rem; }
.latest-posts__list .post-card:not(:last-child) {
    border-bottom: 1px solid var(--cb-hairline);
    padding-bottom: 0.75rem;
}

/* =========================================================================
   REDAZIONE (editorial team page + staff cards)
   ========================================================================= */
.redazione-inner { display: flex; gap: 30px; margin: 40px 0; }
@media (max-width: 1024px) { .redazione-inner { flex-direction: column; } }

.staff-list { flex: 2; min-width: 300px; display: flex; flex-direction: column; gap: 15px; }

/* Scoped to the redazione page so it never touches the widget .sidebar. */
.redazione-inner .sidebar {
    flex: 1; min-width: 250px; background-color: #262626;
    padding: 25px; border-radius: var(--radius-lg); height: fit-content;
}
.redazione-inner .logo-img { max-width: 200px; display: block; margin-bottom: 20px; }
.sidebar-section { margin-bottom: 30px; }
.sidebar-section:last-child { margin-bottom: 0; }
.sidebar-label { color: #e11d48; font-weight: 700; font-size: var(--fs-sm); display: block; margin-bottom: 5px; }
.sidebar-value { font-size: var(--fs-md); font-weight: 700; margin: 0; }

.author-card {
    display: flex; flex-direction: column; gap: 1em; margin-bottom: 1em;
    padding: 15px; background-color: #262626; border-radius: var(--radius-lg);
    text-decoration: none; color: inherit;
    transition: transform 0.2s ease, background-color 0.2s ease;

    & a { text-decoration: none; }
    &:hover { transform: scale(1.02); background-color: #333; }
    & .card-header { display: flex; gap: 1rem; }
    & .author-name { margin: 0; font-size: var(--fs-lg); color: var(--cb-white); }
    & .author-name > a { color: inherit; }
    & .role { font-size: var(--fs-sm); color: #a3a3a3; display: block; margin-bottom: 5px; }
    & .email { font-size: var(--fs-xs); color: #d4d4d4; display: flex; align-items: center; gap: 5px; }
    & .author-bio { color: var(--text-muted); font-size: var(--fs-sm); }
    & .author_avatar_img, & .author_avatar_large { border-radius: 50%; width: 90px; height: auto; }
}
.single-post__content .author-card {
  background-color: transparent;
  .author-bio { display:none; }
  &:hover { transform: unset; }
}
.author-socials {
    list-style: none; padding: 0; margin: 0;
    display: flex; justify-content: flex-start; align-items: center; gap: 1rem;

    & li {
        background: #fff; border-radius: 50%; width: 32px; height: 32px;
        display: flex; align-items: center; justify-content: center;
        transition: opacity 250ms ease; opacity: 0.9;

        & a { display: flex; }
    }
    & li:hover { opacity: 1; }
    & .author-social__icon { width: 1.5rem; height: 1.5rem; }
}

/* =========================================================================
   FOOTER
   ========================================================================= */
.site-footer { background: rgba(0, 0, 0, 0.4); color: var(--footer-text); margin-top: 2rem; }

.footer-top {
    display: flex; align-items: center; gap: 2rem; flex-wrap: wrap; padding: 1.5rem 0;
    .social-links {display:flex;justify-content:center;}
    .footer-top__logo {flex-grow:1;display:flex;justify-content:center;}
    .footer-menu-right {display:flex;justify-content:center;}
    & .footer-top__logo img { height: 100px; width: auto; }
}
.social-links {
    display: flex; gap: 16px; margin-left: auto;

    & .social-links__item { color: var(--cb-white); display: inline-flex; }
    & .cb-icon { width: 24px; height: 24px; }
    & .social-links__item:hover { color: var(--accent); }
}
.footer-menu-right__list {
    display: flex; gap: 1rem; flex-wrap: wrap; list-style: none; margin: 0; padding: 0;

    & a { color: var(--footer-text); font-size: var(--fs-base); font-weight: 600; }
}
.footer-bottom { border-top: 1px solid var(--cb-hairline); padding: 1.5rem 0; text-align: center; }
.footer-menu__list {
    display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; list-style: none; margin: 0 0 1rem; padding: 0;

    & a { color: var(--footer-text); font-size: var(--fs-xs); }
}
.colophon { font-size: var(--fs-xs); line-height: 1.46; color: var(--cb-white); margin: 0; text-align: center; }
.colophon p { margin: 0; }

/* Floating WhatsApp bar (bottom-right, as in production) */
.wa-float { position: fixed; right: 20px; bottom: 20px; z-index: 90; }
.wa-float__link {
    display: inline-flex; align-items: center; gap: 0.5rem;
    background: #25d366; color: #fff; padding: 10px 16px; border-radius: 50px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); font-size: var(--fs-2xs); font-weight: 500;

    & .cb-icon { width: 24px; height: 24px; }
    &:hover {color:#fff;}
}
@media (min-width: 768px) {
  .footer-top {
    .social-links {order:1;}
    .footer-top__logo {order:2;flex-grow:1;}
    .footer-menu-right {order:3;}
  }
}
@media (max-width: 768px) {
  .footer-top {
    .social-links,
    .footer-top__logo,
    .footer-menu-right {width:100%;}
  }

  .wa-float__label { display: none; }
  .wa-float__link { padding: 10px; border-radius: 50%; }
}

/* =========================================================================
   404
   ========================================================================= */
.error-404 { text-align: center; padding: 5rem 0; }
.error-404__code {
    font-size: var(--fs-display); font-weight: 800; line-height: 1; letter-spacing: 4px; color: var(--accent);
}
.error-404__title { font-size: var(--fs-xl); margin: 0.5rem 0 0; }
.error-404__text { color: var(--text-muted); max-width: 34rem; margin: 0.75rem auto 0; }

/* Search bar mirrors the header search: magenta pill with an inline icon button. */
.error-404__search {
    display: flex; align-items: center; gap: 0.35rem;
    max-width: 420px; margin: 1.75rem auto 0;
    background: var(--accent); border-radius: var(--radius-lg); padding: 6px 6px 6px 14px;

    & input[type="search"] {
        flex: 1; background: transparent; border: none;
        font-size: var(--fs-base); color: var(--cb-white); padding: 8px 0;
    }
    & input[type="search"]::placeholder { color: rgba(255, 255, 255, 0.8); }
    & input[type="search"]:focus { outline: none; }
    & button {
        display: flex; align-items: center; justify-content: center;
        background: transparent; border: none; color: var(--cb-white);
        cursor: pointer; width: 42px; height: 42px;
    }
    & .cb-icon { width: 20px; height: 20px; }
}
.error-404 .btn { margin: 1.75rem auto 0; }

/* =========================================================================
   COMPONENTS: BUTTONS
   ========================================================================= */
.btn {
    display: inline-block; max-width: max-content; padding: 1rem 1.5rem;
    background-color: var(--cb-black); border: 1px solid var(--accent); color: var(--cb-white);
    font-size: var(--fs-base); font-weight: 700; line-height: var(--line-height-tight);
    border-radius: 0.2rem; cursor: pointer;
    transition: background-color var(--transition), color var(--transition);

    &:hover { background-color: var(--accent); border-color: var(--accent); color: var(--cb-black); }
}

/* =========================================================================
   LOADER
   ========================================================================= */
.cb-loader {
    display: inline-block; width: 40px; height: 40px;
    border: 3px solid color-mix(in srgb, var(--accent) 25%, transparent);
    border-top-color: var(--accent); border-radius: 50%;
    animation: cb-spin 0.8s linear infinite;
}
@keyframes cb-spin { to { transform: rotate(360deg); } }

/* =========================================================================
   UTILITIES
   ========================================================================= */
.flex { display: flex; }
.col { flex-direction: column; }
.grid { display: grid; }
.gap { gap: var(--gap); }
.gap-sm { gap: 0.75rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid-cols-3-2 { grid-template-columns: 2fr 1fr; }

@media (max-width: 768px) { .grid-cols-3-2 { grid-template-columns: 1fr; } }
@media (max-width: 768px) { .grid-cols-3, .grid-cols-4 { grid-template-columns: repeat(2, 1fr); } }

/* =========================================================================
   HOME MODULES (builder)
   ========================================================================= */
.home-builder-canvas { padding-top: 1.5rem; }

.module-section { margin-bottom: 3rem; }

.section-heading { flex-wrap: wrap; }
.section-heading--center { justify-content: center; text-align: center; }
.section-heading--right { justify-content: flex-end; text-align: right; }
.section-heading__intro {
    flex-basis: 100%;
    color: var(--text-muted);
    font-size: var(--fs-md);
    margin-top: 0.25rem;
}
.section-heading__intro p { margin: 0; }

/* Flexible grid driven by --cols */
.module-grid { grid-template-columns: repeat(var(--cols, 3), 1fr); }
/* Home grid cards use compact titles (14.4px) as in production. */
.module-grid .post-card--default .post-card__title { font-size: var(--fs-sm); }

/* Grid containers of overlay cards: don't vertically stretch the cards, so the
   absolute body keeps overlaying the image (fixes meta sitting below in stretched
   grid cells). NB: the hero uses a flex column, so it must NOT get this. */
.module-two-smalls__main,
.module-featured,
.archive-grid { align-items: start; }

/* Per-layout aspect ratios (measured on production): default 5:3, half-small &
   featured 4:3, two-smalls big 1:1. */
.post-card--half-small .entry-media { aspect-ratio: 4 / 3; }
.module-featured .entry-media { aspect-ratio: 4 / 3; }
.module-two-smalls__main .entry-media { aspect-ratio: 1; }

/* Side lists: hairline separators between small cards (as in the current site) */
.module-hero__side .post-card:not(:last-child),
.module-two-smalls__side .post-card:not(:last-child) {
    border-bottom: 1px solid var(--cb-hairline);
    padding-bottom: 0.75rem;
}

@media (max-width: 768px) {
    .module-grid { grid-template-columns: repeat(2, 1fr); }
    .module-featured,
    .module-two-smalls__main,
    .module-hero__main .grid-cols-2 { grid-template-columns: 1fr; }
}

/* =========================================================================
   CUSTOM EMBEDS (tb-*) — ported verbatim from the old theme.
   Markup is generated by the site's plugins (tb-liveposts): player card
   ("scheda calciatore"), match container, and live-post single badge.
   Uses --cbmagenta (aliased to --accent above). Do not restyle — kept as-is.
   ========================================================================= */
.tb-player-card-single {
	border:solid 2px var(--cbmagenta);
	border-radius:16px;
	padding:1rem;
	margin:20px 0;
}

.tb-player-card-single label {color:#CCC;}

.tb-player-card-single .flex-inline {display:flex;align-items:center;gap:0 1rem;}
.tb-player-card-single .player-meta {flex-flow:row wrap;}
.tb-player-card-single .player-title {align-items:flex-start;}

.tb-player-card-single .card-inner {width:100%;gap:1rem;}


.tb-player-card-single .card-image {width:150px;height:150px;border-radius:8px;}

.tb-player-card-single .card-content {width:min-content;flex-grow:1;}
.tb-player-card-single .card-content .player-head {display:flex;align-items:flex-start;gap:1rem;}
.tb-player-card-single .card-content .player-head > .player-main {flex-grow:1;}

.tb-player-card-single .card-content hr {display:block;border:unset;height:1px;width:100%;margin:.75rem 0;background-color:rgba(255,255,255,0.1);}

.tb-player-card-single p {margin:0;}
.tb-player-card-single .player-name-wrapper {text-decoration:none;color:#FFF;flex-grow:1;}
.tb-player-card-single .player-name {font-size: var(--fs-xl);margin:0 0 8px 0!important;flex-grow:1;line-height:1.2em;}
.img-wrapper {overflow:hidden;}
.img-wrapper img {width:100%;height:100%;object-fit:cover;}

.tb-player-card-single .card-inner {display:flex;}

.tb-player-card-single ul.player-details {padding:0;margin:0;list-style:none;display:flex;flex-flow:row wrap;gap:4px 32px;}
.tb-player-card-single ul.player-details > li {width:auto;display:block;line-height:1.5em;}

.tb-player-card-single .team-logo {width:42px;height:42px;border-radius:50%;}

.tb-player-card-single .player-description {display:none;color:#FFF;font-size: var(--fs-base);line-height:1.6em;padding:8px;margin-top:8px;}
.tb-player-card-single.show-bio .player-description {display:block;}

.tb-player-card-single .player-bio-btn {cursor:pointer;font-weight:bold;text-transform:uppercase;transition:all 250ms;}
.tb-player-card-single.show-bio .player-bio-btn,
.tb-player-card-single .player-bio-btn:hover {color:var(--cbmagenta);transition:all 250ms;}

@media (max-width: 1024px) {
	.tb-player-card-single {font-size: var(--fs-xs);}
	.tb-player-card-single .player-name {font-size: var(--fs-lg);}
	.tb-player-card-single .team-logo {width:32px;height:32px;}
}

@media (max-width: 768px) {
	.tb-player-card-single .card-content .player-head > .player-main {width:100%;}
	.tb-player-card-single .player-title {width:100%;justify-content:space-between;}
	.tb-player-card-single .card-image {width:120px;height:120px;}
	.tb-player-card-single .player-name {font-size: var(--fs-md);}
	.tb-player-card-single .card-content .player-head {flex-direction:column;align-items:flex-start;gap:.5rem;}
	.tb-player-card-single .player-meta {flex-direction: column;align-items: flex-start;gap: 0;}
	.tb-player-card-single .player-meta .player-title {justify-content:space-between;}
	.tb-player-card-single ul.player-details {flex-direction:column;gap:.75rem;}
	.tb-player-card-single .card-content hr {margin:.7rem 0;}
	.tb-player-card-single .player-title {flex-direction:column;align-items:flex-start;}
	.tb-player-card-single .player-title > .player-name {order:2;}
	.tb-player-card-single .player-title > .team-logo {order:1;}
}

.match-container {
	border:solid 2px var(--cbmagenta);
	border-radius:16px;
	padding:1rem;
	margin:20px 0;
}

body.single-live .post_content {margin-top:64px;padding-top:40px;border-top:solid 1px rgba(255,255,255,0.1);}

body.single-live .live-badge {
	display:inline-block;
	font-size: var(--fs-xs);
	gap:5px;
	letter-spacing:1px;
	text-transform:uppercase;
	font-weight:600;
}
body.single-live .live-badge span {position:relative;}

@keyframes live-blink {
	0%, 100% {opacity: 1;}
	50% {opacity: 0.3;}
}

body.single-live .live-badge span::before  {
	content: '';
	position:relative;
	display: inline-block;
	width: 12px;
	height: 12px;
	margin:2px 8px 0 0;
	background-color: red;
	border-radius: 50%;
	animation: live-blink 1.5s infinite;
}

/* =========================================================================
   BETTING ADV
   ========================================================================= */
.bet-adv-title {margin-top:1.5rem;}

.bet-item * {
  margin:0;
  padding:0;
  list-style-type:none;
  text-decoration:none;
  line-height:1em;
}

.bet-wrapper {
  display:flex;
  flex-direction:column;
  gap:24px;
  margin:40px 0;
}

.bet-item {
  width:100%;
  background: #0F1218;
  border: solid 1px #364053;
  border-radius:5px;

  .bet-main {

  }

  .bet-image {
    display:flex;
    align-items:center;
    justify-content:center;
    height:70px;
    img {height:28px;width:auto;}
  }

  .bet-content {
    padding:20px;
    display:flex;
    flex-direction:column;
    gap:20px;

    .content-upper {
      display:flex;
      align-items:center;
      gap:1.5rem;

      .title {display:none;}
      .value {
        color:#E31B54;
        font-size:32px;
        font-weight:900;
        display:flex;
        gap:4px;
        letter-spacing:1px;
      }
      .bet-labels {
        display:flex;
        flex-wrap:wrap;
        gap:8px;
      }
      .label {
        font-size:12px;
        font-weight:bold;
        text-transform:uppercase;
        padding:8px 12px;
        background:#E31B54;
        border-radius:5px;
      }
    }
    .content-lower {
      .description {
        font-size: 18px;
        font-weight:600;
        line-height: 1.4em;
        margin-bottom: 1em;
      }
      ul.features {
        li {
          display:flex;
          align-items:flex-start;
          font-size:18px;
          padding:6px 0;
          gap:8px;

          svg {width:24px;height:24px;margin-top:2px;}
          span {display:block;line-height:1.4em;white-space:wrap;width:100%;}
        }
      }
    }
  }

  .bet-cta {
    padding:20px;
    a.button {
      display:block;
      font-size:15px;
      white-space:nowrap;
      font-weight:700;
      text-transform:uppercase;
      letter-spacing:.5px;
      background:#E31B54;
      text-decoration:none;
      color:#FFF;
      padding:16px 32px;
      border-radius:5px;
      width:100%;
      text-align:center;
    }
  }

  .bet-footer {
    details {
      & > * {
        padding:20px;
        border-top: solid 1px #364053;
      }
      summary {
        display:flex;
        align-items:center;
        gap:8px;
        svg {
          transition:all 200ms;
        }
      }
      .inner {
        & > *:not(:last-child) {margin-bottom:1em;}
        p {
          font-size:16px;
          line-height:1.6em;
        }
      }
    }
    details[open] {
      summary {
        svg {
          transform:rotate(180deg);
          transition:all 200ms;
        }
      }
    }
  }
}

@media (min-width: 1025px) {
  .bet-item {
    .bet-main {
      display:flex;
      .bet-image {
        aspect-ratio:1/1;
        width:auto;
        height:auto;
        min-width:280px;
        img {height:auto;width:180px;object-fit:contain;}
      }
      .bet-content {width:100%;}
      .bet-cta {width:fit-content;display:flex;align-items:center;}
    }
  }
}


/* =========================================================================
   GUTENBERG BRIDGE
   ========================================================================= */
.has-primary-color { color: var(--color-primary); }
.has-primary-background-color { background-color: var(--color-primary); }
.has-text-color { color: var(--color-text); }
