/* Homepage sections. Builds on home.css (cards, tabs, agenda) and market-pulse.css (summary, movers tables). */
.hp-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Quotes lead the page in one row; values scale with the row so the Merval keeps its decimals. */
.hp-quotes { margin-bottom: 36px; container-type: inline-size; }
.home-page .hp-quotes .edition-quote-summary strong { font-size: clamp(16px, 2.3cqi, 28px); }
.hp-quotes .edition-quote-name { font-size: 14px; }

/* The written summary sits beside the agenda; closed, its preview fills the agenda's height. */
.home-page .hp-summary { align-self: start; margin: 0; }
.home-page .hp-summary .pulse-summary-title { font-size: 22px; }
.home-page .hp-summary:not(.is-open) .pulse-summary-body { max-height: 10.5em; }
.home-page .edition-agenda-heading { padding-top: 0; }
/* Without a summary the agenda takes the row, its days side by side. */
.hp-lead-solo { grid-template-columns: 1fr; }
.hp-lead-solo .edition-agenda { min-height: 0; padding-left: 0; border-left: 0; }
.hp-lead-solo .edition-agenda-inner { position: static; }
.hp-lead-solo .edition-agenda-days { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px 28px; overflow: visible; }
.hp-lead-solo .edition-day + .edition-day { margin-top: 0; }

/* Secondary sections: one compact heading line instead of the chapter header. */
.hp-section { padding: 28px 0 32px; border-top: 1px solid var(--color-border); }
.hp-section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.hp-section-heading h2 { margin: 0; font: 600 22px/1.2 var(--font-interface); letter-spacing: -.02em; }
.edition .hp-section-heading a { flex: none; color: var(--color-accent); font-size: 14px; font-weight: 600; }
.edition .hp-section-heading a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Session: a vertical menu per market; one market's three biggest gains and losses at a time. */
.hp-session { grid-template-columns: 250px minmax(0, 1fr); }
.hp-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; align-items: start; }
.hp-pair > .edition-panel-empty { grid-column: 1 / -1; }
.hp-session .edition-table { font-size: 14px; }
.hp-session .edition-table :is(th, td) { padding-top: 6px; padding-bottom: 6px; }
.hp-session .edition-table .pulse-spark-cell { width: 72px; padding-left: 6px; padding-right: 6px; }
.hp-session caption.pulse-table-title small { color: var(--color-text-secondary); font-weight: 500; }
.hp-session .edition-panel > .edition-action { font-size: 15px; }

/* Economía: compact thematic rows; available figures share the row. */
.hp-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px 20px; margin: 0; padding: 0; list-style: none; }
.hp-stats li { min-width: 0; padding: 0; border-bottom: 1px solid var(--color-border); }
.hp-panel-actions { display: flex; flex-wrap: wrap; gap: 0 28px; }
.hp-session .hp-panel-actions .edition-action { padding-top: 18px; font-size: 15px; }
.hp-stats a { display: flex; flex-direction: column; gap: 7px; height: 100%; box-sizing: border-box; padding: 12px 4px; text-decoration: none; }
.hp-stat-name { display: block; color: var(--color-text-secondary); font-size: 12px; font-weight: 500; line-height: 1.4; text-wrap: balance; }
.hp-stats a:hover, .hp-stats a:focus-visible { background: var(--color-surface-warm); }
.hp-stats a:hover .hp-stat-name, .hp-stats a:focus-visible .hp-stat-name { color: var(--color-accent); }
.hp-stat-value { margin-top: auto; color: var(--color-text); font-size: clamp(18px, 1.65vw, 23px); font-weight: 600; line-height: 1.2; letter-spacing: -.025em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hp-stat-value small { color: var(--color-text-secondary); font-size: .56em; font-weight: 500; letter-spacing: 0; }
.hp-stat-date { color: var(--color-text-secondary); font-size: 10px; line-height: 1.4; }

/* Tools: four compact cards with what each one answers. */
.hp-tools { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.hp-tool { display: flex; flex-direction: column; min-width: 0; padding: 18px 18px 16px; border: 1px solid var(--color-border); border-radius: 8px; background: var(--color-surface); transition: border-color .15s, box-shadow .15s; }
/* The whole box opens the tool; the example and the button stay usable above it. */
.hp-tool h3 a::after { content: ""; position: absolute; inset: 0; }
.hp-tool:hover { border-color: var(--color-accent); box-shadow: 0 4px 14px rgba(0, 0, 0, .08); }
.hp-tool:hover h3 a { color: var(--color-accent); }
.hp-tool h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font: 600 17px/1.25 var(--font-interface); letter-spacing: -.01em; }
.hp-tool h3 .edition-icon { width: 22px; height: 22px; color: var(--color-accent); }
.hp-tool > p { margin: 0; color: var(--color-text-secondary); font-size: 14px; line-height: 1.45; }
.hp-tool { position: relative; }
.hp-tool-foot { position: relative; z-index: 1; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 14px; }
.edition .hp-tool .edition-action { padding-top: 0; font-size: 14px; }

/* Example: the tool's opening scenario, floating under its card so the row keeps its height. */
.hp-example summary { color: var(--color-text-secondary); font-size: 13px; font-weight: 600; list-style: none; cursor: pointer; white-space: nowrap; }
.hp-example summary::-webkit-details-marker { display: none; }
.hp-example summary::after { content: ''; display: inline-block; width: 6px; height: 6px; margin: 0 2px 2px 7px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); transition: transform .2s; }
.hp-example[open] summary::after { margin-bottom: -1px; transform: rotate(-135deg); }
.hp-example summary:hover, .hp-example[open] summary { color: var(--color-accent); }
.hp-example summary:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; border-radius: 2px; }
.hp-example-body { position: absolute; z-index: 5; top: calc(100% + 8px); left: -1px; right: -1px; padding: 16px 18px; border: 1px solid var(--color-border); border-radius: 8px;
    background: var(--color-surface); box-shadow: 0 2px 4px rgb(0 0 0 / .05), 0 12px 32px rgb(0 0 0 / .12); font-size: 13px; line-height: 1.45; }
.hp-example-body p { margin: 0 0 10px; color: var(--color-text); }
.hp-example-body .hp-example-note { color: var(--color-text-secondary); font-size: 12px; }
.hp-example-figure { display: flex; flex-direction: column; gap: 1px; }
.hp-example-figure strong { font-size: 24px; font-weight: 700; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.hp-example-figure span { color: var(--color-text-secondary); font-size: 12px; }
.hp-example-options { display: grid; gap: 4px; margin: 0 0 10px; padding: 0; list-style: none; font-variant-numeric: tabular-nums; }
.hp-example-options li { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 6px 8px; border-radius: 4px; background: var(--surface-container); }
.hp-example-options strong { white-space: nowrap; }
.hp-example-options li[data-tone="best"] { color: var(--color-positive); background: color-mix(in srgb, var(--color-positive) 10%, transparent); }
.hp-example-options li[data-tone="best"] span::after { content: 'Menor costo'; display: block; font-size: 11px; font-weight: 600; }
.edition .hp-example-body > a { color: var(--color-accent); font-size: 13px; font-weight: 600; }
.edition .hp-example-body > a:hover { text-decoration: underline; text-underline-offset: 3px; }

[data-theme="dark"] .hp-tool { background: var(--surface-container); }
[data-theme="dark"] .hp-example-body { background: #1f1f1f; border-color: #363636; box-shadow: 0 12px 32px rgb(0 0 0 / .5); }
[data-theme="dark"] .hp-example-options li:not([data-tone="best"]) { background: #262626; }
@media (prefers-reduced-motion: reduce) { .hp-example summary::after { transition: none; } }

@media (max-width: 1180px) {
    .hp-pair { grid-template-columns: 1fr; }
    .hp-pair > .edition-table + .edition-table { margin-top: 14px; }
    .home-page .hp-summary:not(.is-open) .pulse-summary-body { max-height: 5em; }
}
@media (max-width: 1100px) {
    .hp-tools { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hp-session { grid-template-columns: 210px minmax(0, 1fr); }
}
/* Below 950px home.css wraps the cards into rows; their values no longer need to shrink. */
@media (max-width: 950px) {
    .home-page .hp-quotes .edition-quote-summary strong { font-size: 24px; }
}
@media (max-width: 760px) {
    .hp-session { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .hp-quotes { margin-bottom: 24px; }
    .home-page .hp-quotes .edition-quote-summary strong { font-size: clamp(20px, 6vw, 26px); }
    .home-page .hp-summary .pulse-summary-title { font-size: 20px; }
    .hp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 16px; }
    /* Two columns: the figures flow in theme order without fixed cells. */
    .hp-stats li { grid-area: auto !important; padding: 0; border-left: 0; }
    .hp-stats li:nth-child(odd) { padding-left: 0; }
    .hp-stats li:nth-child(even) { border-left: 0; }
    .hp-section-heading { flex-wrap: wrap; }
    .hp-tools { grid-template-columns: 1fr; }
    /* One card per row: the example opens inside its card. */
    .hp-tool-foot { flex-wrap: wrap; }
    .hp-example { flex-basis: 100%; }
    .hp-example summary { display: inline-block; }
    .hp-example-body { position: static; margin-top: 10px; box-shadow: none; }
}
