/*
 * The Plans page (#7, D-123) on the extension's Untitled UI theme (D-109): the brand scale from
 * cobalt #0049FE, Untitled UI's neutral greys, Inter (the extension's own file, packages/tokens/fonts),
 * 6 px radius, hairline borders and soft shadows, in light and dark. The values are the extension's
 * (apps/extension/src/styles/theme.css, theme-values.ts).
 */
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('./fonts/Inter-Variable.woff2') format('woff2');
}

:root {
  color-scheme: light;
  --brand-50: #f2f6fe;
  --brand-100: #e5eeff;
  --brand-200: #cbddff;
  --brand-500: #417cff;
  --brand-600: #0049fe;
  --brand-700: #003ed8;
  --bg-primary: #ffffff;
  --bg-secondary: #fafafa;
  --bg-tertiary: #f5f5f5;
  --bg-brand: var(--brand-50);
  --text-primary: #171717;
  --text-secondary: #404040;
  --text-tertiary: #525252;
  --text-quaternary: #737373;
  --text-brand: var(--brand-700);
  --border-primary: #d4d4d4;
  --border-secondary: #e5e5e5;
  --border-control: #737373;
  --fg-brand: var(--brand-600);
  --fg-quaternary: #a1a1a1;
  --fg-success: #00a63e;
  --fg-warning: #d08700;
  --bg-warning: #fefce8;
  --border-warning: #fff085;
  --button-solid: var(--brand-600);
  --button-solid-hover: var(--brand-700);
  --focus-ring: var(--brand-500);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg:
    0 12px 16px -4px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.03), 0 2px 2px -1px rgba(0, 0, 0, 0.04);
  --radius: 6px;
  --font: Inter, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg-primary: #0a0a0a;
    --bg-secondary: #171717;
    --bg-tertiary: #262626;
    --bg-brand: #011b5e;
    --text-primary: #fafafa;
    --text-secondary: #d4d4d4;
    --text-tertiary: #a1a1a1;
    --text-quaternary: #a1a1a1;
    --text-brand: #a5c3ff;
    --border-primary: #404040;
    --border-secondary: #262626;
    --border-control: #737373;
    --fg-brand: var(--brand-500);
    --fg-quaternary: #525252;
    --fg-success: #00c950;
    --fg-warning: #f0b100;
    --bg-warning: #2b2105;
    --border-warning: #6a4c00;
    /* A darker brand hover in dark mode (D-111). */
    --button-solid-hover: #0030b2;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 16px -4px rgba(0, 0, 0, 0.5);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
ul {
  margin: 0;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.wrap {
  width: 100%;
  max-width: 1152px;
  margin: 0 auto;
  padding: 0 16px;
}

@media (min-width: 768px) {
  .wrap {
    padding: 0 32px;
  }
}

/* The header: the mark and the name. */
.top {
  border-bottom: 1px solid var(--border-secondary);
}

.top__row {
  display: flex;
  align-items: center;
  height: 64px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.logo__mark {
  width: 28px;
  height: 28px;
  color: var(--fg-brand);
}

/* The title, its line, the notes and the Monthly · Yearly switch. */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 48px 0 32px;
  text-align: center;
}

@media (min-width: 768px) {
  .hero {
    padding: 80px 0 48px;
  }
}

h1 {
  font-size: 2.25rem;
  line-height: 2.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

@media (min-width: 768px) {
  h1 {
    font-size: 3rem;
    line-height: 3.75rem;
  }
}

.lead {
  max-width: 40rem;
  color: var(--text-tertiary);
  font-size: 1.125rem;
  line-height: 1.75rem;
  text-wrap: pretty;
}

@media (min-width: 768px) {
  .lead {
    font-size: 1.25rem;
    line-height: 1.875rem;
  }
}

.note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 40rem;
  padding: 12px 16px;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.25rem;
  text-align: left;
  box-shadow: var(--shadow-xs);
}

.note strong {
  display: block;
  color: var(--text-primary);
  font-weight: 600;
}

/* The status colour on the icon, the words in text colours (D-111). */
.card .note {
  max-width: none;
}

.note--warning {
  border-color: var(--border-warning);
  background: var(--bg-warning);
}

.note__icon {
  flex: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--fg-brand);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.note--warning .note__icon {
  stroke: var(--fg-warning);
}

.status {
  min-height: 1.25rem;
  color: var(--text-tertiary);
  font-size: 0.875rem;
}

.status:empty,
.status:has(span:empty) {
  min-height: 0;
}

.period {
  display: inline-flex;
  gap: 4px;
  margin: 8px 0 0;
  padding: 4px;
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius);
  background: var(--bg-secondary);
}

.period__option {
  position: relative;
  display: inline-flex;
}

.period__option input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.period__option span {
  padding: 8px 16px;
  border-radius: calc(var(--radius) - 2px);
  color: var(--text-tertiary);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25rem;
}

.period__option input:checked + span {
  background: var(--bg-primary);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.period__option input:focus-visible + span {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* The cards: Free, Scoop, Double Scoop; then the two Lifetime plans. */
.cards {
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr;
}

@media (min-width: 960px) {
  .cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 720px) {
  .cards--two {
    grid-template-columns: repeat(2, 1fr);
    max-width: 896px;
    margin: 0 auto;
  }
}

.card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius);
  background: var(--bg-primary);
  box-shadow: var(--shadow-sm);
  scroll-margin-top: 24px;
}

@media (min-width: 768px) {
  .card {
    padding: 32px;
  }
}

.card--featured {
  border-color: var(--brand-600);
  box-shadow:
    0 0 0 1px var(--brand-600),
    var(--shadow-lg);
}

/* The plan the extension asked to show first (?tier=, ?period=lifetime). */
.card.is-suggested {
  border-color: var(--brand-600);
  box-shadow:
    0 0 0 4px var(--brand-100),
    var(--shadow-lg);
}

@media (prefers-color-scheme: dark) {
  .card.is-suggested {
    box-shadow:
      0 0 0 4px #011b5e,
      var(--shadow-lg);
  }
}

.card__name {
  color: var(--text-brand);
  font-size: 1.125rem;
  line-height: 1.75rem;
  font-weight: 600;
}

.card__tagline {
  margin-top: -12px;
  color: var(--text-tertiary);
}

/* Side by side, the prices line up whatever each line's length. */
@media (min-width: 960px) {
  .card__tagline {
    min-height: 3rem;
  }
}

.card__price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  min-height: 3.5rem;
  color: var(--text-tertiary);
}

.card__amount {
  font-size: 1rem;
}

.card__amount b {
  color: var(--text-primary);
  font-size: 2.5rem;
  line-height: 3rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.card__note {
  color: var(--text-tertiary);
  font-size: 0.875rem;
  line-height: 2.75rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border: 1px solid var(--brand-200);
  border-radius: 9999px;
  background: var(--bg-brand);
  color: var(--text-brand);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
  white-space: nowrap;
}

@media (prefers-color-scheme: dark) {
  .badge {
    border-color: #0030b2;
  }
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius);
  background: var(--bg-primary);
  color: var(--text-secondary);
  font: inherit;
  font-weight: 600;
  line-height: 1.5rem;
  box-shadow: var(--shadow-xs);
  cursor: pointer;
}

.button:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.button--primary {
  border-color: var(--button-solid);
  background: var(--button-solid);
  color: #ffffff;
}

.button--primary:hover {
  border-color: var(--button-solid-hover);
  background: var(--button-solid-hover);
  color: #ffffff;
}

.button:disabled {
  cursor: default;
  opacity: 0.6;
}

.button[aria-busy='true'] {
  cursor: progress;
}

.card__features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 0 0;
  border-top: 1px solid var(--border-secondary);
  list-style: none;
}

.card__features li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: var(--text-tertiary);
}

.icon {
  flex: none;
  width: 24px;
  height: 24px;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon--yes {
  stroke: var(--fg-brand);
}

.icon--no {
  stroke: var(--fg-quaternary);
}

/* Pay once. */
.section-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 0 0 24px;
  text-align: center;
}

.section-head h2 {
  font-size: 1.875rem;
  line-height: 2.375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.section-head p {
  color: var(--text-tertiary);
  font-size: 1.125rem;
}

.lifetime {
  padding: 64px 0 0;
  scroll-margin-top: 24px;
}

.terms {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 32px 0 0;
  color: var(--text-tertiary);
  font-size: 0.875rem;
  line-height: 1.25rem;
  text-align: center;
}

/* Compare plans. */
.compare {
  padding: 64px 0 80px;
  scroll-margin-top: 24px;
}

.compare__scroll {
  /* The containing block of the screen-reader words in its cells, so they scroll (and clip) with it. */
  position: relative;
  overflow-x: auto;
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}

.compare__table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.compare__table th,
.compare__table td {
  padding: 16px;
  border-bottom: 1px solid var(--border-secondary);
  text-align: center;
  vertical-align: top;
}

.compare__table tr:last-child th,
.compare__table tr:last-child td {
  border-bottom: 0;
}

.compare__table thead th {
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-weight: 600;
}

.compare__table thead th:first-child {
  width: 30%;
}

.compare__table tbody th {
  text-align: left;
  font-weight: 400;
}

.compare__label {
  display: block;
  color: var(--text-primary);
  font-weight: 600;
}

.compare__text {
  display: block;
  color: var(--text-tertiary);
}

.compare__table td {
  color: var(--text-tertiary);
}

.compare__table td .icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  vertical-align: top;
}

/* Back from Stripe, paid. */
.done {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  min-height: 60vh;
  padding: 96px 16px;
  text-align: center;
}

.done__icon {
  width: 56px;
  height: 56px;
  fill: none;
  stroke: var(--fg-success);
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.foot {
  padding: 32px 0 48px;
  border-top: 1px solid var(--border-secondary);
  color: var(--text-tertiary);
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.foot .wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.foot__links {
  display: flex;
  gap: 16px;
}

.foot a {
  color: var(--text-tertiary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.foot a:hover {
  color: var(--text-secondary);
}

/* Windows high contrast: the system's colours, and the controls keep their outlines. */
@media (forced-colors: active) {
  .card,
  .button,
  .period,
  .note,
  .compare__scroll {
    border-color: CanvasText;
  }

  .period__option input:checked + span {
    outline: 2px solid Highlight;
  }

  .icon,
  .note__icon,
  .done__icon {
    stroke: CanvasText;
  }
}
