/* ==============================================================================
   LINKS BLOCK
   ============================================================================== */

/* The links block (templates/blocks/links.html, ADR-040): a grid of cards
   for a links page and one wide card for the home. Only tokens, no colour
   of its own: the paper card, the violet text and the slate labels are
   the pairs tokens.css already measured AA in both themes. */

.block-links__intro {
  margin-bottom: var(--spacing-lg);
}

/* Three columns on a wide screen, two on a tablet, one on a phone: 260px
   is the narrowest a card still holds its title on two or three lines.
   The list's own bullets and indent go, since every item is a card. */
.links-grid {
  display: grid;
  gap: var(--spacing-lg);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

/* The card is the paper of .card, and its one <a> fills it, so the whole
   card is the target of a click and of the keyboard focus. */
.link-card {
  display: flex;
  min-width: 0;
}

.link-card__link {
  display: flex;
  flex-direction: column;
  width: 100%;
  overflow: hidden;
  background: var(--paper-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  color: var(--text-primary);
  text-decoration: none;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

/* A small lift says the card is one unit, as on .card but a step smaller,
   since a page of links carries a dozen of them. The underline of a:hover
   would run under every line of the card, so it is taken off here and
   left on the label alone. */
.link-card__link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.link-card__link:hover .link-card__cta {
  text-decoration: underline;
}

/* The ring of main.css drawn just outside the card's rounded edge. */
.link-card__link:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

/* main.css already shortens every transition under reduced motion; the
   lift itself goes too, so the card does not jump. */
@media (prefers-reduced-motion: reduce) {
  .link-card__link {
    transition: none;
  }

  .link-card__link:hover {
    transform: none;
  }
}

/* Every preview fills the same 16:9 box, cropped to the centre, so the
   titles of a row line up whatever shape the medium's image had. */
.link-card__media {
  display: block;
}

.link-card__image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

/* The tile that stands in for a missing preview: the same 16:9 box on the
   second paper tone, with the kind's icon and name in the slate of the
   labels, --label-color (4.8:1 on the paper), so a row mixing images and
   tiles keeps one rhythm. */
.link-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  aspect-ratio: 16 / 9;
  background: var(--paper-secondary-bg);
  color: var(--label-color);
}

.link-tile__icon {
  width: 3rem;
  height: 3rem;
}

.link-tile__label {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* flex-grow on the body and margin-top: auto on the label pin the label
   to the foot of the card when a neighbour's title runs longer. */
.link-card__body {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  gap: var(--spacing-sm);
  padding: var(--spacing-md) var(--spacing-lg) var(--spacing-lg);
}

/* Source and day, small, in the muted violet of a card's text. */
.link-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 0.4em;
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.link-card__kind-icon {
  flex: 0 0 auto;
  width: 1.25em;
  height: 1.25em;
  color: var(--label-color);
}

/* A card's title is on the closed list of serious headings (ADR-034):
   Source Serif 4 at its one served weight, without capitals, like the
   block heading of .block-cards. h3 is outside main.css's uppercase
   rule, so no extra specificity is needed. A long word wraps rather than
   widening a narrow card. */
.link-card__title {
  margin: 0;
  font-family: var(--font-title-serious);
  font-size: var(--font-size-lg);
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

/* Three lines at most: the card says what the link is, the article says
   the rest. */
.link-card__description {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  margin: 0;
  color: var(--text-muted);
  line-height: 1.5;
}

/* The label in the links' violet with its arrow, at the foot. */
.link-card__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  margin-top: auto;
  color: var(--accent-blue);
  font-weight: 600;
}

.link-card__arrow {
  flex: 0 0 auto;
  width: 1.15em;
  height: 1.15em;
}

/* ------------------------------------------------------------------------------
   The featured layout: one link, wide, on the home
   ------------------------------------------------------------------------------ */

/* The paper card of .block-featured, so the call of the day and the link
   under it read as one pair at the top of the home. */
.block-links--featured {
  display: grid;
  gap: var(--spacing-lg);
  padding: var(--spacing-lg) var(--spacing-md);
  background: var(--paper-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* The image keeps its own proportions up to 16:9 on a phone, as wide as
   the column; from 768px it sits in a column of its own (below). */
.link-featured__media {
  display: block;
  min-width: 0;
  overflow: hidden;
  border-radius: var(--radius-lg);
}

.link-featured__image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.link-tile--featured {
  display: flex;
}

/* minmax(0, 1fr) in the wide grid and min-width here: a long word in the
   title must wrap inside its column, never widen the page. */
.link-featured__body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--spacing-sm);
}

/* «Enlace destacado · La Voz de Lanzarote TV», the small capitals line of
   .featured__kicker. */
.link-featured__kicker {
  margin: 0;
  color: var(--label-color);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* The title of .featured__title: the serious serif, no capitals. The
   body:not(.admin) prefix matches the specificity of main.css's
   uppercase rule for h2, as featured.css does. */
body:not(.admin) .link-featured__title {
  margin: 0;
  font-family: var(--font-title-serious);
  font-weight: 600;
  line-height: 1.15;
  text-transform: none;
  letter-spacing: 0;
}

.link-featured__date {
  margin: 0;
  color: var(--text-muted);
}

.link-featured__description {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.6;
}

.link-featured__button {
  margin-top: var(--spacing-xs);
}

/* From 768px the copy takes the left column and the image a right
   column of up to 18rem, centred on each other's height (Juan, 15 October
   2026: «el enlace destacado lleva la foto a la derecha»; the call of the
   day above it keeps its poster on the left, so the two cards alternate).
   The image stays first in the markup, so on a phone it is on top; the
   grid places it on the right here. It is no longer cropped to 16:9: a
   photo or a poster shows whole in its column. */
@media (min-width: 768px) {
  .block-links--featured {
    grid-template-columns: minmax(0, 1fr) minmax(0, 18rem);
    align-items: center;
    column-gap: var(--spacing-xl);
    padding: var(--spacing-xl) var(--spacing-lg);
  }

  .link-featured__media {
    grid-column: 2;
    grid-row: 1;
  }

  .link-featured__body {
    grid-column: 1;
    grid-row: 1;
  }

  .link-featured__image {
    aspect-ratio: auto;
  }
}
