/*
Theme Name: PMD — Paolo Miki D'Agostini
Theme URI: https://paolomikidagostini.it
Author: Paolo Miki D'Agostini
Description: Tema editoriale "quotidiano moderno" per il blog di informazione economica di Paolo Miki D'Agostini. Tipografia Cormorant Garamond + Jost, palette inchiostro e oro su fondo avorio.
Version: 1.3.2
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: pmd
Tags: blog, news, one-column, custom-menu
*/

/* ============ Tokens ============ */
:root {
  --ink: oklch(0.21 0.035 258);
  --ink-60: oklch(0.21 0.035 258 / 0.6);
  --ink-50: oklch(0.21 0.035 258 / 0.5);
  --line: oklch(0.21 0.035 258 / 0.25);
  --line-soft: oklch(0.21 0.035 258 / 0.18);
  --gold: oklch(0.66 0.08 78);
  --paper: oklch(0.975 0.006 85);
  --paper-2: oklch(0.955 0.008 85);
  --up: oklch(0.55 0.12 150);
  --down: oklch(0.55 0.16 25);
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Jost", "Helvetica Neue", sans-serif;
}

/* ============ Base ============ */
* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  font-size: 17px;
  line-height: 1.85;
}
a { color: var(--ink); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--gold); }
img { max-width: 100%; height: auto; }
input, button { font-family: var(--sans); }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 32px; }

.kicker {
  font-size: 13px; font-weight: 500; letter-spacing: 0.3em;
  text-transform: uppercase; color: var(--gold);
}
.kicker a { color: var(--gold); }
.meta {
  font-size: 13px; font-weight: 300; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-60);
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
}
.meta .dot { color: var(--gold); }

.section-rule {
  display: flex; align-items: center; gap: 18px; margin: 0 0 28px;
  font-size: 13px; font-weight: 500; letter-spacing: 0.24em; text-transform: uppercase;
}
.section-rule::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ============ Header ============ */
.site-header { padding-top: 14px; }
.masthead {
  display: flex; flex-direction: column; align-items: center; gap: 18px;
}
.brand {
  display: grid; grid-template-columns: auto 2px auto;
  column-gap: 26px; align-items: center; row-gap: 4px;
  color: var(--ink);
}
.brand:hover { color: var(--ink); }
.brand-mono {
  grid-row: 1 / span 2;
  font-family: var(--serif); font-weight: 500;
  font-size: 64px; letter-spacing: 0.06em; line-height: 1;
}
.brand-rule { grid-row: 1 / span 2; width: 2px; align-self: stretch; background: oklch(0.21 0.035 258 / 0.28); }
.brand-name {
  font-family: var(--serif); font-weight: 500;
  font-size: 36px; line-height: 1; white-space: nowrap;
}
.gold { color: var(--gold); }
.brand-payoff {
  grid-column: 3;
  font-weight: 300; text-transform: uppercase; letter-spacing: 0.26em;
  font-size: 11.5px; opacity: 0.6; white-space: nowrap;
}

.site-nav {
  width: 100%;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  display: flex; justify-content: center; align-items: center; gap: 36px;
  padding: 12px 0;
  font-size: 13.5px; font-weight: 400; letter-spacing: 0.16em; text-transform: uppercase;
}
.site-nav ul { display: flex; gap: 36px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; justify-content: center; }
.site-nav li.current-menu-item > a,
.site-nav li.current_page_item > a { color: var(--gold); }

.nav-search { position: relative; border-left: 1px solid var(--line); padding-left: 28px; }
.nav-search summary {
  list-style: none; cursor: pointer; opacity: 0.6; font-size: 13px; letter-spacing: 0.1em;
}
.nav-search summary::-webkit-details-marker { display: none; }
.nav-search summary:hover { opacity: 1; color: var(--gold); }
.nav-search[open] summary { color: var(--gold); opacity: 1; }
.nav-search .pop {
  position: absolute; right: 0; top: calc(100% + 14px); z-index: 50;
  background: var(--paper); border: 1px solid var(--line);
  padding: 14px; box-shadow: 0 10px 30px oklch(0.21 0.035 258 / 0.12);
}

.search-form { display: flex; gap: 0; }
.search-form input[type="search"] {
  background: transparent; border: 1px solid oklch(0.21 0.035 258 / 0.4); border-right: none;
  color: var(--ink); font-weight: 300; font-size: 14px;
  padding: 11px 16px; width: 240px; outline: none;
}
.search-form button {
  background: var(--ink); color: var(--paper); border: none; cursor: pointer;
  font-size: 12px; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase;
  padding: 11px 18px;
}
.search-form button:hover { background: var(--gold); color: var(--ink); }

/* ============ Home ============ */
.hero {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 18px; padding: 60px 0 64px;
  max-width: 880px; margin: 0 auto;
}
.hero-title {
  margin: 0;
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(36px, 4.6vw, 58px); line-height: 1.12;
  text-wrap: balance;
}
.hero-title a:hover { color: oklch(0.35 0.05 258); }
.standfirst {
  font-family: var(--serif); font-style: italic;
  font-size: 22px; line-height: 1.5; color: var(--ink); opacity: 0.78;
  max-width: 720px; margin: 0;
}

.home-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0;
  padding-bottom: 56px;
}
.home-grid .card {
  display: flex; flex-direction: column; gap: 12px; padding: 0 32px;
  border-right: 1px solid var(--line-soft);
}
.home-grid .card:nth-child(3n) { border-right: none; }
.home-grid .card:nth-child(-n+3) { padding-top: 0; }
.home-grid .card:nth-child(n+4) { margin-top: 40px; padding-top: 40px; border-top: 1px solid var(--line-soft); }
.home-grid .card:first-child { padding-left: 0; }
.card .kicker { font-size: 12px; letter-spacing: 0.26em; }
.card-title {
  margin: 0;
  font-family: var(--serif); font-weight: 600;
  font-size: 26px; line-height: 1.2;
}
.card-excerpt { font-size: 14px; line-height: 1.6; color: var(--ink); opacity: 0.7; margin: 0; }
.card-date { font-size: 12px; font-weight: 300; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-50); }

/* ============ Liste archivio / ricerca ============ */
.archive-head {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 14px; padding: 52px 32px 44px;
  border-bottom: 1px solid var(--line);
}
.archive-head .over {
  font-size: 13px; font-weight: 500; letter-spacing: 0.3em; text-transform: uppercase; color: var(--ink-60);
}
.archive-title {
  margin: 0;
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(42px, 5vw, 64px); line-height: 1;
}
.archive-desc {
  font-family: var(--serif); font-style: italic;
  font-size: 21px; line-height: 1.5; opacity: 0.7; max-width: 620px; margin: 0;
}
.archive-count { font-size: 12px; font-weight: 400; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-50); }

.post-row {
  display: grid; grid-template-columns: 150px 1fr auto;
  align-items: baseline; gap: 40px;
  padding: 32px 24px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink);
}
.post-row:hover { background: var(--paper-2); color: var(--ink); }
.post-row .date { font-size: 12.5px; font-weight: 300; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-50); }
.post-row .inner { display: flex; flex-direction: column; gap: 8px; }
.post-row .row-kicker { font-size: 12px; font-weight: 500; letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold); }
.post-row h2 {
  margin: 0;
  font-family: var(--serif); font-weight: 600;
  font-size: 30px; line-height: 1.16;
}
.post-row .excerpt { font-size: 14px; line-height: 1.6; opacity: 0.7; max-width: 760px; }
.post-row .arrow { font-size: 18px; color: var(--gold); }

.pagination, .navigation.posts-navigation { padding: 36px 0; }
.nav-links {
  display: flex; justify-content: center; align-items: center; gap: 22px;
  font-size: 13px; font-weight: 400; letter-spacing: 0.16em; text-transform: uppercase;
}
.nav-links .page-numbers { color: var(--ink); opacity: 0.6; }
.nav-links .page-numbers:hover { color: var(--gold); opacity: 1; }
.nav-links .page-numbers.current {
  color: var(--gold); opacity: 1;
  border-bottom: 1px solid var(--gold); padding-bottom: 2px;
}

/* ============ Articolo ============ */
.single-head {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 18px; padding: 56px 32px 36px;
  max-width: 880px; margin: 0 auto;
}
.single-title {
  margin: 0;
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(34px, 4.4vw, 54px); line-height: 1.12; text-wrap: balance;
}
.single-head .gold-bar { width: 64px; height: 2px; background: var(--gold); margin-top: 8px; }

.entry-content, .page-content-body {
  max-width: 720px; margin: 0 auto; padding: 0 32px 24px;
  font-size: 17px; font-weight: 300; line-height: 1.85;
}
.entry-content > p:first-of-type::first-letter {
  font-family: var(--serif); font-weight: 600;
  font-size: 64px; line-height: 0.8;
  float: left; padding: 10px 12px 0 0; color: var(--gold);
}
/* Gerarchia titoli nei contenuti (blocchi "Titolo" H1–H6) */
.entry-content h1, .entry-content h2, .entry-content h3, .entry-content h4,
.page-content-body h1, .page-content-body h2, .page-content-body h3, .page-content-body h4 {
  font-family: var(--serif); font-weight: 600; line-height: 1.2;
  margin: 2.2em 0 0.6em; color: var(--ink);
}
.entry-content h1, .page-content-body h1 { font-size: 40px; line-height: 1.12; }
.entry-content h2, .page-content-body h2 { font-size: 31px; }
.entry-content h3, .page-content-body h3 { font-size: 25px; }
.entry-content h4, .page-content-body h4 { font-size: 21px; }
.entry-content h5, .page-content-body h5,
.entry-content h6, .page-content-body h6 {
  font-family: var(--sans); font-weight: 500; line-height: 1.4;
  letter-spacing: 0.18em; text-transform: uppercase;
  margin: 2.4em 0 0.8em;
}
.entry-content h5, .page-content-body h5 { font-size: 14px; color: var(--ink); }
.entry-content h6, .page-content-body h6 { font-size: 12.5px; color: var(--gold); }
.entry-content a, .page-content-body a {
  border-bottom: 1px solid var(--gold); padding-bottom: 1px;
}
.entry-content blockquote, .page-content-body blockquote {
  margin: 2.2em auto; padding: 18px 0; text-align: center;
  border-top: 1px solid oklch(0.21 0.035 258 / 0.3);
  border-bottom: 1px solid oklch(0.21 0.035 258 / 0.3);
}
.entry-content blockquote p {
  font-family: var(--serif); font-style: italic; font-weight: 500;
  font-size: 28px; line-height: 1.35; margin: 0; text-wrap: balance;
}
.entry-content blockquote cite {
  display: block; margin-top: 12px;
  font-family: var(--sans); font-style: normal;
  font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-60);
}
.entry-content figure, .entry-content .wp-block-image { margin: 2em 0; }

/* Didascalie immagini — editor a blocchi, editor classico, gallerie, pagine */
.entry-content { counter-reset: pmdfig; }
.entry-content figcaption,
.page-content-body figcaption,
.entry-content .wp-caption-text,
.page-content-body .wp-caption-text {
  font-size: 13px; font-weight: 300; letter-spacing: 0.06em; color: var(--ink-60);
  margin: 10px 0 0; padding: 0; text-align: left; line-height: 1.6;
}
.entry-content .wp-block-image figcaption::before,
.entry-content .wp-caption .wp-caption-text::before {
  counter-increment: pmdfig;
  content: "Fig. " counter(pmdfig);
  font-family: var(--sans); font-weight: 500; font-size: 11px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--gold); margin-right: 10px;
}
.wp-caption { max-width: 100%; }
.entry-content .wp-block-image.aligncenter figcaption,
.entry-content .has-text-align-center figcaption { text-align: center; }
.page-content-body img { border: 1px solid var(--line-soft); }
.entry-content img { border: 1px solid var(--line-soft); }
.entry-content table { width: 100%; border-collapse: collapse; font-size: 15px; margin: 2em 0; }
.entry-content th {
  font-family: var(--sans); font-weight: 500; font-size: 12px;
  letter-spacing: 0.18em; text-transform: uppercase; text-align: left;
  border-top: 2px solid var(--ink); border-bottom: 1px solid var(--line);
  padding: 10px 12px;
}
.entry-content td { border-bottom: 1px solid var(--line-soft); padding: 10px 12px; }
.entry-content .has-text-align-center { text-align: center; }

.entry-tags { display: flex; gap: 10px; flex-wrap: wrap; max-width: 720px; margin: 12px auto 0; padding: 0 32px; }
.entry-tags a {
  font-size: 11.5px; font-weight: 400; letter-spacing: 0.16em; text-transform: uppercase;
  border: 1px solid oklch(0.21 0.035 258 / 0.3); padding: 6px 14px;
}
.entry-tags a:hover { border-color: var(--gold); color: var(--gold); }

.author-box {
  max-width: 720px; margin: 26px auto 0; padding: 26px 32px 0;
  border-top: 1px solid var(--line);
  display: flex; gap: 22px; align-items: center;
}
.author-box .avatar-wrap { flex: none; }
.author-box img.avatar { border-radius: 50%; border: 1px solid var(--line); display: block; }
.author-box .name { font-family: var(--serif); font-weight: 600; font-size: 21px; }
.author-box .bio { font-size: 13.5px; line-height: 1.6; opacity: 0.7; }

.related { border-top: 1px solid var(--line); margin-top: 52px; padding: 40px 0 52px; }

/* ============ Pagine ============ */
.page-head {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 16px; padding: 60px 32px 40px;
}
.page-title {
  margin: 0;
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(40px, 5vw, 60px); line-height: 1.05;
}
.page-content-body { padding-bottom: 64px; }

/* ============ Footer (banda blu) ============ */
.site-footer {
  background: var(--ink);
  color: oklch(0.975 0.006 85 / 0.75);
  margin-top: 64px;
}
.site-footer .inner {
  max-width: 1200px; margin: 0 auto; padding: 34px 32px;
  display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap;
  font-size: 12.5px; font-weight: 300; letter-spacing: 0.08em;
}
.foot-brand { display: flex; align-items: center; gap: 18px; }
.foot-mono {
  font-family: var(--serif); font-weight: 500;
  font-size: 26px; letter-spacing: 0.06em; line-height: 1;
  color: oklch(0.975 0.006 85);
}
.site-footer a { color: oklch(0.975 0.006 85 / 0.75); }
.site-footer a:hover { color: var(--gold); }
.site-footer .links { display: flex; gap: 24px; }

/* ============ 404 / vuoto ============ */
.nothing {
  text-align: center; padding: 80px 32px 96px; max-width: 640px; margin: 0 auto;
}
.nothing h1 { font-family: var(--serif); font-weight: 600; font-size: 52px; margin: 0 0 16px; }

/* ============ Responsive ============ */
@media (max-width: 900px) {
  .home-grid { grid-template-columns: 1fr; }
  .home-grid .card { border-right: none; padding: 0; }
  .home-grid .card:nth-child(n+2) { margin-top: 32px; padding-top: 32px; border-top: 1px solid var(--line-soft); }
  .post-row { grid-template-columns: 1fr; gap: 10px; }
  .post-row .arrow { display: none; }
  .brand { grid-template-columns: auto; justify-items: center; row-gap: 10px; }
  .brand-rule { display: none; }
  .brand-mono { grid-row: auto; }
  .brand-payoff { grid-column: auto; }
  .site-nav { gap: 20px; flex-wrap: wrap; padding: 12px 16px; }
  .site-nav ul { gap: 20px; }
  .nav-search { border-left: none; padding-left: 0; }
  .site-footer .inner { flex-direction: column; align-items: flex-start; gap: 14px; }
}
