/*
Theme Name: TaboolaWP Magazine
Theme URI: https://taboolawp.local
Author: TaboolaWP
Description: Tema WordPress in stile quotidiano economico/finanziario per advertorial e magazine editoriali. Header con testata e ticker mercati, layout articolo + sidebar, single editoriale con kicker, occhiello, firma e dropcap. Brand e colori personalizzabili dal Customizer.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: taboolawp
*/

:root {
  --brand: #c8102e;          /* rosso testata (override via Customizer) */
  --ink: #1a1a1a;
  --ink-soft: #444;
  --muted: #6b7280;
  --rule: #e3e3e3;
  --rule-strong: #111;
  --bg: #ffffff;
  --bg-soft: #f6f6f4;
  --link: #0a4ea3;
  --serif: 'Lora', Georgia, 'Times New Roman', serif;
  --display: 'Playfair Display', Georgia, serif;
  --sans: 'Libre Franklin', Arial, Helvetica, sans-serif;
  --maxw: 1120px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

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

/* ---------- TOP UTILITY BAR ---------- */
.utility-bar { background: #111; color: #cfcfcf; font-family: var(--sans); font-size: 12px; letter-spacing: 0.2px; }
.utility-inner { max-width: var(--maxw); margin: 0 auto; padding: 7px 20px; display: flex; justify-content: space-between; align-items: center; }
.utility-inner .u-date { text-transform: capitalize; }
.utility-inner .u-links { display: flex; gap: 18px; }
.utility-inner .u-links a { text-decoration: none; color: #cfcfcf; }
.utility-inner .u-links a:hover { color: #fff; }
.u-sub { color: var(--brand); font-weight: 700; }
/* selettore lingua con bandierina */
.lang-switch { display: inline-flex; align-items: center; gap: 12px; list-style: none; margin: 0; padding: 0; }
.lang-switch li { margin: 0; }
.lang-switch a { display: inline-flex; align-items: center; gap: 5px; text-decoration: none; color: #cfcfcf; text-transform: uppercase; font-weight: 700; font-size: 11px; letter-spacing: 0.5px; }
.lang-switch a:hover { color: #fff; }
.lang-switch img { width: 18px; height: auto; display: block; border-radius: 2px; }
.lang-switch .current-lang a { color: #fff; }
@media (max-width: 680px) { .utility-inner .u-links > a:not(.u-sub) { display: none; } }

/* ---------- MASTHEAD ---------- */
.masthead { max-width: var(--maxw); margin: 0 auto; padding: 18px 20px 14px; text-align: center; border-bottom: 1px solid var(--rule); }
.masthead .brandmark { font-family: var(--display); font-weight: 900; font-size: 2.9rem; letter-spacing: -0.5px; line-height: 1; color: var(--ink); text-decoration: none; display: inline-block; }
.masthead .brandmark .amp { color: var(--brand); }
.masthead .tagline { font-family: var(--sans); font-size: 11px; letter-spacing: 3px; text-transform: uppercase; color: var(--muted); margin-top: 8px; }
@media (max-width: 600px) { .masthead .brandmark { font-size: 2rem; } }

/* ---------- NAV ---------- */
.topnav { position: sticky; top: 0; z-index: 1000; background: #fff; border-top: 3px solid var(--brand); border-bottom: 1px solid var(--rule); box-shadow: 0 1px 6px rgba(0,0,0,0.04); }
.topnav-inner { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; height: 48px; }
.nav-links { display: flex; gap: 22px; font-family: var(--sans); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: 0.4px; overflow: hidden; list-style: none; margin: 0; padding: 0; }
.nav-links li { margin: 0; }
.nav-links a { text-decoration: none; color: var(--ink); white-space: nowrap; }
.nav-links a.active, .nav-links .current-menu-item > a, .nav-links .current_page_item > a { color: var(--brand); }
.nav-links a:hover { color: var(--brand); }
.nav-cta { font-family: var(--sans); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; background: var(--brand); color: #fff; text-decoration: none; padding: 8px 16px; border-radius: 2px; white-space: nowrap; }
/* Mobile: nav scorrevole orizzontale, tutte le categorie raggiungibili */
@media (max-width: 860px) {
  .topnav-inner { gap: 12px; }
  .nav-links {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex: 1 1 auto;
    gap: 20px;
    height: 100%;
    align-items: center;
    -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent);
            mask-image: linear-gradient(90deg, #000 88%, transparent);
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links li { flex: 0 0 auto; }
  .nav-cta { flex: 0 0 auto; padding: 8px 14px; }
}

/* ---------- TICKER ---------- */
.ticker-wrap { position: relative; width: 100%; height: auto; min-height: 46px; border-bottom: 1px solid var(--rule); background: #fff; max-width: var(--maxw); margin: 0 auto; }
.ticker-wrap iframe { display: block; }

/* ---------- LAYOUT ---------- */
.layout { max-width: var(--maxw); margin: 0 auto; padding: 26px 20px 10px; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 44px; }
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; gap: 0; }
  /* Mobile: la sidebar non sparisce, va sotto il contenuto */
  .sidebar { margin-top: 24px; padding-top: 22px; border-top: 3px solid var(--rule-strong); }
  .sb-sticky { position: static; }
  .sb-sticky .sb-block:last-child { margin-bottom: 8px; }
}

.article { min-width: 0; max-width: 720px; }

.breadcrumb { font-family: var(--sans); font-size: 12px; color: var(--muted); margin-bottom: 18px; text-transform: uppercase; letter-spacing: 0.5px; }
.breadcrumb a { text-decoration: none; color: var(--muted); }
.breadcrumb span { color: var(--brand); font-weight: 700; }

.kicker { font-family: var(--sans); font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--brand); margin-bottom: 14px; }
.kicker a { text-decoration: none; color: var(--brand); }

h1.headline { font-family: var(--display); font-weight: 900; font-size: 2.85rem; line-height: 1.12; letter-spacing: -0.5px; color: var(--ink); margin: 0 0 18px; }
@media (max-width: 600px) { h1.headline { font-size: 1.95rem; } }

.standfirst { font-family: var(--serif); font-size: 1.3rem; line-height: 1.5; color: var(--ink-soft); font-weight: 500; margin: 0 0 24px; }
@media (max-width: 600px) { .standfirst { font-size: 1.12rem; } }

.byline { display: flex; align-items: center; gap: 12px; padding: 16px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin-bottom: 26px; }
.byline .avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--brand); color: #fff; font-family: var(--sans); font-weight: 800; font-size: 16px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.byline .b-meta { font-family: var(--sans); font-size: 13px; line-height: 1.5; }
.byline .b-meta .b-author { font-weight: 700; color: var(--ink); }
.byline .b-meta .b-author span { color: var(--brand); }
.byline .b-meta .b-sub { color: var(--muted); }
.byline .share { margin-left: auto; display: flex; gap: 8px; }
.byline .share a { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--rule); display: flex; align-items: center; justify-content: center; color: var(--ink-soft); text-decoration: none; transition: 0.2s; }
.byline .share a:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.byline .share svg { width: 15px; height: 15px; }
@media (max-width: 520px) { .byline .share { display: none; } }

figure.hero { margin: 0 0 10px; }
figure.hero img { width: 100%; display: block; border-radius: 2px; }
figure.hero figcaption { font-family: var(--sans); font-size: 12px; color: var(--muted); padding: 8px 2px 0; border-bottom: 1px solid var(--rule); margin-bottom: 26px; line-height: 1.4; }
figure.hero figcaption strong { color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.5px; font-size: 11px; }

.article p { font-family: var(--serif); font-size: 1.21rem; line-height: 1.75; color: #232323; margin: 0 0 24px; }
.article p a { color: var(--link); text-decoration: none; font-weight: 600; border-bottom: 1px solid rgba(10,78,163,0.3); }

/* dropcap automatico sul primo paragrafo dell'articolo */
.article .entry-content > p:first-of-type::first-letter,
.dropcap { font-family: var(--display); font-size: 4.4rem; float: left; line-height: 0.74; padding: 8px 12px 0 0; color: var(--brand); font-weight: 900; }
.dropcap { font-size: 4.4rem; }

h2.subhead, .article .entry-content h2 { font-family: var(--display); font-size: 1.85rem; font-weight: 800; color: var(--ink); margin: 42px 0 18px; line-height: 1.2; }
@media (max-width: 600px) { h2.subhead, .article .entry-content h2 { font-size: 1.45rem; } }
.article .entry-content h3 { font-family: var(--display); font-size: 1.5rem; font-weight: 800; color: var(--ink); margin: 34px 0 16px; }

.article ul.bullets, .article .entry-content ul { font-family: var(--serif); font-size: 1.18rem; line-height: 1.7; margin: 0 0 28px; padding-left: 22px; color: #232323; }
.article ul.bullets li, .article .entry-content ul li { margin-bottom: 14px; }
.article ul.bullets strong { color: var(--ink); }

blockquote.pull, .article .entry-content blockquote { font-family: var(--display); font-size: 1.7rem; line-height: 1.35; font-weight: 700; color: var(--ink); border-left: 4px solid var(--brand); margin: 36px 0; padding: 6px 0 6px 24px; }
blockquote.pull cite { display: block; font-family: var(--sans); font-size: 13px; font-weight: 600; font-style: normal; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 14px; }

/* ---------- FEATURE CARDS ---------- */
.features-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 22px 0 8px; }
.feature-card { background: #fff; border: 1px solid var(--rule); border-radius: 4px; overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.feature-card video, .feature-card img { width: 100%; height: auto; display: block; border-bottom: 1px solid var(--rule); object-fit: cover; }
.feature-card-content { padding: 14px; }
.feature-card-content h4 { font-family: var(--sans); font-size: 1rem; margin: 0 0 8px; color: var(--ink); font-weight: 700; line-height: 1.2; }
.feature-card-content p { font-family: var(--sans); font-size: 0.9rem; color: var(--muted); margin: 0; line-height: 1.45; }
@media (max-width: 700px) { .features-grid-3 { grid-template-columns: 1fr; } }

/* ---------- ACTIVITY / STATEMENT ---------- */
.test-wrap { display: flex; flex-wrap: nowrap; justify-content: center; align-items: center; gap: 20px; margin: 8px 0 34px; width: 100%; }
.test-wrap .vid { flex: 0 0 42%; max-width: 380px; overflow: hidden; display: flex; justify-content: center; }
.test-wrap .vid video { width: 100%; transform: scale(1.35); }
.test-wrap .feed { flex: 1 1 58%; max-width: 450px; font-family: var(--sans); }
@media (max-width: 560px) { .test-wrap .vid { display: none; } .test-wrap .feed { max-width: 100%; } }

/* ---------- ALERT ---------- */
.alert-box { background-color: #fffbeb; border: 1px solid #fcd34d; border-left: 5px solid #f59e0b; border-radius: 4px; padding: 20px; margin: 8px 0 34px; font-family: var(--sans); }
.alert-box .a-title { color: #b45309; font-size: 15px; font-weight: 800; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.alert-box p { font-family: var(--sans); font-size: 15px; line-height: 1.6; margin: 0; color: #451a03; }
.alert-box p + p { margin-top: 12px; }

/* ---------- FORM ---------- */
.main-bottom-form { background: var(--bg-soft); border: 1px solid var(--rule); padding: 32px; margin: 40px 0; border-radius: 6px; }
.form-header-title { font-family: var(--display); font-size: 1.6rem; font-weight: 800; text-align: center; margin-bottom: 22px; color: var(--ink); }

/* ---------- COMMENTS (custom advertorial) ---------- */
.comments-section { margin-top: 44px; padding-top: 28px; border-top: 2px solid var(--rule-strong); font-family: var(--sans); }
.comments-title { font-family: var(--display); font-size: 1.6rem; font-weight: 800; margin-bottom: 20px; color: var(--ink); }
.comment-item { padding: 18px 0; border-bottom: 1px solid var(--rule); }
.comment-item:last-child { border-bottom: none; }
.comment-item.reply { margin-left: 40px; border-left: 3px solid var(--rule); padding-left: 15px; }
.c-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.c-name { font-weight: 700; font-size: 15px; color: var(--ink); }
.c-time { font-size: 12px; color: #888; }
.c-text { font-size: 15px; color: #333; line-height: 1.5; margin-bottom: 12px; font-family: var(--serif); }
.c-actions { display: flex; gap: 15px; font-size: 12px; color: #666; font-weight: 600; }
.c-actions span { cursor: pointer; display: flex; align-items: center; gap: 4px; }
.c-actions span:hover { color: var(--brand); }
.c-upvotes { color: #059669; }

/* ---------- SIDEBAR ---------- */
.sidebar { font-family: var(--sans); }
.sb-sticky { position: sticky; top: 64px; }
.sb-block { margin-bottom: 34px; }
.sb-title { font-family: var(--sans); font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: var(--ink); padding-bottom: 10px; margin-bottom: 4px; border-bottom: 3px solid var(--brand); }
.mostread { list-style: none; margin: 0; padding: 0; counter-reset: mr; }
.mostread li { counter-increment: mr; display: flex; gap: 14px; align-items: flex-start; padding: 16px 0; border-bottom: 1px solid var(--rule); }
.mostread li::before { content: counter(mr); font-family: var(--display); font-weight: 900; font-size: 1.8rem; color: var(--brand); line-height: 1; flex: 0 0 auto; min-width: 24px; }
.mostread a { text-decoration: none; font-family: var(--serif); font-size: 1rem; line-height: 1.35; color: var(--ink); font-weight: 600; }
.mostread a:hover { color: var(--brand); }
.sb-ad { background: var(--bg-soft); border: 1px solid var(--rule); border-radius: 4px; text-align: center; padding: 22px 18px; }
.sb-ad .ad-label { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.sb-ad h4 { font-family: var(--display); font-size: 1.25rem; margin: 0 0 8px; color: var(--ink); }
.sb-ad p { font-size: 13px; color: var(--ink-soft); line-height: 1.5; margin: 0 0 16px; }
.sb-ad a { display: inline-block; background: var(--brand); color: #fff; text-decoration: none; font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; padding: 11px 22px; border-radius: 2px; }
.sb-block .widget-title { font-family: var(--sans); font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: var(--ink); padding-bottom: 10px; margin: 0 0 14px; border-bottom: 3px solid var(--brand); }
.sb-block p { font-family: var(--serif); font-size: 0.98rem; line-height: 1.5; color: var(--ink-soft); }

/* ---------- MAGAZINE HOME / ARCHIVE GRID ---------- */
.section-head { display: flex; align-items: center; gap: 14px; margin: 6px 0 22px; }
.section-head h2 { font-family: var(--sans); font-size: 14px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: var(--ink); margin: 0; padding-bottom: 8px; border-bottom: 3px solid var(--brand); }
.lead-story { display: grid; grid-template-columns: 1.2fr 1fr; gap: 26px; margin-bottom: 36px; padding-bottom: 30px; border-bottom: 1px solid var(--rule); align-items: center; }
.lead-story .lead-media img { width: 100%; height: 320px; object-fit: cover; border-radius: 3px; }
.lead-story .lead-cat { font-family: var(--sans); font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--brand); margin-bottom: 10px; }
.lead-story h3 { font-family: var(--display); font-size: 2.1rem; font-weight: 900; line-height: 1.14; margin: 0 0 12px; }
.lead-story h3 a { text-decoration: none; color: var(--ink); }
.lead-story h3 a:hover { color: var(--brand); }
.lead-story p { font-family: var(--serif); font-size: 1.08rem; line-height: 1.6; color: var(--ink-soft); margin: 0; }
@media (max-width: 760px) { .lead-story { grid-template-columns: 1fr; } .lead-story .lead-media img { height: 220px; } .lead-story h3 { font-size: 1.6rem; } }

.cards-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 28px; }
@media (max-width: 620px) { .cards-grid { grid-template-columns: 1fr; } }

/* ---------- SMALL SCREENS (phones) ---------- */
@media (max-width: 600px) {
  .layout { padding: 20px 16px 8px; }
  .masthead { padding: 14px 16px 10px; }
  .masthead .tagline { letter-spacing: 2px; }
  .topnav-inner { padding: 0 16px; }
  .lead-story { margin-bottom: 26px; padding-bottom: 22px; }
  .lead-story .lead-media img { height: 200px; }
  .cards-grid { gap: 22px; }
  .post-card .pc-media img { height: 200px; }
  .article p { font-size: 1.12rem; line-height: 1.7; }
  .article ul.bullets, .article .entry-content ul { font-size: 1.1rem; }
  blockquote.pull, .article .entry-content blockquote { font-size: 1.4rem; }
  .section-head h2 { font-size: 13px; }
  footer#footer { padding: 36px 16px 32px; }
  footer#footer .f-nav { gap: 18px; }
}
@media (max-width: 400px) {
  h1.headline { font-size: 1.72rem; }
  .lead-story h3 { font-size: 1.4rem; }
}
.post-card { display: flex; flex-direction: column; }
.post-card .pc-media img { width: 100%; height: 180px; object-fit: cover; border-radius: 3px; }
.post-card .pc-cat { font-family: var(--sans); font-weight: 800; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--brand); margin: 12px 0 8px; }
.post-card h3 { font-family: var(--display); font-size: 1.35rem; font-weight: 800; line-height: 1.2; margin: 0 0 10px; }
.post-card h3 a { text-decoration: none; color: var(--ink); }
.post-card h3 a:hover { color: var(--brand); }
.post-card p { font-family: var(--serif); font-size: 1rem; line-height: 1.55; color: var(--ink-soft); margin: 0 0 10px; }
.post-card .pc-meta { font-family: var(--sans); font-size: 12px; color: var(--muted); }

.pagination { margin: 40px 0; font-family: var(--sans); display: flex; gap: 8px; flex-wrap: wrap; }
.pagination .page-numbers { display: inline-block; padding: 8px 14px; border: 1px solid var(--rule); text-decoration: none; color: var(--ink); font-weight: 700; font-size: 14px; border-radius: 2px; }
.pagination .page-numbers.current { background: var(--brand); color: #fff; border-color: var(--brand); }
.pagination .page-numbers:hover { border-color: var(--brand); color: var(--brand); }

/* ---------- PAGE / GENERIC CONTENT ---------- */
.page-content { font-family: var(--serif); font-size: 1.15rem; line-height: 1.75; color: #232323; }
.page-content h1.page-title { font-family: var(--display); font-weight: 900; font-size: 2.4rem; line-height: 1.15; margin: 0 0 22px; }
.page-content a { color: var(--link); }

/* ---------- FOOTER ---------- */
footer#footer { background: #111; color: #9aa0a6; padding: 48px 20px 40px; font-family: var(--sans); font-size: 13px; margin-top: 30px; }
footer#footer .f-inner { max-width: var(--maxw); margin: 0 auto; }
footer#footer .f-brand { font-family: var(--display); font-weight: 900; font-size: 1.8rem; color: #fff; text-align: center; margin-bottom: 6px; }
footer#footer .f-brand .amp { color: var(--brand); }
footer#footer .f-nav { list-style: none; padding: 0; margin: 18px 0 36px; display: flex; justify-content: center; gap: 28px; flex-wrap: wrap; }
footer#footer .f-nav a { color: #ccc; text-decoration: none; font-weight: 600; }
footer#footer .f-nav a:hover { color: #fff; }
footer#footer .legal { max-width: 850px; margin: 0 auto; border-top: 1px solid #333; padding-top: 30px; }
footer#footer .legal p { color: #777; font-size: 11px; line-height: 1.55; margin: 0 0 14px; }
footer#footer .legal strong { color: #aaa; }
footer#footer .copyright { font-size: 11px; color: #666; letter-spacing: 2px; text-transform: uppercase; margin-top: 20px; text-align: center; }

#tracking-and-modals { display: none !important; position: absolute; height: 0; width: 0; overflow: hidden; }
@keyframes popIn { 0% { transform: scale(0.9); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* WP core alignment helpers */
.aligncenter { display: block; margin-left: auto; margin-right: auto; }
.alignright { float: right; margin: 0 0 1em 1.5em; }
.alignleft { float: left; margin: 0 1.5em 1em 0; }
.wp-caption { max-width: 100%; }
.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(1px,1px,1px,1px); }
