/* ==========================================================================
   incanet.it — one-page site
   Mobile-first, BEM, no external fonts, no frameworks.
   Breakpoints: 48rem (tablet), 64rem (desktop).
   ========================================================================== */

:root {
  --color-bg: #0b1120;
  --color-bg-2: #0f172a;
  --color-bg-3: #1e293b;
  --color-text: #e5e7eb;
  --color-text-strong: #f8fafc;
  --color-muted: #94a3b8;
  --color-accent: #38bdf8;
  --color-accent-2: #a78bfa;
  --color-line: rgba(255, 255, 255, 0.08);
  --glass-bg: rgba(15, 23, 42, 0.34);
  --glass-bg-strong: rgba(11, 17, 32, 0.78);
  --glass-blur: 10px;
  --radius: 1rem;
  --radius-sm: 0.5rem;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --header-h: 4rem;
  --footer-h: 5.25rem;
  --content-w: 72rem;
  --gutter: clamp(1rem, 4vw, 2rem);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Inter, Arial, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background:
    radial-gradient(60rem 40rem at 10% -10%, rgba(56, 189, 248, 0.08), transparent 60%),
    radial-gradient(50rem 40rem at 110% 20%, rgba(167, 139, 250, 0.08), transparent 60%),
    linear-gradient(160deg, var(--color-bg), var(--color-bg-2) 60%, var(--color-bg-3));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
ul,
ol {
  margin: 0;
}

a {
  color: var(--color-accent);
}

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.anchor {
  position: absolute;
  top: 0;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--color-accent);
  color: var(--color-bg);
  border-radius: var(--radius-sm);
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}

/* --------------------------------------------------------------------------
   Glass surface (shared)
   -------------------------------------------------------------------------- */

.glass {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* --------------------------------------------------------------------------
   3D background
   -------------------------------------------------------------------------- */

.scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 0.75rem 1rem;
  min-height: var(--header-h);
  padding: 0 var(--gutter);
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  border-bottom: 1px solid var(--color-line);
}

.header__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--color-text-strong);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.header__logo {
  width: 1.75rem;
  height: 1.75rem;
}

.header__name {
  font-size: 1.1rem;
}

.header__toggle {
  order: 3;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.35rem;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
}

.header__toggle-bar {
  display: block;
  width: 1.1rem;
  height: 2px;
  margin: 0 auto;
  background: var(--color-text);
  transition: transform 0.25s var(--ease), opacity 0.25s;
}

.header__toggle[aria-expanded="true"] .header__toggle-bar:first-child {
  transform: translateY(0.22rem) rotate(45deg);
}

.header__toggle[aria-expanded="true"] .header__toggle-bar:last-child {
  transform: translateY(-0.22rem) rotate(-45deg);
}

.header__nav {
  order: 4;
  grid-column: 1 / -1;
  display: none;
  padding: 0.5rem 0 1rem;
}

.header__nav.is-open {
  display: block;
}

.nav {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav__link {
  display: block;
  padding: 0.6rem 0.75rem;
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.95rem;
  border-radius: var(--radius-sm);
  transition: color 0.2s, background-color 0.2s;
}

.nav__link:hover,
.nav__link.is-active {
  color: var(--color-text-strong);
  background: rgba(255, 255, 255, 0.05);
}

.nav__link.is-active {
  box-shadow: inset 2px 0 0 var(--color-accent);
}

/* Language switch */
.lang {
  order: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.lang__btn {
  padding: 0.4rem 0.5rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-muted);
  font: inherit;
  cursor: pointer;
  transition: color 0.2s, background-color 0.2s;
}

.lang__btn:hover {
  color: var(--color-text-strong);
}

.lang__btn[aria-pressed="true"] {
  color: var(--color-text-strong);
  background: rgba(56, 189, 248, 0.12);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.35);
}

.lang__sep {
  opacity: 0.5;
}

/* --------------------------------------------------------------------------
   Main layout
   -------------------------------------------------------------------------- */

.main {
  position: relative;
  z-index: 1;
  padding-top: var(--header-h);
  padding-bottom: var(--footer-h);
}

.section {
  width: min(var(--content-w), 100%);
  margin: 0 auto;
  padding: clamp(4rem, 10vh, 7rem) var(--gutter);
}

.section__head {
  max-width: 44rem;
  margin-bottom: clamp(2rem, 5vh, 3.5rem);
}

.section__kicker {
  margin-bottom: 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.section__title {
  font-size: clamp(1.8rem, 4.5vw, 3rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.01em;
  color: var(--color-text-strong);
}

.section__lead {
  margin-top: 1rem;
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  color: var(--color-muted);
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.9rem;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.2s var(--ease), box-shadow 0.2s, background-color 0.2s, border-color 0.2s;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn--primary {
  color: var(--color-bg);
  background: linear-gradient(120deg, var(--color-accent), var(--color-accent-2));
  box-shadow: 0 8px 24px rgba(56, 189, 248, 0.25);
}

.btn--primary:hover {
  box-shadow: 0 10px 30px rgba(56, 189, 248, 0.35);
}

.btn--ghost {
  color: var(--color-text-strong);
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.03);
}

.btn--ghost:hover {
  border-color: rgba(255, 255, 255, 0.35);
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100dvh - var(--header-h));
  padding: clamp(3rem, 8vh, 6rem) var(--gutter);
  text-align: center;
}

.hero__inner {
  width: min(62rem, 100%);
}

.hero__kicker {
  margin-bottom: 1.25rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.hero__title {
  font-size: clamp(2.2rem, 6.5vw, 4.6rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--color-text-strong);
  text-wrap: balance;
}

.hero__lead {
  max-width: 44rem;
  margin: 1.5rem auto 0;
  font-size: clamp(1.05rem, 1.8vw, 1.3rem);
  color: var(--color-muted);
  text-wrap: pretty;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 2.25rem;
}

.hero__scroll {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  width: 1.5rem;
  height: 2.4rem;
  padding-top: 0.4rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
}

.hero__scroll-dot {
  width: 0.3rem;
  height: 0.3rem;
  border-radius: 50%;
  background: var(--color-accent);
  animation: scroll-hint 1.8s var(--ease) infinite;
}

@keyframes scroll-hint {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(0.9rem); opacity: 0; }
  100% { transform: translateY(0); opacity: 0; }
}

/* --------------------------------------------------------------------------
   AI topics (scrollytelling blocks)
   -------------------------------------------------------------------------- */

.topic {
  display: flex;
  align-items: center;
  min-height: 60vh;
  padding: clamp(1.5rem, 4vh, 3rem) 0;
}

.topic__body {
  width: min(34rem, 100%);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  background: rgba(15, 23, 42, 0.24);
  -webkit-backdrop-filter: blur(7px) saturate(130%);
  backdrop-filter: blur(7px) saturate(130%);
  border-color: rgba(255, 255, 255, 0.12);
}

.topic__text {
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

.topic__index {
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--color-accent-2);
}

.topic__title {
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-text-strong);
}

.topic__text {
  margin-top: 0.9rem;
  color: var(--color-text);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding: 0;
  list-style: none;
}

.tags__item {
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: var(--color-muted);
  border: 1px solid var(--color-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
}

/* --------------------------------------------------------------------------
   Grids, cards, notes, steps
   -------------------------------------------------------------------------- */

.grid {
  display: grid;
  gap: 1rem;
}

.card,
.note,
.steps__item {
  padding: clamp(1.25rem, 3vw, 1.75rem);
  transition: transform 0.3s var(--ease), border-color 0.3s;
}

.card:hover,
.note:hover,
.steps__item:hover {
  transform: translateY(-3px);
  border-color: rgba(56, 189, 248, 0.35);
}

.card__title,
.note__title,
.steps__title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text-strong);
}

.card__text,
.note__text,
.steps__text {
  margin-top: 0.6rem;
  font-size: 0.97rem;
  color: var(--color-muted);
}

.steps {
  display: grid;
  gap: 1rem;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps__num {
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  margin-bottom: 0.9rem;
  font-weight: 700;
  color: var(--color-bg);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-2));
}

/* --------------------------------------------------------------------------
   Contact
   -------------------------------------------------------------------------- */

.section--contact {
  padding-bottom: clamp(5rem, 12vh, 8rem);
}

.contact {
  max-width: 44rem;
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 3.5rem);
  text-align: center;
}

.contact .btn {
  margin-top: 1.75rem;
}

/* --------------------------------------------------------------------------
   Footer (fixed, glass)
   -------------------------------------------------------------------------- */

.footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  min-height: var(--footer-h);
  padding: 0.6rem var(--gutter);
  font-size: 0.82rem;
  text-align: center;
  color: var(--color-muted);
  background: var(--glass-bg-strong);
  border: 0;
  border-top: 1px solid var(--color-line);
  border-radius: 0;
  box-shadow: none;
}

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

.footer__link:hover {
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Reveal on scroll
   -------------------------------------------------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(1.5rem);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* --------------------------------------------------------------------------
   Breakpoints
   -------------------------------------------------------------------------- */

@media (min-width: 48rem) {
  :root {
    --footer-h: 3rem;
  }

  .footer {
    flex-direction: row;
    gap: 1.5rem;
  }

  .footer__item + .footer__item::before {
    content: "·";
    margin-right: 1.5rem;
    opacity: 0.5;
  }

  .grid--2 {
    grid-template-columns: repeat(2, 1fr);
  }

  .steps {
    grid-template-columns: repeat(3, 1fr);
  }

  .topic--alt {
    justify-content: flex-end;
  }
}

@media (min-width: 64rem) {
  .header {
    grid-template-columns: auto 1fr auto;
  }

  .header__toggle {
    display: none;
  }

  .header__nav {
    order: 2;
    grid-column: auto;
    display: block;
    padding: 0;
    justify-self: center;
  }

  .nav {
    flex-direction: row;
    gap: 0.25rem;
  }

  .nav__link {
    padding: 0.5rem 0.85rem;
  }

  .nav__link.is-active {
    box-shadow: inset 0 -2px 0 var(--color-accent);
  }

  .lang {
    order: 3;
  }

  .topic {
    min-height: 70vh;
  }
}

/* --------------------------------------------------------------------------
   Reduced motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .hero__scroll-dot {
    animation: none;
  }

  .btn,
  .card,
  .note,
  .steps__item {
    transition: none;
  }
}
