/* ==========================================================================
   KAI·FORGE — core (tema clar)
   Tokens, reset, tipografia, botons, utilitats.

   Direcció visual: paper càlid + tinta + lila sòlid.
   Deliberadament NO fem degradats lila sobre blanc: és exactament l'aspecte
   de plantilla SaaS genèrica. El lila apareix en poca superfície i sempre
   sòlid, com una tinta d'impremta.
   ========================================================================== */

:root {
  /* --- Paper (fons) --- */
  --paper:      #FBFAF7;   /* càlid, no blanc clínic */
  --paper-2:    #F3F1EC;   /* banda alterna */
  --paper-3:    #EAE7E0;   /* filets i separadors sòlids */
  --card:       #FFFFFF;

  /* --- Tinta (text) --- */
  /* Contrast mesurat contra --paper-2, que és el fons més fosc on cauen.
     El terciari era #74748A i es quedava a 4.04:1: per sota d'AA. */
  --ink:        #16161D;   /* 15.95:1 */
  --ink-2:      #4C4C5A;   /*  7.48:1 */
  --ink-3:      #6B6B7E;   /*  4.62:1 — mínim AA per a text normal */

  /* --- Lila (marca) --- */
  --lila:       #6D28D9;   /*  7.3:1 sobre paper */
  --lila-fort:  #5B21B6;
  --lila-tou:   #F1EBFE;   /* fons de tint */
  --lila-vora:  #DDCFFB;

  /* --- Blau (accent secundari) --- */
  --blau:       #1D4ED8;   /*  7.6:1 sobre paper */
  --blau-tou:   #E8EFFE;
  --blau-vora:  #C7D9FA;

  /* --- Tinta fosca (seccions de contrast) --- */
  --fosc:       #16161D;
  --fosc-2:     #23232E;

  /* --- Estat --- */
  --verd:       #067A55;
  --ambre:      #A55B00;

  /* --- Línies --- */
  --line:       rgba(22, 22, 29, 0.10);
  --line-forta: rgba(22, 22, 29, 0.18);

  /* --- Ombres: suaus i baixes, com paper sobre paper --- */
  --ombra-1: 0 1px 2px rgba(22, 22, 29, 0.04), 0 2px 8px rgba(22, 22, 29, 0.04);
  --ombra-2: 0 2px 4px rgba(22, 22, 29, 0.04), 0 8px 24px rgba(22, 22, 29, 0.07);
  --ombra-3: 0 4px 8px rgba(22, 22, 29, 0.05), 0 20px 48px rgba(22, 22, 29, 0.10);

  /* --- Tipografia --- */
  --sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono: 'Geist Mono', 'SF Mono', ui-monospace, Menlo, Monaco, monospace;

  /* --- Moviment --- */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-tou: cubic-bezier(0.4, 0, 0.2, 1);

  /* --- Mides --- */
  --maxw: 1120px;
  --maxw-text: 680px;
  --gutter: 24px;
  --r-s: 10px;
  --r-m: 16px;
  --r-l: 22px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg, video { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
ul, ol { list-style: none; }
a { color: inherit; }

/* La llum entra per dalt. Molt subtil, gairebé imperceptible. */
body::before {
  content: '';
  position: fixed;
  inset: 0 0 auto;
  height: 70vh;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(109, 40, 217, 0.055), transparent 70%),
    radial-gradient(ellipse 60% 50% at 85% 0%, rgba(29, 78, 216, 0.045), transparent 70%);
}

/* Gra de paper */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 900;
  pointer-events: none;
  opacity: 0.028;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

main, header, footer { position: relative; z-index: 1; }

/* ---------- Focus ---------- */
:focus { outline: none; }

:focus-visible {
  outline: 2.5px solid var(--lila);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 2000;
  background: var(--ink);
  color: var(--paper);
  padding: 12px 20px;
  border-radius: 0 0 12px 12px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.2s var(--ease);
}

.skip-link:focus { top: 0; }

/* ---------- Tipografia ---------- */
h1, h2, h3, h4 {
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.12;
  color: var(--ink);
  text-wrap: balance;
}

.display {
  font-size: clamp(42px, 6.6vw, 82px);
  line-height: 1;
  letter-spacing: -0.045em;
  font-weight: 600;
}

/* L'accent és tinta sòlida, no un degradat rentat */
.accent { color: var(--lila); }

.underline-mark {
  position: relative;
  white-space: nowrap;
}

.underline-mark::after {
  content: '';
  position: absolute;
  left: -1px;
  right: -1px;
  bottom: 0.06em;
  height: 0.32em;
  background: var(--lila-tou);
  border-radius: 2px;
  z-index: -1;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--lila);
  margin-bottom: 18px;
}

.eyebrow::before {
  content: '';
  width: 20px;
  height: 2px;
  background: var(--lila);
  border-radius: 2px;
  flex-shrink: 0;
}

.section-title {
  font-size: clamp(30px, 4.2vw, 50px);
  line-height: 1.08;
  letter-spacing: -0.035em;
  max-width: 17ch;
  margin-bottom: 18px;
}

.section-lead {
  font-size: clamp(17px, 1.5vw, 20px);
  color: var(--ink-2);
  max-width: 54ch;
  line-height: 1.6;
}

.section-head { margin-bottom: clamp(44px, 5.5vw, 72px); }

.section-head.center {
  text-align: center;
  margin-inline: auto;
  max-width: 700px;
}

.section-head.center .eyebrow { justify-content: center; }
.section-head.center .section-title,
.section-head.center .section-lead { margin-inline: auto; }

/* ---------- Estructura ---------- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

section {
  position: relative;
  z-index: 1;
  padding-block: clamp(72px, 9vw, 128px);
}

/* Bandes: la majoria clares, alguna fosca per donar ritme sense cansar */
.band-2 { background: var(--paper-2); }

.band-fosca {
  background: var(--fosc);
  color: rgba(255, 255, 255, 0.92);
}

.band-fosca h1, .band-fosca h2, .band-fosca h3, .band-fosca h4 { color: #fff; }
.band-fosca .section-lead { color: rgba(255, 255, 255, 0.72); }
.band-fosca .eyebrow { color: #C4B5FD; }
.band-fosca .eyebrow::before { background: #C4B5FD; }

/* ---------- Botons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 15px 26px;
  border-radius: 12px;
  border: 1.5px solid transparent;
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease),
              background 0.25s var(--ease-tou), border-color 0.25s var(--ease-tou),
              color 0.25s var(--ease-tou);
}

.btn svg { flex-shrink: 0; transition: transform 0.3s var(--ease); }
.btn:hover svg.arrow { transform: translateX(4px); }

.btn-primary {
  background: var(--lila);
  color: #fff;
  box-shadow: var(--ombra-1);
}

.btn-primary:hover {
  background: var(--lila-fort);
  transform: translateY(-2px);
  box-shadow: var(--ombra-2);
}

.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-forta);
}

.btn-ghost:hover {
  border-color: var(--ink);
  background: rgba(22, 22, 29, 0.04);
  transform: translateY(-2px);
}

.band-fosca .btn-ghost { color: #fff; border-color: rgba(255, 255, 255, 0.28); }
.band-fosca .btn-ghost:hover { border-color: #fff; background: rgba(255, 255, 255, 0.08); }

.btn-sm { padding: 11px 20px; font-size: 15px; border-radius: 10px; }
.btn-block { width: 100%; }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 16px;
  font-weight: 600;
  color: var(--lila);
  text-decoration: none;
  position: relative;
  transition: gap 0.3s var(--ease);
}

.link-arrow::after {
  content: '';
  position: absolute;
  left: 0;
  right: 20px;
  bottom: -3px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s var(--ease);
}

.link-arrow:hover { gap: 10px; }
.link-arrow:hover::after { transform: scaleX(1); }

.band-fosca .link-arrow { color: #C4B5FD; }

/* ---------- Etiquetes ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 100px;
  border: 1.5px solid var(--lila-vora);
  background: var(--lila-tou);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--lila);
}

.chip.blau { border-color: var(--blau-vora); background: var(--blau-tou); color: var(--blau); }
.chip.neutra { border-color: var(--line-forta); background: transparent; color: var(--ink-3); }
.chip.demo { border-color: #F0D9AE; background: #FCF4E5; color: var(--ambre); }

.dot-live {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--verd);
  flex-shrink: 0;
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--line);
  background: var(--card);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
  transition: border-color 0.25s var(--ease-tou), color 0.25s var(--ease-tou);
}

.tag:hover { border-color: var(--lila-vora); color: var(--lila); }

/* ---------- Aparició en scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
  transition-delay: var(--d, 0ms);
}

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

/* ---------- Utilitats ---------- */
.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;
}

.center { text-align: center; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row.center { justify-content: center; }

.rule {
  height: 1px;
  border: 0;
  background: var(--line);
}

/* ---------- Moviment reduït ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

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