/* Blog, laid out like yo.xyz/blog in Bacán's colours and type: the index is a big title,
   category pills and a two-column card grid (16:9 cover, date, title, excerpt); a post is
   breadcrumb, cover, title, date and byline over an 864px reading column. Prose, tables
   and callouts come from ../ayuda/ayuda.css. */

/* ---- Index and category pages --------------------------------------------------------------- */
.blog-index main { width: min(100% - 32px, 1040px); padding-block: 72px 112px; }
.blog-index h1 { margin-bottom: 16px; font-size: clamp(3rem, 8vw, 4.5rem); }
.blog-index main > p { max-width: 60ch; color: var(--neutral-600); }

/* width: auto overrides the site-wide nav width (styles.css). */
.blog-pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; width: auto; margin: 40px 0 48px; }
.blog-pill {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 20px;
  border: 1px solid var(--green); border-radius: 999px; color: var(--green);
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; text-decoration: none;
}
.blog-pill[aria-current="page"] { background: var(--green); color: #fff; }

.blog-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 80px 32px; margin: 0; padding: 0; list-style: none; }
.blog-card { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; margin: 0; }
.blog-card-cover { display: block; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 10px; background: var(--green); }
.blog-card-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
@media (hover: hover) and (pointer: fine) {
  .blog-pill:hover { background: var(--green-tint); }
  .blog-card h2 a:hover, .post-crumbs a:hover { color: var(--green); }
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .blog-card-cover img { transition: scale 300ms ease; }
  .blog-card:hover .blog-card-cover img { scale: 1.05; }
}
.blog-card-date { margin: 0; color: var(--green); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; }
.blog-card h2 { margin: 0; font-size: 1.75rem; line-height: 1.1; }
.blog-card h2 a { color: inherit; text-decoration: none; }
.blog-card p:last-child { margin: 0; color: var(--neutral-600); }

/* ---- Posts ---------------------------------------------------------------------------------- */
.blog-post main { width: min(100% - 32px, 864px); padding-block: 56px 112px; }
.post-crumbs { display: flex; flex-wrap: wrap; gap: 8px; width: auto; margin: 0 0 24px; color: var(--neutral-600); font-size: var(--fs-small); }
.post-crumbs a { color: inherit; text-decoration: none; }
.post-cover { margin: 0 0 32px; }
.post-cover img { display: block; width: 100%; height: auto; border-radius: 10px; }
.blog-post h1 { margin: 0 0 16px; color: var(--neutral-800); font-size: clamp(2.25rem, 6vw, 3rem); line-height: 1; }
/* Same specificity as ayuda.css's lead-paragraph rule, which would otherwise enlarge the date. */
.blog-post main > p.post-date { margin: 0; color: var(--neutral-600); font-size: var(--fs-small); font-weight: 600; }
.post-byline { margin: 4px 0 40px; color: var(--neutral-600); font-size: var(--fs-small); }
.post-body p, .post-body li { line-height: 1.65; }
.post-body > p:first-child { font-size: 1.0625rem; }

/* Charts and figures run the full column (the help center's .shot is a phone screenshot). */
.blog .shot img { max-width: 100%; border: var(--rule); border-radius: 10px; box-shadow: none; }

/* Price tables: figures line up and long headers wrap instead of widening the table. */
.blog td { font-variant-numeric: tabular-nums; }
.blog th { white-space: normal; vertical-align: bottom; }

/* ---- Interactive pieces (widgets/widgets.js) -------------------------------------------------- */
/* The shared box, controls and result card; each widget's own layout lives in widgets/<name>.css. */
.widget { margin: 40px 0; padding: 24px; border: var(--rule); border-radius: 16px; background: var(--neutral-100); }
.widget:empty { display: none; }
.widget h3 { margin: 0 0 4px; font-size: 1.375rem; line-height: 1.2; }
.widget-lead { margin: 0 0 20px; color: var(--neutral-600); font-size: var(--fs-small); }
.widget-label { display: block; margin: 0 0 8px; font-size: var(--fs-small); font-weight: 600; }
.widget-note { margin: 16px 0 0; color: var(--neutral-600); font-size: 0.75rem; line-height: 1.5; }
.widget-total { margin: 0; font-family: var(--font-display); font-size: 2rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
/* Every headline amount reads the same: an optional .widget-label above, the .widget-total, then one
   small grey .widget-meta line right under it («$4.021 más (+34%)», «$108.636 al año»). */
.widget .widget-total + .widget-meta { margin-top: 4px; }

/* Choice pills (a role="radiogroup" of buttons with aria-checked) and range sliders. */
.widget-choices { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }
.widget-choice {
  -webkit-tap-highlight-color: transparent;
  min-height: 40px; padding: 0 16px; border: 1px solid var(--neutral-300); border-radius: 999px;
  background: var(--neutral-100); color: var(--neutral-800); font: inherit; font-size: var(--fs-small); font-weight: 500; cursor: pointer;
}
.widget-choice[aria-checked="true"], .widget-choice[aria-pressed="true"] { border-color: var(--green); background: var(--green); color: #fff; }
.widget-choice:focus-visible, .widget-btn:focus-visible, .widget-share:focus-visible { outline: 2px solid var(--neutral-800); outline-offset: 2px; }
.widget input[type="range"] { width: 100%; margin: 0 0 20px; accent-color: var(--green); }
.widget input[type="range"]:focus-visible { outline: 2px solid var(--neutral-800); outline-offset: 4px; }

/* Buttons: primary is the header's «Únete a la lista» green; secondary is outlined. */
.widget-btn {
  -webkit-tap-highlight-color: transparent;
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 20px;
  border: 1px solid var(--green); border-radius: 999px; background: var(--green); color: #fff;
  font: inherit; font-size: var(--fs-small); font-weight: 600; text-decoration: none; cursor: pointer;
}
.widget-btn.secondary { background: var(--neutral-100); color: var(--green); }
.widget-btn, .widget-choice { transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease; }
@media (prefers-reduced-motion: no-preference) {
  .widget-btn, .widget-choice {
    transition: scale 150ms var(--ease-out), background-color 150ms ease, border-color 150ms ease, color 150ms ease;
  }
  .widget-btn:not(:disabled):active, .widget-choice:not(:disabled):active { scale: 0.96; }
}

/* Dropdowns in Bacán's colours where the browser allows styling the open list (Chrome and Edge,
   «appearance: base-select»); elsewhere the system list stays, which on phones is the native picker. */
@supports (appearance: base-select) {
  .widget select, .widget select::picker(select) { appearance: base-select; }
  .widget select { display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; }
  .widget select::picker-icon { color: var(--neutral-600); }
  @media (prefers-reduced-motion: no-preference) {
    .widget select::picker-icon { transition: rotate 200ms cubic-bezier(0.2, 0, 0, 1); }
  }
  .widget select:open::picker-icon { rotate: 180deg; }
  .widget select::picker(select) {
    max-height: min(360px, 60dvh); margin-top: 6px; padding: 6px; overflow-y: auto; overscroll-behavior: contain;
    border: 1px solid var(--neutral-300); border-radius: 15px; background: var(--neutral-100);
    box-shadow: 0 12px 32px rgba(3, 65, 35, 0.12);
  }
  .widget select option { min-height: 40px; padding: 0 12px; border-radius: 8px; color: var(--neutral-800); font-size: var(--fs-small); }
  .widget select option::checkmark { order: 1; margin-left: auto; color: var(--green); }
  .widget select option:focus-visible { background: var(--green-tint); outline: none; }
  @media (hover: hover) and (pointer: fine) {
    .widget select option:hover { background: var(--green-tint); }
  }
  .widget select option:checked { color: var(--green); font-weight: 600; }
}

/* Ranked rows with bars, the layout of «Barata, intermedia y cara» (widgets/tres-marcas.css):
   <ol class="widget-rows"><li class="widget-row"> who | bar | value </li></ol>. Three text styles
   inside: .widget-value (amounts, names), .widget-meta (small grey detail), .widget-label. Bars: set
   the fill width from code (element.style.width); colours .bar-green (the answer / cheapest), the
   ramp .bar-ramp-0/1/2 (light to dark, as in the charts) and .bar-grey (the rest). */
.widget .widget-rows { margin: 8px 0 0; padding: 0; list-style: none; }
.widget .widget-rows li { margin: 0; padding-left: 0; }
.widget .widget-rows li::before { content: none; }
/* 13rem keeps a name plus a short grey line («cada alimento al menor precio») on one line each; the
   min-height keeps rows with and without that grey line the same height. */
.widget-row {
  display: grid; grid-template-columns: minmax(0, 13rem) minmax(0, 1fr) 7.5rem; align-items: center; gap: 16px;
  min-height: 70px; padding: 14px 0; border-top: var(--rule);
}
.widget-row:last-child { border-bottom: var(--rule); }
.widget-row-who, .widget-row-end { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.widget .widget-row-end { margin: 0; text-align: right; }
.widget-value { font-weight: 600; font-variant-numeric: tabular-nums; }
.widget-meta { color: var(--neutral-600); font-size: 0.8125rem; line-height: 1.35; font-variant-numeric: tabular-nums; }
.widget-bar { height: 20px; }
.widget-bar > span { display: block; width: 100%; height: 100%; clip-path: inset(0 100% 0 0); }
.widget-bar > span[hidden] { display: none; }
.widget-bar .bar-green, .widget-bar .bar-ramp-2 { background: var(--green); }
.widget-bar .bar-ramp-0 { background: #86b898; }
.widget-bar .bar-ramp-1 { background: #3f7f5b; }
.widget-bar .bar-grey { background: #8a928e; }
@media (max-width: 600px) {
  /* Who and value on the first line, the bar full width under them. */
  .widget-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 10px; }
  .widget-bar { grid-column: 1 / -1; grid-row: 2; }
}
/* A value change morphs the bar (BacanWidgets.bar sets the clip); reduced motion swaps it instantly. */
@media (prefers-reduced-motion: no-preference) {
  .widget-bar > span { transition: clip-path 240ms var(--ease-in-out); }
}

/* Result card dialog: the image, save/share buttons, then share links (the landing's share pills). */
.result-dialog {
  width: min(100% - 32px, 640px); max-height: calc(100% - 32px); padding: 24px; border: 1px solid transparent;
  border-radius: 35px; overflow: auto; overscroll-behavior: contain; outline: none;
}
.result-dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
/* Open: 250ms fade (and scale from 0.96 without reduced motion); close: 150ms. */
.result-dialog, .result-dialog::backdrop {
  transition: opacity 250ms var(--ease-out), overlay 250ms allow-discrete, display 250ms allow-discrete;
}
.result-dialog:not([open]), .result-dialog:not([open])::backdrop { opacity: 0; transition-duration: 150ms; }
@starting-style {
  .result-dialog[open], .result-dialog[open]::backdrop { opacity: 0; }
}
@media (prefers-reduced-motion: no-preference) {
  .result-dialog {
    transition: opacity 250ms var(--ease-out), scale 250ms var(--ease-out), overlay 250ms allow-discrete, display 250ms allow-discrete;
  }
  .result-dialog:not([open]) { scale: 0.96; }
  @starting-style {
    .result-dialog[open] { scale: 0.96; }
  }
}
.result-close { position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; border: 0; border-radius: 999px; background: transparent; font-size: 1.75rem; line-height: 1; cursor: pointer; }
.result-image { display: block; width: 100%; height: auto; margin: 16px 0; border-radius: 10px; outline: 1px solid oklch(0 0 0 / 0.1); outline-offset: -1px; }
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.result-actions .widget-btn { flex: 1 1 160px; }
.result-loading { margin: 32px 0; text-align: center; color: var(--neutral-600); }
.widget-share-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.widget-share {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 16px;
  border: 1px solid var(--neutral-300); border-radius: 100px; color: var(--neutral-800);
  font-size: var(--fs-small); font-weight: 500; text-decoration: none;
}
.widget-share svg { width: 16px; height: 16px; flex: none; }
@media (hover: hover) and (pointer: fine) {
  .widget-choice:hover { border-color: var(--green); }
  .widget-btn:hover { background: #022e19; /* --green, a step darker */ color: #fff; }
  .widget-share:hover { background: var(--neutral-300); }
}

@media (max-width: 720px) {
  .blog-grid { grid-template-columns: minmax(0, 1fr); gap: 56px; }
  .blog-card h2 { font-size: 1.5rem; }
  .blog-index main, .blog-post main { padding-top: 40px; }
  .widget { padding: 20px 16px; }
}
@media (prefers-reduced-motion: reduce) {
}
