/*
Theme Name: Attrezzi Verde
Theme URI: https://attrezziverde.it
Author: Redazione Attrezzi Verde
Author URI: https://attrezziverde.it
Description: Tema leggero e chiaro di Attrezzi Verde. Niente framework, niente jQuery, niente build.
Version: 1.0.2
Requires at least: 6.4
Tested up to: 7.1
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: attrezziverde
*/

/* ============================================================
   FONT DEI TITOLI (incluso nel tema, nessuna richiesta esterna)
   ============================================================ */
@font-face {
  font-family: "Titoli";
  src: url("assets/titoli.woff2") format("woff2");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}

/* ============================================================
   COLORI E MISURE (solo tema chiaro)
   ============================================================ */
:root {
  --accent:     #15803D;
  --accent-ink: #FFFFFF;
  --tinta:      color-mix(in srgb, var(--accent) 8%, #FFFFFF);
  --bg:         #FAFAF9;
  --surface:    #FFFFFF;
  --ink:        #1C1917;
  --ink-soft:   #57534E;
  --line:       #E7E5E4;
  --link:       var(--accent);
  --radius:     12px;
  --maxw:       1120px;
  --readw:      720px;
  --shadow:     0 1px 2px rgba(28,25,23,.04), 0 8px 24px -12px rgba(28,25,23,.14);
  --font-body:  ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-head:  "Titoli", var(--font-body);
  color-scheme: light;
}

/* ============================================================
   RESET
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
[id] { scroll-margin-top: 96px; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, picture, svg, video { display: block; max-width: 100%; height: auto; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input { font: inherit; color: inherit; }

/* ============================================================
   LAYOUT
   ============================================================ */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2rem); }
.read { max-width: var(--readw); margin-inline: auto; }
.section { padding-block: clamp(2rem, 5vw, 3.25rem); }
.section__title { font-family: var(--font-head); font-weight: 750; font-size: 1.35rem; letter-spacing: -.01em; margin-bottom: 1.2rem; }

/* ============================================================
   TESTATA
   ============================================================ */
.masthead {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.masthead__inner { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; min-height: 68px; }
.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand svg, .brand img { height: 38px; width: auto; }
@media (max-width: 560px) { .brand svg, .brand img { height: 32px; } }

.site-nav__list, .site-nav__list li { list-style: none !important; margin: 0 !important; padding: 0 !important; }
.site-nav__list { display: flex; align-items: center; gap: .2rem; flex-wrap: wrap; }
.site-nav__list a {
  display: inline-flex; align-items: center; position: relative;
  font-weight: 600; font-size: .95rem; color: var(--ink-soft);
  padding: .5rem .55rem; border-radius: 8px; text-decoration: none; transition: color .15s, background .15s;
}
.site-nav__list a:hover { color: var(--ink); background: var(--tinta); text-decoration: none; }
.site-nav__list .current-menu-item > a, .site-nav__list .current-cat > a,
.site-nav__list .current-post-ancestor > a, .site-nav__list .current-category-ancestor > a { color: var(--accent); }

.masthead__toggle {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 42px; height: 42px; padding: 0 10px; cursor: pointer;
  background: none; border: 1px solid var(--line); border-radius: 10px;
}
.masthead__toggle-bar { display: block; height: 2px; width: 100%; background: var(--ink); border-radius: 2px; transition: transform .25s ease, opacity .2s ease; }
.masthead__toggle.is-active .masthead__toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.masthead__toggle.is-active .masthead__toggle-bar:nth-child(2) { opacity: 0; }
.masthead__toggle.is-active .masthead__toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 860px) {
  .masthead__toggle { display: flex; }
  .site-nav { position: absolute; left: 0; right: 0; top: 100%; background: var(--surface); border-bottom: 1px solid var(--line);
    padding: .5rem clamp(1rem, 4vw, 2rem) 1rem; display: none; }
  .site-nav.is-open { display: block; }
  .site-nav__list { flex-direction: column; align-items: stretch; gap: 0; }
  .site-nav__list li + li { border-top: 1px solid var(--line); }
  .site-nav__list a { display: flex; padding: .85rem .25rem; font-size: 1.05rem; border-radius: 0; }
  .site-nav__list a:hover { background: none; }
}

/* ============================================================
   HOME
   ============================================================ */
.hero { padding-block: clamp(2.5rem, 7vw, 4.5rem) clamp(1.5rem, 4vw, 2.5rem); border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--tinta), var(--bg)); }
.hero .hero__eyebrow { font-size: .78rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--accent); }
.hero h1 { font-family: var(--font-head); font-weight: 800; letter-spacing: -.025em; font-size: clamp(2rem, 5.2vw, 3.2rem); line-height: 1.08; margin-top: .5rem; max-width: 22ch; }
.hero p { color: var(--ink-soft); font-size: 1.12rem; margin-top: .9rem; max-width: 58ch; }
.hero .search-form { margin-top: 1.6rem; max-width: 520px; }

.topics { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.topic {
  display: flex; flex-direction: column; gap: .35rem; padding: 1.1rem 1.2rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.topic:hover { text-decoration: none; border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-2px); }
.topic__name { font-family: var(--font-head); font-weight: 700; font-size: 1.08rem; display: flex; justify-content: space-between; gap: .5rem; }
.topic__name::after { content: "→"; color: var(--accent); }
.topic__desc { color: var(--ink-soft); font-size: .9rem; line-height: 1.45; }
.topic__count { font-size: .78rem; color: var(--ink-soft); margin-top: auto; }

.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 1.6rem; color: var(--ink-soft); }

/* ============================================================
   ARCHIVI
   ============================================================ */
.page-hero { padding-block: clamp(2rem, 5vw, 3rem) 1rem; }
.page-hero h1 { font-family: var(--font-head); font-weight: 800; letter-spacing: -.025em; font-size: clamp(1.9rem, 4.8vw, 2.8rem); line-height: 1.08; }
.page-hero p { color: var(--ink-soft); margin-top: .6rem; max-width: 60ch; }

.grid { display: grid; gap: clamp(1.1rem, 3vw, 1.6rem); grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: clip; display: flex; flex-direction: column; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.card__media { aspect-ratio: 16 / 10; overflow: hidden; background: var(--tinta); }
.card__media img { width: 100%; height: 100%; object-fit: cover; }
.card__body { padding: 1rem 1.15rem 1.2rem; display: flex; flex-direction: column; gap: .45rem; flex: 1; }
.card__cat { font-size: .72rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--accent); }
.card__title { font-family: var(--font-head); font-weight: 700; letter-spacing: -.01em; font-size: 1.2rem; line-height: 1.25; }
.card__title a { color: var(--ink); }
.card__title a:hover { color: var(--accent); text-decoration: none; }
.card__excerpt { color: var(--ink-soft); font-size: .95rem; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card__meta { margin-top: auto; padding-top: .3rem; font-size: .82rem; color: var(--ink-soft); }

/* ============================================================
   ARTICOLO / PAGINA
   ============================================================ */
.crumbs { font-size: .85rem; color: var(--ink-soft); padding-top: clamp(1.2rem, 3vw, 2rem); }
.crumbs a { color: var(--ink-soft); }
.crumbs a:hover { color: var(--accent); }
.crumbs span[aria-hidden] { margin-inline: .4rem; }
.entry-header { padding-block: clamp(1rem, 3vw, 1.6rem) .5rem; }
.entry-title { font-family: var(--font-head); font-weight: 800; letter-spacing: -.025em; font-size: clamp(1.9rem, 4.5vw, 2.7rem); line-height: 1.1; }
.entry-meta { color: var(--ink-soft); font-size: .88rem; margin-top: .9rem; display: flex; gap: .4rem 1rem; flex-wrap: wrap; align-items: center; }
.entry-meta__aff { font-size: .74rem; color: var(--ink-soft); }
.entry-meta__aff a { color: inherit; text-decoration: underline; }
.entry-header + .entry-content { margin-top: 1.2rem; }
.featured { margin-block: 1.5rem; border-radius: var(--radius); overflow: clip; border: 1px solid var(--line); }

.entry-content { font-size: 1.1rem; line-height: 1.75; }
.entry-content > * + * { margin-top: 1.15rem; }
.entry-content h2 { font-family: var(--font-head); font-weight: 750; letter-spacing: -.015em; font-size: 1.6rem; line-height: 1.22; margin-top: 2.4rem;
  padding-bottom: .35rem; border-bottom: 2px solid var(--tinta); }
.entry-content h3 { font-family: var(--font-head); font-weight: 700; font-size: 1.28rem; line-height: 1.3; margin-top: 1.8rem; }
.entry-content a { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.entry-content ul, .entry-content ol { padding-left: 1.3rem; }
.entry-content li + li { margin-top: .4rem; }
.entry-content li::marker { color: var(--accent); }
.entry-content img { border-radius: var(--radius); }
.entry-content figure { margin-block: 1.6rem; }
.entry-content figcaption { font-size: .85rem; color: var(--ink-soft); margin-top: .5rem; text-align: center; }
.entry-content blockquote { border-left: 3px solid var(--accent); padding: .2rem 0 .2rem 1.2rem; color: var(--ink-soft); }
.entry-content code { background: var(--tinta); border-radius: 6px; padding: .1em .4em; font-size: .9em; }
.entry-content .box, .entry-content .wp-block-group.is-style-box { background: var(--tinta); border-radius: var(--radius); padding: 1.1rem 1.3rem; }

body .entry-content table { width: 100% !important; height: auto !important; margin: 1.8rem 0; border-collapse: collapse; font-size: .95rem; font-variant-numeric: tabular-nums; }
body .entry-content th, body .entry-content td { border: 0; border-bottom: 1px solid var(--line); padding: .7rem .9rem; text-align: left; vertical-align: top; background: none; }
body .entry-content thead th { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); white-space: nowrap; border-bottom: 2px solid var(--accent); }
body .entry-content tbody tr:last-child > * { border-bottom: 0; }
body .entry-content tbody td:first-child { font-weight: 600; color: var(--ink); }
body .entry-content .wp-block-table { margin: 1.8rem 0; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
body .entry-content .wp-block-table table { margin: 0; }

/* ============================================================
   BOX PRODOTTO  [prodotto] (link affiliato)
   ============================================================ */
.deal {
  --pad: clamp(1rem, 3vw, 1.4rem);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  display: grid; grid-template-columns: 1fr; gap: var(--pad); padding: var(--pad); margin-block: 2rem;
}
.deal:has(.deal__media) { grid-template-columns: 180px 1fr; }
.deal__media { border-radius: 10px; overflow: hidden; align-self: start; background: #fff; }
.deal__media img { width: 100%; aspect-ratio: 1; object-fit: contain; margin: 0; border-radius: 0; }
.deal__body { display: flex; flex-direction: column; gap: .45rem; }
.deal__badge { align-self: flex-start; font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; background: var(--tinta); color: var(--accent); padding: .22rem .6rem; border-radius: 6px; }
.deal__title { font-family: var(--font-head); font-weight: 750; font-size: 1.3rem; line-height: 1.2; margin: 0; }
.deal__desc { color: var(--ink-soft); font-size: .96rem; margin: 0; }
.deal__cols { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem 1.5rem; margin: .3rem 0; }
.deal__cols ul { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.deal__cols li { display: flex; gap: .45rem; margin-top: .25rem; line-height: 1.35; }
.deal__cols .pros li::before { content: "+"; color: #15803D; font-weight: 800; }
.deal__cols .cons li::before { content: "–"; color: #B91C1C; font-weight: 800; }
.deal__foot { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: .3rem; }
.deal__price { font-family: var(--font-head); font-weight: 800; font-size: 1.4rem; }
.deal__disc { font-size: .7rem; color: var(--ink-soft); }
.btn {
  display: inline-flex; align-items: center; gap: .5rem; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 1rem;
  padding: .65rem 1.3rem; border: none; border-radius: 999px; text-decoration: none; transition: filter .15s ease;
}
.btn:hover { filter: brightness(.92); text-decoration: none; }
.entry-content .btn { text-decoration: none; color: var(--accent-ink); }
.btn svg { width: 18px; height: 18px; }
@media (max-width: 560px) {
  .deal, .deal:has(.deal__media) { grid-template-columns: 1fr; }
  .deal__media { max-width: 160px; }
  .deal__cols { grid-template-columns: 1fr; }
}

/* ============================================================
   CORRELATI / PAGINAZIONE / RICERCA
   ============================================================ */
.related { border-top: 1px solid var(--line); margin-top: 3rem; padding-top: 2rem; }
.related__list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }
.related__item { display: flex; flex-direction: column; gap: .5rem; color: var(--ink); }
.related__item:hover { text-decoration: none; color: var(--accent); }
.related__media { display: block; aspect-ratio: 16 / 10; border-radius: 10px; overflow: hidden; background: var(--tinta); }
.related__media img { width: 100%; height: 100%; object-fit: cover; }
.related__name { font-family: var(--font-head); font-weight: 700; font-size: 1rem; line-height: 1.3; }
@media (max-width: 560px) { .related__list { grid-template-columns: 1fr; } }

.pagination, .nav-links { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; margin-top: 2.5rem; }
.page-numbers { padding: .5rem .85rem; border: 1px solid var(--line); border-radius: 10px; color: var(--ink-soft); font-weight: 600; background: var(--surface); }
.page-numbers.current { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
a.page-numbers:hover { border-color: var(--accent); text-decoration: none; color: var(--ink); }

.search-form { display: flex; gap: .5rem; }
.search-form input[type="search"] { flex: 1; min-width: 0; padding: .65rem .95rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.search-form input[type="search"]:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.search-form button { padding: .65rem 1.15rem; border: none; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 700; cursor: pointer; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer { border-top: 1px solid var(--line); margin-top: 4rem; background: var(--surface); color: var(--ink-soft); font-size: .92rem; }
.site-footer a { color: var(--ink-soft); }
.site-footer a:hover { color: var(--accent); }
.site-footer__cols { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 2rem; padding-block: 2.5rem 1.5rem; }
.site-footer__brand svg, .site-footer__brand img { height: 30px; width: auto; }
.site-footer__brand p { margin-top: .8rem; max-width: 36ch; }
.site-footer h2 { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink); margin-bottom: .7rem; }
.site-footer ul, .site-footer li { list-style: none; padding: 0; margin: 0; }
.site-footer li + li { margin-top: .35rem; }
.site-footer__bottom { border-top: 1px solid var(--line); padding-block: 1rem 1.4rem; display: flex; flex-wrap: wrap; gap: .3rem 1rem; justify-content: space-between; font-size: .82rem; }
.site-footer__aff { font-size: .72rem; color: var(--ink-soft); opacity: .85; flex-basis: 100%; }
@media (max-width: 760px) { .site-footer__cols { grid-template-columns: 1fr 1fr; } .site-footer__brand { grid-column: 1 / -1; } }

/* ============================================================
   UTIL / ACCESSIBILITA'
   ============================================================ */
.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--accent-ink); padding: .6rem 1rem; z-index: 100; }
.skip-link:focus { left: 1rem; top: 1rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
