/*!
 * ENTRA 3D Product Gallery — viewer styles (homepage teaser + full gallery page)
 * Every rule is scoped to .emg-section / .emg so nothing leaks into the rest of the page.
 * Fonts reuse the homepage set (Space Grotesk, Inter, Cairo) — no extra font requests.
 */

/* ===== 1. Tokens ===== */
.emg-section, .emg {
  --emg-bg: #e9eef4;
  --emg-surface: #f5f8fb;
  --emg-surface-2: #ffffff;
  --emg-line: #cdd6e0;
  --emg-fg: #011548;          /* ENTRA navy */
  --emg-muted: #51607a;
  --emg-accent: #f36e21;      /* ENTRA orange */
  --emg-accent-ink: #011548;  /* text on orange (AA contrast) */
  --emg-accent-soft: rgba(243, 110, 33, .14);
  --emg-grid: #b9c6d2;
  --emg-glass: rgba(245, 248, 251, .88);
  --emg-shadow: 0 12px 32px rgba(1, 21, 72, .14);
  --emg-radius: 18px;
  --emg-f-display: "Space Grotesk", "Cairo", system-ui, sans-serif;
  --emg-f-body: "Inter", "Cairo", system-ui, sans-serif;
}

/* ===== 2. Section shell & heading ===== */
.emg-section { position: relative; z-index: 10; padding-block: 4rem 4.5rem; scroll-margin-top: 88px; }
.emg-head { max-width: 48rem; margin: 0 auto 2rem; text-align: center; }
.emg-eyebrow {
  display: inline-block; padding: .35rem .9rem; border-radius: 999px;
  border: 1px solid rgba(243, 110, 33, .4); background: rgba(243, 110, 33, .1);
  color: #c4530f; font: 700 .75rem/1.2 var(--emg-f-body); letter-spacing: .12em; text-transform: uppercase;
}
.emg-title { margin-top: 1rem; color: var(--emg-fg); font: 800 clamp(1.75rem, 3.6vw, 2.75rem)/1.1 var(--emg-f-display); letter-spacing: -.02em; text-wrap: balance; }
.emg-intro { margin-top: .9rem; color: var(--emg-muted); font: 400 1.0625rem/1.6 var(--emg-f-body); }

/* ===== 3. Gallery frame ===== */
.emg {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  height: clamp(560px, 80vh, 780px);
  background: var(--emg-bg); color: var(--emg-fg);
  border: 1px solid var(--emg-line); border-radius: 24px; box-shadow: var(--emg-shadow);
  font: 400 15px/1.45 var(--emg-f-body); -webkit-font-smoothing: antialiased;
  isolation: isolate;
}
.emg button { font: inherit; color: inherit; cursor: pointer; }
.emg svg { display: block; }
.emg :focus-visible { outline: 2px solid var(--emg-accent); outline-offset: 2px; }
.emg-ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ===== 4. 3D stage ===== */
.emg-stage { position: relative; flex: 1; min-height: 0; }
.emg-gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: pan-y; outline: none; }
.emg-gl.is-drag { cursor: grabbing; }

/* Hotspot pins */
.emg-pins { position: absolute; inset: 0; pointer-events: none; overflow: hidden; transition: opacity .25s; }
.emg-pins.is-off { opacity: 0; }
.emg--nolabels .emg-pins { display: none; }
.emg-pin { position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 8px; pointer-events: auto; will-change: transform; }
.emg-pin i { width: 12px; height: 12px; margin: -6px; flex: none; border-radius: 50%; background: var(--emg-accent); box-shadow: 0 0 0 4px var(--emg-accent-soft), 0 0 0 1px var(--emg-bg); }
.emg-pin-tag { margin-inline-start: 12px; max-width: 200px; padding: 5px 10px; border: 1px solid var(--emg-line); border-radius: 10px; background: var(--emg-glass); box-shadow: var(--emg-shadow); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.emg-pin b { display: block; font-size: 13px; font-weight: 600; line-height: 1.2; white-space: nowrap; }
.emg-pin em { display: block; max-height: 0; overflow: hidden; color: var(--emg-muted); font-size: 12px; font-style: normal; line-height: 1.3; transition: max-height .25s, margin .25s; }
.emg-pin:hover em, .emg-pin:focus-within em { max-height: 60px; margin-top: 3px; }
.emg-pin:hover, .emg-pin:focus-within { z-index: 3; }

/* ===== 5. Info card ===== */
.emg-info {
  position: absolute; z-index: 3; top: 16px; inset-inline-start: 16px;
  display: flex; flex-direction: column; gap: 12px;
  width: 340px; max-height: calc(100% - 32px); overflow: auto; padding: 18px 20px;
  border: 1px solid var(--emg-line); border-radius: var(--emg-radius);
  background: var(--emg-glass); box-shadow: var(--emg-shadow); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.emg-kick { color: #c4530f; font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-variant-numeric: tabular-nums; }
.emg-name { color: var(--emg-fg); font: 700 28px/1.02 var(--emg-f-display); letter-spacing: -.01em; text-transform: uppercase; text-wrap: balance; }
.emg[dir="rtl"] .emg-name { font-size: 26px; line-height: 1.25; text-transform: none; }
.emg-tagline { color: var(--emg-muted); font-size: 15px; }
.emg-variants { display: flex; flex-wrap: wrap; gap: 6px; }
.emg-vchip { height: 32px; padding: 0 11px; border: 1px solid var(--emg-line); border-radius: 9px; background: var(--emg-surface-2); font-size: 13px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.emg-vchip:hover { border-color: var(--emg-accent); }
.emg-vchip[aria-pressed="true"] { background: var(--emg-accent); border-color: var(--emg-accent); color: var(--emg-accent-ink); }
.emg-more-body { display: flex; flex-direction: column; gap: 12px; }
.emg-specs { display: grid; grid-template-columns: auto 1fr; border-top: 1px solid var(--emg-line); }
.emg-specs dt, .emg-specs dd { padding: 6px 0; border-bottom: 1px solid var(--emg-line); font-size: 14px; }
.emg-specs dt { display: flex; align-items: center; padding-inline-end: 16px; color: var(--emg-muted); font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; }
.emg-specs dd { text-align: end; font-weight: 600; font-variant-numeric: tabular-nums; }
.emg-uses-h { margin-bottom: 8px; color: var(--emg-muted); font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.emg-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.emg-chips span { padding: 3px 11px; border: 1px solid var(--emg-line); border-radius: 999px; background: var(--emg-surface-2); font-size: 13px; }
.emg-cta { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; border-radius: 11px; background: var(--emg-fg); color: #fff; font-weight: 600; text-decoration: none; transition: background-color .15s; }
.emg-cta:hover { background: #0a2a78; }
.emg-note { color: var(--emg-muted); font-size: 12px; }
.emg-more { display: none; }

/* ===== 6. Prev / next + hint ===== */
.emg-navbar { position: absolute; z-index: 2; bottom: 12px; left: 0; right: 0; display: flex; align-items: center; justify-content: center; gap: 14px; padding-inline-start: 372px; pointer-events: none; }
.emg-navbar > * { pointer-events: auto; }
.emg-edge { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border: 1px solid var(--emg-line); border-radius: 50%; background: var(--emg-glass); box-shadow: var(--emg-shadow); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.emg-edge:hover { background: var(--emg-surface-2); border-color: var(--emg-accent); }
.emg-edge .emg-ic { width: 22px; height: 22px; }
.emg[dir="rtl"] .emg-edge .emg-ic { transform: scaleX(-1); }
.emg-hint { padding: 4px 14px; border: 1px solid var(--emg-line); border-radius: 999px; background: var(--emg-glass); color: var(--emg-muted); font-size: 12.5px; white-space: nowrap; pointer-events: none; transition: opacity .6s; }
.emg-hint.is-hidden { opacity: 0; }

/* ===== 7. Dock: toolbar + system rail ===== */
.emg-dock { position: relative; z-index: 4; flex: none; display: flex; flex-direction: column; gap: 10px; padding: 10px 16px 12px; border-top: 1px solid var(--emg-line); background: var(--emg-bg); }
.emg-toolbar, .emg-rail { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.emg-toolbar::-webkit-scrollbar, .emg-rail::-webkit-scrollbar { display: none; }
.emg-toolbar { align-items: center; }
.emg-tool, .emg-speed { display: inline-flex; align-items: center; flex: none; height: 38px; padding: 0 12px; border: 1px solid var(--emg-line); border-radius: 10px; background: var(--emg-surface); font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.emg-tool { position: relative; overflow: hidden; gap: 7px; }
.emg-tool:hover { background: var(--emg-surface-2); }
.emg-tool[aria-pressed="true"] { background: var(--emg-accent-soft); border-color: var(--emg-accent); }
.emg-tool[aria-pressed="true"] .emg-ic { color: #c4530f; }
.emg-tool[data-emg-ref="tour"]::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: calc(var(--p, 0) * 100%); background: var(--emg-accent); }
.emg-speed { gap: 8px; }
.emg-speed output { min-width: 4.6em; color: var(--emg-muted); text-align: end; font-variant-numeric: tabular-nums; }
.emg-speed input { width: 110px; accent-color: var(--emg-accent); }
.emg-rail { gap: 8px; scroll-snap-type: x proximity; }
.emg-card { position: relative; flex: 1 1 0; display: flex; align-items: center; gap: 10px; min-width: 150px; height: 62px; padding: 0 12px; border: 1px solid var(--emg-line); border-radius: 12px; background: var(--emg-surface); text-align: start; scroll-snap-align: start; }
.emg-card:hover { background: var(--emg-surface-2); }
.emg-card svg { width: 30px; height: 30px; flex: none; fill: none; stroke: var(--emg-muted); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.emg-card span { font: 600 13.5px/1.15 var(--emg-f-display); letter-spacing: .01em; text-transform: uppercase; text-wrap: balance; }
.emg[dir="rtl"] .emg-card span { font: 700 14px/1.3 var(--emg-f-body); text-transform: none; }
.emg-card[aria-current="true"] { border-color: var(--emg-accent); background: var(--emg-surface-2); }
.emg-card[aria-current="true"] svg { stroke: var(--emg-accent); }
.emg-card[aria-current="true"]::after { content: ""; position: absolute; inset-inline: 12px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--emg-accent); }

/* ===== 8. Loading / failure ===== */
.emg-loading { position: absolute; inset: 0; z-index: 10; display: grid; place-items: center; padding: 24px; background: var(--emg-bg); text-align: center; transition: opacity .5s; }
.emg-loading.is-done { opacity: 0; pointer-events: none; }
.emg-loading p { margin-top: 12px; color: var(--emg-muted); }
.emg-spin { width: 34px; height: 34px; margin: 0 auto; border: 3px solid var(--emg-line); border-top-color: var(--emg-accent); border-radius: 50%; animation: emg-spin 1s linear infinite; }
@keyframes emg-spin { to { transform: rotate(360deg); } }
.emg--failed .emg-dock, .emg--failed .emg-info, .emg--failed .emg-navbar { display: none; }

/* ===== 9. Responsive ===== */
@media (max-width: 899px) {
  .emg-section { padding-block: 3rem; }
  .emg { height: clamp(600px, 88vh, 720px); border-radius: 18px; }
  .emg-info { top: 10px; inset-inline: 10px; width: auto; max-height: 56%; padding: 12px 14px; gap: 8px; }
  .emg-name { font-size: 22px; }
  .emg[dir="rtl"] .emg-name { font-size: 20px; }
  .emg-tagline { font-size: 13.5px; }
  .emg-more-body { display: none; }
  .emg-info.is-open .emg-more-body { display: flex; }
  .emg-more { display: inline-flex; align-self: flex-start; align-items: center; gap: 4px; padding: 0; border: 0; background: none; color: #c4530f; font-size: 13.5px; font-weight: 600; }
  .emg-navbar { justify-content: space-between; padding-inline: 12px; }
  .emg-edge { width: 42px; height: 42px; }
  .emg-hint, .emg-lbl { display: none; }
  .emg-tool { padding: 0 11px; }
  .emg-dock { padding-inline: 12px; }
  .emg-card { min-width: 136px; }
}
@media (max-width: 420px) { .emg-speed input { width: 84px; } }
@media (prefers-reduced-motion: reduce) {
  .emg *, .emg *::before, .emg *::after { animation: none !important; transition: none !important; }
}

/* ===== 10. V12: ENTRA branding, product link, fullscreen ===== */
.emg-watermark { position: absolute; z-index: 2; top: 14px; inset-inline-end: 14px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; max-width: 46%; pointer-events: none; user-select: none; }
.emg-watermark img { width: clamp(88px, 10vw, 132px); height: auto; padding: 6px 9px; border-radius: 9px; background: rgba(255, 255, 255, .82); opacity: .92; }
.emg-watermark span { padding: 2px 8px; border-radius: 6px; background: rgba(255, 255, 255, .7); color: var(--emg-muted); font-size: 10.5px; line-height: 1.35; text-align: end; }
.emg-gl { -webkit-user-drag: none; user-select: none; }
.emg-page { color: var(--emg-fg); font-size: 13.5px; font-weight: 700; text-align: center; text-decoration: none; }
.emg-page:hover { color: #c4530f; text-decoration: underline; }
.emg-variants[hidden] { display: none; }
.emg-more-link { margin-top: 1.5rem; text-align: center; }
.emg-card { min-width: 168px; }
.emg--fs { width: 100vw; height: 100vh !important; border: 0; border-radius: 0; }
.emg:fullscreen { width: 100vw; height: 100vh; border-radius: 0; }
@media (max-width: 899px) {
  .emg-watermark { top: auto; bottom: 64px; inset-inline-end: 10px; }
  .emg-watermark span { display: none; }
  .emg-watermark img { width: 84px; padding: 4px 6px; }
}
