/* ============================================================
   CemGPT — Landing page
   Co-branded CemGPT + Heidelberg Materials
   Palette: brand Heidelberg Materials — VERDE UNICO del logo principale
   verde #004E2B · bianco (il verde brillante #00DD39 è stato rimosso su richiesta)
   ============================================================ */

:root {
  --hm-green: #004E2B;            /* Heidelberg Materials — verde unico del logo */
  --hm-green-bright: var(--hm-green); /* unificato al verde unico (era #00DD39) */
  --bg: #0A0C10;
  --bg-elevated: #13161C;
  --surface: #1B2129;
  --surface-2: #232a33;
  --border: #2A323D;
  --text: #F4F6F8;
  --text-muted: #A8B0BA;
  --text-dim: #6C7682;
  --radius: 16px;
  --radius-lg: 24px;
  --container: 1100px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

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

a { color: var(--hm-green-bright); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Accessibility helpers ---- */
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -48px;
  background: var(--hm-green); color: #fff; font-weight: 600;
  padding: 10px 16px; border-radius: 8px; z-index: 100;
  transition: top .2s ease;
}
.skip-link:focus { top: 12px; text-decoration: none; }

:focus-visible {
  outline: 3px solid var(--hm-green-bright);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10, 12, 16, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 72px; gap: 16px;
}
.brand { display: inline-flex; align-items: center; }
.brand:hover { text-decoration: none; }
.brand-logo { height: 38px; width: auto; }
.cobrand {
  display: flex; flex-direction: column; align-items: flex-end;
  line-height: 1.2; text-align: right;
}
.cobrand-by { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 4px; }
.cobrand-name { font-size: 15px; font-weight: 700; color: var(--text); }
.cobrand-logo { display: block; height: 26px; width: auto; }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  padding: 72px 0 40px;
  text-align: center;
  background:
    radial-gradient(60% 80% at 50% 0%, rgba(0, 78, 43, 0.14), transparent 70%),
    var(--bg);
}
.eyebrow {
  display: inline-block;
  font-size: 13px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--hm-green-bright);
  border: 1px solid rgba(0, 78, 43, 0.35);
  padding: 6px 14px; border-radius: 999px;
  margin-bottom: 24px;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 800; line-height: 1.1; letter-spacing: -0.02em;
  margin: 0 auto 20px; max-width: 16ch;
}
.hero h1 .accent { color: var(--hm-green-bright); }
.hero-sub {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  color: var(--text-muted);
  max-width: 60ch; margin: 0 auto;
}

/* ============================================================
   CHAT
   ============================================================ */
.chat-section { padding: 28px 0 56px; }

.chat-window {
  max-width: 760px; margin: 0 auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0,78,43,0.06);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.chat-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}
.chat-status { font-size: 14px; font-weight: 600; color: var(--text); display: inline-flex; align-items: center; gap: 8px; }
.chat-status .dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--hm-green-bright);
  box-shadow: 0 0 0 4px rgba(0,78,43,0.18);
}
.chat-tag {
  font-size: 11px; text-transform: uppercase; letter-spacing: .1em; font-weight: 700;
  color: var(--text-dim); border: 1px solid var(--border); padding: 3px 8px; border-radius: 6px;
}

.chat-thread {
  padding: 24px 20px; min-height: 280px; max-height: 440px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 16px;
}
.msg { display: flex; gap: 12px; max-width: 85%; animation: msg-in .28s ease both; }
/* comparsa morbida dei messaggi (AI-Native: smooth reveal) */
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
/* caret lampeggiante durante lo streaming della risposta AI */
.msg-bubble.is-streaming::after {
  content: ''; display: inline-block; width: 2px; height: 1.05em;
  margin-left: 2px; vertical-align: -2px; background: var(--hm-green-bright);
  animation: caret-blink 1s steps(1) infinite;
}
@keyframes caret-blink { 50% { opacity: 0; } }
.msg-avatar {
  flex: 0 0 32px; width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center; font-size: 14px; font-weight: 700;
}
.msg-bubble {
  padding: 12px 16px; border-radius: 14px; font-size: 15px;
}
.msg.ai { align-self: flex-start; }
.msg.ai .msg-avatar { background: var(--hm-green-bright); color: #FFFFFF; }
.msg.ai .msg-bubble { background: var(--surface); color: var(--text); border-top-left-radius: 4px; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg.user .msg-avatar { background: var(--surface-2); color: var(--text-muted); }
.msg.user .msg-bubble { background: linear-gradient(135deg, var(--hm-green), #004E2B); color: #fff; border-top-right-radius: 4px; }

/* typing indicator */
.typing { display: inline-flex; gap: 5px; align-items: center; padding: 4px 2px; }
.typing span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--text-dim);
  animation: blink 1.4s infinite both;
}
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.chat-suggestions {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 0 20px 16px;
}
.chip {
  font-family: var(--font); font-size: 13px; font-weight: 500;
  color: var(--text-muted); background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 10px 16px; min-height: 44px; /* touch target ≥44px */
  display: inline-flex; align-items: center;
  cursor: pointer; transition: all .18s ease;
}
.chip:hover { border-color: var(--hm-green); color: var(--text); background: var(--surface-2); }

.chat-input {
  display: flex; align-items: flex-end; gap: 10px;
  padding: 14px 16px; border-top: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}
.chat-input textarea {
  flex: 1; resize: none; max-height: 140px;
  font-family: var(--font); font-size: 15px; line-height: 1.5;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; outline: none;
}
.chat-input textarea::placeholder { color: var(--text-dim); }
.chat-input textarea:focus { border-color: var(--hm-green); }
.send-btn {
  flex: 0 0 auto; width: 46px; height: 46px; border: none; border-radius: 12px;
  background: var(--hm-green-bright);
  color: #FFFFFF; cursor: pointer; display: grid; place-items: center;
  transition: transform .15s ease, filter .15s ease;
}
.send-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.send-btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.chat-disclaimer {
  text-align: center; font-size: 13px; color: var(--text-dim);
  max-width: 620px; margin: 18px auto 0;
}

/* embed mode (quando EMBED_URL è valorizzato in chat.js) */
.chat-window.is-embed { padding: 0; }
.chat-window.is-embed iframe { width: 100%; height: 600px; border: 0; display: block; }

/* ============================================================
   GALLERY (immagini futuristiche)
   ============================================================ */
.gallery { padding: 24px 0 56px; }
.gallery-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
}
.gallery-item {
  margin: 0; border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; background: var(--bg-elevated);
  transition: transform .25s ease, border-color .25s ease;
}
.gallery-item:hover { transform: translateY(-4px); border-color: var(--hm-green); }
.gallery-item img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; }
.gallery-item figcaption {
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px 18px 20px;
}
.gallery-title { font-size: 1.05rem; font-weight: 700; color: var(--text); }
.gallery-desc { font-size: 0.95rem; line-height: 1.55; color: var(--text-muted); }

/* ============================================================
   ABOUT
   ============================================================ */
.about {
  padding: 64px 0;
  background:
    radial-gradient(70% 100% at 50% 100%, rgba(0, 78, 43, 0.10), transparent 70%),
    var(--bg-elevated);
  border-top: 1px solid var(--border);
}
.about-inner { max-width: 760px; margin: 0 auto; }
.about h2 {
  font-size: clamp(1.6rem, 3.5vw, 2.3rem); font-weight: 800; letter-spacing: -0.02em;
  margin: 0 0 24px; text-align: center;
}
.about p { color: var(--text-muted); font-size: 1.08rem; margin: 0 0 18px; }
.about strong { color: var(--text); font-weight: 600; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer { background: var(--bg); border-top: 1px solid var(--border); }
.footer-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; padding: 40px 24px; flex-wrap: wrap;
}
.footer-brand img { height: 30px; width: auto; margin-bottom: 8px; }
.footer-tagline { font-size: 14px; color: var(--text-dim); margin: 0; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 8px 28px; }
.footer-nav a { color: var(--text-muted); font-size: 15px; }
.footer-nav a:hover { color: var(--hm-green-bright); }
.footer-nav a[data-soon="true"] { position: relative; }
.footer-nav a[data-soon="true"]::after {
  content: "presto"; font-size: 9px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-dim); border: 1px solid var(--border); border-radius: 4px;
  padding: 1px 5px; margin-left: 6px; vertical-align: middle;
}
.footer-bottom { border-top: 1px solid var(--border); }
.footer-bottom p { font-size: 13px; color: var(--text-dim); padding: 18px 0; margin: 0; }
.footer-bottom .footer-legal { font-size: 12px; line-height: 1.5; padding: 18px 0 8px; }
.footer-bottom .footer-credits { padding: 0 0 18px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .gallery-grid { grid-template-columns: 1fr; }
  .cobrand-logo { height: 22px; }
  .hero { padding: 48px 0 32px; }
  .header-inner { height: 64px; }
  .brand-logo { height: 32px; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
