:root {
  color-scheme: light;
  --papel: #f5f8f4;
  --superficie: #ffffff;
  --tinta: #13301f;
  --tinta-2: #4f6356;
  --tinta-3: #6f8276;
  --regla: #dbe3dc;
  --verde: #0b6b3a;          /* verde cruceño: solo marca */
  --serie-1: #2a78d6;        /* oficial */
  --serie-2: #eb6834;        /* paralelo / temperatura */
  --sube: #0f7a36;
  --baja: #c23b30;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --papel: #0e1712;
    --superficie: #15211a;
    --tinta: #eaf1ec;
    --tinta-2: #b4c4b9;
    --tinta-3: #8fa396;
    --regla: #2a3a30;
    --verde: #5cc48a;
    --serie-1: #3987e5;
    --serie-2: #d95926;
    --sube: #58c27f;
    --baja: #f07a6e;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --papel: #0e1712; --superficie: #15211a; --tinta: #eaf1ec; --tinta-2: #b4c4b9; --tinta-3: #8fa396;
  --regla: #2a3a30; --verde: #5cc48a; --serie-1: #3987e5; --serie-2: #d95926; --sube: #58c27f; --baja: #f07a6e;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--papel); color: var(--tinta);
  font: 400 16px/1.5 "Schibsted Grotesk", system-ui, sans-serif;
  font-feature-settings: "tnum" 0;
}
a { color: inherit; text-underline-offset: 2px; }
a:focus-visible, summary:focus-visible { outline: 2px solid var(--verde); outline-offset: 2px; }
.suave { color: var(--tinta-2); }
p { margin: 0; }

/* Cabecera: el nombre es la marca, con el verde cruceño como única nota de color */
.cabecera {
  max-width: 1120px; margin: 0 auto; padding: 32px 16px 20px;
  display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap;
  border-bottom: 3px solid var(--verde);
}
.cabecera h1 { margin: 0; font-size: clamp(2.2rem, 6vw, 3.4rem); line-height: 1; font-weight: 700; letter-spacing: -0.03em; }
.fecha { text-align: right; font-size: .95rem; }
#hoy { font-weight: 600; }
#hoy::first-letter { text-transform: uppercase; }

.grilla {
  max-width: 1120px; margin: 0 auto; padding: 24px 16px;
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px;
}
.bloque { background: var(--superficie); border: 1px solid var(--regla); border-radius: 6px; padding: 20px; min-width: 0; }
.bloque h2 { margin: 0 0 14px; font-size: 1.1rem; font-weight: 600; }
.dolar { grid-row: span 2; }
.bitcoin { grid-column: 2; }

/* Dólar: la cifra del paralelo manda */
.dolar-cifras { display: flex; flex-wrap: wrap; gap: 20px 40px; align-items: end; margin-bottom: 24px; }
.heroe-valor { font-size: clamp(3.2rem, 9vw, 4.8rem); font-weight: 700; line-height: 1; letter-spacing: -0.035em; }
.moneda { font-size: .42em; font-weight: 500; letter-spacing: 0; color: var(--tinta-2); vertical-align: .9em; }
.heroe .suave { margin-top: 8px; }
.secundarias { display: flex; gap: 32px; margin: 0; }
.secundarias dt { color: var(--tinta-2); font-size: .9rem; }
.secundarias dd { margin: 2px 0 0; font-size: 1.6rem; font-weight: 600; letter-spacing: -0.02em; }

/* Gráficos */
.figura { margin: 0; }
.figura figcaption { font-size: .9rem; color: var(--tinta-2); margin-bottom: 6px; }
.grafico { position: relative; width: 100%; min-height: 220px; }
.grafico svg { display: block; width: 100%; overflow: visible; }
.grafico .grilla-y line { stroke: var(--regla); stroke-width: 1; }
.grafico text { fill: var(--tinta-3); font-size: 12px; font-family: inherit; }
.grafico .etiqueta-fin { fill: var(--tinta-2); font-weight: 600; }
.grafico .cruz { stroke: var(--tinta-3); stroke-width: 1; }
.grafico .vacio { fill: var(--tinta-2); font-size: 14px; }
.leyenda { display: flex; gap: 16px; font-size: .88rem; color: var(--tinta-2); margin-bottom: 6px; }
.leyenda span::before { content: ""; display: inline-block; width: 14px; height: 2px; margin-right: 6px; vertical-align: middle; background: var(--c); border-radius: 1px; }
.tooltip {
  position: fixed; z-index: 10; pointer-events: none; background: var(--superficie); color: var(--tinta);
  border: 1px solid var(--regla); border-radius: 6px; padding: 8px 10px; font-size: .85rem;
  box-shadow: 0 4px 16px rgb(0 0 0 / .12); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.tooltip b { display: block; font-weight: 600; margin-bottom: 2px; }
.tooltip i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--c); }

.tabla-datos { margin-top: 10px; font-size: .88rem; }
.tabla-datos summary { cursor: pointer; color: var(--tinta-2); }
.tabla-datos table { border-collapse: collapse; margin-top: 8px; font-variant-numeric: tabular-nums; }
.tabla-datos th, .tabla-datos td { padding: 4px 16px 4px 0; text-align: right; border-bottom: 1px solid var(--regla); }
.tabla-datos th:first-child, .tabla-datos td:first-child { text-align: left; }
.tabla-datos th { font-weight: 600; color: var(--tinta-2); }

/* Clima */
.clima-ahora { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
#clima-temp { font-size: 2.6rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.dias { list-style: none; margin: 0; padding: 0; }
.dias li { display: grid; grid-template-columns: 5.5em 1fr; gap: 2px 12px; padding: 10px 0; border-top: 1px solid var(--regla); }
.dia-nombre { font-weight: 600; }
.dia-estado { color: var(--tinta-2); font-size: .9rem; }
.dia-rango { grid-column: 1 / -1; display: grid; grid-template-columns: 2.6em 1fr 2.6em; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; font-size: .95rem; }
.dia-rango .min { color: var(--tinta-2); text-align: right; }
.dia-rango .max { font-weight: 600; }
.pista { position: relative; height: 6px; background: var(--regla); border-radius: 3px; }
.pista span { position: absolute; top: 0; bottom: 0; background: var(--serie-2); border-radius: 3px; }
.dia-lluvia { grid-column: 1 / -1; color: var(--tinta-2); font-size: .85rem; }

/* Bitcoin */
.btc-cifras { margin-bottom: 16px; }
.btc-valor { font-size: 2.2rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.cambio { font-weight: 600; margin: 4px 0; }
.cambio.sube { color: var(--sube); }
.cambio.baja { color: var(--baja); }
.bitcoin .grafico { min-height: 170px; }

/* Combustible */
.precios { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.precios th { text-align: left; font-weight: 500; font-size: .85rem; color: var(--tinta-2); padding: 0 12px 6px 0; }
.precios td { padding: 10px 12px 10px 0; border-top: 1px solid var(--regla); vertical-align: top; }
.precios th:not(:first-child), .precios td:not(:first-child) { text-align: right; padding-right: 0; padding-left: 12px; }
.precios .producto { font-weight: 600; }
.precios .precio { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.precios .unidad { font-size: .8rem; font-weight: 400; color: var(--tinta-2); }
.precios .detalle { display: block; font-size: .82rem; font-weight: 400; color: var(--tinta-2); margin-top: 2px; }
.precios .usd { color: var(--tinta-2); white-space: nowrap; }
.nota-pie { font-size: .82rem; margin-top: 12px; }

/* Euro */
.euro-valor { font-size: 2.2rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.euro-sec { margin-top: 16px; }
.euro-sec dd { font-size: 1.25rem; }

.error { margin-top: 10px; font-size: .88rem; color: var(--baja); }
.pie { max-width: 1120px; margin: 0 auto; padding: 8px 16px 40px; font-size: .85rem; }

@media (max-width: 860px) {
  .grilla { grid-template-columns: minmax(0, 1fr); }
  .dolar { grid-row: auto; }
  .bitcoin { grid-column: auto; }
  .fecha { text-align: left; }
}
.precios td:nth-child(2) .detalle { white-space: nowrap; }
