/* ============================================================
   Casa Smart — Blog statico SEO
   Foglio di stile unificato
   ============================================================ */

/* --- Reset & base ----------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* --- Variabili -------------------------------------------- */
:root {
  --bg: #ffffff;
  --fg: #111827;
  --muted: #6b7280;
  --card: #f8fafc;
  --line: #e5e7eb;
  --accent: #0ea5e9;
  --accent-hover: #0284c7;
  --max: 780px;
  --max-wide: 1100px;
  --radius: 12px;
  --space-xs: 0.5rem;
  --space-s: 1rem;
  --space-m: 1.5rem;
  --space-l: 2.5rem;
  --space-xl: 4rem;
}

/* --- Utilities -------------------------------------------- */
.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--space-s);
}

.wrap-wide {
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 0 var(--space-s);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ============================================================
   NAVIGAZIONE
   ============================================================ */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.site-nav .wrap-wide {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.site-nav__logo {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.02em;
}

.site-nav__logo:hover {
  text-decoration: none;
  color: var(--accent);
}

.site-nav__links {
  display: flex;
  gap: var(--space-m);
  list-style: none;
}

.site-nav__links a {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.15s;
}

.site-nav__links a:hover,
.site-nav__links a[aria-current="page"] {
  color: var(--fg);
  text-decoration: none;
}

/* Hamburger */
.site-nav__toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-xs);
}

.site-nav__toggle svg {
  width: 24px;
  height: 24px;
  stroke: var(--fg);
  stroke-width: 2;
  fill: none;
}

@media (max-width: 768px) {
  .site-nav__toggle {
    display: block;
  }

  .site-nav__links {
    display: none;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: var(--space-s);
    gap: 0;
  }

  .site-nav__links.is-open {
    display: flex;
  }

  .site-nav__links li {
    border-top: 1px solid var(--line);
  }

  .site-nav__links li:first-child {
    border-top: none;
  }

  .site-nav__links a {
    display: block;
    padding: var(--space-s) 0;
    font-size: 1rem;
  }
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  margin-top: var(--space-xl);
  border-top: 1px solid var(--line);
  padding: var(--space-l) 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.site-footer .wrap-wide {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-s);
}

.site-footer a {
  color: var(--muted);
}

.site-footer a:hover {
  color: var(--accent);
}

/* ============================================================
   BREADCRUMB
   ============================================================ */
.breadcrumb {
  padding: var(--space-s) 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  gap: 0.3rem;
}

.breadcrumb li::after {
  content: ">";
  margin-left: 0.3rem;
  color: var(--line);
}

.breadcrumb li:last-child::after {
  content: "";
}

.breadcrumb a {
  color: var(--muted);
}

.breadcrumb a:hover {
  color: var(--accent);
}

/* ============================================================
   ARTICOLO
   ============================================================ */
article {
  padding-bottom: var(--space-xl);
}

article h1 {
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-s);
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-s);
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: var(--space-m);
}

.article-meta .author {
  font-weight: 600;
}

/* Immagine hero articolo */
article > figure {
  margin: 0 0 var(--space-l);
}

article > figure img {
  border-radius: var(--radius);
  width: 100%;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
  background: var(--card);
}

/* --- TOC -------------------------------------------------- */
.toc {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-m);
  margin-bottom: var(--space-l);
}

.toc h2 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: var(--space-s);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.toc ol {
  list-style: decimal;
  padding-left: 1.4rem;
}

.toc li {
  margin-bottom: 0.35rem;
  line-height: 1.4;
}

.toc a {
  color: var(--fg);
  font-size: 0.92rem;
}

.toc a:hover {
  color: var(--accent);
}

/* --- Sezioni H2 ------------------------------------------ */
article section {
  margin-bottom: var(--space-l);
}

article section h2 {
  font-size: 1.35rem;
  line-height: 1.3;
  margin-bottom: var(--space-s);
  padding-top: var(--space-s);
}

article section h3 {
  font-size: 1.1rem;
  line-height: 1.35;
  margin-bottom: var(--space-xs);
  margin-top: var(--space-m);
}

article p {
  margin-bottom: var(--space-s);
}

article p:last-child {
  margin-bottom: 0;
}

/* --- Figure dentro sezioni ------------------------------- */
article section figure {
  margin: var(--space-m) 0;
}

article section figure img {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card);
}

figcaption {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: var(--space-xs);
}

/* --- Fonti ----------------------------------------------- */
#fonti ul {
  list-style: none;
  padding: 0;
}

#fonti li {
  padding: var(--space-xs) 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
  line-height: 1.5;
}

#fonti li:last-child {
  border-bottom: none;
}

#fonti a {
  color: var(--fg);
}

#fonti a:hover {
  color: var(--accent);
}

/* --- FAQ ------------------------------------------------- */
#faq dl {
  border-top: 1px solid var(--line);
}

#faq dt {
  font-weight: 600;
  padding: var(--space-s) 0 var(--space-xs);
  cursor: default;
}

#faq dd {
  padding-bottom: var(--space-s);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.65;
}

/* --- Articoli correlati ---------------------------------- */
.correlati {
  margin-top: var(--space-l);
  padding-top: var(--space-l);
  border-top: 1px solid var(--line);
}

.correlati h2 {
  font-size: 1.1rem;
  margin-bottom: var(--space-m);
}

.correlati-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-s);
}

.correlati-card {
  display: block;
  padding: var(--space-s);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--fg);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.correlati-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.08);
  text-decoration: none;
}

.correlati-card__title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.correlati-card__excerpt {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}

@media (min-width: 768px) {
  .correlati-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ============================================================
   HOMEPAGE
   ============================================================ */
.hero {
  padding: var(--space-xl) 0 var(--space-l);
  text-align: center;
}

.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: var(--space-s);
}

.hero p {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 540px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Griglia articoli homepage e categoria */
.articles-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-m);
  padding-bottom: var(--space-xl);
}

@media (min-width: 600px) {
  .articles-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 900px) {
  .articles-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.article-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.article-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(14, 165, 233, 0.08);
  text-decoration: none;
}

.article-card__img {
  aspect-ratio: 1200 / 630;
  background: var(--card);
  overflow: hidden;
}

.article-card__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-card__body {
  padding: var(--space-s);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.article-card__category {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 0.3rem;
}

.article-card__title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--fg);
  margin-bottom: var(--space-xs);
}

.article-card__excerpt {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.55;
  flex: 1;
}

.article-card__date {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: var(--space-s);
}

/* ============================================================
   PAGINA CATEGORIA
   ============================================================ */
.category-header {
  padding: var(--space-l) 0;
}

.category-header h1 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin-bottom: var(--space-xs);
}

.category-header p {
  color: var(--muted);
  max-width: 600px;
}

/* Cluster section */
.cluster-section {
  margin-bottom: var(--space-l);
}

.cluster-section h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-s);
  padding-bottom: var(--space-xs);
  border-bottom: 2px solid var(--accent);
  display: inline-block;
}

/* ============================================================
   STAMPA
   ============================================================ */
@media print {
  .site-nav,
  .site-nav__toggle,
  .toc,
  .correlati,
  .site-footer {
    display: none;
  }

  body {
    font-size: 11pt;
    line-height: 1.5;
    color: #000;
  }

  a {
    color: #000;
    text-decoration: underline;
  }
}
