/*
  Features 20 — standalone HTML/CSS/JS implementation.
  No build step, no framework, no external dependency: copy these three
  files into any project and open index.html as-is.
*/

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --white: #ffffff;
  --slate-50: #f8fafc;
  --slate-200: #e2e8f0;
  --slate-500: #64748b;
  --slate-900: #0f172a;
  --emerald-50: #ecfdf5;
  --emerald-500: rgba(16, 185, 129, 0.7);
  --emerald-600: #059669;
  --emerald-700: #047857;
  --font-sans:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji";
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--slate-900);
  background-color: var(--white);
  line-height: 1.5;
}

.features {
  padding: clamp(4rem, 3.5rem + 2vw, 6rem) clamp(1rem, 0.3rem + 3vw, 2rem);
}

.features__inner {
  width: 100%;
  max-width: 72rem;
  margin: 0 auto;
}

.layout {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: 2.5rem;
}

.kicker {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--emerald-600);
}

.heading {
  margin: 0.75rem 0 0;
  font-weight: 600;
  font-size: clamp(1.875rem, 1.5rem + 1.9vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.lede {
  margin: 1rem 0 0;
  max-width: 28rem;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--slate-500);
}

.module {
  border-radius: 1rem;
  border: 1px solid var(--slate-200);
  background-color: var(--slate-50);
  padding: 1.5rem;
}

.module__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.metric__value {
  margin: 0;
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.metric__label {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--slate-500);
}

.trend {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.25rem;
  border-radius: 999px;
  background-color: var(--emerald-50);
  padding: 0.375rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--emerald-700);
}

.trend svg {
  width: 0.75rem;
  height: 0.75rem;
}

.description {
  margin: 0.25rem 0 0;
  max-width: 24rem;
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--slate-500);
}

.chart {
  display: flex;
  height: 6rem;
  align-items: flex-end;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.bar {
  width: 100%;
  border-radius: 0.375rem 0.375rem 0 0;
  background-color: var(--emerald-500);
  transition: height 450ms cubic-bezier(0.16, 1, 0.3, 1);
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.pill {
  border: none;
  border-radius: 999px;
  background-color: var(--white);
  padding: 0.375rem 0.875rem;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--slate-500);
  cursor: pointer;
  transition:
    background-color 250ms ease,
    color 250ms ease;
}

.pill:hover {
  color: #334155;
}

.pill.is-active {
  background-color: var(--slate-900);
  color: var(--white);
}

.pill:focus-visible {
  outline: 2px solid var(--emerald-600);
  outline-offset: 2px;
}

@media (min-width: 1024px) {
  .layout {
    grid-template-columns: 2fr 3fr;
    gap: 4rem;
  }

  .module {
    padding: 2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bar {
    transition-duration: 1ms;
  }
}

/* Motion — the module's one-shot entrance and the metric's small pop are
   purely decorative and fully gated below; the bar-height and pill-color
   transitions above are functional state changes and stay on at a
   near-instant duration under reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  @keyframes al-features20-module {
    from {
      opacity: 0;
      transform: translateY(16px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  @keyframes al-features20-metric {
    from {
      opacity: 0;
      transform: translateY(4px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .module {
    animation: al-features20-module 600ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .metric.is-updating {
    animation: al-features20-metric 220ms ease both;
  }
}
