/* AM Serveis Digitals · capa de la Fase F (pàgines per idioma, formulari, mode fosc). Es carrega DESPRÉS de styles.css. */
:root {
  --sc-bg: #eef4fd; --sc-card: #ffffff; --sc-ink: #1D2834; --sc-line: #cfd9e6; --sc-brand: #0056C4; --sc-accent: #FF7A00; --sc-star: #FFC107; --sc-screen: #ffffff;
  --link: var(--primary);
}
a { color: var(--link); }
.btn, .site-footer a, .footer-links a, .main-nav a, .lang-btn, .card-link { text-decoration: none; }

/* ---------- Capçalera: Àrea client, idioma com a enllaços i mode fosc ---------- */
.lang-btn { display: inline-flex; align-items: center; text-decoration: none; }
.lang-btn[aria-current="true"] { background: var(--primary); color: #fff; }
.area-link { display: none; align-items: center; gap: .4rem; padding: .45rem .8rem; border-radius: 999px; border: 1px solid var(--line); color: var(--dark); font-weight: 600; font-size: .88rem; text-decoration: none; position: relative; transition: border-color .2s, color .2s; }
.area-link:hover { border-color: var(--primary); color: var(--primary); }
.area-link .icon { width: 1.1em; height: 1.1em; }
.area-dot { position: absolute; top: -2px; right: -2px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--white); }
.area-dot[hidden] { display: none; }
.theme-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--dark); cursor: pointer; display: inline-grid; place-items: center; }
.theme-btn:hover { border-color: var(--primary); color: var(--primary); }
.theme-btn svg { width: 20px; height: 20px; }
.theme-btn .t-sun { display: none; }
html[data-theme="dark"] .theme-btn .t-sun { display: inline; }
html[data-theme="dark"] .theme-btn .t-moon { display: none; }
@media (min-width: 560px) { .area-link { display: inline-flex; } }
@media (max-width: 559px) { .area-link { display: inline-flex; padding: .45rem; } .area-link span:not(.area-dot) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; } .lang-btn { padding: .38rem .45rem; } .header-actions { gap: .35rem; } }

/* ---------- Targetes de serveis ---------- */
.service-card .card-link { margin-top: auto; padding-top: 1rem; font-weight: 700; font-size: .95rem; }
.service-card .card-link::after { content: ""; position: absolute; inset: 0; }
.service-card p { margin-bottom: 0; }

/* ---------- Com treballem / passos ---------- */
.steps { display: grid; gap: 1.25rem; counter-reset: s; max-width: 1000px; margin: 0 auto; }
.step { position: relative; padding: 1.5rem; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.step h3 { font-size: 1.1rem; margin: .8rem 0 .4rem; }
.step p { margin: 0; color: var(--muted); font-size: .97rem; }
.step-n { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--primary); color: #fff; font-family: var(--font-head); font-weight: 800; }
@media (min-width: 720px) { .steps { grid-template-columns: repeat(3, 1fr); } .steps-4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .steps-4 { grid-template-columns: repeat(4, 1fr); max-width: 1180px; } }

/* ---------- Per a qui ---------- */
.sectors { display: flex; flex-wrap: wrap; justify-content: center; gap: .7rem; max-width: 900px; margin: 0 auto 2.5rem; }
.sector { display: inline-flex; align-items: center; gap: .5rem; padding: .6rem 1rem; border-radius: 999px; background: var(--white); border: 1px solid var(--line); font-weight: 600; font-size: .95rem; }
.sector .icon { color: var(--primary); }
.values li { display: flex; gap: .75rem; align-items: flex-start; margin-bottom: .9rem; }
.values .icon { color: var(--primary); width: 1.5rem; height: 1.5rem; margin-top: .15rem; }
.values strong, .values span { display: block; }
.values span { color: var(--muted); }
.benefits { display: grid; gap: 1rem; max-width: 900px; margin: 0 auto 2.5rem; }
.benefit { display: flex; gap: .8rem; align-items: flex-start; padding: 1rem 1.2rem; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.benefit .icon { color: var(--primary); width: 1.6rem; height: 1.6rem; }
.benefit p { margin: 0; }
@media (min-width: 760px) { .benefits { grid-template-columns: repeat(3, 1fr); } }
.google-reviews-card { max-width: 720px; margin: 0 auto; padding: 2rem 1.5rem; text-align: center; background: var(--white); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-sm); }
.reviews-stars { color: #FFC107; font-size: 1.6rem; letter-spacing: .15em; }
.reviews-actions { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: center; }

/* ---------- Pàgines de servei ---------- */
.page-hero { position: relative; overflow: hidden; isolation: isolate; padding: calc(var(--header-h) + 2rem) 0 3rem; background: var(--dark-bg, #1D2834); color: rgba(255,255,255,.85); }
.page-hero-bg { position: absolute; inset: 0; z-index: -1; background: radial-gradient(60% 70% at 90% 10%, rgba(0,86,196,.6) 0%, rgba(0,86,196,0) 70%), linear-gradient(160deg, #1D2834 0%, #18222d 60%, #0f1720 100%); }
.page-hero h1 { color: #fff; font-size: clamp(1.9rem, 1.3rem + 3vw, 3rem); font-weight: 800; margin-bottom: 1rem; }
.page-hero .hero-sub { margin-bottom: 1.6rem; }
.page-hero-inner { display: grid; gap: 2rem; align-items: center; }
.page-hero-scene { max-width: 420px; width: 100%; justify-self: center; }
.page-hero-short { padding-bottom: 2.2rem; }
@media (min-width: 900px) { .page-hero-inner { grid-template-columns: 1.2fr .8fr; } .page-hero-short .page-hero-inner { grid-template-columns: 1fr; } }
.crumbs ol { display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: 0 0 1rem; font-size: .88rem; list-style: none; }
.crumbs li + li::before { content: "›"; margin-right: .4rem; opacity: .6; }
.crumbs a { color: #9cc3ff; text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs [aria-current] { opacity: .85; }
.two-col { display: grid; gap: 2.5rem; }
@media (min-width: 860px) { .two-col { grid-template-columns: 1fr 1fr; gap: 3.5rem; } }
.two-col h2, .faq-inner h2 { font-size: clamp(1.4rem, 1.1rem + 1.2vw, 1.9rem); }
.check-list li { display: flex; gap: .7rem; align-items: flex-start; margin-bottom: .8rem; }
.check-list .icon { color: var(--primary); flex: none; margin-top: .25rem; width: 1.2em; height: 1.2em; }
.note { margin-top: 1.2rem; padding: .9rem 1.1rem; border-left: 4px solid var(--accent); background: var(--soft); border-radius: 8px; color: var(--muted); font-size: .95rem; }
.related { margin-top: 2.5rem; }
.related h3, .related .related-t { font-size: 1rem; margin: 0 0 .5em; }   /* el títol de la llista és un H2 (jerarquia), però amb la mida d'abans */
.related ul { display: flex; flex-wrap: wrap; gap: .6rem; }
.related a { display: inline-block; padding: .5rem .9rem; border: 1px solid var(--line); border-radius: 999px; font-weight: 600; font-size: .92rem; text-decoration: none; }
.related a:hover { border-color: var(--primary); }
.legal .related ul { list-style: none; padding-left: 0; }
.legal .related li { margin-bottom: 0; }

/* ---------- Escenes animades ---------- */
.scene { width: 100%; height: auto; filter: drop-shadow(0 24px 40px rgba(0,0,0,.35)); }
.sc-float { animation: floaty 6s ease-in-out infinite; }
.sc-wave { animation: scWave 2.4s ease-in-out infinite; transform-origin: center; }
.sc-pulse { animation: scPulse 3s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
.sc-scan { animation: scScan 3s ease-in-out infinite; }
@keyframes scWave { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@keyframes scPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes scScan { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(98px); } }

/* ---------- FAQ visible (details obert per defecte) ---------- */
.faq-list { display: grid; gap: .8rem; }
.faq-item { border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
.faq-item summary { cursor: pointer; list-style: none; padding: 1.1rem 1.3rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; border-radius: var(--radius); }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 1.5rem; line-height: 1; color: var(--primary); flex: none; }
.faq-item[open] summary::after { content: "–"; }
.faq-item summary h3 { margin: 0; font-size: 1.05rem; }
.faq-item p { margin: 0; padding: 0 1.3rem 1.2rem; color: var(--muted); }

/* ---------- Contacte ---------- */
.contact-grid { display: grid; gap: 2rem; }
@media (min-width: 900px) { .contact-grid { grid-template-columns: 1.4fr .8fr; align-items: start; } }
.contact-card, .contact-side { background: var(--white); border: 1px solid var(--line); border-radius: 22px; padding: 1.6rem; box-shadow: var(--shadow-sm); }
.contact-side h2 { font-size: 1.2rem; }
.side-list li { color: var(--text); }
.side-list a { color: var(--link); }
.side-social { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }
.cform { display: grid; gap: 1.1rem; }
.field label { display: block; font-weight: 600; margin-bottom: .35rem; font-size: .95rem; }
.field input, .field select, .field textarea { width: 100%; padding: .75rem .9rem; border-radius: 12px; border: 1.5px solid var(--line); background: var(--white); color: var(--text); font: inherit; min-height: 48px; }
.field textarea { resize: vertical; min-height: 130px; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; border-color: var(--primary); }
.field small { color: var(--muted); font-size: .85rem; }
.check { display: flex; gap: .65rem; align-items: flex-start; font-size: .93rem; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: .15rem; accent-color: var(--primary); flex: none; }
.check-opt { padding: .75rem .9rem; border: 1px solid rgba(0, 86, 196, .28); border-radius: 12px; background: rgba(0, 86, 196, .06); }   /* casella opcional de publicitat: ben visible */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.ts-box { min-height: 0; }
.form-msg { margin: 0; font-weight: 600; min-height: 1.4em; }
.form-msg.ok { color: #0a7a3d; }
.form-msg.err { color: #c0392b; }
.cform button[disabled] { opacity: .65; cursor: progress; }
.form-off { text-align: center; padding: 1rem; }
.form-off h2 { font-size: 1.25rem; }

/* ---------- Legal ---------- */
.legal-inner article h1 { margin-bottom: .4rem; }
.legal table th[scope="row"] { background: transparent; font-weight: 600; }
.legal ul li { word-break: break-word; }

/* ---------- Mode fosc ---------- */
html[data-theme="dark"] {
  color-scheme: dark;
  --text: #e6ebf2; --muted: #a9b5c4; --line: #2a3745; --soft: #16212d; --primary-050: #14263f; --link: #7fb2ff; --accent: #FF8C00;
  --sc-bg: #1b2a3b; --sc-card: #243446; --sc-ink: #0f1720; --sc-line: #3a4c60; --sc-screen: #1b2a3b;
}
html[data-theme="dark"] body { background: #111a24; color: var(--text); }
html[data-theme="dark"] h1, html[data-theme="dark"] h2, html[data-theme="dark"] h3 { color: #f1f5fa; }
html[data-theme="dark"] .site-header::before { background: rgba(17,26,36,.92); }
html[data-theme="dark"] body.menu-open .site-header::before, html[data-theme="dark"] .main-nav { background: #111a24; }
@media (min-width: 1024px) { html[data-theme="dark"] .main-nav { background: none; } }
html[data-theme="dark"] .main-nav a:not(.btn), html[data-theme="dark"] .area-link, html[data-theme="dark"] .theme-btn { color: #e6ebf2; }
html[data-theme="dark"] .menu-toggle span { background: #e6ebf2; }
html[data-theme="dark"] .area-dot { box-shadow: 0 0 0 2px #111a24; }
html[data-theme="dark"] .lang-toggle { background: #16212d; }
html[data-theme="dark"] .section-soft { background: #16212d; }
html[data-theme="dark"] .service-card, html[data-theme="dark"] .step, html[data-theme="dark"] .sector, html[data-theme="dark"] .benefit, html[data-theme="dark"] .google-reviews-card, html[data-theme="dark"] .faq-item, html[data-theme="dark"] .contact-card, html[data-theme="dark"] .contact-side, html[data-theme="dark"] .about-logo-card { background: #17222e; border-color: var(--line); }
html[data-theme="dark"] .service-card:hover { border-color: transparent; }
html[data-theme="dark"] .service-icon { background: #14263f; color: #7fb2ff; }
html[data-theme="dark"] .about-logo-card, html[data-theme="dark"] .brand img { background: #fff; border-radius: 10px; padding: 4px 8px; }
html[data-theme="dark"] .btn-outline { color: #e6ebf2; border-color: #3a4c60; }
html[data-theme="dark"] .btn-outline:hover { border-color: #e6ebf2; }
html[data-theme="dark"] .eyebrow { color: #7fb2ff; }
html[data-theme="dark"] .stats dd, html[data-theme="dark"] .cta-note { color: #f1f5fa; }
html[data-theme="dark"] .field input, html[data-theme="dark"] .field select, html[data-theme="dark"] .field textarea { background: #0f1720; color: #e6ebf2; border-color: #3a4c60; }
html[data-theme="dark"] .form-msg.ok { color: #5ee08f; }
html[data-theme="dark"] .form-msg.err { color: #ff8a7a; }
html[data-theme="dark"] .note { background: #16212d; }
html[data-theme="dark"] .legal th { background: #16212d; color: #f1f5fa; }
html[data-theme="dark"] .scene { filter: drop-shadow(0 24px 40px rgba(0,0,0,.5)); }
html[data-theme="dark"] .hero, html[data-theme="dark"] .site-footer { background: #0b121a; }
html[data-theme="dark"] .section-dark { background: #0b121a; }
html[data-theme="dark"] .acc-item, html[data-theme="dark"] .related a { background: #17222e; }
[hidden] { display: none !important; }
.steps { list-style: none; padding: 0; }

/* ---------- Línia de serveis i zona dins de l'H1 de la portada (es veu com l'antiga etiqueta superior) ---------- */
.hero h1 .h1-pre { display: flex; width: fit-content; font-family: var(--font-body); line-height: 1.4; }

/* ---------- Secció «On treballem» de les pàgines de servei ---------- */
.local-inner { display: flex; gap: 1.25rem; align-items: flex-start; max-width: 860px; }
.local-inner .local-pin { flex: none; width: 48px; height: 48px; padding: 11px; border-radius: 14px; background: var(--primary-050); color: var(--primary); }
.local-inner h2 { font-size: clamp(1.4rem, 1.1rem + 1.4vw, 2rem); }
.local-inner p { color: var(--muted); font-size: 1.05rem; }
.local-inner p:last-child { margin-bottom: 0; }
html[data-theme="dark"] .local-inner .local-pin { background: #14263f; color: #7fb2ff; }
html[data-theme="dark"] .local-inner p { color: #b8c3d0; }

/* ---------- Submenú de Serveis a la capçalera ---------- */
.main-nav .has-sub { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; position: relative; }
.sub-toggle { width: 44px; height: 44px; border: 0; background: transparent; cursor: pointer; border-radius: 10px; position: relative; color: var(--dark); }
.sub-toggle::before { content: ""; position: absolute; left: 50%; top: 50%; width: 9px; height: 9px; margin: -7px 0 0 -5px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform .2s var(--ease); }
.sub-toggle[aria-expanded="true"]::before { transform: rotate(-135deg); margin-top: -2px; }
.sub-toggle:hover, .sub-toggle:focus-visible { color: var(--primary); background: var(--soft); }
.main-nav .sub-menu { display: none; flex-basis: 100%; flex-direction: column; align-items: center; gap: .25rem; padding: .25rem 0 0; width: 100%; list-style: none; }
.main-nav .has-sub.open .sub-menu { display: flex; }
.main-nav .sub-menu a:not(.btn) { font-family: var(--font-body); font-weight: 600; font-size: 1.1rem; padding: .5rem 1.25rem; min-height: 44px; }
html[data-theme="dark"] .sub-toggle { color: #e6ebf2; }

@media (min-width: 1024px) {
  .main-nav .has-sub { flex-wrap: nowrap; }
  .sub-toggle { width: 26px; height: 32px; margin-left: -.5rem; }
  .main-nav .sub-menu {
    display: flex; position: absolute; top: 100%; left: 50%; z-index: 20; flex-basis: auto; width: max-content; max-width: 360px; align-items: stretch; gap: 0;
    margin: 0; padding: .5rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow);
    opacity: 0; visibility: hidden; transform: translate(-50%, 6px); transition: opacity .18s, transform .18s, visibility .18s;
  }
  .main-nav .has-sub::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 10px; }
  .main-nav .has-sub:hover .sub-menu, .main-nav .has-sub.open .sub-menu, .main-nav .has-sub:has(:focus-visible) .sub-menu { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
  .main-nav .sub-menu li { display: block; }
  .main-nav .sub-menu a:not(.btn) { display: block; padding: .6rem .9rem; font-size: .92rem; line-height: 1.3; white-space: normal; border-radius: 8px; text-align: left; }
  .main-nav .sub-menu a:not(.btn)::after { display: none; }
  .main-nav .sub-menu a:not(.btn):hover, .main-nav .sub-menu a:not(.btn):focus-visible { background: var(--soft); color: var(--primary); }
  .main-nav .sub-menu a[aria-current="true"] { color: var(--primary); }
  html[data-theme="dark"] .main-nav .sub-menu { background: #17222e; border-color: #2a3745; }
  html[data-theme="dark"] .main-nav .sub-menu a:not(.btn):hover { background: #1f2e3d; }
}
@media (prefers-reduced-motion: reduce) { .main-nav .sub-menu, .sub-toggle::before { transition: none; } }

/* ---------- Animacions d'entrada de les pàgines (serveis i resta de pàgines interiors) ---------- */
@keyframes pgIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes pgScene { from { opacity: 0; transform: translateY(22px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes pgBg { from { opacity: 0; } to { opacity: 1; } }
@keyframes vtOut { to { opacity: 0; } }
@keyframes vtIn { from { opacity: 0; transform: translateY(14px); } }
@media (prefers-reduced-motion: no-preference) {
  .page-hero-bg { animation: pgBg 1s ease-out both; }
  .page-hero .crumbs { animation: pgIn .55s var(--ease) both; }
  .page-hero h1 { animation: pgIn .6s var(--ease) .08s both; }
  .page-hero .hero-sub { animation: pgIn .6s var(--ease) .16s both; }
  .page-hero .hero-ctas { animation: pgIn .6s var(--ease) .24s both; }
  .page-hero-scene { animation: pgScene .8s var(--ease) .15s both; }
  /* Transició suau entre pàgines de la web (navegadors que la suporten; la capçalera es queda quieta) */
  @view-transition { navigation: auto; }
  .site-header { view-transition-name: site-header; }
  ::view-transition-old(root) { animation: vtOut .18s ease-in both; }
  ::view-transition-new(root) { animation: vtIn .4s var(--ease) both; }
}

/* ---------- Portada: graella de serveis (7 + targeta «Parlem») i bloc «Agenda i atenció amb IA» ----------
   Cap targeta sola en una fila: 8 targetes = 1 / 2 / 4 columnes; el bloc d'IA (3) = 1 o 3 columnes. */
@media (min-width: 640px) {
  .cards-grid.cards-8 > *, .cards-grid.cards-3 > * { grid-column: span 2 !important; }
}
@media (min-width: 640px) and (max-width: 899px) {
  .cards-grid.cards-3 { grid-template-columns: 1fr; max-width: 620px; }
  .cards-grid.cards-3 > * { grid-column: auto !important; }
}
@media (min-width: 900px) {
  .cards-grid.cards-3 { grid-template-columns: repeat(3, 1fr); }
  .cards-grid.cards-3 > * { grid-column: auto !important; }
}
@media (min-width: 1024px) and (max-width: 1199px) {
  .cards-grid.cards-8 { grid-template-columns: repeat(4, 1fr); max-width: 900px; }
}
@media (min-width: 1200px) {
  .cards-grid.cards-8 { grid-template-columns: repeat(4, 1fr); max-width: 1180px; }
  .cards-grid.cards-8 > * { grid-column: auto !important; }
}
/* Targeta «Tens una idea diferent? Parlem»: el mateix vidre, amb un toc de la marca */
.service-card-cta { background: linear-gradient(160deg, var(--primary-050), var(--white) 70%); border-style: dashed; border-color: rgba(0,86,196,.35); }
.service-card-cta .service-icon { background: var(--primary); color: var(--white); }
html[data-theme="dark"] .service-card-cta { background: linear-gradient(160deg, #14263f, #17222e 70%); border-color: rgba(127,178,255,.35); }

/* Fons de les seccions de serveis: taques de llum suaus de la marca i una quadrícula de punts molt tènue (sota el contingut) */
.section-svc { position: relative; isolation: isolate; overflow: hidden; }
.section-svc::before, .section-svc::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.section-svc::before { background: radial-gradient(38% 32% at 6% 14%, rgba(0,86,196,.08), rgba(0,86,196,0) 70%), radial-gradient(32% 30% at 94% 78%, rgba(255,122,0,.06), rgba(255,122,0,0) 70%); }
.section-svc-ai::before { background: radial-gradient(36% 40% at 92% 18%, rgba(0,86,196,.08), rgba(0,86,196,0) 70%), radial-gradient(30% 34% at 8% 86%, rgba(255,122,0,.05), rgba(255,122,0,0) 70%); }
.section-svc::after { background-image: radial-gradient(rgba(0,86,196,.13) 1px, transparent 1.4px); background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 18%, #000 82%, transparent); mask-image: linear-gradient(180deg, transparent, #000 18%, #000 82%, transparent); }
#serveis.section-svc { padding-bottom: 2.25rem; }
.section-svc-ai { padding-top: 2.25rem; }
html[data-theme="dark"] .section-svc::before { background: radial-gradient(38% 32% at 6% 14%, rgba(90,160,255,.08), rgba(90,160,255,0) 70%), radial-gradient(32% 30% at 94% 78%, rgba(255,140,0,.05), rgba(255,140,0,0) 70%); }
html[data-theme="dark"] .section-svc::after { background-image: radial-gradient(rgba(127,178,255,.10) 1px, transparent 1.4px); }
