/* fast.intercables.net: misma marca que intercables.net (tokens copiados de assets/css/styles.css) */

@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-latin-standard-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Figtree";
  src: url("../fonts/figtree-latin-wght-normal.woff2") format("woff2");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  /* Color: marca Intercables, versión sobre azul marino */
  --color-bg: oklch(26% 0.085 264);
  --color-bg-deep: oklch(22% 0.075 264);
  --color-surface: oklch(31% 0.095 264);
  --color-surface-raised: oklch(36% 0.1 264);
  --color-border: oklch(42% 0.08 264);
  --color-text: oklch(97% 0.012 150);
  --color-text-muted: oklch(85% 0.03 240);
  --color-text-faint: oklch(76% 0.04 240);
  --color-accent: oklch(73% 0.178 149); /* #3CC465, verde del logo en negativo */
  --color-accent-strong: oklch(66% 0.17 149);
  --color-on-accent: oklch(24% 0.07 160);
  --color-fibre: oklch(79% 0.15 70);
  --color-ping: oklch(80% 0.09 240);
  --color-error: oklch(72% 0.16 28);
  --color-light: oklch(97% 0.012 150);
  --color-light-surface: oklch(93% 0.024 150);
  --color-on-light: oklch(26% 0.085 264);
  --color-on-light-muted: oklch(42% 0.05 264);
  --color-accent-on-light: oklch(60% 0.169 147); /* #1C9B3E, Verde Conexión */

  /* Espaciado, base 4 */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-6: 24px;
  --s-8: 32px;
  --s-12: 48px;
  --s-16: 64px;
  --s-24: 96px;
  --s-32: 128px;
  --section: var(--s-16);
  --gutter: var(--s-4);

  /* Tipografía, ratio 1.333 */
  --t-xs: 0.875rem;
  --t-base: 1.0625rem;
  --t-md: 1.333rem;
  --t-lg: clamp(1.777rem, 3vw, 2.369rem);
  --t-xl: clamp(2.369rem, 5.4vw, 4.209rem);
  --t-num: clamp(3.5rem, 9vw, 5.6rem);
  --font-display: "Archivo", "Arial Narrow", sans-serif;
  --font-text: "Figtree", "Trebuchet MS", sans-serif;

  /* Forma y movimiento */
  --r-s: 8px;
  --r-m: 16px;
  --r-l: 32px;
  --r-pill: 999px;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --fast: 160ms;
  --mid: 280ms;
  --shadow: 0 1px 2px oklch(18% 0.06 264 / 0.4), 0 24px 48px oklch(18% 0.06 264 / 0.45);
}

@media (min-width: 900px) {
  :root { --section: var(--s-24); --gutter: var(--s-8); }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-text);
  font-size: var(--t-base);
  line-height: 1.6;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ol, dl, dd { margin: 0; padding: 0; }
ol { list-style: none; }
a { color: inherit; }
svg { display: block; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--color-fibre); outline-offset: 3px; border-radius: var(--r-s); }
.icon { width: 20px; height: 20px; flex: none; }
.wrap { width: 100%; max-width: 1280px; margin-inline: auto; padding-inline: var(--gutter); }

.eyebrow, .label {
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.title, .h2, .readout__num, .metric__val, .tips__n {
  font-family: var(--font-display);
  font-stretch: 125%;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.h2 { font-size: var(--t-lg); line-height: 1.15; }
em { font-style: italic; color: var(--color-accent); }

/* Cabecera */
.header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding-block: var(--s-6);
}
.logo { display: flex; align-items: center; gap: var(--s-3); text-decoration: none; color: var(--color-text); }
.logo { transition: opacity var(--fast) var(--ease-out); }
.logo:hover { opacity: 0.85; }
.logo__img { display: block; width: auto; height: 48px; }
.header__server {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--t-xs);
  color: var(--color-text-muted);
}
.pulse {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--color-accent);
  box-shadow: 0 0 0 0 oklch(73% 0.178 149 / 0.6);
  animation: pulse 2.4s var(--ease-out) infinite;
}
@keyframes pulse { 70% { box-shadow: 0 0 0 8px oklch(73% 0.178 149 / 0); } 100% { box-shadow: 0 0 0 0 oklch(73% 0.178 149 / 0); } }
@media (max-width: 479px) { .logo__img { height: 36px; } .header__server { display: none; } }

/* Escenario: intro, medidor y resultados */
.stage {
  display: grid;
  gap: var(--s-12);
  padding-block: var(--s-8) var(--section);
  grid-template-columns: 1fr;
  grid-template-areas: "intro" "meter" "results";
}
.stage__intro { grid-area: intro; max-width: 60ch; }
.meter { grid-area: meter; }
.results { grid-area: results; }
@media (min-width: 960px) {
  .stage {
    grid-template-columns: 7fr 5fr;
    grid-template-areas: "intro intro" "meter results";
    column-gap: var(--s-16);
    row-gap: var(--s-12);
    align-items: start;
  }
}
.stage__intro .eyebrow { margin-bottom: var(--s-4); }
.title { font-size: var(--t-xl); }
.lead { margin-top: var(--s-6); color: var(--color-text-muted); max-width: 56ch; }

.meter {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--s-8) var(--s-6);
  background: var(--color-surface);
  border-radius: var(--r-l);
  box-shadow: var(--shadow);
}
.gauge { position: relative; width: min(100%, 480px); }
.gauge__svg { width: 100%; height: auto; overflow: visible; }
.gauge__track { fill: none; stroke: var(--color-bg-deep); stroke-width: 18; stroke-linecap: round; }
.gauge__value {
  fill: none;
  stroke: var(--color-accent);
  stroke-width: 18;
  stroke-linecap: round;
  transition: stroke-dashoffset 240ms linear, stroke var(--mid) var(--ease-out);
}
.gauge__node { fill: var(--color-fibre); transition: cx 240ms linear, cy 240ms linear; }
.gauge__halo { fill: oklch(79% 0.15 70 / 0.25); transition: cx 240ms linear, cy 240ms linear; }
.gauge__tick { fill: var(--color-text-faint); font: 600 13px var(--font-text); text-anchor: middle; font-variant-numeric: tabular-nums; }
.meter.is-ul .gauge__value { stroke: var(--color-fibre); }
.meter.is-ping .gauge__value { stroke: var(--color-ping); }

.readout {
  position: absolute;
  inset: auto 0 12%;
  text-align: center;
  pointer-events: none;
}
.readout__num { font-size: var(--t-num); font-variant-numeric: tabular-nums; }
.readout__unit { margin-top: var(--s-2); color: var(--color-text-muted); font-size: var(--t-xs); letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; }

.steps { display: flex; gap: var(--s-2); margin-top: var(--s-6); }
.step {
  padding: var(--s-1) var(--s-3);
  border-radius: var(--r-pill);
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--color-text-faint);
  background: var(--color-bg-deep);
  transition: color var(--fast) var(--ease-out), background-color var(--fast) var(--ease-out);
}
.step.is-active { color: var(--color-on-accent); background: var(--color-accent); }
.step.is-done { color: var(--color-text); background: var(--color-surface-raised); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  margin-top: var(--s-8);
  padding: var(--s-4) var(--s-8);
  border: 0;
  border-radius: var(--r-pill);
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-weight: 700;
  font-size: var(--t-md);
  cursor: pointer;
  box-shadow: 0 12px 32px oklch(73% 0.178 149 / 0.25);
  transition: transform var(--fast) var(--ease-out), background-color var(--fast) var(--ease-out), box-shadow var(--fast) var(--ease-out);
}
.btn__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--color-on-accent); }
.btn:hover { transform: translateY(-2px); background: var(--color-accent-strong); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn.is-stop { background: var(--color-surface-raised); color: var(--color-text); box-shadow: none; }
.btn.is-stop .btn__dot { border-radius: 2px; background: var(--color-error); }
.btn.is-stop:hover { background: var(--color-border); }
.status { margin-top: var(--s-4); min-height: 1.6em; font-size: var(--t-xs); color: var(--color-text-muted); text-align: center; }
.status.is-error { color: var(--color-error); }

/* Resultados */
.main-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-6); }
.metric dt, .sub-metrics dt, .facts dt {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.key { width: 12px; height: 4px; border-radius: 2px; background: var(--color-accent); }
.metric--ul .key { background: var(--color-fibre); }
.metric dd { display: flex; align-items: baseline; gap: var(--s-2); margin-top: var(--s-2); }
.metric__val { font-size: var(--t-xl); font-variant-numeric: tabular-nums; }
.metric__unit { color: var(--color-text-muted); font-size: var(--t-xs); font-weight: 600; }

.sub-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-6);
  margin-top: var(--s-8);
  padding-top: var(--s-6);
  border-top: 1px solid var(--color-border);
}
.sub-metrics dd { margin-top: var(--s-1); font-size: var(--t-md); font-weight: 700; font-variant-numeric: tabular-nums; }
.sub-metrics dt::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--color-ping); }

.facts { display: grid; gap: var(--s-3); margin-top: var(--s-8); }
.facts div { display: flex; justify-content: space-between; gap: var(--s-4); font-size: var(--t-xs); }
.facts dd { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.label { margin-top: var(--s-12); margin-bottom: var(--s-3); }
.hist table { width: 100%; border-collapse: collapse; font-size: var(--t-xs); font-variant-numeric: tabular-nums; }
.hist th, .hist td { padding: var(--s-3) var(--s-2); text-align: right; border-bottom: 1px solid var(--color-border); }
.hist th:first-child, .hist td:first-child { text-align: left; padding-left: 0; }
.hist th:last-child, .hist td:last-child { padding-right: 0; }
.hist th { color: var(--color-text-faint); font-weight: 600; }
.hist__empty { font-size: var(--t-xs); color: var(--color-text-faint); }

/* Consejos: banda clara, como las secciones de intercables.net */
.tips { background: var(--color-light); color: var(--color-on-light); padding-block: var(--section); }
.tips em { color: var(--color-accent-on-light); }
.tips__in { display: grid; gap: var(--s-12); }
.tips__list { display: grid; gap: var(--s-8); }
@media (min-width: 900px) {
  .tips__in { grid-template-columns: 4fr 8fr; column-gap: var(--s-16); align-items: start; }
  .tips__list { grid-template-columns: repeat(3, 1fr); gap: var(--s-8); }
}
.tips__list li { padding-top: var(--s-4); border-top: 2px solid var(--color-on-light); }
.tips__n { display: block; font-size: var(--t-lg); color: var(--color-accent-on-light); }
.tips__list h3 { margin-top: var(--s-4); font-size: var(--t-base); font-weight: 700; line-height: 1.3; }
.tips__list p { margin-top: var(--s-2); color: var(--color-on-light-muted); font-size: var(--t-xs); }

/* Ayuda por zona */
.help { display: grid; gap: var(--s-8); padding-block: var(--section); }
@media (min-width: 900px) { .help { grid-template-columns: 5fr 7fr; column-gap: var(--s-16); align-items: end; } }
.help__text p { margin-top: var(--s-4); color: var(--color-text-muted); max-width: 48ch; }
.zones { display: grid; gap: var(--s-6); grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.zones dt { font-weight: 700; margin-bottom: var(--s-2); }
.zones a {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding-block: var(--s-1);
  color: var(--color-text-muted);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
  transition: color var(--fast) var(--ease-out);
}
.zones a:hover { color: var(--color-accent); }
.zones .icon { width: 16px; height: 16px; }

.is-empty { color: var(--color-text-faint); font-weight: 400; font-stretch: 100%; }

/* Pie */
.footer { background: var(--color-bg-deep); padding-block: var(--s-16) var(--s-8); }
.footer__word { width: 100%; height: auto; aspect-ratio: 418 / 44; color: var(--color-surface-raised); }
.footer__row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--s-3);
  margin-top: var(--s-8);
  font-size: var(--t-xs);
  color: var(--color-text-faint);
}
.footer__row a { color: var(--color-text-muted); }
.footer__row a:hover { color: var(--color-accent); }

@media (prefers-reduced-motion: reduce) {
  .pulse { animation: none; }
  .gauge__value, .gauge__node, .gauge__halo, .btn, .step, .zones a { transition: none; }
}
