/* ==========================================================================
   Gusto Rewards — app-download hero + membership tier grid
   --------------------------------------------------------------------------
   Namespaced .rw-* throughout, so this file is side-effect-free on any page
   that also loads it for a different component (same guarantee the asset
   registry documents for home-elevation.css).

   Loaded by assets/css/… through the composition-aware asset layer: the
   rewards_tiers component type declares the 'rewards' logical style handle,
   so this file loads ONLY on pages whose composition contains that type,
   plus explicitly by template-rewards.php.

   Colours, spacing and type come from design-system.css tokens. No new
   palette value, font or spacing constant is introduced here, and no
   existing design-system rule is overridden.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Local surfaces, derived from existing palette tokens only.
   -------------------------------------------------------------------------- */
.rw-hero,
.rw-tiers {
  --rw-gold-soft:     #E8D5B0;                    /* tint of --home-gold, card face */
  --rw-silver-soft:   var(--ds-ivory);
  --rw-platinum-soft: #0E3450;                    /* shade of --ds-navy, card face */
  --rw-hairline:      rgba(244, 240, 229, 0.18);
  --rw-hairline-dark: rgba(8, 38, 61, 0.14);
  --rw-radius:        10px;
}

/* ==========================================================================
   1. Hero — app download
   ========================================================================== */

.rw-hero {
  position: relative;
  overflow: hidden;                                /* no horizontal overflow, ever */
  background-color: var(--ds-navy);                /* fallback before/without a photo */
  isolation: isolate;

  /* Desktop band: 600px (client-specified). The supplied photograph is 1738x905 (1.92:1)
     with the phone composited in, and at 1440 it covers to 750px tall — so 600px reveals
     80% of the frame, more of the device and the table than the previous 520px did.
     min-height, not height, so longer copy still grows the band rather than being clipped. */
  min-height: 600px;
  padding: var(--space-sm) 0;
  display: flex;
  align-items: center;
}

.rw-hero-inner { width: 100%; }

.rw-hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  /* Biased slightly above centre: the supplied photograph's phone screen sits in the upper
     two-thirds of frame, so this keeps the device content inside the crop. */
  background-position: 50% 42%;
  z-index: 0;
}

/* Legibility scrim. Default sits between the two explicit strengths. */
.rw-hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(8, 38, 61, 0.92) 0%, rgba(8, 38, 61, 0.72) 55%, rgba(8, 38, 61, 0.45) 100%);
}
.rw-hero--overlay-light .rw-hero-bg::after {
  background: linear-gradient(90deg, rgba(8, 38, 61, 0.78) 0%, rgba(8, 38, 61, 0.5) 55%, rgba(8, 38, 61, 0.25) 100%);
}
.rw-hero--overlay-strong .rw-hero-bg::after {
  background: linear-gradient(90deg, rgba(8, 38, 61, 0.97) 0%, rgba(8, 38, 61, 0.88) 55%, rgba(8, 38, 61, 0.7) 100%);
}

.rw-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-sm);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: center;
  gap: var(--space-sm);
}

/* Foreground image on the left instead of the right. */
.rw-hero--media-left .rw-hero-media { order: -1; }

.rw-hero-copy { min-width: 0; }

.rw-hero-eyebrow {
  display: block;
  color: var(--home-gold);
  margin-bottom: var(--space-xs);
}

.rw-hero-title {
  color: var(--ds-white);
  margin: 0 0 var(--space-xs);
  line-height: 1.05;
}

.rw-hero-text {
  color: rgba(244, 240, 229, 0.86);
  max-width: 46ch;
  margin: 0 0 var(--space-sm);
}

/* ---- store badges ---- */

.rw-store-badges {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.rw-store-badge { margin: 0; }

.rw-store-badge-link {
  display: inline-block;
  line-height: 0;                                  /* kills the inline-image gap */
  border-radius: 8px;
  transition: transform var(--ds-transition-fast), opacity var(--ds-transition-fast);
}
.rw-store-badge-link:hover,
.rw-store-badge-link:focus-visible { transform: translateY(-2px); opacity: 0.92; }

.rw-store-badge-link:focus-visible {
  outline: 2px solid var(--home-gold);
  outline-offset: 3px;
}

/* Artwork supplied, store URL not yet. The badge shows at full fidelity but is a <span>,
   not a link: nothing to click, no placeholder destination, no hover affordance. */
.rw-store-badge-link--inactive {
  cursor: default;
}
.rw-store-badge-link--inactive:hover {
  transform: none;
  opacity: 1;
}

/* Official badge artwork comes in different aspect ratios; normalise on HEIGHT
   so the two sit on a shared baseline without distorting either one. */
.rw-store-badge-img {
  height: 48px;
  width: auto;
  max-width: 100%;
  display: block;
}

.rw-hero-media {
  min-width: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* The device image is capped by HEIGHT so it sits inside the 420px band without being
   cropped, and object-fit:contain guarantees its proportions are never distorted
   whatever aspect ratio the supplied artwork has. */
.rw-hero-device-img {
  display: block;
  max-width: 100%;
  height: auto;
  max-height: 360px;
  object-fit: contain;
  margin-left: auto;
  margin-right: auto;
}

/* ==========================================================================
   1b. Decorative divider — shared by the benefit row and the tier band
   --------------------------------------------------------------------------
   A hairline rule, a small gold lozenge, a hairline rule. Drawn in CSS from the
   existing gold token: no new artwork, nothing to download, and it scales and
   recolours with the design system.
   ========================================================================== */

.rw-ornament {
  display: block;
  position: relative;
  width: 140px;
  height: 12px;
  margin: 0 auto var(--space-xs);
  color: var(--home-gold);

  /* The two hairlines, drawn as backgrounds so the element needs no child nodes. */
  background-image:
    linear-gradient(currentColor, currentColor),
    linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-size: 52px 1px, 52px 1px;
  background-position: left center, right center;
}

/* The centre lozenge: one square, rotated. */
.rw-ornament::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  background: currentColor;
  transform: translate(-50%, -50%) rotate(45deg);
}

/* ==========================================================================
   1c. Benefit row  (feature_grid / rewards_benefits)
   ========================================================================== */

.rw-benefits {
  background-color: var(--home-ivory);
  padding: var(--space-md) 0;
}

.rw-benefits-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-sm);
}

.rw-benefits-head {
  text-align: center;
  max-width: 720px;
  margin: 0 auto var(--space-md);
}

.rw-benefits-eyebrow {
  display: block;
  color: var(--home-gold);
  margin-bottom: var(--space-xs);
}

.rw-benefits-title {
  color: var(--ds-navy);
  margin: 0 0 var(--space-xs);
}

.rw-benefits-intro {
  margin: 0;
  color: var(--ds-navy);
  opacity: 0.78;
  line-height: 1.6;
}

/* FOUR equal columns on desktop — the count is fixed by the design, not by the row
   count, so a fifth benefit wraps rather than squeezing the row. */
.rw-benefits-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
}

/* Hairline separators BETWEEN columns only — never a trailing edge. */
.rw-benefit {
  min-width: 0;
  padding: 0 var(--space-sm);
  text-align: center;
  border-left: 1px solid rgba(8, 38, 61, 0.14);
}
.rw-benefit:first-child { border-left: 0; }

.rw-benefit-iconwrap {
  display: block;
  margin-bottom: 18px;
  line-height: 0;
}

.rw-benefit-icon {
  color: var(--home-gold);
  display: inline-block;
}

.rw-benefit-title {
  margin: 0 0 8px;
  font-family: var(--ds-font-neutra), sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ds-navy);
  line-height: 1.4;
}

.rw-benefit-text {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--ds-navy);
  opacity: 0.72;
}

/* ==========================================================================
   2. Tier grid
   ========================================================================== */

.rw-tiers {
  background-color: var(--ds-navy);
  padding: var(--space-md) 0;
}

.rw-tiers-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-sm);
}

/* 860, not 720: at 720 "Your Journey with Gusto Rewards" wraps onto two lines, where the
   reference keeps it on one. The intro paragraph is capped separately and narrower, so it
   still breaks to two lines exactly as the reference does. */
.rw-tiers-head {
  text-align: center;
  max-width: 860px;
  margin: 0 auto var(--space-sm);
}

.rw-tiers-eyebrow {
  display: block;
  color: var(--home-gold);
  margin-bottom: var(--space-xs);
}

.rw-tiers-title {
  color: var(--ds-white);
  margin: 0 0 var(--space-xs);
}

.rw-tiers-intro {
  color: rgba(244, 240, 229, 0.82);
  margin: 0 auto;
  max-width: 640px;
}

/* Three equal columns; equal heights come free from grid's default stretch. */
.rw-tiers-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-sm);
  align-items: stretch;
}

/* ---- the card ---- */

.rw-tier {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: var(--space-sm);
  border-radius: var(--rw-radius);
  background-color: var(--rw-silver-soft);
  color: var(--ds-navy);
  border: 1px solid var(--rw-hairline-dark);
  text-align: center;
  transition: transform var(--ds-transition-fast), box-shadow var(--ds-transition-fast);
}

.rw-tier:hover { transform: translateY(-4px); }

/* Surface treatments — all built from existing palette tokens. */
.rw-tier--silver   { background-color: var(--rw-silver-soft); color: var(--ds-navy); }
.rw-tier--gold     { background: linear-gradient(160deg, var(--rw-gold-soft) 0%, var(--home-gold) 100%); color: var(--ds-navy); border-color: rgba(8, 38, 61, 0.18); }
.rw-tier--platinum { background-color: var(--rw-platinum-soft); color: var(--ds-ivory); border-color: var(--rw-hairline); }
.rw-tier--ivory    { background-color: var(--home-ivory); color: var(--ds-navy); }
.rw-tier--white    { background-color: var(--ds-white);  color: var(--ds-navy); }
.rw-tier--navy     { background-color: var(--home-navy); color: var(--ds-ivory); border-color: var(--rw-hairline); }

/* The highlighted tier is distinguished by its SURFACE, not by a vertical offset: the reference
   shows all three card tops aligned. A translateY lift here was also unreliable — the design
   system's .ds-reveal-up.is-visible (specificity 0,2,0) sets transform:translateY(0) and beats a
   single-class .rw-tier--highlight (0,1,0), so the lift was cancelled the moment the card
   revealed. Shadow and border carry the emphasis instead, and nothing fights the reveal. */
.rw-tier--highlight {
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
}

.rw-tier-flag {
  align-self: center;
  margin: 0 0 var(--space-xs);
  padding: 4px 12px;
  border-radius: 999px;
  background-color: var(--ds-navy);
  color: var(--ds-ivory);
  font-family: var(--ds-font-neutra), sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.rw-tier--platinum .rw-tier-flag,
.rw-tier--navy .rw-tier-flag { background-color: var(--home-gold); color: var(--ds-navy); }

/* ---- badge ---- */

.rw-tier-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-xs);
  border-radius: 50%;
  background-color: rgba(168, 137, 74, 0.16);
  border: 1px solid rgba(168, 137, 74, 0.45);
}
.rw-tier--platinum .rw-tier-badge,
.rw-tier--navy .rw-tier-badge {
  background-color: rgba(244, 240, 229, 0.1);
  border-color: var(--rw-hairline);
}

.rw-tier-badge-icon { color: var(--home-gold); }
.rw-tier--platinum .rw-tier-badge-icon,
.rw-tier--navy .rw-tier-badge-icon { color: var(--ds-ivory); }

.rw-tier-badge-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  display: block;
}

/* ---- text ---- */

.rw-tier-name {
  margin: 0 0 6px;
  font-family: var(--ds-font-abruzzo), serif;
  font-size: 1.5rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: inherit;
}

.rw-tier-desc {
  margin: 0 0 var(--space-xs);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid currentColor;
  font-size: 0.95rem;
  line-height: 1.5;
  opacity: 0.78;
}

/* ---- benefits ---- */

.rw-tier-benefits {
  list-style: none;
  margin: 0;
  padding: 0;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rw-tier-benefit {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.95rem;
  line-height: 1.45;
}

.rw-tier-benefit-icon {
  flex: 0 0 auto;
  margin-top: 1px;
  color: var(--home-gold);
}
.rw-tier--platinum .rw-tier-benefit-icon,
.rw-tier--navy .rw-tier-benefit-icon { color: var(--ds-ivory); opacity: 0.85; }

.rw-tier-benefit-text { min-width: 0; }

/* ==========================================================================
   3. Responsive
   ========================================================================== */

/* Tablet — hero stacks, tiers go to two columns with the third centred. */
@media (max-width: 1024px) {
  /* TABLET KEEPS THE TWO-COLUMN, LEFT-ALIGNED HERO. An earlier revision collapsed to one
     centred column here, which is what made the hero read as centred at tablet widths — the
     reference stays left-aligned and two-column down to the phone breakpoint. Only the column
     ratio tightens, so the copy keeps its ~10% left anchor. */
  /* Responsive heights, not a forced 600: the band scales with the narrower viewport so the
     copy and both badges stay readable without an over-tall photograph. */
  .rw-hero {
    min-height: 480px;
    padding: var(--space-sm) 0;
  }
  .rw-hero-inner {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: var(--space-xs);
    /* Below 1200 the 1200px container stops capping the width, so a fixed 24px gutter would
       pin the copy against the viewport edge (measured 2.2% at 900). A percentage gutter keeps
       the same ~10% left anchor the desktop layout has. */
    padding: 0 6%;
  }
  .rw-hero-device-img { max-height: 300px; }

  /* Benefit row: two columns on tablet. Separators follow the new column structure —
     the left edge of each row's first item loses its rule, and a horizontal rule
     appears between the two rows. */
  .rw-benefits-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rw-benefit { padding: var(--space-xs) var(--space-sm); }
  .rw-benefit:nth-child(odd) { border-left: 0; }
  .rw-benefit:nth-child(n + 3) { border-top: 1px solid rgba(8, 38, 61, 0.14); }

  .rw-tiers-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* An odd last card centres itself rather than sitting lopsided. */
  .rw-tiers-grid[data-tier-count="3"] > .rw-tier:last-child {
    grid-column: 1 / -1;
    max-width: 420px;
    justify-self: center;
  }
}

/* Mobile — everything stacks. */
@media (max-width: 768px) {
  /* Mobile is where the hero finally stacks and centres. The photograph stays; only the
     scrim turns vertical so the copy stays readable over it. */
  .rw-hero {
    min-height: 440px;
    padding: var(--space-md) 0;
  }
  .rw-hero-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-sm);
    text-align: center;
  }
  .rw-hero-text { margin-left: auto; margin-right: auto; }
  .rw-store-badges { justify-content: center; }
  .rw-hero--media-left .rw-hero-media { order: 0; }
  .rw-hero-device-img { max-width: 320px; }
  /* Narrow crop: hold the right of the frame so the phone and plate stay in shot instead of
     being cropped away. */
  .rw-hero-bg { background-position: 66% 45%; }
  .rw-hero-bg::after {
    background: linear-gradient(180deg, rgba(8, 38, 61, 0.86) 0%, rgba(8, 38, 61, 0.74) 45%, rgba(8, 38, 61, 0.9) 100%);
  }
  .rw-hero-title { line-height: 1.12; }
  .rw-store-badge-img { height: 44px; }
  .rw-hero-device-img { max-height: 260px; }

  /* Benefit row stacks; vertical rules become horizontal ones between items. */
  .rw-benefits-grid { grid-template-columns: minmax(0, 1fr); }
  .rw-benefit {
    border-left: 0;
    border-top: 1px solid rgba(8, 38, 61, 0.14);
    padding: var(--space-sm) 0;
  }
  .rw-benefit:first-child { border-top: 0; padding-top: 0; }

  .rw-tiers-grid { grid-template-columns: minmax(0, 1fr); }
  .rw-tiers-grid[data-tier-count="3"] > .rw-tier:last-child {
    grid-column: auto;
    max-width: none;
    justify-self: stretch;
  }
}

@media (max-width: 480px) {
  .rw-hero-inner,
  .rw-tiers-inner { padding: 0 16px; }
  .rw-tier { padding: var(--space-sm) 20px; }
  .rw-tier-name { font-size: 1.35rem; }
}

/* Very small screens (the theme's documented <=368px check). */
@media (max-width: 368px) {
  .rw-store-badges { gap: 10px; }
  .rw-store-badge-img { height: 40px; }
  .rw-tier-badge { width: 56px; height: 56px; }
  .rw-tier-benefit { font-size: 0.9rem; }
}

/* Respect reduced-motion: the theme's reveal animation already does, and the
   hover lifts should too. */
@media (prefers-reduced-motion: reduce) {
  .rw-tier,
  .rw-store-badge-link { transition: none; }
  .rw-tier:hover,
  .rw-store-badge-link:hover { transform: none; }
}

/* --------------------------------------------------------------------------
   30 Nov 2026, client request: body text in the top three Rewards sections
   matches the sitewide body size (.ds-body = 1.1rem). Plus the optional hero
   text link below the store badges.
   -------------------------------------------------------------------------- */
.rw-hero-text,
.rw-benefits-intro,
.rw-benefit-text,
.rw-tiers-intro,
.rw-tier-desc,
.rw-tier-benefit { font-size: 1.1rem; }

.rw-hero-secondary { margin: var(--space-xs) 0 0; }
.rw-hero-secondary-link {
  color: var(--ds-ivory);
  font-family: var(--ds-font-neutra), sans-serif;
  font-weight: 600;
  font-size: 1.1rem;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.rw-hero-secondary-link:hover,
.rw-hero-secondary-link:focus-visible { color: var(--home-gold); }
@media (max-width: 768px) { .rw-hero-secondary { text-align: center; } }

/* rewards-css-2 (30 Nov 2026): match the sitewide .ds-body size from 769px (style.css: 1.2rem). */
@media (min-width: 769px) {
  .rw-hero-text,
  .rw-benefits-intro,
  .rw-benefit-text,
  .rw-tiers-intro,
  .rw-tier-desc,
  .rw-tier-benefit,
  .rw-hero-secondary-link { font-size: 1.2rem; }
}
