/* ==========================================================================
   Page Pricing (/pricing) and its components
   Ported from the designer's mockup (charly repo: pricing.html, Figma "Pricing — Desktop" 11529:2).
   Tokens translated to the shop names: spacing xxs/xs/sm -> xs/sm/12px, tint-max -> overlay-pressed,
   shadow-low -> shadow-md. Buttons use the shop classes (button--filled / --outline, icon-button--ghost).
   Every selector is prefixed with :where(.ds), like the other design system files.
   ========================================================================== */

/* ---- Label LG Strong (missing from the shop base.css) ---- */
:where(.ds) .label-lg-strong {
  font-size: var(--type-label-lg);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
}

/* ---- Stepper (Figma Core > Stepper 11472:5555) ---- */
:where(.ds) .stepper {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

:where(.ds) .stepper__label {
  color: var(--content-secondary);
}

:where(.ds) .stepper__control {
  display: flex;
  align-items: center;
  height: var(--size-xl);
  padding-inline: var(--spacing-sm);
  border: 1px solid var(--border-tertiary);
  border-radius: var(--radius-md);
  background-color: var(--background-primary);
  transition: border-color var(--duration-fast) var(--ease-standard);
}

:where(.ds) .stepper__control:has(.stepper__value:focus) {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 1px var(--border-focus);
}

:where(.ds) .stepper__value {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: none;
  color: var(--content-primary);
  font: inherit;
  font-size: var(--type-label-xl);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  text-align: center;
  appearance: textfield;
  -moz-appearance: textfield;
}

:where(.ds) .stepper__value::-webkit-inner-spin-button,
:where(.ds) .stepper__value::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

:where(.ds) .stepper__value:focus {
  outline: none;
}

/* Touch: 16 px value, no iOS zoom on focus */
@media (pointer: coarse) {
  :where(.ds) .stepper__value {
    font-size: var(--type-body-md);
  }
}

/* ---- Link inline ---- */
:where(.ds) .link--inline {
  display: inline;
  font-size: inherit;
  line-height: inherit;
  text-decoration: underline 1px var(--border-tertiary);
  text-underline-offset: 3px;
  transition: text-decoration-color var(--duration-fast) var(--ease-standard);
}

:where(.ds) .link--inline::after {
  content: none;
}

:where(.ds) .link--inline:hover {
  text-decoration-color: currentColor;
}

/* ---- Tag: Has Border ---- */
:where(.ds) .tag.tag--border {
  box-shadow: inset 0 0 0 1px var(--border-quaternary);
}

/* ---- Section Heading: title + tag on one row ---- */
:where(.ds) .section-heading__title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--spacing-sm) var(--spacing-md);
}

/* Sub-menu: in the site header (views/partials/subnavPricing.handlebars, style.css #subnav).
   --subnav-bottom (pricing.js) = bottom of the header, where a section stops when reached through an anchor */
:where(.ds.pricing) .section {
  scroll-margin-top: var(--subnav-bottom, 0px);
}

:where(.ds.pricing) .section[tabindex="-1"]:focus {
  outline: none;
}

/* ---- Pricing page sections (Figma 11529:2); the Card / Pricing component is in content.css ---- */
:where(.ds) .pricing-cta__link {
  align-self: flex-start;
}

:where(.ds) .pricing-cta--glow .pricing-cta__links .link {
  text-shadow: var(--shadow-text);
}

:where(.ds) .pricing-cta--glow .pricing-cta__links .link .icon {
  filter: drop-shadow(0 1px 2px var(--black-alpha-60)) drop-shadow(0 0 12px var(--black-alpha-60));
}

:where(.ds) .pricing-cta__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm) var(--spacing-xl);
}

:where(.ds) #offers .pricing-card__description {
  min-height: 0;
}

:where(.ds) .pricing-card__title-product {
  display: none;
}

@media (max-width: 767px) {
  :where(.ds) .pricing-card__title-product {
    display: inline;
  }
}

:where(.ds) #offers > .section__container {
  gap: var(--spacing-xl);
}

:where(.ds) .pricing-cta--glow {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

:where(.ds) .pricing-cta--glow::before {
  content: "";
  position: absolute;
  inset: calc(120px - 24px) -24px -24px;
  z-index: -1;
  background: url("../../images/pricing/pricing-offers-bg.jpg") center / cover no-repeat;
  filter: blur(6px);
  pointer-events: none;
}

:where(.ds) .pricing-cta--glow .pricing-cta__cards > .pricing-card {
  background-color: var(--background-overlay-pressed);
}

:where(.ds) .pricing-offers__tabs {
  display: none;
}

@media (max-width: 767px) {
  :where(.ds) .pricing-offers__tabs {
    display: flex;
    width: 100%;
    margin-bottom: calc(var(--spacing-md) - var(--spacing-xl));
  }

  :where(.ds) .pricing-offers__tabs .segmented-control__segment {
    flex: 1;
  }

  :where(.ds) #offers:has(.pricing-offers__tabs:not([hidden])) .pricing-cta__cards > .pricing-card {
    grid-area: 1 / 1;
  }

  :where(.ds) #offers .pricing-card.is-tab-hidden {
    visibility: hidden;
  }

  :where(.ds) #offers .section-heading {
    display: contents;
  }

  :where(.ds) #offers .pricing-cta__links {
    order: 1;
    flex-direction: column;
    align-items: flex-start;
  }

  :where(.ds) #offers .pricing-cta__links .link {
    display: inline;
  }

  :where(.ds) #offers .pricing-cta__links .link .icon {
    display: inline-block;
    margin-left: var(--spacing-xs);
    vertical-align: -3px;
  }

  :where(.ds) :is(#offers, #extensions, #bundle, #hardware) .section-heading__title-group {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }
}

@media (min-width: 1120px) {
  :where(.ds) .pricing-cta--page .pricing-cta__cards > .pricing-card {
    min-height: 660px;
  }

  :where(.ds) #offers .pricing-cta__cards > .pricing-card {
    min-height: 0;
  }
}

:where(.ds) .pricing-hardware {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 1px calc((100% - 2 * var(--spacing-lg)) / 3);
  overflow: hidden;
  border: 1px solid var(--border-quaternary);
  border-radius: var(--radius-lg);
  background-color: var(--background-primary);
  box-shadow: var(--shadow-md);
}

:where(.ds) .pricing-hardware__media {
  position: relative;
}

:where(.ds) .pricing-hardware__media img {
  position: absolute;
  inset: var(--spacing-xl);
  width: calc(100% - 2 * var(--spacing-xl));
  height: calc(100% - 2 * var(--spacing-xl));
  border-radius: var(--radius-lg);
}

:where(.ds) .pricing-hardware__separator {
  margin-block: var(--spacing-xl);
  background-color: var(--border-quaternary);
}

:where(.ds) .pricing-card--flat {
  border: 0;
  border-radius: 0;
  background-color: transparent;
  box-shadow: none;
}

:where(.ds) .pricing-hardware__media img {
  display: block;
  object-fit: cover;
}

:where(.ds) .pricing-education {
  display: grid;
  grid-template-columns: repeat(var(--grid-columns), minmax(0, 1fr));
  gap: var(--grid-gutter);
  align-items: stretch;
}

:where(.ds) .pricing-education__media {
  grid-column: 1 / span 6;
}

:where(.ds) .pricing-education__content {
  grid-column: 8 / span 5;
}

:where(.ds) .pricing-education__content {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xl);
}

:where(.ds) .pricing-education__media {
  position: relative;
  min-height: 360px;
  overflow: hidden;
  border-radius: var(--radius-lg);
}

:where(.ds) .pricing-education__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

:where(.ds) .steps {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
  margin: 0;
  padding: 0;
  list-style: none;
}

:where(.ds) .steps__item {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-md);
}

:where(.ds) .steps__number {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background-color: var(--background-inverse);
  color: var(--content-inverse);
}

:where(.ds) .steps__text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: var(--spacing-xs);
  min-width: 0;
  color: var(--content-secondary);
}

:where(.ds) .steps__text h4 {
  margin: 0;
  color: var(--content-primary);
}

:where(.ds) .steps__text p {
  margin: 0;
}

:where(.ds) .steps__list {
  margin: 0;
  padding: 0;
  list-style: "• " inside;
}

:where(.ds) .steps__action {
  align-self: flex-start;
  margin-top: var(--spacing-xs);
}

:where(.ds) .pricing-card .segmented-control__segment {
  flex: 1;
}

@media (max-width: 1119px) {
  :where(.ds) .pricing-hardware {
    grid-template-columns: minmax(0, 1fr);
  }

  :where(.ds) .pricing-hardware {
    min-height: 0;
  }

  :where(.ds) .pricing-hardware__media {
    aspect-ratio: 3 / 2;
  }

  :where(.ds) .pricing-education {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--spacing-3xl);
  }

  :where(.ds) .pricing-education__media,
  :where(.ds) .pricing-education__content {
    grid-column: auto;
  }

  :where(.ds) .pricing-education__media {
    min-height: 0;
    aspect-ratio: 4 / 3;
  }

  :where(.ds) .pricing-hardware__separator {
    height: 1px;
    margin: 0 var(--spacing-xl);
  }
}

@media (max-width: 767px) {
  :where(.ds) .pricing-hardware__media img {
    inset: var(--spacing-lg);
    width: calc(100% - 2 * var(--spacing-lg));
    height: calc(100% - 2 * var(--spacing-lg));
  }

  :where(.ds) .pricing-hardware__separator {
    margin: 0 var(--spacing-lg);
  }
}

/* Price line until its first price (pricing.js): two shapes in place of the price and of its unit, crossed by
   a light sweep (the line keeps its room, hidden); then price, old price and unit fade in together, no text moving */
:where(.ds.pricing) .pricing-card__amount {
  --price-shape: min(55%, 7rem);
  position: relative;
}
:where(.ds.pricing) .pricing-card__amount > * {
  transition: opacity var(--duration-fast, 150ms) ease-out;
}
:where(.ds.pricing) .pricing-card__amount[data-price-pending] > * {
  opacity: 0;
}
:where(.ds.pricing) .pricing-card__amount[data-price-pending]::before,
:where(.ds.pricing) .pricing-card__amount[data-price-pending]::after {
  content: "";
  position: absolute;
  left: 0;
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, var(--grey-150) 35%, var(--grey-50) 50%, var(--grey-150) 65%) 100% 0 / 300% 100%;
  animation: price-sweep 1.4s linear infinite;
}
/* price */
:where(.ds.pricing) .pricing-card__amount[data-price-pending]::before {
  top: var(--spacing-xs);
  bottom: var(--spacing-xs);
  width: var(--price-shape);
}
/* unit, on the baseline side */
:where(.ds.pricing) .pricing-card__amount[data-price-pending]::after {
  left: calc(var(--price-shape) + var(--spacing-sm));
  bottom: var(--spacing-sm);
  width: min(35%, 5rem);
  height: var(--spacing-md);
  animation-delay: 0.1s;
}
@keyframes price-sweep {
  to { background-position: 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  :where(.ds.pricing) .pricing-card__amount > * {
    transition: none;
  }
  :where(.ds.pricing) .pricing-card__amount[data-price-pending]::before,
  :where(.ds.pricing) .pricing-card__amount[data-price-pending]::after {
    animation: none;
  }
}
