/* ===========================================================================
   INCAFE Structural Systems · portada
   S'aplica damunt d'estructures.css (variables, capçalera, botons, peu).
   L'escenari 3D (canvas) és fix darrere de la pàgina; els capítols hi passen per sobre.
   =========================================================================== */

.lp { --hero: 1; background: #101215; overflow-x: hidden; }
.lp::before {
    background:
        radial-gradient(60% 50% at 70% 38%, rgba(242, 166, 146, .07), transparent 70%),
        radial-gradient(90% 70% at 50% 120%, rgba(0, 0, 0, .65), transparent 70%),
        linear-gradient(180deg, #1b2028 0%, #15191f 45%, #0e1013 100%);
}

/* ------------------------------------------------------------------ escenari */
.stage { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 1.4s ease; }
.has-3d .stage canvas { opacity: 1; }
.stage__poster {
    position: absolute; inset: 0; display: none;
    background: linear-gradient(90deg, rgba(14, 16, 19, .9), rgba(14, 16, 19, .3) 60%), url("../../img/naus/opcions/portada.webp?v=20261206") center / cover no-repeat;
}
.no-3d .stage__poster { display: block; }
.stage__shade {
    position: absolute; inset: 0;
    background:
        linear-gradient(90deg, rgba(12, 14, 17, calc(.78 * var(--hero))) 0%, rgba(12, 14, 17, calc(.38 * var(--hero))) 34%, transparent 58%),
        radial-gradient(120% 90% at 60% 50%, transparent 55%, rgba(8, 9, 11, .55) 100%),
        linear-gradient(180deg, rgba(10, 12, 14, .55) 0%, transparent 14%, transparent 80%, rgba(10, 12, 14, .5) 100%);
}
.stage__labels { position: absolute; inset: 0; }

/* etiquetes ancorades a punts del model (posició: inici3d.js) */
.tag {
    position: absolute; left: 0; top: 0; opacity: 0; will-change: transform, opacity;
    transition: opacity .35s ease; white-space: nowrap; pointer-events: none;
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
.tag--axis {
    width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%;
    display: grid; place-items: center; font-size: .7rem; font-weight: 600;
    color: var(--peach); border: 1.5px solid rgba(242, 166, 146, .85); background: rgba(16, 18, 22, .72);
}
.tag--dim {
    translate: -50% -50%; padding: 2px 8px; border-radius: 6px; font-size: .76rem; font-weight: 600;
    color: #ffe1d6; background: rgba(16, 18, 22, .78); border: 1px solid rgba(242, 166, 146, .35);
}
.tag--util, .tag--part {
    translate: 16px -50%; display: flex; align-items: center; gap: 8px;
    padding: 6px 10px; border-radius: 10px; font-size: .74rem; color: var(--ink);
    background: rgba(16, 18, 22, .82); border: 1px solid var(--line2); backdrop-filter: blur(6px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
}
.tag--util::before, .tag--part::before {
    content: ""; position: absolute; left: -21px; top: 50%; width: 10px; height: 10px; margin-top: -5px;
    border-radius: 50%; background: var(--peach); box-shadow: 0 0 0 4px rgba(242, 166, 146, .22);
}
.tag--util::after, .tag--part::after {
    content: ""; position: absolute; left: -11px; top: 50%; width: 11px; height: 1px; background: rgba(242, 166, 146, .7);
}
.tag--util b, .tag--part b { font-weight: 600; color: #fff; }
.tag--l { translate: calc(-100% - 16px) -50%; }
.tag--l::before { left: auto; right: -21px; }
.tag--l::after { left: auto; right: -11px; }
.tag--util i {
    font-style: normal; font-weight: 600; padding: 1px 7px; border-radius: 999px;
    background: var(--c); color: #15110f;
}

/* ------------------------------------------------------------------ indicador de càrrega */
.loader {
    position: fixed; left: clamp(14px, 3vw, 40px); bottom: 22px; z-index: 40;
    display: flex; align-items: center; gap: 12px; padding: 8px 14px 8px 12px;
    border-radius: 999px; background: rgba(16, 18, 22, .8); border: 1px solid var(--line2);
    color: var(--muted); font-size: .8rem; transition: opacity .6s ease, transform .6s ease;
}
.loader__bar { position: relative; width: 46px; height: 2px; background: rgba(255, 255, 255, .12); overflow: hidden; border-radius: 2px; }
.loader__bar::after {
    content: ""; position: absolute; inset: 0; width: 40%; background: var(--peach);
    animation: lpLoad 1.1s ease-in-out infinite;
}
.loader.is-done { opacity: 0; transform: translateY(8px); }
@keyframes lpLoad { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

/* ------------------------------------------------------------------ capçalera */
.lp-header {
    position: fixed; left: 0; right: 0; top: 0;
    background: linear-gradient(180deg, rgba(12, 14, 17, .7), rgba(12, 14, 17, 0));
    border-bottom-color: transparent; backdrop-filter: none;
    transition: background .4s ease, border-color .4s ease, backdrop-filter .4s;
}
.lp-header.is-solid { background: rgba(18, 21, 26, .86); border-bottom-color: var(--line); backdrop-filter: blur(10px); }
.btn--sm { min-height: 36px; padding: 6px 14px; font-size: .86rem; border-radius: 10px; }
.btn--ghost { background: rgba(255, 255, 255, .04); border-color: rgba(255, 255, 255, .22); }
.btn--ghost:hover { background: rgba(255, 255, 255, .1); }

main { position: relative; z-index: 1; }
.lp .site-footer { position: relative; z-index: 1; margin-top: 0; background: rgba(12, 14, 17, .94); }

/* ------------------------------------------------------------------ obertura */
.lp-hero {
    position: relative; min-height: 100vh; min-height: 100svh;
    display: flex; align-items: center;
    padding: calc(var(--head-h) + 30px) clamp(18px, 5vw, 80px) 90px;
}
.lp-hero__in { width: min(640px, 100%); }
.lp-hero__title {
    font-family: Commissioner, Inter, sans-serif; font-weight: 900; text-transform: uppercase;
    font-size: clamp(2.4rem, 1.1rem + 4.4vw, 5.1rem); line-height: .98; letter-spacing: -.015em;
    margin: 4px 0 0;
}
.lp-hero__title .ln { display: block; overflow: hidden; padding-bottom: .06em; }
.lp-hero__title .ln > span { display: inline-block; }
.lp-accent {
    background: linear-gradient(92deg, #f7c3b3 0%, var(--peach) 40%, #e27a5f 100%);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lp-hero__lead { margin: 22px 0 28px; color: #c9d0d8; font-size: clamp(1rem, .95rem + .25vw, 1.15rem); max-width: 52ch; }
.lp-hero__actions { display: flex; flex-wrap: wrap; gap: 12px 14px; }
.lp-stats { list-style: none; display: flex; flex-wrap: wrap; gap: 10px 30px; margin: 34px 0 0; padding: 0; }
.lp-stats li { display: grid; gap: 0; }
.lp-stats b {
    font-family: Commissioner, Inter, sans-serif; font-weight: 900; font-size: 1.7rem; line-height: 1.1;
    color: #fff; font-variant-numeric: tabular-nums;
}
.lp-stats span { color: var(--muted2); font-size: .8rem; letter-spacing: .02em; }

/* entrades de l'obertura */
.lp-in { opacity: 0; animation: lpUp .9s cubic-bezier(.2, .7, .2, 1) var(--d, 0s) forwards; }
.lp-hero__title .lp-in { transform: translateY(105%); animation-name: lpLine; animation-duration: 1.05s; }
@keyframes lpUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes lpLine { from { opacity: 1; transform: translateY(105%); } to { opacity: 1; transform: none; } }

/* «terminal» de càlcul */
.calc-stream {
    position: absolute; right: clamp(18px, 4vw, 60px); bottom: 64px; z-index: 2; margin: 0;
    display: grid; gap: 3px; min-width: 0; max-width: min(470px, 44vw);
    font: 500 .72rem/1.5 "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    color: rgba(238, 242, 246, .62); white-space: pre-wrap;
    opacity: var(--hero); transition: opacity .3s;
}
.calc-stream span { display: block; animation: lpType .45s steps(18) both; overflow: hidden; }
.calc-stream span::before { content: "› "; color: var(--peach); }
.calc-stream span.is-live::after { content: "▍"; color: var(--peach); animation: lpBlink .8s steps(1) infinite; }
.calc-stream span.is-ok { color: #ffd9cc; font-weight: 600; }
.calc-stream span.is-ok::before { content: ""; }
@keyframes lpType { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes lpBlink { 50% { opacity: 0; } }

.scroll-cue {
    position: absolute; left: 50%; bottom: 22px; width: 26px; height: 42px; margin-left: -13px;
    border: 2px solid rgba(255, 255, 255, .45); border-radius: 14px; opacity: calc(var(--hero) * .9);
    animation: lpUp .9s ease 2.2s both;
}
.scroll-cue span {
    position: absolute; left: 50%; top: 8px; width: 4px; height: 8px; margin-left: -2px;
    border-radius: 2px; background: var(--peach); animation: lpCue 1.8s ease-in-out infinite;
}
@keyframes lpCue { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(14px); } }

/* ------------------------------------------------------------------ capítols */
.chapter {
    position: relative; min-height: 130vh; min-height: 130svh;
    display: flex; align-items: center;
    padding: 12vh clamp(18px, 5vw, 80px);
}
.chapter--right { justify-content: flex-end; }
.chapter__card {
    position: relative;
    width: min(470px, 100%);
    padding: clamp(22px, 2.4vw, 32px);
    background: rgba(17, 20, 25, .74);
    border: 1px solid var(--line2); border-radius: 22px;
    backdrop-filter: blur(14px) saturate(1.15); -webkit-backdrop-filter: blur(14px) saturate(1.15);
    box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
}
.chapter__card h2 {
    font-family: Commissioner, Inter, sans-serif; font-weight: 900; text-transform: uppercase;
    font-size: clamp(1.55rem, 1rem + 1.7vw, 2.35rem); line-height: 1.02; letter-spacing: -.01em;
    margin: 0 0 14px; text-wrap: balance;
}
.chapter__card > p { color: #c3cad3; margin: 0 0 16px; }
.chapter__kicker {
    display: flex; align-items: center; gap: 10px; margin: 0 0 14px !important;
    font: 600 .74rem/1 "JetBrains Mono", ui-monospace, monospace; letter-spacing: .14em; text-transform: uppercase;
    color: var(--peach) !important;
}
.chapter__kicker span:first-child {
    display: inline-grid; place-items: center; min-width: 34px; height: 22px; padding: 0 6px;
    border: 1px solid rgba(242, 166, 146, .5); border-radius: 6px;
}
.chapter__note { font-size: .82rem; color: var(--muted2) !important; margin: 14px 0 0 !important; }
.chapter__note b { color: var(--muted); font-weight: 600; }

.reveal { opacity: 0; transform: translateY(34px); transition: opacity .9s ease, transform .9s cubic-bezier(.2, .7, .2, 1); }
.reveal.is-in { opacity: 1; transform: none; }

/* aprofitaments */
.util-list { list-style: none; margin: 4px 0 12px; padding: 0; display: grid; gap: 7px; }
.util-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto 74px 44px; column-gap: 10px; align-items: center; }
.u-name { font-weight: 600; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.u-prof { color: var(--muted2); font-size: .72rem; font-family: "JetBrains Mono", ui-monospace, monospace; white-space: nowrap; }
.u-bar { grid-column: 3; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.u-bar i { display: block; height: 100%; width: calc(var(--u) * 100%); background: var(--c); border-radius: 3px; }
.util-list b { grid-column: 4; text-align: right; font-variant-numeric: tabular-nums; font-size: .88rem; }
.heat-legend { display: flex; align-items: center; gap: 10px; font: 500 .7rem "JetBrains Mono", ui-monospace, monospace; color: var(--muted2); }
.heat-legend i { flex: 1; height: 6px; border-radius: 3px; background: linear-gradient(90deg, #2c5d9c, #36a3b3 35%, #8fcf8a 55%, #f3d38b 72%, #f2a070 86%, #d8452f); }

/* fitxa d'unió */
.spec { display: grid; gap: 0; margin: 6px 0 0; border-top: 1px solid var(--line); }
.spec div { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.spec dt { color: var(--muted); font-size: .86rem; }
.spec dd { margin: 0; font: 600 .82rem/1.4 "JetBrains Mono", ui-monospace, monospace; text-align: right; }

/* xifres del kit */
.kit-facts { list-style: none; margin: 6px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.kit-facts li { display: grid; gap: 2px; padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); }
.kit-facts b { font-family: Commissioner, Inter, sans-serif; font-weight: 900; font-size: 1.35rem; color: #fff; }
.kit-facts span { font-size: .76rem; color: var(--muted2); line-height: 1.3; }

/* triador */
.picker { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 10px; }
.picker__label { width: 74px; font-size: .8rem; color: var(--muted); font-weight: 600; }
.picker button {
    min-width: 58px; min-height: 42px; padding: 6px 12px; border-radius: 12px; cursor: pointer;
    background: rgba(255, 255, 255, .05); border: 1px solid var(--line2); color: var(--ink);
    font: 700 .95rem/1 Inter, sans-serif; transition: background .15s, border-color .15s, color .15s;
}
.picker button:hover { border-color: rgba(242, 166, 146, .6); }
.picker button[aria-pressed="true"] { background: var(--peach); border-color: var(--peach); color: #2a1a15; }
.cfg-out { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 16px 0 6px; }
.cfg-out div { display: grid; gap: 1px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); }
.cfg-out div > span { font-size: .74rem; color: var(--muted2); }
.cfg-out b { font-variant-numeric: tabular-nums; font-size: .98rem; }
.chapter--config .btn { margin-top: 16px; width: 100%; }

/* ------------------------------------------------------------------ com funciona */
.lp-steps { position: relative; padding: 14vh clamp(18px, 5vw, 80px) 12vh; }
.lp-steps__in {
    width: min(1180px, 100%); margin: 0 auto; padding: clamp(24px, 3.5vw, 48px);
    background: rgba(17, 20, 25, .84); border: 1px solid var(--line2); border-radius: 26px;
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.lp-steps h2 {
    font-family: Commissioner, Inter, sans-serif; font-weight: 900; text-transform: uppercase;
    font-size: clamp(1.5rem, 1rem + 1.5vw, 2.3rem); margin: 0 0 26px; text-wrap: balance;
}
.lp-steps ol { list-style: none; counter-reset: st; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.lp-steps li {
    counter-increment: st; position: relative; display: grid; gap: 6px; align-content: start;
    padding: 46px 18px 18px; border-radius: 16px; background: rgba(255, 255, 255, .035); border: 1px solid var(--line);
}
.lp-steps li::before {
    content: "0" counter(st); position: absolute; left: 18px; top: 14px;
    font: 600 .78rem "JetBrains Mono", ui-monospace, monospace; color: var(--peach); letter-spacing: .1em;
}
.lp-steps li b { font-size: 1.02rem; }
.lp-steps li span { color: var(--muted); font-size: .9rem; }
.lp-final { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 0; }
.lp-steps__src { margin: 22px 0 0; font-size: .78rem; color: var(--muted2); }

/* ------------------------------------------------------------------ mòbil */
@media (max-width: 1000px) {
    .calc-stream { display: none; }
}
@media (max-width: 860px) {
    .lp-hide-s { display: none; }
    .lp-hero { align-items: flex-end; padding-bottom: 76px; }
    .lp-hero__title { font-size: clamp(2.1rem, 1rem + 6vw, 3.3rem); }
    .lp-stats b { font-size: 1.35rem; }
    .stage__shade {
        background:
            linear-gradient(0deg, rgba(12, 14, 17, calc(.92 * var(--hero))) 0%, rgba(12, 14, 17, calc(.6 * var(--hero))) 42%, transparent 66%),
            linear-gradient(180deg, rgba(10, 12, 14, .5) 0%, transparent 16%);
    }
    .chapter, .chapter--right { justify-content: center; align-items: flex-end; min-height: 120svh; padding-bottom: 6vh; }
    .chapter__card { position: relative; top: auto; width: 100%; background: rgba(17, 20, 25, .86); }
    .lp-steps ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tag--util, .tag--part { font-size: .66rem; padding: 4px 8px; }
}
@media (max-width: 520px) {
    .site-header .brand__sub { display: none; }
    .lp-hero { padding-bottom: 64px; }
    .lp-hero__lead { font-size: .95rem; margin: 14px 0 18px; }
    .lp-hero__actions .btn { width: 100%; }
    .lp-hero__actions .btn--ghost { display: none; }
    .lp-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 20px; }
    .lp-stats b { font-size: 1.15rem; }
    .lp-stats span { font-size: .68rem; line-height: 1.25; }
    .u-prof, .tag--util .p { display: none; }
    .util-list li { grid-template-columns: minmax(0, 1fr) 64px 40px; }
    .u-bar { grid-column: 2; }
    .util-list b { grid-column: 3; }
    .lp-steps ol { grid-template-columns: minmax(0, 1fr); }
    .kit-facts b { font-size: 1.1rem; }
    .picker__label { width: 100%; }
}

/* ------------------------------------------------------------------ preferències */
@media (prefers-reduced-motion: reduce) {
    .lp-in, .lp-hero__title .lp-in { animation: none; opacity: 1; transform: none; }
    .reveal { opacity: 1; transform: none; transition: none; }
    .calc-stream span, .scroll-cue span { animation: none; }
    html { scroll-behavior: auto; }
}
@media print {
    .stage, .loader, .scroll-cue, .calc-stream { display: none !important; }
    .reveal, .lp-in { opacity: 1 !important; transform: none !important; }
}
