/* Secțiunea 3D „De la desen la piesă” de pe pagina Servicii.
   Scena (WebGL + strat 2D de particule + etichete) stă lipită (sticky) cât timp derulează cei 7 pași. */
.p3d {
  --p-ink: #f2efe9;
  --p-dim: #b9b5ad;
  --p-panel: rgba(14, 15, 17, .86);
  --p-line: rgba(242, 239, 233, .16);
  --p-blue: #9fd0ff;
  --bg-a: #0d2f52;
  --bg-b: #0a223d;
  --grid: .55;
  --frame: rgba(159, 208, 255, .35);
  position: relative; background: #0b0c0e; color: var(--p-ink); font-size: 18px; line-height: 1.55;
}
.p3d-stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; z-index: 0; }
.p3d-bg { position: absolute; inset: 0; background: radial-gradient(ellipse at 62% 42%, var(--bg-a) 0%, var(--bg-b) 78%); }
.p3d-bg::after {
  content: ""; position: absolute; inset: 0; opacity: var(--grid);
  background-image:
    linear-gradient(rgba(159, 208, 255, .16) 1px, transparent 1px), linear-gradient(90deg, rgba(159, 208, 255, .16) 1px, transparent 1px),
    linear-gradient(rgba(159, 208, 255, .07) 1px, transparent 1px), linear-gradient(90deg, rgba(159, 208, 255, .07) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
}
.p3d-scene, .p3d-fx { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.p3d-fx { pointer-events: none; }
.p3d-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.p3d .lbl { position: absolute; left: 0; top: 0; white-space: nowrap; font-family: var(--font-mono); font-size: 14px; letter-spacing: .02em; transform: translate(-50%, -50%); transition: opacity .25s; }
.p3d .lbl.bp { color: var(--p-blue); text-shadow: 0 0 10px rgba(10, 30, 60, .9); }
.p3d .lbl.cmm { color: #101214; background: #f4f2ee; border-left: 4px solid #2f9e44; padding: 5px 10px; box-shadow: 0 6px 18px rgba(0,0,0,.28); }
.p3d .lbl.cmm b { font-weight: 500; }
.p3d .lbl.cmm .ok { color: #2f9e44; margin-left: 6px; }

/* rama de planșă tehnică */
.p3d-sheet { position: absolute; inset: 14px; pointer-events: none; border: 1px solid var(--frame); transition: border-color .4s; }
.p3d-sheet .tx, .p3d-sheet .ty { position: absolute; display: flex; font-family: var(--font-mono); font-size: 11px; color: var(--frame); }
.p3d-sheet .tx { left: 0; right: 0; top: 0; height: 18px; border-bottom: 1px solid var(--frame); }
.p3d-sheet .ty { top: 18px; bottom: 0; left: 0; width: 18px; flex-direction: column; border-right: 1px solid var(--frame); }
.p3d-sheet .tx span, .p3d-sheet .ty span { flex: 1; display: grid; place-items: center; }
.p3d-sheet .tx span + span { border-left: 1px solid var(--frame); }
.p3d-sheet .ty span + span { border-top: 1px solid var(--frame); }
.p3d-sheet .sid { position: absolute; right: 0; bottom: 0; display: flex; font-family: var(--font-mono); font-size: 11px; color: var(--frame); border-top: 1px solid var(--frame); border-left: 1px solid var(--frame); background: rgba(10, 12, 14, .35); }
.p3d-sheet .sid span { padding: 5px 12px; letter-spacing: .06em; }
.p3d-sheet .sid span + span { border-left: 1px solid var(--frame); }

.p3d-rail { position: absolute; z-index: 5; top: 50%; transform: translateY(-50%); right: max(34px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 8px; }
.p3d-rail a { display: flex; align-items: center; justify-content: flex-end; gap: 10px; text-decoration: none; color: var(--p-dim); font-family: var(--font-mono); font-size: 12px; min-height: 30px; }
.p3d-rail a i { display: block; width: 18px; height: 2px; background: currentColor; opacity: .5; transition: width .25s, opacity .25s; }
.p3d-rail a .t { opacity: 0; transition: opacity .25s; text-transform: uppercase; letter-spacing: .08em; font-size: 11px; }
.p3d-rail a.on { color: var(--orange); }
.p3d-rail a.on i { width: 38px; opacity: 1; }
.p3d-rail a.on .t, .p3d-rail a:hover .t { opacity: 1; }
.p3d-prog { display: none; }

.p3d-content { position: relative; z-index: 4; margin-top: -100vh; margin-top: -100svh; }
.p3d-wrap { padding-left: max(56px, env(safe-area-inset-left, 0px)); padding-right: max(56px, env(safe-area-inset-right, 0px)); }
.p3d-intro { min-height: 100vh; min-height: 100svh; display: flex; align-items: flex-end; padding-block: 18vh 10vh; }
.p3d-intro > div { max-width: 820px; }
.p3d-kicker { display: flex; gap: 14px; align-items: center; font-family: var(--font-mono); font-size: 13px; letter-spacing: .12em; color: var(--orange); text-transform: uppercase; }
.p3d-kicker::before { content: ""; width: 42px; height: 2px; background: currentColor; }
.p3d-intro h2 { font-family: var(--font-stencil); font-weight: 800; text-transform: uppercase; font-size: clamp(60px, 10vw, 160px); line-height: .86; margin: 14px 0 22px; color: var(--p-ink); }
.p3d-intro h2 em { font-style: normal; color: var(--orange); }
.p3d-intro p { max-width: 54ch; color: var(--p-dim); font-size: 20px; }
.p3d-cue { margin-top: 30px; display: inline-flex; align-items: center; gap: 12px; font-family: var(--font-mono); font-size: 13px; letter-spacing: .08em; color: var(--p-blue); text-transform: uppercase; }
.p3d-cue span { display: inline-block; width: 1px; height: 38px; background: currentColor; animation: cue 1.8s ease-in-out infinite; transform-origin: top; }

.p3d-step { min-height: 140vh; position: relative; }
.p3d-panel {
  position: sticky; top: 18vh; width: min(520px, 100%);
  display: grid; grid-template-columns: 34px 1fr;
  background: var(--p-panel); border: 1px solid var(--p-line);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.p3d-panel::before, .p3d-panel::after { content: ""; position: absolute; width: 14px; height: 14px; border: 2px solid var(--orange); pointer-events: none; }
.p3d-panel::before { top: -6px; left: -6px; border-right: 0; border-bottom: 0; }
.p3d-panel::after { bottom: -6px; right: -6px; border-left: 0; border-top: 0; }
.p3d-side { border-right: 1px solid var(--p-line); display: flex; align-items: center; justify-content: center; padding: 14px 0; }
.p3d-side span { writing-mode: vertical-rl; transform: rotate(180deg); font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--p-dim); white-space: nowrap; }
.p3d-side b { color: var(--orange); font-weight: 500; }
.p3d-body { padding: 24px 28px 0; min-width: 0; }
.p3d-num { font-family: var(--font-stencil); font-weight: 800; font-size: 30px; line-height: 1; color: var(--orange); }
.p3d-num small { font-size: .55em; color: var(--p-dim); margin-left: 4px; }
.p3d-panel h3 { font-family: var(--font-stencil); font-weight: 800; text-transform: uppercase; font-size: 60px; line-height: .9; margin: 8px 0 14px; color: var(--p-ink); }
.p3d-panel p { color: var(--p-dim); }
.p3d-tb { display: grid; grid-template-columns: 1fr 1fr; margin: 20px -28px 0; border-top: 1px solid var(--p-line); }
.p3d-tb div { padding: 10px 14px 12px 28px; min-width: 0; }
.p3d-tb div + div { border-left: 1px solid var(--p-line); padding-left: 14px; }
.p3d-tb dt { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--orange); }
.p3d-tb dd { margin: 3px 0 0; font-family: var(--font-cond); font-weight: 600; font-size: 17px; line-height: 1.2; color: var(--p-ink); letter-spacing: .02em; }
.p3d-panel .btn { margin: 20px 0 24px; }
.p3d-step:last-child .p3d-panel { margin-bottom: 0; }
.p3d-end { height: 30vh; }

@media (max-width: 1100px) {
  .p3d-panel h3 { font-size: 50px; }
  .p3d-panel { width: min(470px, 100%); }
}
@media (max-width: 760px) {
  .p3d { font-size: 16px; }
  .p3d-wrap { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .p3d-sheet, .p3d-rail { display: none; }
  .p3d .lbl { font-size: 11px; }
  .p3d .lbl.cmm { padding: 3px 7px; border-left-width: 3px; }
  .p3d-prog {
    display: flex; position: absolute; z-index: 6; left: 0; right: 0; top: 0;
    padding: 10px 16px; gap: 4px; align-items: center;
    background: linear-gradient(rgba(8, 9, 11, .72), rgba(8, 9, 11, 0)); opacity: 0; transition: opacity .3s;
  }
  .p3d-prog.show { opacity: 1; }
  .p3d-prog i { flex: 1; height: 3px; background: rgba(242, 239, 233, .22); position: relative; overflow: hidden; }
  .p3d-prog i b { position: absolute; inset: 0; background: var(--orange); transform-origin: left; transform: scaleX(var(--p, 0)); }
  .p3d-prog span { font-family: var(--font-mono); font-size: 11px; color: var(--p-ink); margin-left: 8px; min-width: 40px; text-align: right; }
  .p3d-intro { padding-block: 14vh 8vh; }
  .p3d-intro h2 { font-size: clamp(54px, 16vw, 84px); }
  .p3d-intro p { font-size: 17px; }
  /* pe telefon cartușul stă jos, lipit de marginea ecranului; piesa rămâne vizibilă deasupra */
  .p3d-step { min-height: 160vh; min-height: 160svh; display: flex; flex-direction: column; }
  .p3d-panel { top: auto; bottom: 12px; margin-top: auto; margin-bottom: 12px; grid-template-columns: 1fr; width: 100%; }
  .p3d-panel::before, .p3d-panel::after { width: 10px; height: 10px; }
  .p3d-side { border-right: 0; border-bottom: 1px solid var(--p-line); justify-content: flex-start; padding: 7px 16px; }
  .p3d-side span { writing-mode: horizontal-tb; transform: none; font-size: 10px; letter-spacing: .14em; }
  .p3d-body { padding: 14px 16px 0; }
  .p3d-num { display: none; }
  .p3d-panel h3 { font-size: 38px; margin: 0 0 8px; }
  .p3d-panel p { font-size: 15px; line-height: 1.5; }
  .p3d-tb { margin: 14px -16px 0; }
  .p3d-tb div { padding: 8px 10px 10px 16px; }
  .p3d-tb div + div { padding-left: 10px; }
  .p3d-tb dt { font-size: 9.5px; }
  .p3d-tb dd { font-size: 14.5px; }
  .p3d-panel .btn { width: 100%; margin: 14px 0 16px; }
  .p3d-end { height: 10vh; }
}
