/* ==========================================================================
   premium.css — /premium/ and /premium/key/, after site.css and help.css

   The guide's parts do most of it: the hero and the eyebrow, the panel head
   and its icon, the state chip and the dotted points (help.css); the card,
   the two buttons, the callout and the footnote (site.css). This file holds
   what only these two pages have: the two plan cards side by side, the
   price (and a coupon's, beside the full one struck through), the coupon
   and key fields and the device list, and the key itself, large.

   Every colour is a site token, as in help.css (no hex literal here).
   ========================================================================== */

body[data-page="premium"],
body[data-page="premium-key"] {
  overflow-x: clip;
  overflow-wrap: break-word;
}

/* The download page's measure: two plan cards fit side by side, and each
   card still reads as one thing. */
body[data-page="premium"] .sheet,
body[data-page="premium-key"] .sheet {
  max-width: calc(820px + 2 * var(--gutter));
  padding-top: clamp(20px, 5vh, 48px);
  padding-bottom: calc(env(safe-area-inset-bottom) + 56px);
}

body[data-page="premium"] .rail-inner,
body[data-page="premium-key"] .rail-inner {
  max-width: calc(820px + 2 * var(--gutter));
}

.premium-hero .eyebrow {
  justify-content: center;
}

.premium-hero h1 {
  max-width: 15ch;
}

/* ---- The device that turns Premium on by itself ------------------------- */

.premium-for {
  margin-top: 28px;
  border-color: rgb(53 211 153 / 0.28);
  background: rgb(53 211 153 / 0.06);
}

.premium-for .callout-icon {
  color: var(--ok);
}

.premium-for strong {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---- The plans --------------------------------------------------------- */

.premium-plans {
  margin-top: clamp(32px, 6vw, 52px);
}

.plan-grid {
  display: grid;
  gap: 16px;
}

@media (min-width: 680px) {
  .plan-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.plan {
  display: flex;
  flex-direction: column;
  padding: clamp(24px, 4vw, 32px);
}

/* The yearly card carries the accent ring: the one to look at first. */
.plan-best {
  border-color: var(--accent-line);
  box-shadow: var(--shadow), 0 0 0 3px rgb(79 123 255 / 0.1);
}

.plan-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}

.plan h3 {
  margin: 0;
  color: var(--ink);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.plan-head .state {
  margin: 0;
}

.plan .state .icon {
  width: 15px;
  height: 15px;
  stroke-width: 2;
}

.plan-price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  margin: 14px 0 0;
}

.plan-amount {
  color: var(--ink);
  font-size: clamp(2rem, 6vw, 2.6rem);
  font-weight: 750;
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.plan-per {
  color: var(--muted);
  font-size: 15px;
  font-weight: 550;
}

/* With a coupon applied: the full price, struck through, ahead of the one
   the coupon gives (admin spec §3.4). */
.plan-was {
  color: var(--muted);
  font-size: clamp(1.1rem, 3.4vw, 1.35rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-decoration: line-through;
  text-decoration-color: var(--muted);
}

/* What the coupon does for this plan: its percent off, or that it does not
   cover the plan (then in the page's quieter voice). */
.plan-coupon {
  margin: 8px 0 0;
  color: var(--ok);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
}

.plan-coupon[data-covered="false"] {
  color: var(--muted);
  font-weight: 500;
}

/* The points take the slack, so both buttons sit on one line along the
   bottom of the row. */
.plan-points {
  flex: 1;
  margin-top: 16px;
}

.plan-button {
  margin-top: 24px;
}

.plan-button:disabled,
.premium-coupon-open:disabled,
.premium-coupon-remove:disabled,
.premium-submit:disabled,
.premium-billing-button:disabled,
.premium-remove:disabled {
  cursor: default;
  opacity: 0.55;
}

.premium-status {
  min-height: 1.5em;
  color: var(--ink-2);
  line-height: 1.5;
}

.premium-status:empty {
  min-height: 0;
}

/* Nothing went wrong, nothing happened: "Payment not finished." after
   Checkout was closed, said in the page's quieter voice. */
.premium-status[data-tone="quiet"] {
  color: var(--muted);
}

.premium-small {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.premium-small strong {
  color: var(--ink-2);
  font-weight: 650;
}

.premium-small a,
.premium-card .points a {
  color: var(--accent-2);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgb(124 92 255 / 0.45);
  text-underline-offset: 3px;
}

/* ---- A coupon ----------------------------------------------------------- */

.premium-coupon {
  margin-top: 18px;
}

/* "Have a coupon code?": a quiet link that opens the field, a button
   because it opens something here rather than going anywhere. */
.premium-coupon-open {
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--accent-2);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgb(124 92 255 / 0.45);
  text-underline-offset: 3px;
  cursor: pointer;
}

.premium-coupon-open:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.premium-coupon-form {
  margin-top: 10px;
}

/* Applied: the code and what it gives, in the green the Computer ID line
   above the plans has, with Remove beside it. */
.premium-coupon-applied {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  padding: 12px 14px;
  border: 1px solid rgb(53 211 153 / 0.28);
  border-radius: var(--radius-inset);
  background: rgb(53 211 153 / 0.06);
}

.premium-coupon-line {
  flex: 1 1 240px;
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
}

.premium-coupon-remove {
  width: auto;
  min-height: 40px;
  padding: 8px 16px;
  font-size: 14px;
}

.premium-coupon .premium-status:not(:empty) {
  margin-top: 10px;
}

/* ---- The cards under the plans ----------------------------------------- */

.premium-card {
  margin-top: clamp(28px, 5vw, 44px);
  padding: clamp(24px, 4vw, 34px);
}

.premium-card h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.3rem, 3vw, 1.6rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.premium-card .points strong {
  color: var(--ink);
  font-weight: 650;
}

.premium-sample {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  white-space: nowrap;
}

/* ---- Already have a key? ------------------------------------------------ */

.premium-form {
  margin-top: 22px;
}

.premium-label {
  display: block;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.premium-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* The account panel's field (account.css .acc-input), in the site's
   tokens: a key is typed or pasted once and read back against a receipt,
   so it is set in the monospaced stack. 16px so a phone does not zoom. */
.premium-input {
  flex: 1 1 240px;
  min-width: 0;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--line-loud);
  border-radius: var(--radius-control);
  background: rgb(255 255 255 / 0.04);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 16px;
  letter-spacing: 0.02em;
  transition: border-color var(--fast) var(--ease), background-color var(--fast) var(--ease);
}

.premium-input::placeholder {
  color: var(--faint);
}

.premium-input:focus {
  outline: none;
  border-color: var(--accent-line);
  background: rgb(255 255 255 / 0.07);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.premium-input[aria-invalid="true"] {
  border-color: rgb(255 107 129 / 0.6);
}

.premium-submit {
  width: auto;
  flex: 0 0 auto;
  min-width: 112px;
  min-height: 48px;
}

.premium-license {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
}

.premium-line {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  font-weight: 650;
  line-height: 1.45;
}

.premium-line[data-state="ended"] {
  color: var(--warn);
}

/* A Premium key nobody has activated yet: nothing wrong, nothing on. */
.premium-line[data-state="waiting"] {
  color: var(--ink-2);
}

.premium-seats {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.premium-devices {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.premium-device {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-inset);
  background: var(--surface-2);
}

.premium-device-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.premium-device-name {
  color: var(--ink);
  font-size: 15px;
  font-weight: 650;
}

.premium-device-meta {
  color: var(--muted);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

.premium-device-empty {
  color: var(--muted);
  font-size: 14.5px;
}

.premium-remove {
  width: auto;
  min-height: 40px;
  padding: 8px 16px;
  font-size: 14px;
}

/* Cancel subscription and Change card side by side, and the confirm step's
   two answers the same way. */
.premium-billing {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.premium-billing-button {
  width: auto;
  min-width: 180px;
}

.premium-confirm {
  margin-top: 18px;
  padding: 16px 18px 18px;
  border: 1px solid var(--line-loud);
  border-radius: var(--radius-inset);
  background: var(--surface-2);
}

.premium-confirm-question {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 650;
}

.premium-confirm-what {
  margin-top: 6px;
}

.premium-confirm .premium-billing {
  margin-top: 14px;
}

/* The one answer that cannot be taken back. */
.premium-cancel-yes {
  border-color: rgb(255 107 129 / 0.45);
  color: var(--danger);
}

@media (hover: hover) {
  .premium-cancel-yes:hover:not(:disabled) {
    border-color: rgb(255 107 129 / 0.7);
    color: var(--danger);
  }
}

/* The line the focus lands on after a cancel: it only says, so no ring. */
.premium-line:focus {
  outline: none;
}

/* ---- The key ------------------------------------------------------------ */

.key-card .code-label {
  margin: 0 0 6px;
}

/* The display register site.css gives a code (.code), in the monospaced
   stack, and breakable only at its dashes' groups on a narrow phone. */
.premium-key {
  margin: 0;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(0.95rem, 4.3vw, 1.9rem);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.03em;
  overflow-wrap: anywhere;
  -webkit-user-select: all;
  user-select: all;
}

.key-copy {
  width: auto;
  min-width: 200px;
  margin-top: 20px;
}

.key-copy .icon {
  width: 20px;
  height: 20px;
  stroke-width: 1.9;
}

.key-ready .premium-line {
  margin-top: 22px;
}

.key-ready .premium-for {
  margin-top: 16px;
}

/* The one-click "Use Premium in this browser", under what the key did. */
.key-browser {
  margin-top: 16px;
}

.key-browser-use {
  width: auto;
  min-width: 200px;
}

.key-browser-status:empty {
  display: none;
}

.key-browser-status {
  margin-top: 10px;
}

@media (max-width: 479px) {
  .premium-submit,
  .premium-billing-button,
  .key-copy,
  .key-browser-use {
    width: 100%;
  }
}

body[data-page="premium"] .footnote,
body[data-page="premium-key"] .footnote {
  justify-content: center;
  margin-top: 40px;
  text-align: center;
}

body[data-page="premium"] .legal-links,
body[data-page="premium-key"] .legal-links {
  justify-content: center;
}

@media (forced-colors: active) {
  .plan-best,
  .premium-input,
  .premium-device,
  .premium-coupon-applied,
  .premium-confirm {
    border-color: CanvasText;
  }
}
