/**
 * Webtron Docs — Home page skin
 *
 * Styles the home page pattern (patterns/home-page-guide-base.php). Every rule is scoped to the
 * pattern's wrapper class, `.wgb-home`, so the blocks it restyles keep their own look anywhere
 * else. Loaded by inc/blocks/home-skin.php wherever that wrapper renders, and listed in
 * add_editor_style() so the Site Editor preview matches.
 *
 * Colours, radii and shadows come from the shared --wds-* tokens (assets/css/blocks/_tokens.css),
 * so dark mode follows the rest of the site. The hero and the tutorials band are dark in both
 * modes.
 *
 * Sections are full-width and hold their content to --wgb-max with inline padding, so one element
 * carries both the background and the content width.
 *
 * @package WebtronDocs
 */

.wgb-home {
  --wgb-max: 1200px;
  --wgb-gutter: clamp(1rem, 4vw, 2rem);
  --wgb-gap: clamp(2.5rem, 5vw, 4rem);
  --wgb-navy: #0b1120;
  --wgb-navy-raised: #111a2e;
  --wgb-on-navy: #ffffff;
  --wgb-on-navy-muted: rgba(255, 255, 255, 0.74);
  --wgb-on-navy-line: rgba(255, 255, 255, 0.14);
  /* How far the platform cards rise into the dark area above them. */
  --wgb-overlap: 9rem;

  background: var(--wds-surface-2);
  color: var(--wds-text);
}

/* The editor and theme add a gap between sibling blocks; sections set their own spacing. The
   doubled class outranks the global-styles rule, which prints after this sheet. */
.wgb-home.wgb-home > *,
.wgb-home .wgb-section > *,
.wgb-home .wgb-hero > *,
.wgb-home .wgb-section__head > * {
  margin-block: 0;
}

/* The dark footer follows the last section directly. */
.wp-site-blocks > main:has(> .wgb-home) + *,
.wp-site-blocks > main:has(> .wgb-home) {
  margin-block: 0;
}

/* ── Sections ─────────────────────────────────────────────────────────────── */

.wgb-home .wgb-section {
  position: relative;
  box-sizing: border-box;
  max-width: none;
  padding-block: var(--wgb-gap);
  padding-inline: max(var(--wgb-gutter), calc((100% - var(--wgb-max)) / 2));
}

.wgb-home .wgb-section + .wgb-section:not(.wgb-band) {
  padding-top: 0;
}

/* Matches the specificity of the rule above so a section after the dark band keeps its top
   padding. */
.wgb-home .wgb-section.wgb-band + .wgb-section:not(.wgb-band) {
  padding-top: var(--wgb-gap);
}

.wgb-home .wgb-section__head {
  max-width: 44rem;
  margin-bottom: 1.5rem;
}

.wgb-home .wgb-eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--wds-accent);
}

.wgb-home .wgb-section__head h2 {
  margin: 0;
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--wds-text);
  text-wrap: balance;
}

.wgb-home .wgb-section__intro {
  margin: 0.5rem 0 0;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--wds-text-muted);
  text-wrap: pretty;
}

/* ── Hero ─────────────────────────────────────────────────────────────────── */

/* Raised above the sections below so the search panel can drop over them. overflow stays
   visible for the same reason; the motion layer clips itself. */
.wgb-home .wgb-hero {
  position: relative;
  z-index: 5;
  box-sizing: border-box;
  max-width: none;
  padding: clamp(6.5rem, 13vh, 8.5rem) var(--wgb-gutter)
    clamp(2.25rem, 4vw, 3rem);
  background-color: var(--wgb-navy);
  /* Static grid for the editor, and for the front end until the canvas draws. */
  background-image:
    linear-gradient(rgba(56, 189, 248, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.06) 1px, transparent 1px);
  background-size: 44px 44px;
  color: var(--wgb-on-navy);
  text-align: center;
}

.wgb-home .wgb-hero__motion {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

/* A glow behind the heading, and a fade to solid navy so the grid ends before the platform
   cards' dark strip begins. */
.wgb-home .wgb-hero::before,
.wgb-home .wgb-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.wgb-home .wgb-hero::before {
  background: radial-gradient(
    ellipse 62% 58% at 50% 8%,
    rgba(35, 114, 206, 0.38),
    transparent 72%
  );
}

.wgb-home .wgb-hero::after {
  top: auto;
  height: 7rem;
  background: linear-gradient(180deg, transparent, var(--wgb-navy));
}

.wgb-home .wgb-hero > :not(.wgb-hero__motion) {
  position: relative;
  z-index: 2;
  max-width: 46rem;
  margin-inline: auto;
}

.wgb-home .wgb-hero .wgb-eyebrow {
  display: table;
  margin: 0 auto 1.125rem;
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--wgb-on-navy-line);
  border-radius: var(--wds-radius-pill);
  background: rgba(255, 255, 255, 0.06);
  color: var(--wgb-on-navy-muted);
}

.wgb-home .wgb-hero > h1.wp-block-heading {
  max-width: 62rem;
  margin: 0 auto 0.875rem;
  font-size: clamp(2rem, 4.2vw, 3rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: var(--wgb-on-navy);
  text-wrap: balance;
}

.wgb-home .wgb-hero .wgb-lead {
  max-width: 38rem;
  margin: 0 auto 1.75rem;
  font-size: clamp(1rem, 1.5vw, 1.1875rem);
  line-height: 1.55;
  color: var(--wgb-on-navy-muted);
  text-wrap: pretty;
}

/* The search bar: above its neighbours so the open panel covers what follows. */
.wgb-home .wgb-hero .webtron-ai-search {
  z-index: 3;
}

/* An announcement, when one is active, as a glass strip under the search. */
.wgb-home .wgb-hero .webtron-announcements {
  max-width: 42.5rem;
  margin: 1.5rem auto 0;
  text-align: left;
}

.wgb-home .wgb-hero .webtron-announcement {
  border: 1px solid var(--wgb-on-navy-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: none;
  color: var(--wgb-on-navy);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.wgb-home .wgb-hero .webtron-announcement__heading,
.wgb-home .wgb-hero .webtron-announcement__body {
  color: var(--wgb-on-navy);
}

.wgb-home .wgb-hero .webtron-announcement__body,
.wgb-home .wgb-hero .webtron-announcement__date {
  color: var(--wgb-on-navy-muted);
}

.wgb-home .wgb-hero .webtron-announcement__body a {
  color: #8ec5ff;
}

/* ── Platforms and services ───────────────────────────────────────────────── */

/* The section paints a navy strip across its own top, so the cards straddle the edge between
   the dark hero and the light page. */
.wgb-home .wgb-products {
  z-index: 1;
  padding-top: 0;
}

.wgb-home .wgb-products::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  z-index: -1;
  height: var(--wgb-overlap);
  background: var(--wgb-navy);
}

.wgb-home .webtron-platforms-services {
  margin: 0;
}

/* One row. Each group grows by its own card count, so the cards come out the same width. */
.wgb-home .webtron-platforms-services .ps-container {
  display: flex;
  align-items: stretch;
  gap: 1rem;
}

.wgb-home .webtron-platforms-services .ps-section {
  min-width: 0;
  gap: 0;
}

.wgb-home .webtron-platforms-services .ps-section--platforms {
  flex: var(--platforms-per-row, 2) 1 0;
}

.wgb-home .webtron-platforms-services .ps-section--services {
  flex: var(--services-per-row, 1) 1 0;
}

.wgb-home .webtron-platforms-services .ps-divider {
  display: none;
}

.wgb-home .webtron-platforms-services .ps-section__heading {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: left;
  color: var(--wgb-on-navy-muted);
}

.wgb-home .webtron-platforms-services .ps-grid {
  gap: 1rem;
}

.wgb-home .webtron-platforms-services .ps-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  box-sizing: border-box;
  height: 13.5rem;
  aspect-ratio: auto;
  padding: 1.125rem 1.25rem;
  border-radius: 16px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.1),
    0 18px 40px rgba(2, 8, 23, 0.28);
  transition:
    transform var(--wds-dur-slow) var(--wds-ease),
    box-shadow var(--wds-dur-slow) var(--wds-ease);
}

.wgb-home .webtron-platforms-services .ps-card:hover {
  z-index: 2;
  transform: translateY(-3px);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.18),
    0 26px 54px rgba(2, 8, 23, 0.38);
}

.wgb-home .webtron-platforms-services .ps-card:hover .ps-card__bg {
  transform: scale(1.04);
}

/* One navy wash on every card, tinted at the foot by the card's own colour. */
.wgb-home .webtron-platforms-services .ps-card .ps-card__overlay,
.wgb-home .webtron-platforms-services .ps-card:hover .ps-card__overlay {
  opacity: 1;
  background: linear-gradient(
    180deg,
    rgba(11, 17, 32, 0.22) 0%,
    rgba(11, 17, 32, 0.6) 40%,
    rgba(11, 17, 32, 0.9) 72%,
    color-mix(in srgb, var(--overlay-color, #1e40af) 34%, #0b1120) 100%
  );
}

.wgb-home .webtron-platforms-services .ps-card__glow {
  display: none;
}

.wgb-home .webtron-platforms-services .ps-card__content {
  position: relative;
  inset: auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0;
  overflow: visible;
}

.wgb-home
  .webtron-platforms-services
  .ps-card
  .ps-card__content
  .ps-card__title {
  margin: 0;
  font-size: 1.1875rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  text-align: left;
  white-space: normal;
  text-shadow: none;
  color: var(--wgb-on-navy);
}

/* The description is only carried in a data attribute; surface it under the title. */
.wgb-home .webtron-platforms-services .ps-card[data-description]::after {
  content: attr(data-description);
  position: relative;
  z-index: 4;
  display: -webkit-box;
  margin-top: 0.375rem;
  overflow: hidden;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--wgb-on-navy-muted);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.wgb-home .webtron-platforms-services .ps-card[data-description=""]::after {
  content: none;
}

/* The preview button sits in the title row rather than floating over the text. */
.wgb-home .webtron-platforms-services .ps-card .ps-card__play-btn,
.wgb-home
  .webtron-platforms-services
  .ps-card.has-video:hover
  .ps-card__play-btn {
  position: static;
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  background: rgba(255, 255, 255, 0.16);
  color: var(--wgb-on-navy);
  font-size: 0.75rem;
  opacity: 1;
  transform: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.wgb-home .webtron-platforms-services .ps-card .ps-card__play-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: none;
}

/* Guide shortcuts as a row of chips under the cards. */
.wgb-home .webtron-doc-shortcuts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.625rem 1rem;
  margin: 1.25rem 0 0;
}

.wgb-home .webtron-doc-shortcuts__heading {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--wds-text-muted);
}

.wgb-home .webtron-doc-shortcuts .webtron-doc-shortcuts__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.wgb-home .webtron-doc-shortcuts .webtron-doc-shortcuts__link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 0;
  padding: 0.375rem 0.875rem 0.375rem 0.4375rem;
  border: 1px solid var(--wds-border);
  border-radius: var(--wds-radius-pill);
  background: var(--wds-surface);
  box-shadow: none;
  font-size: 0.8125rem;
  line-height: 1.3;
  color: var(--wds-text);
  transform: none;
}

.wgb-home .webtron-doc-shortcuts .webtron-doc-shortcuts__link:hover {
  border-color: var(--wds-accent);
  color: var(--wds-accent-strong);
}

.wgb-home .webtron-doc-shortcuts .webtron-doc-shortcuts__icon {
  flex: 0 0 auto;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  font-size: 0.6875rem;
}

.wgb-home .webtron-doc-shortcuts .webtron-doc-shortcuts__body {
  display: inline;
}

.wgb-home .webtron-doc-shortcuts .webtron-doc-shortcuts__label {
  font-size: inherit;
  font-weight: 500;
}

/* Doc or Topic stays a word for screen readers; the chip has no room to show it. */
.wgb-home .webtron-doc-shortcuts .webtron-doc-shortcuts__badge {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.wgb-home .webtron-doc-shortcuts .webtron-doc-shortcuts__excerpt,
.wgb-home .webtron-doc-shortcuts .webtron-doc-shortcuts__arrow {
  display: none;
}

/* ── Quick answers ────────────────────────────────────────────────────────── */

.wgb-home .webtron-quick-answers {
  margin: 0;
}

/* ── Tutorials band ───────────────────────────────────────────────────────── */

.wgb-home .wgb-band {
  overflow: hidden;
  background-color: var(--wgb-navy);
  background-image:
    radial-gradient(
      ellipse 55% 60% at 85% 0%,
      rgba(35, 114, 206, 0.3),
      transparent 70%
    ),
    linear-gradient(rgba(56, 189, 248, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.05) 1px, transparent 1px);
  background-size:
    auto,
    44px 44px,
    44px 44px;
  color: var(--wgb-on-navy);
}

.wgb-home .wgb-band .wgb-eyebrow {
  color: #7cc0ff;
}

.wgb-home .wgb-band .wgb-section__head h2 {
  color: var(--wgb-on-navy);
}

.wgb-home .wgb-band .wgb-section__intro {
  color: var(--wgb-on-navy-muted);
}

/* The block sets these as inline custom properties, which only !important can outrank. */
.wgb-home .webtron-tutorials {
  --tutorials-sidebar-bg: var(--wgb-navy-raised) !important;
  --tutorials-radius: 16px !important;

  width: 100%;
  max-width: none;
  margin: 0;
  border: 1px solid var(--wgb-on-navy-line);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

/* ── Browse the documentation ─────────────────────────────────────────────── */

.wgb-home .webtron-docs-grid {
  max-width: none;
  margin: 0;
  padding: 0;
}

.wgb-home .webtron-docs-grid > * {
  max-width: none;
  margin-block-start: 0;
  margin-inline: 0;
}

.wgb-home .webtron-docs-grid .webtron-docs-grid__search {
  max-width: 26rem;
  margin: 0 0 0.875rem;
}

.wgb-home .webtron-docs-grid .webtron-docs-grid__search-field {
  max-width: none;
  margin-inline: 0;
}

/* Sections as wrapping chips, so all twelve are on screen without a sideways scroll. */
.wgb-home .webtron-docs-grid .webtron-docs-grid__tabs {
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: 1.25rem;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: none;
}

.wgb-home .webtron-docs-grid .webtron-docs-grid__tab {
  flex: 0 1 auto;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--wds-border);
  background: var(--wds-surface);
  font-size: 0.8125rem;
  line-height: 1.3;
}

.wgb-home .webtron-docs-grid .webtron-docs-grid__tab:hover {
  border-color: var(--wds-border-strong);
  background: var(--wds-surface);
}

.wgb-home .webtron-docs-grid .webtron-docs-grid__tab.is-active {
  border-color: var(--wds-accent-solid, #2372ce);
  background: var(--wds-accent-solid, #2372ce);
  box-shadow: none;
  color: var(--wds-accent-contrast);
}

.wgb-home .webtron-docs-grid .webtron-docs-grid__content {
  gap: 1rem;
}

.wgb-home .webtron-docs-grid .webtron-docs-grid__card {
  padding: 1.125rem 1.25rem;
  border-radius: 14px;
  box-shadow: none;
}

.wgb-home .webtron-docs-grid .webtron-docs-grid__card:hover {
  border-color: color-mix(in srgb, var(--wds-accent) 45%, var(--wds-border));
  box-shadow: var(--wds-shadow-lg);
}

/* Icon beside the title, description beneath both. */
.wgb-home
  .webtron-docs-grid
  .webtron-docs-grid__card:not(.webtron-docs-grid__card--parent)
  .webtron-docs-grid__card-link {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 0.75rem;
}

.wgb-home
  .webtron-docs-grid
  .webtron-docs-grid__card:not(.webtron-docs-grid__card--parent)
  .webtron-docs-grid__card-icon {
  width: 2.375rem;
  height: 2.375rem;
  margin: 0;
}

.wgb-home
  .webtron-docs-grid
  .webtron-docs-grid__card:not(.webtron-docs-grid__card--parent)
  .webtron-docs-grid__card-icon
  i {
  font-size: 1.0625rem;
}

.wgb-home
  .webtron-docs-grid
  .webtron-docs-grid__card:not(.webtron-docs-grid__card--parent)
  .webtron-docs-grid__card-title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.3;
}

.wgb-home
  .webtron-docs-grid
  .webtron-docs-grid__card:not(.webtron-docs-grid__card--parent)
  .webtron-docs-grid__card-description {
  grid-column: 1 / -1;
  margin: 0.75rem 0 0;
  font-size: 0.8125rem;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.wgb-home .webtron-docs-grid .webtron-docs-grid__card-count {
  margin: 0.75rem 0 0;
  padding: 0;
  border: 0;
  background: none;
}

.wgb-home .webtron-docs-grid .webtron-docs-grid__card-children {
  margin-top: 0.75rem;
  padding-top: 0.625rem;
}

.wgb-home .webtron-docs-grid .webtron-docs-grid__card-child {
  padding: 0.25rem 0;
}

.wgb-home .webtron-docs-grid .webtron-docs-grid__card-child a {
  font-size: 0.8125rem;
  line-height: 1.4;
}

/* ── Narrow screens ───────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .wgb-home {
    --wgb-overlap: 8rem;
  }

  .wgb-home .webtron-platforms-services .ps-container {
    flex-direction: column;
    gap: 1.25rem;
  }

  /* Once stacked, only the first group sits on the navy strip. */
  .wgb-home
    .webtron-platforms-services
    .ps-section--services
    .ps-section__heading {
    color: var(--wds-text-muted);
  }

  .wgb-home .webtron-platforms-services .ps-card {
    height: 12rem;
  }
}

@media (max-width: 782px) {
  .wgb-home .wgb-hero {
    padding-top: 6.25rem;
  }
}

@media (max-width: 600px) {
  .wgb-home {
    --wgb-overlap: 7rem;
  }

  .wgb-home .webtron-platforms-services .ps-grid {
    grid-template-columns: 1fr;
  }

  .wgb-home .webtron-platforms-services .ps-card {
    height: 10.5rem;
  }

  .wgb-home .webtron-docs-grid .webtron-docs-grid__search {
    max-width: none;
  }

  /* Twelve wrapped chips would fill the screen; on a phone they are one swipeable row that
     runs to the screen edges. */
  .wgb-home .webtron-docs-grid .webtron-docs-grid__tabs {
    flex-wrap: nowrap;
    margin-inline: calc(var(--wgb-gutter) * -1);
    padding: 0 var(--wgb-gutter) 0.25rem;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .wgb-home .webtron-docs-grid .webtron-docs-grid__tabs::-webkit-scrollbar {
    display: none;
  }

  .wgb-home .webtron-docs-grid .webtron-docs-grid__tab {
    flex: 0 0 auto;
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wgb-home .webtron-platforms-services .ps-card,
  .wgb-home .webtron-platforms-services .ps-card .ps-card__bg {
    transition: none;
  }

  .wgb-home .webtron-platforms-services .ps-card:hover,
  .wgb-home .webtron-platforms-services .ps-card:hover .ps-card__bg {
    transform: none;
  }
}
