/*
 * Censurado public frontend
 * Static, component-oriented CSS. Stable URL: /assets/style.css.
 */

@layer reset, tokens, base, layout, components, utilities;

@layer reset {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
  }

  body,
  h1,
  h2,
  h3,
  p,
  figure,
  blockquote,
  ol,
  ul,
  dl,
  dd {
    margin: 0;
  }

  ol,
  ul {
    padding: 0;
  }

  img,
  video,
  iframe {
    display: block;
    max-width: 100%;
  }

  button,
  input,
  textarea,
  select {
    font: inherit;
  }
}

@layer tokens {
  :root {
    color-scheme: light;

    --color-page: #ffffff;
    --color-paper: #ffffff;
    --color-ink: #101820;
    --color-muted: #52606d;
    --color-subtle: #7b8792;
    --color-line: #d7dce0;
    --color-line-dark: #8a949d;
    --color-red: #e01842;
    --color-blue: #075f7a;
    --color-cyan: #20e0c0;
    --color-gold: #c98124;
    --color-plum: #62395f;
    --color-shadow: rgb(16 24 32 / 12%);
    --color-footer: #eef1f3;
    --label-bg: #ffffff;
    --label-ink: #101820;

    --font-display: "Inter Tight", "Aptos Display", "Segoe UI", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
    --font-body: Inter, "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-serif: Georgia, "Times New Roman", ui-serif, serif;
    --font-mono: "SF Mono", ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;

    --text-xs: 0.78rem;
    --text-sm: 0.92rem;
    --text-base: 1rem;
    --text-md: 1.06rem;
    --text-lg: 1.26rem;
    --text-xl: 1.58rem;
    --text-2xl: 2.45rem;
    --text-3xl: 3.55rem;
    --text-masthead: 3.1rem;

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-7: 3rem;
    --space-8: 4.5rem;

    --radius-sm: 0;
    --radius-md: 0;
    --measure: 70ch;
    --site-max: 1250px;
    --gutter: 1rem;

    --motion-fast: 140ms;
    --motion-med: 220ms;
    --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  @media (min-width: 48rem) {
    :root {
      --gutter: 1.5rem;
      --text-xl: 1.85rem;
      --text-2xl: 3rem;
      --text-3xl: 5.5rem;
      --text-masthead: 5.25rem;
    }
  }

  @media (min-width: 78rem) {
    :root {
      --gutter: 2rem;
      --text-3xl: 6.6rem;
      --text-masthead: 6.35rem;
    }
  }

  :root[data-theme="light"] {
    color-scheme: light;
  }

  :root[data-theme="dark"] {
    color-scheme: dark;
    --color-page: #0a0a0a;
    --color-paper: #171e24;
    --color-ink: #f8f0e5;
    --color-muted: #a9b4bc;
    --color-subtle: #7f8b94;
    --color-line: #33404a;
    --color-line-dark: #5f6f79;
    --color-red: #ff2f64;
    --color-blue: #22d7c0;
    --color-cyan: #49f2d2;
    --color-gold: #f1a43a;
    --color-plum: #c98bd0;
    --color-shadow: rgb(0 0 0 / 34%);
    --color-footer: #0d1419;
    --label-bg: #ffffff;
    --label-ink: #101820;
  }

  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      color-scheme: dark;
      --color-page: #0a0a0a;
      --color-paper: #171e24;
      --color-ink: #f8f0e5;
      --color-muted: #a9b4bc;
      --color-subtle: #7f8b94;
      --color-line: #33404a;
      --color-line-dark: #5f6f79;
      --color-red: #ff2f64;
      --color-blue: #22d7c0;
      --color-cyan: #49f2d2;
      --color-gold: #f1a43a;
      --color-plum: #c98bd0;
      --color-shadow: rgb(0 0 0 / 34%);
      --color-footer: #0d1419;
      --label-bg: #ffffff;
      --label-ink: #101820;
    }
  }
}

@layer base {
  body {
    min-height: 100vh;
    background: var(--color-page);
    color: var(--color-ink);
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: 1.58;
    text-rendering: optimizeLegibility;
  }

  a {
    color: inherit;
    text-decoration-thickness: 0.08em;
    text-underline-offset: 0.18em;
  }

  a:hover {
    color: var(--color-red);
  }

  :focus-visible {
    outline: 3px solid var(--color-red);
    outline-offset: 3px;
  }

  ::selection {
    color: var(--color-paper);
    background: var(--color-red);
  }
}

@layer layout {
  .site-shell {
    display: grid;
    grid-template-rows: auto 1fr auto;
  }

  .skip-link {
    position: fixed;
    left: var(--space-4);
    top: -5rem;
    z-index: 10;
    padding: var(--space-2) var(--space-3);
    background: var(--color-ink);
    color: var(--color-paper);
    font-size: var(--text-sm);
    text-decoration: none;
    transition: top var(--motion-fast) var(--ease-out);
  }

  .skip-link:focus {
    top: var(--space-4);
  }

  .site-main {
    width: min(100% - (var(--gutter) * 2), var(--site-max));
    margin-inline: auto;
  }

  .site-header {
    position: relative;
    display: grid;
    width: 100%;
    gap: 0;
    padding-block: 0;
  }

  .site-main {
    padding-block: var(--space-6) var(--space-8);
  }

  .site-footer {
    display: grid;
    gap: var(--space-6);
    width: 100%;
    margin-inline: auto;
    padding:
      var(--space-7)
      max(var(--gutter), calc((100% - var(--site-max)) / 2));
    border-top: 4px solid var(--color-ink);
    background: var(--color-footer);
  }

  @media (min-width: 50rem) {
    .site-footer {
      grid-template-columns: minmax(16rem, 0.38fr) minmax(0, 1fr);
      align-items: start;
    }
  }
}

@layer components {
  .header-topline {
    position: absolute;
    inset: 0 0 auto 0;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    width: 100%;
    padding: 0.55rem max(var(--gutter), calc((100% - var(--site-max)) / 2)) 0.85rem;
    color: var(--color-muted);
    font-size: var(--text-sm);
    /* Float the controls over the video so the footage keeps the height. A soft top
       scrim keeps them legible without a solid bar, and the controls stay in their
       dark-mode form (light on dark) in both themes. */
    background: linear-gradient(to bottom, rgb(0 0 0 / 64%) 0%, rgb(0 0 0 / 28%) 55%, rgb(0 0 0 / 0%) 100%);
    --color-muted: #c2cbd2;
    --color-ink: #f8f0e5;
    --color-line: #33404a;
    --color-line-dark: #5f6f79;
    --label-bg: #ffffff;
    --label-ink: #101820;
  }

  .menu-toggle,
  .site-nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 1.9rem;
    padding: 0.3rem 0.58rem 0.28rem 0.5rem;
    border: 0;
    background: var(--label-bg);
    color: var(--label-ink);
    font-size: var(--text-xs);
    font-weight: 900;
    line-height: 1;
    text-decoration: none;
    text-transform: uppercase;
    cursor: pointer;
    transition:
      background var(--motion-fast) var(--ease-out),
      color var(--motion-fast) var(--ease-out),
      box-shadow var(--motion-fast) var(--ease-out);
  }

  .menu-toggle::before,
  .site-nav-link::before {
    content: "";
    flex: 0 0 auto;
    width: 0.42rem;
    height: 0.42rem;
    margin-right: var(--space-2);
    background: var(--color-line-dark);
    transition: background var(--motion-fast) var(--ease-out);
  }

  .menu-toggle {
    display: none;
  }

  .menu-toggle:hover,
  .menu-toggle[aria-expanded="true"],
  .site-nav-link:hover,
  .site-nav-link[aria-current="page"],
  .site-nav-link:focus-visible {
    background: color-mix(in srgb, var(--color-line) 46%, var(--label-bg));
    color: var(--label-ink);
  }

  .menu-toggle:hover::before,
  .menu-toggle[aria-expanded="true"]::before,
  .site-nav-link:hover::before,
  .site-nav-link[aria-current="page"]::before,
  .site-nav-link:focus-visible::before {
    background: var(--color-red);
  }

  .theme-switcher {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-left: auto;
  }

  .theme-switcher button {
    min-height: 1.8rem;
    padding: 0;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--color-muted);
    font-size: var(--text-xs);
    font-weight: 850;
    text-transform: uppercase;
    cursor: pointer;
  }

  .theme-switcher button:hover,
  .theme-switcher button[aria-pressed="true"] {
    border-color: var(--color-red);
    color: var(--color-ink);
  }

  @media (max-width: 42rem) {
    .menu-toggle {
      display: inline-flex;
    }

    /* Theme switcher: small, tucked in the top-right, not a full row over the title. */
    .theme-switcher {
      gap: var(--space-2);
    }

    .theme-switcher button {
      font-size: 0.62rem;
    }

    /* The nav is the mobile menu: a classic dropdown. Hidden until opened, then a
       vertical panel that overlays the whole page (not an inline expansion that
       reflows the layout). */
    .site-header[data-menu-ready="true"] .site-nav {
      position: fixed;
      inset: 0;
      z-index: 60;
      flex-direction: column;
      flex-wrap: nowrap;
      align-items: stretch;
      justify-content: flex-start;
      gap: 0.4rem;
      width: 100%;
      height: 100dvh;
      padding: 4.4rem var(--gutter) var(--gutter);
      background: #0a0a0a;
      overflow-y: auto;
    }

    .site-header[data-menu-ready="true"][data-menu-open="false"] .site-nav {
      display: none;
    }

    .site-header[data-menu-ready="true"] .site-nav-link {
      width: 100%;
      justify-content: flex-start;
      min-height: 3rem;
      font-size: var(--text-sm);
    }

    /* Keep the toggle reachable above the open panel so it doubles as the close. */
    .site-header[data-menu-ready="true"][data-menu-open="true"] .menu-toggle {
      position: fixed;
      top: 0.85rem;
      left: var(--gutter);
      z-index: 70;
    }
  }

  .masthead {
    position: relative;
    isolation: isolate;
    display: grid;
    place-items: center;
    min-height: clamp(14rem, 34vw, 24rem);
    width: 100%;
    justify-content: center;
    overflow: hidden;
    padding: var(--space-5) var(--space-3);
    background:
      linear-gradient(90deg, rgb(7 95 122 / 72%), rgb(16 24 32 / 84)),
      var(--color-ink);
  }

  .masthead-media {
    position: absolute;
    inset: 0;
    z-index: -2;
    overflow: hidden;
  }

  .masthead-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    /* Blackout: dim and slightly desaturate so the footage never saturates the page. */
    filter: brightness(0.5) saturate(0.85) contrast(1.04);
    transition: opacity 1s ease;
  }

  .masthead-video.is-active {
    opacity: 1;
  }

  /* CRT-monitor overlay above the video (within the media layer): a flat dim, fine
     horizontal scanlines, and an edge vignette. This is the "blacked-out monitor"
     look and most of the darkening. */
  .masthead-scanlines {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
      linear-gradient(rgb(0 0 0 / 30%), rgb(0 0 0 / 30%)),
      repeating-linear-gradient(
        to bottom,
        rgb(0 0 0 / 0%) 0,
        rgb(0 0 0 / 0%) 2px,
        rgb(0 0 0 / 22%) 3px,
        rgb(0 0 0 / 0%) 4px
      ),
      radial-gradient(ellipse at center, rgb(0 0 0 / 0%) 48%, rgb(0 0 0 / 60%) 100%);
  }

  .site-name {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 0.16em;
    max-width: 100%;
    color: #f1f3f1;
    font-family: var(--font-display);
    font-size: var(--text-masthead);
    font-weight: 950;
    line-height: 0.8;
    text-align: center;
    text-decoration: none;
  }

  .site-name:hover {
    color: var(--color-paper);
  }

  .brand-word {
    position: relative;
    display: inline-block;
  }

  .brand-word-el {
    display: inline-flex;
    align-items: baseline;
    padding: 0.08em 0.04em 0.06em 0.09em;
    background: var(--color-red);
    color: #101820;
    font-family: Impact, "Arial Black", "Aptos Display", var(--font-display);
    font-size: 0.98em;
    line-height: 0.8;
  }

  .brand-el-e,
  .brand-el-l {
    display: inline-block;
  }

  .brand-el-l {
    transform: scaleX(0.82);
    transform-origin: left center;
    margin-left: -0.04em;
  }

  .brand-word-censurado {
    color: #f1f3f1;
  }

  .brand-word-censurado::after {
    content: "";
    position: absolute;
    left: -0.02em;
    right: -0.02em;
    top: 52%;
    height: 0.075em;
    background: var(--color-red);
    box-shadow: 0 0.045em 0 rgb(16 24 32 / 64%);
    transform: translateY(-50%);
  }

  .brand-word-web {
    color: var(--color-red);
  }

  .brand-e {
    position: relative;
    display: inline-block;
  }

  .brand-e::before {
    content: "";
    position: absolute;
    left: 0.06em;
    right: 0.02em;
    top: -0.08em;
    height: 0.055em;
    background: currentColor;
    transform: rotate(-8deg);
  }

  .site-nav {
    position: absolute;
    inset: auto 0 0 0; /* overlay the bottom of the header, over the video, to keep the video tall */
    z-index: 3;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-3) max(var(--gutter), calc((100% - var(--site-max)) / 2));
    /* a soft bottom scrim so the nav stays legible over the footage, no hard border */
    background: linear-gradient(to top, rgb(0 0 0 / 62%) 0%, rgb(0 0 0 / 0%) 100%);
    --color-line: #33404a;
    --label-bg: #ffffff;
    --label-ink: #101820;
  }

  .site-deck,
  .site-footer-deck {
    max-width: 42rem;
    color: var(--color-muted);
    font-size: var(--text-sm);
    line-height: 1.45;
  }

  .footer-name .brand-wordmark {
    color: var(--color-ink);
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 950;
    line-height: 0.9;
  }

  .footer-wordmark {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.12em;
    color: var(--color-ink);
    text-decoration: none;
  }

  .footer-wordmark .brand-word-censurado {
    color: var(--color-ink);
  }

  .footer-wordmark .brand-word-censurado::after {
    box-shadow: none;
  }

  .footer-brand {
    display: grid;
    gap: var(--space-2);
  }

  .footer-disclosure {
    display: grid;
    gap: var(--space-3);
    padding: var(--space-4) 0 var(--space-4) var(--space-4);
    border-left: 5px solid var(--color-red);
    border-block: 1px solid var(--color-line);
  }

  .footer-heading {
    color: var(--color-ink);
    font-size: var(--text-xs);
    font-weight: 900;
    line-height: 1.2;
    text-transform: uppercase;
  }

  .footer-disclosure p {
    max-width: 64rem;
    color: var(--color-muted);
    font-size: var(--text-sm);
    line-height: 1.55;
  }

  .listing-hero {
    display: grid;
    justify-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-7);
    text-align: center;
  }

  .eyebrow {
    color: var(--color-red);
    font-size: var(--text-sm);
    font-weight: 850;
    line-height: 1.2;
    text-transform: uppercase;
  }

  .listing-heading,
  .article-title {
    max-width: 13ch;
    font-family: var(--font-display);
    font-size: var(--text-3xl);
    font-weight: 950;
    line-height: 0.86;
  }

  .listing-summary {
    max-width: 42rem;
    color: var(--color-muted);
    font-size: var(--text-md);
    line-height: 1.5;
  }

  .portal-front {
    display: grid;
    gap: var(--space-6);
  }

  .facet-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3) var(--space-5);
    padding-block: var(--space-3);
  }

  /* Mobile: keep the facets on one horizontally scrollable line (swipe / two-finger)
     instead of wrapping to several rows. Scoped under .portal-front so these win over
     the base .facet-chips wrap rule regardless of source order. */
  @media (max-width: 42rem) {
    .portal-front .facet-panel {
      flex-wrap: nowrap;
      overflow-x: auto;
      scrollbar-width: none;
      -webkit-overflow-scrolling: touch;
    }

    .portal-front .facet-panel::-webkit-scrollbar {
      display: none;
    }

    .portal-front .facet-group,
    .portal-front .facet-chips {
      flex-wrap: nowrap;
    }

    .portal-front .facet-chip,
    .portal-front .facet-clear,
    .portal-front .facet-group-label {
      white-space: nowrap;
    }
  }

  .facet-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
  }

  .facet-group[data-facet-group="author"],
  .facet-group[data-facet-group="section"],
  .facet-group[data-facet-group="month"] {
    display: none;
  }

  .facet-group-label {
    color: var(--color-muted);
    font-size: var(--text-xs);
    font-weight: 850;
    text-transform: uppercase;
  }

  .facet-chips,
  .topics {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    list-style: none;
  }

  /* Single-line topic/chip scroller (initTopicScroller): the row never wraps; it
     scrolls horizontally with the scrollbar hidden, flanked by arrows that show
     only when it overflows. */
  .scroll-row {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    min-width: 0;
    max-width: 100%;
  }

  /* The portada topic filter ("Tema") becomes one bounded scroll line: the group
     takes its own full-width row and the chips shrink + scroll inside it (with
     arrows / drag) instead of wrapping over several rows. */
  .facet-panel {
    min-width: 0;
  }

  .facet-group[data-facet-group="topic"] {
    flex: 1 1 100%;
    min-width: 0;
    flex-wrap: nowrap;
  }

  .facet-group[data-facet-group="topic"] .scroll-row {
    flex: 1 1 auto;
  }

  .scroll-row .topics,
  .scroll-row .facet-chips {
    flex-wrap: nowrap;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
    scroll-behavior: smooth;
  }

  .scroll-row .topics::-webkit-scrollbar,
  .scroll-row .facet-chips::-webkit-scrollbar {
    display: none;
  }

  .scroll-row .topics li,
  .scroll-row .facet-chips li {
    flex: 0 0 auto;
  }

  .scroll-arrow {
    display: none;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    border: 0;
    background: transparent;
    color: var(--color-ink);
    font-size: var(--text-xl);
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
  }

  .scroll-row[data-overflow="true"] .scroll-arrow {
    display: inline-flex;
  }

  .scroll-arrow:disabled {
    opacity: 0.3;
    cursor: default;
  }

  .scroll-arrow:hover:not(:disabled) {
    color: var(--color-red);
  }

  .facet-chip,
  .facet-clear,
  .topic-link,
  .pager-link,
  .month-link {
    display: inline-flex;
    align-items: center;
    min-height: 1.7rem;
    border: 0;
    border-bottom: 2px solid var(--color-line-dark);
    background: transparent;
    color: var(--color-ink);
    font-size: var(--text-xs);
    font-weight: 780;
    line-height: 1;
    text-decoration: none;
    text-transform: uppercase;
    cursor: pointer;
    transition:
      color var(--motion-fast) var(--ease-out),
      border-color var(--motion-fast) var(--ease-out);
  }

  .facet-chip:hover,
  .topic-link:hover,
  .pager-link:hover,
  .month-link:hover {
    border-color: var(--color-red);
    color: var(--color-red);
  }

  .facet-chip[aria-pressed="true"] {
    border-color: var(--color-red);
    color: var(--color-red);
  }

  .facet-chip[aria-disabled="true"],
  .facet-chip:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    text-decoration: line-through;
  }

  .facet-clear {
    color: var(--color-red);
    border-color: var(--color-red);
  }

  .facet-clear[hidden] {
    display: none;
  }

  .refine-status {
    flex-basis: 100%;
    min-height: 1.25rem;
    color: var(--color-muted);
    font-size: var(--text-xs);
  }

  .live-refresh-banner {
    grid-column: 1 / -1;
    justify-self: center;
    min-height: 2rem;
    margin-bottom: var(--space-2);
    padding: 0.4rem 0.75rem;
    border: 0;
    background: var(--label-bg);
    box-shadow:
      inset 0 -2px 0 var(--color-red),
      inset 0 0 0 1px var(--color-line);
    color: var(--label-ink);
    font-size: var(--text-xs);
    font-weight: 900;
    line-height: 1;
    text-transform: uppercase;
    cursor: pointer;
    transition:
      background var(--motion-fast) var(--ease-out),
      box-shadow var(--motion-fast) var(--ease-out);
  }

  .live-refresh-banner:hover,
  .live-refresh-banner:focus-visible {
    background: color-mix(in srgb, var(--color-line) 46%, var(--label-bg));
    box-shadow:
      inset 0 -2px 0 var(--color-red),
      inset 0 0 0 1px var(--color-red);
  }

  .live-refresh-banner[hidden] {
    display: none;
  }

  .article-list {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: var(--space-5);
    list-style: none;
  }

  .article-item {
    grid-column: 1 / -1;
    min-width: 0;
    border-top: 1px solid var(--color-line);
    padding-top: var(--space-4);
  }

  /* The lead story gets the same thick rule as the Most Read rail; the rest of the
     scroll-down list stays on a single thin line. */
  .article-item:first-child {
    border-top: 4px solid var(--color-ink);
  }

  .card {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    min-height: 100%;
  }

  .card-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: var(--space-2);
    min-width: 0;
  }

  /* The dek: bold on every card (image cards included), so it reads as a subtitle
     consistently and never blends into the description. */
  .card-subtitle {
    color: var(--color-ink);
    font-size: var(--text-sm);
    font-weight: 650;
    line-height: 1.45;
  }

  /* Every card shows the FULL description, never trimmed; the masonry columns
     absorb the varying card heights. */
  .card-description {
    color: var(--color-muted);
    font-size: var(--text-sm);
    line-height: 1.55;
  }

  .article-item:first-child .card-description {
    -webkit-line-clamp: 7;
    line-clamp: 7;
  }

  .card-textonly .card-subtitle {
    color: var(--color-ink);
    font-weight: 650;
  }

  .card-media {
    position: relative;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--color-ink);
  }

  .card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--motion-med) var(--ease-out);
  }

  .card:hover .card-media img {
    transform: scale(1.025);
  }

  .card-kicker {
    display: none;
  }

  /* Portada titles are always a single full-width line; a too-long title is
     clipped with an ellipsis rather than wrapping. Titles are kept short at the
     source (the authored title is a <=5-word synthesis). */
  /* Titles wrap across as many lines as they need, never truncated. */
  .card-title {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 930;
    line-height: 1.08;
  }

  .card-link {
    display: block;
    color: inherit;
    text-decoration: none;
  }

  .card-link {
    color: inherit;
    text-decoration: none;
  }

  .card-link:hover,
  .card-link:focus-visible {
    color: var(--color-red);
  }

  /* Card signature: the author "signs" each card, bottom-right. margin-top:auto
     pushes it to the foot of the (flex-column) card body regardless of how much
     title/subtitle sits above it, so signatures line up across a row. */
  .card-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-2);
    margin-top: auto;
    padding-top: var(--space-2);
  }

  .article-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--space-2) var(--space-3);
  }

  .card-meta .byline {
    font-weight: 800;
  }

  .byline,
  .published {
    color: var(--color-muted);
    font-size: var(--text-xs);
    line-height: 1.45;
  }

  .published {
    display: none;
  }

  .author-link,
  .section-link {
    color: var(--color-ink);
    text-decoration: none;
  }

  .author-link:hover,
  .section-link:hover {
    color: var(--color-red);
  }

  /* Compact byline/avatar treatment used in cards and article signatures. The
     author profile and about roster use larger rectangular portraits below. */
  .author-avatar {
    --avatar-size: 1.7rem;
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    width: var(--avatar-size);
    height: var(--avatar-size);
    overflow: hidden;
    border-radius: 50%;
    border: 1px solid var(--color-line-dark);
    background:
      linear-gradient(135deg, rgb(224 24 66 / 20%), transparent 52%),
      var(--color-page);
    color: var(--color-ink);
    font-size: var(--text-xs);
    font-weight: 900;
  }

  .author-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .author-card-avatar {
    width: var(--avatar-size, 4.5rem);
    height: var(--avatar-size, 4.5rem);
    flex: 0 0 auto;
    border-radius: 50%;
    border: 1px solid var(--color-line-dark);
    object-fit: cover;
    background: var(--color-page);
  }

  /* /author/<slug> profile: portfolio-style, with a rectangular portrait, large
     name, topic chips, and the author bio in one focused block. */
  .author-profile {
    display: grid;
    gap: var(--space-5);
    margin-bottom: var(--space-7);
    padding-block: var(--space-5) var(--space-6);
    border-block: 1px solid var(--color-line);
    color: var(--color-ink);
  }

  .author-profile-photo {
    display: grid;
    place-items: center;
    width: 100%;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    border: 1px solid var(--color-line-dark);
    background: transparent;
  }

  .author-profile-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .author-profile-initial {
    font-family: var(--font-display);
    font-size: clamp(4rem, 18vw, 8rem);
    font-weight: 950;
    line-height: 1;
  }

  .author-profile-main {
    display: grid;
    align-content: start;
    gap: var(--space-4);
    min-width: 0;
  }

  .author-profile-kicker,
  .author-profile-label {
    color: var(--color-muted);
    font-size: var(--text-xs);
    font-weight: 900;
    letter-spacing: 0.08em;
    line-height: 1.1;
    text-transform: uppercase;
  }

  .author-profile-name {
    max-width: 13ch;
    font-family: var(--font-display);
    font-size: clamp(2.25rem, 8vw, 5.25rem);
    font-weight: 950;
    line-height: 0.92;
  }

  .author-profile-topics {
    display: grid;
    gap: var(--space-2);
    padding-top: var(--space-3);
    border-top: 1px solid var(--color-line);
  }

  .author-profile-topics ul {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    list-style: none;
  }

  .author-profile-topics a {
    display: inline-flex;
    align-items: center;
    min-height: 1.75rem;
    border-bottom: 2px solid var(--color-line-dark);
    color: var(--color-ink);
    font-size: var(--text-xs);
    font-weight: 850;
    line-height: 1;
    text-decoration: none;
    text-transform: uppercase;
  }

  .author-profile-topics a:hover,
  .author-profile-topics a:focus-visible {
    border-color: var(--color-red);
    color: var(--color-red);
  }

  .author-profile-about {
    display: grid;
    gap: var(--space-2);
    padding-top: var(--space-3);
    border-top: 1px solid var(--color-line);
    color: var(--color-muted);
    font-size: var(--text-md);
    line-height: 1.6;
  }

  .author-profile-about p:last-child {
    white-space: pre-line;
  }

  .author-content-head {
    display: grid;
    gap: var(--space-1);
    border-top: 4px solid var(--color-ink);
    padding-top: var(--space-3);
  }

  .author-content-head h2 {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 930;
    line-height: 1.04;
  }

  .author-portal {
    grid-template-columns: 1fr;
  }

  .author-portal .article-list,
  .author-portal .author-content-head,
  .author-portal .pager,
  .author-portal .months {
    grid-column: 1 / -1;
  }

  .about-manifesto {
    display: grid;
    gap: var(--space-3);
    max-width: 72rem;
    margin: 0 auto;
    padding: var(--space-4) 0 var(--space-4) var(--space-4);
    border-left: 5px solid var(--color-red);
    border-block: 1px solid var(--color-line);
  }

  .about-manifesto p {
    max-width: 64rem;
    color: var(--color-muted);
    font-size: var(--text-sm);
    line-height: 1.55;
  }

  .about-manifesto p:first-child {
    color: var(--color-ink);
    font-family: var(--font-display);
    font-size: clamp(1.08rem, 1.7vw, 1.35rem);
    font-weight: 850;
    line-height: 1.2;
  }

  /* Nosotros roster (/about/): each author's "about" laid out as a card — a big
     rectangular portrait with a theme-color rule, the name + beat beside it, and
     the first-person bio spanning the full width below both. The accent color is
     keyed to the author's section/beat (data-section), so every byline carries its
     own identity. */
  .about-authors {
    margin-top: var(--space-7);
  }

  .author-cards {
    display: grid;
    gap: var(--space-7);
    list-style: none;
  }

  .author-card {
    --author-accent: var(--color-ink);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "portrait head"
      "bio bio";
    gap: var(--space-2) var(--space-5);
    align-items: end;
    padding: var(--space-4) 0 var(--space-5) var(--space-4);
    border-top: 1px solid var(--color-line);
    border-left: 4px solid var(--author-accent);
  }

  /* Theme color per beat. Unknown/empty section keeps the ink default above. */
  .author-card[data-section="politics"] {
    --author-accent: #c81d3d;
  }
  .author-card[data-section="economics"] {
    --author-accent: #1f8a52;
  }
  .author-card[data-section="tech"] {
    --author-accent: #2563c9;
  }
  .author-card[data-section="world"] {
    --author-accent: #7a3fb0;
  }
  .author-card[data-section="literatura"] {
    --author-accent: #b5852a;
  }

  .author-card-portrait {
    grid-area: portrait;
    display: grid;
    place-items: center;
    width: 9rem;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    border: 1px solid var(--color-line-dark);
    border-bottom: 4px solid var(--author-accent);
    background:
      linear-gradient(135deg, rgb(224 24 66 / 12%), transparent 52%),
      var(--color-page);
    text-decoration: none;
  }

  .author-card-portrait .author-card-avatar {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 0;
    object-fit: cover;
  }

  .author-card-initial {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 900;
    color: var(--color-ink);
  }

  .author-card-head {
    grid-area: head;
    display: grid;
    gap: var(--space-1);
    align-content: end;
    min-width: 0;
    padding-bottom: var(--space-1);
  }

  .author-card-beat {
    font-size: var(--text-xs);
    font-weight: 900;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--author-accent);
  }

  .author-card-name {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 900;
    line-height: 1.05;
    color: var(--color-ink);
    text-decoration: none;
  }

  .author-card-name:hover {
    color: var(--author-accent);
  }

  .author-card-bio {
    grid-area: bio;
    width: 100%;
    margin-top: var(--space-2);
    color: var(--color-muted);
    font-size: var(--text-md);
    line-height: 1.6;
    white-space: pre-line;
  }

  .author-card:nth-child(even) {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "head portrait"
      "bio bio";
    padding-right: var(--space-4);
    padding-left: 0;
    border-right: 4px solid var(--author-accent);
    border-left: 0;
  }

  .author-card:nth-child(even) .author-card-head {
    justify-items: end;
    text-align: right;
  }

  .author-card:nth-child(even) .author-card-bio {
    text-align: right;
  }

  @media (min-width: 50rem) {
    .author-card {
      gap: var(--space-3) var(--space-6);
      padding-left: var(--space-5);
    }

    .author-card:nth-child(even) {
      grid-template-columns: minmax(0, 1fr) auto;
      grid-template-areas:
        "head portrait"
        "bio bio";
      padding-right: var(--space-5);
    }

    .author-card-portrait {
      width: 11rem;
    }
  }

  .ranked-rail {
    border-top: 4px solid var(--color-ink);
  }

  .rail-heading {
    display: inline-block;
    padding: 0.22rem 0.45rem;
    background: var(--color-ink);
    color: var(--color-paper);
    font-size: var(--text-xs);
    font-weight: 900;
    line-height: 1;
    text-transform: uppercase;
  }

  .ranked-list {
    counter-reset: ranked;
    list-style: none;
  }

  .ranked-item {
    counter-increment: ranked;
    border-bottom: 1px solid var(--color-line);
  }

  .ranked-link {
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr);
    gap: var(--space-3);
    padding-block: var(--space-4);
    text-decoration: none;
  }

  .ranked-link::before {
    content: counter(ranked);
    color: var(--color-subtle);
    font-family: var(--font-serif);
    font-size: var(--text-xl);
    line-height: 0.9;
  }

  .ranked-section {
    display: block;
    grid-column: 2;
    color: var(--color-blue);
    font-size: var(--text-xs);
    font-weight: 850;
    text-transform: uppercase;
  }

  .ranked-link strong {
    display: block;
    grid-column: 2;
    margin-top: var(--space-1);
    font-size: var(--text-sm);
    font-weight: 880;
    line-height: 1.12;
  }

  .empty-state {
    grid-column: 1 / -1;
    padding: var(--space-6);
    border-top: 1px solid var(--color-line);
    color: var(--color-muted);
  }

  .pager,
  .months {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-line);
  }

  .months {
    display: none;
  }

  .article {
    display: grid;
    gap: var(--space-6);
  }

  .article-header {
    display: grid;
    justify-items: center;
    gap: var(--space-4);
    max-width: 66rem;
    margin-inline: auto;
    text-align: center;
  }

  .article-title {
    max-width: 16ch;
  }

  /* Mobile: the full-article headline (--text-3xl ~3.55rem) reads too heavy on a
     narrow screen. Soften it moderately so the title sits easier above the body. */
  @media (max-width: 42rem) {
    .article-title {
      font-size: 2.7rem;
    }
  }

  .article-subtitle {
    max-width: 36rem;
    color: var(--color-muted);
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 650;
    line-height: 1.24;
  }

  .article-standfirst {
    max-width: var(--measure);
    margin-inline: auto;
    color: var(--color-ink);
    font-family: var(--font-serif);
    font-size: var(--text-md);
    font-weight: 600;
    line-height: 1.5;
  }

  /* The author "signs" the foot of the piece: circled portrait + name. */
  /* The signature spans the body column and sits hard against its right edge
     (not a centered measure-width block, which read as centered). */
  .article-sign {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
    padding-top: var(--space-4);
    border-top: 2px solid var(--color-ink);
  }

  .article-sign .author-avatar {
    --avatar-size: 2.8rem;
  }

  .article-sign-name {
    font-family: var(--font-display);
    font-size: var(--text-md);
    font-weight: 850;
    text-decoration: none;
    white-space: nowrap;
  }

  /* Article permalink layout: the piece + a "Relacionados" grid in the main
     column, with "Lo más leído" as a lateral rail on wide screens (stacked
     below on narrow). */
  .article-shell {
    display: grid;
    gap: var(--space-7);
  }

  .article-main {
    display: grid;
    gap: var(--space-6);
    min-width: 0;
  }

  .related {
    display: grid;
    gap: var(--space-4);
  }

  .related-heading {
    justify-self: start;
    padding: 0.22rem 0.45rem;
    background: var(--color-ink);
    color: var(--color-paper);
    font-size: var(--text-xs);
    font-weight: 900;
    line-height: 1;
    text-transform: uppercase;
  }

  .related-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr));
    gap: var(--space-5);
    list-style: none;
  }

  .related-item {
    min-width: 0;
    border-top: 1px solid var(--color-line);
    padding-top: var(--space-4);
  }

  /* "Más de este autor" rail on a permalink: the author's other pieces, aligned
     to the right against the margin. */
  .author-more {
    border-top: 4px solid var(--color-ink);
    text-align: right;
  }

  .author-more-list {
    list-style: none;
  }

  .author-more-item {
    border-bottom: 1px solid var(--color-line);
  }

  .author-more-link {
    display: block;
    padding-block: var(--space-3);
    text-decoration: none;
  }

  .author-more-section {
    display: block;
    color: var(--color-blue);
    font-size: var(--text-xs);
    font-weight: 850;
    text-transform: uppercase;
  }

  .author-more-link strong {
    display: block;
    margin-top: var(--space-1);
    font-size: var(--text-sm);
    font-weight: 880;
    line-height: 1.15;
  }

  .author-more-link:hover strong {
    color: var(--color-red);
  }

  .ranked-link:hover strong,
  .ranked-link:focus-visible strong {
    color: var(--color-red);
  }

  @media (min-width: 72rem) {
    .article-shell {
      grid-template-columns: minmax(0, 1fr) minmax(15rem, 0.3fr);
      align-items: start;
      column-gap: var(--space-7);
    }

    .article-rail {
      position: sticky;
      top: var(--space-4);
    }
  }

  .hero {
    width: min(100%, var(--site-max));
    overflow: hidden;
    border-top: 4px solid var(--color-ink);
    background: var(--color-ink);
  }

  .hero-img,
  .hero-video,
  .embed-shell {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--color-ink);
  }

  .hero-img,
  .hero-video {
    height: auto;
    object-fit: cover;
  }

  .embed-shell {
    position: relative;
  }

  .hero-embed {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
  }

  .article-body {
    max-width: var(--measure);
    margin-inline: auto;
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: 1.72;
  }

  .article-body > * + * {
    margin-top: var(--space-4);
  }

  .article-body h2,
  .article-body h3 {
    font-family: var(--font-display);
    font-weight: 900;
    line-height: 1.08;
    margin-top: var(--space-6);
  }

  .article-body h2 {
    font-size: var(--text-xl);
  }

  .article-body h3 {
    font-size: var(--text-lg);
  }

  .article-body a {
    color: var(--color-blue);
  }

  .article-body blockquote {
    padding: var(--space-3) 0 var(--space-3) var(--space-4);
    border-left: 4px solid var(--color-red);
    color: var(--color-muted);
  }

  .article-body code,
  .article-body pre {
    font-family: var(--font-mono);
    font-size: 0.92em;
  }

  .article-body :not(pre) > code {
    padding: 0.1rem 0.3rem;
    background: rgb(201 129 36 / 16%);
  }

  .article-body pre {
    overflow-x: auto;
    padding: var(--space-4);
    border: 1px solid var(--color-line);
    background: var(--color-paper);
  }

  .article-body img {
    width: min(100%, 52rem);
    height: auto;
  }

  .article-body table {
    display: block;
    overflow-x: auto;
    border-collapse: collapse;
  }

  .article-body th,
  .article-body td {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-line);
  }

  @media (min-width: 42rem) {
    .author-profile {
      grid-template-columns: minmax(12rem, 0.36fr) minmax(0, 1fr);
      align-items: start;
    }

    .author-profile-photo {
      width: 100%;
      max-width: 18rem;
    }

    .article-standfirst {
      max-width: 100%;
    }

    .article-item {
      grid-column: span 6;
    }

    .article-item:first-child {
      grid-column: 1 / -1;
    }

    /* The full-width lead is a feature card: kicker and centered title and dek run
       full width up top; the image then floats left and the summary wraps beside it
       and continues full width once it passes the bottom of the image. display:block
       (not the card's flex) so the float wrap works. */
    .card.lead-card {
      display: block;
    }
    .lead-card .card-kicker,
    .lead-card .card-title {
      text-align: center;
    }
    .lead-card .card-kicker {
      justify-content: center;
    }
    .lead-card .card-title {
      font-size: var(--text-2xl);
    }
    .lead-card .card-media {
      float: left;
      width: 46%;
      margin: var(--space-1) var(--space-5) var(--space-3) 0;
      height: auto;
      min-height: 0;
    }
    .lead-card .card-meta {
      clear: both;
    }

    .author-grid .article-item,
    .author-grid .article-item:first-child {
      grid-column: span 6;
    }

    .author-grid .article-item:first-child .card-has-media {
      display: flex;
      grid-template-columns: none;
      gap: var(--space-3);
    }

    .author-grid .article-item:first-child .card-has-media .card-media {
      height: auto;
      min-height: 0;
    }

    .author-grid .article-item:first-child .card-title {
      font-size: var(--text-xl);
    }
  }

  @media (min-width: 72rem) {
    .portal-front {
      grid-template-columns: minmax(0, 1fr) minmax(18rem, 0.32fr);
      align-items: start;
      column-gap: var(--space-6);
    }

    .facet-panel,
    .pager,
    .months {
      grid-column: 1 / -1;
    }

    .article-list {
      grid-column: 1;
    }

    .ranked-rail {
      grid-column: 2;
      position: sticky;
      top: var(--space-4);
    }

    .article-item {
      grid-column: span 6;
    }

    .article-item:first-child {
      grid-column: 1 / -1;
    }

    .article-item:nth-child(2),
    .article-item:nth-child(3) {
      grid-column: span 6;
    }

    .author-portal {
      grid-template-columns: 1fr;
    }

    .author-portal .article-list {
      grid-column: 1 / -1;
    }

    .author-grid .article-item:first-child,
    .author-grid .article-item:nth-child(2),
    .author-grid .article-item:nth-child(3) {
      grid-column: span 6;
    }
  }
}

@layer utilities {
  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      animation-duration: 0.001ms !important;
      animation-iteration-count: 1 !important;
      scroll-behavior: auto !important;
      transition-duration: 0.001ms !important;
    }

    /* A reduced-motion reader gets no autoplaying background video; the masthead
       keeps its gradient and wordmark. The blanket rule above stops CSS animation
       and transition only, not <video> playback, so disable the video directly. */
    .masthead-video {
      display: none;
    }
  }

  /* Desktop: the card lists (the latest grid and the author page's "Contenido
     generado" grid, both .article-list) flow as two independent masonry columns
     instead of aligned grid rows, so a short text-only card never leaves an empty
     gap beside a tall image card. The main list keeps its full-width lead via
     column-span; the author grid (.author-grid) has no lead. Mobile, a single
     column, is unaffected. */
  @media (min-width: 42rem) {
    .article-list {
      display: block;
      columns: 2;
      column-gap: var(--gutter);
    }
    .article-list > .article-item {
      break-inside: avoid;
      margin-bottom: var(--space-6);
    }
    .article-list:not(.author-grid) > .article-item:first-child {
      column-span: all;
    }
    .article-list .card {
      min-height: 0;
    }
  }
}
