/* /marc — moviment i interacció propis de la pàgina.
   Colors del sistema de disseny (var(--color-*)), així el mode fosc s'hi adapta sol.
   Amb prefers-reduced-motion tot queda quiet i sencer. */

/* ── Hero: el títol entra paraula a paraula ── */
.mc-word { display: inline-block; }

/* ── Foto: s'inclina cap al punter i hi passa una llum (marc.js posa --rx/--ry/--gx/--gy) ── */
.mc-tilt {
    transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
    transition: transform .5s cubic-bezier(.2, .8, .2, 1), box-shadow .5s ease;
}
.mc-tilt.is-tilting { transition-duration: .12s; box-shadow: 0 30px 60px -30px rgba(43, 45, 38, .45); }
.mc-glare {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at var(--gx, 50%) var(--gy, 30%), rgba(255, 255, 255, .35), transparent 55%);
    opacity: 0;
    transition: opacity .4s ease;
}
.mc-tilt.is-tilting .mc-glare { opacity: 1; }

/* ── Enllaços: la fletxa llisca ── */
.mc-arrow { display: inline-block; transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
.mc-link:hover .mc-arrow, .mc-link:focus-visible .mc-arrow { transform: translateX(5px); }
a.mc-link.flex { min-height: 44px; transition: background-color .2s ease; }
a.mc-link.flex:hover { background-color: color-mix(in srgb, var(--color-primary) 6%, transparent); }
.mc-link:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 3px; border-radius: 1rem; }

/* ── Recorregut d'«Abans d'Arrelam»: la línia es dibuixa en baixar (marc.js posa --p) ── */
.mc-tl { position: relative; list-style: none; margin: 0; padding: .25rem 0 0 2.5rem; }
.mc-tl::before,
.mc-tl::after {
    content: "";
    position: absolute;
    left: .7rem;
    top: .6rem;
    width: 2px;
    border-radius: 2px;
}
.mc-tl::before { bottom: 2.2rem; background: color-mix(in srgb, var(--color-primary) 14%, transparent); }
.mc-tl::after {
    height: calc((100% - 2.8rem) * var(--p, 1));
    background: linear-gradient(var(--color-accent), var(--color-primary));
}
.mc-node { position: relative; padding-bottom: 2.25rem; }
.mc-node:last-child { padding-bottom: 0; }
.mc-node::before {
    content: "";
    position: absolute;
    left: calc(-2.5rem + .7rem + 1px);
    top: .55rem;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    transform: translateX(-50%);
    background: var(--color-background-light);
    border: 2px solid color-mix(in srgb, var(--color-primary) 30%, transparent);
    transition: background-color .4s ease, border-color .4s ease, box-shadow .4s ease;
}
.mc-node.is-on::before {
    background: var(--color-accent);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--color-accent) 22%, transparent);
}
.mc-node--now.is-on::before { box-shadow: 0 0 0 8px color-mix(in srgb, var(--color-accent) 30%, transparent); }

/* ── Com treballo: la targeta segueix el punter amb una llum suau (marc.js posa --mx/--my) ── */
.mc-card { position: relative; overflow: hidden; isolation: isolate; transition: transform .35s cubic-bezier(.2, .8, .2, 1), border-color .35s ease, box-shadow .35s ease; }
.mc-card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--color-accent) 22%, transparent), transparent 70%);
    opacity: 0;
    transition: opacity .35s ease;
}
.mc-card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--color-primary) 25%, transparent); box-shadow: 0 24px 50px -30px rgba(43, 45, 38, .35); }
.mc-card:hover::before { opacity: 1; }
.mc-icon { transition: transform .45s cubic-bezier(.34, 1.56, .64, 1); }
.mc-card:hover .mc-icon { transform: rotate(-8deg) scale(1.08); }

/* ── Infraestructura: les icones es dibuixen ── */
.mc-draw * { stroke-dasharray: 100; stroke-dashoffset: 0; }

@media (prefers-reduced-motion: no-preference) {
    .mc-word {
        animation: mc-rise .9s cubic-bezier(.2, .8, .2, 1) both;
        animation-delay: calc(.12s + var(--w, 0) * .1s);
    }
    @keyframes mc-rise { from { opacity: 0; transform: translateY(.5em) rotate(2deg); filter: blur(6px); } }

    .mc-float { animation: mc-float 6s ease-in-out infinite; }
    @keyframes mc-float { 50% { transform: translateY(-4px); } }

    /* Fins que la línia hi arriba, la fita espera apagada */
    .mc-js .mc-node > * { transition: opacity .6s ease, transform .6s cubic-bezier(.2, .8, .2, 1); }
    .mc-js .mc-node:not(.is-on) > * { opacity: .3; transform: translateX(8px); }

    .reveal .mc-card { opacity: 0; transform: translateY(24px); }
    .reveal.visible .mc-card {
        opacity: 1;
        transform: none;
        transition: opacity .7s ease calc(var(--i, 0) * .12s), transform .7s cubic-bezier(.2, .8, .2, 1) calc(var(--i, 0) * .12s), border-color .35s ease, box-shadow .35s ease;
    }
    .reveal.visible .mc-card:hover { transform: translateY(-4px); transition-delay: 0s; }

    .reveal .mc-draw * { stroke-dashoffset: 100; }
    .reveal.visible .mc-draw * { transition: stroke-dashoffset 1.4s cubic-bezier(.65, 0, .35, 1) calc(.2s + var(--i, 0) * .15s); stroke-dashoffset: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .mc-tilt, .mc-card, .mc-icon, .mc-arrow { transition: none; }
    .mc-card:hover, .mc-card:hover .mc-icon { transform: none; }
}
