/*
 * Everything here is scoped under .ncd-page: this file is injected globally
 * into PeerTube, so unscoped rules would leak into the rest of the interface.
 *
 * Colours come from PeerTube's own custom properties with literal fallbacks,
 * which is what makes the page follow the instance theme and dark mode.
 */

.ncd-page {
  --ncd-fg: var(--mainForegroundColor, #000);
  --ncd-bg: var(--mainBackgroundColor, #fff);
  --ncd-muted: var(--greyForegroundColor, #585858);
  --ncd-accent: var(--mainColor, #f2690d);
  --ncd-accent-hover: var(--mainHoverColor, var(--ncd-accent));
  --ncd-rule: var(--inputBorderColor, rgba(127, 127, 127, 0.28));

  max-width: 46rem;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
  color: var(--ncd-fg);
}

.ncd-page__title {
  margin: 0 0 1.5rem;
  font-size: 2.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.ncd-page__intro {
  margin: 0 0 2.5rem;
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ncd-muted);
}

.ncd-page__intro > :first-child { margin-top: 0; }
.ncd-page__intro > :last-child { margin-bottom: 0; }

.ncd-rate {
  margin: 0.5rem 0 0;
  color: var(--ncd-fg);
}

/* Tiers ------------------------------------------------------------------ */

.ncd-tiers {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 2px solid var(--ncd-fg);
}

.ncd-tier {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--ncd-rule);
}

.ncd-tier__label {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 0.75rem;
  min-width: 0;
}

.ncd-tier__size {
  font-size: 1.75rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ncd-tier__name,
.ncd-tier__badge {
  font-size: 0.9375rem;
  color: var(--ncd-muted);
}

.ncd-tier__badge {
  color: var(--ncd-accent);
}

.ncd-tier__buy {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  white-space: nowrap;
}

.ncd-tier__price {
  font-size: 1.125rem;
  font-variant-numeric: tabular-nums;
}

.ncd-tier__period {
  color: var(--ncd-muted);
  font-size: 0.9375rem;
}

.ncd-tier form { margin: 0; }

/* Actions ---------------------------------------------------------------- */

.ncd-action {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 44px;
  padding: 0 0.125rem;
  border: 0;
  border-bottom: 1px solid transparent;
  background: none;
  color: var(--ncd-accent);
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
}

.ncd-action:hover,
.ncd-action:focus-visible {
  color: var(--ncd-accent-hover);
  border-bottom-color: currentColor;
}

.ncd-action:focus-visible {
  outline: 2px solid var(--ncd-accent);
  outline-offset: 3px;
}

.ncd-action[disabled] {
  color: var(--ncd-muted);
  cursor: default;
  border-bottom-color: transparent;
}

.ncd-action__arrow {
  /* Decorative: the label already says what the action does. */
  transition: transform 0.15s ease;
}

.ncd-action:hover .ncd-action__arrow {
  transform: translateX(2px);
}

/* Footer ----------------------------------------------------------------- */

.ncd-page__footer {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin-top: 2rem;
  color: var(--ncd-muted);
}

.ncd-page__footer p { margin: 0; }

.ncd-note {
  margin: 2rem 0 0;
  color: var(--ncd-muted);
}

.ncd-muted { color: var(--ncd-muted); }

/* Narrow viewports ------------------------------------------------------- */

@media (max-width: 40rem) {
  .ncd-page {
    padding: 2rem 1rem 3rem;
  }

  .ncd-page__title { font-size: 1.875rem; }

  .ncd-tier {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .ncd-tier__buy {
    width: 100%;
    justify-content: space-between;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ncd-action__arrow {
    transition: none;
  }

  .ncd-action:hover .ncd-action__arrow {
    transform: none;
  }
}
