/* ==========================================================================
   Ifylabs — sistema visual
   Paper càlid + granat + or (les quatre barres com a firma)
   ========================================================================== */

:root {
  --paper: #FBF7F0;
  --paper-2: #FFFFFF;
  --ink: #24151A;
  --muted: #71595F;
  --line: #E9DECD;
  --garnet: #8B1A2E;
  --garnet-dark: #6E1424;
  --gold: #EEB90C;
  --gold-soft: #F8E7AC;
  --teal: #0E6E5C;

  --font-display: "Bricolage Grotesque", "Hanken Grotesk", sans-serif;
  --font-body: "Hanken Grotesk", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --radius: 14px;
  --wrap: 1160px;
}

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

html { scroll-behavior: smooth; }

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

img, svg { display: block; }

a { color: inherit; }

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

/* --------------------------------------------------------------------------
   Firma: les quatre barres
   -------------------------------------------------------------------------- */
.quatre {
  display: inline-flex;
  gap: 3px;
  align-items: center;
}
.quatre i {
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--garnet);
}
.quatre-gold i { background: var(--gold); }

/* --------------------------------------------------------------------------
   Tipografia i utilitats
   -------------------------------------------------------------------------- */
h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h1 { font-size: clamp(2.6rem, 5.6vw, 4.4rem); font-weight: 800; }
h2 { font-size: clamp(1.9rem, 3.6vw, 2.7rem); font-weight: 700; }
h3 { font-size: 1.45rem; font-weight: 700; letter-spacing: -0.01em; }
h4 { font-family: var(--font-body); font-size: 1.05rem; font-weight: 700; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--garnet);
}

.marked {
  font-style: normal;
  background: linear-gradient(transparent 62%, var(--gold) 62%, var(--gold) 94%, transparent 94%);
  padding: 0 0.06em;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  padding: 14px 26px;
  border-radius: 999px;
  transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--garnet); color: #fff; }
.btn-primary:hover { background: var(--garnet-dark); }
.btn-ghost { border: 1.5px solid var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--garnet); }
.btn-sm { padding: 10px 18px; font-size: 0.92rem; min-height: 44px; }

/* --------------------------------------------------------------------------
   Navegació
   -------------------------------------------------------------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.wordmark b { font-weight: inherit; color: var(--garnet); }
.logo-mark { width: auto; height: 38px; flex: none; }
.logo-type { width: auto; height: 24px; flex: none; }
.nav-links { display: flex; gap: 12px; }
.nav-links a {
  text-decoration: none;
  font-weight: 500;
  font-size: 0.98rem;
  color: var(--muted);
  transition: color 0.15s ease;
  padding: 10px 8px;
}
.nav-links a:hover { color: var(--garnet); }

.nav-actions { display: flex; align-items: center; gap: 6px; }
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0 10px;
  border: 0;
  background: none;
  cursor: pointer;
}
.nav-toggle-bar {
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle.is-open .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-open .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle.is-open .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-mobile {
  display: none;
  flex-direction: column;
  border-top: 1px solid var(--line);
  padding: 8px 24px 14px;
}
.nav-mobile a {
  text-decoration: none;
  font-weight: 500;
  color: var(--ink);
  padding: 13px 4px;
  border-bottom: 1px solid var(--line);
}
.nav-mobile a:last-child { border-bottom: 0; }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.hero { overflow: hidden; }
.hero-inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: clamp(56px, 9vw, 110px) 24px clamp(64px, 9vw, 120px);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: clamp(40px, 6vw, 80px);
  align-items: center;
}
.hero-copy h1 { margin: 22px 0 20px; max-width: 13ch; }
.lede {
  font-size: 1.18rem;
  color: var(--muted);
  max-width: 46ch;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 34px; }

/* Mòbil en CSS pur */
.hero-visual { position: relative; display: flex; justify-content: center; }
.hero-visual::before {
  content: "";
  position: absolute;
  inset: 8% -4% 4% 10%;
  background: var(--gold-soft);
  border-radius: 36px;
  transform: rotate(-4deg);
  z-index: 0;
}
.phone {
  position: relative;
  z-index: 1;
  width: min(300px, 78vw);
  border-radius: 42px;
  background: var(--ink);
  padding: 12px;
  box-shadow: 0 30px 60px -25px rgba(36, 21, 26, 0.45);
}
.phone-screen {
  background: var(--paper-2);
  border-radius: 32px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 480px;
}
.chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
}
.chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--teal);
  color: #fff;
  display: grid;
  place-items: center;
}
.chat-avatar svg { width: 20px; height: 20px; }
.chat-title {
  display: flex;
  flex-direction: column;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.2;
}
.chat-title small {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.chat-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 16px;
}
.bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.45;
}
.bubble.app {
  align-self: flex-start;
  background: #F2ECE0;
  border-bottom-left-radius: 4px;
}
.bubble.user {
  align-self: flex-end;
  background: var(--teal);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.bubble.typing {
  align-self: flex-start;
  display: inline-flex;
  gap: 5px;
  background: #F2ECE0;
  border-bottom-left-radius: 4px;
  padding: 13px 14px;
}
.bubble.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: typing 1.2s infinite ease-in-out;
}
.bubble.typing span:nth-child(2) { animation-delay: 0.18s; }
.bubble.typing span:nth-child(3) { animation-delay: 0.36s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.float-chip {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 12px 28px -16px rgba(36, 21, 26, 0.35);
  padding: 9px 15px;
  font-size: 0.82rem;
  white-space: nowrap;
}
.float-chip svg { width: 15px; height: 15px; color: var(--garnet); flex: none; }
.float-chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  flex: none;
}
.chip-a { top: -12px; right: max(-12px, -2vw); }
.chip-b { bottom: 7%; left: max(-8px, -1vw); }

/* --------------------------------------------------------------------------
   Xifres
   -------------------------------------------------------------------------- */
.stats { background: var(--garnet); color: #fff; }
.stats-inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: clamp(36px, 5vw, 56px) 24px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.stat { text-align: center; }
.stat strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.02em;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.stat span {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
}

/* --------------------------------------------------------------------------
   Aplicacions
   -------------------------------------------------------------------------- */
.apps {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: clamp(72px, 10vw, 120px) 24px;
}
.section-head { max-width: 620px; margin-bottom: clamp(40px, 6vw, 64px); }
.section-head h2 { margin: 18px 0 14px; }
.section-lede { color: var(--muted); font-size: 1.1rem; }

.app-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}
.app-card {
  --accent: var(--garnet);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.app-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 24px 44px -28px rgba(36, 21, 26, 0.35);
}
.accent-teal { --accent: var(--teal); }
.accent-garnet { --accent: var(--garnet); }
.accent-blue { --accent: #2456C4; }

.app-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.app-logo {
  width: 48px;
  height: 48px;
  border-radius: 13px;
  object-fit: cover;
  box-shadow: 0 4px 12px -6px rgba(36, 21, 26, 0.35);
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 11px;
  border-radius: 999px;
}
.tag-live { background: color-mix(in srgb, var(--teal) 12%, white); color: var(--teal); }

.app-card p { color: var(--muted); font-size: 0.98rem; flex-grow: 1; }
.app-link {
  font-weight: 700;
  font-size: 0.98rem;
  text-decoration: none;
  color: var(--accent);
}
.app-link span { transition: transform 0.15s ease; display: inline-block; }
.app-link:hover span { transform: translateX(4px); }

/* --------------------------------------------------------------------------
   Missió
   -------------------------------------------------------------------------- */
.mission { border-top: 1px solid var(--line); }
.mission-inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: clamp(72px, 10vw, 120px) 24px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(40px, 6vw, 88px);
  align-items: center;
}
.mission-copy h2 { margin: 18px 0 34px; max-width: 16ch; }
.mission-list { list-style: none; display: flex; flex-direction: column; gap: 26px; }
.mission-list li { display: flex; gap: 16px; }
.mission-icon {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--gold) 22%, white);
  color: #8A6A00;
  display: grid;
  place-items: center;
}
.mission-icon svg { width: 22px; height: 22px; }
.mission-list h4 { margin-bottom: 3px; }
.mission-list p { color: var(--muted); font-size: 0.96rem; }

.mission-panel {
  background: var(--garnet);
  color: #fff;
  border-radius: 20px;
  padding: clamp(36px, 4.5vw, 56px);
  display: flex;
  flex-direction: column;
  gap: 26px;
}
.quatre-panel { gap: 6px; }
.quatre-panel i {
  width: 5px;
  height: 34px;
  border-radius: 3px;
  background: var(--gold);
}
.mission-panel blockquote {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  line-height: 1.2;
  letter-spacing: -0.015em;
}
.mission-panel em { font-style: normal; color: var(--gold); }
.mission-panel figcaption {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
}

/* --------------------------------------------------------------------------
   Peu
   -------------------------------------------------------------------------- */
.footer { background: var(--ink); color: rgba(255, 255, 255, 0.82); }
.footer-inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: clamp(48px, 7vw, 72px) 24px;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
}
.footer .wordmark { color: #fff; margin-bottom: 14px; }
.footer .wordmark b { color: var(--gold); }
.footer-brand p.footer-tagline {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
}
.footer-brand p { font-size: 0.92rem; color: rgba(255, 255, 255, 0.6); }
.footer-col { display: flex; flex-direction: column; gap: 10px; }
.footer-col h4 {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 4px;
}
.footer-col a {
  text-decoration: none;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.75);
  transition: color 0.15s ease;
  padding: 3px 0;
}
.footer-col a:hover { color: #fff; }
.footer-col a small { font-size: 0.8em; color: rgba(255, 255, 255, 0.45); }

/* --------------------------------------------------------------------------
   Pàgines legals
   -------------------------------------------------------------------------- */
.legal {
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(48px, 7vw, 88px) 24px clamp(72px, 9vw, 110px);
}
.legal h1 { font-size: clamp(2rem, 4.4vw, 3rem); margin: 18px 0 10px; }
.legal .legal-updated {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 36px;
}
.legal h2 { font-size: 1.35rem; margin: 36px 0 10px; }
.legal p, .legal li { color: var(--muted); }
.legal ul { padding-left: 22px; margin: 10px 0; }
.legal a { color: var(--garnet); font-weight: 600; }
.legal .back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--garnet);
  margin-top: 44px;
}

/* --------------------------------------------------------------------------
   Blog
   -------------------------------------------------------------------------- */
.post-meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 36px;
}
.blog-card {
  display: block;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 28px;
  margin-bottom: 18px;
  text-decoration: none;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.blog-card:hover {
  transform: translateY(-3px);
  border-color: var(--garnet);
  box-shadow: 0 20px 40px -28px rgba(36, 21, 26, 0.35);
}
.blog-card h2 {
  font-size: 1.35rem;
  margin: 0 0 8px;
  color: var(--ink);
}
.blog-card p { color: var(--muted); font-size: 0.98rem; margin: 0 0 10px; }
.blog-card .meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--garnet);
}
.post-cta {
  background: var(--garnet);
  color: #fff;
  border-radius: var(--radius);
  padding: 26px 28px;
  margin-top: 40px;
}
.post-cta p { color: rgba(255, 255, 255, 0.9); margin-bottom: 14px; }
.post-cta strong { color: var(--gold); }
.post-cta a.btn-cta {
  display: inline-block;
  background: var(--gold);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  padding: 11px 22px;
  border-radius: 999px;
}

/* --------------------------------------------------------------------------
   Moviment
   -------------------------------------------------------------------------- */
.reveal-load { animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.reveal-load.d1 { animation-delay: 0.08s; }
.reveal-load.d2 { animation-delay: 0.16s; }
.reveal-load.d3 { animation-delay: 0.24s; }
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1); }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal-load { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .bubble.typing span { animation: none; }
  .btn, .app-card, .app-link span { transition: none; }
}

/* --------------------------------------------------------------------------
   Responsiu
   -------------------------------------------------------------------------- */
@media (max-width: 920px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-visual { margin-top: 12px; }
  .app-grid { grid-template-columns: 1fr; }
  .mission-inner { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .nav-links { display: none; }
  .nav-toggle { display: flex; }
  .nav-mobile:not([hidden]) { display: flex; }
  .stats-inner { grid-template-columns: 1fr 1fr; gap: 32px 16px; }
  .stat:last-child { grid-column: 1 / -1; }
  .chip-a { right: 0; }
  .chip-b { left: 0; }
  .footer-inner { grid-template-columns: 1fr; gap: 28px; }
}
