/* ==========================================================================
   Approfitand — Estils principals
   Una sola versió responsive, ràpida i compatible amb tots els dispositius
   (mòbil, tauleta, desktop, Safari/iOS). Animacions subtils i segures.
   ========================================================================== */

/* ---------- Variables ---------- */
:root {
    --green-900: #061412;
    --green-800: #0a201b;
    --green-700: #0f2e26;
    --green-600: #154034;
    --mint-500: #34d399;
    --mint-400: #6ee7b7;
    --mint-300: #a7f3d0;
    --accent: #7fcdbb;
    --amber: #fbbf24;
    --cream: #ecfdf5;
    --text: #e6f4ef;
    --text-soft: #9fc4b7;
    --card: rgba(255, 255, 255, 0.04);
    --card-border: rgba(127, 205, 187, 0.16);
    --max: 1180px;
    --radius: 20px;
    --shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.6);
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

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

body {
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--green-900);
    color: var(--text);
    line-height: 1.65;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Bloqueig de scroll quan el gate o el menú mòbil són actius */
html.is-locked,
html.is-locked body {
    overflow: hidden;
}

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

a {
    color: inherit;
    text-decoration: none;
}

ul {
    list-style: none;
}

/* ---------- Fons decoratiu global ---------- */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(60% 50% at 80% -5%, rgba(52, 211, 153, 0.14), transparent 60%),
        radial-gradient(50% 50% at 0% 30%, rgba(127, 205, 187, 0.10), transparent 60%),
        linear-gradient(180deg, var(--green-900), #04100e 60%);
}

/* ---------- Layout helpers ---------- */
.container {
    width: min(100% - 2.4rem, var(--max));
    margin-inline: auto;
    position: relative;
    z-index: 1;
}

.section {
    padding: clamp(4rem, 9vw, 7.5rem) 0;
    position: relative;
}

.eyebrow {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--mint-400);
    margin-bottom: 1rem;
}

.section-title {
    font-size: clamp(2rem, 5vw, 3.4rem);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.02em;
}

.gradient-text {
    background: linear-gradient(100deg, var(--mint-400), var(--accent) 60%, var(--mint-300));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.lead {
    color: var(--text-soft);
    font-size: clamp(1rem, 2vw, 1.2rem);
    max-width: 56ch;
}

/* ---------- Botons ---------- */
.btn {
    --btn-bg: linear-gradient(100deg, var(--mint-500), var(--accent));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.95rem 1.8rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.98rem;
    color: var(--green-900);
    background: var(--btn-bg);
    border: none;
    cursor: pointer;
    transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), filter 0.3s var(--ease);
    box-shadow: 0 12px 30px -12px rgba(52, 211, 153, 0.7);
    -webkit-tap-highlight-color: transparent;
}

.btn:hover {
    transform: translateY(-3px);
    filter: brightness(1.05);
    box-shadow: 0 18px 40px -12px rgba(52, 211, 153, 0.8);
}

.btn--ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--card-border);
    box-shadow: none;
}

.btn--ghost:hover {
    background: var(--card);
    border-color: var(--mint-400);
    box-shadow: none;
}

.btn--lg {
    padding: 1.15rem 2.6rem;
    font-size: 1.05rem;
}

/* ---------- Header ---------- */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem clamp(1.2rem, 4vw, 3rem);
    transition: background 0.4s var(--ease), box-shadow 0.4s var(--ease), padding 0.4s var(--ease);
}

.header.is-scrolled {
    background: rgba(6, 20, 18, 0.72);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    box-shadow: 0 1px 0 rgba(127, 205, 187, 0.12);
    padding-block: 0.7rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    font-size: 1.1rem;
}

.brand img {
    height: 34px;
    width: auto;
}

.nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav a {
    padding: 0.5rem 0.95rem;
    border-radius: 999px;
    font-weight: 500;
    color: var(--text-soft);
    transition: color 0.25s, background 0.25s;
}

.nav a:hover,
.nav a.active {
    color: var(--cream);
}

.nav a.nav-cta {
    color: var(--green-900);
    background: linear-gradient(100deg, var(--mint-500), var(--accent));
    font-weight: 700;
}

.nav a.nav-cta:hover {
    color: var(--green-900);
    filter: brightness(1.06);
}

/* Accions de la capçalera (idioma + nav) */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Selector d'idioma */
.lang-switch {
    display: flex;
    gap: 2px;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 999px;
    padding: 3px;
}

.lang-switch button {
    border: none;
    background: transparent;
    color: var(--text-soft);
    font: inherit;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    padding: 0.34rem 0.6rem;
    border-radius: 999px;
    cursor: pointer;
    transition: color 0.25s, background 0.25s;
    -webkit-tap-highlight-color: transparent;
}

.lang-switch button:hover {
    color: var(--cream);
}

.lang-switch button.is-active {
    background: linear-gradient(100deg, var(--mint-500), var(--accent));
    color: var(--green-900);
}

/* Botó hamburguesa */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    cursor: pointer;
}

.nav-toggle span {
    width: 20px;
    height: 2px;
    background: var(--cream);
    border-radius: 2px;
    transition: transform 0.3s var(--ease), opacity 0.3s;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ---------- Hero ---------- */
.hero {
    position: relative;
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    align-items: center;
    padding-top: 6rem;
    overflow: hidden;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: clamp(2rem, 5vw, 4rem);
    align-items: center;
}

.hero h1 {
    font-size: clamp(2.6rem, 8vw, 5.4rem);
    font-weight: 900;
    line-height: 0.98;
    letter-spacing: -0.03em;
    margin: 0.6rem 0 1.4rem;
}

.hero p.lead {
    margin-bottom: 2rem;
}

.hero-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
}

/* Mockup del telèfon */
.hero-visual {
    position: relative;
    display: flex;
    justify-content: center;
}

.hero-visual .glow {
    position: absolute;
    inset: -10% 5%;
    background: radial-gradient(closest-side, rgba(52, 211, 153, 0.35), transparent 70%);
    filter: blur(20px);
    z-index: 0;
}

.hero-visual img {
    position: relative;
    z-index: 1;
    width: min(78%, 360px);
    filter: drop-shadow(0 30px 50px rgba(0, 0, 0, 0.55));
    animation: floaty 6s ease-in-out infinite;
}

/* Blobs flotants (decoratius, GPU-friendly) */
.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.5;
    z-index: 0;
    pointer-events: none;
}

.blob-1 {
    width: 320px;
    height: 320px;
    background: rgba(52, 211, 153, 0.4);
    top: 8%;
    left: -8%;
    animation: floaty 9s ease-in-out infinite;
}

.blob-2 {
    width: 260px;
    height: 260px;
    background: rgba(127, 205, 187, 0.35);
    bottom: 4%;
    right: -6%;
    animation: floaty 11s ease-in-out infinite reverse;
}

.emoji-float {
    position: absolute;
    font-size: clamp(1.7rem, 3vw, 2.6rem);
    z-index: 0;
    opacity: 0.85;
    pointer-events: none;
    user-select: none;
    animation: floaty 7s ease-in-out infinite;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.35));
}

@keyframes floaty {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-16px); }
}

/* ---------- Targetes / Grids ---------- */
.grid {
    display: grid;
    gap: 1.4rem;
}

.grid--3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 2rem;
    transition: transform 0.4s var(--ease), border-color 0.4s, background 0.4s;
    position: relative;
    overflow: hidden;
    height: 100%;
}

.card:hover {
    transform: translateY(-6px);
    border-color: rgba(110, 231, 183, 0.45);
    background: rgba(255, 255, 255, 0.06);
}

.card .icon {
    font-size: 2rem;
    margin-bottom: 0.9rem;
    display: block;
}

.card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
}

.card p {
    color: var(--text-soft);
    font-size: 0.98rem;
}

.card ul.bullets {
    margin-top: 1rem;
    display: grid;
    gap: 0.5rem;
}

.card ul.bullets li {
    position: relative;
    padding-left: 1.4rem;
    color: var(--text-soft);
    font-size: 0.92rem;
}

.card ul.bullets li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--mint-400);
    font-weight: 700;
}

/* ---------- Banda d'impacte / stats ---------- */
.band {
    background: linear-gradient(120deg, var(--green-700), var(--green-600));
    border-block: 1px solid var(--card-border);
    position: relative;
    overflow: hidden;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 2rem;
    text-align: center;
}

.stat .num {
    font-size: clamp(2.4rem, 6vw, 3.6rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.02em;
}

.stat .label {
    color: var(--text-soft);
    margin-top: 0.4rem;
    font-weight: 500;
}

/* ---------- CTA final ---------- */
.cta-final {
    text-align: center;
}

.cta-final h2 {
    font-size: clamp(1.9rem, 5vw, 3.2rem);
    font-weight: 800;
    line-height: 1.1;
    max-width: 18ch;
    margin: 0.6rem auto 2rem;
}

/* ---------- Pàgina interior (hero compacte) ---------- */
.page-hero {
    padding: clamp(8rem, 14vw, 11rem) 0 clamp(2.5rem, 6vw, 4rem);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.page-hero h1 {
    font-size: clamp(2.4rem, 7vw, 4.4rem);
    font-weight: 900;
    letter-spacing: -0.03em;
    line-height: 1.02;
}

.page-hero .lead {
    margin: 1.2rem auto 0;
    text-align: center;
}

/* ---------- Formulari de contacte ---------- */
.form-card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: clamp(1.6rem, 4vw, 2.6rem);
}

.field {
    margin-bottom: 1.2rem;
}

.field label {
    display: block;
    font-weight: 600;
    font-size: 0.92rem;
    margin-bottom: 0.45rem;
    color: var(--cream);
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--card-border);
    color: var(--text);
    font: inherit;
    font-size: 1rem;
    transition: border-color 0.25s, box-shadow 0.25s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--mint-400);
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18);
}

.field textarea {
    resize: vertical;
    min-height: 130px;
}

.field-check {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    font-size: 0.9rem;
    color: var(--text-soft);
}

.field-check input {
    width: auto;
    margin-top: 0.25rem;
    accent-color: var(--mint-500);
}

.field-check a {
    color: var(--mint-400);
    text-decoration: underline;
}

.flash {
    padding: 0.9rem 1.1rem;
    border-radius: 12px;
    margin-bottom: 1.2rem;
    font-weight: 500;
}

.flash--ok {
    background: rgba(52, 211, 153, 0.15);
    border: 1px solid rgba(52, 211, 153, 0.4);
    color: var(--mint-300);
}

.flash--err {
    background: rgba(248, 113, 113, 0.12);
    border: 1px solid rgba(248, 113, 113, 0.4);
    color: #fca5a5;
}

.contact-info {
    display: grid;
    gap: 1.2rem;
    align-content: start;
}

.contact-info .item {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.3rem 1.5rem;
}

.contact-info .item h4 {
    font-size: 1rem;
    margin-bottom: 0.3rem;
}

.contact-info .item p {
    color: var(--text-soft);
    font-size: 0.95rem;
}

/* ---------- Contingut legal ---------- */
.legal h2 {
    font-size: 1.5rem;
    margin: 2rem 0 0.8rem;
    color: var(--cream);
}

.legal p {
    color: var(--text-soft);
    margin-bottom: 0.8rem;
    max-width: 70ch;
}

.legal ul {
    list-style: disc;
    padding-left: 1.4rem;
    color: var(--text-soft);
    margin-bottom: 0.8rem;
}

.legal ul li {
    margin-bottom: 0.4rem;
}

/* ---------- Footer ---------- */
.footer {
    border-top: 1px solid var(--card-border);
    padding: 3rem 0 2.2rem;
    margin-top: 2rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: 2rem;
}

.footer .brand {
    margin-bottom: 0.8rem;
}

.footer p {
    color: var(--text-soft);
    font-size: 0.95rem;
    max-width: 38ch;
}

.footer h5 {
    font-size: 0.82rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--mint-400);
    margin-bottom: 0.9rem;
}

.footer ul li {
    margin-bottom: 0.5rem;
}

.footer ul a {
    color: var(--text-soft);
    transition: color 0.25s;
}

.footer ul a:hover {
    color: var(--cream);
}

.footer-bottom {
    margin-top: 2.4rem;
    padding-top: 1.4rem;
    border-top: 1px solid rgba(127, 205, 187, 0.1);
    text-align: center;
    color: var(--text-soft);
    font-size: 0.86rem;
}

/* ---------- Reveal en scroll ---------- */
.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
    will-change: opacity, transform;
}

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

/* ---------- Gate de contrasenya ---------- */
.gate {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.4rem;
    background: rgba(4, 16, 14, 0.92);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

.gate[hidden] {
    display: none;
}

.gate-card {
    width: min(100%, 400px);
    background: var(--green-800);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 2.2rem;
    box-shadow: var(--shadow);
    text-align: center;
}

.gate-card img {
    height: 48px;
    width: auto;
    margin: 0 auto 1.2rem;
}

.gate-card h1 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}

.gate-card p {
    color: var(--text-soft);
    font-size: 0.95rem;
    margin-bottom: 1.4rem;
}

.gate-card .field {
    text-align: left;
}

.gate-card .btn {
    width: 100%;
}

.gate-error {
    color: #fca5a5;
    font-size: 0.9rem;
    min-height: 1.2em;
    margin: 0.4rem 0 0.8rem;
}

html.gate-locked {
    overflow: hidden;
}

/* ---------- Pop-up d'instal·lació ---------- */
.install-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.4rem;
    background: rgba(4, 16, 14, 0.9);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

.install-overlay[hidden] {
    display: none;
}

.install-card {
    width: min(100%, 440px);
    max-height: 90vh;
    overflow: auto;
    position: relative;
    background: var(--green-800);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.install-close {
    position: absolute;
    top: 0.7rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-soft);
    font-size: 1.9rem;
    line-height: 1;
    cursor: pointer;
}

.install-close:hover {
    color: var(--cream);
}

.install-head {
    text-align: center;
    margin-bottom: 1.4rem;
}

.install-head img {
    height: 42px;
    width: auto;
    margin: 0 auto 0.8rem;
}

.install-head h2 {
    font-size: 1.3rem;
}

.install-head p {
    color: var(--text-soft);
    font-size: 0.92rem;
    margin-top: 0.3rem;
}

.install-q {
    font-weight: 600;
    margin-bottom: 0.8rem;
    text-align: center;
}

.install-options {
    display: grid;
    gap: 0.7rem;
    margin-bottom: 0.5rem;
}

.install-opt {
    padding: 0.9rem 1rem;
    border-radius: 14px;
    background: var(--card);
    border: 1px solid var(--card-border);
    color: var(--text);
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.25s, background 0.25s, transform 0.2s;
}

.install-opt:hover {
    border-color: var(--mint-400);
    transform: translateY(-2px);
}

.install-opt.is-active {
    border-color: var(--mint-400);
    background: rgba(52, 211, 153, 0.12);
}

.install-steps {
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 1rem 1rem 1rem 0.5rem;
}

.install-steps ol {
    margin: 0;
    padding-left: 1.7rem;
    display: grid;
    gap: 0.6rem;
}

.install-steps li {
    color: var(--text);
    font-size: 0.96rem;
    line-height: 1.5;
}

.install-steps b {
    color: var(--mint-300);
    font-weight: 700;
}

.install-note {
    color: var(--text-soft);
    font-size: 0.85rem;
    margin: 0.9rem 0 0;
    text-align: center;
}

.install-actions {
    display: flex;
    gap: 0.7rem;
    margin-top: 1.2rem;
}

.install-actions .btn {
    flex: 1;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 900px) {
    .hero-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero p.lead {
        margin-inline: auto;
    }

    .hero-buttons {
        justify-content: center;
    }

    .hero-visual {
        order: -1;
        margin-bottom: 1rem;
    }

    .hero-visual img {
        width: min(60%, 250px);
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 760px) {
    .nav-toggle {
        display: flex;
    }

    .nav {
        position: fixed;
        inset: 0 0 0 auto;
        width: min(80%, 320px);
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 0.4rem;
        padding: 6rem 1.6rem 2rem;
        background: rgba(6, 20, 18, 0.97);
        -webkit-backdrop-filter: blur(18px);
        backdrop-filter: blur(18px);
        border-left: 1px solid var(--card-border);
        transform: translateX(100%);
        transition: transform 0.4s var(--ease);
    }

    .nav.is-open {
        transform: translateX(0);
    }

    .nav a {
        padding: 0.85rem 1rem;
        font-size: 1.05rem;
    }

    .nav a.nav-cta {
        text-align: center;
        margin-top: 0.5rem;
    }

    .header-actions {
        gap: 0.6rem;
    }

    .lang-switch button {
        font-size: 0.7rem;
        padding: 0.3rem 0.45rem;
    }
}

@media (max-width: 420px) {
    .brand span,
    .brand {
        font-size: 0.95rem;
    }

    .lang-switch button {
        padding: 0.28rem 0.38rem;
    }
}

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

    .card {
        padding: 1.5rem;
    }
}

/* ---------- Accessibilitat: reduir moviment ---------- */
@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;
    }

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