/*
Theme Name: OttimizzazioneAI
Theme URI: https://ottimizzazioneai.it/
Author: OttimizzazioneAI.it
Description: Tema editoriale proprietario per OttimizzazioneAI.it.
Version: 1.0.3
Text Domain: ottimizzazioneai
*/

:root {
  --ink: #122039;
  --ink-soft: #46536b;
  --paper: #f7f7f2;
  --paper-strong: #fffef9;
  --line: #dfe2db;
  --violet: #6857db;
  --violet-dark: #4d3db8;
  --teal: #0f8f83;
  --mint: #c8f2de;
  --sun: #f3c969;
  --danger: #bd3f58;
  --radius: 22px;
  --shadow: 0 20px 55px rgba(18, 32, 57, .10);
  --max: 1180px;
  --reading: 760px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 96px; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 4% 1%, rgba(104,87,219,.08), transparent 23rem),
    linear-gradient(180deg, #fbfbf7 0, var(--paper) 42rem);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--violet-dark); text-decoration-thickness: .08em; text-underline-offset: .18em; }
a:hover { color: var(--teal); }
img { max-width: 100%; height: auto; }
button, input, textarea { font: inherit; }

.skip-link {
  position: fixed; left: 1rem; top: -5rem; z-index: 1000;
  padding: .7rem 1rem; background: var(--ink); color: white; border-radius: 8px;
}
.skip-link:focus { top: 1rem; }

.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(251,251,247,.9);
  border-bottom: 1px solid rgba(18,32,57,.09);
  backdrop-filter: blur(18px);
}
.header-inner {
  max-width: var(--max); margin: 0 auto; min-height: 78px; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 2rem;
}
.brand { display: inline-flex; align-items: center; gap: .72rem; color: var(--ink); text-decoration: none; font-weight: 850; letter-spacing: -.035em; }
.brand-mark {
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px;
  color: white; background: linear-gradient(135deg, var(--violet), var(--teal));
  box-shadow: 0 8px 20px rgba(104,87,219,.25); font-size: .86rem; letter-spacing: -.06em;
}
.brand-text span { color: var(--violet); }
.primary-nav ul, .footer-menu { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: .3rem; }
.primary-nav a { display: block; padding: .7rem .78rem; color: var(--ink); text-decoration: none; font-size: .91rem; font-weight: 700; border-radius: 10px; }
.primary-nav a:hover, .primary-nav .current-menu-item > a, .primary-nav .current-menu-ancestor > a { color: var(--violet-dark); background: rgba(104,87,219,.08); }
.primary-nav .menu-item-has-children { position: relative; }
.primary-nav .sub-menu {
  position: absolute; top: calc(100% + .35rem); left: 0; width: 270px; padding: .55rem;
  display: block; opacity: 0; visibility: hidden; transform: translateY(-4px);
  border: 1px solid var(--line); border-radius: 16px; background: var(--paper-strong); box-shadow: var(--shadow);
  transition: .18s ease;
}
.primary-nav .sub-menu a { font-size: .87rem; padding: .65rem .75rem; }
.primary-nav .menu-item-has-children:hover > .sub-menu,
.primary-nav .menu-item-has-children:focus-within > .sub-menu { opacity: 1; visibility: visible; transform: none; }
.primary-nav > ul > li:last-child > .sub-menu { left: auto; right: 0; }
.menu-toggle { display: none; border: 0; background: transparent; color: var(--ink); padding: .55rem; cursor: pointer; }
.menu-toggle span { display: block; width: 24px; height: 2px; margin: 5px 0; background: currentColor; border-radius: 2px; }

.site-main { min-height: 68vh; }
.wrap { width: min(calc(100% - 48px), var(--max)); margin-inline: auto; }
.reading-wrap { width: min(calc(100% - 48px), var(--reading)); margin-inline: auto; }

.hero { padding: clamp(4.3rem, 8vw, 8rem) 0 4.5rem; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(340px, .72fr); gap: clamp(2.5rem, 6vw, 6.2rem); align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: .55rem; margin: 0 0 1.1rem; color: var(--teal); font-size: .75rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.eyebrow::before { content: ""; width: 24px; height: 2px; background: currentColor; }
.hero h1, .page-hero h1 {
  margin: 0; max-width: 880px; font-family: Georgia, "Times New Roman", serif;
  font-weight: 700; letter-spacing: -.045em; line-height: 1.02; text-wrap: balance;
}
.hero h1 { font-size: clamp(3.3rem, 7vw, 6.4rem); }
.hero h1 em { color: var(--violet); font-style: normal; }
.hero .lead { max-width: 690px; margin: 1.5rem 0 0; color: var(--ink-soft); font-size: clamp(1.12rem, 2vw, 1.34rem); line-height: 1.6; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 2rem; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 48px; padding: .7rem 1.15rem; border: 1px solid var(--ink); border-radius: 12px; color: white; background: var(--ink); text-decoration: none; font-size: .9rem; font-weight: 800; }
.button:hover { color: white; background: var(--violet-dark); border-color: var(--violet-dark); transform: translateY(-1px); }
.button.secondary { color: var(--ink); background: transparent; border-color: var(--line); }
.button.secondary:hover { color: var(--violet-dark); background: white; border-color: var(--violet); }

.answer-map { position: relative; min-height: 440px; }
.map-orbit { position: absolute; inset: 4% 5%; border: 1px dashed rgba(104,87,219,.35); border-radius: 50%; animation: drift 14s linear infinite; }
.map-orbit:nth-child(2) { inset: 19%; animation-direction: reverse; animation-duration: 18s; border-color: rgba(15,143,131,.42); }
.map-core {
  position: absolute; inset: 50% auto auto 50%; translate: -50% -50%; width: 178px; aspect-ratio: 1;
  display: grid; place-items: center; text-align: center; padding: 1.2rem; border-radius: 44% 56% 62% 38% / 45% 38% 62% 55%;
  color: white; background: linear-gradient(145deg, var(--violet), #876fea 52%, var(--teal)); box-shadow: 0 28px 60px rgba(86,69,192,.28); font-weight: 850; line-height: 1.25;
}
.map-node { position: absolute; padding: .72rem .9rem; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,254,249,.94); box-shadow: 0 10px 30px rgba(18,32,57,.09); font-size: .79rem; font-weight: 800; }
.map-node:nth-of-type(1) { top: 4%; left: 36%; }
.map-node:nth-of-type(2) { top: 29%; right: 0; }
.map-node:nth-of-type(3) { bottom: 11%; right: 14%; }
.map-node:nth-of-type(4) { bottom: 6%; left: 18%; }
.map-node:nth-of-type(5) { top: 27%; left: 0; }
@keyframes drift { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .map-orbit { animation: none; } * { transition: none !important; } }

.trust-strip { border-block: 1px solid var(--line); background: rgba(255,255,255,.5); }
.trust-grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.trust-item { padding: 1.2rem 1.5rem; border-right: 1px solid var(--line); }
.trust-item:last-child { border: 0; }
.trust-item strong { display: block; font-size: .88rem; }
.trust-item span { color: var(--ink-soft); font-size: .78rem; }

.section { padding: clamp(4rem, 8vw, 7.2rem) 0; }
.section.tint { background: #eeeee8; }
.section.dark { color: white; background: var(--ink); }
.section-head { display: grid; grid-template-columns: .48fr 1fr; gap: 2rem; align-items: end; margin-bottom: 2.3rem; }
.section-head h2 { margin: 0; max-width: 720px; font: 700 clamp(2.15rem, 4vw, 3.8rem)/1.08 Georgia, serif; letter-spacing: -.035em; text-wrap: balance; }
.section-head p { margin: .7rem 0 0; max-width: 650px; color: var(--ink-soft); }
.dark .section-head p { color: #bfc8d8; }
.kicker { color: var(--teal); font-size: .73rem; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }

.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.card { position: relative; min-height: 255px; padding: 1.5rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper-strong); box-shadow: 0 1px 0 rgba(18,32,57,.04); overflow: hidden; }
.card::after { content: ""; position: absolute; right: -42px; bottom: -54px; width: 120px; height: 120px; border-radius: 50%; background: rgba(104,87,219,.08); transition: .25s ease; }
.card:hover::after { scale: 1.35; }
.card-number { color: var(--violet); font: 700 2.2rem/1 Georgia, serif; }
.card h3 { margin: 2rem 0 .6rem; font-size: 1.18rem; line-height: 1.25; }
.card p { margin: 0 0 1rem; color: var(--ink-soft); font-size: .91rem; line-height: 1.6; }
.card a { position: relative; z-index: 1; font-size: .84rem; font-weight: 850; }

.feature-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.feature { padding: 2rem; border-radius: var(--radius); background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); }
.feature small { color: var(--mint); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.feature h3 { margin: .65rem 0 .5rem; font: 700 1.7rem/1.15 Georgia, serif; }
.feature p { color: #c7cfdd; }
.feature a { color: var(--mint); font-weight: 800; }

.manifesto { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; align-items: start; }
.manifesto h2 { margin: 0; position: sticky; top: 120px; font: 700 clamp(2.4rem, 5vw, 4.7rem)/1.02 Georgia, serif; letter-spacing: -.04em; }
.principles { list-style: none; margin: 0; padding: 0; counter-reset: principle; }
.principles li { counter-increment: principle; position: relative; padding: 1.5rem 0 1.5rem 3.8rem; border-bottom: 1px solid var(--line); }
.principles li::before { content: "0" counter(principle); position: absolute; left: 0; top: 1.55rem; color: var(--violet); font-weight: 850; }
.principles strong { display: block; margin-bottom: .25rem; }
.principles span { color: var(--ink-soft); font-size: .94rem; }

.cta-band { display: grid; grid-template-columns: 1fr auto; gap: 2rem; align-items: center; padding: clamp(2rem,5vw,4rem); border-radius: 32px; background: linear-gradient(130deg, #5b48ce, #7664e4 55%, #167f78); color: white; box-shadow: var(--shadow); }
.cta-band h2 { margin: 0; font: 700 clamp(2rem,4vw,3.3rem)/1.06 Georgia, serif; letter-spacing: -.035em; }
.cta-band p { margin: .8rem 0 0; max-width: 700px; color: #eeecff; }
.cta-band .button { background: white; color: var(--ink); border-color: white; white-space: nowrap; }

.page-hero { padding: clamp(3.2rem,7vw,6rem) 0 3.2rem; border-bottom: 1px solid var(--line); }
.page-hero h1 { font-size: clamp(2.8rem,6vw,5.4rem); }
.page-deck { max-width: 790px; margin: 1.25rem 0 0; color: var(--ink-soft); font-size: clamp(1.08rem,2vw,1.3rem); line-height: 1.6; }
.page-meta { display: flex; flex-wrap: wrap; gap: .65rem 1.3rem; margin-top: 1.5rem; color: var(--ink-soft); font-size: .79rem; font-weight: 700; }
.breadcrumbs { margin-bottom: 1.2rem; color: var(--ink-soft); font-size: .76rem; }
.breadcrumbs a { color: inherit; }

.article-layout { display: grid; grid-template-columns: minmax(0, var(--reading)) 260px; gap: clamp(2.5rem,6vw,5rem); align-items: start; justify-content: center; padding: clamp(3.2rem,7vw,6rem) 0; }
.article-content { min-width: 0; }
.article-content > *:first-child { margin-top: 0; }
.article-content h2 { margin: 3.2rem 0 1rem; font: 700 clamp(1.9rem,3.4vw,2.65rem)/1.13 Georgia, serif; letter-spacing: -.025em; scroll-margin-top: 110px; text-wrap: balance; }
.article-content h3 { margin: 2.2rem 0 .7rem; font-size: 1.3rem; line-height: 1.25; scroll-margin-top: 110px; }
.article-content p { margin: 0 0 1.25rem; }
.article-content ul, .article-content ol { padding-left: 1.35rem; margin: 0 0 1.4rem; }
.article-content li { margin-bottom: .55rem; }
.article-content strong { color: #08162f; }
.article-content blockquote { margin: 2rem 0; padding: 1.4rem 1.6rem; border-left: 4px solid var(--violet); background: #eeece5; border-radius: 0 15px 15px 0; font: 700 1.18rem/1.5 Georgia, serif; }
.article-content table { width: 100%; margin: 1.8rem 0; border-collapse: collapse; font-size: .9rem; background: white; }
.article-content th, .article-content td { padding: .85rem; text-align: left; vertical-align: top; border: 1px solid var(--line); }
.article-content th { background: #e9e8e1; }
.article-content code { padding: .15em .35em; background: #e9e8e1; border-radius: 5px; font-size: .86em; }
.article-content pre { overflow: auto; padding: 1.2rem; color: #e8edf6; background: #13213a; border-radius: 14px; font-size: .82rem; }
.article-content pre code { padding: 0; background: none; }
.article-content .lead-paragraph { font: 700 1.3rem/1.55 Georgia, serif; color: #293750; }

.key-answer { position: relative; margin: 1.8rem 0 2.3rem; padding: 1.5rem 1.6rem 1.5rem 2rem; border: 1px solid rgba(15,143,131,.3); border-radius: 18px; background: linear-gradient(135deg, rgba(200,242,222,.62), rgba(255,255,255,.8)); }
.key-answer::before { content: "Risposta breve"; display: block; margin-bottom: .55rem; color: var(--teal); font-size: .68rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.key-answer p:last-child { margin-bottom: 0; }
.note, .warning, .example { margin: 1.8rem 0; padding: 1.3rem 1.45rem; border-radius: 16px; background: #eeece5; }
.note { border-left: 4px solid var(--violet); }
.warning { border-left: 4px solid var(--sun); }
.example { border-left: 4px solid var(--teal); }
.note > strong:first-child, .warning > strong:first-child, .example > strong:first-child { display: block; margin-bottom: .35rem; }
.checklist { list-style: none; padding: 0 !important; }
.checklist li { position: relative; padding: .8rem 0 .8rem 2.2rem; border-bottom: 1px solid var(--line); }
.checklist li::before { content: "✓"; position: absolute; left: .25rem; color: var(--teal); font-weight: 900; }
.steps { list-style: none; padding: 0 !important; counter-reset: steps; }
.steps li { counter-increment: steps; position: relative; min-height: 3.5rem; padding: 0 0 1.6rem 4rem; }
.steps li::before { content: counter(steps); position: absolute; left: 0; top: -.1rem; width: 2.7rem; height: 2.7rem; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--violet); font-weight: 850; }
.faq-list { margin: 2rem 0; border-top: 1px solid var(--line); }
.faq-item { border-bottom: 1px solid var(--line); }
.faq-item summary { cursor: pointer; padding: 1.1rem .2rem; font-weight: 800; }
.faq-item p { padding: 0 .2rem 1rem; color: var(--ink-soft); }
.source-list { margin-top: 3rem; padding: 1.3rem 1.5rem; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.55); font-size: .82rem; }
.source-list h2 { margin: 0 0 .7rem; font: 800 .75rem/1.2 inherit; letter-spacing: .11em; text-transform: uppercase; }
.source-list ul { margin-bottom: 0; }

.toc { position: sticky; top: 108px; padding: 1.2rem; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,254,249,.88); }
.toc-title { margin: 0 0 .7rem; font-size: .7rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.toc ol { list-style: none; padding: 0; margin: 0; }
.toc li { margin: 0; }
.toc a { display: block; padding: .33rem 0; color: var(--ink-soft); text-decoration: none; font-size: .77rem; line-height: 1.35; }
.toc a:hover, .toc a.active { color: var(--violet-dark); }

.related { padding: 3.6rem 0; border-top: 1px solid var(--line); }
.related h2 { margin: 0 0 1.4rem; font: 700 2rem/1.15 Georgia, serif; }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; }
.related-card { padding: 1.2rem; border: 1px solid var(--line); border-radius: 15px; background: white; text-decoration: none; }
.related-card small { display: block; color: var(--teal); font-weight: 850; text-transform: uppercase; letter-spacing: .08em; }
.related-card strong { display: block; margin-top: .5rem; color: var(--ink); line-height: 1.3; }

.site-footer { margin-top: 2rem; color: #d4d9e3; background: #0d192d; }
.footer-grid { display: grid; grid-template-columns: 1.2fr .8fr .8fr; gap: 3rem; padding: 4.5rem 0 3rem; }
.footer-brand { color: white; font: 700 1.55rem/1 Georgia, serif; }
.footer-copy { max-width: 430px; color: #aeb8c9; font-size: .88rem; }
.footer-title { color: white; font-size: .76rem; font-weight: 900; text-transform: uppercase; letter-spacing: .12em; }
.site-footer ul { list-style: none; margin: .9rem 0 0; padding: 0; }
.site-footer li { margin: .42rem 0; }
.site-footer a { color: #d4d9e3; text-decoration: none; font-size: .86rem; }
.site-footer a:hover { color: var(--mint); }
.footer-bottom { padding: 1.2rem 0 1.45rem; border-top: 1px solid rgba(255,255,255,.1); color: #929db0; font-size: .76rem; }
.footer-bottom-main { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.footer-legal { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; margin-top: .9rem; padding-top: .9rem; border-top: 1px solid rgba(255,255,255,.07); }
.footer-legal p { margin: 0; }
.footer-legal-copy { max-width: 810px; }
.footer-legal-copy p + p { margin-top: .35rem; }
.footer-trademarks { color: #7f8ba0; }
.footer-powered { flex: 0 0 auto; white-space: nowrap; }
.footer-legal a { color: #c8f2de; font-weight: 750; }
.footer-menu { justify-content: flex-end; }

.empty-state { padding: 8rem 0; text-align: center; }
.empty-state h1 { font: 700 clamp(3rem,8vw,7rem)/1 Georgia, serif; margin: 0; }

@media (max-width: 980px) {
  .menu-toggle { display: block; }
  .primary-nav { position: fixed; inset: 78px 0 auto; max-height: calc(100vh - 78px); overflow: auto; padding: 1rem 24px 2rem; opacity: 0; visibility: hidden; transform: translateY(-8px); background: var(--paper-strong); border-bottom: 1px solid var(--line); transition: .18s ease; }
  .primary-nav.open { opacity: 1; visibility: visible; transform: none; }
  .primary-nav ul { display: block; }
  .primary-nav .sub-menu { position: static; width: auto; display: block; opacity: 1; visibility: visible; transform: none; padding: 0 0 0 1rem; border: 0; box-shadow: none; background: transparent; }
  .hero-grid { grid-template-columns: 1fr; }
  .answer-map { min-height: 370px; max-width: 560px; width: 100%; margin: auto; }
  .article-layout { grid-template-columns: minmax(0, var(--reading)); }
  .toc { display: none; }
  .section-head { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  body { font-size: 16px; }
  .wrap, .reading-wrap { width: min(calc(100% - 32px), var(--max)); }
  .header-inner { min-height: 70px; padding: 0 16px; }
  .primary-nav { top: 70px; }
  .brand-text { font-size: .92rem; }
  .hero { padding-top: 3.5rem; }
  .hero h1 { font-size: clamp(2.9rem,14vw,4.6rem); }
  .answer-map { min-height: 315px; }
  .map-core { width: 138px; font-size: .84rem; }
  .map-node { font-size: .67rem; padding: .55rem .65rem; }
  .trust-grid { grid-template-columns: repeat(2, 1fr); }
  .trust-item:nth-child(2) { border-right: 0; }
  .trust-item:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .card-grid, .feature-grid, .manifesto, .footer-grid, .related-grid { grid-template-columns: 1fr; }
  .manifesto { gap: 2rem; }
  .manifesto h2 { position: static; }
  .cta-band { grid-template-columns: 1fr; }
  .footer-menu { justify-content: flex-start; flex-wrap: wrap; }
  .footer-bottom-main, .footer-legal { align-items: flex-start; flex-direction: column; gap: .65rem; }
  .footer-powered { white-space: normal; }
  .page-hero h1 { font-size: clamp(2.5rem,12vw,4.2rem); }
  .article-content table { display: block; overflow-x: auto; }
}
