/* ==================================================================
   Landing pages — site home and guide sub-home.

   Uses only the shared tokens from brand.css, so it inherits whichever
   design direction is active rather than hard-coding one palette.
   ================================================================== */

/* Landing pages need the full width; option C narrows the measure to
   ~46rem for reading, which is wrong for a card grid. Detected via :has()
   on the hero, so no custom template override is needed. */
.md-content__inner:has(.rs-hero) {
  max-width: 62rem;
  padding-top: 0;
}

/* ------------------------------------------------------------------
   HERO
   ------------------------------------------------------------------ */

.rs-hero {
  position: relative;
  background: var(--rs-navy);
  background-image:
    radial-gradient(circle at 88% 12%, rgba(49, 162, 217, 0.32) 0%, transparent 52%),
    linear-gradient(135deg, var(--rs-navy-deep) 0%, var(--rs-navy) 62%);
  color: #fff;
  padding: 4rem 3rem 3.4rem;
  margin-bottom: 3rem;
  overflow: hidden;
}

/* Site home goes full-bleed. Safe here because the page hides the
   navigation sidebar, so the content column spans the grid. */
.rs-hero:not(.rs-hero--sub) {
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding-left: max(3rem, calc(50vw - 30rem));
  padding-right: max(3rem, calc(50vw - 30rem));
}

/* Sub-landing keeps the sidebar, so it stays a contained panel. */
.rs-hero--sub {
  border-radius: 4px;
  padding: 3rem 2.6rem 2.6rem;
}

/* faint grid motif, echoing the product's node-and-branch designer */
.rs-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 46px 46px;
  pointer-events: none;
}
.rs-hero > * {
  position: relative;
  z-index: 1;
}

.md-typeset .rs-hero h1 {
  font-family: var(--rs-display-font);
  font-weight: 700;
  font-size: 3rem;
  line-height: 1.04;
  color: #fff;
  letter-spacing: 0.01em;
  margin: 0 0 1.1rem;
}
.rs-hero--sub .md-typeset h1,
.md-typeset .rs-hero--sub h1 {
  font-size: 2.3rem;
}

/* the sky rule under the title */
.md-typeset .rs-hero h1::after {
  content: "";
  display: block;
  width: 3.2rem;
  height: 4px;
  background: var(--rs-blue);
  margin-top: 1.1rem;
}

.md-typeset .rs-hero__sub {
  font-size: 1rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.82);
  max-width: 34rem;
  margin: 0 0 2rem;
}
.md-typeset .rs-hero__sub strong {
  color: #fff;
}

/* Each landing page's strapline, which was an H2 in Flare because the carousel
 * sat underneath it. With the carousel gone it introduces nothing, so
 * build_landing demotes it to this. */
.md-typeset .rs-lede {
  font-size: 1.05rem;
  line-height: 1.45;
  color: var(--rs-grey);
  max-width: 34rem;
  margin: -0.4rem 0 2rem;
}

/* --- search: the primary action on a 589-page site ---------------- */
.rs-hero__search {
  margin-bottom: 1.6rem;
  max-width: 30rem;
}
.rs-hero__searchbtn {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  padding: 0.95rem 1.2rem;
  font-family: var(--rs-body-font);
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.72);
  text-align: left;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.rs-hero__searchbtn:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: var(--rs-blue);
  color: #fff;
  transform: translateY(-1px);
}
.rs-hero__searchicon {
  font-size: 0.95rem;
  filter: grayscale(1) brightness(2.2);
}

.md-typeset .rs-hero__links {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.45);
  margin: 0;
}
.md-typeset .rs-hero__links a {
  color: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(49, 162, 217, 0.55);
  text-decoration: none;
  padding-bottom: 1px;
}
.md-typeset .rs-hero__links a:hover {
  color: var(--rs-blue);
  border-bottom-color: var(--rs-blue);
}

/* ------------------------------------------------------------------
   SECTION HEADINGS on landing pages
   ------------------------------------------------------------------ */

.md-typeset:has(.rs-hero) h2 {
  font-family: var(--rs-body-font);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--rs-grey);
  margin: 2.8rem 0 1.1rem;
  padding: 0 0 0.7rem;
  border-top: none;
  border-bottom: 1px solid var(--rs-rule);
}
.md-typeset:has(.rs-hero) h2::before {
  display: none;
}

/* ------------------------------------------------------------------
   CARDS
   ------------------------------------------------------------------ */

/* Three things had to be right here, and none of them were before DOCS-62.
 *
 * On the <div>, not the <ul>: Material sets `.grid.cards > ul` to
 * `display: contents`, so the list is not the grid container and everything
 * set on it is inert — which is why these cards rendered one per row.
 *
 * 13rem, not Material's 16rem: at this theme's 125% root size 16rem is 320px,
 * and two of those never fit the measure. 13rem is 260px, which fits three
 * across the 856px a landing page gets once its table of contents is hidden.
 *
 * auto-fill, not auto-fit: the site home stacks groups of 2, 3, 12 and 4
 * cards, and auto-fit collapses the unused tracks, so the two-card group
 * rendered at 420px per card directly above a twelve-card group at 274px. */
.md-typeset .rs-cards.grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr));
  gap: 0.85rem;
  /* Each card is the height of its own content. Grid rows stretch by default,
     so one long blurb in a row left every other card in it padded out with
     100px of nothing. */
  align-items: start;
}

.md-typeset .rs-cards.grid.cards > ul > li {
  border: 1px solid var(--rs-rule);
  border-radius: 4px;
  padding: 0.95rem 1.05rem 1rem;
  margin: 0;
  box-shadow: none;
  background: #fff;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
  display: flex;
  flex-direction: column;
  /* anchor for the stretched title link below */
  position: relative;
}

/* A floor, deliberately not `align-items: stretch` on the container. Stretch
 * would make every card in a row as tall as the tallest, which is the 100px of
 * nothing that `align-items: start` above exists to avoid. A min-height lifts
 * the one-line outliers -- "IMan v6.0 New Features" measured 112px against a
 * 226px neighbour -- and leaves anything already taller alone.
 *
 * 9rem is three blurb lines plus the card's chrome. Measured across the six
 * busiest landing pages, cards run 112-249px, and the steps between them are
 * blurb lines of ~22px: a one-line card is 112, three lines 156, four 178.
 *
 * Gated at 45em because below it the grid is a single column, so every card is
 * its own row and a floor buys no alignment -- it would only add empty space to
 * the short ones. 44.9375em is already this file's phone breakpoint. */
@media screen and (min-width: 45em) {
  .md-typeset .rs-cards.grid.cards > ul > li {
    min-height: 9rem;
  }
}

/* The whole card is the link. The title's <a> is stretched over the card with
 * an ::after, which keeps one anchor and one accessible name — a wrapper <a>
 * would read the blurb out as part of the link text too. This replaced a
 * separate "Open" action in the corner: it left most of the card dead to a
 * click, and lining it up across a row forced every card to the height of the
 * tallest, which is where the empty space came from. */
.md-typeset .rs-cards.grid.cards > ul > li > p:first-child a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 4px;
}
.md-typeset .rs-cards.grid.cards > ul > li:hover {
  border-color: var(--rs-blue);
  box-shadow: 0 6px 20px rgba(51, 70, 89, 0.11);
  transform: translateY(-2px);
}

/* icon */
.md-typeset .rs-cards.grid.cards > ul > li > :first-child .twemoji,
.md-typeset .rs-cards.grid.cards > ul > li .twemoji.lg {
  color: var(--rs-blue);
}
.md-typeset .rs-cards.grid.cards > ul > li .twemoji svg {
  width: 1.5rem;
  height: 1.5rem;
  fill: var(--rs-blue);
}

/* title */
.md-typeset .rs-cards.grid.cards > ul > li > p:first-child {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--rs-body-font);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--rs-navy);
  margin: 0 0 0.45rem;
}
.md-typeset .rs-cards.grid.cards > ul > li > p:first-child strong {
  font-weight: 700;
}
.md-typeset .rs-cards.grid.cards > ul > li > p:first-child a {
  color: inherit;
  border-bottom: none;
  text-decoration: none;
}
.md-typeset .rs-cards.grid.cards > ul > li:hover > p:first-child a {
  color: var(--rs-blue);
}

/* the --- rule Material inserts between title and body */
.md-typeset .rs-cards.grid.cards > ul > li hr {
  margin: 0 0 0.55rem;
  border-bottom: 1px solid var(--rs-rule);
}

.md-typeset .rs-cards.grid.cards > ul > li > p {
  font-size: 0.73rem;
  line-height: 1.5;
  color: var(--rs-grey);
  margin: 0 0 0.4rem;
}
/* Since DOCS-67 removed the page count, this is the blurb — it is the last
   thing in every card, and its bottom margin would otherwise double up with
   the card's own padding. */
.md-typeset .rs-cards.grid.cards > ul > li > p:last-child {
  margin-bottom: 0;
}


/* Landing-page headings. Direction C gives an h2 2.8rem of air above it, which
   is right for a long read and wrong for a page whose job is to be scanned:
   with it, "In this guide" sat below the fold on every guide. */
.md-typeset:has(.rs-cards) h2 {
  margin-top: 1.6rem;
}
.md-typeset:has(.rs-cards) h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.7rem;
}
.md-typeset .rs-cards.grid {
  margin-bottom: 1.6rem;
}

/* ------------------------------------------------------------------
   VIDEOS
   ------------------------------------------------------------------ */

.rs-videos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem;
  margin: 1rem 0 3rem;
}
.rs-videos iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  border: 1px solid var(--rs-rule);
  border-radius: 4px;
  background: #000;
}

/* ------------------------------------------------------------------
   RESPONSIVE
   ------------------------------------------------------------------ */

@media screen and (max-width: 76.1875em) {
  .rs-hero:not(.rs-hero--sub) {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

@media screen and (max-width: 44.9375em) {
  .rs-hero {
    padding: 2.5rem 1.4rem 2.2rem;
  }
  .md-typeset .rs-hero h1 {
    font-size: 2rem;
  }
  .rs-hero--sub .md-typeset h1,
  .md-typeset .rs-hero--sub h1 {
    font-size: 1.7rem;
  }
}
