/* Explorador de máquinas + herramienta (src/explorer.js: fotos de Blender, sin three.js) — todo bajo #equipment para que nada se cuele al resto de la página. */
/* --accent-ink is pinned per accent rather than to var(--ink): the Take-apart button keeps its accent background in dark mode. */
#equipment,#tools{--tool-fg:#1f2328;--tool-muted:#6b7078;--panel:#ffffff;--line2:color-mix(in oklab,var(--line) 55%,transparent);--chip:#ffffff;--leader:var(--ink);--hot:#ffd3b8;--accent-ink:#ffffff;--xr:10px}
/* explorer sits on a soft off-white field so the white 3D panels read as cards (like the GET Drilling Tools page) */
#equipment{background:#f7f7f4}
html[data-mode="dark"] #equipment{background:transparent}
html[data-accent="purple"] #equipment,html[data-accent="purple"] #tools{--accent-ink:#f5f2ec}
html[data-mode="dark"] #equipment,html[data-mode="dark"] #tools{--panel:#ffffff;--chip:#ffffff;--leader:#0f0a14;--hot:#3a1e12}
#equipment [hidden],#tools [hidden]{display:none!important}
#sections:empty,#tools-sections:empty{min-height:280px;display:flex;align-items:center;justify-content:center;border:1px dashed var(--line);margin-top:28px}
#sections:empty::after,#tools-sections:empty::after{content:attr(data-loading);font-family:var(--font-mono);font-size:11px;letter-spacing:.14em;text-transform:uppercase;color:var(--muted)}
/* one machine at a time — data-show on #sections is set by the dropdown */
#sections[data-show]>section.machine{display:none}
#sections[data-show="piling-rig"]>#piling-rig,#sections[data-show="small-rig"]>#small-rig,#sections[data-show="rt-crane"]>#rt-crane,#sections[data-show="excavator"]>#excavator,#sections[data-show="compressor"]>#compressor{display:contents}
/* explorer layout: text column left, machine right; stacks under 1024px */
#equipment .eq-layout{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.25fr);grid-template-areas:"side stage" "sub stage" ". bar" "tools tools";gap:0 56px;align-items:start}
#equipment .eq-side{grid-area:side}
#equipment .eq-side .eq-head{grid-template-columns:1fr;gap:20px;align-items:start}
#equipment #sections{display:contents}
#equipment #sections:empty{display:block;grid-area:stage}
@media (max-width:1024px){#equipment .eq-layout{grid-template-columns:minmax(0,1fr);grid-template-areas:"side" "sub" "stage" "bar" "tools";gap:0}#equipment section.machine p.sub{margin-top:24px}#equipment .stage,#equipment .bar{justify-self:center}}
/* machine panel: one column — stage, bar, then the tools for that machine */
#equipment section.machine{display:grid;grid-template-columns:minmax(0,1fr);grid-template-areas:"h" "sub" "stage" "bar" "tools";gap:0;align-items:start;padding:24px 0 0;margin-top:20px;border-top:1px solid var(--line)}
#equipment section.machine h2{display:none;grid-area:h;margin:0;font-family:var(--font-display);font-weight:800;font-size:clamp(26px,2.4vw,34px);line-height:1.05;letter-spacing:-.01em;color:var(--fg);text-wrap:balance}
#equipment section.machine h2 small{display:block;font-family:var(--font-mono);font-weight:500;font-size:11px;line-height:1.4;letter-spacing:.14em;color:var(--muted);text-transform:uppercase;margin-top:10px}
#equipment section.machine p.sub{grid-area:sub;margin:24px 0 14px;color:var(--muted);max-width:60ch;font-size:13px;line-height:1.5}
/* El escenario mide SIEMPRE 1/0.9 = la proporción de los cuadros de Blender (1200×1080), también en celular: la foto lo llena sin bandas y los puntos (en %) caen en su sitio. Se limita por ancho. */
#equipment .stage{grid-area:stage;position:relative;width:100%;max-width:min(100%,78vh);justify-self:end;aspect-ratio:1/0.9;background:#e7e7e7;border:1px solid var(--line);border-radius:var(--xr);box-shadow:0 1px 2px rgba(0,0,0,.04);overflow:hidden;user-select:none;-webkit-user-select:none}
#equipment .stage canvas{position:absolute;inset:0;width:100%;height:100%;display:block}
#equipment .stage canvas.foto{touch-action:pan-y;-webkit-tap-highlight-color:transparent}
/* resalte de la pieza tocada: su silueta (máscara de Blender, 300×270) estirada sobre la foto */
#equipment .stage canvas.luz{pointer-events:none;opacity:.5;mix-blend-mode:screen}
#equipment .stage .overlay{position:absolute;inset:0;pointer-events:none}
#equipment .stage .hint{position:absolute;right:14px;bottom:12px;font-family:var(--font-mono);font-size:10px;letter-spacing:.1em;text-transform:uppercase;color:#6b7078;background:rgba(255,255,255,.85);border:1px solid #e3e5e8;border-radius:2px;padding:6px 9px}
#equipment .stage .hint[hidden]{display:none}
#equipment .part-card{position:absolute;left:14px;top:14px;width:min(340px,calc(100% - 28px));pointer-events:auto;background:#fff;border:1px solid var(--line);border-radius:var(--xr);box-shadow:0 12px 32px rgba(15,10,20,.14);padding:16px 16px 14px;display:flex;flex-direction:column;gap:12px;z-index:3}
#equipment .part-card[hidden]{display:none}
#equipment .part-card .close{position:absolute;top:6px;right:6px;width:28px;height:28px;border:0;background:none;color:var(--muted);font-size:20px;line-height:1;cursor:pointer;border-radius:2px}
#equipment .part-card .close:hover{color:var(--fg);background:var(--hot)}
#equipment .part-card .pc-head{display:flex;gap:12px;align-items:flex-start;padding-right:24px}
#equipment .part-card .n{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;border-radius:13px;background:var(--leader);color:#fff;font-family:var(--font-mono);font-weight:700;font-size:11px;line-height:1}
#equipment .part-card .pc-name{font-family:var(--font-display);font-weight:800;font-size:17px;line-height:1.15;color:var(--fg)}
#equipment .part-card .pc-sub{font-size:12.5px;color:var(--muted);margin-top:3px}
#equipment .part-card .pc-spares{font-size:13.5px;line-height:1.45;color:var(--fg);border-top:1px dashed var(--line);padding-top:10px}
#equipment .part-card .pc-spares b{display:block;font-family:var(--font-mono);font-weight:500;font-size:10px;letter-spacing:.12em;text-transform:uppercase;color:var(--muted);margin-bottom:4px}
#equipment .part-card a.inq{align-self:flex-start;text-decoration:none;font-family:var(--font-mono);font-weight:600;font-size:11px;line-height:1;letter-spacing:.1em;text-transform:uppercase;color:#fff;background:var(--accent);border:1px solid var(--accent);border-radius:6px;padding:11px 14px}
#equipment .part-card a.inq:hover{background:var(--fg);border-color:var(--fg)}
@media (max-width:560px){#equipment .part-card{left:8px;right:8px;top:auto;bottom:8px;width:auto;padding:12px 12px 10px;gap:8px;max-height:calc(100% - 16px);overflow:auto}#equipment .part-card .pc-spares{font-size:12.5px;padding-top:8px}#equipment .stage .hint{display:none}#equipment .tag.badge b{min-width:19px;height:19px;font-size:11px}}   /* en celular el escenario mide ~350 px: puntos más chicos y sin el aviso (taparía media máquina; el texto de arriba ya dice «toca cualquier pieza») */
#equipment .tag{position:absolute;pointer-events:auto;cursor:pointer;transform:translate(-50%,-50%);white-space:nowrap;background:var(--chip);border:1px solid #d9dbdf;border-radius:3px;padding:3px 8px 3px 6px;font-family:var(--font-narrow);font-weight:600;font-size:12px;line-height:1.2;letter-spacing:.04em;text-transform:uppercase;color:#0f0a14;box-shadow:0 1px 2px rgba(0,0,0,.08);transition:opacity .2s;display:flex;gap:6px;align-items:center}
#equipment .tag b{display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;border-radius:9px;background:#1f2328;color:#fff;font-family:var(--font-mono);font-weight:700;font-size:10px;line-height:1}
#equipment .tag.hot{border-color:var(--accent);background:var(--hot)}
#equipment .tag small{display:block;font-family:var(--font-body);font-weight:500;font-size:10px;line-height:1.2;letter-spacing:.02em;text-transform:none;color:#6b7078}
#equipment .tag.badge{padding:0;border:0;background:none;box-shadow:none}
/* con ratón, el punto bajo el cursor se abre y enseña el nombre: el número se queda sobre su punto y el texto sale hacia el lado con más sitio */
#equipment .tag:not(.badge){transform:translate(-15px,-50%);z-index:2}
#equipment .tag.izq:not(.badge){transform:translate(calc(-100% + 15px),-50%);flex-direction:row-reverse;padding:3px 6px 3px 8px;text-align:right}
#equipment .tag.hot:not(.badge){background:#fff;border-color:var(--accent)}   /* fijo: en modo oscuro --hot es casi negro y el nombre no se leía */
#equipment .tag.badge.hot{z-index:2}
#equipment .tag.badge.hot b{background:var(--accent);outline:2px solid #fff}
#equipment .tag:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:12px}
#equipment .tag.badge span{display:none}
#equipment .tag.badge b{min-width:22px;height:22px;border-radius:11px;font-size:12px;box-shadow:0 0 0 1.5px rgba(255,255,255,.9),0 1px 3px rgba(0,0,0,.35)}
#equipment .bar{grid-area:bar;display:flex;gap:10px;align-items:center;flex-wrap:wrap;padding:10px 0 18px;width:100%;max-width:min(100%,78vh);justify-self:end}
#equipment .bar button{font-family:var(--font-mono);font-weight:500;font-size:11px;line-height:1;letter-spacing:.08em;text-transform:uppercase;color:var(--fg);background:var(--panel);border:1px solid var(--line);border-radius:6px;padding:10px 12px;cursor:pointer}
html[data-mode="dark"] #equipment .bar button{background:var(--bg)}
#equipment .bar button:hover{border-color:var(--fg)}
#equipment .bar button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
#equipment .bar button[aria-pressed="true"]{background:var(--fg);color:var(--bg);border-color:var(--fg)}
#equipment .bar button.toggle{background:var(--accent);color:var(--accent-ink);border-color:var(--accent);min-width:132px;font-family:var(--font-display);font-weight:800;font-size:13px;letter-spacing:.06em}
#equipment .bar input[type=range]{flex:1 1 160px;min-width:120px;accent-color:var(--accent)}
#equipment .grp{display:flex;gap:6px}
@media (max-width:720px){#equipment .bar{padding-bottom:20px}}
/* tools inside each machine tab */
#equipment .tools-for{grid-area:tools;padding:24px 0 24px;margin-top:8px;border-top:1px solid var(--line)}
#equipment .tools-for h3{margin:0 0 6px;font-family:var(--font-display);font-weight:800;font-size:clamp(20px,1.8vw,26px);line-height:1.1;letter-spacing:-.01em;color:var(--fg)}
#equipment .tools-for .grp-title{margin:22px 0 12px;font-family:var(--font-mono);font-weight:500;font-size:11px;line-height:1;letter-spacing:.14em;text-transform:uppercase;color:var(--muted);display:flex;align-items:center;gap:12px}
#equipment .tools-for .grp-title::after{content:"";flex:1;height:1px;background:var(--line)}
#equipment .tools-for .grid+.grid{margin-top:16px}
/* tools grid (grouped by machine or by size — headings come from the module) */
#equipment .tools-for .legacy-h3{margin:40px 0 14px;font-family:var(--font-mono);font-weight:500;font-size:11px;line-height:1;letter-spacing:.14em;text-transform:uppercase;color:var(--muted);display:flex;align-items:center;gap:14px}
#equipment .tools-for .legacy-h3::after{content:"";flex:1;height:1px;background:var(--line)}
#equipment .tools-for .grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:16px}
#equipment .tools-for .tool{background:var(--panel);color:var(--tool-fg);border:1px solid var(--line);border-radius:var(--xr);box-shadow:0 1px 2px rgba(0,0,0,.04);overflow:hidden;display:flex;flex-direction:column}
#equipment .tools-for .tool .mini{position:relative;width:100%;aspect-ratio:1/1;background:var(--panel);border-bottom:1px solid var(--line2)}
/* kelly card = poster format: the bar is ~10:1, so it spans two rows and its stage takes the full height */
#equipment .tools-for #tool-kelly-bar .mini{aspect-ratio:1/1.75}
@media (min-width:640px){#equipment .tools-for #tool-kelly-bar{grid-row:span 2}#equipment .tools-for #tool-kelly-bar .mini{aspect-ratio:auto;flex:1 1 auto;min-height:560px}#equipment .tools-for #tool-kelly-bar .txt{flex:0 0 auto}}
#equipment .tools-for .tool .txt{padding:16px 18px 18px;display:flex;flex-direction:column;gap:8px;flex:1}
#equipment .tools-for .tool h4{margin:0;font-family:var(--font-display);font-weight:800;font-size:17px;line-height:1.15;letter-spacing:-.005em;color:var(--tool-fg)}
#equipment .tools-for .tool .ref{font-family:var(--font-mono);font-weight:500;font-size:10px;line-height:1.3;letter-spacing:.1em;text-transform:uppercase;color:var(--tool-muted)}
#equipment .tools-for .tool .fn{font-size:13px;line-height:1.5;color:var(--tool-fg)}
#equipment .tools-for .tool .wear{font-size:12px;line-height:1.45;color:var(--tool-muted)}
#equipment .tools-for .tool .wear b{color:var(--tool-fg);font-weight:600}
#equipment .tools-for .tool a.inq{margin-top:auto;align-self:flex-start;text-decoration:none;font-family:var(--font-mono);font-weight:500;font-size:11px;line-height:1;letter-spacing:.1em;text-transform:uppercase;color:var(--tool-fg);border:1px solid var(--tool-fg);border-radius:6px;padding:9px 11px}
#equipment .tools-for .tool a.inq:hover{background:var(--tool-fg);color:#fff}
#equipment .tools-for .tool.other{background:var(--ink);color:var(--paper);border-color:var(--ink)}
#equipment .tools-for .tool.other .txt{padding:28px 24px;min-height:220px;justify-content:center;gap:12px}
#equipment .tools-for .tool.other h4,#equipment .tools-for .tool.other .fn{color:var(--paper)}
#equipment .tools-for .tool.other a.inq{color:var(--paper);border-color:var(--paper)}
#equipment .tools-for .tool.other a.inq:hover{background:var(--accent);border-color:var(--accent);color:#0f0a14}
@media (prefers-reduced-motion:reduce){#equipment .tag{transition:none}}

/* Raul 18-nov: foto de estudio (render de Blender) en la tarjeta de cada herramienta */
#equipment .tools-for .tool .mini.foto{background:#e6e6e6;overflow:hidden}
#equipment .tools-for .tool .mini.foto img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;display:block}
#equipment .tools-for #tool-kelly-bar .mini.foto img{object-fit:contain}

#equipment .stage .carga{position:absolute;left:0;right:0;bottom:0;height:3px;background:#f26b21;transform-origin:0 50%;transform:scaleX(0);transition:transform .25s linear,opacity .4s .3s;pointer-events:none;z-index:3}#equipment .stage .carga.lista{opacity:0}
