/* Precio de bolsa. Built on the .ex system from excedentes.css. This file adds the
   hero, the interactive monthly chart and page layout. Everything is scoped to .bp. */

@keyframes bp-fade { from { opacity: 0; } to { opacity: 1; } }

.bp { --up: #136b4b; --down: #a8321c; }

/* Hero */
.bp .bp-hero { padding: 22px 0 120px; --up: #6ee7b7; --down: #fca5a5; }
.bp .bp-hero h1 { max-width: 20ch; }
.bp-hero h1 span { color: var(--accent); }
.bp .bp-eyebrow { margin-top: 30px; font: 600 0.74rem/1.2 var(--b); letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255, 255, 255, 0.6); }
.bp .bp-hero .ex-lead { max-width: 60ch; }
.bp .bp-stats { display: grid; grid-template-columns: minmax(0, 1.5fr) repeat(2, minmax(0, 1fr)); margin-top: 40px; }
.bp-stats > div { min-width: 0; padding: 18px 22px 0; border-left: 1px solid rgba(255, 255, 255, 0.14); }
.bp-stats > div:first-child { padding-left: 0; border-left: 0; }
.bp-stats dt { margin-bottom: 8px; font-size: 0.84rem; line-height: 1.35; color: rgba(255, 255, 255, 0.64); }
.bp-stats dd { font: 800 1.5rem/1.1 var(--d); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: #fff; }
.bp-stat-main dd { font-size: clamp(2.5rem, 5vw, 3.7rem); line-height: 1; letter-spacing: -0.035em; }
.bp-stats small { font: 500 0.85rem var(--b); letter-spacing: 0; color: rgba(255, 255, 255, 0.66); }

/* Change values: green for a rise, red for a fall, always with an arrow */
.bp .bp-delta[data-tone="up"] { color: var(--up); }
.bp .bp-delta[data-tone="down"] { color: var(--down); }
.bp .bp-delta[data-tone="up"]::before { content: "▲\00a0"; font-size: 0.7em; vertical-align: 0.12em; }
.bp .bp-delta[data-tone="down"]::before { content: "▼\00a0"; font-size: 0.7em; vertical-align: 0.12em; }

/* Body and chart card. The card overlaps the hero's bottom padding. */
.bp .bp-body { padding-bottom: 72px; }
.bp .bp-chart-card { position: relative; z-index: 2; margin-top: -104px; padding: 28px 30px 22px; border: 1px solid rgba(181, 196, 190, 0.7); border-radius: 26px; background: var(--card); box-shadow: 0 1px 2px rgba(11, 31, 35, 0.06), 0 40px 90px -40px rgba(11, 31, 35, 0.5); }
.bp .bp-chart-card h2 { font-size: 1.45rem; }
.bp-chart-sub { margin-top: 6px; font-size: 0.9rem; color: var(--mute); }
.bp-chart-hint { margin-top: 14px; font-size: 0.86rem; color: var(--mute); }

/* Chart geometry. Each month owns one band; the SVG uses a 0-100 space. */
.bp-chart { position: relative; height: 300px; margin: 18px 0 40px; padding-left: 54px; }
.bp-axis { position: absolute; top: 0; bottom: 0; left: 0; width: 46px; font-size: 0.74rem; color: var(--mute); font-variant-numeric: tabular-nums; }
.bp-axis span { position: absolute; right: 0; transform: translateY(-50%); white-space: nowrap; }
.bp-plot { position: relative; height: 100%; }
.bp-plot > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.bp-grid-line { stroke: #e2e9e4; stroke-width: 1; vector-effect: non-scaling-stroke; }
.bp-series { animation: bp-fade 0.9s ease-out both; }
.bp-area { fill: url(#bp-fill); }
.bp-price-line { fill: none; stroke: #b07400; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.bp-avg-line { stroke: var(--ink); stroke-width: 1; stroke-opacity: 0.5; stroke-dasharray: 5 5; vector-effect: non-scaling-stroke; }

/* Month bands: real buttons for months with a verified value, decorative for the rest. */
.bp-band { position: absolute; top: 0; bottom: 0; }
.bp-point { margin: 0; padding: 0; border: 0; border-radius: 12px; background: transparent; color: var(--mute); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.bp-point:hover, .bp-point:focus-visible { background: linear-gradient(180deg, rgba(255, 180, 0, 0.12), rgba(255, 180, 0, 0.02)); }
.bp-point:focus-visible { outline-offset: -3px; }
.bp-point-dot { position: absolute; left: 50%; top: var(--y-price); width: 12px; height: 12px; translate: -50% -50%; border: 2.5px solid #b07400; border-radius: 50%; background: #fff; transition: background 0.2s, scale 0.2s, box-shadow 0.2s; animation: bp-fade 0.5s ease-out both; animation-delay: calc(var(--i) * 70ms + 300ms); }
.bp-point[aria-pressed="true"] .bp-point-dot { scale: 1.35; border-color: var(--ink); background: var(--accent); box-shadow: 0 0 0 6px rgba(255, 180, 0, 0.28); }
.bp-point-label { position: absolute; left: 50%; top: calc(100% + 12px); translate: -50% 0; font: 500 0.8rem var(--b); color: var(--mute); white-space: nowrap; }
.bp-point[aria-pressed="true"] .bp-point-label { color: var(--text); font-weight: 700; }
.bp-band.is-pending { border-radius: 12px; background: repeating-linear-gradient(135deg, rgba(11, 31, 35, 0.055) 0 6px, transparent 6px 12px); pointer-events: none; }
.bp-band.is-pending .bp-point-label { color: #8a9a95; }

/* Crosshair and tooltip follow the month under the pointer, focus or touch. */
.bp-cross { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px dashed rgba(11, 31, 35, 0.38); pointer-events: none; transition: left 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
.bp-tip { --up: #6ee7b7; --down: #fca5a5; position: absolute; z-index: 3; min-width: 150px; padding: 10px 13px; border-radius: 13px; background: var(--ink); color: #fff; box-shadow: 0 18px 36px -12px rgba(11, 31, 35, 0.55); pointer-events: none; opacity: 0; translate: -50% calc(-100% - 14px); transition: opacity 0.18s ease, left 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), top 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
.bp-tip.is-visible { opacity: 1; }
.bp-tip.is-below { translate: -50% 14px; }
.bp-tip.is-start { translate: 0 calc(-100% - 14px); }
.bp-tip.is-start.is-below { translate: 0 14px; }
.bp-tip.is-end { translate: -100% calc(-100% - 14px); }
.bp-tip.is-end.is-below { translate: -100% 14px; }
.bp-tip-month { display: block; font-size: 0.76rem; color: rgba(255, 255, 255, 0.72); }
.bp-tip strong { display: block; font: 800 1.25rem/1.15 var(--d); font-variant-numeric: tabular-nums; }
.bp-tip small { font: 400 0.72rem var(--b); color: rgba(255, 255, 255, 0.72); }
.bp-tip-change { display: block; font-size: 0.78rem; color: rgba(255, 255, 255, 0.72); }

/* Readout, legend and footnote */
.bp-readout { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 18px; margin-top: 4px; padding: 16px 20px; border: 1px solid #dfe7e2; border-radius: 16px; background: #f1f5f2; }
.bp-readout-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; }
.bp-readout-month { font-weight: 600; }
.bp-readout strong { font: 800 1.45rem/1 var(--d); font-variant-numeric: tabular-nums; }
.bp-readout strong small { font: 400 0.82rem var(--b); color: var(--mute); }
.bp-readout .bp-delta { font-weight: 700; font-size: 0.95rem; }
.bp-readout-note { font-size: 0.84rem; color: var(--mute); }
.bp-readout > a { font-size: 0.9rem; font-weight: 600; color: #155b66; }
.bp-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 16px 0 0; padding: 0; list-style: none; font-size: 0.8rem; color: var(--mute); }
.bp-legend li { display: inline-flex; align-items: center; gap: 8px; }
.bp-legend i { display: inline-block; flex-shrink: 0; }
.bp-key-dash { width: 18px; border-top: 2px dashed var(--ink); opacity: 0.5; }
.bp-key-pending { width: 12px; height: 12px; border-radius: 4px; border: 1px solid rgba(11, 31, 35, 0.15); background: repeating-linear-gradient(135deg, rgba(11, 31, 35, 0.3) 0 2px, transparent 2px 4px); }
.bp-chart-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 20px; margin-top: 16px; padding-top: 14px; border-top: 1px solid #e3e9e4; }
.bp .bp-chart-note { font-size: 0.82rem; color: var(--mute); }
.bp-table-link { font-size: 0.9rem; font-weight: 600; color: #155b66; white-space: nowrap; }
.bp-empty p { margin-top: 8px; color: var(--mute); }

/* Lower sections */
.bp .bp-context { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 32px; margin-top: 32px; padding: 28px 30px; border: 1px solid var(--ink-2); border-radius: 20px; background: radial-gradient(ellipse at top right, rgba(255, 180, 0, 0.09), transparent 65%), var(--ink); color: #fff; }
.bp .bp-context-label { margin-bottom: 10px; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.13em; text-transform: uppercase; color: var(--accent); }
.bp .bp-context h2 { font-size: 1.4rem; line-height: 1.25; }
.bp .bp-context-description { max-width: 68ch; margin-top: 8px; font-size: 0.92rem; color: rgba(255, 255, 255, 0.74); }
.bp .bp-context-link { display: inline-flex; align-items: center; gap: 14px; min-height: 44px; font-size: 0.94rem; font-weight: 600; color: var(--accent); text-decoration: none; }
.bp-context-arrow { display: grid; place-items: center; flex-shrink: 0; width: 42px; height: 42px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 1.3rem; transition: transform 0.2s; }
.bp .bp-context-link:hover > span:first-child { text-decoration: underline; text-underline-offset: 4px; }
.bp .bp-context-link:hover .bp-context-arrow { transform: translateX(3px); }
.bp .bp-context :focus-visible { outline-color: var(--accent); }
.bp .bp-section { padding-top: 56px; scroll-margin-top: 24px; }
.bp .bp-section h2 { font-size: 1.7rem; }
.bp-section-head > p { margin-top: 8px; font-size: 0.9rem; color: var(--mute); }
.bp-table-wrap { margin-top: 20px; overflow-x: auto; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: 0 1px 3px rgba(11, 31, 35, 0.08); }
.bp-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.bp-table th, .bp-table td { padding: 13px 20px; text-align: left; border-bottom: 1px solid #e3e9e4; }
.bp-table thead th { background: #fdf3d6; color: var(--text); font-weight: 600; font-size: 0.8rem; }
.bp-table tbody th { font-weight: 500; }
.bp-table tr:last-child > * { border-bottom: 0; }
.bp-table th:nth-child(2), .bp-table td.bp-table-price { text-align: right; }
.bp-table-price { font-weight: 700; font-variant-numeric: tabular-nums; }
.bp-table td small { display: block; max-width: 28ch; margin-top: 3px; font-size: 0.76rem; color: var(--mute); }
.bp-table a { display: inline-flex; align-items: center; min-height: 32px; font-weight: 600; color: #155b66; }
.bp-missing { font-size: 0.84rem; color: var(--mute); background: #f7f9f5; }
.bp .ex-faq a { color: #155b66; }

@media (max-width: 760px) {
  .bp .ex-top-row { height: auto; padding-top: 14px; padding-bottom: 14px; }
  .bp .ex-nav { flex-wrap: wrap; gap: 0; }
  .bp .ex-nav a { font-size: 0.8rem; padding: 8px; }
  .bp .bp-hero { padding-bottom: 96px; }
  .bp .bp-stats { grid-template-columns: 1fr 1fr; gap: 20px 18px; margin-top: 30px; }
  .bp-stats > div { padding: 0; border: 0; }
  .bp-stat-main { grid-column: 1 / -1; }
  .bp-stats dd { font-size: 1.3rem; }
  .bp-stat-main dd { font-size: clamp(2.6rem, 14vw, 3.2rem); }
  .bp .bp-chart-card { margin-top: -80px; padding: 22px 14px 18px; border-radius: 22px; }
  .bp-chart { height: 240px; padding-left: 38px; }
  .bp-axis { width: 34px; font-size: 0.66rem; }
  .bp-point-label { font-size: 0.68rem; }
  .bp-tip { min-width: 128px; padding: 8px 10px; }
  .bp-tip strong { font-size: 1.05rem; }
  .bp-readout { padding: 14px; }
  .bp .bp-context { grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 22px; }
  .bp .bp-context h2 { font-size: 1.3rem; }
  .bp .bp-context-link { justify-content: space-between; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, 0.14); }
  .bp-table th, .bp-table td { padding: 10px; }
  .bp-table { font-size: 0.84rem; }
  .bp-table td small { max-width: 14ch; font-size: 0.68rem; }
}

/* Year list and metric explainer */
.bp .bp-year-list { display: grid; gap: 12px; margin: 22px 0 0; padding: 0; list-style: none; }
.bp .bp-year-link { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 20px; min-height: 44px; padding: 18px 20px; border: 1px solid #dfe7e2; border-radius: 16px; background: #f7faf8; color: var(--text); text-decoration: none; transition: border-color 0.2s, background 0.2s; }
.bp .bp-year-link:hover { border-color: #155b66; background: #fff; }
.bp .bp-year-link:focus-visible { outline: 3px solid #155b66; outline-offset: 3px; }
.bp .bp-year-title { font: 800 1.25rem/1.2 var(--d); letter-spacing: -0.01em; }
.bp .bp-year-meta { grid-column: 1; font-size: 0.9rem; color: var(--mute); }
.bp .bp-year-cta { grid-row: 1 / span 2; grid-column: 2; font-weight: 600; color: #155b66; white-space: nowrap; }
.bp .bp-empty-text { margin-top: 12px; color: var(--mute); }

.bp .bp-facts { display: grid; margin: 18px 0 0; }
.bp .bp-facts > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 20px; padding: 16px 0; border-top: 1px solid #e3e9e4; }
.bp .bp-facts dt { font-weight: 600; color: var(--text); }
.bp .bp-facts-note { grid-column: 1 / -1; font-size: 0.88rem; color: var(--mute); }
.bp .bp-facts-link { margin-top: 18px; }
.bp .bp-facts-link a { color: #155b66; font-weight: 600; }

@media (max-width: 760px) {
  .bp .bp-year-link { grid-template-columns: minmax(0, 1fr); }
  .bp .bp-year-cta { grid-row: auto; grid-column: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .bp *, .bp *::before, .bp *::after { animation: none !important; transition: none !important; }
}
