/* ============================================
   Media & Interviews — Refined Masonry
   Bespoke layout, not Quarto's listing scaffold.
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@300;400;500;600;700&display=swap');

/* Token overrides / extensions for the media page.
   Core tokens (--blue, --warm, --ease, --ink-*) are defined globally
   in styles.css. Only media-page-specific values are added here. */
:root {
  --bg-0:#0B0F15; --bg-1:#0F1419; --bg-2:#161D27; --bg-3:#1E2634;
  --line:rgba(255,255,255,.06); --line-blue:rgba(100,181,246,.22);
  --ff:'Quicksand',system-ui,sans-serif;
  --talk:#B6A6E8;
}

#quarto-content { padding: 0; }
#title-block-header { display: none !important; }
body {
  animation: none !important;
  padding-top: 80px !important;
  font-family: var(--ff);
  color: var(--ink-1);
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
  min-height: 100vh;
  background: #000 !important;
  background-size: auto !important;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ── Page wrapper ── */
.med-wrap {
  max-width: 1600px;
  margin: 0 auto;
  padding: 3rem 4rem 6rem;
}

@keyframes swIn {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}

section.med-page-title {
  animation: swIn 0.6s cubic-bezier(.22, 1, .36, 1) 0.05s both;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 2.5rem;
}

h1.med-page-title {
  font-family: var(--ff);
  font-weight: 600;
  font-size: clamp(2.2rem, 4.5vw, 3.4rem);
  letter-spacing: -0.02em;
  color: var(--ink-0);
  margin: 0 0 0.75rem;
  line-height: 1.05;
}

section.med-page-title > p {
  max-width: 60ch;
  font-size: 1rem;
  color: var(--ink-1);
  line-height: 1.65;
  margin: 0;
}

section#med-content-section > h1 { display: none; }

.filter-bar {
  animation: swIn 0.45s cubic-bezier(.22, 1, .36, 1) 0.3s both;
}

@media (max-width: 768px) {
  .med-wrap { padding: 3rem 1.5rem 4rem; }
}

/* ── Image renders at its natural aspect ──
   Hover scale anchored at bottom-center so any title overlay inside the
   image (e.g. the El Financiero broadcast frame) stays in place — only
   the top edge gets clipped by overflow:hidden on the wrapper. */
.tile-img > img {
  width: 100%;
  height: auto;
  display: block;
  transform-origin: center bottom;
  transition: transform .6s var(--ease);
}
.tile:hover .tile-img > img {
  transform: scale(1.03);
}

/* ── Medium chip — capitalized (Press, Radio, TV, Talk) like filter labels ── */
.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  font-family: var(--ff); font-size: .72rem; font-weight: 500;
  letter-spacing: .02em; padding: .28rem .55rem; border-radius: 999px;
  transform-origin: center;
  transition: transform .25s var(--ease);
}
.tile:hover .chip {
  transform: scale(1.08);
}
.chip.tv    { background: rgba(100,181,246,.16); color: var(--blue); }
.chip.radio { background: rgba(232,168,124,.16); color: var(--warm); }
.chip.press { background: rgba(255,255,255,.06); color: var(--ink-1); }
.chip.talk  { background: rgba(167,142,232,.14); color: var(--talk); }

/* ── Filter bar ── */
.filter-bar {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}
.filter-btn {
  font-family: var(--ff); font-size: .78rem; font-weight: 500;
  letter-spacing: .06em; text-transform: uppercase;
  padding: .38rem .9rem; border-radius: 999px;
  min-height: 44px;
  border: 1px solid var(--line-blue);
  background: transparent; color: var(--ink-2);
  cursor: pointer;
  transition: background .22s var(--ease), color .22s var(--ease), border-color .22s var(--ease);
}
.filter-btn:hover {
  background: var(--blue-soft); color: var(--ink-0); border-color: var(--blue-line);
}
.filter-btn.active {
  background: var(--blue-soft); color: var(--blue); border-color: var(--blue-line);
}
.filter-btn:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.filter-btn i { margin-right: .3rem; font-size: .72rem; }

/* ── Masonry wall ── */
.wall { columns: 3; column-gap: 1rem; }
@media (max-width: 900px) { .wall { columns: 2; } }
@media (max-width: 600px) { .wall { columns: 1; } }

.tile {
  break-inside: avoid;
  margin-bottom: 1rem;
  display: block;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  contain: layout style;
  -webkit-tap-highlight-color: transparent;
  transition:
    border-color .3s var(--ease),
    box-shadow .3s var(--ease);
}
/* Hover: color + shadow only — no transform (CSS-columns masonry can
   reflow tiles oddly with translateY) and no opacity transition (caused
   the first-hover-flash-black bug when entrance was mid-transition). */
.tile:hover {
  border-color: var(--blue-line);
  box-shadow: 0 14px 30px rgba(0,0,0,.4);
}
.tile:active {
  opacity: 0.82;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
}

/* Filter-change stagger — applied by JS only on filter switch, never on initial load */
@keyframes tileIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.tile--in {
  animation: tileIn 0.22s var(--ease) var(--tile-delay, 0ms) both;
}
.tile:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-color: var(--blue-line);
}
/* Image wrapper has no forced aspect-ratio — each cover keeps its own
   proportions so titles in the artwork (e.g. the El Financiero frame
   "En México hay 148 grupos criminales") aren't cropped.
   overflow: hidden is critical — without it, the 1.03 scale on hover
   visually overflows the wrapper and covers the title in .tile-body. */
.tile-img { position: relative; line-height: 0; overflow: hidden; }
.tile-body { padding: 1rem 1.1rem 1.2rem; }

/* Outlet name — italic Quicksand, editorial / magazine feel */
.tile-outlet {
  font-family: var(--ff);
  font-style: italic;
  font-size: .85rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--blue);
  margin-bottom: .5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tile-title {
  font-family: var(--ff); font-weight: 600; font-size: .97rem;
  line-height: 1.35; color: var(--ink-0); text-wrap: pretty;
  margin-bottom: .7rem; transition: color .3s var(--ease);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tile:hover .tile-title { color: var(--blue); }

/* Footer — accent line color matches the medium's chip color for consistent
   visual encoding at both the chip (micro) and structural (footer) levels. */
.tile-foot {
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--ff); font-size: .82rem; color: var(--ink-0);
  font-weight: 400; letter-spacing: 0;
  padding-top: .7rem;
  border-top: 1px solid var(--blue);
}
.tile--radio .tile-foot  { border-top-color: var(--warm); }
.tile--talk  .tile-foot  { border-top-color: var(--talk); }
.tile--press .tile-foot  { border-top-color: rgba(255,255,255,.18); }
/* Right side of the footer — chip (always visible) + flag (hover only) */
.tile-foot .foot-right {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
}
.tile-foot .flag {
  font-size: 1.1rem;
  line-height: 1;
  filter: saturate(1.1);
  opacity: 0.45;
  transform: translateX(0);
  transition: opacity .3s var(--ease);
}
.tile:hover .tile-foot .flag {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  section.med-page-title,
  .filter-bar,
  .tile-img > img,
  .chip,
  .tile,
  .tile--in,
  .tile-title,
  .tile-foot .flag {
    transition: none !important;
    transform: none !important;
    animation: none !important;
    opacity: 1 !important;
  }
  .tile-foot .flag { opacity: 0.45 !important; }
}

/* Print-only variant: no image, serif italic quote */
.tile.is-text .tile-img { display: none; }
.tile.is-text .tile-body {
  padding: 1.4rem 1.3rem 1.2rem;
  background: radial-gradient(circle at 100% 0%, rgba(100,181,246,.06), transparent 60%);
}
.tile.is-text .tile-chip {
  position: static;
  margin-bottom: .7rem;
  display: inline-flex;
}
.tile.is-text .tile-title {
  font-family: var(--ff-serif); font-style: italic; font-weight: 400;
  font-size: 1.1rem; line-height: 1.3;
}

/* Visually hidden but announced to screen readers */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Empty state when a filter returns zero results */
.wall-empty {
  column-span: all;
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
  padding: 4rem 2rem; text-align: center;
}
.wall-empty-icon {
  font-size: 2rem; color: var(--blue); opacity: .35;
}
.wall-empty p {
  font-family: var(--ff); font-size: .95rem; color: var(--ink-3);
  letter-spacing: .01em; margin: 0;
}
.wall-empty-reset {
  margin-top: .25rem;
  border-color: var(--line-blue);
  color: var(--blue);
}

/* Count badge on active filter — appears after first filter interaction */
.filter-btn.active[data-count]::after {
  content: attr(data-count);
  margin-left: .45rem;
  font-size: .68rem; font-weight: 600; letter-spacing: .04em;
  background: var(--blue-soft); color: var(--blue);
  padding: .1rem .38rem; border-radius: 999px;
  vertical-align: middle;
}
