/* Ensobre: página de tasas (rates.html y es/tasas.html).
   Va después de home.css y doc.css (colores, tema claro/oscuro y tipografía salen de ahí).
   Todo bajo body.rates-page. Las gráficas se dibujan en rates.js. */

/* Ancho: la tabla de tasas necesita más aire que un documento normal. */
body.rates-page .doc-shell,
body.rates-page:not(:has(.doc-toc)) .doc-shell{width:min(1040px,calc(100% - 88px))}
body.rates-page .doc-hero{padding:72px 0 52px}
body.rates-page .doc-hero h1{max-width:24ch}
body.rates-page .doc-hero p{max-width:68ch}
body.rates-page .doc-body{padding:56px 0 96px}
body.rates-page .doc article p{max-width:75ch}
body.rates-page .doc article ul{max-width:75ch}
body.rates-page .doc article .rates-lead{margin-bottom:24px}

/* Fecha de las últimas tasas, en el encabezado */
body.rates-page .hero-updated{display:inline-flex;align-items:center;gap:10px;margin:26px 0 0;padding:8px 16px;background:var(--card);border:1px solid var(--line);border-radius:40px;font-size:14px;line-height:1.4;color:var(--ink);white-space:nowrap;max-width:100%}
body.rates-page .doc-hero p.hero-updated{font-size:14px;margin-top:26px;color:var(--ink)}
body.rates-page .hero-updated .dot{width:8px;height:8px;border-radius:50%;background:var(--green);box-shadow:0 0 0 4px var(--soft);flex-shrink:0}

/* "Próximamente" */
body.rates-page .rates-status{margin:0}

/* ---------- Tarjeta de tasas ---------- */
body.rates-page .rates-card{background:var(--card);border:1px solid var(--line);border-radius:16px;box-shadow:0 3px 14px var(--shadow);overflow:hidden}
body.rates-page .rates-list{list-style:none;margin:0;padding:0}
body.rates-page .doc article .rates-list{padding:0;margin:0;line-height:1.4;max-width:none}
body.rates-page .doc article .rates-list li+li{margin-top:0}
body.rates-page .rates-list li::marker{content:""}

/* Mismas columnas en el encabezado y en cada fila */
body.rates-page .rates-head,
body.rates-page .rate-row{display:grid;grid-template-columns:minmax(170px,1.3fr) minmax(104px,.75fr) minmax(120px,1fr) minmax(96px,.6fr) minmax(124px,.8fr) 20px;column-gap:clamp(14px,2vw,28px);align-items:center;padding-inline:clamp(16px,2.4vw,28px)}
body.rates-page .rates-card.no-history .rates-head,
body.rates-page .rates-card.no-history .rate-row{grid-template-columns:minmax(170px,1.3fr) minmax(104px,.75fr) minmax(124px,.8fr)}
body.rates-page .rates-card.no-history .h-hist,
body.rates-page .rates-card.no-history .rates-head>span:last-child{display:none}
body.rates-page .rates-head{padding-block:13px;background:var(--surface);border-bottom:1px solid var(--line);font-size:12px;font-weight:650;letter-spacing:.08em;text-transform:uppercase;color:var(--faint);line-height:1.3}
body.rates-page .rates-head>span{min-width:0}
body.rates-page .rates-head .h-num{text-align:right}

body.rates-page .rate{border-bottom:1px solid var(--line);transition:background .18s}
body.rates-page .rate:last-child{border-bottom:0}
body.rates-page .rate.is-open{background:var(--surface)}

body.rates-page .rate-row{width:100%;min-height:76px;padding-block:14px;text-align:left;background:transparent;border:0;border-radius:0;color:var(--ink);font:inherit;line-height:1.4}
body.rates-page button.rate-row{cursor:pointer}
body.rates-page button.rate-row:hover{background:var(--surface)}
body.rates-page .rate.is-open button.rate-row:hover{background:transparent}
body.rates-page button.rate-row:focus-visible{outline:3px solid var(--green);outline-offset:-3px}
body.rates-page .rate-row>*{min-width:0}
body.rates-page .rate-row.plain{cursor:default}

/* Moneda: etiqueta con el código + nombre */
body.rates-page .rate-cur{display:flex;align-items:center;gap:14px}
body.rates-page .rate-badge{flex:none;display:inline-grid;place-items:center;min-width:54px;height:34px;padding:0 10px;border-radius:9px;background:var(--soft);border:1px solid var(--soft-line);color:var(--soft-ink);font-size:13px;font-weight:700;letter-spacing:.04em}
body.rates-page .rate-name{font-size:15px;font-weight:600;color:var(--ink);overflow-wrap:anywhere;line-height:1.3}

/* Valor */
body.rates-page .rate-val{text-align:right;font-size:18px;font-weight:650;letter-spacing:-.01em;color:var(--ink);font-variant-numeric:tabular-nums;white-space:nowrap}

/* Mini gráfica */
body.rates-page .rate-spark{display:block;height:36px;width:100%}
body.rates-page .rate-spark svg{display:block;overflow:visible}

/* Cambio: color neutro a propósito (que suba el número no es ni bueno ni malo) */
body.rates-page .rate-chg{display:flex;align-items:center;gap:8px;flex-wrap:nowrap}
body.rates-page .chg-pill{display:inline-flex;align-items:center;gap:6px;height:28px;padding:0 10px;border-radius:30px;background:var(--surface);border:1px solid var(--line);color:var(--ink);font-size:13px;font-weight:600;font-variant-numeric:tabular-nums;white-space:nowrap}
body.rates-page .rate.is-open .chg-pill{background:var(--card)}
body.rates-page .chg-pill svg{width:10px;height:10px;fill:currentColor;flex-shrink:0}
body.rates-page .chg-period{display:none;font-size:13px;color:var(--faint);white-space:nowrap}

/* Fuente y fecha */
body.rates-page .rate-src{display:flex;flex-direction:column;gap:2px;font-size:13px;line-height:1.4;color:var(--muted)}
body.rates-page .rate-src b{font-weight:600;color:var(--muted)}
body.rates-page .rate-src span{color:var(--faint);white-space:nowrap}
body.rates-page .rate-src .sep{display:none}

/* Flecha de abrir */
body.rates-page .rate-chev{width:20px;height:20px;fill:none;stroke:var(--faint);stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;transition:transform .2s,stroke .2s}
body.rates-page button.rate-row:hover .rate-chev{stroke:var(--green)}
body.rates-page .rate.is-open .rate-chev{transform:rotate(180deg);stroke:var(--green)}

/* ---------- Gráfica grande ---------- */
body.rates-page .rate-panel{padding:6px clamp(16px,2.4vw,28px) 26px}
body.rates-page .rate-panel[hidden]{display:none}
body.rates-page .panel-top{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:12px 20px;margin:0 0 14px}
body.rates-page .panel-title{display:flex;align-items:center;flex-wrap:wrap;gap:8px 12px;min-width:0}
body.rates-page .panel-title strong{font-size:16px;font-weight:650;color:var(--ink);letter-spacing:-.01em}
body.rates-page .panel-title .chg-pill{background:var(--card)}
body.rates-page .range{display:inline-flex;gap:4px;padding:4px;background:var(--card);border:1px solid var(--line);border-radius:10px}
body.rates-page .range button{min-height:34px;padding:0 14px;border:0;border-radius:7px;background:transparent;color:var(--muted);font-size:13px;font-weight:600;white-space:nowrap}
body.rates-page .range button:hover{color:var(--ink);background:var(--surface)}
body.rates-page .range button[aria-pressed="true"]{background:var(--green);color:var(--on-green)}
body.rates-page .range button:focus-visible{outline:3px solid var(--green);outline-offset:2px}

body.rates-page .chart{position:relative;width:100%;border-radius:12px;background:var(--card);border:1px solid var(--line);outline:0;touch-action:pan-y;user-select:none;-webkit-user-select:none}
body.rates-page .chart:focus-visible{outline:3px solid var(--green);outline-offset:3px}
body.rates-page .chart svg{display:block;overflow:visible;width:100%}
body.rates-page .chart text{font-family:inherit;font-size:12px;fill:var(--faint);font-variant-numeric:tabular-nums}
body.rates-page .chart .grid{stroke:var(--line);stroke-width:1;stroke-dasharray:3 4}
body.rates-page .chart .base{stroke:var(--line);stroke-width:1}
body.rates-page .chart .cross{stroke:var(--faint);stroke-width:1;stroke-dasharray:3 3;opacity:0}
body.rates-page .chart.is-hover .cross{opacity:.8}
body.rates-page .chart .tip{position:absolute;top:8px;left:0;padding:6px 11px;background:var(--card);border:1px solid var(--line);border-radius:9px;box-shadow:0 3px 12px var(--shadow);font-size:13px;line-height:1.35;color:var(--ink);white-space:nowrap;pointer-events:none;font-variant-numeric:tabular-nums}
body.rates-page .chart .tip small{display:block;font-size:12px;color:var(--faint)}
body.rates-page .chart .tip b{font-weight:650}
body.rates-page .chart:not(.is-hover) .tip{background:transparent;border-color:transparent;box-shadow:none}

/* Línea que se dibuja sola, área con degradado y punto final con halo */
body.rates-page svg .draw{fill:none;stroke:var(--green);stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:1;stroke-dashoffset:1}
body.rates-page svg .area,
body.rates-page svg .dot,
body.rates-page svg .halo{opacity:0}
body.rates-page .grown .draw{stroke-dashoffset:0;transition:stroke-dashoffset 1s cubic-bezier(.22,1,.36,1);transition-delay:calc(var(--i,0)*45ms)}
body.rates-page .grown .area{opacity:1;transition:opacity .7s ease .25s}
body.rates-page .grown svg .dot{opacity:1;transition:opacity .3s ease .8s}
body.rates-page .grown .halo{opacity:.2;transition:opacity .3s ease .8s}
body.rates-page .chart svg .dot{stroke:var(--card);stroke-width:2}
body.rates-page .instant .draw,
body.rates-page .instant .area,
body.rates-page .instant .dot,
body.rates-page .instant .halo{transition:none!important}
@media(prefers-reduced-motion:reduce){
body.rates-page svg .draw,body.rates-page svg .area,body.rates-page svg .dot,body.rates-page svg .halo{transition:none!important}
body.rates-page .rate-chev{transition:none}
}

body.rates-page .rates-note{margin:18px 0 0;font-size:14px;line-height:1.7;color:var(--muted);max-width:75ch}
body.rates-page .doc article .rates-note{font-size:14px;margin-top:18px}

/* ---------- Tabla de fuentes ---------- */
body.rates-page table.sources-table{min-width:0;table-layout:auto}
body.rates-page table.sources-table th,
body.rates-page table.sources-table td{padding:16px 20px;line-height:1.65}
body.rates-page table.sources-table td:first-child{min-width:220px;font-weight:500}
body.rates-page table.sources-table td:nth-child(3){min-width:140px}
body.rates-page table.sources-table td:nth-child(4){min-width:230px}
body.rates-page .doc article section[id]:not(:first-of-type) h2{margin-top:64px}

/* ---------- Tablet y celular ---------- */
@media(max-width:900px){
body.rates-page .doc-shell,
body.rates-page:not(:has(.doc-toc)) .doc-shell{width:calc(100% - 48px)}
body.rates-page .doc-hero{padding:52px 0 40px}
body.rates-page .doc-body{padding:40px 0 72px}

/* Cada fila pasa a cuatro renglones: moneda y valor / gráfica / cambio / fuente */
body.rates-page .rates-head{display:none}
body.rates-page .rate-row,
body.rates-page .rates-card.no-history .rate-row{grid-template-columns:minmax(0,1fr) auto 20px;grid-template-areas:"cur val chev" "spark spark spark" "chg chg chg" "src src src";row-gap:12px;column-gap:14px;padding-block:18px}
body.rates-page .rates-card.no-history .rate-row{grid-template-areas:"cur val" "src src";grid-template-columns:minmax(0,1fr) auto}
body.rates-page .rate-cur{grid-area:cur}
body.rates-page .rate-val{grid-area:val;font-size:19px}
body.rates-page .rate-chev{grid-area:chev}
body.rates-page .rate-spark{grid-area:spark;height:44px}
body.rates-page .rate-chg{grid-area:chg}
body.rates-page .rate-src{grid-area:src;flex-direction:row;flex-wrap:wrap;align-items:baseline;gap:0 6px;margin-top:-4px}
body.rates-page .rate-src b,body.rates-page .rate-src span{white-space:nowrap}
body.rates-page .rate-src .sep{display:inline}
body.rates-page .chg-period{display:inline}
body.rates-page .rate-row .sp{display:none}
body.rates-page .rate-row.plain,
body.rates-page .rates-card .rate-row.plain{grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"cur val" "src src"}
body.rates-page .rate-row.plain .rate-src{justify-content:flex-start;text-align:left}
}

@media(max-width:650px){
body.rates-page .doc-shell,
body.rates-page:not(:has(.doc-toc)) .doc-shell{width:calc(100% - 32px)}
body.rates-page .doc-hero p{font-size:16px}
body.rates-page .rates-card{border-radius:14px}
body.rates-page .rate-row,
body.rates-page .rates-card.no-history .rate-row{padding-inline:16px}
body.rates-page .rate-badge{min-width:50px}
body.rates-page .rate-panel{padding:4px 12px 20px}
body.rates-page .panel-top{flex-direction:column;align-items:stretch}
body.rates-page .range{display:grid;grid-auto-flow:column;grid-auto-columns:1fr}
body.rates-page .range button{padding:0 6px}
body.rates-page .hero-updated{white-space:normal}

/* La tabla de fuentes pasa a tarjetas: sin barra de desplazamiento lateral */
body.rates-page .doc-table-wrap{border:0;background:transparent;overflow:visible}
body.rates-page table.sources-table,
body.rates-page table.sources-table tbody{display:block}
body.rates-page table.sources-table thead{display:none}
body.rates-page table.sources-table tr{display:block;margin:0 0 14px;padding:6px 18px;background:var(--card);border:1px solid var(--line);border-radius:14px}
body.rates-page table.sources-table td,
body.rates-page table.sources-table td:first-child,
body.rates-page table.sources-table td:nth-child(3),
body.rates-page table.sources-table td:nth-child(4){display:block;min-width:0;padding:12px 0;border-bottom:1px solid var(--line)}
body.rates-page table.sources-table td:last-child{border-bottom:0}
body.rates-page table.sources-table td::before{content:attr(data-label);display:block;margin-bottom:2px;font-size:11px;font-weight:650;letter-spacing:.08em;text-transform:uppercase;color:var(--faint)}
body.rates-page table.sources-table tbody tr:hover td{background:transparent}
body.rates-page .doc article section[id]:not(:first-of-type) h2{margin-top:48px}
}
body.rates-page .pill-slot{display:inline-flex;align-items:center;gap:10px}
