/*
 * 04 Latest launches: the product cards.
 *
 * The prototype used container queries and cqw units against a wrapper this
 * theme does not have, so the one breakpoint this section has is a media
 * query. The recon records no change at 1100px for this section: both grids
 * stay two up until 640px, so there is deliberately no 1100px rule here.
 *
 * Nothing in this section loops or auto-plays, so there is no ambient motion
 * to stop for SC 2.2.2. The only movement is the reveal transition, whose
 * rules and its reduced-motion handling already live in hero.css, and the
 * card border fade, which base.css collapses under prefers-reduced-motion.
 */

.ad-launches {
  padding-block: 0 var(--ad-space-section);
  padding-inline: var(--ad-space-page);
}

/* ------------------------------------------------------------- section head */

.ad-launches__head {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 40px;
  align-items: end;
  margin-block-end: 48px;
}

.ad-launches__eyebrow {
  display: flex;
  flex-wrap: wrap;
  gap: .5em;
  font-family: var(--ad-font-mono);
  font-size: 12px;
  letter-spacing: .16em;
  color: var(--ad-color-accent);
}

.ad-launches__lede {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ad-launches__heading {
  font-size: 56px;
  letter-spacing: -.04em;
  line-height: 1;
  text-wrap: pretty;
}

.ad-launches__intro {
  max-width: 620px;
  font-size: 17px;
  line-height: 1.5;
  color: var(--ad-color-text-muted);
  text-wrap: pretty;
}

/* ------------------------------------------------------------- card grid */

.ad-launches__list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--ad-space-card-gap);
}

/*
 * The list item carries data-reveal and the card inside it carries the
 * chrome. Keeping them apart matters: the reveal rule in hero.css owns the
 * `transition` shorthand on whatever it is applied to, so a border-color
 * transition declared on the same element would either be dropped or would
 * clobber the reveal.
 */
.ad-launches__item {
  display: flex;
}

.ad-launches__card {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  background: var(--ad-color-panel);
  border: 1px solid var(--ad-color-hairline);
  transition: border-color .3s ease;
}

/*
 * The prototype only had :hover here. focus-within adds the same highlight
 * when either of the card's links is reached by keyboard, so the card a
 * visitor is inside is identifiable without a mouse (SC 2.4.7). It is an
 * addition to the focus ring, never a replacement for it.
 */
.ad-launches__card:hover,
.ad-launches__card:focus-within {
  border-color: var(--ad-color-accent);
}

/* --------------------------------------------------------- screenshot slot */

.ad-launches__shot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: linear-gradient(135deg, var(--ad-color-hero-grad), var(--ad-color-bg));
  border-block-end: 1px solid var(--ad-color-hairline);
}

/*
 * The 32px grid is decoration, so it is a pseudo-element and never reaches
 * the accessibility tree. Unlike the hero's 56px grid it does not drift:
 * this one is static in the design, which is also why it needs no pause rule.
 */
.ad-launches__shot::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .6;
  background-image:
    linear-gradient(var(--ad-color-grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--ad-color-grid-line) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* Sits above the grid, and beats the global img{height:auto} on specificity. */
.ad-launches__img {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ------------------------------------------------------------- card body */

.ad-launches__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 16px;
  padding: 32px;
}

.ad-launches__meta {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.ad-launches__url {
  font-family: var(--ad-font-mono);
  font-size: 13px;
  letter-spacing: .08em;
  color: var(--ad-color-accent);
}

/* auto margin rather than space-between, so a card with no URL still puts
   its tag on the end of the line. */
.ad-launches__tag {
  margin-inline-start: auto;
  font-family: var(--ad-font-mono);
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--ad-color-text-meta);
}

.ad-launches__name {
  font-size: 30px;
  letter-spacing: -.03em;
  line-height: 1.1;
  text-wrap: pretty;
}

/*
 * The design highlights a hovered card with its border, not with a colour
 * change on the title, so the title link opts out of the global a:hover.
 */
.ad-launches__name-link,
.ad-launches__name-link:hover {
  color: inherit;
}

/*
 * The link overlay. The anchor is only the product title, which keeps its
 * accessible name to that title instead of the whole card (SC 2.4.4), while
 * this stretched pseudo-element keeps the card clickable end to end exactly
 * as the prototype's card-wide anchor did.
 */
.ad-launches__name-link::after {
  content: "";
  position: absolute;
  inset: 0;
}

.ad-launches__desc {
  font-size: 16px;
  line-height: 1.55;
  color: var(--ad-color-text-secondary);
}

.ad-launches__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-block-start: 4px;
}

.ad-launches__chip {
  padding-block: 6px;
  padding-inline: 10px;
  font-family: var(--ad-font-mono);
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--ad-color-text-muted);
  /* A chip is a static label, not an interactive component, so SC 1.4.11
     does not apply and it keeps the prototype's exact hairline. */
  border: 1px solid var(--ad-color-border-subtle);
}

/*
 * The second real link in the card. z-index lifts it clear of the title
 * link's overlay so it stays clickable, and min-height gives it a 44px
 * target where the prototype had a 15px text span (SC 2.5.8).
 */
.ad-launches__visit {
  position: relative;
  z-index: 1;
  align-self: start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: var(--ad-size-hit);
  margin-block-start: auto;
  padding-block-start: 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ad-color-accent);
}

.ad-launches__visit svg {
  flex: none;
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 640px) {
  .ad-launches {
    /* The mobile rule overrides the zero top padding, so the section gains
       space above as well as below. */
    padding-block: var(--ad-space-section-mobile);
    padding-inline: var(--ad-space-page-mobile);
  }

  .ad-launches__head,
  .ad-launches__list {
    grid-template-columns: 1fr;
  }

  .ad-launches__heading {
    font-size: 34px;
  }

  /* Sides only. The 32px block padding stays, per the design. */
  .ad-launches__body {
    padding-inline: var(--ad-space-page-mobile);
  }
}
