@import url('https://fonts.googleapis.com/css2?family=Comfortaa:wght@300;400;500;600;700&display=swap');

:root {
  font-family: 'Comfortaa', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --transition: 420ms cubic-bezier(.2,.7,.2,1);
  --radius: 18px;
  --brand-green: #8BBE24;
  --field-bg: #FFFFFF;
  --field-text: #171411;
  --field-muted: #756E67;
  --field-line: rgba(23,20,17,.18);
}

:root[data-theme='day'] {
  --bg: #F4F0E8;
  --surface: #EEE8DD;
  --surface-2: #E8E1D5;
  --text: #171411;
  --muted: #665F58;
  --line: rgba(23, 20, 17, 0.18);
  --accent: #321800;
  --accent-contrast: #F4F0E8;
}

:root[data-theme='night'] {
  --bg: #321800;
  --surface: #3C1F08;
  --surface-2: #46250C;
  --text: #F4F0E8;
  --muted: #D9CFC3;
  --line: rgba(244, 240, 232, 0.24);
  --accent: #F4F0E8;
  --accent-contrast: #321800;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); scroll-padding-top: 96px; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--bg); color: var(--text); transition: background var(--transition), color var(--transition); }
a { color: inherit; }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
textarea { resize: vertical; }
.punct { color: var(--brand-green); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.site-shell { min-height: 100vh; padding: 0 clamp(20px, 4vw, 64px); }

.site-header { min-height: 92px; display: grid; grid-template-columns: minmax(250px, 1fr) auto minmax(190px, 1fr); align-items: center; gap: 24px; border-bottom: 1px solid var(--line); position: relative; z-index: 10; }
.brand { display: inline-flex; align-items: center; gap: 12px; width: max-content; text-decoration: none; color: var(--text); }
.brand-word { position: relative; display: inline-flex; align-items: baseline; white-space: nowrap; font-size: clamp(19px, 1.9vw, 28px); line-height: 1; letter-spacing: -.055em; font-weight: 300; }
.brand-separator {
  display: inline-block;
  width: .18em;
  height: .18em;
  flex: 0 0 .18em;
  margin: 0 .10em .035em;
  border-radius: 50%;
  background: var(--brand-green);
}
.brand-i { position: relative; display: inline-block; line-height: 1; }
.brand-i::after { content: ''; position: absolute; width: .11em; height: .11em; border-radius: 50%; background: var(--brand-green); left: 50%; top: .015em; transform: translateX(-50%); }
.brand-symbol { width: 48px; height: 34px; flex: 0 0 auto; overflow: visible; color: var(--text); }
.main-nav { display: flex; align-items: center; justify-content: center; gap: clamp(14px, 2.2vw, 30px); font-size: 11px; }
.main-nav a { text-decoration: none; opacity: .72; transition: opacity 180ms ease; white-space: nowrap; }
.main-nav a:hover, .main-nav a:focus-visible { opacity: 1; }

.theme-control { justify-self: end; display: flex; align-items: center; gap: 10px; }
.auto-button { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 999px; padding: 7px 9px; font-size: 9px; letter-spacing: .12em; cursor: pointer; transition: all var(--transition); }
.auto-button.is-active { background: var(--text); color: var(--bg); border-color: var(--text); }
.theme-switch { display: inline-flex; align-items: center; gap: 7px; padding: 0; border: 0; background: transparent; color: var(--text); cursor: pointer; }
.sun, .moon { width: 16px; font-size: 14px; text-align: center; line-height: 1; }
.switch-track { position: relative; width: 42px; height: 24px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); transition: background var(--transition), border-color var(--transition); }
.switch-thumb { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--text); transition: transform var(--transition), background var(--transition); }
:root[data-theme='night'] .switch-thumb { transform: translateX(18px); }

/* Home / KALI: l'utente e la sua esigenza sono il centro visivo */
.hero { min-height: calc(100vh - 92px); display: flex; align-items: center; justify-content: center; text-align: center; padding: clamp(70px, 9vw, 132px) 0; border-bottom: 1px solid var(--line); }
.hero-copy { width: min(100%, 940px); margin: 0 auto; }
.eyebrow, .section-kicker { margin: 0 0 18px; text-transform: uppercase; font-size: 10px; letter-spacing: .2em; color: var(--muted); }
.hero h1 { max-width: 900px; margin: 0 auto; font-size: clamp(34px, 4.7vw, 64px); line-height: 1.05; letter-spacing: -.048em; font-weight: 500; }
.lead { max-width: 760px; margin: 24px auto 0; font-size: clamp(15px, 1.35vw, 19px); line-height: 1.65; letter-spacing: -.015em; color: var(--muted); }

.kali-prompt { margin: clamp(34px, 4vw, 48px) auto 0; max-width: 860px; padding: 0; border: 0; }
.kali-prompt textarea { width: 100%; min-height: 116px; border: 1px solid var(--field-line); border-radius: 16px; outline: 0; background: var(--field-bg); color: var(--field-text); padding: 18px 20px; font-size: clamp(14px, 1.15vw, 17px); line-height: 1.55; box-shadow: 0 8px 30px rgba(0,0,0,.035); }
.kali-prompt textarea:focus { border-color: var(--brand-green); box-shadow: 0 0 0 3px rgba(139,190,36,.14); }
.kali-prompt textarea::placeholder { color: var(--field-muted); opacity: .84; }
.kali-actions { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 12px; margin-top: 14px; }
.form-submit-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 10px; }
.kali-note, .privacy-note { color: var(--muted); font-size: 10px; line-height: 1.5; }
.form-status { min-height: 18px; margin: 8px 0 0; color: var(--muted); font-size: 10px; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; width: max-content; border: 1px solid var(--text); border-radius: 999px; padding: 11px 16px; text-decoration: none; cursor: pointer; font-size: 11px; line-height: 1; transition: background 180ms ease, color 180ms ease, transform 180ms ease, border-color 180ms ease; }
.button:hover { transform: translateY(-1px); }
.button--primary { background: var(--text); color: var(--bg); }
.button--primary:hover { border-color: var(--brand-green); }
.button--ghost { background: transparent; color: var(--text); }
.button--ghost:hover { background: var(--text); color: var(--bg); }

.content-section { min-height: 58vh; display: grid; align-items: center; border-bottom: 1px solid var(--line); padding: clamp(68px, 8vw, 120px) 0; }
.content-section--split { grid-template-columns: minmax(0, .9fr) minmax(320px, .8fr); gap: clamp(42px, 8vw, 130px); }
.content-section h2, .case-section h2, .site-footer h2, .detail-hero h1 { margin: 0; font-size: clamp(27px, 3.3vw, 46px); line-height: 1.1; font-weight: 500; letter-spacing: -.038em; }
.section-copy { max-width: 650px; }
.section-copy p, .section-intro, .footer-intro > p:not(.section-kicker), .detail-copy p, .detail-copy li { margin: 0; font-size: clamp(15px, 1.35vw, 19px); line-height: 1.7; color: var(--muted); }
.section-copy .button { margin-top: 30px; }

.case-section { border-bottom: 1px solid var(--line); padding: clamp(72px, 9vw, 130px) 0; }
.section-heading-row { display: grid; grid-template-columns: 1fr minmax(300px, .72fr); align-items: end; gap: 50px; margin-bottom: 46px; }
.section-intro { max-width: 560px; justify-self: end; }
.case-grid { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.case-card { min-height: 300px; padding: 28px; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.case-card:last-child { border-right: 0; }
.case-number { color: var(--muted); font-size: 10px; letter-spacing: .16em; }
.case-card h3 { margin: auto 0 14px; font-size: clamp(21px, 2vw, 30px); font-weight: 500; letter-spacing: -.03em; }
.case-card p { margin: 0; color: var(--muted); font-size: 13px; }

.site-footer { padding: clamp(72px, 8vw, 120px) 0 0; display: grid; grid-template-columns: minmax(280px, .7fr) minmax(420px, 1fr); gap: clamp(50px, 10vw, 150px); }
.footer-intro { max-width: 560px; }
.footer-intro > p:not(.section-kicker) { margin-top: 22px; }
.company-info { margin-top: 42px; display: flex; flex-direction: column; gap: 9px; color: var(--muted); font-size: 11px; }
.company-info a { text-decoration: none; }
.contact-form { width: 100%; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.contact-form label { display: flex; flex-direction: column; gap: 9px; margin-bottom: 19px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .11em; }
.contact-form input, .contact-form textarea { width: 100%; border: 1px solid var(--field-line); border-radius: 11px; padding: 12px 13px; background: var(--field-bg); color: var(--field-text); outline: none; font-size: 14px; text-transform: none; letter-spacing: 0; transition: border-color 180ms ease, box-shadow 180ms ease; }
.contact-form input:focus, .contact-form textarea:focus { border-color: var(--brand-green); box-shadow: 0 0 0 3px rgba(139,190,36,.14); }
.contact-form textarea { min-height: 100px; }
.contact-form textarea::placeholder, .contact-form input::placeholder { color: var(--field-muted); }
.footer-bottom { grid-column: 1 / -1; min-height: 90px; margin-top: 64px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 24px; color: var(--muted); font-size: 9px; letter-spacing: .12em; text-transform: uppercase; }

/* Detail pages */
.detail-main { max-width: 1180px; margin: 0 auto; }
.detail-hero { padding: clamp(72px, 10vw, 150px) 0 clamp(52px, 7vw, 96px); border-bottom: 1px solid var(--line); }
.detail-hero h1 { max-width: 900px; }
.detail-hero .lead { max-width: 800px; margin-left: 0; }
.detail-copy { padding: clamp(52px, 7vw, 96px) 0; max-width: 900px; }
.detail-copy h2 { margin: 54px 0 18px; font-size: clamp(23px, 2.7vw, 36px); font-weight: 500; letter-spacing: -.035em; }
.detail-copy h2:first-child { margin-top: 0; }
.detail-copy ul { padding-left: 1.2em; }
.detail-copy li + li { margin-top: 8px; }
.back-link { margin-top: 36px; }

@media (max-width: 980px) {
  .site-header { grid-template-columns: 1fr auto; min-height: auto; padding: 18px 0; }
  .main-nav { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; overflow-x: auto; padding: 4px 0 2px; scrollbar-width: none; }
  .main-nav::-webkit-scrollbar { display: none; }
  .theme-control { grid-column: 2; grid-row: 1; }
  .hero { min-height: auto; }
  .content-section--split, .section-heading-row, .site-footer { grid-template-columns: 1fr; }
  .section-intro { justify-self: start; }
  .case-grid { grid-template-columns: 1fr; }
  .case-card { min-height: 220px; border-right: 0; border-bottom: 1px solid var(--line); }
  .case-card:last-child { border-bottom: 0; }
}

@media (max-width: 700px) {
  .brand-word { font-size: 19px; }
  .brand-symbol { width: 38px; height: 28px; }
}

@media (max-width: 620px) {
  .site-shell { padding: 0 18px; }
  .brand-word { font-size: 17px; }
  .brand-symbol { width: 34px; height: 25px; }
  .main-nav { gap: 20px; }
  .hero h1 { font-size: clamp(32px, 10vw, 44px); }
  .lead { font-size: 15px; }
  .form-submit-row { align-items: flex-start; flex-direction: column; }
  .content-section { min-height: auto; }
  .content-section h2, .case-section h2, .site-footer h2 { font-size: clamp(26px, 8vw, 38px); }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .footer-bottom { align-items: flex-start; flex-direction: column; justify-content: center; }
}

@media (max-width: 460px) {
  .brand-word { display: none; }
  .brand-symbol { width: 44px; height: 31px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
