/* Bticino — A prueba de todo
   Headings / bold highlights: Montserrat. Running text: Roboto. */

:root {
  --orange: #fe6b00;
  --black: #000;
  --ink: #0a0a0b;
  --white: #fff;
  --muted: rgba(255, 255, 255, .72);
  --rule: 2px solid var(--orange);
  --head: "Montserrat", system-ui, sans-serif;
  --body: "Roboto", system-ui, sans-serif;
  --ease: cubic-bezier(.2, .7, .1, 1);
  --header-h: 98px;
  color-scheme: dark;
}
@media (max-width: 767px) { :root { --header-h: 144px; } }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--black);
  color: var(--white);
  font: 400 16px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, svg { display: block; }
b, strong { font-family: var(--head); font-weight: 700; }
a { color: inherit; }
p { margin: 0; }
h1, h2 { margin: 0; font-weight: inherit; }

/* ── Shared pieces ─────────────────────────────── */

.badge { color: var(--orange); overflow: visible; }

.rule-tag {
  display: inline-block;
  font: 700 1em/1 var(--head);
  letter-spacing: -.005em;
  padding: .72em 0 .74em;
  border-top: var(--rule);
  border-bottom: var(--rule);
}

.legal { font: 300 .8rem/1.4 var(--body); color: var(--white); }
.legal b { font-weight: 700; }

/* The hanging Legrand logo sits over the hero's empty top-left corner
   (smoke only), so the key visual starts right under the navigation. */
main { margin-top: 0; }

section[id], header[id] { scroll-margin-top: var(--header-h); }

/* ── HERO ─────────────────────────────────────── */

.hero {
  position: relative;
  container-type: inline-size;
  aspect-ratio: 950 / 535;
  overflow: hidden;
  background: #05070b;
}
.hero-media { position: absolute; inset: 0; will-change: transform; }
.hero-bg { width: 100%; height: 100%; object-fit: cover; }
/* Line-up cropped from the key visual, dropped back at its original spot */
.hero-products {
  position: absolute;
  left: 63.67%; top: 65.12%;
  width: 27.64%; height: auto;
  -webkit-mask: linear-gradient(90deg, transparent 0, #000 4%, #000 96%, transparent 100%),
                linear-gradient(180deg, transparent 0, #000 6%, #000 90%, transparent 100%);
  -webkit-mask-composite: source-in;
          mask: linear-gradient(90deg, transparent 0, #000 4%, #000 96%, transparent 100%) intersect,
                linear-gradient(180deg, transparent 0, #000 6%, #000 90%, transparent 100%);
}
.hero-badge { position: absolute; right: 4.2cqi; top: 7%; width: 8.6cqi; height: 8.6cqi; }

.hero-copy { position: absolute; left: 64.6cqi; top: 25.5%; width: 30cqi; }
.hero-title { font-family: var(--head); line-height: .9; }
.hero-title span, .closing-title span { display: block; }
.line-light { font-weight: 400; font-size: 5.25cqi; letter-spacing: .02em; }
.line-heavy { font-weight: 800; font-size: 5.6cqi; color: var(--orange); letter-spacing: -.01em; margin-top: .08em; }
.hero-pillars { font: 700 1.62cqi/1.2 var(--head); margin-top: 1.3cqi; }
.hero-claim { font: 400 1.45cqi/1.28 var(--body); margin-top: .7cqi; }
.hero-legal { position: absolute; left: 1.3cqi; right: 16cqi; bottom: 2.3cqi; font-size: max(11px, .95cqi); }

.scroll-cue {
  position: absolute; left: 50%; bottom: 5.2cqi; translate: -50% 0;
  width: 26px; height: 42px; border: 2px solid rgba(255,255,255,.8); border-radius: 14px;
}
.scroll-cue span {
  position: absolute; left: 50%; top: 8px; width: 4px; height: 8px; margin-left: -2px;
  background: var(--orange); border-radius: 2px;
  animation: cue 1.8s var(--ease) infinite;
}
@keyframes cue { 0% { transform: translateY(0); opacity: 0 } 25% { opacity: 1 } 80% { transform: translateY(14px); opacity: 0 } 100% { opacity: 0 } }

/* Hero entrance */
.js .hero-title .line-light,
.js .hero-title .line-heavy,
.js .hero-pillars,
.js .hero-claim { animation: rise 1.1s var(--ease) both; }
.js .hero-title .line-heavy { animation-delay: .12s; }
.js .hero-pillars { animation-delay: .3s; }
.js .hero-claim { animation-delay: .42s; }
.js .hero-badge { animation: spin-in 1.4s var(--ease) .2s both; }
@keyframes rise { from { transform: translateY(40%); opacity: 0; filter: blur(6px); } }
@keyframes spin-in { from { transform: rotate(-120deg) scale(.6); opacity: 0; } }

/* ── INTRO · 12 / 12 ──────────────────────────── */

.intro {
  position: relative;
  padding: clamp(80px, 10vw, 160px) 20px clamp(80px, 9vw, 140px);
  background:
    radial-gradient(60% 50% at 20% 30%, rgba(254,107,0,.14), transparent 70%),
    radial-gradient(50% 50% at 90% 90%, rgba(40,90,190,.12), transparent 70%),
    var(--ink);
}
.intro-inner {
  max-width: 1180px; margin: 0 auto;
  display: grid; grid-template-columns: minmax(220px, 380px) 1fr; gap: clamp(32px, 6vw, 96px); align-items: center;
}
.score { position: relative; aspect-ratio: 1; }
.score-ring { width: 100%; height: 100%; }
.score-ring line { stroke: rgba(255,255,255,.14); stroke-width: 7; stroke-linecap: round; transition: stroke .5s var(--ease); }
.score-ring line.on { stroke: var(--orange); filter: drop-shadow(0 0 6px rgba(254,107,0,.7)); }
.score-num {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font: 800 clamp(64px, 7.6vw, 116px)/1 var(--head); letter-spacing: -.04em; font-variant-numeric: tabular-nums;
}
.score-num .count { color: var(--orange); }
.score-num .of { font-size: .34em; font-weight: 500; letter-spacing: 0; margin: .9em 0 0 .08em; color: var(--muted); }

.eyebrow { font: 700 .8rem/1 var(--head); letter-spacing: .24em; text-transform: uppercase; color: var(--orange); margin-bottom: 22px; }
.intro-title { font: 500 clamp(28px, 3.6vw, 50px)/1.12 var(--head); letter-spacing: -.02em; text-wrap: balance; }
.intro-title em { font-style: normal; font-weight: 800; color: var(--orange); }
.intro-legal { margin-top: 26px; font: 300 1rem/1.5 var(--body); color: var(--muted); max-width: 520px; }

.pillars {
  max-width: 1180px; margin: clamp(64px, 8vw, 120px) auto 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(16px, 2.4vw, 32px);
}
.pillar { border-top: var(--rule); padding-top: 26px; }
.pillar-name { font: 800 clamp(34px, 3.6vw, 52px)/1 var(--head); letter-spacing: -.02em; }
.pillar-tag { font: 700 .95rem/1.3 var(--head); color: var(--orange); margin-top: 10px; }
.pillar ol { list-style: none; margin: 24px 0 0; padding: 0; }
.pillar li + li { border-top: 1px solid rgba(255,255,255,.12); }
.pillar a {
  display: flex; align-items: center; gap: 14px; padding: 14px 0;
  font: 400 1.05rem/1.2 var(--body); text-decoration: none;
  transition: color .25s, padding .35s var(--ease);
}
.pillar a span { font: 700 .78rem/1 var(--head); color: var(--orange); letter-spacing: .08em; width: 22px; font-variant-numeric: tabular-nums; }
.pillar a::after {
  content: ""; margin-left: auto; width: 18px; height: 18px; flex: none;
  background: var(--orange);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 12.5l5 5L20 6.5' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 12.5l5 5L20 6.5' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.pillar a:hover, .pillar a:focus-visible { color: var(--orange); padding-left: 8px; }

/* ── CHAPTERS ─────────────────────────────────── */

.chapter {
  text-align: center;
  padding: clamp(90px, 12vw, 180px) 20px clamp(70px, 9vw, 130px);
  background: var(--black);
}
.chapter-num { font: 700 .85rem/1 var(--head); letter-spacing: .3em; color: var(--orange); }
.chapter-num i { font-style: normal; color: rgba(255,255,255,.45); }
.chapter-title {
  font: 800 clamp(64px, 13vw, 210px)/.9 var(--head); letter-spacing: -.045em;
  margin: 18px 0 clamp(22px, 3vw, 40px);
}
.chapter .rule-tag { font-size: clamp(18px, 2vw, 28px); }

/* ── TEST SECTIONS · web replicas of the key visuals ─ */

.test {
  position: relative;
  container-type: inline-size;
  aspect-ratio: 950 / 535;
  overflow: hidden;
  background: #050505;
}
.test-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.tab { position: absolute; left: 0; top: 37.1%; width: 10.9cqi; height: auto; }
.badge:not(.hero-badge):not(.closing-badge) { position: absolute; right: 4.3cqi; top: 7.4%; width: 8.4cqi; height: 8.4cqi; }

.copy { position: absolute; top: 53%; translate: 0 -50%; width: 38cqi; }
.side-right .copy { left: 56.4cqi; }
.side-left  .copy { left: 14.4cqi; }

.test-meta {
  display: flex; align-items: center; gap: .7em;
  font: 700 max(10px, .78cqi)/1 var(--head); letter-spacing: .22em; text-transform: uppercase;
  color: var(--orange); margin-bottom: 1.4cqi;
}
.test-meta span { color: var(--white); }
.test-meta::before {
  content: ""; width: 1.25em; height: 1.25em; border-radius: 50%; background: var(--orange);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='12'/%3E%3C/svg%3E") center/contain no-repeat;
  box-shadow: 0 0 12px var(--orange);
  order: 2;
}

.headline { font-family: var(--head); line-height: .86; }
.headline .lead, .headline .word { display: block; }
.headline .lead { font-weight: 400; font-size: 4.25cqi; letter-spacing: .02em; line-height: 1; }
.headline .word { font-weight: 800; font-size: 7.05cqi; color: var(--orange); letter-spacing: -.012em; margin-top: .06em; white-space: nowrap; }

.headline .word.long { font-size: 6.55cqi; }

.claim { font: 700 max(15px, 1.36cqi)/1.2 var(--head); margin-top: 1.9cqi; max-width: 32cqi; }
.spec  { font: 400 max(13px, 1.04cqi)/1.5 var(--body); margin-top: 1.5cqi; max-width: 28cqi; }
.test .rule-tag { font-size: max(17px, 1.9cqi); margin-top: 1.6cqi; min-width: 27.5cqi; }
.side-left .spec { max-width: 29cqi; }

/* Scroll reveal: text only. The photography itself is never faded or tinted. */
.js .test .copy > *,
.js .reveal { opacity: 0; transform: translateY(28px); transition: opacity .9s var(--ease), transform 1.1s var(--ease); }
.js .test .headline .word { clip-path: inset(0 100% 0 0); transition: clip-path 1.1s var(--ease) .15s; }
.js .test .rule-tag { transform: none; border-color: transparent; }
.js .test .rule-tag::before, .js .test .rule-tag::after { content: none; }

.js .test.in .copy > * { opacity: 1; transform: none; }
.js .test.in .copy > :nth-child(2) { transition-delay: .08s; }
.js .test.in .copy > :nth-child(3) { transition-delay: .32s; }
.js .test.in .copy > :nth-child(4) { transition-delay: .42s; }
.js .test.in .copy > :nth-child(5) { transition-delay: .55s; }
.js .test.in .headline .word { clip-path: inset(-10% -60% -20% -2%); }
.js .test .rule-tag { transition: opacity .6s var(--ease) .55s, border-color .8s var(--ease) .7s; }
.js .test.in .rule-tag { border-color: var(--orange); }

/* Image settles into place as it arrives (scale only, full brightness) */
.js .test .test-bg { transform: scale(1.07); transition: transform 2.2s var(--ease); }
.js .test.in .test-bg { transform: none; }
.js .test .tab { transform: translateX(-102%); transition: transform .9s var(--ease) .2s; }
.js .test.in .tab { transform: none; }
.js .test .badge { transform: rotate(-90deg) scale(.7); opacity: 0; transition: transform 1.2s var(--ease) .35s, opacity .6s .35s; }
.js .test.in .badge { transform: none; opacity: 1; }

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

/* ── CLOSING ──────────────────────────────────── */

.closing {
  position: relative;
  padding: clamp(100px, 12vw, 180px) 20px clamp(60px, 7vw, 100px);
  text-align: center;
  background:
    radial-gradient(45% 55% at 22% 40%, rgba(254,107,0,.22), transparent 70%),
    radial-gradient(45% 55% at 80% 35%, rgba(50,120,230,.2), transparent 70%),
    #030407;
  overflow: hidden;
}
.closing-inner { position: relative; max-width: 900px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; }
.closing-badge { width: clamp(96px, 10vw, 140px); height: clamp(96px, 10vw, 140px); margin-bottom: 36px; }
.closing-title { font-family: var(--head); line-height: .9; }
.closing-title .line-light { font-size: clamp(52px, 8.4vw, 124px); }
.closing-title .line-heavy { font-size: clamp(56px, 9vw, 132px); }
.closing-pillars { font: 700 clamp(20px, 2.4vw, 32px)/1.2 var(--head); margin-top: 26px; }
.closing-products { width: min(680px, 100%); height: auto; margin-top: 40px;
  -webkit-mask: linear-gradient(90deg, transparent 0, #000 14%, #000 86%, transparent 100%),
                linear-gradient(180deg, transparent 0, #000 14%, #000 62%, transparent 100%);
  -webkit-mask-composite: source-in;
          mask: linear-gradient(90deg, transparent 0, #000 14%, #000 86%, transparent 100%) intersect,
                linear-gradient(180deg, transparent 0, #000 14%, #000 62%, transparent 100%); }
.closing-claim { font: 300 clamp(17px, 1.6vw, 22px)/1.4 var(--body); margin-top: 18px; }
.closing-claim b { font-weight: 800; }
.closing-legal { margin-top: 60px; font-size: .85rem; color: var(--muted); }
.closing-logo { width: 72px; height: auto; margin-top: 36px; }

/* ── TRACKER (progress through the 12 tests) ──── */

.tracker {
  position: fixed; left: 50%; bottom: 18px; z-index: 40;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 18px;
  background: rgba(8, 8, 10, .72);
  -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid rgba(255,255,255,.1); border-radius: 999px;
  translate: -50% 140%; opacity: 0; pointer-events: none;
  transition: translate .6s var(--ease), opacity .4s;
}
.tracker.show { translate: -50% 0; opacity: 1; pointer-events: auto; }
.tracker-label { display: flex; align-items: baseline; gap: 2px; font: 500 .8rem/1 var(--head); white-space: nowrap; min-width: 200px; order: 2; }
.tracker-n { color: var(--orange); font-weight: 800; font-size: 1rem; font-variant-numeric: tabular-nums; }
.tracker-label > span:not(.tracker-name) { color: rgba(255,255,255,.5); }
.tracker-name { margin-left: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.tracker-bars { display: flex; gap: 5px; list-style: none; margin: 0; padding: 0; }
.tracker-bars a { display: block; width: 22px; height: 18px; position: relative; }
.tracker-bars a::before {
  content: ""; position: absolute; left: 0; right: 0; top: 7px; height: 4px; border-radius: 2px;
  background: rgba(255,255,255,.2); transition: background .35s, box-shadow .35s, transform .35s var(--ease);
}
.tracker-bars a.done::before { background: var(--orange); }
.tracker-bars a.now::before { background: var(--orange); box-shadow: 0 0 10px var(--orange); transform: scaleY(1.8); }
.tracker-bars a:hover::before { background: #fff; }
.tracker-bars .gap { margin-left: 8px; }

/* ── Tablet / small laptop: keep the replica, loosen type floors ── */
@media (max-width: 1180px) and (min-width: 900px) {
  .copy { width: 41cqi; }
  .side-right .copy { left: 54.5cqi; }
  .claim { max-width: 38cqi; }
  .spec { max-width: 36cqi; }
  .test-meta { display: none; }
}

/* ── Mobile: image on top, message below ──────── */
@media (max-width: 899px) {
  .hero { aspect-ratio: auto; display: flex; flex-direction: column; }
  .hero-media { position: relative; aspect-ratio: 4 / 5; overflow: hidden; }
  .hero-bg { object-position: 14% 50%; }
  .hero-products { display: none; }
  .hero-badge { right: 16px; top: 16px; width: 84px; height: 84px; }
  .hero-copy { position: static; width: auto; padding: 30px 20px 0; }
  .hero-media { aspect-ratio: 1 / 1; }
  .line-light { font-size: clamp(44px, 13.5vw, 78px); }
  .line-heavy { font-size: clamp(47px, 14.4vw, 84px); }
  .hero-pillars { font-size: 20px; margin-top: 18px; }
  .hero-claim { font-size: 17px; margin-top: 10px; max-width: 420px; }
  .hero-legal { position: static; padding: 28px 20px 36px; font-size: 12px; }
  .scroll-cue { display: none; }

  .intro-inner { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .score { width: min(300px, 76vw); }
  .intro-legal { margin-inline: auto; }
  .pillars { grid-template-columns: 1fr; gap: 44px; }

  .test { aspect-ratio: auto; display: flex; flex-direction: column; container-type: normal; }
  .test-bg { position: relative; inset: auto; aspect-ratio: 4 / 5; height: auto; object-position: var(--pos, 50%) 50%; }
  .tab { top: auto; bottom: auto; width: 76px; }
  .tab { top: calc(min(100vw, 899px) * 1.25 * .5 - 47px); }
  .badge:not(.hero-badge):not(.closing-badge) { right: 16px; top: 16px; width: 76px; height: 76px; }
  .copy { position: relative; top: auto; left: auto !important; translate: none; width: auto; padding: 30px 20px 64px; }
  .test-meta { font-size: 11px; margin-bottom: 16px; }
  .headline .lead { font-size: clamp(30px, 9.2vw, 52px); }
  .headline .word { font-size: clamp(42px, 14.2vw, 84px); white-space: normal; }
  .claim { font-size: 19px; margin-top: 22px; max-width: 520px; }
  .spec { font-size: 15px; margin-top: 14px; max-width: 520px; }
  .test .rule-tag { font-size: 20px; margin-top: 22px; min-width: 0; }
  .side-left .spec { max-width: 520px; }

  /* Thin progress strip on the bottom edge so it never covers the copy */
  .tracker { left: 0; right: 0; bottom: 0; translate: 0 100%; padding: 0; border: 0; border-radius: 0; background: #000; }
  .tracker.show { translate: 0 0; }
  .tracker-label { display: none; }
  .tracker-bars { flex: 1; gap: 2px; }
  .tracker-bars li { flex: 1; }
  .tracker-bars a { width: auto; height: 6px; }
  .tracker-bars a::before { top: 1px; height: 4px; border-radius: 0; }
  .tracker-bars a.now::before { transform: none; }
  .tracker-bars .gap { margin-left: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .test .copy > *, .js .reveal { opacity: 1; transform: none; }
  .js .test .headline .word { clip-path: none; }
  .js .test .test-bg, .js .test .tab, .js .test .badge { transform: none; opacity: 1; }
  .js .test .rule-tag { border-color: var(--orange); }
}
