/*
Theme Name: Prima Ambiente
Theme URI: https://prima-ambiente.it/
Author: Smart Italy Communications
Description: Tema editoriale WordPress per prima-ambiente.it con homepage configurabile, search in header, spazi adv, box autore e infinite scroll.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.6
Requires PHP: 7.4
License: GPL-2.0-or-later
Text Domain: prima-ambiente
*/

:root {
  --pa-black: #020604;
  --pa-ink: #092019;
  --pa-text: #10231c;
  --pa-muted: #6a746e;
  --pa-line: #dce5dd;
  --pa-cream: #fbfcf7;
  --pa-green: #8cc63f;
  --pa-green-dark: #4f8f28;
  --pa-radius: 8px;
  --pa-shadow: 0 18px 42px rgba(4, 19, 13, .16);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--pa-cream);
  color: var(--pa-text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.55;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }
.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.container { width: min(1200px, calc(100% - 48px)); margin: 0 auto; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #000;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.header-inner {
  min-height: 86px;
  display: flex;
  align-items: center;
  gap: 34px;
}
.site-logo {
  color: var(--pa-green);
  font-size: clamp(25px, 2.4vw, 38px);
  font-weight: 500;
  letter-spacing: 0;
  white-space: nowrap;
}
.site-logo span { color: #e6d5ad; }
.main-navigation { margin-left: auto; }
.menu {
  display: flex;
  align-items: center;
  gap: 26px;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 14px;
  font-weight: 700;
}
.menu a { color: #fff; }
.menu a:hover { color: var(--pa-green); }
.header-search { position: relative; }
.search-toggle {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  cursor: pointer;
}
.search-toggle svg { width: 22px; height: 22px; }
.search-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: min(360px, calc(100vw - 32px));
  display: none;
  padding: 10px;
  background: #fff;
  border-radius: var(--pa-radius);
  box-shadow: var(--pa-shadow);
}
.search-panel.is-open { display: block; }
.search-panel form { display: flex; gap: 8px; }
.search-panel input {
  width: 100%;
  border: 1px solid var(--pa-line);
  border-radius: 6px;
  padding: 12px;
}
.search-panel button,
.button,
.wp-block-button__link {
  border: 0;
  border-radius: 6px;
  background: var(--pa-green);
  color: #fff;
  font-weight: 800;
  padding: 12px 18px;
  cursor: pointer;
}

.hero {
  min-height: 560px;
  color: #fff;
  background:
    linear-gradient(90deg, rgba(0,0,0,.72), rgba(0,0,0,.24) 55%, rgba(0,0,0,.78)),
    linear-gradient(180deg, rgba(0,0,0,0), rgba(0,0,0,.38)),
    url("assets/hero-forest.svg") center/cover;
}
.hero-grid {
  min-height: 560px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: center;
  gap: 54px;
}
.kicker {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--pa-green);
  font-size: 14px;
  font-weight: 900;
  text-transform: uppercase;
}
.hero h1 {
  max-width: 680px;
  margin: 0 0 20px;
  font-size: clamp(44px, 6vw, 76px);
  line-height: 1.02;
  letter-spacing: 0;
}
.hero p { max-width: 620px; margin: 0 0 30px; font-size: 20px; font-weight: 650; }
.hero-side { display: grid; gap: 28px; }
.side-story {
  display: grid;
  grid-template-columns: 1fr 96px;
  align-items: center;
  gap: 18px;
  padding-bottom: 26px;
  border-bottom: 1px solid rgba(255,255,255,.18);
}
.side-story img,
.post-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}
.side-story .thumb { width: 96px; height: 96px; }
.side-story h3 { margin: 4px 0 0; font-size: 20px; line-height: 1.18; }

.section {
  padding: 56px 0;
  border-bottom: 1px solid var(--pa-line);
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  margin-bottom: 26px;
}
.section h2 { margin: 0; font-size: clamp(28px, 3vw, 36px); line-height: 1.15; }
.front-grid {
  display: grid;
  grid-template-columns: 1.15fr .9fr 1fr;
  gap: 42px;
}
.feature-card {
  min-height: 470px;
  display: flex;
  align-items: flex-end;
  padding: 28px;
  color: #fff;
  background: linear-gradient(180deg, rgba(0,0,0,.05), rgba(0,0,0,.78)), var(--pa-ink);
  background-size: cover;
  background-position: center;
  border-radius: var(--pa-radius);
  overflow: hidden;
}
.feature-card h3 { margin: 8px 0 10px; font-size: 31px; line-height: 1.08; }
.stack-list { display: grid; gap: 24px; }
.mini-post {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 18px;
  align-items: center;
}
.mini-post .thumb { width: 108px; aspect-ratio: 1; }
.mini-post h3 { margin: 5px 0 6px; font-size: 18px; line-height: 1.25; }
.post-date { color: var(--pa-muted); font-size: 14px; }
.category-label {
  color: var(--pa-green-dark);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
}
.post-card .thumb { aspect-ratio: 1.35; margin-bottom: 18px; }
.post-card h3 { margin: 8px 0 10px; font-size: 21px; line-height: 1.2; }
.post-card p { margin: 0; color: var(--pa-muted); }

.topics {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 20px;
  text-align: center;
}
.topic-icon {
  display: grid;
  justify-items: center;
  gap: 9px;
  color: var(--pa-green-dark);
  font-weight: 800;
  font-size: 13px;
}
.topic-icon svg { width: 48px; height: 48px; stroke-width: 1.6; }
.promo-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 44px;
}
.newsletter,
.story-promo {
  min-height: 180px;
  padding: 30px;
  border-radius: var(--pa-radius);
}
.newsletter {
  color: #fff;
  background: linear-gradient(90deg, rgba(0,0,0,.86), rgba(0,0,0,.64)), url("assets/leaf.svg") right bottom/contain no-repeat #04120c;
}
.newsletter form { display: flex; gap: 8px; margin-top: 22px; }
.newsletter input { flex: 1; min-width: 0; border: 0; border-radius: 6px; padding: 14px; }
.story-promo {
  background: linear-gradient(90deg, #eaf0e4 0%, rgba(234,240,228,.65) 54%, rgba(234,240,228,.2)), url("assets/seedling.svg") right center/auto 100% no-repeat;
}

.ad-slot {
  display: grid;
  place-items: center;
  min-height: 90px;
  margin: 28px 0;
  padding: 16px;
  border: 1px dashed #aac39f;
  border-radius: var(--pa-radius);
  color: var(--pa-muted);
  background: #f3f7ef;
  text-align: center;
}
.ad-leaderboard { min-height: 90px; }
.ad-rectangle { min-height: 250px; }
.ad-inarticle { min-height: 280px; }

.site-main { padding: 46px 0; }
.archive-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}
.load-more { display: block; margin: 36px auto 0; }
.load-more[disabled] { opacity: .55; cursor: wait; }

.single-layout {
  display: grid;
  grid-template-columns: minmax(0, 760px) 320px;
  gap: 58px;
  align-items: start;
}
.article-shell {
  background: #fff;
  border-radius: var(--pa-radius);
  box-shadow: 0 1px 0 rgba(0,0,0,.04);
  overflow: hidden;
}
.article-cover { aspect-ratio: 1.7; width: 100%; object-fit: cover; }
.article-body { padding: clamp(24px, 4vw, 50px); }
.article-body h1 { margin: 10px 0 16px; font-size: clamp(38px, 5vw, 58px); line-height: 1.03; }
.entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--pa-muted);
  font-size: 14px;
}
.entry-content { margin-top: 28px; font-size: 19px; }
.entry-content a { color: var(--pa-green-dark); font-weight: 750; text-decoration: underline; }
.entry-content > * { margin-top: 0; margin-bottom: 1.25em; }
.author-box {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 20px;
  margin-top: 42px;
  padding: 22px;
  border: 1px solid var(--pa-line);
  border-radius: var(--pa-radius);
  background: #f7faf4;
}
.author-box img { border-radius: 50%; }
.post-navigation {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 28px;
}
.post-navigation a {
  display: block;
  padding: 18px;
  border: 1px solid var(--pa-line);
  border-radius: var(--pa-radius);
  background: #fff;
  font-weight: 800;
}
.sidebar-widget { margin-bottom: 28px; }

.site-footer {
  color: #fff;
  background: #000;
  padding: 52px 0 28px;
  overflow: hidden;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: 44px;
}
.footer-grid h3 { color: var(--pa-green); margin-top: 0; font-size: 15px; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 7px; }
.footer-brand p { max-width: 250px; color: #dbe5dc; }
.footer-bottom {
  margin-top: 44px;
  padding-top: 22px;
  border-top: 1px solid rgba(255,255,255,.15);
  color: #c8d1ca;
  font-size: 13px;
}

@media (max-width: 980px) {
  .header-inner { flex-wrap: wrap; padding: 14px 0; gap: 16px; }
  .main-navigation { order: 3; width: 100%; overflow-x: auto; }
  .menu { width: max-content; gap: 18px; }
  .hero-grid,
  .front-grid,
  .single-layout { grid-template-columns: 1fr; }
  .hero-side { display: none; }
  .card-grid,
  .archive-grid { grid-template-columns: repeat(2, 1fr); }
  .topics { grid-template-columns: repeat(4, 1fr); }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .container { width: min(100% - 28px, 1200px); }
  .hero,
  .hero-grid { min-height: 520px; }
  .card-grid,
  .archive-grid,
  .promo-row,
  .post-navigation { grid-template-columns: 1fr; }
  .topics { grid-template-columns: repeat(2, 1fr); }
  .mini-post { grid-template-columns: 88px 1fr; }
  .mini-post .thumb { width: 88px; }
  .newsletter form { flex-direction: column; }
  .footer-grid { grid-template-columns: 1fr; }
}
