/* ---------- Tokens ---------- */
:root {
  --bg: #f6f7fb;
  --bg-elev: #ffffff;
  --bg-soft: #eef1f7;
  --text: #0f172a;
  --muted: #475569;
  --text-2: #334155;        /* texto de lectura secundario, más legible que --muted */
  --line: #dde2ec;
  --accent: #d97706;        /* energía / ámbar */
  --accent-2: #0284c7;      /* eléctrico / cian */
  --accent-ink: #b45309;    /* naranja para texto, con buen contraste */
  --accent-2-ink: #0369a1;  /* celeste para texto */
  --accent-soft: rgba(217, 119, 6, .12);
  --grid: rgba(15, 23, 42, .045);
  --shadow: none;
  --radius: 10px;
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Archivo", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0f1c; --bg-elev: #111827; --bg-soft: #172033;
    --text: #e8ecf4; --muted: #a8b3c7; --text-2: #cbd5e1; --line: #243049;
    --accent: #fbbf24; --accent-2: #38bdf8; --accent-soft: rgba(251,191,36,.12);
    --accent-ink: #fbbf24; --accent-2-ink: #7dd3fc;
    --grid: rgba(148,160,184,.06);
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0f1c; --bg-elev: #111827; --bg-soft: #172033;
  --text: #e8ecf4; --muted: #a8b3c7; --text-2: #cbd5e1; --line: #243049;
  --accent: #fbbf24; --accent-2: #38bdf8; --accent-soft: rgba(251,191,36,.12);
  --accent-ink: #fbbf24; --accent-2-ink: #7dd3fc;
  --grid: rgba(148,160,184,.06);
  --shadow: none;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.6 var(--font); -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0; letter-spacing: -.01em; }
a { color: inherit; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }


/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 24px;
  padding: 12px max(16px, calc((100% - 1120px) / 2));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: var(--text); color: var(--bg); font-family: var(--display); font-size: .85rem;
}
.nav-links { display: flex; gap: 4px; margin-left: auto; }
.nav-links a {
  text-decoration: none; color: var(--muted); font-size: .9rem; padding: 6px 10px; border-radius: 8px;
  transition: color .2s, background .2s;
}
.nav-links a:hover, .nav-links a.current { color: var(--text); background: var(--bg-soft); }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg-elev); color: var(--text); cursor: pointer; display: grid; place-items: center;
}
.icon-btn svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 12px 20px; border-radius: 12px; font: 600 .95rem var(--font);
  border: 1px solid var(--line); background: var(--bg-elev); color: var(--text);
  text-decoration: none; cursor: pointer; transition: transform .15s, box-shadow .2s, background .2s;
}
.btn svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #111; }
.btn.full { width: 100%; }
.btn:disabled { opacity: .6; cursor: wait; transform: none; }

/* ---------- Hero ---------- */
.hero {
  display: grid; grid-template-columns: 1.3fr 1fr; gap: 48px; align-items: center;
  padding: 72px 0 40px;
}
.status {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 20px;
  font-size: .85rem; color: var(--muted); padding: 6px 12px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--bg-elev);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
.hero h1 { font-size: clamp(2.8rem, 7vw, 5rem); font-weight: 700; }
.role { font-family: var(--display); font-size: clamp(1.2rem, 2.6vw, 1.6rem); margin: 14px 0 18px; color: var(--text-2); min-height: 1.4em; }
.typed { color: var(--accent-ink); font-weight: 600; }
.caret { display: inline-block; width: 2px; height: 1.1em; background: var(--accent); margin-left: 3px; vertical-align: -3px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.lead { font-size: 1.08rem; color: var(--text-2); max-width: 56ch; margin: 0 0 28px; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; }

.hero-photo { position: relative; justify-self: center; }
.photo-ring {
  width: min(320px, 70vw); aspect-ratio: 1; border-radius: 50%; padding: 6px;
  background: conic-gradient(from 200deg, var(--accent), var(--accent-2), var(--accent));
  animation: spin 12s linear infinite;
}
/* Marco circular: gira al revés del aro para quedar quieto, y recorta la foto ampliada */
.photo-clip {
  display: block; width: 100%; height: 100%; border-radius: 50%; overflow: hidden;
  border: 6px solid var(--bg); animation: spin 12s linear infinite reverse;
}
.photo-clip img {
  width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%;
  transform: translateY(-4%) scale(1.65); transform-origin: 50% 46%;   /* zoom sobre la cara y la campera */
}
@keyframes spin { to { transform: rotate(360deg); } }
.chip-float {
  position: absolute; padding: 8px 14px; border-radius: 12px; font-size: .85rem; font-weight: 600;
  background: var(--bg-elev); border: 1px solid var(--line); box-shadow: var(--shadow); white-space: nowrap;
  animation: float 5s ease-in-out infinite;
}
.c1 { top: 8%; left: -12%; }
.c2 { bottom: 14%; left: -18%; animation-delay: -1.6s; }
.c3 { top: 46%; right: -16%; animation-delay: -3.2s; }
@keyframes float { 50% { transform: translateY(-10px); } }


/* ---------- Lens ---------- */
.lens {
  margin-top: 56px; padding: 28px; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent-soft), transparent 60%), var(--bg-elev);
  border: 1px solid var(--line);
}
.lens-title { font-size: 1.4rem; }
.lens .muted { margin: 6px 0 16px; }
.lens-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: 500 .92rem var(--font); padding: 9px 16px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg); color: var(--text); transition: all .2s;
}
.chip:hover { border-color: var(--accent); }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.lens-summary { margin: 16px 0 0; font-size: .95rem; min-height: 1.6em; }
.lens-summary:empty { display: none; }

/* Filtering: dim non-matching items */
[data-tags] { transition: opacity .35s, filter .35s, transform .35s; }
body[data-lens]:not([data-lens="all"]) [data-tags].dim { opacity: .45; filter: grayscale(.8); }
body[data-lens]:not([data-lens="all"]) .skill:not(.dim) { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- Sections ---------- */
.section { padding: 88px 0 0; }
.section-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 28px; }
.section-head h2 { font-size: clamp(1.8rem, 4vw, 2.4rem); }

.skills { display: flex; flex-wrap: wrap; gap: 8px; }
.skill {
  padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-elev);
  font-size: .9rem;
}

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 140px; top: 8px; bottom: 8px; width: 2px;
  background: linear-gradient(var(--accent), var(--accent-2), transparent);
}
.job { display: grid; grid-template-columns: 140px 1fr; gap: 32px; padding-bottom: 20px; position: relative; }
.job::before {
  content: ""; position: absolute; left: 134px; top: 22px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--bg); border: 3px solid var(--accent);
}
.job-when { font: 600 .9rem var(--display); color: var(--text-2); padding-top: 18px; text-align: right; padding-right: 8px; }
.job-card {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 24px; box-shadow: var(--shadow);
}
.job-card h3 { font-size: 1.15rem; }
.org { color: var(--accent-2-ink); font-weight: 600; margin: 4px 0 10px; font-size: .95rem; }
.job-card ul, .feature-list { margin: 0; padding-left: 18px; color: var(--text-2); }
.job-card li, .feature-list li { margin: 4px 0; }
.job-card li::marker, .feature-list li::marker { color: var(--accent); }

/* Projects */
.projects { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }
.project {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px; display: flex; flex-direction: column; gap: 16px; box-shadow: var(--shadow);
}
.project.big { grid-row: span 2; background: linear-gradient(160deg, var(--accent-soft), transparent 45%), var(--bg-elev); }
.project h3 { font-size: 1.3rem; margin: 10px 0 8px; }
.project p { margin: 0; color: var(--text-2); }
.badge {
  display: inline-block; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  color: var(--accent-ink); background: var(--accent-soft); padding: 4px 10px; border-radius: 999px;
}
.stack { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.stack span {
  font: 500 .78rem ui-monospace, "Cascadia Code", Consolas, monospace; padding: 4px 9px; border-radius: 6px;
  background: var(--bg-soft); color: var(--text);
}

/* Services */
.services { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 8px; }
.service {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px;
  transition: transform .2s, border-color .2s;
}
.service:hover { transform: translateY(-4px); border-color: var(--accent); }
.s-icon { font-size: 1.6rem; margin-bottom: 10px; }
.service h3 { font-size: 1.08rem; margin-bottom: 6px; }
.service p { margin: 0; color: var(--text-2); font-size: .94rem; }

/* Education */
.edu-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.edu { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.edu-years { font: 600 .8rem var(--display); color: var(--accent-ink); text-transform: uppercase; letter-spacing: .08em; }
.edu h3 { font-size: 1.12rem; margin: 8px 0 4px; }
.edu h3 small { color: var(--muted); font-weight: 500; }
.edu p { margin: 0; color: var(--text-2); }
.certs { margin: 10px 0 0; padding-left: 18px; color: var(--text-2); }
.certs b { color: var(--text); }
.lang { display: grid; grid-template-columns: 110px 1fr auto; align-items: center; gap: 12px; margin-top: 12px; font-size: .92rem; }
.lang small { color: var(--muted); }
.bar { height: 6px; border-radius: 99px; background: var(--bg-soft); overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: inherit; }
.edu .extra { margin-top: 14px; font-size: .92rem; }

/* Reviews */
.reviews-layout { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; align-items: start; }
.rating-summary {
  display: flex; align-items: center; gap: 16px; margin-bottom: 16px; padding: 18px 22px;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
}
.rating-summary b { font: 700 2.6rem var(--display); }
.stars-static { color: var(--accent); letter-spacing: 2px; font-size: 1.1rem; }
.stars-static .off { color: var(--line); }
.reviews { display: grid; gap: 14px; }
.review {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px;
}
.review-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.review-who { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 600;
  background: var(--accent-soft); color: var(--accent-ink);
}
.review-who small { display: block; color: var(--muted); font-size: .8rem; }
.review p { margin: 10px 0 0; color: var(--text-2); white-space: pre-line; }
.empty { padding: 24px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); margin: 0; }

.review-form {
  position: sticky; top: 90px;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px;
  display: grid; gap: 14px; box-shadow: var(--shadow);
}
.review-form h3 { font-size: 1.2rem; }
.review-form .muted { margin: -8px 0 0; }
.review-form label { display: grid; gap: 6px; font-size: .9rem; font-weight: 500; }
.review-form input, .review-form select, .review-form textarea {
  font: inherit; font-weight: 400; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); width: 100%;
}
.review-form input:focus, .review-form select:focus, .review-form textarea:focus {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent;
}
.stars-input { border: 0; padding: 0; margin: 0; }
.stars-input legend { font-size: .9rem; font-weight: 500; margin-bottom: 4px; padding: 0; }
.stars-row { display: inline-flex; flex-direction: row-reverse; }
.stars-row input { position: absolute; opacity: 0; pointer-events: none; }
.stars-row label { font-size: 2rem; color: var(--line); cursor: pointer; padding: 0 2px; transition: color .15s, transform .15s; }
.stars-row label:hover, .stars-row label:hover ~ label,
.stars-row input:checked ~ label { color: var(--accent); }
.stars-row label:hover { transform: scale(1.15); }
.stars-row input:focus-visible + label { outline: 2px solid var(--accent); border-radius: 4px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; }
.form-msg { margin: 0; font-size: .9rem; min-height: 1.4em; }
.form-msg.ok { color: #16a34a; }
.form-msg.err { color: #dc2626; }

/* Contact */
.contact {
  display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: center;
  padding: 36px; border-radius: 24px; border: 1px solid var(--line);
  background: radial-gradient(circle at 0% 0%, var(--accent-soft), transparent 55%), var(--bg-elev);
}
.contact h2 { font-size: clamp(2rem, 5vw, 3rem); margin: 6px 0 10px; }
.contact-links { display: grid; gap: 10px; }
.contact-card {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: 14px; text-decoration: none;
  background: var(--bg); border: 1px solid var(--line); transition: transform .2s, border-color .2s;
}
.contact-card:hover { transform: translateX(6px); border-color: var(--accent); }
.contact-card b { display: block; }
.contact-card small { color: var(--muted); word-break: break-all; }
.c-ico { font-size: 1.4rem; }

.footer {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  padding: 48px 0 32px; color: var(--muted); font-size: .88rem;
}
.footer a { text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .nav-links { display: none; }
  .nav .icon-btn { margin-left: auto; }
  .hero { grid-template-columns: 1fr; padding-top: 40px; gap: 40px; }
  .hero-photo { order: -1; }
  .photo-ring { width: min(240px, 60vw); }
  .projects, .reviews-layout, .contact, .edu-grid { grid-template-columns: 1fr; }
  .project.big { grid-row: auto; }
  .services { grid-template-columns: repeat(2, 1fr); }
  .review-form { position: static; }
}
@media (max-width: 600px) {
  .section { padding-top: 64px; }
  .services { grid-template-columns: 1fr; }
  .timeline::before { left: 7px; }
  .job { grid-template-columns: 1fr; gap: 6px; padding-left: 30px; }
  .job::before { left: 1px; top: 4px; }
  .job-when { text-align: left; padding: 0; }
  .chip-float { font-size: .75rem; padding: 6px 10px; }
  .c1 { left: -8%; } .c2 { left: -10%; } .c3 { right: -10%; }
  .lens, .contact { padding: 22px; }
}

.verified {
  display: inline-block; margin-left: 6px; font-size: .72rem; font-weight: 600; vertical-align: 1px;
  color: #16a34a; background: rgba(22,163,74,.12); padding: 2px 8px; border-radius: 999px;
}

/* ---------- Banner "En campo" (Experiencia) ---------- */
.field-banner {
  display: grid; grid-template-columns: minmax(260px, 340px) 1fr; margin: 0 0 40px;
  border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow);
  background: #0b1220;
}
.fb-photo { position: relative; overflow: hidden; aspect-ratio: 4 / 5; }
.fb-photo img {
  width: 100%; height: 100%; object-fit: cover; object-position: 50% 80%;
  transform: translateY(var(--parallax, 0px)) scale(1.08); will-change: transform;
}
.fb-text {
  display: flex; flex-direction: column; justify-content: center; gap: 16px; padding: 40px;
  color: #e8ecf4;
  background:
    radial-gradient(circle at 0% 0%, rgba(249, 115, 22, .32), transparent 55%),
    radial-gradient(circle at 100% 100%, rgba(56, 189, 248, .14), transparent 50%);
}
.fb-tag {
  align-self: flex-start; font-size: .8rem; font-weight: 600; padding: 6px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14);
}
.fb-quote { margin: 0; font: 700 clamp(1.5rem, 3vw, 2.2rem)/1.15 var(--display); letter-spacing: -.01em; color: #fff; }
.fb-points { margin: 0; padding-left: 18px; color: #b6c2d6; }
.fb-points li { margin: 4px 0; }
.fb-points li::marker { color: #fb923c; }

@media (max-width: 700px) {
  .field-banner { grid-template-columns: 1fr; }
  .fb-photo { aspect-ratio: 4 / 4.4; }
  .fb-text { padding: 24px; }
}

/* Subtítulo dentro de las etiquetas flotantes de la foto */
.chip-float small { display: block; margin-top: 1px; padding-left: 1.45em; font-size: .72rem; font-weight: 500; color: var(--muted); }

/* Proyecto a todo el ancho con casos de uso */
.project.wide { grid-column: 1 / -1; }
.use-cases { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.use-cases li { padding: 12px 14px; border-radius: 12px; background: var(--bg-soft); display: grid; gap: 4px; }
.use-cases b { font-size: .95rem; }
.use-cases span { font-size: .86rem; color: var(--text-2); }
@media (max-width: 900px) { .use-cases { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .use-cases { grid-template-columns: 1fr; } }

/* =========================================================
   Medidor de la portada: display de inversor / SCADA.
   Es oscuro en ambos temas, como la pantalla de un equipo.
   Se "enciende" una sola vez (clase .on) al entrar en pantalla.
   ========================================================= */
.meter { margin-top: 28px; }
.meter-screen {
  --scr: #06161b; --scr-line: rgba(94, 234, 212, .14); --lcd: #fde68a; --lcd-dim: #7f9aa2; --ink: #c9d7dc; --glow: #5eead4;
  display: grid; grid-template-columns: 1.5fr 1fr 1fr; border-radius: 22px; overflow: hidden;
  background: var(--scr); border: 1px solid #1d3a42;
  box-shadow: inset 0 0 0 6px #0b2229, inset 0 0 40px rgba(94, 234, 212, .05), 0 18px 40px -18px rgba(6, 22, 27, .55);
}
.ch { position: relative; padding: 26px 28px 24px; display: flex; flex-direction: column; gap: 4px; }
.ch + .ch { border-left: 1px solid var(--scr-line); }
.ch-name { margin: 0; font-size: .9rem; color: var(--lcd-dim); }
.ch-value {
  margin: 2px 0 0; font: 700 clamp(2.2rem, 4.4vw, 3rem)/1 var(--display); color: var(--lcd);
  font-variant-numeric: tabular-nums; letter-spacing: -.02em;
  text-shadow: 0 0 18px rgba(253, 230, 138, .25);
}
.ch-value small { font-size: .42em; font-weight: 600; margin-left: .25em; color: var(--lcd); opacity: .8; }
.ch-value i { font-style: normal; font-weight: 400; color: var(--lcd-dim); margin: 0 .12em; }
.ch-note { margin: 0; font-size: .88rem; color: var(--ink); }

/* Canal solar: curva de generación de un día, con un punto en la hora actual */
.ch-solar { padding-bottom: 18px; }
.sun-curve { display: block; width: 100%; height: 64px; margin-top: 14px; overflow: visible; }
.curve-line { fill: none; stroke: #fbbf24; stroke-width: 2.2; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.curve-now {
  position: absolute; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; border-radius: 50%;
  background: var(--glow); box-shadow: 0 0 0 4px rgba(94, 234, 212, .22), 0 0 14px var(--glow);
}
.curve-now[hidden] { display: none; }
.curve-label { margin: 6px 0 0; font-size: .78rem; color: var(--lcd-dim); }

/* Canal baterías: celdas que se cargan */
.cells {
  position: relative; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; width: 132px; height: 34px;
  margin-top: auto; padding: 4px; border: 2px solid #3d6570; border-radius: 7px;
}
.cells::after { content: ""; position: absolute; right: -7px; top: 9px; width: 4px; height: 12px; border-radius: 0 3px 3px 0; background: #3d6570; }
.cells i { border-radius: 2px; background: linear-gradient(#5eead4, #14b8a6); box-shadow: 0 0 8px rgba(94, 234, 212, .45); }

/* Canal IT: barras de señal */
.signal { display: flex; align-items: flex-end; gap: 5px; height: 34px; margin-top: auto; }
.signal i { width: 9px; border-radius: 2px; background: var(--glow); box-shadow: 0 0 8px rgba(94, 234, 212, .4); }
.signal i:nth-child(1) { height: 28%; } .signal i:nth-child(2) { height: 52%; }
.signal i:nth-child(3) { height: 76%; } .signal i:nth-child(4) { height: 100%; }
.ch-batt .ch-note, .ch-it .ch-note { margin-bottom: 18px; }

.meter-foot { display: flex; align-items: center; gap: 10px; margin: 14px 4px 0; font-size: .92rem; color: var(--text-2); }
.led { width: 9px; height: 9px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .18), 0 0 10px #22c55e; }

/* Encendido: una sola secuencia orquestada. Sin .on (o sin animaciones) se ve el estado final. */
.meter.on .curve-line { stroke-dasharray: 100; animation: draw 1.4s cubic-bezier(.6, 0, .2, 1) both .15s; }
.meter.on .curve-area { animation: fade .8s ease both 1.1s; }
.meter.on .curve-now { animation: pop .4s ease both 1.5s; }
.meter.on .cells i { animation: cell .28s ease both; }
.meter.on .cells i:nth-child(1) { animation-delay: .35s; } .meter.on .cells i:nth-child(2) { animation-delay: .55s; }
.meter.on .cells i:nth-child(3) { animation-delay: .75s; } .meter.on .cells i:nth-child(4) { animation-delay: .95s; }
.meter.on .cells i:nth-child(5) { animation-delay: 1.15s; }
.meter.on .signal i { animation: cell .3s ease both; }
.meter.on .signal i:nth-child(1) { animation-delay: .5s; } .meter.on .signal i:nth-child(2) { animation-delay: .7s; }
.meter.on .signal i:nth-child(3) { animation-delay: .9s; } .meter.on .signal i:nth-child(4) { animation-delay: 1.1s; }
.meter.on .led { animation: fade .3s ease both 1.6s; }
/* .arm = la animación va a correr: arranca apagado hasta que se agrega .on */
.meter.arm .curve-line { stroke-dasharray: 100; stroke-dashoffset: 100; }
.meter.arm .curve-area, .meter.arm .curve-now, .meter.arm .led { opacity: 0; }
.meter.arm .cells i, .meter.arm .signal i { opacity: .08; }
@keyframes draw { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(.2); } to { opacity: 1; transform: scale(1); } }
@keyframes cell { from { opacity: .08; } to { opacity: 1; } }

@media (max-width: 900px) {
  .meter-screen { grid-template-columns: 1fr 1fr; }
  .ch-solar { grid-column: 1 / -1; }
  .ch-batt { border-left: 0 !important; border-top: 1px solid var(--scr-line); }
  .ch-it { border-top: 1px solid var(--scr-line); }
}
@media (max-width: 480px) {
  .ch { padding: 20px 18px; }
  .cells { width: 112px; }
}

/* =========================================================
   Línea de tiempo: el "cable" se energiza con el scroll
   (scroll-driven animations; donde no hay soporte queda encendida).
   ========================================================= */
.timeline::after {
  content: ""; position: absolute; left: 140px; top: 8px; bottom: 8px; width: 2px; transform-origin: top;
  background: linear-gradient(var(--accent), var(--accent-2));
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 55%, transparent);
}
@supports (animation-timeline: view()) {
  .timeline::before { background: var(--line); }
  /* La línea y cada nodo siguen el paso de su bloque por la pantalla (no el de su propio dibujo) */
  .timeline { view-timeline-name: --cable; }
  .job { view-timeline-name: --puesto; }
  .timeline::after { animation: energize linear both; animation-timeline: --cable; animation-range: cover 8% cover 88%; }
  .job::before { animation: node-on linear both; animation-timeline: --puesto; animation-range: cover 20% cover 40%; }
}
@keyframes energize { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes node-on {
  from { border-color: var(--line); background: var(--bg); box-shadow: none; }
  to { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft), 0 0 12px var(--accent); }
}
@media (max-width: 600px) { .timeline::after { left: 7px; } }

/* =========================================================
   Transiciones suaves al cambiar de página (y en el panel)
   ========================================================= */
@view-transition { navigation: auto; }
.brand-mark { view-transition-name: brand; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .28s; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }

/* =========================================================
   Identidad: Archivo (títulos expandidos, como el rotulado de
   un equipo) + bandas petróleo. Sin sombras ni giros genéricos.
   ========================================================= */
:root { --petrol: #06161b; }
body { font-size: 16.5px; }
h1, h2 { font-stretch: 118%; font-weight: 700; letter-spacing: -.012em; }
.hero h1 { font-stretch: 125%; font-weight: 750; font-size: clamp(2.6rem, 6.4vw, 4.6rem); line-height: .98; }
h3 { font-stretch: 100%; font-weight: 650; }
.section-head h2 { font-size: clamp(1.9rem, 4.2vw, 2.6rem); }
.role { font-stretch: 110%; font-weight: 500; }
.brand-name { font-stretch: 115%; font-weight: 650; }
.ch-value, .fb-quote { font-stretch: 115%; }
.btn { font-weight: 600; }

/* Planos con borde en vez de tarjetas con sombra y degradé */
.btn:hover { box-shadow: none; }
.project.big, .lens { background: var(--bg-elev); }

/* Foto: aro sólido y quieto; etiquetas sin flotar */
.photo-ring { background: var(--accent); animation: none; padding: 5px; }
.photo-clip { animation: none; }
.chip-float { animation: none; box-shadow: none; }

/* Servicios: lista en dos columnas con íconos de línea */
.services {
  list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr;
  gap: 0 48px; border-top: 1px solid var(--line);
}
.service {
  display: grid; grid-template-columns: 44px 1fr; gap: 4px 16px; padding: 22px 0;
  background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
}
.service:hover { transform: none; border-color: var(--line); }
.s-icon {
  grid-row: span 2; width: 44px; height: 44px; margin: 0; display: grid; place-items: center;
  border-radius: 10px; background: var(--accent-soft); color: var(--accent-ink);
}
.s-icon svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.service h3 { margin: 0; align-self: end; }
@media (max-width: 700px) { .services { grid-template-columns: 1fr; } }

/* Contacto: banda oscura petróleo, como el medidor */
.contact {
  --bg: #0b2229; --bg-elev: #0b2229; --text: #eaf3f5; --text-2: #c9d7dc; --muted: #a9bec4; --line: #1d3a42;
  background: var(--petrol); color: var(--text); border-color: #1d3a42;
}
.contact-card:hover { transform: none; border-color: var(--accent); }

/* =========================================================
   Fondo de la portada: diagrama unifilar (paneles, inversor,
   baterías, tablero, trafo y red). Quieto y casi transparente.
   ========================================================= */
:root { --sld: rgba(3, 105, 161, .2); --sld-text: rgba(3, 105, 161, .42); }
:root[data-theme="dark"] { --sld: rgba(125, 211, 252, .16); --sld-text: rgba(125, 211, 252, .38); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --sld: rgba(125, 211, 252, .16); --sld-text: rgba(125, 211, 252, .38); }
}
.hero { position: relative; isolation: isolate; }
.sld { position: absolute; inset: 0 0 -28px; width: 100%; height: calc(100% + 28px); z-index: -1; pointer-events: none; overflow: visible; }
.sld-lines * { fill: none; stroke: var(--sld); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.sld-lines .sld-node { fill: var(--sld-text); stroke: none; }
.sld-text text { fill: var(--sld-text); font: 500 12px var(--font); letter-spacing: .02em; }
/* La derivación a medición llega justo al borde superior del medidor */
.sld-drop { stroke-dasharray: 5 5; }
@media (max-width: 900px) {
  .sld { inset: 0; height: 100%; }
  .sld-drop, .sld-node { display: none; }
  .sld-text text:nth-child(n+3) { display: none; }
}

/* Puesta en marcha al entrar (una vez por visita). Sin .boot el diagrama se ve completo. */
/* Mientras se dibuja, el cable va "energizado" en ámbar y con más grosor; después se apaga al tono de fondo */
.sld.boot .sld-lines > :not(.sld-drop):not(.sld-node) {
  stroke-dasharray: 1; stroke-dashoffset: 1;
  animation: sld-draw 1.6s ease-out forwards; animation-delay: var(--d, 0s);
}
.sld.boot .sld-node { opacity: 0; animation: sld-node 1.6s ease forwards; animation-delay: var(--d, 0s); }
.sld.boot .sld-drop { clip-path: inset(0 0 100% 0); animation: sld-drop 1.8s ease-in forwards; animation-delay: var(--d, 0s); }
.sld.boot .sld-text text { opacity: 0; animation: sld-show .35s ease forwards; animation-delay: var(--d, 0s); }
@keyframes sld-draw {
  0%   { stroke-dashoffset: 1; stroke: var(--accent); stroke-width: 2.6; }
  28%  { stroke-dashoffset: 0; stroke: var(--accent); stroke-width: 2.6; }
  100% { stroke-dashoffset: 0; stroke: var(--sld); stroke-width: 1.4; }
}
@keyframes sld-node { 0% { opacity: 0; fill: var(--accent); } 25% { opacity: 1; fill: var(--accent); } 100% { opacity: 1; fill: var(--sld-text); } }
@keyframes sld-drop {
  0%   { clip-path: inset(0 0 100% 0); stroke: var(--accent); stroke-width: 2.6; }
  30%  { clip-path: inset(0 0 0 0); stroke: var(--accent); stroke-width: 2.6; }
  100% { clip-path: inset(0 0 0 0); stroke: var(--sld); stroke-width: 1.4; }
}
@keyframes sld-show { to { opacity: 1; } }
