/* Blog: editorial index + article template. Builds on the tokens in styles.css.
   Reading column is ~66ch of 1.125rem system sans; headings and pull quotes in Newsreader. */

/* Articles highlight "Blog" in the nav without claiming to be the blog index itself */
.nav a[aria-current="true"] {
  color: var(--ink);
  background: var(--paper-2);
}

/* ---------- shared: kicker line (category · date · reading time) ---------- */

.post-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 10px;
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.005em;
}

.post-kicker::before {
  content: "";
  width: 18px;
  height: 1px;
  background: currentColor;
  opacity: 0.7;
}

/* Items never break inside, and the separator trails its item, so a wrapped line never starts with a dot */
.post-kicker > span {
  white-space: nowrap;
}

.post-kicker > span:not(:last-child)::after {
  content: "·";
  margin-left: 10px;
  opacity: 0.8;
}

/* Long date by default; the short one wherever the long one would push the kicker onto two lines */
.post-kicker .kd-s {
  display: none;
}

@media (max-width: 560px) {
  .post-kicker .kd-l {
    display: none;
  }

  .post-kicker .kd-s {
    display: inline;
  }
}

@media (min-width: 1024px) and (max-width: 1279px) {
  .bi-feature .post-kicker .kd-l {
    display: none;
  }

  .bi-feature .post-kicker .kd-s {
    display: inline;
  }
}

.post-kicker--plain::before {
  display: none;
}

/* ---------- article cards ("Seguí leyendo" on each article) ---------- */

.post-list-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px 24px;
  padding-top: 26px;
  margin-bottom: clamp(28px, 4vw, 48px);
  border-top: 1px solid var(--line);
}

.post-list-head .link-arrow {
  min-height: 40px;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(48px, 5vw, 64px) clamp(20px, 3vw, 40px);
}

.post-card {
  position: relative;
}

.post-thumb {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  padding: 28px;
  color: var(--white);
  text-align: center;
}

.post-mark {
  display: grid;
  justify-items: center;
  gap: 14px;
  transition: transform 0.6s var(--ease);
}

.post-mark b {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(2.1rem, 4vw, 3.6rem);
  line-height: 1;
  letter-spacing: -0.025em;
  font-variant-numeric: lining-nums;
  text-wrap: balance;
}

.post-mark b em {
  font-style: italic;
}

.post-mark small {
  font-size: var(--fs-xs);
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.72);
}

.post-card .post-kicker {
  margin-top: 22px;
}

.post-card h3 {
  margin-top: 10px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.5rem, 2.1vw, 1.9rem);
  line-height: 1.15;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

.post-card h3 a {
  text-decoration: none;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}

/* Stretched links: the whole card is one tap target, the accessible name stays the title */
.post-card h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
}

.post-card .dek {
  margin-top: 12px;
  color: var(--ink-2);
  max-width: 36em;
  text-wrap: pretty;
}

@media (max-width: 760px) {
  .post-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- blog index ---------- */

.bi-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.bi-hero {
  padding: clamp(56px, 8vw, 120px) 0 clamp(44px, 6vw, 88px);
}

.bi-hero .display {
  margin-top: 22px;
  max-width: 11.5em;
  font-size: clamp(2.75rem, 6.4vw, 6rem);
}

.bi-hero .lead {
  margin-top: 28px;
}

/* Featured: a large painted cover beside the copy. Title links stretch over their whole card,
   so every card is a single tap target whose accessible name is the title. */
.bi-feature {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  gap: clamp(28px, 4.5vw, 72px);
  align-items: center;
}

.bi-feature .post-thumb {
  aspect-ratio: 16 / 10;
  padding: clamp(28px, 5vw, 72px);
  transition: transform 0.6s var(--ease);
}

.bi-feature .post-mark b {
  font-size: clamp(2.5rem, 5vw, 4.75rem);
  max-width: 8em;
}

.bi-feature .h2 {
  margin-top: 18px;
  font-size: clamp(2rem, 3.2vw, 3rem);
}

.bi-feature .dek {
  margin-top: 20px;
  color: var(--ink-2);
  max-width: 30em;
  text-wrap: pretty;
}

.bi-feature .link-arrow {
  margin-top: 28px;
}

.bi-feature .h2 a,
.bi-card h3 a {
  text-decoration: none;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}

.bi-feature .h2 a::after,
.bi-card h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
}

/* The focus ring goes around the whole card (the stretched area), not just the title text */
.bi-feature .h2 a:focus-visible,
.bi-card h3 a:focus-visible,
.post-card h3 a:focus-visible {
  outline: none;
}

.bi-feature .h2 a:focus-visible::after,
.bi-card h3 a:focus-visible::after,
.post-card h3 a:focus-visible::after {
  outline: 2px solid var(--ink);
  outline-offset: 8px;
  border-radius: var(--radius-canvas);
}

/* Hover only where a pointer can hover, so a tap on a phone never leaves a card stuck lifted */
@media (hover: hover) {
  .bi-feature:hover .h2 a,
  .bi-card:hover h3 a,
  .post-card:hover h3 a {
    text-decoration-line: underline;
  }

  .bi-feature:hover .post-thumb,
  .bi-card:hover .post-thumb {
    transform: translateY(-4px);
  }

  .post-card:hover .post-mark {
    transform: translateY(-4px);
  }

  .bi-feature:hover .link-arrow svg {
    transform: translateX(3px);
  }

  .bi-chip:hover {
    border-color: var(--ink);
    color: var(--ink);
  }
}

/* ---------- index: filter + grid ---------- */

.bi-list {
  padding: clamp(88px, 10vw, 144px) 0 0;
}

.bi-list-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px 32px;
  padding-top: 26px;
  margin-bottom: clamp(32px, 4vw, 56px);
  border-top: 1px solid var(--line);
}

.bi-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bi-filters[hidden] {
  display: none;
}

.bi-chip {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-size: var(--fs-small);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 0.25s var(--ease),
    border-color 0.25s var(--ease),
    color 0.25s var(--ease);
}

.bi-chip[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--white);
}

.bi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(48px, 5vw, 72px) clamp(20px, 2.4vw, 32px);
}

.bi-card {
  position: relative;
}

.bi-card[hidden] {
  display: none;
}

.bi-card.is-entering {
  animation: bi-in 0.6s var(--ease) both;
}

@keyframes bi-in {
  from {
    opacity: 0;
    transform: translate3d(0, 14px, 0);
  }
}

.bi-card .post-thumb {
  aspect-ratio: 3 / 2;
  padding: 24px;
  transition: transform 0.6s var(--ease);
}

.bi-card .post-mark b {
  font-size: clamp(1.8rem, 2.6vw, 2.5rem);
  max-width: 8em;
}

.bi-card .post-mark small {
  font-size: var(--fs-xs);
}

.bi-card .post-kicker {
  margin-top: 20px;
  font-size: var(--fs-xs);
}

.bi-card h3 {
  margin-top: 10px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.35rem, 1.7vw, 1.6rem);
  line-height: 1.18;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.bi-card .dek {
  margin-top: 10px;
  font-size: var(--fs-small);
  line-height: 1.55;
  color: var(--ink-2);
  text-wrap: pretty;
}

@media (max-width: 1079px) {
  .bi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1023px) {
  .bi-feature {
    grid-template-columns: 1fr;
  }

  .bi-feature .post-thumb {
    aspect-ratio: 16 / 9;
  }

  .bi-feature .post-mark b {
    font-size: clamp(2.5rem, 7vw, 4.5rem);
  }

  .bi-feature .h2 {
    font-size: clamp(2rem, 5vw, 2.75rem);
  }
}

@media (max-width: 639px) {
  .bi-grid {
    grid-template-columns: 1fr;
  }

  .bi-feature .post-thumb {
    aspect-ratio: 4 / 3;
    padding: 24px;
  }

  .bi-card .post-mark b {
    font-size: 2.1rem;
  }
}

/* ---------- article ---------- */

.post {
  padding-top: clamp(20px, 3vw, 36px);
}

/* One centered column for header and body keeps their left edges aligned */
.post-col {
  width: 100%;
  max-width: calc(44rem + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.crumbs ol {
  display: flex;
  align-items: center;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--fs-small);
  color: var(--muted);
}

.crumbs li {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

.crumbs li + li::before {
  content: "/";
  margin: 0 10px;
  color: var(--line);
}

.crumbs li:last-child {
  flex: 1 1 auto;
  min-width: 0;
}

.crumbs a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  text-decoration: none;
}

.crumbs a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.crumbs [aria-current="page"] {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-2);
}

.post-head {
  padding-bottom: clamp(36px, 5vw, 56px);
}

.post-head .post-kicker {
  margin-top: clamp(28px, 5vw, 56px);
}

.post-title {
  margin-top: 20px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.2rem, 1.25rem + 4vw, 3.9rem);
  line-height: 1.04;
  letter-spacing: -0.024em;
  text-wrap: balance;
  font-optical-sizing: auto;
}

.post-title em {
  font-style: italic;
  font-weight: 300;
}

.post-dek {
  margin-top: 24px;
  font-size: var(--fs-lead);
  line-height: 1.55;
  color: var(--ink-2);
  text-wrap: pretty;
}

.post-byline {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: var(--fs-small);
  color: var(--ink-2);
}

.post-byline img {
  width: 32px;
  height: 32px;
  padding: 7px;
  border-radius: 50%;
  background: var(--white);
  border: 1px solid var(--line-soft);
}

.post-byline b {
  font-weight: 500;
  color: var(--ink);
}

/* Cover: a painted canvas wider than the reading column */
.post-cover {
  width: 100%;
  max-width: calc(1120px + var(--gutter) * 2);
  margin: 0 auto clamp(48px, 7vw, 88px);
  padding-inline: var(--gutter);
}

.post-cover .canvas {
  padding: clamp(14px, 4vw, 56px);
}

.post-cover .post-thumb {
  aspect-ratio: 21 / 9;
}

.post-cover .post-mark b {
  font-size: clamp(2.6rem, 7vw, 6rem);
}

.post-cover .post-mark small {
  font-size: var(--fs-small);
}

/* ---------- article body ---------- */

.post-body {
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--ink);
  overflow-wrap: break-word;
}

.post-body > * + * {
  margin-top: 1.15em;
}

.post-body p,
.post-body li {
  text-wrap: pretty;
}

.post-body a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: rgba(18, 20, 18, 0.35);
  overflow-wrap: anywhere;
  transition: text-decoration-color 0.2s;
}

.post-body a:hover {
  text-decoration-color: currentColor;
}

/* Links to official sources open in a new tab; a small arrow says so. It is a background on the
   link's own padding (not a pseudo-element) so it can never wrap onto a line by itself. */
.post-body a[target="_blank"] {
  padding-right: 0.92em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23878b85' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17 17 7'/%3E%3Cpath d='M8 7h9v9'/%3E%3C/svg%3E")
    no-repeat right 0.06em center / 0.62em 0.62em;
}

.post-body strong {
  font-weight: 600;
}

.post-body h2 {
  margin-top: 2.1em;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.65rem, 1.2rem + 1.3vw, 2.15rem);
  line-height: 1.15;
  letter-spacing: -0.014em;
  text-wrap: balance;
}

.post-body h3 {
  margin-top: 1.8em;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.4rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.post-body h2 + *,
.post-body h3 + * {
  margin-top: 0.7em;
}

.post-body ul,
.post-body ol {
  padding-left: 1.3em;
}

.post-body li + li {
  margin-top: 0.75em;
}

.post-body li::marker {
  color: var(--muted);
}

/* Pull quote */
.post-body blockquote {
  margin: 1.9em 0;
  padding: 4px 0 4px clamp(18px, 3vw, 28px);
  border-left: 1px solid var(--ink);
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.5rem, 1.1rem + 1.3vw, 2.05rem);
  line-height: 1.26;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-wrap: balance;
}

.post-body blockquote + * {
  margin-top: 0;
}

.post-figure {
  margin: 2.2em 0;
}

.post-figure .canvas {
  padding: clamp(12px, 3vw, 40px);
}

.post-figure figcaption {
  margin-top: 14px;
  font-size: var(--fs-small);
  line-height: 1.5;
  color: var(--muted);
  text-wrap: pretty;
}

@media (min-width: 1040px) {
  .post-figure {
    margin-inline: -96px;
  }

  .post-figure figcaption {
    padding-inline: 96px;
  }
}

/* Tables scroll inside their own frame, never the page */
.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-ui);
  background: var(--white);
  -webkit-overflow-scrolling: touch;
}

.post-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-small);
  line-height: 1.5;
}

.post-body th,
.post-body td {
  padding: 12px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line-soft);
}

.post-body th {
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

.post-body tr:last-child td {
  border-bottom: 0;
}

.post-note {
  margin-top: 2.4em;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-ui);
  background: rgba(255, 255, 255, 0.55);
  font-size: var(--fs-small);
  line-height: 1.6;
  color: var(--ink-2);
}

.post-note p + p {
  margin-top: 10px;
}

/* Sources cited in the article, in the product's own "Fuentes" idiom */
.post-sources {
  margin-top: clamp(48px, 6vw, 72px);
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.post-body .post-sources h2 {
  margin-top: 0;
  font-family: var(--sans);
  font-size: var(--fs-small);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0;
  color: var(--muted);
}

.post-body .post-sources li + li {
  margin-top: 0;
}

.post-sources ol {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.post-body .post-sources a {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  padding: 10px 14px 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-ui);
  background: var(--white);
  text-decoration: none;
  overflow-wrap: normal;
  transition: border-color 0.2s var(--ease);
}

.post-sources a:hover {
  border-color: var(--ink);
}

.post-sources b {
  display: block;
  font-size: var(--fs-small);
  font-weight: 500;
  line-height: 1.35;
}

.post-sources span span {
  display: block;
  font-size: var(--fs-xs);
  color: var(--muted);
  line-height: 1.4;
}

.post-sources .go {
  width: 15px;
  height: 15px;
  color: var(--muted);
}

/* ---------- closing CTA card ---------- */

.post-cta-wrap {
  padding-top: clamp(80px, 10vw, 136px);
}

.post-cta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 28px 48px;
  padding: clamp(32px, 6vw, 80px);
  color: var(--on-night);
}

.post-cta .eyebrow {
  color: var(--on-night-muted);
}

.post-cta .h2 {
  margin-top: 16px;
  font-size: clamp(2.2rem, 4.2vw, 3.75rem);
  max-width: 13em;
}

.post-cta p:not(.eyebrow) {
  margin-top: 18px;
  font-size: var(--fs-lead);
  line-height: 1.5;
  color: rgba(237, 236, 231, 0.8);
  max-width: 30em;
  text-wrap: pretty;
}

@media (max-width: 880px) {
  .post-cta {
    grid-template-columns: 1fr;
    align-items: start;
  }
}

@media (max-width: 480px) {
  .post-kicker {
    font-size: var(--fs-xs);
    gap: 2px 8px;
  }

  .post-kicker::before {
    display: none;
  }

  .post-kicker > span:not(:last-child)::after {
    margin-left: 8px;
  }

}

@media (max-width: 640px) {
  /* Covers and figures get the full phone width, minus the same 8px frame the home hero uses */
  .post-cover {
    padding-inline: 8px;
  }

  .post-figure {
    margin-inline: calc(8px - var(--gutter));
  }

  .post-figure figcaption {
    padding-inline: calc(var(--gutter) - 8px);
  }

  .post-cover .post-thumb {
    aspect-ratio: 4 / 3;
  }

  .post-cover .canvas,
  .post-cta {
    padding: 28px 22px;
  }

  .post-cta .hero-ctas .btn {
    flex: 1 1 auto;
  }

  .post-body .post-sources a {
    padding-right: 12px;
  }
}

.post-end {
  height: clamp(80px, 10vw, 136px);
}

/* Orphan card in the last row (set by script.js): spans the row, cover across two columns, text in the third. */
.bi-card.is-wide {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  grid-template-rows: auto auto 1fr;
  align-content: start;
}

.bi-card.is-wide .post-thumb {
  grid-column: 1 / -2;
  grid-row: 1 / span 3;
}

.bi-card.is-wide > :not(.post-thumb) {
  grid-column: -2 / -1;
}

.bi-card.is-wide .post-kicker {
  margin-top: 0;
}

.bi-card.is-wide .post-mark b {
  font-size: clamp(2.4rem, 4.2vw, 4.2rem);
}

.bi-card.is-wide.is-span2 {
  grid-column: span 2;
}

.bi-card.is-span2 .post-mark b {
  font-size: clamp(2.1rem, 3.4vw, 3.4rem);
}
