/* Dispensa Intelligente: stile del sito (home + blog). Sostituisce il template Start Bootstrap New Age. */

:root {
  --ground: #f7f1e8;
  --surface: #fffdf9;
  --tone: #efe5d6;
  --ink: #2a2118;
  --ink-soft: #5f5248;
  --dark: #221a13;
  --accent: #a35000;
  --accent-hover: #823f00;
  --orange: #ff8c00;
  --on-dark: #f7f1e8;

  --display: "Newsreader", Georgia, serif;
  --text: "Mulish", system-ui, sans-serif;

  --fs-display: clamp(2.5rem, 5vw, 4.6rem);
  --fs-h2: clamp(1.9rem, 3.4vw, 3.1rem);
  --fs-h3: clamp(1.35rem, 1.8vw, 1.6rem);
  --fs-lead: clamp(1.1rem, 1.4vw, 1.3rem);
  --fs-body: 1.0625rem;
  --fs-small: 0.9rem;

  --gutter: clamp(20px, 4vw, 48px);
  --section: clamp(88px, 11vw, 168px);
  --radius: 24px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--text);
  font-size: var(--fs-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--orange); color: var(--dark); }

h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; line-height: 1.05; letter-spacing: -0.02em; margin: 0 0 0.5em; }
h1 { font-size: var(--fs-display); letter-spacing: -0.03em; }
h2 { font-size: var(--fs-h2); }
h3, h4 { font-size: var(--fs-h3); line-height: 1.15; }
p { margin: 0 0 1em; max-width: 64ch; }

.wrap { width: 100%; max-width: 1280px; margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: var(--section); }
.lead { font-size: var(--fs-lead); line-height: 1.5; }
.soft { color: var(--ink-soft); }

/* Bottoni */
.btn {
  display: inline-flex; align-items: center; gap: 0.5em;
  padding: 0.85em 1.5em; border-radius: 999px; border: 0;
  background: var(--accent); color: #fff; font: 700 1rem/1 var(--text);
  text-decoration: none; cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
}
.btn:hover { background: var(--accent-hover); color: #fff; transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-light { background: var(--on-dark); color: var(--ink); }
.btn-light:hover { background: #fff; color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink); padding-inline: 0.75em; }
.btn-ghost:hover { background: var(--tone); color: var(--ink); }

.badges { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.badges a { transition: transform 0.2s ease; }
.badges a:hover { transform: translateY(-3px); }
.badges img { height: 56px; width: auto; }

/* Navigazione */
.nav { position: sticky; top: 0; z-index: 20; background: var(--ground); }
.nav .wrap { display: flex; align-items: center; justify-content: space-between; gap: 24px; height: 76px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 600 1.35rem/1 var(--display); }
.brand img { width: 40px; height: 40px; }
.nav-links { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-links a { display: block; padding: 0.55em 0.8em; border-radius: 999px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 0.975rem; transition: background-color 0.2s ease; }
.nav-links a:hover { background: var(--tone); }
.nav-links .btn, .nav-links .btn:hover { color: #fff; background: var(--accent); }
.nav-links .btn:hover { background: var(--accent-hover); }
.nav-menu { display: none; }
.nav-menu summary { list-style: none; cursor: pointer; font-weight: 700; padding: 0.55em 1em; border-radius: 999px; background: var(--tone); }
.nav-menu summary::-webkit-details-marker { display: none; }

@media (max-width: 900px) {
  .nav .nav-links { display: none; }
  .nav-menu { display: block; position: relative; }
  .nav-menu[open] .nav-links {
    display: flex; flex-direction: column; align-items: stretch;
    position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px;
    background: var(--surface); border-radius: 18px; padding: 8px;
    box-shadow: 0 18px 40px rgba(34, 26, 19, 0.18);
  }
}

/* Hero */
.hero { padding-block: clamp(32px, 6vw, 88px) var(--section); }
.hero .wrap { display: grid; grid-template-columns: 1.3fr 1fr; gap: clamp(32px, 5vw, 80px); align-items: center; }
.hero h1 { margin-bottom: 0.4em; }
.hero .lead { margin-bottom: 2rem; max-width: 52ch; }
.hero-visual {
  position: relative; background: var(--orange); border-radius: 32px;
  min-height: clamp(460px, 48vw, 640px);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.phone {
  width: clamp(220px, 21vw, 290px); border: 10px solid var(--dark); border-radius: 40px;
  overflow: hidden; background: var(--dark); box-shadow: 0 30px 60px rgba(34, 26, 19, 0.3);
}
.phone img { width: 100%; }
.hero-visual .phone-front { position: relative; z-index: 2; transform: translateX(14%) rotate(4deg); }
.hero-visual .phone-back { position: absolute; z-index: 1; transform: translateX(-38%) rotate(-7deg) scale(0.88); opacity: 0.95; }

@media (max-width: 860px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .hero-visual { min-height: 520px; }
}

/* Fasce con frase */
.band { padding-block: clamp(72px, 9vw, 128px); }
.band p { font-family: var(--display); font-size: clamp(1.5rem, 3.4vw, 2.6rem); line-height: 1.15; letter-spacing: -0.01em; max-width: 32ch; margin: 0; }
.band-dark { background: var(--dark); color: var(--on-dark); }
.band-orange { background: var(--orange); color: var(--dark); }
.band-orange .wrap { display: flex; justify-content: flex-end; }
.band-orange p { text-align: right; }

/* Funzioni (griglia a mattoncini) */
.bento { display: grid; grid-template-columns: 1.35fr 1fr 1fr; grid-template-rows: auto auto; gap: 16px; }
.tile { border-radius: var(--radius); padding: clamp(24px, 3vw, 40px); background: var(--surface); transition: transform 0.25s ease; }
.tile:hover { transform: translateY(-4px); }
.tile p { margin: 0; }
.tile-scan { grid-row: span 2; display: flex; flex-direction: column; overflow: hidden; padding-bottom: 0; }
.tile-scan .phone { max-height: 380px; margin: 32px auto 0; border-bottom: 0; border-radius: 40px 40px 0 0; width: min(290px, 80%); box-shadow: none; }
.tile-alert { grid-column: span 2; background: var(--accent); color: #fff; display: flex; flex-direction: column; justify-content: flex-end; }
.tile-alert h3 { font-size: var(--fs-h2); max-width: 16ch; }
.tile-alert p { font-size: var(--fs-lead); max-width: 40ch; }
.tile-waste { background: var(--tone); }
.tile-home { background: var(--dark); color: var(--on-dark); }
.tile-alert h3, .tile-home h3 { color: inherit; }
.tile-alert p, .tile-home p { color: inherit; opacity: 0.92; }

@media (max-width: 860px) {
  .bento { grid-template-columns: 1fr; }
  .tile-scan { grid-row: auto; }
  .tile-alert { grid-column: auto; }
}

/* Testo con foto */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 6vw, 96px); align-items: center; }
.split figure { margin: 0; border-radius: var(--radius); overflow: hidden; }
.split figure img { width: 100%; height: 100%; object-fit: cover; }
.split-photo-tall { grid-template-columns: 0.8fr 1.2fr; }
.split-photo-tall figure { aspect-ratio: 4 / 5; }
.split-photo-wide figure { aspect-ratio: 4 / 3; }
.surface { background: var(--surface); }
@media (max-width: 860px) {
  .split, .split-photo-tall { grid-template-columns: 1fr; }
  .split figure { order: -1; }
}

/* Contatori */
.counters .wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.counters h2 { margin: 0; padding: clamp(28px, 4vw, 48px); background: var(--tone); border-radius: var(--radius); font-size: var(--fs-h3); line-height: 1.2; }
.counter { display: block; font-size: clamp(3.5rem, 7vw, 6rem); line-height: 1; color: var(--accent); letter-spacing: -0.03em; }
@media (max-width: 700px) { .counters .wrap { grid-template-columns: 1fr; } }

/* Piani */
.plans { background: var(--tone); }
.plans-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 16px 48px; margin-bottom: 48px; }
.plans-head p { margin: 0; }
.plans-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.plan { border-radius: var(--radius); padding: clamp(28px, 3.5vw, 48px); background: var(--surface); display: flex; flex-direction: column; }
.plan h4 { font-size: var(--fs-h2); margin-bottom: 0.1em; }
.plan > p { margin-bottom: 1.5em; }
.plan ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.plan li { display: flex; gap: 12px; align-items: baseline; }
.plan li::before { flex: none; width: 1.4em; height: 1.4em; border-radius: 50%; display: inline-grid; place-items: center; font-size: 0.8rem; font-weight: 800; transform: translateY(0.15em); }
.plan .yes::before { content: "✓"; background: #2f7a4a; color: #fff; }
.plan .no { color: var(--ink-soft); }
.plan .no::before { content: "✕"; background: var(--tone); color: var(--ink-soft); }
.plan .limit::before { content: "!"; background: var(--orange); color: var(--dark); }
.plan-pro { background: var(--dark); color: var(--on-dark); }
.plan-pro > p { color: inherit; opacity: 0.85; }
.plan-pro .yes::before { background: var(--orange); color: var(--dark); }
.plan-pro .btn { margin-top: 32px; align-self: flex-start; }
@media (max-width: 760px) { .plans-grid { grid-template-columns: 1fr; } }

/* FAQ */
.faq .wrap { display: grid; grid-template-columns: 1.1fr 1.5fr; gap: clamp(32px, 6vw, 96px); align-items: start; }
.faq-title { position: sticky; top: 108px; }
.faq-list { display: grid; gap: 16px; }
.faq-item { background: var(--surface); border-radius: var(--radius); padding: clamp(22px, 2.6vw, 32px); }
.faq-item h3 { font-size: 1.3rem; }
.faq-item p { margin: 0; }
@media (max-width: 860px) {
  .faq .wrap { grid-template-columns: 1fr; }
  .faq-title { position: static; }
}

/* Invito finale con foto */
.cta { position: relative; color: #fff; overflow: hidden; }
.cta-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scale(1.08); transition: transform 1.6s ease; }
.cta.is-in .cta-bg { transform: scale(1); }
.cta::after { content: ""; position: absolute; inset: 0; background: rgba(34, 26, 19, 0.55); }
.cta .wrap { position: relative; z-index: 1; padding-block: clamp(120px, 16vw, 220px); }
.cta h2 { font-size: var(--fs-display); max-width: 14ch; }
.cta h3 { font-family: var(--text); font-weight: 600; font-size: var(--fs-lead); letter-spacing: 0; margin-bottom: 2rem; }

/* Download */
.download { text-align: center; padding-block: clamp(72px, 9vw, 120px); }
.download .badges { justify-content: center; }

/* Footer */
.footer { background: var(--dark); color: var(--on-dark); padding-block: clamp(64px, 8vw, 112px) 40px; }
.footer .footer-name { font: 600 clamp(2.8rem, 10vw, 9rem)/0.9 var(--display); letter-spacing: -0.04em; margin: 0 0 40px; max-width: none; }
.footer p, .footer .links { font-size: var(--fs-small); color: var(--on-dark); opacity: 0.85; }
.footer a { color: var(--on-dark); }
.footer a:hover { color: var(--orange); }
.footer .links { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-bottom: 24px; }
.footer .credits { opacity: 0.6; font-size: 0.8rem; margin: 0; max-width: none; }

/* Dialog contatti */
dialog.contacts { border: 0; border-radius: var(--radius); padding: 32px; max-width: 440px; width: calc(100% - 40px); background: var(--surface); color: var(--ink); }
dialog.contacts::backdrop { background: rgba(34, 26, 19, 0.6); }
dialog.contacts h5 { font: 600 1.8rem/1.1 var(--display); margin: 0 0 16px; }
dialog.contacts ul { padding-left: 1.2em; }
dialog.contacts form { margin: 24px 0 0; }

/* Entrata degli elementi (il contenuto resta visibile se lo script non parte) */
.js [data-reveal] { opacity: 0; transform: translateY(24px); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(.2, .7, .2, 1); transition-delay: var(--d, 0ms); }
.js [data-reveal].is-in { opacity: 1; transform: none; }
.hero-visual .phone-front { animation: rise 1s cubic-bezier(.2, .7, .2, 1) both 0.15s; }
.hero-visual .phone-back { animation: rise-back 1s cubic-bezier(.2, .7, .2, 1) both 0.35s; }
@keyframes rise { from { transform: translateX(14%) translateY(60px) rotate(4deg); } }
@keyframes rise-back { from { opacity: 0; transform: translateX(-38%) translateY(80px) rotate(-7deg) scale(0.88); } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js [data-reveal] { opacity: 1; transform: none; }
  .cta-bg { transform: none; }
}

/* Blog */
.blog-main { padding-block: clamp(40px, 6vw, 96px) var(--section); }
.blog-main .container { width: 100%; max-width: 1280px; margin-inline: auto; padding-inline: var(--gutter); }
.blog-main .col-lg-8 { max-width: 760px; margin-inline: auto; }
.blog-main h1 { font-size: clamp(2.3rem, 4.6vw, 4rem); }
.blog-main article.mb-5 { background: var(--surface); border-radius: var(--radius); padding: clamp(24px, 3vw, 40px); margin-bottom: 16px; transition: transform 0.25s ease; }
.blog-main article.mb-5:hover { transform: translateY(-3px); }
.blog-main article.mb-5 h2 { font-size: var(--fs-h3); }
.blog-main article.mb-5 h2 a { color: var(--ink); text-decoration: none; }
.blog-main article.mb-5 h2 a:hover { color: var(--accent); }
.blog-content { font-size: 1.1rem; line-height: 1.75; }
.blog-content h2 { font-size: clamp(1.6rem, 2.6vw, 2.2rem); margin-top: 2.5rem; }
.blog-content h3 { margin-top: 2rem; }
.blog-content p, .blog-content li { max-width: 68ch; }
.blog-content ul, .blog-content ol { padding-left: 1.3em; }
.blog-content li { margin-bottom: 0.4em; }
.table-responsive { overflow-x: auto; margin: 1.5rem 0 2rem; border-radius: 16px; background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: 0.975rem; line-height: 1.45; }
.table th, .table td { padding: 12px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--tone); }
.table thead th { background: var(--tone); font-weight: 700; }
.table tr:last-child td { border-bottom: 0; }
.blog-download { background: var(--orange); color: var(--dark); padding-block: clamp(72px, 9vw, 128px); }
.blog-download h2 { max-width: 22ch; }

/* Utilità usate nel contenuto degli articoli */
.small { font-size: var(--fs-small); }
.text-muted { color: var(--ink-soft); }
.text-center { text-align: center; }
.text-center p, p.text-center { margin-inline: auto; }
.fw-bold { font-weight: 700; }
.h5 { font-size: 1.3rem; }
.h3 { font-size: var(--fs-h3); }
.img-fluid { max-width: 100%; height: auto; border-radius: var(--radius); }
.mb-1 { margin-bottom: 0.25rem; } .mb-2 { margin-bottom: 0.5rem; } .mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; } .mb-5 { margin-bottom: 3rem; } .mt-2 { margin-top: 0.5rem; }
.my-4 { margin-block: 1.5rem; } .my-5 { margin-block: 3rem; }
.btn-primary { background: var(--accent); }
