/* =============================================================
   Frog-AI Tutor — the paid parts

   Everything the subscription added: the meter, the school-year
   picker, the paywall, the pricing page and the admin library.

   Same rules as tutor.css. Every colour, radius, border and
   shadow comes from site.css's tokens — 2px ink outlines, flat
   colour, offset sticker shadows, Darumadrop One headings.
   Nothing new is invented here.

   Kept as a separate file from tutor.css so that the two can be
   reviewed apart: tutor.css is the chat, this is the commerce.
   ============================================================= */

/* =============================================================
   Shared small parts
   ============================================================= */
.field {
  display: block;
  margin: 0 0 16px;
}
.field > span,
.field > legend {
  display: block;
  font-weight: 800;
  font-size: .88rem;
  color: var(--ink);
  margin: 0 0 6px;
}
.field input[type="text"],
.field input[type="url"],
.field select,
.field textarea {
  width: 100%;
  font: 600 .95rem var(--font-body);
  color: var(--ink);
  background: var(--paper);
  border: var(--stroke) solid var(--ink);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.field textarea { resize: vertical; min-height: 96px; }
.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}
.field--bands { border: 0; padding: 0; margin: 0 0 16px; }
.field__help { font-size: .82rem; color: var(--ink-soft); margin: 6px 0 0; }

.checkline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: .88rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}
.checkline input { width: 18px; height: 18px; accent-color: var(--blue); }

.link-button--danger { color: var(--coral-deep); }

/* =============================================================
   The meter

   Sits above the account button and stays hidden until there is
   something worth saying. A child who can watch a number fall
   starts rationing questions, which is exactly the behaviour we
   do not want to buy with a subscription.
   ============================================================= */
.meter {
  flex: none;
  padding: 12px;
  margin: 0 0 10px;
  background: var(--sky);
  border: var(--stroke) solid var(--ink);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-hard-sm);
}
.meter[hidden] { display: none !important; }

.meter__bar {
  height: 9px;
  border-radius: 999px;
  background: var(--hair);
  overflow: hidden;
  margin: 0 0 8px;
}
.meter__bar span {
  display: block;
  height: 100%;
  background: var(--green);
  border-radius: 999px;
  transition: width .4s var(--ease);
}
.meter--low .meter__bar span { background: var(--coral); }

.meter__text {
  font-weight: 800;
  font-size: .82rem;
  color: var(--ink);
  margin: 0 0 9px;
}
.meter .btn { width: 100%; }

/* =============================================================
   Dialogs: the school-year picker and the paywall
   ============================================================= */
.picker-backdrop,
.paywall-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(18, 35, 46, .45);
  backdrop-filter: blur(2px);
  z-index: 60;
  animation: froge-fade .2s var(--ease);
}

.picker,
.paywall {
  position: fixed;
  z-index: 61;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 28px;
  background: var(--cream);
  border: var(--stroke) solid var(--ink);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card-hi);
  animation: froge-pop .28s var(--bounce);
}

@keyframes froge-fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes froge-pop {
  from { opacity: 0; transform: translate(-50%, -46%) scale(.96) }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1) }
}

.picker h2,
.paywall h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.9rem;
  line-height: 1.15;
  color: var(--ink);
  margin: 0 0 18px;
  text-align: center;
}

.picker__close,
.paywall__close { position: absolute; top: 14px; right: 14px; }

.picker__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 12px;
}


/* ---------- School year ----------
   One account is one person, so the only thing this dialog asks
   is how old they are. */
.picker__lede {
  margin: -8px 0 20px;
  text-align: center;
  font-weight: 600;
  font-size: .95rem;
  color: var(--ink-soft);
}

.year-tile {
  display: grid;
  gap: 3px;
  place-items: center;
  padding: 18px 10px;
  background: var(--paper);
  border: var(--stroke) solid var(--ink);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-hard-sm);
  cursor: pointer;
  font-family: var(--font-body);
  transition: transform .18s var(--bounce), box-shadow .18s var(--ease), background .2s var(--ease);
}
.year-tile:hover { transform: translate(-2px, -3px); box-shadow: var(--shadow-hard); }
.year-tile:active { transform: translate(2px, 3px); box-shadow: none; }
.year-tile.is-active { background: var(--pond); box-shadow: 3px 4px 0 var(--green); }

/* A coloured pebble per band, youngest to oldest, so the choice
   reads at a glance before the words do. */
.year-tile::before {
  content: '';
  width: 18px; height: 18px;
  margin-bottom: 6px;
  border-radius: 50%;
  border: var(--stroke) solid var(--ink);
  background: var(--coral);
  transition: transform .3s var(--bounce);
}
.year-tile:nth-child(2)::before { background: var(--sun); }
.year-tile:nth-child(3)::before { background: var(--green); }
.year-tile:nth-child(4)::before { background: var(--blue); }
.year-tile:nth-child(5)::before { background: var(--ink); }
.year-tile:hover::before { transform: scale(1.25); }

.year-tile__label { font-weight: 900; font-size: .95rem; color: var(--ink); }
.year-tile__hint  { font-weight: 700; font-size: .74rem; color: var(--ink-soft); }

/* =============================================================
   The paywall

   A child may well be the one reading it, so nothing in it may
   suggest they have done something wrong — and it still has to be
   clear enough for the grown-up who pays to act on.
   ============================================================= */
.paywall { width: min(620px, calc(100vw - 32px)); text-align: center; }

.paywall__stage {
  position: relative;
  width: 132px;
  height: 132px;
  margin: 0 auto 10px;
}
.paywall__stage .pond-disc { position: absolute; inset: 8%; }

/* The stage is square because the pond behind the frog is a
   circle. The mascot is not square — it is 300x373 — so sizing it
   to the full width makes it a quarter taller than the box it sits
   in, and it lands on the heading underneath.

   A width small enough that the height still fits, then: 373/300
   means anything over about 80% overflows. 76% matches the
   proportion the welcome screen uses and leaves a little air. */
.paywall__stage img {
  position: relative;
  z-index: 2;
  width: 76%;
  height: auto;
  margin: 0 auto;
  display: block;
}

.paywall__lede {
  color: var(--ink-soft);
  font-weight: 600;
  font-size: .96rem;
  margin: 0 auto 20px;
  max-width: 44ch;
}

.paywall__plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  text-align: left;
}
.paywall__loading { color: var(--ink-soft); font-weight: 700; }

.plan-option {
  display: grid;
  gap: 2px;
  padding: 16px 18px;
  background: var(--paper);
  border: var(--stroke) solid var(--ink);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-hard-sm);
  cursor: pointer;
  font-family: var(--font-body);
  text-align: left;
  transition: transform .18s var(--bounce), box-shadow .18s var(--ease);
}
.plan-option:hover:not(:disabled) { transform: translate(-2px, -3px); box-shadow: var(--shadow-hard); }
.plan-option:disabled { opacity: .6; cursor: default; }
.plan-option--hero { background: var(--sun); }
.plan-option.is-busy { opacity: .6; cursor: progress; }

.plan-option__name {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.3rem;
  color: var(--ink);
}
.plan-option__price { font-weight: 900; font-size: 1.05rem; color: var(--ink); }
.plan-option__limit { font-weight: 700; font-size: .82rem; color: var(--ink-soft); }
.plan-option__tag {
  justify-self: start;
  margin-top: 6px;
  padding: 3px 10px;
  background: var(--green);
  border: var(--stroke) solid var(--ink);
  border-radius: 999px;
  font-weight: 800;
  font-size: .72rem;
  color: var(--on-accent);
}

.paywall__more {
  display: inline-block;
  margin-top: 16px;
  font-weight: 800;
  font-size: .86rem;
  color: var(--blue);
}
.paywall__foot {
  margin: 18px 0 0;
  font-size: .78rem;
  color: var(--ink-soft);
  font-weight: 600;
}
.paywall__error {
  margin: 12px 0 0;
  padding: 10px 12px;
  background: var(--coral);
  border: var(--stroke) solid var(--ink);
  border-radius: var(--radius-sm);
  color: var(--on-accent);
  font-weight: 700;
  font-size: .84rem;
}

/* =============================================================
   The pricing page
   ============================================================= */
.pricing-main { flex: 1; padding: 24px 0 72px; }

.pricing-flag {
  max-width: 640px;
  margin: 0 auto 26px;
  padding: 14px 18px;
  background: var(--sun);
  border: var(--stroke) solid var(--ink);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-hard-sm);
  font-weight: 700;
  font-size: .92rem;
  color: var(--ink);
  text-align: center;
}
.pricing-flag[hidden] { display: none !important; }

.pricing-head { text-align: center; margin: 0 0 34px; }
.pricing-head h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.1rem, 5vw, 3rem);
  color: var(--ink);
  margin: 0 0 12px;
}
.pricing-lede {
  max-width: 52ch;
  margin: 0 auto;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 1.02rem;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 20px;
  max-width: 820px;
  margin: 0 auto;
  align-items: start;
}
.plan-grid__loading { color: var(--ink-soft); font-weight: 700; text-align: center; }

.plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 28px 26px;
  background: var(--paper);
  border: var(--stroke) solid var(--ink);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.plan-card--hero { background: var(--pond); box-shadow: var(--shadow-card-hi); }
.plan-card--current { background: var(--sky); }

.plan-card__ribbon {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 16px;
  background: var(--sun);
  border: var(--stroke) solid var(--ink);
  border-radius: 999px;
  font-weight: 800;
  font-size: .76rem;
  color: var(--ink);
  white-space: nowrap;
}

.plan-card__name {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.7rem;
  color: var(--ink);
  margin: 0 0 4px;
}
.plan-card__price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 0 0 12px;
}
.plan-card__price strong {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 2.6rem;
  color: var(--green-deep);
  line-height: 1;
}
.plan-card__price span { font-weight: 700; font-size: .85rem; color: var(--ink-soft); }

.plan-card__blurb {
  color: var(--ink-soft);
  font-weight: 600;
  font-size: .92rem;
  margin: 0 0 18px;
}

.plan-card__features {
  list-style: none;
  padding: 0;
  margin: 0 0 22px;
  display: grid;
  gap: 9px;
  flex: 1;
}
.plan-card__features li {
  position: relative;
  padding-left: 26px;
  font-weight: 700;
  font-size: .9rem;
  color: var(--ink);
}
.plan-card__features li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 2px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--green);
  border: var(--stroke) solid var(--ink);
}
.plan-card__features li::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 7px;
  width: 6px;
  height: 3px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg);
}

.plan-card__cta { width: 100%; }
.plan-card__foot {
  margin: 10px 0 0;
  text-align: center;
  font-size: .78rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.plan-card__error {
  margin: 10px 0 0;
  font-size: .82rem;
  font-weight: 700;
  color: var(--coral-deep);
}

.pricing-note {
  max-width: 52ch;
  margin: 26px auto 0;
  text-align: center;
  font-size: .84rem;
  font-weight: 600;
  color: var(--ink-soft);
}

/* ---------- Reassurance ---------- */
.pricing-facts { margin: 64px auto 0; max-width: 900px; }
.pricing-facts h2,
.pricing-faq h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.9rem;
  color: var(--ink);
  text-align: center;
  margin: 0 0 24px;
}

/* Two by two rather than auto-fit: there are exactly four of
   these, and three-across leaves one sitting on its own. */
.fact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));   /* never wider than a phone */
  gap: 16px;
}
.fact {
  padding: 22px 24px;
  background: var(--paper);
  border: var(--stroke) solid var(--ink);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}
.fact h3 {
  font-weight: 900;
  font-size: 1rem;
  color: var(--ink);
  margin: 0 0 8px;
}
.fact p { color: var(--ink-soft); font-weight: 600; font-size: .9rem; margin: 0; }

.pricing-faq { margin: 56px auto 0; max-width: 700px; }
.pricing-faq details {
  background: var(--paper);
  border: var(--stroke) solid var(--ink);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-hard-sm);
  margin: 0 0 12px;
  overflow: hidden;
}
.pricing-faq summary {
  padding: 16px 20px;
  font-weight: 900;
  font-size: .96rem;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
}
.pricing-faq summary::-webkit-details-marker { display: none; }
.pricing-faq summary::after {
  content: '+';
  float: right;
  font-family: var(--font-display);
  color: var(--blue);
}
.pricing-faq details[open] summary::after { content: '−'; }
.pricing-faq details p {
  margin: 0;
  padding: 0 20px 18px;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: .92rem;
}

/* =============================================================
   Admin — the material library
   ============================================================= */
.admin-main { flex: 1; padding: 24px 0 72px; }

.admin-gate { max-width: 560px; margin: 60px auto; text-align: center; font-weight: 700; }
.admin-hint {
  margin-top: 16px;
  padding: 16px;
  text-align: left;
  background: var(--ink);
  color: var(--cream);
  border-radius: var(--radius-sm);
  font: 600 .8rem ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  overflow-x: auto;
}

.admin-card {
  max-width: 860px;
  margin: 0 auto 26px;
  padding: 26px 28px;
  background: var(--paper);
  border: var(--stroke) solid var(--ink);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.admin-card h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.5rem;
  color: var(--ink);
  margin: 0 0 18px;
}

.admin-form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.admin-form__actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.band-picker { display: flex; flex-wrap: wrap; gap: 14px; }

.dropzone {
  display: grid;
  gap: 4px;
  place-items: center;
  padding: 30px 20px;
  margin: 0 0 16px;
  background: var(--sky);
  border: var(--stroke) dashed var(--ink);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: center;
}
.dropzone.is-over { background: var(--pond); border-style: solid; }
.dropzone strong { font-weight: 900; font-size: 1rem; color: var(--ink); }
.dropzone span { font-weight: 600; font-size: .84rem; color: var(--ink-soft); }
.dropzone:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

.admin-log {
  margin-top: 18px;
  padding: 14px 16px;
  max-height: 240px;
  overflow-y: auto;
  background: var(--cream);
  border: var(--stroke) solid var(--ink);
  border-radius: var(--radius-sm);
}
.admin-log[hidden] { display: none !important; }
.admin-log__line {
  margin: 0 0 6px;
  font: 600 .84rem var(--font-body);
  color: var(--ink-soft);
}
.admin-log__line.is-ok { color: var(--green-deep); font-weight: 800; }
.admin-log__line.is-error { color: var(--coral-deep); font-weight: 800; }

.admin-empty { color: var(--ink-soft); font-weight: 600; }

.doc-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.doc-table th {
  text-align: left;
  font-weight: 900;
  color: var(--ink-soft);
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 0 10px 8px 0;
}
.doc-table td {
  padding: 10px 10px 10px 0;
  border-top: 1px solid var(--hair);
  font-weight: 700;
  color: var(--ink);
  vertical-align: middle;
}
.doc-table__title { font-weight: 900; }
.doc-table__num { font-variant-numeric: tabular-nums; }

.switch { display: inline-flex; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch span {
  width: 42px; height: 24px;
  background: var(--hair-3);
  border: var(--stroke) solid var(--ink);
  border-radius: 999px;
  position: relative;
  transition: background .2s var(--ease);
}
.switch span::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: var(--paper);
  border: var(--stroke) solid var(--ink);
  border-radius: 50%;
  transition: transform .2s var(--bounce);
}
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: 2px; }

/* =============================================================
   Small screens
   ============================================================= */
@media (max-width: 640px) {
  .picker, .paywall { padding: 22px 18px; border-radius: var(--radius-md); }
  .picker h2, .paywall h2 { font-size: 1.55rem; }
  .admin-form__row { grid-template-columns: 1fr; }
  .admin-card { padding: 20px 18px; }
  .doc-table { font-size: .8rem; }
}

/* site.css makes the sticky header see-through on .auth-body for
   the pond. The pricing and admin pages scroll under it, so the
   logo floated over the plan cards; give it back its glass. */
.auth-body .site-header {
  background: color-mix(in srgb, var(--cream) 90%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* One plan now: centre it instead of leaving half a two-up grid */
.plan-grid:has(> .plan-card:only-child) {
  grid-template-columns: minmax(0, 460px);
  justify-content: center;
}

/* The plans page on a phone: tighter gaps between sections, roomier
   tap targets on the questions, and edges that match the header. */
@media (max-width: 560px) {
  .auth-body .site-header .header-row { padding-left: 16px; padding-right: 16px; }
  .pricing-facts { margin-top: 40px; }
  .pricing-faq { margin-top: 40px; }
  .pricing-facts h2, .pricing-faq h2 { font-size: 1.5rem; margin-bottom: 16px; }
  .plan-card { padding: 24px 20px 20px; }
  .fact-grid { gap: 12px; }
  .fact-grid > * { padding: 18px; }
  .pricing-faq summary { font-size: 1rem; padding: 16px 18px; }
  .pricing-faq details p { font-size: .95rem; }
}
