/* Line 41: high-tech dashboard / HUD layer over styles.css. Own CSS and SVG only, no external fonts or images.
   Keeps the plug-type tint (--plug-bg / --plug-accent from line 37). Text sits on solid dark panels so body text stays
   at least 4.5:1 (measured by tools/qa-line41.mjs). Every animation here is off under prefers-reduced-motion. */
:root {
  --hud-mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, "DejaVu Sans Mono", "Liberation Mono", monospace;
  --hud-panel: rgba(3, 14, 26, 0.92);
  --hud-line: color-mix(in srgb, var(--plug-accent, #00D4F8) 42%, transparent);
  --hud-glow: color-mix(in srgb, var(--plug-accent, #00D4F8) 22%, transparent);
  --hud-corner: var(--plug-accent, #00D4F8);
}

/* Subtle page grid + scanlines, behind everything (z -1, like the plug art). */
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.022) 0 1px, transparent 1px 3px),
    linear-gradient(color-mix(in srgb, var(--plug-accent, #00D4F8) 7%, transparent) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(90deg, color-mix(in srgb, var(--plug-accent, #00D4F8) 7%, transparent) 1px, transparent 1px) 0 0 / 48px 48px;
}

/* Header: glass bar with a glowing baseline. */
.site-header { border-bottom: 1px solid var(--hud-line); box-shadow: 0 1px 18px var(--hud-glow); }
.wordmark { letter-spacing: 0.06em; text-transform: uppercase; font-size: 1.05rem; }
.nav-links a { font-family: var(--hud-mono); font-size: 0.86rem; letter-spacing: 0.04em; text-transform: uppercase; }
.lang-toggle button { font-family: var(--hud-mono); }

/* Kickers and headings read like HUD labels. */
.kicker { font-family: var(--hud-mono); letter-spacing: 0.16em; }
.kicker > span:last-child::before { content: "// "; opacity: 0.7; }
.section h2 { text-shadow: 0 0 22px var(--hud-glow); }

/* Hero: grid + moving scan band + reticle, all decorative. The plug tint/art from line 37 stays underneath. */
.hud-grid {
  position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden;
  background:
    linear-gradient(color-mix(in srgb, var(--plug-accent, #00D4F8) 10%, transparent) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(90deg, color-mix(in srgb, var(--plug-accent, #00D4F8) 10%, transparent) 1px, transparent 1px) 0 0 / 40px 40px;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 45%, #000 100%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 45%, #000 100%);
}
.hud-grid::after {
  content: ""; position: absolute; left: 0; right: 0; top: -30%; height: 30%;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--plug-accent, #00D4F8) 14%, transparent) 70%, color-mix(in srgb, var(--plug-accent, #00D4F8) 35%, transparent) 99%, transparent);
  animation: hud-scan 7s linear infinite;
}
@keyframes hud-scan { from { transform: translateY(0); } to { transform: translateY(440%); } }
.hud-reticle {
  position: absolute; z-index: 1; pointer-events: none; right: 6%; top: 14%; width: min(34vw, 360px); height: auto; opacity: 0.55;
  fill: none; stroke: var(--plug-accent, #00D4F8); filter: drop-shadow(0 0 6px var(--hud-glow));
}
.hud-ret-ring { stroke-width: 1; opacity: 0.6; }
.hud-ret-inner { opacity: 0.35; }
.hud-ret-dash { stroke-width: 3; opacity: 0.7; transform-origin: 100px 100px; animation: hud-spin 40s linear infinite; }
.hud-ret-tick { stroke-width: 2; }
.hud-ret-arc { stroke-width: 4; stroke-linecap: round; transform-origin: 100px 100px; animation: hud-spin 12s linear infinite reverse; }
@keyframes hud-spin { to { transform: rotate(360deg); } }

.hud-telemetry { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.hud-tel {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 6px;
  font-family: var(--hud-mono); font-size: 0.82rem; letter-spacing: 0.06em;
  background: var(--hud-panel); border: 1px solid var(--hud-line); box-shadow: 0 0 14px var(--hud-glow);
}
.hud-tel-k { color: var(--muted); text-transform: uppercase; }
.hud-tel-v { color: var(--text); font-weight: 700; }
.hud-tel-v#hud-plug { color: var(--plug-accent, #00D4F8); }

/* Glowing HUD panels with corner brackets (background layers, so no pseudo-element clashes). */
.find-item, .streak-card, .streak-savings, .near-panel, .home-bar, .find-bar, .quiz-card, .trip-card,
#quiz-results > *, #trip-results > *, .faq-item, .tip-card {
  --c: var(--hud-corner);
  background:
    linear-gradient(var(--c), var(--c)) top left / 16px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) top left / 2px 16px no-repeat,
    linear-gradient(var(--c), var(--c)) top right / 16px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) top right / 2px 16px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / 16px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / 2px 16px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / 16px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / 2px 16px no-repeat,
    var(--hud-panel);
  border: 1px solid var(--hud-line);
  border-radius: 6px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 0 22px var(--hud-glow), inset 0 0 28px rgba(0, 212, 248, 0.04);
}
.find-item, .streak-card { animation: hud-pulse 5s ease-in-out infinite alternate; }
@keyframes hud-pulse {
  from { box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 0 12px var(--hud-glow), inset 0 0 28px rgba(0, 212, 248, 0.03); }
  to { box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 0 30px var(--hud-glow), inset 0 0 28px rgba(0, 212, 248, 0.07); }
}
.near-panel { --c: var(--lime); }
.find-name { font-size: 1.08rem; letter-spacing: 0.01em; }

/* Charger readout: distance arc gauge, plug lights, port meters. */
.hud-readout {
  display: grid; grid-template-columns: auto auto minmax(170px, 260px); justify-content: start; gap: 10px 34px; align-items: center;
  margin: 10px 0 12px; padding: 10px 12px; border-radius: 6px;
  background: rgba(0, 0, 0, 0.35); border: 1px dashed color-mix(in srgb, var(--plug-accent, #00D4F8) 30%, transparent);
  font-family: var(--hud-mono);
}
.hud-cell { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.hud-lab { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em; }
.hud-dist { position: relative; display: grid; grid-template-columns: 58px auto; grid-template-rows: auto auto; column-gap: 10px; align-items: center; }
.hud-dist .hud-arc { grid-row: 1 / span 2; }
.hud-val { color: var(--text); font-size: 0.85rem; }
.hud-val b { font-size: 1.25rem; color: var(--plug-accent, #00D4F8); text-shadow: 0 0 10px var(--hud-glow); }
.hud-arc { width: 58px; height: 58px; }
.hud-arc circle { fill: none; stroke-width: 6; stroke-linecap: round; }
.hud-arc-track { stroke: rgba(255, 255, 255, 0.12); }
.hud-arc-val { stroke: var(--plug-accent, #00D4F8); filter: drop-shadow(0 0 3px var(--plug-accent, #00D4F8)); }
.hud-plug-row { display: flex; flex-wrap: wrap; gap: 6px; }
.hud-plug {
  font-size: 0.75rem; padding: 3px 8px; border-radius: 4px; letter-spacing: 0.04em;
  color: #8796A8; border: 1px solid rgba(255, 255, 255, 0.16); background: rgba(0, 0, 0, 0.3);
}
.hud-plug.is-on { color: #04121C; background: var(--plug-accent, #00D4F8); border-color: var(--plug-accent, #00D4F8); font-weight: 700; box-shadow: 0 0 10px var(--hud-glow); }
.hud-row { display: grid; grid-template-columns: 2.4em 1fr 2.2em; gap: 8px; align-items: center; font-size: 0.8rem; color: var(--text); }
.hud-k { color: var(--muted); }
.hud-row b { text-align: right; }
.hud-seg { height: 8px; width: 100%; max-width: 160px; }
.hud-seg-on { fill: var(--plug-accent, #00D4F8); }
.hud-seg-off { fill: rgba(255, 255, 255, 0.12); }
.hud-walk { display: inline-block; vertical-align: middle; margin-left: 8px; }
.hud-walk .hud-seg { width: 46px; height: 7px; }
.hud-walk .hud-seg-on { fill: var(--lime); }

/* Counters: streak tiles and the savings amount. */
.hud-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0 0 14px; }
.hud-tile {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 6px;
  background: rgba(0, 0, 0, 0.4); border: 1px solid var(--hud-line); box-shadow: inset 0 0 18px var(--hud-glow);
}
.hud-count { font-family: var(--hud-mono); font-variant-numeric: tabular-nums; font-size: 1.9rem; font-weight: 700; line-height: 1.1; color: var(--plug-accent, #00D4F8); text-shadow: 0 0 14px var(--hud-glow); }
.hud-tile-cur .hud-count { color: var(--lime); }
.streak-savings-amt { font-family: var(--hud-mono); font-variant-numeric: tabular-nums; }
.streak-savings-amt .hud-count { font-size: 2.1rem; color: var(--lime); }
.streak-badge { border-radius: 6px; font-family: var(--hud-mono); }
.streak-badge.is-unlocked { box-shadow: 0 0 14px var(--hud-glow); border-color: var(--plug-accent, #00D4F8); }
.streak-badge.is-locked { opacity: 1; color: #B9C4D2; }
.streak-badge.is-locked .streak-badge-state { color: #A8B8CC; }

/* Near-charger tabs: HUD switches. Wide screens wrap so every label is fully visible (ES "Práctico" was clipped). */
.near-title { font-family: var(--hud-mono); letter-spacing: 0.06em; color: var(--lime); }
.near-tab { border-radius: 6px; font-family: var(--hud-mono); font-size: 0.82rem; letter-spacing: 0.02em; background: rgba(0, 0, 0, 0.35); }
.near-tab[aria-selected="true"] { box-shadow: 0 0 12px rgba(126, 226, 74, 0.35), inset 0 0 10px rgba(126, 226, 74, 0.15); }
@media (min-width: 721px) {
  .near-tablist { flex-wrap: wrap; overflow-x: visible; }
}
.near-spin-btn { border-radius: 6px; font-family: var(--hud-mono); letter-spacing: 0.04em; box-shadow: 0 0 14px var(--hud-glow); }
.place-item.is-spin-pick { box-shadow: 0 0 14px rgba(126, 226, 74, 0.35); }

/* Buttons and inputs get the HUD edge. */
.find-row input, .home-row input, .home-row select, .trip-field input { border-radius: 6px; font-family: var(--hud-mono); }
.find-actions button, .find-actions a { border-radius: 6px; }

@media (max-width: 900px) { .hud-reticle { display: none; } }
@media (max-width: 720px) {
  .hud-readout { grid-template-columns: auto 1fr; }
  .hud-readout .hud-ports { grid-column: 1 / -1; }
  .hud-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hud-count { font-size: 1.6rem; }
  .hud-telemetry { margin-top: 12px; gap: 6px; }
  .hud-tel { padding: 4px 8px; font-size: 0.72rem; gap: 6px; }
}
@media (max-width: 420px) { .hud-tel:nth-child(2) { display: none; } }
/* Very small phones: the first screen must still show the CTA and the "Illustration" caption (qa-r4-spots @320x640). */
@media (max-width: 359px) { .hud-telemetry { display: none; } }

/* Reduced motion: no scan band, no reticle spin, no glow pulse, no counter roll (hud.js shows the final value). */
@media (prefers-reduced-motion: reduce) {
  .hud-grid::after { animation: none !important; display: none; }
  .hud-ret-dash, .hud-ret-arc { animation: none !important; }
  .find-item, .streak-card { animation: none !important; }
}

/* Focus ring must beat component glows (e.g. selected near-tab) and stay a white-on-dark sandwich. */
.btn-demo:focus-visible,
.find-save:focus-visible,
.near-spin-btn:focus-visible,
.near-tab:focus-visible,
.near-tab[aria-selected="true"]:focus-visible,
.find-row input[type="search"]:focus-visible,
.lang-toggle button:focus-visible {
  outline: 3px solid #F4F4F4;
  outline-offset: 3px;
  box-shadow: 0 0 0 3px #000711, 0 0 0 9px #000711;
}


/* QA r1: padding inside find/quiz/trip bars so labels and inputs clear the corner brackets. */
.find-bar { padding: 14px 16px; }

/* Placeholder contrast on every field (Chrome default gray was ~3.7:1). */
input::placeholder,
textarea::placeholder {
  color: #A8B8CC;
  opacity: 1;
}

/* Keep primary-button glow from washing muted text beside or below the CTA. */
.find-bar .btn-demo,
.cta-bar .btn-demo,
.legal .btn-demo,
.hero .btn-demo {
  box-shadow:
    0 0 0 1px rgba(0, 229, 255, 0.9),
    0 0 16px rgba(0, 212, 248, 0.65),
    0 0 28px rgba(0, 212, 248, 0.28);
}
.find-status { margin-top: 16px; position: relative; z-index: 1; }
.cta-bar p { position: relative; z-index: 1; }

/* Opaque chips so muted/secondary labels stay 4.5:1 over hero glow, art and strokes. */
.hud-tel {
  background: rgba(2, 10, 18, 0.96);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55);
  position: relative;
  z-index: 2;
}
.mapcard-cap {
  background: rgba(2, 10, 18, 0.92);
  padding: 4px 10px;
  border-radius: 6px;
  text-shadow: none;
  z-index: 2;
}

/* Dark field fill on every text-like control so #A8B8CC placeholders stay 4.5:1. */
input[type="text"],
input[type="search"],
input[type="number"],
input[type="email"],
input[type="url"],
input[type="tel"],
textarea {
  background-color: #02101C;
  color: var(--text);
}

/* Restate the focus sandwich after the contained CTA glow so it is not overwritten. */
.find-bar .btn-demo:focus-visible,
.cta-bar .btn-demo:focus-visible,
.legal .btn-demo:focus-visible,
.hero .btn-demo:focus-visible {
  outline: 3px solid #F4F4F4;
  outline-offset: 3px;
  box-shadow: 0 0 0 3px #000711, 0 0 0 9px #000711;
}

/* Keep the home ZIP placeholder fully readable at 390 (do not sit the field beside the label). */
@media (max-width: 600px) {
  .home-row label[for="home-q"] { flex: 1 1 100%; }
  .home-row input { flex: 1 1 100%; }
}
