/*
Theme Name: Controeditoriale
Theme URI: https://www.controeditoriale.com/
Author: Giorgio Giardina / OpenAI
Author URI: https://giorgiogiardina.it/
Description: Tema editoriale custom per Controeditoriale: netto, leggibile, veloce, orientato a opinione, approfondimento, sarcasmo e monetizzazione futura.
Version: 1.0.0
Requires at least: 6.5
Tested up to: 7.0
Requires PHP: 8.1
Text Domain: controeditoriale
License: GPL-2.0-or-later
*/

:root {
  --ce-paper: #f4f0e8;
  --ce-paper-2: #ebe5d9;
  --ce-ink: #111111;
  --ce-muted: #655f56;
  --ce-red: #bd171d;
  --ce-red-dark: #8f0f14;
  --ce-white: #fffdf8;
  --ce-border: #cfc7b9;
  --ce-max: 1240px;
  --ce-reading: 780px;
  --ce-shadow: 0 18px 45px rgba(17,17,17,.09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ce-paper);
  color: var(--ce-ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; }
a { color: inherit; text-decoration-color: rgba(189,23,29,.5); text-underline-offset: .18em; }
a:hover { color: var(--ce-red); }
button, input, textarea, select { font: inherit; }

.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;
}

.ce-wrap { width: min(calc(100% - 32px), var(--ce-max)); margin-inline: auto; }
.ce-reading { width: min(calc(100% - 32px), var(--ce-reading)); margin-inline: auto; }

.site-header {
  border-bottom: 1px solid var(--ce-ink);
  background: rgba(244,240,232,.96);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
}
.admin-bar .site-header { top: 32px; }
.ce-masthead {
  min-height: 98px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 24px;
}
.site-branding { min-width: 0; }
.ce-logo {
  display: inline-flex;
  align-items: baseline;
  gap: .16em;
  color: var(--ce-ink);
  text-decoration: none;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 900;
  font-size: clamp(2rem, 5vw, 4.4rem);
  line-height: .9;
  letter-spacing: -.065em;
}
.ce-logo__contra {
  display: inline-block;
  background: var(--ce-red);
  color: white;
  padding: .08em .16em .11em;
  letter-spacing: -.04em;
}
.ce-tagline {
  margin: .55rem 0 0;
  color: var(--ce-muted);
  font-size: .92rem;
  font-weight: 650;
  letter-spacing: .01em;
}

.ce-menu-toggle {
  display: none;
  border: 1px solid var(--ce-ink);
  background: transparent;
  padding: .65rem .8rem;
  cursor: pointer;
}
.primary-nav { border-top: 1px solid var(--ce-border); }
.primary-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
}
.primary-nav a {
  display: block;
  text-decoration: none;
  padding: .72rem .95rem;
  font-size: .83rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .055em;
}
.primary-nav li:first-child a { padding-left: 0; }
.primary-nav .current-menu-item > a,
.primary-nav .current-menu-ancestor > a { color: var(--ce-red); }

.ce-breaking {
  background: var(--ce-ink);
  color: white;
  border-bottom: 4px solid var(--ce-red);
}
.ce-breaking__inner {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: .85rem;
  font-size: .92rem;
}
.ce-breaking__label {
  color: #fff;
  background: var(--ce-red);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: .22rem .48rem;
  white-space: nowrap;
}
.ce-breaking a { text-decoration: none; }

.ce-main { padding: 42px 0 70px; }
.ce-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  color: var(--ce-red);
  font-size: .76rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .085em;
}
.ce-eyebrow::before { content: ""; width: 24px; height: 3px; background: currentColor; }

.ce-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, .8fr);
  gap: 28px;
  margin-bottom: 46px;
}
.ce-feature {
  min-height: 540px;
  position: relative;
  overflow: hidden;
  background: var(--ce-ink);
  box-shadow: var(--ce-shadow);
}
.ce-feature img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .62;
  filter: saturate(.82) contrast(1.05);
  transition: transform .6s ease, opacity .3s ease;
}
.ce-feature:hover img { transform: scale(1.025); opacity: .7; }
.ce-feature::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 20%, rgba(17,17,17,.86) 86%);
}
.ce-feature__content {
  position: absolute;
  z-index: 2;
  inset: auto 0 0;
  color: white;
  padding: clamp(24px, 4vw, 52px);
}
.ce-feature h1, .ce-feature h2 {
  margin: .5rem 0 .75rem;
  max-width: 900px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.35rem, 5.2vw, 5.2rem);
  line-height: .98;
  letter-spacing: -.05em;
}
.ce-feature a { text-decoration: none; color: inherit; }
.ce-feature__meta { color: rgba(255,255,255,.78); font-size: .92rem; }

.ce-side-stack { display: grid; gap: 18px; align-content: start; }
.ce-side-card {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--ce-border);
}
.ce-side-card img { width: 118px; aspect-ratio: 1 / 1; object-fit: cover; background: var(--ce-paper-2); }
.ce-side-card h3 {
  margin: .15rem 0 .35rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.22rem;
  line-height: 1.12;
  letter-spacing: -.025em;
}
.ce-side-card a { text-decoration: none; }

.ce-section { margin-top: 58px; }
.ce-section__head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  padding-bottom: 10px;
  border-bottom: 4px solid var(--ce-ink);
  margin-bottom: 22px;
}
.ce-section__head h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3.7rem);
  line-height: .95;
  letter-spacing: -.045em;
}
.ce-section__head a { font-size: .85rem; font-weight: 850; text-transform: uppercase; text-decoration: none; }

.ce-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
}
.ce-card {
  background: var(--ce-white);
  border: 1px solid var(--ce-border);
  min-width: 0;
  transition: transform .18s ease, box-shadow .18s ease;
}
.ce-card:hover { transform: translateY(-3px); box-shadow: var(--ce-shadow); }
.ce-card__media { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--ce-paper-2); }
.ce-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .45s ease; }
.ce-card:hover .ce-card__media img { transform: scale(1.035); }
.ce-card__body { padding: 20px; }
.ce-card h2, .ce-card h3 {
  margin: .45rem 0 .6rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.55rem, 2.2vw, 2.15rem);
  line-height: 1.03;
  letter-spacing: -.035em;
}
.ce-card h2 a, .ce-card h3 a { text-decoration: none; }
.ce-card p { color: var(--ce-muted); margin: 0; }
.ce-meta { color: var(--ce-muted); font-size: .82rem; }
.ce-meta a { text-decoration: none; }

.ce-sarcasm {
  margin-top: 62px;
  background: var(--ce-red);
  color: white;
  padding: clamp(28px, 5vw, 60px);
  transform: rotate(-.35deg);
}
.ce-sarcasm > * { transform: rotate(.35deg); }
.ce-sarcasm h2 {
  margin: 0 0 24px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3rem, 8vw, 7rem);
  line-height: .82;
  letter-spacing: -.07em;
}
.ce-sarcasm__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.ce-sarcasm a { color: white; text-decoration-color: rgba(255,255,255,.7); }
.ce-sarcasm h3 { font-size: 1.45rem; line-height: 1.08; margin: 0; }

.ce-newsletter {
  margin: 64px 0 0;
  padding: clamp(28px, 5vw, 62px);
  background: var(--ce-ink);
  color: white;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 38px;
  align-items: center;
}
.ce-newsletter h2 {
  margin: 0 0 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.5rem, 5vw, 5rem);
  line-height: .9;
  letter-spacing: -.06em;
}
.ce-newsletter p { color: rgba(255,255,255,.78); }
.ce-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: .78rem 1.1rem;
  border: 0;
  background: var(--ce-red);
  color: white;
  text-decoration: none;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .05em;
  cursor: pointer;
}
.ce-button:hover { background: white; color: var(--ce-ink); }

/* Article */
.ce-article-header { padding: 34px 0 24px; }
.ce-article-header h1 {
  margin: .6rem 0 1rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.1rem, 8vw, 7.2rem);
  line-height: .88;
  letter-spacing: -.075em;
  overflow-wrap: anywhere;
}
.ce-deck {
  max-width: 880px;
  margin: 0 0 1rem;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ce-muted);
  font-size: clamp(1.3rem, 2.2vw, 1.8rem);
  line-height: 1.28;
}
.ce-article-hero { width: min(calc(100% - 32px), 1440px); margin: 12px auto 40px; }
.ce-article-hero img { width: 100%; max-height: 760px; object-fit: cover; }
.ce-article-layout {
  width: min(calc(100% - 32px), 1100px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 170px minmax(0, var(--ce-reading));
  gap: 48px;
  align-items: start;
}
.ce-article-aside { position: sticky; top: 145px; font-size: .84rem; color: var(--ce-muted); }
.ce-reading-time { padding-top: 10px; border-top: 4px solid var(--ce-red); }
.ce-entry-content {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.16rem, 1.5vw, 1.3rem);
  line-height: 1.78;
  min-width: 0;
}
.ce-entry-content > p:first-child { font-size: 1.18em; }
.ce-entry-content h2, .ce-entry-content h3, .ce-entry-content h4 {
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  line-height: 1.08;
  letter-spacing: -.04em;
  margin: 2.2em 0 .65em;
}
.ce-entry-content h2 { font-size: clamp(2rem, 4vw, 3.4rem); }
.ce-entry-content h3 { font-size: clamp(1.55rem, 3vw, 2.35rem); }
.ce-entry-content blockquote {
  margin: 2em 0;
  padding: 1.1rem 0 1.1rem 1.4rem;
  border-left: 7px solid var(--ce-red);
  font-size: 1.35em;
  line-height: 1.35;
  font-style: italic;
}
.ce-entry-content figure { margin: 2.2em 0; }
.ce-entry-content figcaption { color: var(--ce-muted); font-family: Inter, sans-serif; font-size: .78rem; }
.ce-entry-content iframe { max-width: 100%; }
.ce-entry-content a { color: var(--ce-red-dark); font-weight: 650; }
.ce-entry-content ul, .ce-entry-content ol { padding-left: 1.25em; }
.ce-entry-content pre { overflow-x: auto; padding: 1rem; background: #1a1a1a; color: white; }

.ce-author-box {
  width: min(calc(100% - 32px), var(--ce-reading));
  margin: 58px auto 0;
  padding: 28px;
  border: 1px solid var(--ce-border);
  background: var(--ce-white);
}
.ce-author-box h3 { margin: 0 0 .35rem; font-size: 1.5rem; }
.ce-author-box p { margin: .4rem 0 0; color: var(--ce-muted); }

.ce-tags { width: min(calc(100% - 32px), var(--ce-reading)); margin: 26px auto; display: flex; flex-wrap: wrap; gap: 8px; }
.ce-tags a { border: 1px solid var(--ce-ink); padding: .25rem .55rem; text-decoration: none; font-size: .78rem; font-weight: 750; }

.ce-archive-head { margin-bottom: 32px; max-width: 900px; }
.ce-archive-head h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3rem, 7vw, 6.7rem);
  line-height: .88;
  letter-spacing: -.065em;
}
.ce-pagination { margin-top: 42px; }
.ce-pagination .nav-links { display: flex; gap: 8px; flex-wrap: wrap; }
.ce-pagination a, .ce-pagination span { padding: .6rem .82rem; border: 1px solid var(--ce-ink); text-decoration: none; }
.ce-pagination .current { background: var(--ce-ink); color: white; }

.site-footer {
  background: var(--ce-ink);
  color: white;
  border-top: 8px solid var(--ce-red);
  padding: 46px 0 26px;
}
.ce-footer-grid { display: grid; grid-template-columns: 1.3fr .7fr .7fr; gap: 36px; }
.ce-footer-title { font-family: Georgia, serif; font-size: 2.4rem; font-weight: 900; letter-spacing: -.05em; }
.site-footer h3 { margin-top: 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: #bdb7ae; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer a { color: white; text-decoration-color: rgba(255,255,255,.4); }
.ce-footer-bottom { margin-top: 34px; padding-top: 20px; border-top: 1px solid #444; color: #aaa; font-size: .8rem; }

@media (max-width: 960px) {
  .ce-hero-grid, .ce-newsletter { grid-template-columns: 1fr; }
  .ce-card-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .ce-article-layout { grid-template-columns: 1fr; width: min(calc(100% - 32px), var(--ce-reading)); gap: 20px; }
  .ce-article-aside { position: static; }
  .ce-footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  .admin-bar .site-header { top: 46px; }
  .ce-masthead { min-height: 76px; grid-template-columns: 1fr auto; }
  .ce-logo { font-size: clamp(1.65rem, 9vw, 2.7rem); }
  .ce-tagline { display: none; }
  .ce-menu-toggle { display: inline-flex; }
  .primary-nav { display: none; }
  .primary-nav.is-open { display: block; }
  .primary-nav ul { display: block; padding: 8px 0 14px; }
  .primary-nav a, .primary-nav li:first-child a { padding: .72rem 0; border-bottom: 1px solid var(--ce-border); }
  .ce-hero-grid { margin-bottom: 28px; }
  .ce-feature { min-height: 430px; }
  .ce-side-card { grid-template-columns: 88px 1fr; }
  .ce-side-card img { width: 88px; }
  .ce-card-grid, .ce-sarcasm__grid, .ce-footer-grid { grid-template-columns: 1fr; }
  .ce-main { padding-top: 28px; }
  .ce-article-header h1 { font-size: clamp(2.8rem, 15vw, 5rem); }
}
