/* Quorly Pro page (/pro/) — self-contained.
 *
 * Does not load /styles.css: this page must be cheap enough to paint instantly after an OAuth
 * redirect. The palette and type are copied from the editor (styles.css :root, body.light-mode
 * and .tile-btn) so it looks like the same product: black, white and their shades only — no
 * accent hue. mode.js applies the user's stored mode before first paint.
 */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/inter.woff2') format('woff2');
}

:root {
  --bg: #030303;
  --card: #0e0e0e;
  --border: rgba(255, 255, 255, 0.1);
  --text: #f5f6f7;
  --muted: #9aa0a6;
  --fill: rgba(255, 255, 255, 0.03);
  --fill-strong: rgba(255, 255, 255, 0.08);
  --btn-bg: #f5f6f7;
  --btn-fg: #0e0e0e;
  --selected-border: #f5f6f7;
  --selected-fill: rgba(255, 255, 255, 0.06);
}

html.light-mode {
  --bg: #f5f5f5;
  --card: #ffffff;
  --border: rgba(0, 0, 0, 0.08);
  --text: #1a1a1a;
  --muted: #666666;
  --fill: rgba(0, 0, 0, 0.03);
  --fill-strong: rgba(0, 0, 0, 0.08);
  --btn-bg: #1a1a1a;
  --btn-fg: #ffffff;
  --selected-border: #1a1a1a;
  --selected-fill: rgba(0, 0, 0, 0.04);
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.card {
  width: 100%;
  max-width: 460px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 28px;
  text-align: center;
}

.brand {
  margin: 0 0 22px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.brand-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--text);
  color: var(--card);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

/* Type mirrors the editor's controls: Inter, small, medium weight. */
h1 {
  margin: 0 0 8px;
  font-size: 17px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.01em;
}

p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
}

.fine {
  margin: 12px 0 0;
  font-size: 11px;
  color: var(--muted);
}

a {
  color: inherit;
  text-underline-offset: 2px;
}

/* Links styled like the editor's text buttons: no decoration until hover. */
.linklike {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 11px;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.btn {
  display: inline-block;
  width: 100%;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.01em;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: opacity 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

/* The returning-subscriber path is a second entrance, not fine print: a rule with a centred
   OR separates it from the purchase action. */
.or-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.or-divider::before,
.or-divider::after {
  content: '';
  flex: 1 1 auto;
  height: 1px;
  background: var(--border);
}
.returning-line {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.returning-line .linklike {
  margin-left: 2px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}

/* A secondary action at the same scale as Continue: outlined, not filled, so it never
   competes with the main action. Matches the account dialog's Close button. */
.btn-secondary {
  margin-top: 12px;
  border-color: var(--border);
  background: transparent;
  color: var(--text);
}
.btn.btn-secondary:hover {
  background: var(--fill);
  opacity: 1;
}

.btn:hover { opacity: 0.88; }
.btn:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.btn[disabled] { opacity: 0.75; cursor: default; }

/* Inline busy spinner: keeps the label in place while Google is opening. */
.btn-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 7px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  vertical-align: -2px;
  animation: btn-spin 0.7s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .btn-spinner { animation-duration: 1.6s; }
}

/* --- plan picker ------------------------------------------------------- */
.plans {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0 0 18px;
}

.plan {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 18px 14px 16px 30px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--fill);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.plan:hover { border-color: var(--fill-strong); }

.plan[aria-checked="true"] {
  border-color: var(--selected-border);
  background: var(--selected-fill);
}

.plan:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

/* Desktop uses the whole card as the hit target; the mobile rule below narrows it to the radio. */
.plan-radio-hit { display: none; }

.plan-name {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.plan-price {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

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

.plan-note {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
}

.plan-tag {
  position: absolute;
  top: -8px;
  left: 12px;
  padding: 1px 7px;
  border-radius: 4px;
  background: var(--text);
  color: var(--card);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

@media (max-width: 720px) {
  /* A phone should start the card near the top of the screen; the top gap then follows the
     side gutters as the card hits its max width on wider screens. */
  body { align-items: flex-start; padding: max(16px, calc((100vw - 460px) / 2)) 16px 16px; }
  .card { padding: 24px 20px; }

  /* Compact plan rows: a radio on the left, a hairline divider, then the plan details. */
  .plans { grid-template-columns: 1fr; }
  .plan {
    justify-content: center;
    min-height: 84px;
    padding: 14px 16px 14px 86px;
    /* The radio is the control on a phone; the pricing details are no longer a giant
       selection target. Keyboard activation of the button still works. */
    pointer-events: none;
    cursor: default;
  }
  .plan-radio-hit {
    display: block;
    position: absolute;
    left: 8px;
    top: 50%;
    width: 38px;
    height: 38px;
    transform: translateY(-50%);
    border-radius: 50%;
    pointer-events: auto;
    cursor: pointer;
  }
  .plan::before {
    content: '';
    position: absolute;
    left: 18px;
    top: 50%;
    width: 18px;
    height: 18px;
    transform: translateY(-50%);
    border: 1px solid var(--border);
    border-radius: 50%;
    background: transparent;
    transition: border-color 0.15s ease, background 0.15s ease;
  }
  .plan[aria-checked="true"]::before {
    border-color: var(--text);
    background: radial-gradient(circle, var(--text) 0 3px, transparent 3.5px);
  }
  .plan::after {
    content: '';
    position: absolute;
    left: 46px;
    top: 14px;
    bottom: 14px;
    width: 1px;
    background: var(--border);
  }
  .plan-tag { left: 86px; }
}

/* --- states ------------------------------------------------------------ */
.spinner {
  width: 24px;
  height: 24px;
  margin: 0 auto 18px;
  border: 2px solid var(--border);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* One state at a time. The [hidden] guards are load-bearing: `display` on the sections
   below would otherwise override the UA rule and show every state at once. */
#statePlans[hidden],
#stateSignin[hidden],
#stateRedirecting[hidden],
#stateConfirming[hidden],
#stateSuccess[hidden],
#stateFailed[hidden],
#statePending[hidden],
#stateNoPro[hidden],
#stateUnconfirmed[hidden],
#stateUnavailable[hidden],
#stateError[hidden] {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
  body { transition: none; }
}

.consent {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 12px 0 12px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}
.consent input { margin-top: 2px; flex-shrink: 0; }
.consent a { text-decoration: underline; }

.signin-btn { margin-top: 20px; }
.returning-line { margin-top: 16px; }

.returning-line .btn { margin-top: 8px; }
