/* Home guides (§6.1, §6.6): the newest posts, between the ways into the
   catalogue (category, room, city) and the run of proof that ends in the ask.

   ONE RULED FRAME, on the before/after and service-area pattern (§8.5): the
   frame owns the outer border and the radius and clips, every rule inside it
   is a straight hairline, and the cards themselves draw no border. The lead
   guide takes the wide column; the next three share the other as rows of
   equal height, each with its photo set flush against the rules. */
@layer components {
  .home-guides {
    padding-block: var(--section-y);
    background-color: var(--bg);
  }

  .home-guides__head {
    display: grid;
    gap: var(--s-5);
    margin-block-end: var(--s-7);
  }

  /* --ink-500, like every eyebrow but the hero's: the accent is spent once a
     viewport (§8.2). */
  .home-guides__eyebrow,
  .guide-card__meta {
    margin: 0 0 var(--s-2);
    color: var(--ink-500);
    font-size: var(--fs-micro);
    font-weight: var(--fw-ui);
    letter-spacing: var(--tracking-micro);
    line-height: var(--lh-small);
    text-transform: uppercase;
  }

  .home-guides__heading {
    margin: 0;
  }

  .home-guides__intro {
    max-inline-size: var(--w-prose);
    margin: 0;
    color: var(--ink-700);
  }

  .home-guides__frame {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    border: var(--hairline) solid var(--mega-media-border);
    border-radius: var(--r-frame);
    overflow: hidden;
    overflow: clip;
    background-color: var(--surface);
  }

  /* Equal rows, so three short titles and one long one still divide the
     column evenly. Each <li> is a grid so its link fills the row. */
  .home-guides__more {
    display: grid;
    grid-auto-rows: 1fr;
    margin: 0;
    padding: 0;
    list-style: none;
    border-block-start: var(--hairline) solid var(--mega-media-border);
  }

  .home-guides__more > li {
    display: grid;
    min-inline-size: 0;
  }

  .home-guides__more > li + li {
    border-block-start: var(--hairline) solid var(--mega-media-border);
  }

  /* ---- The card: one link ------------------------------------------------ */

  .guide-card {
    display: flex;
    min-inline-size: 0;
    color: var(--ink-900);
    text-decoration: none;
    /* The link fills its cell and the frame clips, so the ring sits just
       inside it (§8.6). */
    --focus-offset: calc(var(--s-1) * -1);
    transition: background-color var(--dur-fast) var(--ease);
  }

  .guide-card--lead {
    flex-direction: column;
  }

  /* Two guides only: both are leads, with one rule between them. */
  .guide-card--lead + .guide-card--lead {
    border-block-start: var(--hairline) solid var(--mega-media-border);
  }

  .guide-card__media {
    position: relative;
    flex: none;
    overflow: hidden;
    background-color: var(--bg-alt);
  }

  /* The lead photo keeps 16:10 as its floor and takes any height the list
     beside it adds, so the two columns always close on the same line. */
  .guide-card--lead .guide-card__media {
    flex: 1 0 auto;
    inline-size: 100%;
    aspect-ratio: 16 / 10;
    border-block-end: var(--hairline) solid var(--mega-media-border);
  }

  /* A row's photo is as tall as its row, whatever the title wraps to. */
  .guide-card--row .guide-card__media {
    inline-size: var(--s-13);
    border-inline-end: var(--hairline) solid var(--mega-media-border);
  }

  .guide-card__img {
    position: absolute;
    inset: 0;
    inline-size: 100%;
    block-size: 100%;
    object-fit: cover;
    transition: transform var(--motion-slow) var(--motion-soft-ease);
  }

  .guide-card__content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: var(--s-4);
    flex: 1 1 auto;
    min-inline-size: 0;
    padding: var(--s-5) var(--s-4);
  }

  .guide-card--lead .guide-card__content {
    flex: 0 0 auto;
    padding: var(--s-6) var(--s-5);
  }

  .guide-card__copy {
    min-inline-size: 0;
  }

  /* "Latest guide" on the lead, the row number on the rest. */
  .guide-card__meta {
    font-variant-numeric: tabular-nums;
  }

  /* Outfit at the destination-name size, the same job .home-city__name and
     .hub-card__title do (§8.3). */
  .guide-card__title {
    margin: 0;
    font-family: var(--font-body);
    font-size: var(--fs-h4);
    font-weight: var(--fw-subhead);
    line-height: var(--lh-heading);
    text-wrap: balance;
  }

  /* The lead title is the one heading in the frame with room to be a
     heading, so it takes the h2 role: the display face at the size tuned for
     a heading inside a column, one step under the section heading above. */
  .guide-card--lead .guide-card__title {
    font-family: var(--font-display);
    font-size: var(--fs-h2);
    font-weight: var(--fw-display);
    font-variation-settings: "wdth" 100, "opsz" 20;
  }

  .guide-card__excerpt {
    max-inline-size: var(--w-prose);
    margin: var(--s-3) 0 0;
    color: var(--ink-700);
    font-size: var(--fs-body);
    line-height: var(--lh-body);
  }

  .guide-card__cue {
    display: flex;
    color: var(--ink-500);
    transition: transform var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  }

  /* The hub card's answer (§8.7): the cell tints, the photo grows inside its
     own frame and the cue steps along. Nothing lifts, because the cells share
     their rules. */
  .guide-card:focus-visible {
    background-color: var(--bg-tint);
  }

  @media (hover: hover) and (pointer: fine) {
    .guide-card:hover {
      background-color: var(--bg-tint);
    }

    .guide-card:hover .guide-card__img {
      transform: scale(var(--photo-zoom));
    }

    .guide-card:hover .guide-card__cue {
      color: var(--ink-900);
      transform: translateX(var(--s-1));
    }
  }

  .home-guides__footer {
    padding-block-start: var(--s-5);
  }

  .home-guides__all {
    display: inline-flex;
    align-items: center;
    min-block-size: var(--tap-min);
    color: var(--mega-media-border);
    font-size: var(--fs-small);
    font-weight: var(--fw-ui);
    text-underline-offset: var(--s-1);
  }

  @media (min-width: 480px) {
    .guide-card--row .guide-card__media {
      inline-size: var(--s-14);
    }

    .guide-card__content {
      padding: var(--s-5);
    }
  }

  @media (min-width: 768px) {
    .home-guides__head {
      grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
      align-items: end;
      gap: var(--s-9);
    }

    /* Side by side: the rule between the lead and the list turns upright. */
    .home-guides__frame {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .home-guides__more,
    .guide-card--lead + .guide-card--lead {
      border-block-start: 0;
      border-inline-start: var(--hairline) solid var(--mega-media-border);
    }

    /* A single guide has no list beside it, so it lies down instead: photo
       and copy share the full width. */
    .home-guides__frame--solo {
      grid-template-columns: minmax(0, 1fr);
    }

    .home-guides__frame--solo .guide-card--lead {
      flex-direction: row;
    }

    .home-guides__frame--solo .guide-card--lead .guide-card__media {
      flex: 0 0 60%;
      inline-size: auto;
      border-block-end: 0;
      border-inline-end: var(--hairline) solid var(--mega-media-border);
    }

    .home-guides__frame--solo .guide-card--lead .guide-card__content {
      flex: 1 1 auto;
      align-content: center;
    }
  }

  @media (min-width: 1024px) {
    /* Only the lead-and-list frame is uneven: one guide has one column, and
       two guides are equals. */
    .home-guides__frame:not(.home-guides__frame--solo, .home-guides__frame--pair) {
      grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    }

    .guide-card--row .guide-card__media {
      inline-size: 40%;
    }

    .guide-card__content {
      padding: var(--s-6);
    }

    .guide-card--lead .guide-card__content {
      padding: var(--s-7);
    }

    .guide-card__title {
      font-size: var(--fs-h3);
    }

    .guide-card--lead .guide-card__title {
      font-size: var(--fs-h2);
    }
  }
}
