/* The quiet, functional pages: care plan sign-up (/subscribe), the care plan portal (/account)
   and the password reset (/reset-password). Built on site.css's .form, .field, .alert, .plan
   and .btn; this file only adds the page frame, the white panel and the small parts. */

/* ---------- Page frame (subscribe, account) ---------- */

.desk { padding: clamp(118px, 19vh, 180px) var(--gutter) clamp(80px, 13vh, 140px); }
.desk__head {
  display: grid; justify-items: center; gap: 16px;
  max-width: 900px; margin: 0 auto clamp(36px, 6vh, 60px);
  text-align: center;
}
.desk__head .display { font-size: clamp(46px, 6.8vw, 116px); }
.desk__head .lede { max-width: 44ch; color: var(--muted); }

/* The white panel every form sits in: ink edge, a hard red shadow (like the log-in panel). */
.panel {
  position: relative;
  padding: clamp(24px, 3vw, 38px);
  background: #fff; color: var(--ink);
  border: 1.5px solid var(--ink);
  box-shadow: 10px 12px 0 var(--red);
}
.panel--narrow { width: min(520px, 100%); margin-inline: auto; }

/* Full-width square button for forms, and a calm disabled state while a request runs. */
.btn--block { display: flex; width: 100%; height: 52px; }
.btn--block .btn__icon { width: 52px; }
.btn--block .btn__label { flex: 1; justify-content: center; font-size: 13px; }
.btn[disabled] { cursor: progress; opacity: 0.6; }
.btn[disabled]:hover .btn__label { background: var(--btn-bg); color: var(--btn-fg); }
.btn[disabled]:hover .btn__icon svg { animation: none; }

.alert { font-size: 15px; line-height: 1.45; }
.alert--error { color: #a4161f; }

.form__note { text-align: center; text-wrap: balance; }
.form__note svg {
  display: inline-block; width: 14px; height: 14px; margin-right: 7px; vertical-align: -2px;
  fill: none; stroke: currentColor; stroke-width: 1.8;
}

/* A plain text button (Sign out, Cancel plan). */
.text-btn {
  padding: 4px 0; border: 0; background: none; color: var(--ink);
  font: 700 12px/1 var(--sans); text-transform: uppercase; letter-spacing: -0.01em;
  text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px;
  cursor: pointer; transition: color 0.25s;
}
.text-btn:hover { color: var(--red); }
.text-btn[disabled] { opacity: 0.55; cursor: progress; }

/* "Back to …": a serif link with a red box arrow pointing back. */
.back {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  width: fit-content; margin: clamp(30px, 5vh, 44px) auto 0;
  font-family: var(--serif); font-size: 20px; line-height: 1;
  color: var(--ink);
}
.back { position: relative; }
.back::after { content: ''; position: absolute; inset: -10px -8px; } /* easier to tap */
.back__box {
  display: grid; place-items: center; flex: none;
  width: 20px; height: 20px;
  background: var(--red); overflow: hidden;
}
.back__box svg { width: 12px; fill: none; stroke: #fff; stroke-width: 2; }
.back:hover .back__box svg { animation: arrow-back 0.55s var(--ease-io); }
.back__text { position: relative; }
.back:hover .back__text { text-decoration: underline; text-decoration-color: var(--red); text-underline-offset: 4px; }
@keyframes arrow-back {
  0% { transform: none; }
  48% { transform: translateX(-170%); }
  49% { transform: translateX(170%); }
  100% { transform: none; }
}

/* Without its "worth building?" block the footer doesn't need the tall red lead-in.
   (Belongs in site.css for every data-footer-cta="off" page; kept here until it moves.) */
html[data-footer-cta='off'] .footer { padding-top: clamp(48px, 8vh, 90px); }

/* ---------- Subscribe: the chosen plan beside the form ---------- */

.checkout {
  display: grid; grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: clamp(30px, 4.5vw, 64px); align-items: start;
  width: min(1040px, 100%); margin: 0 auto;
}
.checkout__plan { gap: 16px; padding: 38px 28px 30px; min-height: 100%; }
.checkout__plan .plan__name { font-size: clamp(28px, 2.6vw, 36px); }
.checkout__plan .plan__for { font-size: 22px; }
.checkout__plan .plan__price small { opacity: 0.9; }
/* site.css sets the featured plan's white dashes before the red default, so the red one wins
   there; spelled out here until that order is fixed. */
.checkout__plan.plan--featured li::before { background: #fff; }
.checkout__plan ul { margin-top: 6px; padding-top: 18px; border-top: 1px solid rgba(255, 255, 255, 0.35); }
.checkout__plan.is-loading .plan__name { opacity: 0.7; }
.checkout__plan.is-missing { min-height: 0; background: #fff; color: var(--ink); border-color: var(--ink); }
.checkout__plan.is-missing ul { display: none; }
.checkout__pick { font-size: 16px; line-height: 1.6; }
.checkout__pick a { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

/* "(optional)" after a label */
.field__opt { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); }

/* ---------- How to pay: Card or ABA Pay / KHQR (subscribe, order) ---------- */

.pay-pick { display: grid; gap: 10px; min-width: 0; margin: 0; padding: 0; border: 0; }
.pay-pick legend { margin-bottom: 8px; padding: 0; font: 700 12px/1 var(--sans); text-transform: uppercase; letter-spacing: 0.02em; }
.pay-pick__opt { position: relative; display: block; cursor: pointer; }
.pay-pick__opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.pay-pick__box {
  display: grid; grid-template-columns: 20px minmax(0, 1fr); align-items: center; gap: 3px 12px;
  padding: 14px 16px;
  border: 1.5px solid var(--line-strong); background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.pay-pick__box::before {
  content: ''; grid-row: span 2;
  width: 18px; height: 18px; border: 1.5px solid var(--ink); border-radius: 50%;
  box-shadow: inset 0 0 0 4px #fff;
}
.pay-pick__box b { font: 700 15px/1.2 var(--sans); }
.pay-pick__box small { grid-column: 2; font-size: 13px; line-height: 1.4; color: var(--muted); }
.pay-pick__opt:hover .pay-pick__box { border-color: var(--ink); }
.pay-pick__opt input:checked + .pay-pick__box { border-color: var(--ink); box-shadow: 4px 4px 0 var(--red); }
.pay-pick__opt input:checked + .pay-pick__box::before { background: var(--red); }
.pay-pick__opt input:focus-visible + .pay-pick__box { outline: 2px solid var(--red); outline-offset: 2px; }

/* ---------- Account: loading, signed-in head and the plan cards ---------- */

.loading {
  display: grid; justify-items: center; gap: 18px;
  padding: clamp(60px, 14vh, 140px) 0;
  font-family: var(--serif); font-size: 26px; color: var(--muted);
}
.loading__dot {
  width: 14px; height: 14px; background: var(--red);
  animation: loading-pulse 0.9s ease-in-out infinite alternate;
}
@keyframes loading-pulse { from { transform: scale(0.6) rotate(0deg); opacity: 0.5; } to { transform: scale(1) rotate(45deg); opacity: 1; } }

.who {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 6px 14px;
  font-size: 15px; color: var(--muted);
}
.who b { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }

.subs { display: grid; gap: 22px; width: min(720px, 100%); margin: 0 auto; }
.sub {
  position: relative;
  display: grid; gap: 16px;
  padding: 26px 26px 24px 30px;
  background: #fff; color: var(--ink);
  border: 1.5px solid var(--ink);
  box-shadow: 8px 10px 0 var(--red);
}
.sub::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--red); }
.sub.is-inactive { box-shadow: 8px 10px 0 var(--well); }
.sub.is-inactive::before { background: var(--well); }
.sub.is-cancelled { border-color: var(--line-strong); box-shadow: none; }
.sub.is-cancelled::before { background: var(--line-strong); }
.sub__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.sub__name { font: 700 clamp(24px, 2.4vw, 32px)/1 var(--sans); letter-spacing: -0.03em; text-transform: uppercase; }
.sub__price { display: flex; align-items: baseline; gap: 6px; margin-top: 10px; }
.sub__price b { font: 400 30px/1 var(--bubble); color: var(--red); letter-spacing: -0.01em; }
.sub__price small { font: 700 12px/1.2 var(--sans); text-transform: uppercase; color: var(--muted); }
.sub.is-cancelled .sub__name, .sub.is-cancelled .sub__price b { color: var(--muted); }
.sub__meta { color: rgba(22, 21, 19, 0.75); line-height: 1.45; }
.sub__dates { display: flex; flex-wrap: wrap; gap: 12px 36px; padding-top: 16px; border-top: 1px solid var(--line); }
.sub__dates div { display: grid; gap: 6px; }
.sub__dates dt { font: 700 12px/1 var(--sans); text-transform: uppercase; letter-spacing: 0.02em; color: var(--muted); }
.sub__dates dd { font-family: var(--serif); font-size: 22px; line-height: 1; }
.sub__cancel { justify-self: start; }

.status {
  flex: none; display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 10px 6px;
  font: 700 12px/1 var(--sans); text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap;
  border: 1.5px solid currentColor;
}
.status::before { content: ''; width: 7px; height: 7px; background: currentColor; }
.status--active { background: var(--ink); border-color: var(--ink); color: #fff; }
.status--active::before { background: #45c27a; border-radius: 50%; }
.status--pending { background: #fff; border-color: var(--ink); color: var(--ink); }
.status--pending::before { background: var(--red); }
.status--cancelled, .status--other { color: var(--muted); }

.subs__empty {
  display: grid; justify-items: center; gap: 20px;
  padding: clamp(30px, 5vw, 44px);
  text-align: center;
  border: 1.5px dashed var(--line-strong);
}
.subs__empty p { max-width: 42ch; color: rgba(22, 21, 19, 0.78); }
.subs + .alert { width: min(720px, 100%); margin: 26px auto 0; }

/* ---------- Reset password: a plain page with only the logo and the card ---------- */

.plain {
  min-height: 100vh; min-height: 100dvh;
  display: grid; align-content: center;
  padding: max(28px, env(safe-area-inset-top)) var(--gutter) max(36px, env(safe-area-inset-bottom));
  background:
    linear-gradient(var(--well), var(--well)) top / 100% 38vh no-repeat,
    var(--bg);
}
.plain > main { display: grid; justify-items: center; }
.plain__logo {
  font-family: var(--script); font-size: clamp(58px, 9vw, 84px); line-height: 0.9;
  color: var(--red);
  padding: 0 10px 10px 0;
  transform: rotate(-5deg);
  margin-bottom: clamp(18px, 4vh, 34px);
}
.plain__card { width: min(460px, 100%); }
.plain__brand {
  display: flex; align-items: center; gap: 9px;
  padding-bottom: 16px; margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
  font: 700 12px/1 var(--sans); text-transform: uppercase; letter-spacing: 0.04em;
}
.plain__brand i { width: 8px; height: 8px; background: var(--red); }
.plain__title {
  font: 700 clamp(30px, 6.4vw, 40px)/0.94 var(--sans);
  letter-spacing: -0.04em; text-transform: uppercase;
}
.plain__title em {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: 1.1em; letter-spacing: -0.015em; text-transform: none; color: var(--red);
}
.plain__sub { margin: 12px 0 24px; color: rgba(22, 21, 19, 0.72); line-height: 1.45; }
.plain .back { margin-top: 30px; }

/* ---------- Phone ---------- */

@media (max-width: 860px) {
  .checkout { grid-template-columns: 1fr; width: min(560px, 100%); }
  .checkout__plan { min-height: 0; }
  .checkout__plan.is-loading { min-height: 420px; } /* the plan's room, so the form doesn't jump down */
}
@media (max-width: 560px) {
  .desk { padding-top: 104px; }
  .panel { box-shadow: 6px 8px 0 var(--red); }
  .sub { padding: 22px 18px 20px 24px; box-shadow: 6px 8px 0 var(--red); }
  .sub.is-cancelled { box-shadow: none; }
  .sub__top { flex-direction: column-reverse; align-items: flex-start; gap: 12px; }
  .back { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) {
  .loading__dot { animation: none; }
}

/* Order: the package card keeps its own height beside the longer form, and stays in view. */
@media (min-width: 861px) {
  #o-plan { min-height: 0; position: sticky; top: clamp(96px, 13vh, 130px); }
}
