/* Discount Velocity v1.0.3
 * Bug-fix: removed dead @media (min-width: 769px) { .dv-strip { flex-direction: column } }
 * which was identical to the default and had no effect.
 * Bug-fix: added color-scheme to .dv-wrapper for light mode normalisation.
 */
.dv-wrapper * { box-sizing: border-box !important; }
.dv-wrapper a { line-height: inherit !important; text-decoration: none !important; }

:root {
    --brand-primary: #20C997;
    --brand-primary-dark: #1AA67D;
    --dv-up-accent: #20C997;
    --dv-stable-accent: #6366f1;
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
    --radius-md: 12px;
    --radius-pill: 9999px;
    --font-primary: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --transition-base: 250ms ease;
}

/* Bug-fix: added color-scheme: light so browser renders scrollbars and form
   controls correctly in light mode, matching the dark-mode override below. */
.dv-wrapper { font-family: var(--font-primary); max-width: 100%; margin: 0 0 2rem; color-scheme: light; }
.dv-header { margin-bottom: 1rem; }
.dv-heading { font-size: 1.25rem; font-weight: 700; color: #111827; margin: 0 0 0.25rem; display: flex; align-items: center; gap: 0.5rem; line-height: 1.3; }
.dv-icon { font-size: 1.1rem; }
.dv-subtitle { font-size: 0.85rem; color: #6b7280; margin: 0; }

/* Strip */
.dv-strip { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }

/* Card */
.dv-card { display: flex; align-items: center; gap: 0.75rem; background: #fff; border-radius: var(--radius-md); padding: 0.75rem 1rem; box-shadow: var(--shadow-md); transition: transform var(--transition-base), box-shadow var(--transition-base); position: relative; }
.dv-card:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(0,0,0,0.09), 0 2px 6px rgba(0,0,0,0.05); }

/* Accent bar — top edge colour by type */
.dv-card-up::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--dv-up-accent); border-radius: var(--radius-md) var(--radius-md) 0 0; }
.dv-card-stable::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--dv-stable-accent); border-radius: var(--radius-md) var(--radius-md) 0 0; }
/* Green inset border for improving */
.dv-card-up { box-shadow: var(--shadow-md), inset 0 0 0 1.5px rgba(32,201,151,0.18); }
.dv-rank { font-size: 1.5rem; font-weight: 800; color: #d1d5db; min-width: 2rem; text-align: center; line-height: 1; flex-shrink: 0; }
.dv-card:nth-child(1) .dv-rank { color: #fbbf24; }
.dv-card:nth-child(2) .dv-rank { color: #9ca3af; }
.dv-card:nth-child(3) .dv-rank { color: #cd7f32; }
.dv-card-body { flex: 1; min-width: 0; }
.dv-card-top { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.4rem; }
.dv-brand-name { font-size: 0.95rem; font-weight: 700; color: #111827; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dv-trend-badge { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.03em; padding: 0.15em 0.6em; border-radius: var(--radius-pill); white-space: nowrap; flex-shrink: 0; background: #f0fdf4; color: #15803d; }
.dv-card-stable .dv-trend-badge { background: #ede9fe; color: #6d28d9; }
/* Progress bar */
.dv-bar-wrap { height: 4px; background: #f3f4f6; border-radius: 2px; overflow: hidden; margin-bottom: 0.4rem; }
.dv-bar-fill { height: 100%; background: linear-gradient(90deg, var(--dv-up-accent), var(--brand-primary-dark)); border-radius: 2px; transition: width 0.6s cubic-bezier(0.16,1,0.3,1); }
.dv-card-stable .dv-bar-fill { background: linear-gradient(90deg, var(--dv-stable-accent), #818cf8); }
.dv-card-meta { display: flex; align-items: center; gap: 0.5rem; }
.dv-pct { font-size: 0.8rem; font-weight: 700; color: var(--brand-primary-dark); }
.dv-signal { font-size: 0.85rem; cursor: default; }
/* CTA */
.dv-cta { display: inline-block; font-size: 0.8rem; font-weight: 600; color: #374151; white-space: nowrap; flex-shrink: 0; padding: 0.65rem 0.9rem; border-radius: var(--radius-pill); border: none; box-shadow: inset 0 0 0 1.5px #d1d5db, 0 1px 2px rgba(0,0,0,0.04); transition: box-shadow var(--transition-base), color var(--transition-base); min-height: 44px; text-align: center; line-height: 1.6; }
.dv-cta:hover { box-shadow: inset 0 0 0 1.5px var(--brand-primary), 0 1px 2px rgba(0,0,0,0.04); color: var(--brand-primary-dark); }

/* Bug-fix: removed dead rule — @media (min-width: 769px) { .dv-strip { flex-direction: column } }
   was identical to the default flex-direction: column already set on .dv-strip
   and had zero effect. */

@media (max-width: 480px) {
    .dv-card { flex-wrap: wrap; }
    .dv-cta { width: 100%; text-align: center; margin-top: 0.5rem; }
}

@media (prefers-color-scheme: dark) {
    .dv-wrapper { color-scheme: dark; }
    .dv-heading { color: #f9fafb; }
    /* BUG FIX v1.0.1: .dv-subtitle had no dark override — #6b7280 on dark bg = 3.6:1 (WCAG fail). */
    .dv-subtitle { color: #9ca3af; }
    .dv-card { background: #1f2937; }
    .dv-brand-name { color: #f9fafb; }
    .dv-bar-wrap { background: #374151; }
    .dv-cta { color: #d1d5db; box-shadow: inset 0 0 0 1.5px #4b5563, 0 1px 2px rgba(0,0,0,0.3); }
    .dv-cta:hover { color: var(--brand-primary); box-shadow: inset 0 0 0 1.5px var(--brand-primary), 0 1px 2px rgba(0,0,0,0.3); }
    .dv-trend-badge { background: rgba(32,201,151,0.15); color: #6ee7b7; }
    .dv-card-stable .dv-trend-badge { background: rgba(99,102,241,0.15); color: #a5b4fc; }
    /* BUG FIX v1.0.3: .dv-pct had no dark override — #1AA67D on #1f2937 = ~4.0:1 (WCAG AA fail for 0.8rem text).
       Changed to #6ee7b7 (~8.3:1 on #1f2937). */
    .dv-pct { color: #6ee7b7; }
}

/* BUG FIX v1.0.2: :focus-visible styles for keyboard navigation (WCAG 2.4.7). */
.dv-cta:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
    box-shadow: inset 0 0 0 1.5px var(--brand-primary), 0 0 0 4px rgba(32,201,151,0.25);
}

@media (prefers-reduced-motion: reduce) {
    .dv-card, .dv-bar-fill, .dv-cta { transition: none; }
}
