/* =========================================================
   CLARIVENT 3D scroll sequence (endustri.html #clarivent)
   Default = static layout (no JS / no WebGL / reduced motion).
   .cv3d-on = pinned 3D stage driven by assets/js/clarivent3d.js
   ========================================================= */
.cv3d { position: relative; background: var(--white); }
.cv3d-canvas, .cv3d-hint, .cv3d-dots, .cv3d-step.s1, .cv3d-step.s2 { display: none; }

/* ---------- static fallback ---------- */
.cv3d-stage { position: relative; padding: clamp(64px, 9vw, 120px) 0 0; }
.cv3d-copy { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.cv3d-fallback { max-width: 820px; margin: 28px auto 0; padding: 0 var(--gutter); }
.cv3d-fallback img { width: 100%; height: auto; border-radius: 24px; display: block; }

/* ---------- step copy ---------- */
.cv3d-step .eyebrow { margin-bottom: 14px; }
.cv3d-step h2 { font-size: clamp(2rem, 4.2vw, 3.6rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.04; }
.cv3d-step p { font-size: clamp(1rem, 1.3vw, 1.12rem); margin: 18px 0 0; color: var(--muted); max-width: 440px; }
.cv3d-step.s1 { color: #fff; }
.cv3d-step.s1 .eyebrow { color: #8fe0b6; }
.cv3d-step.s1 p { color: rgba(255,255,255,.78); }
.cv3d-step.s1 h2, .cv3d-step.s1 p { text-shadow: 0 2px 24px rgba(0,0,0,.35), 0 1px 3px rgba(0,0,0,.25); }
.cv3d-step h2 .grad-text { white-space: nowrap; }
.cv3d-stats { display: grid; grid-template-columns: repeat(3, auto); gap: 10px 30px; margin-top: 26px; justify-content: start; }
.cv3d-stats div { border-left: 2px solid var(--end); padding-left: 12px; }
.cv3d-stats b { display: block; white-space: nowrap; font-family: var(--font-display); font-weight: 900; font-size: clamp(1.5rem, 2.6vw, 2.2rem); letter-spacing: -.03em; line-height: 1.05; }
.cv3d-stats span { display: block; color: var(--muted); font-size: .84rem; margin-top: 3px; }

/* ---------- after the stage: product text and actions ---------- */
.cv3d-after { padding-top: clamp(48px, 7vw, 90px) !important; }
.cv3d-after .cv3d-grid { display: grid; grid-template-columns: .9fr 1.1fr; gap: clamp(28px, 6vw, 88px); align-items: start; }
.cv3d-after h2 { font-size: clamp(2rem, 4vw, 3.2rem); margin: 14px 0 0; }
.cv3d-after p { color: var(--muted); font-size: 1.04rem; }
.cv3d-after .actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
@media (max-width: 860px) { .cv3d-after .cv3d-grid { grid-template-columns: 1fr; gap: 12px; } }

/* ---------- animated, pinned stage ---------- */
.cv3d-on .cv3d-track { height: 420vh; }
.cv3d-on .cv3d-stage {
  position: sticky; top: var(--cv3d-top, 125px); padding: 0; overflow: hidden;
  height: calc(100vh - var(--cv3d-top, 125px)); height: calc(100svh - var(--cv3d-top, 125px));
  background: #70757b;
}
.cv3d-on .cv3d-canvas { display: block; position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity .8s ease; }
.cv3d-ready .cv3d-canvas { opacity: 1; }
.cv3d-on .cv3d-fallback { position: absolute; inset: 0; margin: 0; max-width: none; display: grid; place-items: center; padding: 6% 8% 6% 46%; transition: opacity .8s ease; }
.cv3d-on .cv3d-fallback img { width: auto; max-width: 100%; max-height: 100%; border-radius: 18px; opacity: .55; }
.cv3d-ready .cv3d-fallback { opacity: 0; visibility: hidden; }

.cv3d-on .cv3d-copy { position: absolute; inset: 0; z-index: 2; pointer-events: none; padding: 0; max-width: var(--wrap); }
.cv3d-on .cv3d-step { display: block; position: absolute; left: var(--gutter); top: 50%; width: min(470px, 40%); transform: translateY(calc(-50% + var(--y, 0px))); opacity: 0; will-change: opacity, transform; }
.cv3d-on .cv3d-step.s1 { opacity: 1; }

.cv3d-on .cv3d-hint { display: flex; position: absolute; z-index: 3; left: 50%; bottom: 22px; transform: translateX(-50%); flex-direction: column; align-items: center; gap: 10px; color: rgba(255,255,255,.75); font-size: .74rem; letter-spacing: .2em; text-transform: uppercase; font-weight: 700; pointer-events: none; }
.cv3d-hint i { width: 22px; height: 34px; border: 1.5px solid currentColor; border-radius: 12px; position: relative; }
.cv3d-hint i::after { content: ""; position: absolute; left: 50%; top: 7px; width: 3px; height: 7px; border-radius: 2px; background: currentColor; transform: translateX(-50%); animation: cv3dwheel 1.7s infinite; }
@keyframes cv3dwheel { 0% { opacity: 0; transform: translate(-50%, 0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, 11px); } }

.cv3d-on .cv3d-dots { display: flex; position: absolute; z-index: 3; left: var(--gutter); bottom: 26px; gap: 8px; }
.cv3d-dots i { width: 22px; height: 4px; border-radius: 4px; background: rgba(150,155,162,.45); transition: width .4s var(--ease), background .4s; }
.cv3d-dots i.on { width: 44px; background: var(--end); }

@media (min-width: 1321px) { .cv3d-on .cv3d-step { left: calc((100vw - var(--wrap)) / 2 + var(--gutter)); } .cv3d-on .cv3d-dots { left: calc((100vw - var(--wrap)) / 2 + var(--gutter)); } }

@media (max-width: 760px) {
  .cv3d-on .cv3d-track { height: 340vh; }
  .cv3d-on .cv3d-stage { height: calc(100vh - var(--cv3d-top, 113px) - 68px); height: calc(100svh - var(--cv3d-top, 113px) - 68px - env(safe-area-inset-bottom)); }
  .cv3d-on .cv3d-fallback { padding: 8% 10% 52%; }
  .cv3d-on .cv3d-step { left: var(--gutter); right: var(--gutter); width: auto; top: auto; bottom: 40px; transform: translateY(var(--y, 0px)); }
  .cv3d-step h2 { font-size: clamp(1.6rem, 7.4vw, 2.1rem); }
  .cv3d-step p { font-size: .95rem; margin-top: 10px; }
  .cv3d-stats { grid-template-columns: repeat(3, 1fr); gap: 8px 12px; margin-top: 16px; }
  .cv3d-stats b { font-size: 1.3rem; }
  .cv3d-stats span { font-size: .74rem; }
  .cv3d-on .cv3d-hint { display: none; }
  .cv3d-on .cv3d-dots { bottom: 16px; }
}

/* intro: centred "scroll for clean air" over the steam (the unit is hidden until the steam is pulled in) */
.cv3d-on .cv3d-step.s1 { left: var(--gutter); right: var(--gutter); width: auto; top: 50%; bottom: auto; text-align: center; transform: translateY(calc(-50% + var(--y, 0px))); }
.cv3d-step.s1 .eyebrow { justify-content: center; color: rgba(255,255,255,.88); text-shadow: 0 1px 6px rgba(0,0,0,.3); }
.cv3d-step.s1 .eyebrow::before { display: none; }
.cv3d-step.s1 h2 { font-size: clamp(2.4rem, 6.4vw, 5.6rem); line-height: 1; letter-spacing: -.035em; }
.cv3d-mouse { display: block; width: 26px; height: 42px; margin: 34px auto 0; border: 2px solid rgba(255,255,255,.75); border-radius: 14px; position: relative; }
.cv3d-mouse::after { content: ""; position: absolute; left: 50%; top: 8px; width: 4px; height: 9px; border-radius: 2px; background: #fff; transform: translateX(-50%); animation: cv3dwheel 1.7s infinite; }
@media (max-width: 760px) { .cv3d-on .cv3d-step.s1 { bottom: auto; top: 50%; transform: translateY(calc(-50% + var(--y, 0px))); } .cv3d-step.s1 h2 { font-size: clamp(2.2rem, 11vw, 3rem); } }
/* animated mode: never show the photo behind the steam (it returns automatically if 3D fails, since .cv3d-on is removed) */
.cv3d-on .cv3d-fallback { display: none; }

/* notice shown instead of the animation (reduced motion / no WebGL) */
.cv3d-notes { margin-top: 22px; }
.cv3d-note { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 14px 18px; margin: 0 0 12px; padding: 16px 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); color: var(--muted); font-size: .95rem; text-align: left; }
.cv3d-note[hidden] { display: none; }
.cv3d-note span { flex: 1 1 280px; }
.cv3d-note .btn { white-space: nowrap; }

/* ---------- product film under the scroll sequence: title + video fit one screen, centred ---------- */
.cv-film { padding: 0 !important; scroll-margin-top: var(--cv3d-top, 125px); }
.cv-film > .wrap { min-height: calc(100vh - var(--cv3d-top, 125px)); min-height: calc(100svh - var(--cv3d-top, 125px));
  display: flex; flex-direction: column; justify-content: center; align-items: center; padding-top: 40px; padding-bottom: 40px; }
.cv-film-title { text-align: center; font-size: clamp(1.7rem, 3.2vw, 2.6rem); margin: 0 0 clamp(18px, 3vh, 30px); }
.cv-film-frame { width: min(100%, 1100px, calc((100vh - var(--cv3d-top, 125px) - 200px) * 16 / 9)); width: min(100%, 1100px, calc((100svh - var(--cv3d-top, 125px) - 200px) * 16 / 9));
  margin: 0 auto; border-radius: 22px; overflow: hidden; background: #050607; aspect-ratio: 16 / 9; box-shadow: 0 30px 80px -30px rgba(0,0,0,.45); }
.cv-film-frame video { display: block; width: 100%; height: 100%; object-fit: cover; background: #050607; }
@media (max-width: 760px) { .cv-film > .wrap { min-height: 0; padding-top: 56px; padding-bottom: 24px; } .cv-film-frame { width: 100%; border-radius: 14px; } }

/* ---------- die-casting hood: opens / closes with the page scroll (assets/js/hood.js) ---------- */
.feature-media .frame.hood { aspect-ratio: 1379 / 1047; background: linear-gradient(180deg, #f6f7f9, #e9ecef); }
.feature-media .frame.hood img { position: absolute; inset: 0; padding: 3%; object-fit: contain; transform: none !important; transition: none; }
.feature-media .frame.hood .hood-open { --a: -20%;
  -webkit-mask-image: linear-gradient(256deg, #000 var(--a), rgba(0,0,0,.55) calc(var(--a) + 7%), transparent calc(var(--a) + 16%));
          mask-image: linear-gradient(256deg, #000 var(--a), rgba(0,0,0,.55) calc(var(--a) + 7%), transparent calc(var(--a) + 16%)); }
.hood-meter { position: absolute; right: 18px; top: 18px; bottom: 18px; width: 4px; border-radius: 4px; background: rgba(20,22,24,.08); }
.hood-meter i { position: absolute; left: 0; right: 0; top: 0; height: 0; border-radius: 4px; background: var(--end); }
[data-theme="dark"] .feature-media .frame.hood { background: linear-gradient(180deg, #f2f3f5, #e4e7ea); }
