/*
Theme Name: Alghero in Chiaro
Theme URI: https://algheroinchiaro.it
Author: Alghero in Chiaro
Description: Tema editoriale per Alghero in Chiaro. Layout stile giornale tradizionale con tipografia classica, banner pubblicitari e editor integrato.
Version: 2.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2
Text Domain: quotidiano-alghero
*/

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

:root {
  --ink: #111111;
  --paper: #f5f0e8;
  --red: #c0392b;
  --gold: #b8860b;
  --light: #fafaf6;
  --border: #d8d0c0;
  --muted: #888888;
  --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --body:  'Source Serif 4', Georgia, serif;
  --sans:  system-ui, -apple-system, sans-serif;
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
  background: var(--paper);
  font-family: var(--body);
  color: var(--ink);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--red); }
img { max-width: 100%; height: auto; display: block; }
button { cursor: pointer; font-family: inherit; }

/* ── MASTHEAD ── */
.site-masthead {
  background: var(--ink);
  color: #fff;
  border-bottom: 4px solid var(--red);
}
.masthead-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 40px;
  border-bottom: 1px solid #333;
  font-family: var(--sans);
  font-size: 11px;
  color: #999;
}
.masthead-top a { color: #999; }
.masthead-top a:hover { color: #fff; }
.masthead-center {
  text-align: center;
  padding: 20px 40px 16px;
}
.site-title {
  font-family: var(--serif);
  font-size: clamp(36px, 6vw, 68px);
  font-weight: 900;
  letter-spacing: -1px;
  color: #fff;
  line-height: 1;
  display: block;
}
.site-tagline {
  font-family: var(--sans);
  font-size: 11px;
  color: #888;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-top: 6px;
}
.masthead-nav {
  background: #1a1a1a;
  border-top: 1px solid #2a2a2a;
}
.masthead-nav ul {
  display: flex;
  list-style: none;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0 40px;
  gap: 0;
}
.masthead-nav ul li a {
  display: block;
  color: #ccc;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 11px 16px;
  border-bottom: 2px solid transparent;
  transition: all .2s;
}
.masthead-nav ul li a:hover,
.masthead-nav ul li.current-menu-item a,
.masthead-nav ul li.current-cat a {
  color: #fff;
  border-bottom-color: var(--red);
}

/* ── BREAKING TICKER ── */
.breaking-bar {
  background: var(--red);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0;
  overflow: hidden;
}
.breaking-label {
  background: #8b1a12;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 8px 16px;
  white-space: nowrap;
  flex-shrink: 0;
}
.breaking-ticker {
  font-family: var(--sans);
  font-size: 12px;
  padding: 8px 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── LAYOUT ── */
.site-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}
.site-main { padding: 32px 0 48px; }

/* ── SECTION HEADERS ── */
.section-title {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--red);
  border-bottom: 2px solid var(--red);
  padding-bottom: 8px;
  margin-bottom: 20px;
}

/* ── LEAD ARTICLE ── */
.lead-article {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 40px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 32px;
  margin-bottom: 32px;
}
.lead-article-main {}
.lead-article-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.lead-article h2 {
  font-family: var(--serif);
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 12px;
  color: var(--ink);
}
.lead-article h2 a { color: var(--ink); }
.lead-article h2 a:hover { color: var(--red); }
.lead-article .excerpt {
  font-family: var(--body);
  font-size: 17px;
  font-style: italic;
  color: #444;
  margin-bottom: 16px;
  line-height: 1.6;
}
.lead-article .body-preview {
  columns: 2;
  column-gap: 28px;
  font-size: 15px;
  line-height: 1.85;
  text-align: justify;
  color: #222;
}
.lead-article-sidebar {}
.lead-article-sidebar .featured-img {
  width: 100%;
  aspect-ratio: 3/2;
  object-fit: cover;
  border: 1px solid var(--border);
  margin-bottom: 16px;
}
.lead-article-sidebar .sidebar-articles { border-top: 1px solid var(--border); }
.sidebar-article-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.sidebar-article-item h4 {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  margin: 8px 0 4px;
  color: var(--ink);
}
.sidebar-article-item h4 a { color: var(--ink); }
.sidebar-article-item h4 a:hover { color: var(--red); }
.sidebar-article-item p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

/* ── ARTICLE GRID ── */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0 32px;
}
.articles-grid .article-card {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}
.articles-grid .article-card:nth-child(-n+3) { border-top: 1px solid var(--border); }
.article-card-img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border: 1px solid var(--border);
  margin-bottom: 12px;
}
.article-card h3 {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 800;
  line-height: 1.25;
  margin: 10px 0 6px;
  color: var(--ink);
}
.article-card h3 a { color: var(--ink); }
.article-card h3 a:hover { color: var(--red); }
.article-card .excerpt {
  font-size: 13px;
  font-style: italic;
  color: #555;
  margin-bottom: 8px;
  line-height: 1.5;
}
.article-card .body-snippet {
  font-size: 13px;
  line-height: 1.75;
  color: #333;
}
.article-card .read-more {
  display: inline-block;
  margin-top: 10px;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--red);
  border-bottom: 1px solid var(--red);
  padding-bottom: 1px;
}

/* ── ARTICLE BADGES ── */
.badge {
  display: inline-block;
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 1px;
}
.badge-tipo { color: #fff; }
.badge-cat  { border: 1px solid #aaa; color: #555; background: transparent; }
.badge-date { color: var(--muted); background: transparent; font-weight: 400; letter-spacing: 0.5px; }

/* ── SINGLE ARTICLE ── */
.single-article-header { border-bottom: 2px solid var(--ink); padding-bottom: 24px; margin-bottom: 32px; }
.single-article-header h1 {
  font-family: var(--serif);
  font-size: clamp(28px, 4vw, 52px);
  font-weight: 900;
  line-height: 1.1;
  margin: 16px 0 12px;
}
.single-article-header .standfirst {
  font-family: var(--body);
  font-size: 20px;
  font-style: italic;
  color: #444;
  line-height: 1.55;
  margin-bottom: 16px;
}
.single-article-header .byline {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
}
.single-featured-img {
  width: 100%;
  max-height: 500px;
  object-fit: cover;
  border: 1px solid var(--border);
  margin-bottom: 32px;
}
.single-article-body {
  max-width: 780px;
  margin: 0 auto;
  columns: 2;
  column-gap: 40px;
  font-size: 16px;
  line-height: 1.9;
  text-align: justify;
  color: #1a1a1a;
}
.single-article-body p { margin-bottom: 1.4em; break-inside: avoid; }
.single-article-body h2, .single-article-body h3 {
  font-family: var(--serif);
  column-span: all;
  margin: 1.5em 0 0.5em;
  break-after: avoid;
}

/* ── ARCHIVE PAGE ── */
.archive-header {
  border-bottom: 2px solid var(--ink);
  padding-bottom: 16px;
  margin-bottom: 32px;
}
.archive-header h1 {
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 900;
}
.archive-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0 40px;
}
.archive-item {
  display: flex;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}
.archive-item-img {
  width: 120px;
  height: 80px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.archive-item h3 {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  margin: 6px 0 4px;
}
.archive-item h3 a { color: var(--ink); }
.archive-item h3 a:hover { color: var(--red); }
.archive-item p { font-size: 12px; color: #555; line-height: 1.5; }

/* ── STATIC PAGES (Chi siamo / Contatti) ── */
.page-header {
  border-bottom: 2px solid var(--ink);
  padding-bottom: 16px;
  margin-bottom: 36px;
}
.page-header h1 { font-family: var(--serif); font-size: 40px; font-weight: 900; }
.page-content {
  max-width: 760px;
  font-size: 16px;
  line-height: 1.85;
  color: #1a1a1a;
}
.page-content p { margin-bottom: 1.4em; }
.page-content h2 { font-family: var(--serif); font-size: 26px; margin: 2em 0 0.6em; }
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-top: 40px;
}
.contact-form input,
.contact-form textarea {
  width: 100%;
  border: 1px solid var(--border);
  padding: 10px 14px;
  font-family: var(--body);
  font-size: 14px;
  background: var(--light);
  margin-bottom: 12px;
  border-radius: 2px;
  color: var(--ink);
}
.contact-form input:focus,
.contact-form textarea:focus { outline: none; border-color: var(--red); }
.contact-form textarea { min-height: 160px; resize: vertical; }
.contact-form button {
  background: var(--red);
  color: #fff;
  border: none;
  padding: 12px 28px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  border-radius: 2px;
  transition: opacity .2s;
}
.contact-form button:hover { opacity: .85; }
.contact-info h3 { font-family: var(--serif); font-size: 22px; margin-bottom: 16px; }
.contact-info p { font-size: 14px; margin-bottom: 10px; color: #444; }

/* ── PAGINATION ── */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 48px;
  font-family: var(--sans);
}
.pagination .page-numbers {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border: 1px solid var(--border);
  font-size: 13px; color: var(--ink); background: var(--light);
}
.pagination .page-numbers.current { background: var(--red); color: #fff; border-color: var(--red); }
.pagination .page-numbers:hover { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ── FOOTER ── */
.site-footer {
  background: var(--ink);
  color: #888;
  margin-top: 60px;
}
.footer-inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  padding: 48px 40px 32px;
  max-width: 1200px;
  margin: 0 auto;
}
.footer-brand .footer-logo {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 900;
  color: #fff;
  display: block;
  margin-bottom: 12px;
}
.footer-brand p { font-size: 13px; line-height: 1.7; max-width: 320px; }
.footer-col h4 {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #fff;
  margin-bottom: 14px;
  border-bottom: 1px solid #333;
  padding-bottom: 8px;
}
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 8px; }
.footer-col ul li a { font-size: 13px; color: #888; transition: color .15s; }
.footer-col ul li a:hover { color: #fff; }
.footer-bottom {
  border-top: 1px solid #222;
  padding: 14px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  font-family: var(--sans);
  font-size: 11px;
}

/* ── RESPONSIVE ── */
@media (max-width: 1024px) {
  .lead-article { grid-template-columns: 1fr; }
  .lead-article-sidebar .featured-img { display: none; }
  .articles-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .masthead-top { display: none; }
  .masthead-center { padding: 14px 20px; }
  .masthead-nav ul { justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; }
  .site-container { padding: 0 16px; }
  .single-article-body { columns: 1; }
  .lead-article .body-preview { columns: 1; }
  .articles-grid { grid-template-columns: 1fr; }
  .archive-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; padding: 32px 20px; }
  .footer-bottom { flex-direction: column; gap: 8px; text-align: center; padding: 14px 20px; }
}

/* ── VIDEO / TELEGIORNALE ── */
.tg-section { margin-top: 48px; }
.tg-hero {
  position: relative; background: #000; border-radius: 4px;
  overflow: hidden; margin-bottom: 32px;
  box-shadow: 0 8px 40px rgba(0,0,0,.25);
}
.tg-hero-badge {
  position: absolute; top: 14px; left: 14px; z-index: 10;
  background: var(--red); color: #fff;
  font-family: var(--sans); font-size: 10px; font-weight: 800;
  letter-spacing: 2px; text-transform: uppercase; padding: 4px 12px;
  border-radius: 2px;
}
.tg-hero-label {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 10;
  background: linear-gradient(transparent, rgba(0,0,0,.85));
  padding: 40px 20px 16px;
  color: #fff; pointer-events: none;
}
.tg-hero-label h2 { font-family: var(--serif); font-size: 22px; font-weight: 900; }
.tg-hero-label p  { font-size: 12px; color: #ccc; margin-top: 4px; font-family: var(--sans); }
.tg-hero iframe, .tg-hero video { display: block; width: 100%; }

.tg-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
}
.tg-card {
  background: #fff; border: 1px solid var(--border); border-radius: 3px;
  overflow: hidden; transition: box-shadow .2s;
}
.tg-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.12); }
.tg-thumb {
  position: relative; aspect-ratio: 16/9; background: #111;
  overflow: hidden; cursor: pointer;
}
.tg-thumb img { width: 100%; height: 100%; object-fit: cover; transition: opacity .2s; }
.tg-thumb:hover img { opacity: .85; }
.tg-play-btn {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
}
.tg-play-btn span {
  width: 48px; height: 48px; border-radius: 50%; background: rgba(192,57,43,.9);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff; transition: transform .15s;
}
.tg-thumb:hover .tg-play-btn span { transform: scale(1.1); }
.tg-card-body { padding: 14px; }
.tg-card-body h3 { font-family: var(--serif); font-size: 16px; font-weight: 700; line-height: 1.3; margin-bottom: 6px; }
.tg-card-body h3 a { color: var(--ink); }
.tg-card-body h3 a:hover { color: var(--red); }
.tg-card-body .meta { font-family: var(--sans); font-size: 11px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.tg-tipo-badge { background: var(--red); color: #fff; font-size: 8px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; padding: 2px 7px; border-radius: 1px; font-family: var(--sans); }

/* Modal video player */
.tg-modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.88); z-index: 1000;
  align-items: center; justify-content: center; padding: 20px;
}
.tg-modal-overlay.open { display: flex; }
.tg-modal {
  background: #000; width: 100%; max-width: 900px; border-radius: 4px; overflow: hidden;
  position: relative;
}
.tg-modal-close {
  position: absolute; top: 12px; right: 12px; z-index: 10;
  background: rgba(255,255,255,.15); border: none; color: #fff;
  width: 32px; height: 32px; border-radius: 50%; font-size: 18px; line-height: 1;
}
.tg-modal-close:hover { background: var(--red); }
.tg-modal-info { padding: 14px 18px; background: #111; }
.tg-modal-info h3 { font-family: var(--serif); color: #fff; font-size: 18px; margin-bottom: 4px; }
.tg-modal-info p  { font-size: 12px; color: #888; font-family: var(--sans); }

/* Pagina archivio TG */
.tg-archive-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 28px; }
.tg-archive-item { display: grid; grid-template-columns: 260px 1fr; gap: 20px; border-bottom: 1px solid var(--border); padding-bottom: 24px; }
.tg-archive-item .tg-thumb { border-radius: 3px; }
.tg-archive-item h3 { font-family: var(--serif); font-size: 20px; font-weight: 800; line-height: 1.25; margin: 8px 0 8px; }
.tg-archive-item h3 a { color: var(--ink); }
.tg-archive-item h3 a:hover { color: var(--red); }
.tg-archive-item p { font-size: 13px; color: #555; line-height: 1.6; }

@media (max-width: 900px) {
  .tg-grid { grid-template-columns: 1fr 1fr; }
  .tg-archive-grid { grid-template-columns: 1fr; }
  .tg-archive-item { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .tg-grid { grid-template-columns: 1fr; }
}

/* ── BANNER PUBBLICITARI ── */
.ad-slot {
  display: block; text-align: center;
  background: #f0ece4; border: 1px dashed #c8c0b0;
  position: relative; overflow: hidden;
}
.ad-slot.ad-empty {
  display: flex; align-items: center; justify-content: center;
  min-height: 60px;
}
.ad-slot.ad-empty::after {
  content: 'Spazio Pubblicitario';
  font-family: sans-serif; font-size: 10px; font-weight: 700;
  letter-spacing: 2px; text-transform: uppercase; color: #bbb;
}
.ad-slot img { max-width: 100%; height: auto; display: block; margin: 0 auto; }
.ad-slot a { display: block; }

/* Banner sotto testata: 728x90 */
.ad-leaderboard {
  width: 100%; max-width: 728px; height: 90px;
  margin: 0 auto; border-bottom: 1px solid var(--border);
}
.ad-leaderboard-wrap {
  background: #f5f0e8; padding: 8px 0; border-bottom: 1px solid var(--border);
  text-align: center;
}

/* Sidebar: 300x250 */
.ad-sidebar { width: 300px; height: 250px; margin: 0 auto 20px; }
.ad-sidebar-wrap { margin-bottom: 24px; }

/* Between articles */
.ad-between {
  width: 100%; max-width: 728px; height: 90px;
  margin: 24px auto; display: block;
}
.ad-between-wrap { padding: 16px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 24px 0; background: #f5f0e8; }

/* Footer banner */
.ad-footer-wrap { background: #0d0d0d; padding: 16px 0; text-align: center; border-top: 1px solid #1a1a1a; }
.ad-footer { width: 100%; max-width: 728px; height: 90px; margin: 0 auto; }

/* Articolo singolo */
.ad-article-top { width: 100%; max-width: 728px; height: 90px; margin: 0 auto 28px; display: block; }
.ad-article-mid { width: 300px; height: 250px; float: right; margin: 0 0 20px 28px; }
