/* ================================================================
   Advanced Glassmorphism — Frontend CSS
   Version 1.0.0
================================================================ */

/* ---- Wrapper ---- */
.agm-wrapper {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  isolation: isolate;
}

/* ---- WebGL canvas ---- */
.agm-canvas {
  display: block;
  width: 100%;
  position: relative;
  z-index: 1;
  border-radius: inherit;
}

/* ---- HTML overlay (accessibility layer + CSS blur) ---- */
.agm-html-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none; /* canvas handles 3D events; individual cards re-enable */
  perspective: 800px;
  perspective-origin: center center;
}

/* ---- Individual glass card (HTML layer) ---- */
.agm-card {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 16px;
  background: var(--card-tint, rgba(255,255,255,0.1));
  backdrop-filter: blur(var(--card-blur, 12px)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--card-blur, 12px)) saturate(160%);
  border: 1px solid rgba(255,255,255,0.25);
  box-shadow:
    0 8px 32px rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.4),
    inset 0 -1px 0 rgba(0,0,0,0.15);
  overflow: hidden;
  pointer-events: all;
  cursor: pointer;
  transition: box-shadow 0.3s ease;
  will-change: transform;
  transform-style: preserve-3d;
}

.agm-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    135deg,
    rgba(255,255,255,0.18) 0%,
    rgba(255,255,255,0.04) 50%,
    rgba(255,255,255,0.0) 100%
  );
  pointer-events: none;
}

.agm-card:hover {
  box-shadow:
    0 12px 48px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.6),
    inset 0 -1px 0 rgba(0,0,0,0.2),
    0 0 24px rgba(120,180,255,0.25);
}

/* ---- Card inner content ---- */
.agm-card-inner {
  position: relative;
  z-index: 1;
  padding: 24px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  color: #fff;
}

.agm-card-icon {
  font-size: 2rem;
  margin-bottom: 12px;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
}

.agm-card-icon svg,
.agm-card-icon i {
  width: 2rem;
  height: 2rem;
  color: #fff;
}

.agm-card-title {
  font-size: clamp(1rem, 2vw, 1.4rem);
  font-weight: 700;
  margin: 0 0 8px 0;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
  color: #fff;
  line-height: 1.3;
}

.agm-card-desc {
  font-size: clamp(0.78rem, 1.5vw, 0.95rem);
  margin: 0;
  color: rgba(255,255,255,0.82);
  line-height: 1.6;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

/* ---- Modal ---- */
.agm-modal {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.agm-modal--open {
  pointer-events: all;
  opacity: 1;
}

.agm-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  cursor: pointer;
}

.agm-modal-panel {
  position: relative;
  z-index: 2;
  width: min(90%, 640px);
  max-height: 80%;
  overflow-y: auto;
  border-radius: 20px;
  background: rgba(15,15,35,0.7);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.2);
  box-shadow:
    0 24px 80px rgba(0,0,0,0.6),
    inset 0 1px 0 rgba(255,255,255,0.35);
  padding: 36px;
  color: #fff;
  transform: scale(0.9);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.agm-modal--open .agm-modal-panel {
  transform: scale(1);
}

.agm-modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.agm-modal-close:hover {
  background: rgba(255,255,255,0.25);
}

.agm-modal-content {
  line-height: 1.7;
  font-size: 0.95rem;
  color: rgba(255,255,255,0.88);
}

.agm-modal-content h1,
.agm-modal-content h2,
.agm-modal-content h3 {
  color: #fff;
  margin-top: 0;
}

/* ---- Audio controls ---- */
.agm-audio-controls {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 10px;
}

.agm-audio-btn {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
  padding: 8px 18px;
  border-radius: 30px;
  cursor: pointer;
  font-size: 0.85rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.2s, transform 0.15s;
}

.agm-audio-btn:hover {
  background: rgba(255,255,255,0.25);
  transform: translateY(-2px);
}

/* ---- Scrollbar for modal ---- */
.agm-modal-panel::-webkit-scrollbar { width: 6px; }
.agm-modal-panel::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); border-radius: 3px; }
.agm-modal-panel::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.25); border-radius: 3px; }

/* ---- Frost overlay (CSS layer for low-perf fallback) ---- */
.agm-frost-overlay {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.15'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  pointer-events: none;
  opacity: 0.45;
  mix-blend-mode: overlay;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .agm-card-inner { padding: 16px; }
  .agm-modal-panel { padding: 24px; }
  .agm-audio-controls { bottom: 8px; }
}

/* ---- Elementor editor placeholder ---- */
.elementor-editor-active .agm-wrapper {
  min-height: 200px;
}
