/* =========================================================
   AINNA ESG Impact — compact strip + 3 animated utils
   1 Signal Route · 2 Carbon Pulse · 3 Efficiency Diff
   ESG palette: leaf / mint / teal / earth
   ========================================================= */

.ainna-esg {
  /* ESG palette */
  --esg-leaf: #16a34a;
  --esg-mint: #4ade80;
  --esg-teal: #0d9488;
  --esg-earth: #14532d;
  --esg-fog: #ecfdf5;
  --esg-stone: #a8a29e;
  --esg-stone-dim: #78716c;

  --esg-bg: #060a08;
  --esg-bg-elevated: #0c1410;
  --esg-surface: rgba(22, 163, 74, 0.06);
  --esg-border: rgba(74, 222, 128, 0.12);
  --esg-border-strong: rgba(74, 222, 128, 0.28);
  --esg-text: #f0fdf4;
  --esg-muted: #a7c4b0;
  --esg-dim: #6b8f78;
  --esg-line: rgba(74, 222, 128, 0.18);
  --esg-radius: 14px;
  --esg-max: 1120px;
  position: relative;
  background: var(--esg-bg);
  color: var(--esg-text);
  overflow: hidden;
  isolation: isolate;
}

html[data-theme="light"] .ainna-esg {
  --esg-bg: #f0fdf4;
  --esg-bg-elevated: #ffffff;
  --esg-surface: rgba(22, 163, 74, 0.05);
  --esg-border: rgba(20, 83, 45, 0.1);
  --esg-border-strong: rgba(22, 163, 74, 0.35);
  --esg-text: #14532d;
  --esg-muted: #3f6b52;
  --esg-dim: #3f6b52;
  --esg-line: rgba(22, 163, 74, 0.18);
}

.ainna-esg * {
  box-sizing: border-box;
}

/* ---- 2 · Carbon Pulse layers ---- */
.ainna-esg__bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 70% at 50% -5%, rgba(22, 163, 74, 0.14), transparent 55%),
    radial-gradient(ellipse 40% 40% at 90% 60%, rgba(13, 148, 136, 0.08), transparent 50%),
    radial-gradient(ellipse 35% 35% at 8% 80%, rgba(20, 83, 45, 0.2), transparent 50%);
}

html[data-theme="light"] .ainna-esg__bg {
  background:
    radial-gradient(ellipse 80% 70% at 50% -5%, rgba(22, 163, 74, 0.1), transparent 55%),
    radial-gradient(ellipse 40% 40% at 90% 60%, rgba(13, 148, 136, 0.06), transparent 50%);
}

.ainna-esg__pulse {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% 40%, rgba(74, 222, 128, 0.09), transparent 60%);
  animation: esg-carbon-pulse 5.5s ease-in-out infinite;
  opacity: 0.9;
}

html[data-theme="light"] .ainna-esg__pulse {
  background:
    radial-gradient(ellipse 60% 50% at 50% 40%, rgba(22, 163, 74, 0.08), transparent 60%);
}

@keyframes esg-carbon-pulse {
  0%, 100% { opacity: 0.45; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.04); }
}

.ainna-esg__inner {
  position: relative;
  z-index: 1;
  width: min(var(--esg-max), calc(100% - 48px));
  margin: 0 auto;
  padding: 48px 0 52px;
}

@media (max-width: 768px) {
  .ainna-esg__inner {
    width: min(var(--esg-max), calc(100% - 32px));
    padding: 36px 0 40px;
  }
}

/* ---- Reveal ---- */
.ainna-esg [data-esg-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: var(--esg-delay, 0ms);
}

.ainna-esg [data-esg-reveal].is-visible {
  opacity: 1;
  transform: none;
}

html[data-boost="1"] .ainna-esg [data-esg-reveal],
html[data-boost="true"] .ainna-esg [data-esg-reveal],
html.boost-active .ainna-esg [data-esg-reveal],
.ainna-esg.ainna-animations-paused [data-esg-reveal] {
  opacity: 1 !important;
  transform: none !important;
  transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .ainna-esg [data-esg-reveal] {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .ainna-esg__pulse {
    animation: none !important;
    opacity: 0.6;
  }
  .ainna-esg__track-dot {
    animation: none !important;
    left: 72% !important;
  }
  .ainna-esg__track-dot--slow {
    left: 88% !important;
  }
}

/* ---- Top: copy + CTAs ---- */
.ainna-esg__top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px 32px;
  margin-bottom: 28px;
}

.ainna-esg__copy {
  flex: 1 1 280px;
  min-width: 0;
  max-width: 54ch;
}

.ainna-esg__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--esg-leaf);
  margin: 0 0 10px;
}

html[data-theme="light"] .ainna-esg__eyebrow {
  color: var(--esg-earth);
}

.ainna-esg__eyebrow::before {
  content: "";
  width: 18px;
  height: 1px;
  background: var(--esg-leaf);
}

.ainna-esg__headline {
  font-size: clamp(1.5rem, 3.2vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0 0 10px;
  color: var(--esg-text);
  max-width: none;
}

.ainna-esg__body {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--esg-muted);
  margin: 0;
  max-width: 52ch;
}

.ainna-esg__cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  flex: 0 0 auto;
}

.ainna-esg__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 560;
  letter-spacing: -0.01em;
  text-decoration: none;
  transition:
    transform 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
  white-space: nowrap;
}

.ainna-esg__btn:hover {
  transform: translateY(-1px);
}

.ainna-esg__btn--primary {
  background: var(--esg-leaf);
  color: #fff;
  border: 1px solid transparent;
  box-shadow: 0 0 0 0 rgba(74, 222, 128, 0);
}

.ainna-esg__btn--primary:hover {
  background: #15803d;
  box-shadow: 0 0 24px rgba(74, 222, 128, 0.25);
}

html[data-theme="light"] .ainna-esg__btn--primary {
  background: var(--esg-leaf);
  color: #fff;
}

.ainna-esg__btn--ghost {
  background: transparent;
  color: var(--esg-mint);
  border: 1px solid var(--esg-border-strong);
}

html[data-theme="light"] .ainna-esg__btn--ghost {
  color: var(--esg-earth);
}

.ainna-esg__btn--ghost:hover {
  border-color: var(--esg-mint);
  box-shadow: 0 0 16px rgba(74, 222, 128, 0.12);
}

/* ---- Metrics strip + rings ---- */
.ainna-esg__metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  border: 1px solid var(--esg-border);
  border-radius: var(--esg-radius);
  background: var(--esg-surface);
  margin-bottom: 16px;
  overflow: hidden;
  position: relative;
}

.ainna-esg__metrics::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    105deg,
    transparent 30%,
    rgba(74, 222, 128, 0.06) 50%,
    transparent 70%
  );
  opacity: 0;
  transition: opacity 0.4s ease;
}

.ainna-esg__metrics.is-visible::before {
  opacity: 1;
  animation: esg-metric-sheen 2.2s ease 0.4s 1 both;
}

@keyframes esg-metric-sheen {
  from { transform: translateX(-40%); }
  to { transform: translateX(40%); }
}

.ainna-esg__metric {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-right: 1px solid var(--esg-border);
  min-width: 0;
  position: relative;
}

.ainna-esg__metric:last-child {
  border-right: none;
}

.ainna-esg__metric.is-pulsed {
  animation: esg-metric-pulse 0.7s ease;
}

@keyframes esg-metric-pulse {
  0% { background: transparent; }
  40% { background: rgba(74, 222, 128, 0.1); }
  100% { background: transparent; }
}

.ainna-esg__metric-copy {
  min-width: 0;
}

.ainna-esg__metric strong {
  display: block;
  font-size: clamp(1.25rem, 2.2vw, 1.65rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.1;
  color: var(--esg-mint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  margin-bottom: 4px;
}

html[data-theme="light"] .ainna-esg__metric strong {
  color: var(--esg-leaf);
}

.ainna-esg__metric strong .esg-arrow {
  font-weight: 400;
  color: var(--esg-dim);
  margin: 0 0.06em;
}

.ainna-esg__metric span {
  display: block;
  font-size: 12px;
  line-height: 1.35;
  color: var(--esg-dim);
}

/* Progress rings */
.ainna-esg__ring {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
}

.ainna-esg__ring-svg {
  width: 36px;
  height: 36px;
  transform: rotate(-90deg);
  display: block;
}

.ainna-esg__ring-track {
  stroke: rgba(74, 222, 128, 0.15);
  stroke-width: 2.5;
}

html[data-theme="light"] .ainna-esg__ring-track {
  stroke: rgba(22, 163, 74, 0.15);
}

.ainna-esg__ring-fill {
  stroke: var(--esg-mint);
  stroke-width: 2.5;
  stroke-linecap: round;
  /* circumference ≈ 97.4 for r=15.5 → use 100 for % math via pathLength */
  pathLength: 100;
  stroke-dasharray: 0 100;
  transition: stroke-dasharray 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.ainna-esg__ring-fill--teal {
  stroke: var(--esg-teal);
}

html[data-theme="light"] .ainna-esg__ring-fill {
  stroke: var(--esg-leaf);
}

html[data-theme="light"] .ainna-esg__ring-fill--teal {
  stroke: var(--esg-teal);
}

.ainna-esg__metrics.is-visible .ainna-esg__ring-fill[data-esg-ring="87"] {
  stroke-dasharray: 87 100;
}
.ainna-esg__metrics.is-visible .ainna-esg__ring-fill[data-esg-ring="66"] {
  stroke-dasharray: 66 100;
}
.ainna-esg__metrics.is-visible .ainna-esg__ring-fill[data-esg-ring="100"] {
  stroke-dasharray: 100 100;
}

@media (max-width: 900px) {
  .ainna-esg__metrics {
    grid-template-columns: 1fr 1fr;
  }

  .ainna-esg__metric:nth-child(2) {
    border-right: none;
  }

  .ainna-esg__metric:nth-child(1),
  .ainna-esg__metric:nth-child(2) {
    border-bottom: 1px solid var(--esg-border);
  }
}

@media (max-width: 480px) {
  .ainna-esg__metrics {
    grid-template-columns: 1fr;
  }

  .ainna-esg__metric {
    border-right: none;
    border-bottom: 1px solid var(--esg-border);
    padding: 14px 16px;
  }

  .ainna-esg__metric:last-child {
    border-bottom: none;
  }

  .ainna-esg__metric:nth-child(1),
  .ainna-esg__metric:nth-child(2) {
    border-bottom: 1px solid var(--esg-border);
  }
}

/* =========================================================
   1 · Signal Route
   ========================================================= */
.ainna-esg__compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

@media (max-width: 640px) {
  .ainna-esg__compare {
    grid-template-columns: 1fr;
  }
}

.ainna-esg__flow {
  border: 1px solid var(--esg-border);
  background: var(--esg-surface);
  border-radius: var(--esg-radius);
  padding: 14px 16px 16px;
  position: relative;
  overflow: hidden;
}

.ainna-esg__flow--legacy {
  border-color: rgba(168, 162, 158, 0.22);
  background: rgba(168, 162, 158, 0.05);
}

.ainna-esg__flow--neural {
  border-color: var(--esg-border-strong);
  background: linear-gradient(180deg, rgba(22, 163, 74, 0.12), var(--esg-surface));
  box-shadow: 0 0 0 1px rgba(74, 222, 128, 0.06), 0 12px 32px rgba(20, 83, 45, 0.18);
}

html[data-theme="light"] .ainna-esg__flow--neural {
  box-shadow: 0 8px 24px rgba(22, 163, 74, 0.08);
}

.ainna-esg__flow-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--esg-stone-dim);
  margin: 0 0 6px;
}

.ainna-esg__flow--neural .ainna-esg__flow-label {
  color: var(--esg-mint);
}

html[data-theme="light"] .ainna-esg__flow--neural .ainna-esg__flow-label {
  color: #15803d;
}

.ainna-esg__flow-line {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--esg-muted);
  letter-spacing: -0.01em;
}

.ainna-esg__flow--neural .ainna-esg__flow-line {
  color: var(--esg-text);
  font-weight: 500;
}

/* Track + signal dots */
.ainna-esg__track {
  position: relative;
  height: 14px;
  margin-top: 2px;
}

.ainna-esg__track-rail {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  transform: translateY(-50%);
  border-radius: 2px;
  background: linear-gradient(90deg, var(--esg-stone-dim), rgba(168, 162, 158, 0.35));
  opacity: 0.55;
}

.ainna-esg__track-rail--green {
  background: linear-gradient(90deg, var(--esg-leaf), var(--esg-mint), var(--esg-teal));
  opacity: 0.85;
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.25);
}

.ainna-esg__track-stops {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.ainna-esg__track-stops i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--esg-stone-dim);
  opacity: 0.7;
  box-shadow: 0 0 0 2px rgba(6, 10, 8, 0.6);
}

html[data-theme="light"] .ainna-esg__track-stops i {
  box-shadow: 0 0 0 2px rgba(240, 253, 244, 0.9);
}

.ainna-esg__track-stops--green i {
  background: var(--esg-mint);
  opacity: 1;
  box-shadow: 0 0 0 2px rgba(6, 10, 8, 0.5), 0 0 8px rgba(74, 222, 128, 0.4);
}

html[data-theme="light"] .ainna-esg__track-stops--green i {
  background: var(--esg-leaf);
  box-shadow: 0 0 0 2px #fff, 0 0 6px rgba(22, 163, 74, 0.35);
}

.ainna-esg__track-dot {
  position: absolute;
  top: 50%;
  left: 0;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  margin-left: -4px;
  border-radius: 50%;
  z-index: 1;
  opacity: 0;
}

.ainna-esg__track-dot--slow {
  background: var(--esg-stone);
  box-shadow: 0 0 8px rgba(168, 162, 158, 0.5);
}

.ainna-esg__track-dot--fast {
  background: var(--esg-mint);
  box-shadow: 0 0 12px rgba(74, 222, 128, 0.7);
  width: 9px;
  height: 9px;
  margin-top: -4.5px;
  margin-left: -4.5px;
}

html[data-theme="light"] .ainna-esg__track-dot--fast {
  background: var(--esg-leaf);
  box-shadow: 0 0 10px rgba(22, 163, 74, 0.55);
}

/* Run only when compare is visible */
.ainna-esg__compare.is-visible .ainna-esg__track-dot--slow {
  opacity: 1;
  animation: esg-signal-slow 3.6s ease-in-out infinite;
}

.ainna-esg__compare.is-visible .ainna-esg__track-dot--fast {
  opacity: 1;
  animation: esg-signal-fast 1.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes esg-signal-slow {
  0%   { left: 0%;   opacity: 0.4; }
  15%  { opacity: 1; }
  70%  { left: 78%;  opacity: 1; }
  85%  { left: 88%;  opacity: 0.85; }
  100% { left: 92%;  opacity: 0.3; }
}

@keyframes esg-signal-fast {
  0%   { left: 0%;   opacity: 0.5; }
  10%  { opacity: 1; }
  55%  { left: 68%;  opacity: 1; }
  100% { left: 100%; opacity: 0.35; }
}

/* =========================================================
   3 · Efficiency Diff
   ========================================================= */
.ainna-esg__diff {
  border: 1px solid var(--esg-border);
  border-radius: var(--esg-radius);
  background: rgba(6, 10, 8, 0.35);
  padding: 14px 16px 12px;
  margin-bottom: 16px;
}

html[data-theme="light"] .ainna-esg__diff {
  background: rgba(255, 255, 255, 0.65);
}

.ainna-esg__diff-row {
  display: grid;
  grid-template-columns: 88px 1fr minmax(0, 140px);
  gap: 10px 12px;
  align-items: center;
  margin-bottom: 10px;
}

@media (max-width: 640px) {
  .ainna-esg__diff-row {
    grid-template-columns: 72px 1fr;
  }

  .ainna-esg__diff-val {
    grid-column: 2;
    margin-top: -4px;
    margin-bottom: 4px;
  }
}

.ainna-esg__diff-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--esg-dim);
}

.ainna-esg__diff-row:last-of-type .ainna-esg__diff-label {
  color: var(--esg-mint);
}

html[data-theme="light"] .ainna-esg__diff-row:last-of-type .ainna-esg__diff-label {
  color: var(--esg-leaf);
}

.ainna-esg__diff-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  position: relative;
}

html[data-theme="light"] .ainna-esg__diff-bar {
  background: rgba(20, 83, 45, 0.08);
}

.ainna-esg__diff-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  transition: width 1.15s cubic-bezier(0.22, 1, 0.36, 1);
}

.ainna-esg__diff-fill--legacy {
  background: linear-gradient(90deg, var(--esg-stone-dim), var(--esg-stone));
  transition-delay: 0.1s;
}

.ainna-esg__diff-fill--neural {
  background: linear-gradient(90deg, var(--esg-leaf), var(--esg-mint));
  box-shadow: 0 0 12px rgba(74, 222, 128, 0.35);
  transition-delay: 0.25s;
}

.ainna-esg__diff.is-visible .ainna-esg__diff-fill--legacy {
  width: 100%;
}

.ainna-esg__diff.is-visible .ainna-esg__diff-fill--neural {
  width: 28%;
}

.ainna-esg__diff-val {
  font-size: 11.5px;
  color: var(--esg-dim);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 640px) {
  .ainna-esg__diff-val {
    text-align: left;
  }
}

.ainna-esg__diff-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 4px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--esg-border);
}

.ainna-esg__diff-tags span {
  font-size: 11.5px;
  color: var(--esg-muted);
  letter-spacing: -0.01em;
}

.ainna-esg__diff-tags span::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--esg-mint);
  margin-right: 7px;
  vertical-align: middle;
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.5);
}

html[data-theme="light"] .ainna-esg__diff-tags span::before {
  background: var(--esg-leaf);
}

/* ---- Closing one-liner ---- */
.ainna-esg__close-note {
  font-size: 13px;
  line-height: 1.45;
  color: var(--esg-dim);
  margin: 0;
  text-align: center;
  letter-spacing: -0.01em;
  position: relative;
  padding-top: 14px;
}

.ainna-esg__close-note::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 48px;
  height: 1px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, var(--esg-leaf), transparent);
}

/* ---- Boost / reduced motion ---- */
html[data-boost="1"] .ainna-esg *,
html[data-boost="true"] .ainna-esg *,
html.boost-active .ainna-esg *,
.ainna-esg.ainna-animations-paused * {
  animation: none !important;
  transition: none !important;
}

html[data-boost="1"] .ainna-esg__diff-fill--legacy,
html[data-boost="true"] .ainna-esg__diff-fill--legacy,
html.boost-active .ainna-esg__diff-fill--legacy,
.ainna-esg.ainna-animations-paused .ainna-esg__diff-fill--legacy {
  width: 100% !important;
}

html[data-boost="1"] .ainna-esg__diff-fill--neural,
html[data-boost="true"] .ainna-esg__diff-fill--neural,
html.boost-active .ainna-esg__diff-fill--neural,
.ainna-esg.ainna-animations-paused .ainna-esg__diff-fill--neural {
  width: 28% !important;
}

html[data-boost="1"] .ainna-esg__ring-fill[data-esg-ring="87"],
html[data-boost="true"] .ainna-esg__ring-fill[data-esg-ring="87"],
html.boost-active .ainna-esg__ring-fill[data-esg-ring="87"],
.ainna-esg.ainna-animations-paused .ainna-esg__ring-fill[data-esg-ring="87"] {
  stroke-dasharray: 87 100 !important;
}

html[data-boost="1"] .ainna-esg__ring-fill[data-esg-ring="66"],
html[data-boost="true"] .ainna-esg__ring-fill[data-esg-ring="66"],
html.boost-active .ainna-esg__ring-fill[data-esg-ring="66"],
.ainna-esg.ainna-animations-paused .ainna-esg__ring-fill[data-esg-ring="66"] {
  stroke-dasharray: 66 100 !important;
}

html[data-boost="1"] .ainna-esg__ring-fill[data-esg-ring="100"],
html[data-boost="true"] .ainna-esg__ring-fill[data-esg-ring="100"],
html.boost-active .ainna-esg__ring-fill[data-esg-ring="100"],
.ainna-esg.ainna-animations-paused .ainna-esg__ring-fill[data-esg-ring="100"] {
  stroke-dasharray: 100 100 !important;
}

html[data-boost="1"] .ainna-esg__pulse,
html[data-boost="true"] .ainna-esg__pulse,
html.boost-active .ainna-esg__pulse,
.ainna-esg.ainna-animations-paused .ainna-esg__pulse {
  opacity: 0.55;
  transform: none;
}
