/* ============================================================
   Dalflow v2 · "El sistema en marxa"
   Tema: paper i tinta amb accent cobalt. Llum per defecte,
   fosc via prefers-color-scheme (automàtic, sense selector).
   Sistema de formes: targetes 14px, botons píndola, inputs 8px.
   Fonts self-hosted a /fonts (subset llatí, cobreix ca/es/en).
   ============================================================ */

@font-face {
  font-family: 'Satoshi'; font-weight: 400; font-style: normal; font-display: swap;
  src: url('fonts/satoshi-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Satoshi'; font-weight: 500; font-style: normal; font-display: swap;
  src: url('fonts/satoshi-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Satoshi'; font-weight: 700; font-style: normal; font-display: swap;
  src: url('fonts/satoshi-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Satoshi'; font-weight: 900; font-style: normal; font-display: swap;
  src: url('fonts/satoshi-900.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono'; font-weight: 400; font-style: normal; font-display: swap;
  src: url('fonts/jetbrains-mono-400.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono'; font-weight: 500; font-style: normal; font-display: swap;
  src: url('fonts/jetbrains-mono-500.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono'; font-weight: 600; font-style: normal; font-display: swap;
  src: url('fonts/jetbrains-mono-600.woff2') format('woff2');
}

:root {
  --paper: #f6f5f1;
  --paper-rise: #fdfcf9;
  --ink: #17181b;
  --ink-dim: #43464d;
  --ink-mute: #7a7d85;
  --line: #e0dfd8;
  --accent: #1d43e6;
  --accent-ink: #ffffff;
  --tint: #eeede7;
  --radius-card: 14px;
  --font-sans: 'Satoshi', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121316;
    --paper-rise: #1a1b1f;
    --ink: #ebecee;
    --ink-dim: #b4b6bc;
    --ink-mute: #83868e;
    --line: #2a2c31;
    --accent: #6e8bff;
    --accent-ink: #0e1013;
    --tint: #17181c;
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3 { font-weight: 700; letter-spacing: -0.02em; line-height: 1.08; text-wrap: balance; }
h2 { font-size: clamp(28px, 4vw, 44px); }
h3 { font-size: 20px; }
p { text-wrap: pretty; }

.acc { color: var(--accent); }

::selection { background: var(--accent); color: var(--accent-ink); }

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

/* Gra de paper: textura fixa sobre tota la pàgina */
body::after {
  content: ''; position: fixed; inset: 0; z-index: 60; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: var(--grain-opacity, 0.25); mix-blend-mode: soft-light;
}

/* ---------- Scroll reveal (IntersectionObserver + transicions) ----------
   L'estat ocult només existeix si el JS ha marcat <html class="js-reveal">:
   sense JS o amb reduced-motion, tot és visible des del principi. */
.js-reveal .reveal {
  opacity: 0; transform: translateY(22px);
  transition:
    opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: var(--rd, 0ms);
}
.js-reveal .reveal.in { opacity: 1; transform: none; }

/* ---------- Entrada del hero (una sola coreografia de càrrega) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .hero__line, .hero__sub, .hero__ctas, .hero__contact, .hero .ops {
    animation: heroRise 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
  }
  .hero__line:nth-child(1) { animation-delay: 0.05s; }
  .hero__line:nth-child(2) { animation-delay: 0.16s; }
  .hero__line:nth-child(3) { animation-delay: 0.27s; }
  .hero__sub { animation-delay: 0.42s; }
  .hero__ctas { animation-delay: 0.52s; }
  .hero__contact { animation-delay: 0.6s; }
  .hero .ops { animation-delay: 0.35s; }
  .ops__table tr { animation: heroRise 0.7s cubic-bezier(0.16, 1, 0.3, 1) both; }
  .ops__table tr:nth-child(1) { animation-delay: 0.52s; }
  .ops__table tr:nth-child(2) { animation-delay: 0.60s; }
  .ops__table tr:nth-child(3) { animation-delay: 0.68s; }
  .ops__table tr:nth-child(4) { animation-delay: 0.76s; }
  .ops__table tr:nth-child(5) { animation-delay: 0.84s; }
  .ops__table tr:nth-child(6) { animation-delay: 0.92s; }
  .ops__foot { animation: heroRise 0.7s cubic-bezier(0.16, 1, 0.3, 1) 1.05s both; }
}
@keyframes heroRise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

.hero__line { display: block; }

/* Cursor de terminal després de "A preu tancat." */
.hero__cursor {
  display: inline-block; width: 0.45ch; height: 0.72em;
  margin-left: 0.12em; transform: translateY(0.06em);
  background: var(--accent);
  animation: blink 1.1s steps(2, start) infinite;
}
@keyframes blink { to { visibility: hidden; } }
@media (prefers-reduced-motion: reduce) {
  .hero__cursor { animation: none; }
}

/* ---------- Botons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 26px; border-radius: 999px;
  font-weight: 700; font-size: 16px; text-decoration: none;
  transition: transform 160ms cubic-bezier(0.23, 1, 0.32, 1), background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn--sm { padding: 10px 18px; font-size: 14.5px; }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: var(--ink); color: var(--paper); }
.btn--ghost { color: var(--ink); border: 1.5px solid var(--line); background: transparent; }
.btn--ghost:hover { border-color: var(--ink); }
.btn--inverse { background: var(--paper); color: var(--ink); }
.btn--inverse:hover { transform: translateY(-1px); }
.btn--ghost-inverse { color: var(--accent-ink); border: 1.5px solid color-mix(in srgb, var(--accent-ink) 40%, transparent); }
.btn--ghost-inverse:hover { border-color: var(--accent-ink); }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 28px;
  height: 68px; padding: 0 clamp(20px, 4vw, 48px);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav__brand { font-size: 22px; font-weight: 900; letter-spacing: -0.03em; color: var(--ink); text-decoration: none; }
.nav__brand em { font-style: normal; color: var(--accent); }
.nav__links { display: flex; gap: 22px; margin-left: auto; }
.nav__links a { color: var(--ink-dim); text-decoration: none; font-size: 15.5px; font-weight: 500; }
.nav__links a:hover { color: var(--ink); }
.nav__lang { display: flex; gap: 10px; font-family: var(--font-mono); font-size: 12.5px; letter-spacing: 0.02em; }
.nav__lang a { color: var(--ink-mute); text-decoration: none; }
.nav__lang a:hover { color: var(--ink); }
.nav__lang .is-current { color: var(--ink); font-weight: 600; }
@media (max-width: 860px) {
  .nav__links { display: none; }
  .nav__lang { margin-left: auto; }
}

/* ---------- Hero ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(32px, 5vw, 72px); align-items: center;
  max-width: 1240px; margin: 0 auto;
  padding: clamp(48px, 7vh, 88px) clamp(20px, 4vw, 48px) clamp(40px, 6vh, 72px);
}
.hero h1 { font-size: clamp(38px, 5.4vw, 68px); font-weight: 900; }
.hero__sub { margin-top: 22px; font-size: 19px; color: var(--ink-dim); max-width: 46ch; }
.hero__ctas { margin-top: 30px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.hero__contact { margin-top: 16px; font-size: 14px; color: var(--ink-mute); }
.hero__contact a { color: var(--ink-dim); text-decoration: underline; text-underline-offset: 2px; }
.hero__contact a:hover { color: var(--accent); }

/* Registre d'operacions (dades reals, estil horari de tren) */
.ops {
  background: var(--paper-rise);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 22px 22px 18px;
  box-shadow: 0 24px 60px -32px color-mix(in srgb, var(--ink) 22%, transparent);
}
.ops__head { display: flex; flex-direction: column; gap: 3px; margin-bottom: 14px; }
.ops__title { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 9px; }
.ops__dot {
  width: 8px; height: 8px; border-radius: 999px; background: var(--accent); flex: none;
  animation: pulse 2.2s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); }
  70%, 100% { box-shadow: 0 0 0 9px transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .ops__dot { animation: none; }
}
.ops__note { font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute); }
.ops__table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ops__table td { padding: 9px 0; border-top: 1px solid var(--line); vertical-align: top; }
.ops__table tr:first-child td { border-top: none; }
.ops__time { font-family: var(--font-mono); font-weight: 600; color: var(--accent); width: 58px; white-space: nowrap; padding-right: 12px; }
.ops__who { font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute); text-align: right; padding-left: 12px; max-width: 110px; }
.ops__foot { margin-top: 14px; font-size: 13.5px; color: var(--ink-mute); font-style: italic; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
}

/* ---------- Franja de prova: 4 columnes abans → ara ---------- */
.proof {
  max-width: 1240px; margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 48px) clamp(48px, 7vh, 80px);
}
.proof__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; }
.proof__item {
  display: flex; flex-direction: column; gap: 8px;
  padding: 20px 24px 20px 0;
  border-top: 2px solid var(--ink);
  margin-right: 28px;
}
.proof__item:last-child { margin-right: 0; }
.proof__sector {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-mute);
}
.proof__num {
  font-family: var(--font-mono); font-weight: 600;
  font-size: clamp(16px, 1.4vw, 19px); letter-spacing: -0.02em;
  display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap;
}
.proof__from { color: var(--ink-mute); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.proof__arrow { color: var(--accent); }
.proof__to { color: var(--accent); }
.proof__label { font-size: 14px; color: var(--ink-dim); }
@media (max-width: 900px) {
  .proof__grid { grid-template-columns: 1fr 1fr; row-gap: 8px; }
  .proof__item { margin-right: 16px; }
}
@media (max-width: 560px) {
  .proof__grid { grid-template-columns: 1fr; }
  .proof__item { margin-right: 0; }
}

/* ---------- Manifest ---------- */
.manifest { padding: clamp(48px, 8vh, 96px) clamp(20px, 4vw, 48px); border-top: 1px solid var(--line); }
.manifest__inner { max-width: 1240px; margin: 0 auto; }
.manifest p {
  font-size: clamp(24px, 3.2vw, 40px); font-weight: 700;
  letter-spacing: -0.02em; line-height: 1.2; text-wrap: balance;
  max-width: 28ch;
}
.manifest em { font-style: normal; color: var(--accent); }

/* ---------- Seccions ---------- */
.section { padding: clamp(56px, 9vh, 110px) clamp(20px, 4vw, 48px); }
.section > * { max-width: 1240px; margin-left: auto; margin-right: auto; }
.section--tint { background: var(--tint); }
.section__head { margin-bottom: clamp(32px, 5vh, 56px); }
.section__lede { margin-top: 16px; font-size: 18px; color: var(--ink-dim); max-width: 58ch; }

/* ---------- Ofertes ---------- */
.offers { display: flex; flex-direction: column; gap: 18px; }
.offer {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 3fr) minmax(0, 6fr);
  gap: clamp(20px, 3vw, 44px);
  background: var(--paper-rise);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: clamp(24px, 3vw, 36px);
}
.offer--featured { border: 2px solid var(--accent); }
.offer__tag {
  display: inline-block; margin-bottom: 10px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  color: var(--accent); border: 1px solid var(--accent);
  border-radius: 999px; padding: 3px 10px;
}
.offer__for { margin-top: 10px; color: var(--ink-dim); font-size: 15.5px; }
.offer__eg { margin-top: 10px; color: var(--ink-mute); font-size: 14px; }
.offer__terms { display: flex; flex-direction: column; gap: 6px; justify-content: center; }
.offer__terms::before {
  content: 'Entrega'; /* ca i es; l'anglès se sobreescriu just a sota */
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-mute);
}
html[lang="en"] .offer__terms::before { content: 'Delivery'; }
.offer__time { font-family: var(--font-mono); font-weight: 600; font-size: clamp(17px, 1.6vw, 21px); letter-spacing: -0.02em; color: var(--ink); }
.offer__scope { display: grid; grid-template-columns: 1fr; gap: 20px; }
.offer__scope h4 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-mute); margin-bottom: 10px; }
.offer__scope ul { list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 14.5px; color: var(--ink-dim); }
.offer__scope li { padding-left: 18px; position: relative; }
.offer__scope li::before { content: '+'; position: absolute; left: 0; font-family: var(--font-mono); color: var(--accent); font-weight: 600; }
.offers__note { margin-top: 26px; color: var(--ink-mute); font-size: 15px; }
@media (max-width: 980px) {
  .offer { grid-template-columns: 1fr; }
  .offer__terms { flex-direction: row; align-items: baseline; gap: 16px; }
}
@media (max-width: 560px) {
  .offer__scope { grid-template-columns: 1fr; }
}

/* ---------- Casos ---------- */
.cases { display: flex; flex-direction: column; }
.case {
  display: grid; grid-template-columns: 150px minmax(0, 1fr) 220px;
  gap: clamp(20px, 3vw, 44px);
  padding: clamp(28px, 4vh, 40px) 0;
  border-top: 1px solid var(--line);
}
.case:first-child { border-top: none; }
.case__brand {
  width: 110px; height: 110px; border-radius: var(--radius-card);
  background: var(--paper-rise); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; padding: 12px;
}
.case__brand img { max-height: 80px; width: 100%; object-fit: contain; }
.case__brand--text { font-weight: 900; font-size: 19px; letter-spacing: -0.02em; }
.case__sector { display: block; font-size: 13.5px; font-weight: 500; color: var(--ink-mute); margin-top: 4px; }
.case__body p { margin-top: 12px; color: var(--ink-dim); font-size: 16px; max-width: 60ch; }
.case__body blockquote { margin-top: 14px; font-size: 15.5px; font-style: italic; }
.case__body blockquote footer { margin-top: 4px; font-size: 13.5px; color: var(--ink-mute); font-style: normal; }
.case__before, .case__after { display: flex; gap: 10px; align-items: baseline; }
.case__before { color: var(--ink-mute); }
.case__after { color: var(--ink); font-weight: 500; }
.case__tag {
  flex: none; font-family: var(--font-mono); font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-mute);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px;
  transform: translateY(-1px);
  min-width: 72px; text-align: center;
}
.case__tag--now { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.case__stat { display: flex; flex-direction: column; gap: 6px; align-self: center; }
.case__stat-v { font-family: var(--font-mono); font-weight: 600; font-size: clamp(19px, 1.7vw, 25px); letter-spacing: -0.02em; color: var(--accent); line-height: 1.2; }
.case__stat-k { font-size: 14px; color: var(--ink-dim); }
@media (max-width: 900px) {
  .case { grid-template-columns: 1fr; gap: 16px; }
  .case__brand { width: 84px; height: 84px; padding: 9px; }
  .case__brand img { max-height: 62px; }
}

/* ---------- Procés ---------- */
.steps {
  list-style: none;
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: clamp(20px, 3vw, 36px);
  counter-reset: step;
}
.step__n {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 999px;
  font-family: var(--font-mono); font-weight: 600; font-size: 14px;
  background: var(--ink); color: var(--paper);
  margin-bottom: 14px;
}
.step h3 { margin-bottom: 8px; }
.step p { font-size: 15px; color: var(--ink-dim); }
@media (max-width: 900px) { .steps { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .steps { grid-template-columns: 1fr; } }

/* ---------- Encaix ---------- */
.fit { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 4vw, 64px); }
.fit h2 { font-size: clamp(22px, 2.6vw, 30px); margin-bottom: 20px; }
.fit__list { list-style: none; display: flex; flex-direction: column; gap: 12px; color: var(--ink-dim); font-size: 16px; }
.fit__list li { padding-left: 26px; position: relative; }
.fit__list--yes li::before { content: '\2713'; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
.fit__list--no li::before { content: '\00d7'; position: absolute; left: 0; color: var(--ink-mute); font-weight: 700; }
.fit__verticals { margin-top: clamp(28px, 4vh, 44px); font-size: 16px; color: var(--ink-dim); }
@media (max-width: 780px) { .fit { grid-template-columns: 1fr; } }

/* ---------- Sobre mi ---------- */
.about { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: clamp(28px, 4vw, 64px); align-items: center; }
.about__photo img { border-radius: var(--radius-card); aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 18%; }
.about__body p { margin-top: 14px; color: var(--ink-dim); font-size: 17px; max-width: 58ch; }
.about__body h2 + p { margin-top: 20px; }
.about__body strong { color: var(--ink); font-weight: 700; }
.about__line { font-family: var(--font-mono); font-size: 13.5px; color: var(--ink-mute); }
.about__line a { color: var(--accent); text-decoration: none; }
.about__line a:hover { text-decoration: underline; text-underline-offset: 2px; }
@media (max-width: 780px) { .about { grid-template-columns: 1fr; } .about__photo { max-width: 320px; } }

/* ---------- FAQ ---------- */
.faq { display: flex; flex-direction: column; }
.faq details { border-top: 1px solid var(--line); max-width: 860px; }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary {
  cursor: pointer; list-style: none;
  padding: 20px 36px 20px 0; position: relative;
  font-weight: 700; font-size: 17.5px;
  transition: color 0.15s ease;
}
@media (hover: hover) and (pointer: fine) {
  .faq summary:hover { color: var(--accent); }
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: '+'; position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-mono); font-size: 20px; color: var(--accent);
}
.faq details[open] summary::after { content: '\2212'; }
.faq details p { padding: 0 0 22px; color: var(--ink-dim); font-size: 16px; max-width: 64ch; }

/* ---------- CTA final ---------- */
.cta {
  background: var(--accent); color: var(--accent-ink);
  padding: clamp(64px, 10vh, 120px) clamp(20px, 4vw, 48px);
  text-align: center;
}
.cta h2 { font-size: clamp(32px, 4.5vw, 52px); font-weight: 900; }
.cta p { margin: 18px auto 0; max-width: 52ch; font-size: 18px; opacity: 0.92; }
.cta__row { margin-top: 32px; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ---------- Footer ---------- */
.footer {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 28px clamp(20px, 4vw, 48px);
  font-size: 14px; color: var(--ink-mute);
}
.footer__brand { font-weight: 900; font-size: 17px; color: var(--ink); }
.footer__brand em { font-style: normal; color: var(--accent); }
.footer a { color: var(--ink-mute); margin-left: auto; }
