/* /account and /pricing (src/account/views.tsx, public/account-page.js). Loaded on these two pages only.
   Solid content cards like the AI limit card and the About page's text (docs/DESIGN.md: no glass on content), the
   page's own tokens for light and dark, logical properties for right-to-left, 44 px touch targets everywhere. */

.acct-page,
.pricing-page {
  --acct-danger: #b3261e;
  --acct-danger-text: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) :is(.acct-page, .pricing-page) {
    --acct-danger: #ff8a80;
    --acct-danger-text: #0f0f0f;
  }
}
:root[data-theme="dark"] :is(.acct-page, .pricing-page) {
  --acct-danger: #ff8a80;
  --acct-danger-text: #0f0f0f;
}

.acct-page {
  max-width: 680px;
}
.acct-stack {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}
.acct-stack[hidden],
.acct-card[hidden],
.acct-form[hidden] {
  display: none;
}

/* ---------------------------------------------------------------- cards */
.acct-card,
.plan-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 12px;
  min-width: 0;
  padding: 18px 20px 20px;
  border-radius: var(--radius-l, 16px);
  corner-shape: squircle;
  background: var(--bg, #fff);
  box-shadow: inset 0 0 0 1px var(--separator, rgb(0 0 0 / 0.1));
  color: var(--text, #0f0f0f);
}
.acct-card__h {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
}
.acct-text {
  margin: 0;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.5;
}
.acct-muted {
  margin: 0;
  color: var(--text-3);
  font-size: 14px;
  line-height: 1.45;
}
.acct-muted:empty {
  display: none;
}
/* while /api/me answers: the sign-in card's height, so the page does not jump when it appears */
.acct-skel {
  min-height: 252px;
  align-content: center;
  justify-items: center;
}

/* ---------------------------------------------------------------- sign-in */
.acct-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  justify-items: start;
}
.acct-field {
  display: grid;
  gap: 6px;
  inline-size: 100%;
}
.acct-field__label {
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}
.acct-input {
  inline-size: 100%;
  max-inline-size: 420px;
  min-height: 44px;
  font-size: 16px; /* ≥ 16 px: iOS Safari does not zoom on focus */
  color: var(--text);
}
.acct-input--code {
  max-inline-size: 220px;
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3em;
  text-align: start;
}
.acct-input--code::placeholder {
  letter-spacing: 0.3em;
  color: var(--text-3);
  opacity: 0.6;
}
.acct-sent {
  margin: 0;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.acct-main {
  min-height: 44px;
  padding: 0 18px;
  font-size: 15px;
}
.acct-main[disabled] {
  opacity: 0.55;
  cursor: default;
}
.acct-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 20px;
  margin: 0;
}
.acct-link {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}
.acct-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.acct-link:focus-visible,
.acct-main:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.acct-status {
  margin: 0;
  min-height: 20px; /* the line is kept, so a message never pushes the card */
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.45;
}
.acct-status[data-kind="error"] {
  color: var(--acct-danger);
}
/* in the signed-in cards a message is rare: the line takes no room until there is one */
[data-acct-panel] .acct-status:empty {
  display: none;
}
.acct-ts:empty {
  display: none;
}

/* ---------------------------------------------------------------- signed in */
.acct-email {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  overflow-wrap: anywhere;
  unicode-bidi: plaintext;
}
.acct-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 0;
}
.acct-plan {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  margin: 0;
}
.acct-plan__name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.acct-features {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-inline-start: 20px;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.45;
}
.acct-meter {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border-radius: calc(12px * var(--sq, 1));
  corner-shape: squircle;
  background: var(--bg-2);
}
.acct-meter__text {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.acct-meter__bar {
  display: block;
  block-size: 6px;
  border-radius: 3px;
  background: var(--fill-2);
  overflow: hidden;
}
.acct-meter__fill {
  display: block;
  block-size: 100%;
  inline-size: 0;
  border-radius: 3px;
  background: var(--accent);
}
.acct-danger {
  color: var(--acct-danger);
}
.acct-danger--solid,
.acct-danger--solid:hover {
  background: var(--acct-danger);
  color: var(--acct-danger-text);
}
.acct-confirm {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: calc(12px * var(--sq, 1));
  corner-shape: squircle;
  background: var(--bg-2);
}
.acct-confirm[hidden],
.acct-actions[hidden] {
  display: none;
}

/* ---------------------------------------------------------------- /pricing */
.pricing-page {
  max-width: 1040px;
}
.acct-note {
  max-width: 680px;
  margin: 0 0 20px;
  padding: 12px 16px;
  border-radius: calc(12px * var(--sq, 1));
  corner-shape: squircle;
  background: var(--bg-2);
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.5;
}
.plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}
/* the call to action sits at the bottom of every card, so the buttons line up across the row */
.plan-card {
  display: flex;
  flex-direction: column;
}
.plan-card__features {
  flex: 1;
}
.plan-card__name {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}
.plan-card__price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  margin: 0;
}
.plan-card__amount {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
/* "No cost", "Price to be announced": words, not a figure */
.plan-card__amount--text {
  font-size: 22px;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.plan-card__per {
  color: var(--text-3);
  font-size: 14px;
}
.plan-card .plan-card__features {
  display: grid;
  align-content: start;
  gap: 8px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.4;
}
.plan-card__features > li {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}
.plan-card__features .icon {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  color: var(--text);
}
.plan-card__cta {
  display: grid;
  gap: 8px;
  justify-items: start;
  margin-top: 4px;
}
.plan-card__cta .btn[hidden],
.plan-card__current[hidden] {
  display: none;
}
.plan-card__current {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}
.plan-card__current .icon {
  width: 18px;
  height: 18px;
}
.pricing-page > .acct-status {
  margin-top: 16px;
}
/* a plan billed two ways (Plus): its price and "Billed …" lines carry data-for=<period>; the chosen period's show.
   Where :has() is missing both show, which still reads right ("$9.90 per month", "$99 per year"). */
@supports selector(:has(*)) {
  .plan-card:has([data-plan-period][value="month"]:checked) [data-for="year"],
  .plan-card:has([data-plan-period][value="year"]:checked) [data-for="month"] {
    display: none;
  }
}
/* monthly or yearly: a pair of radios drawn as the site's segmented control (app.css .segmented); the radio covers its
   option, invisible but focusable and announced */
.plan-period {
  display: flex;
  gap: 2px;
  min-inline-size: 0;
  margin: 0;
  padding: 2px;
  border: 0;
  border-radius: 10px;
  background: var(--fill);
}
.plan-period__opt {
  position: relative;
  display: inline-flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--dur-press), transform var(--dur-press) var(--ease-out);
}
.plan-period__input {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.plan-period__opt:has(.plan-period__input:checked) {
  background: var(--seg-on);
  box-shadow: var(--seg-shadow);
  color: var(--text);
  font-weight: 600;
}
.plan-period__opt:has(.plan-period__input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
@supports not selector(:has(*)) {
  .plan-period__input {
    position: static;
    inline-size: auto;
    block-size: auto;
    opacity: 1;
  }
}
.plan-period__save {
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
}
.plan-period__opt:has(.plan-period__input:checked) .plan-period__save {
  color: var(--text-2);
}
@media (pointer: coarse) {
  .plan-period__opt {
    min-height: 44px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .plan-period__opt {
    transition: none;
  }
}
/* under the cards: currency and tax, who takes the money, the terms and the refund policy */
.pricing-notes {
  display: grid;
  gap: 6px;
  max-width: 680px;
  margin-top: 20px;
  color: var(--text-3);
  font-size: 14px;
  line-height: 1.5;
}
.pricing-notes p {
  margin: 0;
}
.pricing-notes a {
  color: var(--link);
}

/* ---------------------------------------------------------------- /pay (Paddle's checkout opens over it) */
.pay-page {
  max-width: 680px;
}

@media (max-width: 767.98px) {
  .acct-card,
  .plan-card {
    padding: 16px;
  }
  .acct-main {
    flex: 1 1 auto;
  }
  .acct-form .acct-main {
    inline-size: 100%;
    max-inline-size: 420px;
  }
}
