/* ==========================================================================
   PhilTech Interactive Lab — фирменные виджеты 2D/3D
   ========================================================================== */

.philtech-widget {
  --pt-ink: #0a1224;
  --pt-bg: #ffffff;
  --pt-paper: #ecf1f7;
  --pt-teal: #43b5a0;
  --pt-cyan: #5ce1e6;
  --pt-pink: #fa448c;
  --pt-violet: #491d88;
  --pt-amber: #f59e0b;
  --pt-border: 3px solid var(--pt-ink);
  --pt-shadow: 8px 8px 0 var(--pt-ink);
  --pt-mono: "JetBrains Mono", "Cascadia Mono", Consolas, ui-monospace, monospace;
  --pt-sans: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  position: relative;
  margin: 28px 0;
  overflow: hidden;
  border: var(--pt-border);
  border-radius: 4px;
  background: var(--pt-bg);
  box-shadow: var(--pt-shadow);
  color: var(--pt-ink);
  font-family: var(--pt-sans);
}

.philtech-widget::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(10, 18, 36, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(10, 18, 36, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.5;
}

.philtech-widget__head {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 3px solid var(--pt-ink);
  background: var(--pt-ink);
  color: #fff;
}

.philtech-widget__tag {
  display: inline-block;
  padding: 3px 8px;
  border: 2px solid var(--pt-cyan);
  background: rgba(92, 225, 230, 0.14);
  color: var(--pt-cyan);
  font-family: var(--pt-mono);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.philtech-widget__tag--2d {
  border-color: var(--pt-teal);
  color: var(--pt-teal);
  background: rgba(67, 181, 160, 0.16);
}

.philtech-widget__title {
  font-family: "Archivo Black", "Arial Black", Impact, sans-serif;
  font-size: 13px;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.philtech-widget__hint {
  position: relative;
  z-index: 2;
  padding: 8px 14px;
  border-top: 1px dashed rgba(10, 18, 36, 0.22);
  background: #f6f9fd;
  color: #43566d;
  font-family: var(--pt-mono);
  font-size: 11px;
  line-height: 1.5;
}

.philtech-widget__caption {
  position: relative;
  z-index: 2;
  padding: 10px 14px;
  border-top: 2px solid var(--pt-ink);
  background: #fff8e6;
  color: #4a3500;
  font-size: 12.5px;
  line-height: 1.55;
}

/* ------------------------------- 3D ---------------------------------- */
.philtech-stage {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 280px;
  aspect-ratio: 16 / 10;
  background: var(--pt-ink);
  outline: none;
  cursor: grab;
  overflow: hidden;
}

.philtech-stage:focus-visible {
  box-shadow: inset 0 0 0 4px var(--pt-cyan);
}

.philtech-stage canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.philtech-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.philtech-label {
  position: absolute;
  top: 0;
  left: 0;
  padding: 2px 6px;
  border: 1px solid rgba(92, 225, 230, 0.35);
  background: rgba(10, 18, 36, 0.72);
  color: var(--pt-cyan);
  font-family: var(--pt-mono);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
  transition: opacity 0.12s linear;
}

.philtech-label[data-kind="title"] {
  border-color: var(--pt-teal);
  background: var(--pt-teal);
  color: #06170f;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.philtech-modes {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 2px solid var(--pt-ink);
  background: var(--pt-paper);
}

.philtech-mode {
  padding: 6px 12px;
  border: 2px solid var(--pt-ink);
  background: #fff;
  color: var(--pt-ink);
  font-family: var(--pt-mono);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.1s ease;
}

.philtech-mode:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--pt-ink);
}

.philtech-mode.is-active {
  background: var(--pt-cyan);
  box-shadow: 3px 3px 0 var(--pt-ink);
}

/* ------------------------------- 2D ---------------------------------- */
.philtech-2d-stage {
  position: relative;
  z-index: 1;
  padding: 14px;
  background: #fff;
}

.philtech-2d-stage svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.philtech-hotspot {
  position: absolute;
  z-index: 3;
  padding: 0;
  border: 2px dashed transparent;
  border-radius: 50%;
  background: transparent;
  transform: translate(-50%, -50%);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.philtech-hotspot:hover,
.philtech-hotspot:focus-visible {
  border-color: var(--pt-pink);
  background: rgba(250, 68, 140, 0.12);
  outline: none;
}

.philtech-tooltip {
  position: absolute;
  z-index: 6;
  width: min(280px, calc(100% - 16px));
  padding: 10px 12px;
  border: 3px solid var(--pt-ink);
  background: var(--pt-ink);
  color: #e8f4ff;
  font-family: var(--pt-sans);
  font-size: 12.5px;
  line-height: 1.45;
  box-shadow: 6px 6px 0 var(--pt-pink);
  transform: translate(-50%, -100%);
  pointer-events: none;
}

.philtech-tooltip strong {
  display: block;
  margin-bottom: 4px;
  color: var(--pt-cyan);
  font-family: var(--pt-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.philtech-tooltip span {
  display: block;
  color: #dbe9f7;
}

/* ---------------------------- Контролы ------------------------------- */
.philtech-controls {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
  align-items: center;
  padding: 12px 14px;
  border-top: 2px solid var(--pt-ink);
  background: var(--pt-paper);
}

.philtech-control {
  display: flex;
  flex: 1 1 180px;
  flex-direction: column;
  gap: 6px;
  min-width: 140px;
}

.philtech-control__label {
  display: flex;
  gap: 6px;
  align-items: baseline;
  color: var(--pt-ink);
  font-family: var(--pt-mono);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.philtech-control__value {
  padding: 1px 6px;
  background: var(--pt-ink);
  color: var(--pt-cyan);
  font-size: 10.5px;
}

.philtech-range {
  width: 100%;
  height: 22px;
  accent-color: var(--pt-teal);
  cursor: pointer;
}

.philtech-select {
  width: 100%;
  padding: 6px 8px;
  border: 2px solid var(--pt-ink);
  border-radius: 2px;
  background: #fff;
  color: var(--pt-ink);
  font-family: var(--pt-sans);
  font-size: 12.5px;
  font-weight: 600;
}

/* ---------------------------- Fallback ------------------------------- */
.philtech-fallback {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 18px 16px;
  border-top: 2px solid var(--pt-ink);
  background: #fff3f8;
  color: #7a1240;
  font-size: 13px;
}

.philtech-fallback__tag {
  padding: 2px 7px;
  background: var(--pt-pink);
  color: #fff;
  font-family: var(--pt-mono);
  font-size: 10px;
  font-weight: 800;
}

@media (max-width: 700px) {
  .philtech-widget {
    margin: 20px 0;
    box-shadow: 5px 5px 0 var(--pt-ink);
  }

  .philtech-stage {
    min-height: 220px;
    aspect-ratio: 4 / 3;
  }

  .philtech-2d-stage {
    padding: 8px;
  }

  .philtech-tooltip {
    transform: translate(-50%, -100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .philtech-mode,
  .philtech-hotspot {
    transition: none;
  }
}
