/* ══ Dimensione IV — Borse Mondiali (realistic glass + depth) ══ */

.dim-iv {
  position: relative;
  overflow: hidden;
  padding: 3.5rem 0 3rem;
  color: #14532d;
  background: linear-gradient(160deg, #ecfdf5 0%, #e0f2fe 45%, #f0fdf4 100%);
}
.dim-iv::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 50% 40% at 85% 20%, rgba(52, 211, 153, 0.12), transparent),
    radial-gradient(ellipse 40% 35% at 10% 80%, rgba(245, 158, 11, 0.08), transparent);
  pointer-events: none;
}

.dim-iv-stage {
  position: relative;
  z-index: 1;
  text-align: center;
}

.dim-iv-header { margin-bottom: 1.75rem; }
.dim-iv-roman {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: 0.75rem;
  font-family: var(--serif);
  font-size: 1.25rem;
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 10px;
  background: linear-gradient(145deg, #fff 0%, #f0fdf4 100%);
  box-shadow:
    0 2px 4px rgba(5, 150, 105, 0.08),
    0 8px 20px rgba(5, 150, 105, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.dim-iv-eyebrow {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #059669;
  margin-bottom: 0.5rem;
}
.dim-iv-header h2 {
  font-family: var(--serif);
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  font-weight: 400;
  line-height: 1.15;
  margin: 0 0 0.5rem;
  color: #14532d;
}
.dim-iv-header h2 em { font-style: italic; color: #059669; }
.dim-iv-header p {
  color: #4b6b55;
  font-size: 0.95rem;
  max-width: 440px;
  margin-inline: auto;
  line-height: 1.5;
}

/* Portal — glass card with depth */
.dim-iv-portal {
  position: relative;
  display: block;
  width: 100%;
  max-width: 680px;
  margin: 0 auto 1.25rem;
  padding: 0;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  text-align: left;
  background: linear-gradient(155deg, rgba(255,255,255,0.95) 0%, rgba(240,253,244,0.88) 100%);
  box-shadow:
    0 1px 2px rgba(5, 80, 60, 0.06),
    0 8px 24px rgba(5, 150, 105, 0.12),
    0 20px 48px rgba(14, 116, 144, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 1),
    inset 0 -1px 0 rgba(5, 150, 105, 0.06);
  overflow: hidden;
  transition: box-shadow 0.4s ease, transform 0.4s ease;
}
.dim-iv-portal::after {
  content: "";
  position: absolute;
  top: 0;
  left: 8%;
  right: 8%;
  height: 45%;
  border-radius: 0 0 50% 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.55) 0%, transparent 100%);
  pointer-events: none;
  z-index: 2;
}
.dim-iv-portal:hover {
  transform: translateY(-3px);
  box-shadow:
    0 2px 4px rgba(5, 80, 60, 0.08),
    0 14px 32px rgba(5, 150, 105, 0.18),
    0 28px 56px rgba(14, 116, 144, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 1),
    inset 0 -1px 0 rgba(5, 150, 105, 0.08);
}
.dim-iv-portal:focus-visible {
  outline: 2px solid #10b981;
  outline-offset: 4px;
}

.dim-iv-portal-glow {
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 25%, rgba(255,255,255,0.5) 48%, transparent 72%);
  background-size: 220% 100%;
  animation: dim-iv-shimmer 5s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}
@keyframes dim-iv-shimmer {
  0%, 100% { background-position: 220% 0; opacity: 0.4; }
  50% { background-position: -220% 0; opacity: 0.85; }
}

.dim-iv-portal-body {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1rem 1.35rem;
  min-height: 118px;
}

.dim-iv-portal-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding-left: 0.25rem;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}
.dim-iv-live-row {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: #059669;
}
.dim-iv-live {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
  animation: dim-iv-pulse 1.8s ease-in-out infinite;
}
@keyframes dim-iv-pulse {
  0%, 100% { box-shadow: 0 0 4px rgba(16, 185, 129, 0.5); }
  50% { box-shadow: 0 0 10px rgba(16, 185, 129, 0.9), 0 0 0 4px rgba(16, 185, 129, 0.15); }
}
.dim-iv-portal-title {
  font-family: var(--serif);
  font-size: 1.35rem;
  color: #14532d;
  line-height: 1.2;
}
.dim-iv-portal-action {
  font-size: 0.78rem;
  font-weight: 600;
  color: #b45309;
  margin-top: 0.15rem;
  transition: color 0.2s;
}
.dim-iv-portal:hover .dim-iv-portal-action { color: #059669; }

/* Chart panel — realistic screen with bezel + reflection */
.dim-iv-chart-panel {
  position: relative;
  flex-shrink: 0;
  width: 220px;
  height: 108px;
  padding: 5px;
  border-radius: 14px;
  background: linear-gradient(145deg, #d1fae5 0%, #a7f3d0 35%, #6ee7b7 100%);
  box-shadow:
    0 2px 4px rgba(5, 80, 60, 0.15),
    0 8px 20px rgba(5, 150, 105, 0.22),
    0 16px 32px rgba(4, 120, 87, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    inset 0 -2px 6px rgba(4, 120, 87, 0.2);
}
.dim-iv-chart-frame {
  position: absolute;
  inset: 4px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: inset 0 0 0 1px rgba(4, 120, 87, 0.15);
  pointer-events: none;
  z-index: 4;
}
.dim-iv-chart-shine {
  position: absolute;
  inset: 5px;
  border-radius: 10px;
  overflow: hidden;
  pointer-events: none;
  z-index: 5;
}
.dim-iv-chart-shine::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 42%;
  background: linear-gradient(180deg, rgba(255,255,255,0.42) 0%, rgba(255,255,255,0.08) 60%, transparent 100%);
  border-radius: 10px 10px 40% 40%;
}
.dim-iv-chart-shine::after {
  content: "";
  position: absolute;
  top: -60%;
  left: -30%;
  width: 50%;
  height: 200%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
  transform: rotate(18deg);
  animation: iv-glass-sweep 4s ease-in-out infinite;
}
@keyframes iv-glass-sweep {
  0%, 100% { left: -50%; opacity: 0; }
  45%, 55% { left: 90%; opacity: 1; }
}
.dim-iv-chart-scan {
  position: absolute;
  inset: 5px;
  border-radius: 10px;
  overflow: hidden;
  pointer-events: none;
  z-index: 6;
}
.dim-iv-chart-scan::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(52, 211, 153, 0.5), transparent);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.4);
  animation: iv-scan-line 3.5s ease-in-out infinite;
}
@keyframes iv-scan-line {
  0%, 100% { top: 8%; opacity: 0; }
  8% { opacity: 1; }
  92% { opacity: 1; }
  100% { top: 92%; opacity: 0; }
}

.dim-iv-chart {
  position: relative;
  z-index: 3;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 10px;
}

.dim-iv-chart .iv-screen {
  fill: linear-gradient(180deg, #f8fafc, #ecfdf5);
  fill: #f1f5f9;
  filter: drop-shadow(0 1px 2px rgba(4, 47, 46, 0.08));
}
.dim-iv-chart .iv-grid {
  stroke: rgba(5, 150, 105, 0.1);
  stroke-width: 0.75;
}
.dim-iv-chart .iv-axis {
  stroke: rgba(4, 120, 87, 0.35);
  stroke-width: 1.25;
  stroke-linecap: round;
}
.dim-iv-chart .iv-area {
  fill: url(#ivGrad);
  animation: iv-area-breathe 4s ease-in-out infinite;
}
@keyframes iv-area-breathe {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 0.95; }
}

.dim-iv-chart .iv-candle-up rect { fill: url(#ivCandleUp); }
.dim-iv-chart .iv-candle-down rect { fill: url(#ivCandleDown); }
.dim-iv-chart .iv-candle-up .iv-wick { stroke: #34d399; }
.dim-iv-chart .iv-candle-down .iv-wick { stroke: #f87171; }
.dim-iv-chart .iv-wick {
  stroke-width: 1.5;
  stroke-linecap: round;
}
.dim-iv-chart .iv-candle {
  transform-box: fill-box;
  transform-origin: center bottom;
  animation: iv-candle-tick 2.8s ease-in-out infinite;
}
.dim-iv-chart .iv-candle:nth-of-type(1) { animation-delay: 0s; }
.dim-iv-chart .iv-candle:nth-of-type(2) { animation-delay: 0.2s; }
.dim-iv-chart .iv-candle:nth-of-type(3) { animation-delay: 0.4s; }
.dim-iv-chart .iv-candle:nth-of-type(4) { animation-delay: 0.6s; }
.dim-iv-chart .iv-candle:nth-of-type(5) { animation-delay: 0.8s; }
.dim-iv-chart .iv-candle:nth-of-type(6) { animation-delay: 1s; }
.dim-iv-chart .iv-candle:nth-of-type(7) { animation-delay: 1.2s; }
@keyframes iv-candle-tick {
  0%, 100% { transform: scaleY(0.88) translateY(2px); }
  25% { transform: scaleY(1.04) translateY(-1px); }
  50% { transform: scaleY(0.94) translateY(1px); }
  75% { transform: scaleY(1.02) translateY(0); }
}

.dim-iv-chart .iv-line {
  fill: none;
  stroke: #d97706;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 280;
  stroke-dashoffset: 280;
  animation: iv-line-live 4s ease-in-out infinite;
  filter: drop-shadow(0 1px 2px rgba(217, 119, 6, 0.35));
}
@keyframes iv-line-live {
  0%, 12% { stroke-dashoffset: 280; }
  50%, 78% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 0; }
}
.dim-iv-chart .iv-tip {
  fill: #f59e0b;
  filter: drop-shadow(0 0 3px rgba(245, 158, 11, 0.7));
  animation: iv-tip-pulse 2s ease-in-out infinite;
}
.dim-iv-chart .iv-tip-ring {
  fill: none;
  stroke: #fbbf24;
  stroke-width: 1;
  opacity: 0;
  animation: iv-ring-expand 2s ease-out infinite;
}
@keyframes iv-tip-pulse {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; }
}
@keyframes iv-ring-expand {
  0% { r: 4; opacity: 0.6; }
  100% { r: 12; opacity: 0; }
}
.dim-iv-chart .iv-price {
  fill: #059669;
  font-size: 9px;
  font-weight: 700;
  font-family: system-ui, sans-serif;
  filter: drop-shadow(0 1px 1px rgba(255,255,255,0.8));
  animation: iv-price-flash 3s ease-in-out infinite;
}
@keyframes iv-price-flash {
  0%, 100% { opacity: 0.75; }
  50% { opacity: 1; }
}

.dim-iv-ticker {
  position: relative;
  z-index: 3;
  display: block;
  overflow: hidden;
  border-top: 1px solid rgba(16, 185, 129, 0.12);
  background: linear-gradient(180deg, rgba(236,253,245,0.5), rgba(224,242,254,0.4));
  padding: 0.45rem 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
}
.dim-iv-ticker-track {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: #6b8f7a;
  white-space: nowrap;
  animation: dim-iv-ticker 22s linear infinite;
}
@keyframes dim-iv-ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.dim-iv-foot {
  font-size: 0.82rem;
  color: #6b8f7a;
}
.dim-iv-foot a {
  color: #b45309 !important;
  font-weight: 600;
  text-decoration: none;
  margin-left: 0.35rem;
}
.dim-iv-foot a:hover { color: #059669 !important; }

@media (max-width: 560px) {
  .dim-iv-portal-body {
    flex-direction: column;
    align-items: stretch;
    min-height: auto;
    padding: 1rem;
  }
  .dim-iv-chart-panel {
    width: 100%;
    height: 100px;
  }
  .dim-iv-portal-info { text-align: center; align-items: center; }
}