/* ============================================================
   CS Magazine — Foglio di stile principale
   Versione: 1.0.0
   ============================================================ */

/* ── FONT ── */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;0,900;1,400;1,700&family=Inter:wght@300;400;500;600;700&display=swap');

/* ── TOKENS ── */
:root {
  --csm-navy:          #1a3a5c;
  --csm-navy-dark:     #0d2238;
  --csm-orange:        #D4581A;
  --csm-orange-hover:  #bf4e17;
  --csm-bg:            #f5f4f1;
  --csm-card:          #ffffff;
  --csm-text:          #1a1a2e;
  --csm-muted:         #6b6b7b;
  --csm-light:         #9898a8;
  --csm-border:        #e0ddd8;
  --csm-tag-bg:        #eef2f7;
  --csm-tag-text:      #1a3a5c;
  --csm-body:          'Inter', system-ui, -apple-system, sans-serif;
  --csm-display:       'Playfair Display', Georgia, 'Times New Roman', serif;
  --csm-radius:        10px;   /* angoli arrotondati globali */
  --csm-radius-sm:     6px;
  --csm-radius-lg:     16px;
  --csm-shadow:        0 2px 16px rgba(0,0,0,0.08);
  --csm-shadow-hover:  0 8px 32px rgba(0,0,0,0.14);
  --csm-transition:    0.2s ease;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --csm-bg:       #0e1a27;
    --csm-card:     #162030;
    --csm-text:     #e8e8f0;
    --csm-muted:    #8a8a9a;
    --csm-light:    #5a5a6a;
    --csm-border:   #1e3048;
    --csm-tag-bg:   #1a2f44;
    --csm-tag-text: #87b4d8;
    --csm-shadow:        0 2px 16px rgba(0,0,0,0.3);
    --csm-shadow-hover:  0 8px 32px rgba(0,0,0,0.45);
  }
}
:root[data-theme="dark"] {
    --csm-bg:       #0e1a27;
    --csm-card:     #162030;
    --csm-text:     #e8e8f0;
    --csm-muted:    #8a8a9a;
    --csm-light:    #5a5a6a;
    --csm-border:   #1e3048;
    --csm-tag-bg:   #1a2f44;
    --csm-tag-text: #87b4d8;
}

/* ── RESET MAGAZINE ── */
.csm-wrap *, .csm-wrap *::before, .csm-wrap *::after {
  box-sizing: border-box;
}
.csm-wrap {
  font-family: var(--csm-body);
  color: var(--csm-text);
  background: var(--csm-bg);
  margin: 0;
  padding: 0;
}
.csm-wrap a { color: inherit; text-decoration: none; }
.csm-wrap img { max-width: 100%; display: block; }

/* ── TOP BAR ── */
.csm-topbar {
  background: var(--csm-navy-dark);
  color: rgba(255,255,255,0.65);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 7px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.csm-topbar a { color: rgba(255,255,255,0.5); transition: color var(--csm-transition); }
.csm-topbar a:hover { color: var(--csm-orange); }
.csm-topbar-left  { display: flex; gap: 20px; flex-wrap: wrap; }
.csm-topbar-right { flex-shrink: 0; }

/* ── MASTHEAD ── */
.csm-masthead {
  background: var(--csm-card);
  border-bottom: 3px solid var(--csm-navy);
  padding: 0 24px;
}
.csm-masthead-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  padding: 18px 0;
}
.csm-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}
.csm-logo-icon {
  width: 50px;
  height: 50px;
  background: var(--csm-navy);
  border-radius: var(--csm-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.csm-logo-icon svg { width: 30px; height: 30px; }
.csm-logo-wordmark { display: flex; flex-direction: column; line-height: 1.1; }
.csm-logo-name {
  font-family: var(--csm-display);
  font-size: 21px;
  font-weight: 700;
  color: var(--csm-navy);
  letter-spacing: -0.01em;
}
.csm-logo-name em { color: var(--csm-orange); font-style: normal; }
.csm-logo-sub {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--csm-muted);
}
.csm-logo-badge {
  display: inline-block;
  background: var(--csm-orange);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 20px;
  margin-top: 5px;
  width: fit-content;
}
.csm-masthead-tagline {
  text-align: center;
  font-family: var(--csm-display);
  font-style: italic;
  font-size: 13px;
  color: var(--csm-muted);
  border-left: 1px solid var(--csm-border);
  border-right: 1px solid var(--csm-border);
  padding: 0 20px;
  line-height: 1.55;
}
.csm-masthead-meta {
  text-align: right;
  font-size: 11px;
  color: var(--csm-light);
  line-height: 1.9;
}
.csm-masthead-meta strong {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: var(--csm-text);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

/* ── MAIN NAV ── */
.csm-nav {
  background: var(--csm-navy);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
}
.csm-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: stretch;
}
.csm-nav-home {
  background: var(--csm-orange);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background var(--csm-transition);
  flex-shrink: 0;
  border: none;
  cursor: pointer;
  height: 48px;
}
.csm-nav-home:hover { background: var(--csm-orange-hover); color: #fff; }
.csm-nav-home svg { width: 14px; height: 14px; }
.csm-nav-sep { width: 1px; background: rgba(255,255,255,0.12); flex-shrink: 0; }
.csm-nav-cats {
  display: flex;
  list-style: none;
  gap: 0;
  margin: 0;
  padding: 0;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.csm-nav-cats::-webkit-scrollbar { display: none; }
.csm-nav-cats li a {
  display: flex;
  align-items: center;
  height: 48px;
  color: rgba(255,255,255,0.75);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0 16px;
  transition: all var(--csm-transition);
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.csm-nav-cats li a:hover,
.csm-nav-cats li a.csm-active {
  color: #fff;
  border-bottom-color: var(--csm-orange);
}
.csm-nav-search {
  color: rgba(255,255,255,0.55);
  padding: 0 16px;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: color var(--csm-transition);
  background: none;
  border: none;
}
.csm-nav-search:hover { color: #fff; }
.csm-nav-search svg { width: 18px; height: 18px; }

/* Mobile nav hamburger */
.csm-nav-toggle {
  display: none;
  color: rgba(255,255,255,0.8);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 16px;
  height: 48px;
  align-items: center;
}
.csm-nav-toggle svg { width: 22px; height: 22px; }

/* ── TICKER ── */
.csm-ticker {
  background: var(--csm-orange);
  color: #fff;
  padding: 8px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  overflow: hidden;
}
.csm-ticker-label {
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: #fff;
  color: var(--csm-orange);
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}
.csm-ticker-track { white-space: nowrap; overflow: hidden; flex: 1; }
.csm-ticker-content { display: inline-block; opacity: 0.95; animation: csm-ticker 30s linear infinite; }
@keyframes csm-ticker {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ── MAIN WRAPPER ── */
.csm-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

/* ── SECTION LABEL ── */
.csm-section-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.csm-section-label::before {
  content: '';
  display: block;
  width: 22px;
  height: 3px;
  background: var(--csm-orange);
  border-radius: 2px;
  flex-shrink: 0;
}
.csm-section-label span {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--csm-muted);
}
.csm-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--csm-border);
}

/* ── HERO SECTION ── */
.csm-hero {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  margin-bottom: 48px;
}
.csm-hero-main {
  background: var(--csm-card);
  border-radius: var(--csm-radius-lg);
  overflow: hidden;
  box-shadow: var(--csm-shadow);
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--csm-transition);
}
.csm-hero-main:hover { box-shadow: var(--csm-shadow-hover); }

.csm-hero-img {
  width: 100%;
  aspect-ratio: 16/9;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.csm-hero-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.csm-hero-img-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--csm-navy) 0%, var(--csm-navy-dark, #0a284a) 100%);
}
.csm-hero-img-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.05) 55%, transparent 100%);
}
.csm-cat-tag {
  display: inline-block;
  background: var(--csm-orange);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 11px;
  border-radius: 20px;
}
.csm-hero-tag {
  position: absolute;
  top: 16px;
  left: 16px;
}
.csm-hero-body { padding: 22px 26px 26px; flex: 1; display: flex; flex-direction: column; }
.csm-hero-title {
  font-family: var(--csm-display);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--csm-text);
  text-wrap: balance;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
  transition: color var(--csm-transition);
}
.csm-hero-title a:hover { color: var(--csm-orange); }
.csm-hero-excerpt { font-size: 15px; color: var(--csm-muted); line-height: 1.65; margin-bottom: 16px; flex: 1; }
.csm-hero-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--csm-light);
  font-weight: 500;
  flex-wrap: wrap;
}
.csm-hero-meta .csm-dot { color: var(--csm-border); }
.csm-read-more {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--csm-orange);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-left: auto;
  transition: color var(--csm-transition);
}
.csm-read-more:hover { color: var(--csm-navy); }
.csm-read-more svg { width: 13px; height: 13px; }

/* Hero sidebar stack */
.csm-hero-sidebar {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--csm-border);
  border-radius: var(--csm-radius-lg);
  overflow: hidden;
  box-shadow: var(--csm-shadow);
}
.csm-side-item {
  background: var(--csm-card);
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 12px;
  align-items: center;
  cursor: pointer;
  transition: background var(--csm-transition);
  text-decoration: none;
  color: inherit;
}
.csm-side-item:hover { background: var(--csm-tag-bg); }
.csm-side-item:hover .csm-side-title { color: var(--csm-orange); }
.csm-side-thumb {
  aspect-ratio: 4/3;
  border-radius: var(--csm-radius-sm);
  overflow: hidden;
  flex-shrink: 0;
}
.csm-side-thumb img { width: 100%; height: 100%; object-fit: cover; }
.csm-side-thumb-ph {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--csm-navy) 0%, #0a284a 100%);
}
.csm-side-cat {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--csm-orange);
  margin-bottom: 4px;
}
.csm-side-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--csm-text);
  transition: color var(--csm-transition);
  text-wrap: balance;
}
.csm-side-date { font-size: 11px; color: var(--csm-light); margin-top: 5px; }

/* ── ARTICLE GRID ── */
.csm-grid-section { margin-bottom: 48px; }
.csm-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}
.csm-cols-1 { grid-template-columns: 1fr; }
.csm-cols-2 { grid-template-columns: repeat(2, 1fr); }
.csm-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ── ARTICLE CARD ── */
.csm-card {
  background: var(--csm-card);
  border-radius: var(--csm-radius-lg);
  overflow: hidden;
  box-shadow: var(--csm-shadow);
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--csm-transition), transform var(--csm-transition);
}
.csm-card:hover {
  box-shadow: var(--csm-shadow-hover);
  transform: translateY(-3px);
}
.csm-card-img {
  aspect-ratio: 16/9;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.csm-card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.35s ease; }
.csm-card:hover .csm-card-img img { transform: scale(1.04); }
.csm-card-img-ph {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--csm-navy) 0%, #0a284a 100%);
}
.csm-card-tag {
  position: absolute;
  top: 12px;
  left: 12px;
}
.csm-card-body {
  padding: 18px 20px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.csm-card-title {
  font-family: var(--csm-display);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--csm-text);
  text-wrap: balance;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}
.csm-card-title a { transition: color var(--csm-transition); }
.csm-card-title a:hover { color: var(--csm-orange); }
.csm-card-excerpt {
  font-size: 13px;
  color: var(--csm-muted);
  line-height: 1.62;
  flex: 1;
  margin-bottom: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.csm-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--csm-border);
  padding-top: 12px;
  margin-top: auto;
}
.csm-card-meta { font-size: 11px; color: var(--csm-light); font-weight: 500; }
.csm-card-read {
  font-size: 11px;
  font-weight: 700;
  color: var(--csm-navy);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color var(--csm-transition);
}
.csm-card-read:hover { color: var(--csm-orange); }
.csm-card-read svg { width: 12px; height: 12px; }

/* ── TAG CLOUD ── */
.csm-tags-section {
  background: var(--csm-card);
  border-radius: var(--csm-radius-lg);
  padding: 22px 26px;
  box-shadow: var(--csm-shadow);
  margin-bottom: 48px;
  border-left: 4px solid var(--csm-navy);
}
.csm-tags-section h3 {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--csm-muted);
  margin: 0 0 14px;
}
.csm-tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.csm-tag {
  background: var(--csm-tag-bg);
  color: var(--csm-tag-text);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 13px;
  border-radius: 20px;
  border: 1px solid var(--csm-border);
  cursor: pointer;
  transition: all var(--csm-transition);
  text-decoration: none;
}
.csm-tag:hover {
  background: var(--csm-navy);
  color: #fff;
  border-color: var(--csm-navy);
}

/* ── ARTICLE PAGE LAYOUT ── */
.csm-article-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 40px;
}

/* Breadcrumb */
.csm-breadcrumb {
  font-size: 12px;
  color: var(--csm-muted);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.csm-breadcrumb a { color: var(--csm-orange); transition: color var(--csm-transition); }
.csm-breadcrumb a:hover { color: var(--csm-navy); }
.csm-breadcrumb .sep { color: var(--csm-border); }

/* Article header */
.csm-article-cat { margin-bottom: 14px; }
.csm-article-title {
  font-family: var(--csm-display);
  font-size: 34px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--csm-text);
  text-wrap: balance;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
}
.csm-article-subtitle {
  font-size: 18px;
  color: var(--csm-muted);
  line-height: 1.6;
  font-style: italic;
  margin-bottom: 20px;
}
.csm-byline {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--csm-border);
  border-bottom: 1px solid var(--csm-border);
  margin-bottom: 26px;
  flex-wrap: wrap;
}
.csm-byline-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--csm-navy);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: var(--csm-display);
}
.csm-byline-info { flex: 1; min-width: 120px; }
.csm-byline-name { font-size: 14px; font-weight: 600; color: var(--csm-text); }
.csm-byline-date { font-size: 12px; color: var(--csm-muted); }
.csm-share-row {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 11px;
  color: var(--csm-light);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.csm-share-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--csm-border);
  cursor: pointer;
  transition: all var(--csm-transition);
  color: var(--csm-muted);
  background: none;
  text-decoration: none;
}
.csm-share-btn:hover { background: var(--csm-navy); border-color: var(--csm-navy); color: #fff; }
.csm-share-btn svg { width: 14px; height: 14px; }

/* Article cover image */
.csm-article-cover {
  border-radius: var(--csm-radius-lg);
  overflow: hidden;
  margin-bottom: 30px;
  aspect-ratio: 1200/630;
}
.csm-article-cover img { width: 100%; height: 100%; object-fit: cover; }

/* Article body */
.csm-article-body {
  font-size: 17px;
  line-height: 1.78;
  color: var(--csm-text);
  max-width: 68ch;
}
.csm-article-body h2 {
  font-family: var(--csm-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--csm-text);
  margin: 36px 0 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--csm-border);
  letter-spacing: -0.01em;
}
.csm-article-body h3 {
  font-family: var(--csm-display);
  font-size: 19px;
  font-weight: 600;
  color: var(--csm-text);
  margin: 28px 0 10px;
}
.csm-article-body p { margin-bottom: 20px; }
.csm-article-body strong { font-weight: 700; }
.csm-article-body a { color: var(--csm-orange); text-decoration: underline; text-underline-offset: 2px; }
.csm-article-body ul {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.csm-article-body ul li { padding-left: 20px; position: relative; }
.csm-article-body ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 9px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--csm-orange);
}
.csm-article-body ol { padding-left: 24px; margin-bottom: 20px; }
.csm-article-body ol li { margin-bottom: 8px; }
.csm-article-body blockquote {
  border-left: 4px solid var(--csm-orange);
  background: var(--csm-tag-bg);
  padding: 16px 22px;
  margin: 28px 0;
  border-radius: 0 var(--csm-radius) var(--csm-radius) 0;
  font-style: italic;
  color: var(--csm-muted);
  font-size: 16px;
}
.csm-article-body img {
  border-radius: var(--csm-radius);
  margin: 24px 0;
}

/* Article tags footer */
.csm-article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 22px 0;
  border-top: 1px solid var(--csm-border);
  border-bottom: 1px solid var(--csm-border);
  margin: 32px 0;
  align-items: center;
}
.csm-article-tags-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--csm-muted);
  margin-right: 4px;
}

/* Related articles */
.csm-related { margin-top: 48px; }
.csm-related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

/* ── SIDEBAR ── */
.csm-sidebar { display: flex; flex-direction: column; gap: 22px; }
.csm-widget {
  background: var(--csm-card);
  border-radius: var(--csm-radius-lg);
  padding: 20px;
  box-shadow: var(--csm-shadow);
}
.csm-widget-title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--csm-muted);
  padding-bottom: 10px;
  border-bottom: 2px solid var(--csm-orange);
  margin-bottom: 16px;
}
.csm-widget-recent { display: flex; flex-direction: column; gap: 14px; }
.csm-widget-item { display: grid; grid-template-columns: 62px 1fr; gap: 12px; }
.csm-widget-thumb {
  aspect-ratio: 4/3;
  border-radius: var(--csm-radius-sm);
  overflow: hidden;
}
.csm-widget-thumb img { width: 100%; height: 100%; object-fit: cover; }
.csm-widget-thumb-ph {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--csm-navy) 0%, #0a284a 100%);
}
.csm-widget-item-cat {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--csm-orange);
  margin-bottom: 3px;
}
.csm-widget-item-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--csm-text);
  transition: color var(--csm-transition);
}
.csm-widget-item-title a:hover { color: var(--csm-orange); }
.csm-widget-item-date { font-size: 11px; color: var(--csm-light); margin-top: 4px; }

.csm-widget-cats { display: flex; flex-direction: column; }
.csm-widget-cat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--csm-border);
  font-size: 13px;
  font-weight: 500;
  transition: color var(--csm-transition);
  text-decoration: none;
  color: var(--csm-text);
}
.csm-widget-cat-item:last-child { border-bottom: none; }
.csm-widget-cat-item:hover { color: var(--csm-orange); }
.csm-widget-cat-count {
  background: var(--csm-tag-bg);
  color: var(--csm-muted);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
}

/* Newsletter sidebar */
.csm-newsletter {
  background: var(--csm-navy);
  color: #fff;
  border-radius: var(--csm-radius-lg);
  padding: 22px;
}
.csm-newsletter-title {
  font-family: var(--csm-display);
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.3;
}
.csm-newsletter-desc { font-size: 13px; opacity: 0.72; line-height: 1.6; margin-bottom: 16px; }
.csm-newsletter input[type="email"] {
  width: 100%;
  padding: 10px 14px;
  border: none;
  border-radius: var(--csm-radius-sm);
  font-size: 13px;
  margin-bottom: 10px;
  background: rgba(255,255,255,0.12);
  color: #fff;
  outline: none;
  font-family: var(--csm-body);
}
.csm-newsletter input::placeholder { color: rgba(255,255,255,0.4); }
.csm-newsletter input:focus { background: rgba(255,255,255,0.18); }
.csm-newsletter button {
  width: 100%;
  padding: 10px;
  background: var(--csm-orange);
  color: #fff;
  border: none;
  border-radius: var(--csm-radius-sm);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: var(--csm-body);
  transition: background var(--csm-transition);
}
.csm-newsletter button:hover { background: var(--csm-orange-hover); }

/* ── FOOTER ── */
.csm-footer {
  background: var(--csm-navy-dark);
  color: rgba(255,255,255,0.6);
  padding: 44px 24px 24px;
}
.csm-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 32px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 20px;
}
.csm-footer-logo { font-family: var(--csm-display); font-size: 20px; font-weight: 700; color: #fff; }
.csm-footer-logo em { color: var(--csm-orange); font-style: normal; }
.csm-footer-desc { font-size: 13px; line-height: 1.7; margin-top: 10px; }
.csm-footer-col h4 {
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.csm-footer-col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 9px; }
.csm-footer-col ul li a { font-size: 13px; color: rgba(255,255,255,0.5); transition: color var(--csm-transition); }
.csm-footer-col ul li a:hover { color: var(--csm-orange); }
.csm-footer-bottom {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  flex-wrap: wrap;
  gap: 10px;
}
.csm-footer-links { display: flex; gap: 16px; }
.csm-footer-links a { color: rgba(255,255,255,0.35); transition: color var(--csm-transition); }
.csm-footer-links a:hover { color: #fff; }

/* ── LATEST LIST (shortcode) ── */
.csm-latest-list { list-style: none; padding: 0; margin: 0; }
.csm-latest-list li { padding: 8px 0; border-bottom: 1px solid var(--csm-border); font-size: 14px; }
.csm-latest-list li:last-child { border-bottom: none; }
.csm-latest-list .csm-date { font-size: 11px; color: var(--csm-light); margin-left: 8px; }

/* ── PAGINATION ── */
.csm-pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 40px;
}
.csm-pagination a, .csm-pagination span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--csm-radius-sm);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--csm-border);
  background: var(--csm-card);
  color: var(--csm-text);
  transition: all var(--csm-transition);
}
.csm-pagination a:hover, .csm-pagination span.current {
  background: var(--csm-navy);
  border-color: var(--csm-navy);
  color: #fff;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablet */
@media (max-width: 960px) {
  .csm-hero { grid-template-columns: 1fr; }
  .csm-hero-sidebar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
    border-radius: var(--csm-radius-lg);
  }
  .csm-grid { grid-template-columns: repeat(2, 1fr); }
  .csm-cols-4 { grid-template-columns: repeat(2, 1fr); }
  .csm-masthead-inner { grid-template-columns: 1fr auto; }
  .csm-masthead-tagline { display: none; }
  .csm-footer-inner { grid-template-columns: repeat(2, 1fr); }
  .csm-related-grid { grid-template-columns: repeat(2, 1fr); }
  .csm-article-layout { grid-template-columns: 1fr; }
  .csm-sidebar { display: grid; grid-template-columns: repeat(2, 1fr); }
  .csm-newsletter { grid-column: 1 / -1; }
}

/* Mobile */
@media (max-width: 640px) {
  .csm-topbar { display: none; }  /* nasconde topbar su mobile */
  .csm-masthead { padding: 0 16px; }
  .csm-masthead-inner { padding: 14px 0; gap: 10px; }
  .csm-logo-name { font-size: 17px; }
  .csm-nav { padding: 0 16px; }
  .csm-nav-cats { display: none; }
  .csm-nav-cats.csm-open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 48px;
    left: 0; right: 0;
    background: var(--csm-navy-dark);
    z-index: 300;
    padding: 8px 0 16px;
  }
  .csm-nav-cats.csm-open li a { height: 40px; padding: 0 24px; border-bottom: none; }
  .csm-nav-toggle { display: flex; }
  .csm-nav-home span { display: none; }  /* solo icona su mobile */
  .csm-main { padding: 20px 16px 40px; }
  .csm-hero-title { font-size: 22px; }
  .csm-grid { grid-template-columns: 1fr; }
  .csm-cols-2, .csm-cols-3, .csm-cols-4 { grid-template-columns: 1fr; }
  .csm-hero-sidebar { grid-template-columns: 1fr; }
  .csm-footer { padding: 32px 16px 20px; }
  .csm-footer-inner { grid-template-columns: 1fr; gap: 24px; }
  .csm-article-title { font-size: 26px; }
  .csm-article-body { font-size: 16px; }
  .csm-sidebar { grid-template-columns: 1fr; }
  .csm-related-grid { grid-template-columns: 1fr; }
  .csm-footer-bottom { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 400px) {
  .csm-hero-title { font-size: 19px; }
  .csm-article-title { font-size: 22px; }
}

/* ── Reading progress bar ── */
.csm-reading-progress-wrap {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  z-index: 9999;
}
.csm-reading-progress {
  height: 100%;
  width: 0;
  background: var(--csm-orange);
  transition: width 0.1s linear;
  border-radius: 0 2px 2px 0;
}

/* ── Breadcrumb ── */
.csm-breadcrumb {
  font-size: .8rem;
  color: var(--csm-muted);
  margin-bottom: 1rem;
}
.csm-breadcrumb a {
  color: var(--csm-navy);
  text-decoration: none;
}
.csm-breadcrumb a:hover { text-decoration: underline; }

/* ── Article standfirst ── */
.csm-article-standfirst {
  font-size: 1.2rem;
  line-height: 1.6;
  color: var(--csm-muted);
  border-left: 4px solid var(--csm-orange);
  padding-left: 1rem;
  margin: 1.25rem 0;
  font-style: italic;
}

/* ── Reading time ── */
.csm-meta-reading {
  margin-left: auto;
  font-size: .8rem;
  color: var(--csm-muted);
  background: var(--csm-light);
  padding: .25rem .6rem;
  border-radius: var(--csm-radius-sm);
}

/* ── Article cover ── */
.csm-article-cover {
  margin: 1.5rem 0 2rem;
  border-radius: var(--csm-radius-lg);
  overflow: hidden;
}
.csm-article-cover-img {
  width: 100%;
  height: auto;
  display: block;
}
.csm-article-cover-caption {
  font-size: .8rem;
  color: var(--csm-muted);
  padding: .5rem 0 0;
  text-align: center;
}

/* ── Article content typography ── */
.csm-article-content {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--csm-text);
}
.csm-article-content h2,
.csm-article-content h3,
.csm-article-content h4 {
  font-family: 'Playfair Display', serif;
  color: var(--csm-navy);
  margin-top: 2rem;
}
.csm-article-content p { margin-bottom: 1.2rem; }
.csm-article-content a { color: var(--csm-orange); }
.csm-article-content blockquote {
  border-left: 4px solid var(--csm-orange);
  margin: 1.5rem 0;
  padding: .75rem 1.25rem;
  background: var(--csm-light);
  border-radius: 0 var(--csm-radius) var(--csm-radius) 0;
  font-style: italic;
  color: var(--csm-navy);
}
.csm-article-content img {
  max-width: 100%;
  border-radius: var(--csm-radius);
}

/* ── Article tags ── */
.csm-article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: 2rem 0 1.5rem;
}

/* ── Share buttons ── */
.csm-share {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: 1rem 0;
  border-top: 1px solid var(--csm-border);
  border-bottom: 1px solid var(--csm-border);
  margin: 1.5rem 0;
  flex-wrap: wrap;
}
.csm-share-label {
  font-weight: 600;
  font-size: .85rem;
  color: var(--csm-navy);
  margin-right: .25rem;
}
.csm-share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--csm-radius-sm);
  font-weight: 700;
  font-size: .8rem;
  text-decoration: none;
  color: #fff;
  transition: opacity .2s, transform .15s;
}
.csm-share-btn:hover { opacity: .85; transform: translateY(-2px); }
.csm-share-fb { background: #1877f2; }
.csm-share-tw { background: #000; }
.csm-share-li { background: #0a66c2; }
.csm-share-wa { background: #25d366; }

/* ── Author box ── */
.csm-author-box {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  background: var(--csm-light);
  border-radius: var(--csm-radius-lg);
  padding: 1.25rem;
  margin: 2rem 0;
}
.csm-author-box-avatar {
  width: 72px !important;
  height: 72px !important;
  border-radius: 50%;
  flex-shrink: 0;
}
.csm-author-box-name {
  font-weight: 700;
  font-family: 'Playfair Display', serif;
  font-size: 1.05rem;
  color: var(--csm-navy);
  margin-bottom: .25rem;
}
.csm-author-box-bio {
  font-size: .9rem;
  color: var(--csm-muted);
  line-height: 1.5;
  margin: 0;
}

/* ── Post nav ── */
.csm-post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 2rem 0;
}
.csm-post-nav-prev,
.csm-post-nav-next {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  padding: 1rem;
  background: var(--csm-light);
  border-radius: var(--csm-radius);
  text-decoration: none;
  transition: background .2s;
}
.csm-post-nav-next { text-align: right; }
.csm-post-nav-prev:hover,
.csm-post-nav-next:hover { background: var(--csm-border); }
.csm-post-nav-dir {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--csm-orange);
  font-weight: 600;
}
.csm-post-nav-title {
  font-size: .9rem;
  color: var(--csm-navy);
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Sidebar widgets ── */
.csm-sidebar-widget {
  background: var(--csm-light);
  border-radius: var(--csm-radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}
.csm-sidebar-title {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  color: var(--csm-navy);
  margin: 0 0 1rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--csm-orange);
}
.csm-widget-about .csm-widget-logo {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--csm-navy);
  margin-bottom: .5rem;
}
.csm-widget-about p,
.csm-widget-newsletter p {
  font-size: .9rem;
  color: var(--csm-muted);
  margin-bottom: 1rem;
}
.csm-sidebar-btn {
  display: inline-block;
  padding: .5rem 1rem;
  background: var(--csm-orange);
  color: #fff;
  border-radius: var(--csm-radius-sm);
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .2s;
}
.csm-sidebar-btn:hover { background: var(--csm-navy); }

/* Sidebar cards */
.csm-sidebar-card {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  padding: .75rem 0;
  border-bottom: 1px solid var(--csm-border);
}
.csm-sidebar-card:last-child { border-bottom: none; }
.csm-sidebar-card-img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--csm-radius-sm);
  flex-shrink: 0;
}
.csm-sidebar-card-title {
  font-size: .88rem;
  font-weight: 600;
  margin: 0 0 .25rem;
  line-height: 1.3;
}
.csm-sidebar-card-title a {
  color: var(--csm-navy);
  text-decoration: none;
}
.csm-sidebar-card-title a:hover { color: var(--csm-orange); }

/* ── Related mobile section ── */
.csm-related-mobile { border-top: 3px solid var(--csm-border); }
.csm-section-heading {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  color: var(--csm-navy);
  margin-bottom: 1.5rem;
}
.csm-grid-3 { grid-template-columns: repeat(3, 1fr); }

/* ── Navigation scrolled state ── */
.csm-nav-scrolled {
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
}

/* ── Responsive additions ── */
@media (max-width: 960px) {
  .csm-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .csm-post-nav { grid-template-columns: 1fr; }
  .csm-post-nav-next { text-align: left; }
}

@media (max-width: 640px) {
  .csm-article-standfirst { font-size: 1rem; }
  .csm-author-box { flex-direction: column; }
  .csm-author-box-avatar { width: 52px !important; height: 52px !important; }
  .csm-share { gap: .4rem; }
  .csm-grid-3 { grid-template-columns: 1fr; }
  .csm-related-mobile { display: none; } /* sidebar already shows related on desktop */
  .csm-sidebar { display: none; } /* sidebar is hidden on mobile */
  .csm-article { width: 100%; }
}

/* ================================================================
   OVERRIDE CRITICI — Bootstrap / WP Block Library reset
   ================================================================ */

/* Rimuove bullet da TUTTE le liste nel contesto magazine */
.csm-body ul,
.csm-body ol,
.csm-nav-list,
.csm-footer-links {
  list-style: none !important;
  margin: 0;
  padding: 0;
}

/* Nav orizzontale — specificità alta per battere Bootstrap */
.csm-nav .csm-nav-list {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap;
  list-style: none !important;
  gap: 0;
  padding: 0 !important;
  margin: 0 !important;
  align-items: center;
}

.csm-nav .csm-nav-list li {
  list-style: none !important;
  display: block !important;
  padding: 0;
  margin: 0;
}

.csm-nav .csm-nav-list li a {
  display: block !important;
  padding: 0.5rem 1rem !important;
  white-space: nowrap;
  font-size: 0.875rem !important;
  font-weight: 500 !important;
  color: var(--csm-text) !important;
  text-decoration: none !important;
  border-radius: var(--csm-radius-sm) !important;
  transition: background var(--csm-transition), color var(--csm-transition) !important;
}

.csm-nav .csm-nav-list li a:hover,
.csm-nav .csm-nav-list li a.active {
  background: var(--csm-tag-bg) !important;
  color: var(--csm-navy) !important;
}

/* Nav toggle spacing */
.csm-nav {
  gap: 0.5rem !important;
}

/* Masthead — battere font del tema */
.csm-masthead-logo,
.csm-logo-name,
.csm-logo-badge {
  font-family: 'Playfair Display', Georgia, serif !important;
}

/* Titoli articoli nelle card — battere reset Bootstrap/GP */
.csm-card-title a,
.csm-hero-title a,
.csm-side-card-title a,
.csm-article-title {
  color: var(--csm-navy) !important;
  text-decoration: none !important;
}

/* Forza body background magazine */
.csm-body {
  background: var(--csm-bg) !important;
  font-family: 'Inter', system-ui, sans-serif !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Rimuove padding body di Bootstrap */
.csm-body.wp-singular,
.csm-body.home {
  padding: 0 !important;
}

/* Footer links orizzontali */
.csm-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  list-style: none !important;
}

/* Nasconde elementi del tema che GP potrebbe iniettare */
.csm-body .site-header,
.csm-body .main-navigation,
.csm-body #site-navigation,
.csm-body .generate-back-to-top,
.csm-body #page,
.csm-body .site-footer {
  display: none !important;
}

/* ── RESET GLOBALE LINK — azzera stili tema/Bootstrap su tutto il magazine ── */
.csm-body a {
  color: inherit !important;
  text-decoration: none !important;
}

/* Masthead logo: nessun underline, colori corretti */
.csm-masthead-logo {
  color: var(--csm-navy) !important;
  text-decoration: none !important;
  border: none !important;
  box-shadow: none !important;
}

.csm-logo-name {
  color: var(--csm-navy) !important;
  text-decoration: none !important;
}

.csm-logo-badge {
  color: #fff !important;
  text-decoration: none !important;
}

/* Topbar links */
.csm-topbar a {
  color: #fff !important;
  text-decoration: none !important;
}

/* Tag links */
.csm-tag,
a.csm-tag {
  color: var(--csm-tag-text) !important;
  text-decoration: none !important;
}

/* Footer links */
.csm-footer-links a,
.csm-footer a {
  color: rgba(255,255,255,0.75) !important;
  text-decoration: none !important;
}

.csm-footer-links a:hover,
.csm-footer a:hover {
  color: #fff !important;
}

/* Sidebar card links */
.csm-sidebar-card-title a,
.csm-sidebar-btn {
  text-decoration: none !important;
}

/* Share buttons */
.csm-share-btn {
  text-decoration: none !important;
}

/* Post nav */
.csm-post-nav-prev,
.csm-post-nav-next {
  text-decoration: none !important;
}
