/* ============================================================================
   Plot45 — door.css: the sign-in and sign-up doors + the welcome flow
   (the signup era, 2026-08-10). Shares suite.css tokens and the dark header;
   this file owns only the door column, the provider buttons, the class-login
   form, and the full-page welcome flow on /signup.html. Zero dependencies.
   ========================================================================== */

/* ── the door: one centred column on quiet graph paper ───────────────────── */
.door {
  position: relative; overflow: hidden; z-index: 0;
  min-height: calc(100vh - 57px);
  --paper-line: rgba(20, 24, 28, 0.07);
}
[data-theme="dark"] .door { --paper-line: rgba(255, 219, 0, 0.09); }
.door::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(var(--paper-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--paper-line) 1px, transparent 1px);
  background-size: 26px 26px;
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 62%);
  mask-image: linear-gradient(to bottom, transparent, black 62%);
}
.door__col {
  max-width: 392px; margin: 0 auto;
  padding: clamp(36px, 7vh, 72px) 22px 88px;
  text-align: center;
}
.door__art { width: 74px; height: auto; margin: 0 auto 6px; display: block; }
.door h1 {
  margin: 0;
  font-size: clamp(26px, 4.2vw, 34px); font-weight: 800;
  letter-spacing: -0.02em; line-height: 1.2;
}

/* provider buttons: white cards with the brand glyphs */
.door__providers { display: grid; gap: 12px; margin: 30px 0 0; }
.provider-btn {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  font: inherit; font-size: 15.5px; font-weight: 650; color: var(--text);
  padding: 13px 20px; cursor: pointer;
  background: var(--panel); border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
}
.provider-btn:hover { border-color: var(--text); }
.provider-btn:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.provider-btn svg { width: 19px; height: 19px; flex: none; }
.provider-btn[disabled] { opacity: 0.6; cursor: default; }

/* the swap line between the two doors */
.door__swap { margin: 20px 0 0; font-size: 14.5px; color: var(--muted); }
.door__swap a { color: var(--text); font-weight: 700; text-underline-offset: 3px; }
.door__swap a:hover { text-decoration-color: var(--brand-45); }

/* divider */
.door__rule {
  display: flex; align-items: center; gap: 14px;
  margin: 30px 0 22px; color: var(--faint);
  font-size: 13px; font-weight: 650; letter-spacing: 0.04em;
}
.door__rule::before, .door__rule::after {
  content: ""; flex: 1; height: 1px; background: var(--line-strong);
}

/* class login */
.door__class h2 {
  margin: 0 0 4px; font-size: 17px; font-weight: 750; letter-spacing: -0.01em;
}
.door__class-line { margin: 0 0 16px; font-size: 13.5px; color: var(--muted); }
.door__form { display: grid; gap: 14px; text-align: left; }
.door__field { display: grid; gap: 6px; }
.door__field span { font-size: 13px; font-weight: 700; }
.door__field input {
  /* 16px, not 15px: iOS Safari zooms the whole viewport into any focused
     input below 16px, and inside the fixed welcome overlay that zoom left
     phone visitors stuck. 16px keeps the viewport still. */
  font: inherit; font-size: 16px; padding: 10px 12px;
  color: var(--text); background: var(--panel);
  border: 1.5px solid var(--line-strong); border-radius: var(--radius);
}
.door__field input:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }
.door__submit {
  font: inherit; font-size: 15px; font-weight: 700;
  padding: 11px 20px; cursor: pointer;
  background: var(--ink); color: var(--ink-text);
  border: 1.5px solid var(--ink); border-radius: var(--radius);
}
.door__submit:hover { opacity: 0.92; }
.door__error { margin: 0; font-size: 13.5px; color: #c22525; text-align: left; }
[data-theme="dark"] .door__error { color: #ff7a7a; }

/* fine print */
.door__fine { margin: 26px 0 0; font-size: 13px; line-height: 1.7; color: var(--muted); }
.door__fine a { color: var(--text); }
.door__fine + .door__fine { margin-top: 8px; }

/* ── the welcome flow: one big question at a time ────────────────────────── */
.flow {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg); color: var(--text);
  display: none; flex-direction: column;
}
.flow.is-on { display: flex; }
.flow__top {
  display: flex; align-items: center; gap: 18px;
  padding: 18px clamp(18px, 4vw, 40px);
}
.flow__back {
  width: 36px; height: 36px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: none; border-radius: 50%;
  color: var(--text); cursor: pointer; padding: 0;
}
.flow__back:hover { background: var(--bg-subtle); }
.flow__back[hidden] { visibility: hidden; display: inline-flex; }
.flow__back svg { width: 20px; height: 20px; }
.flow__bar {
  flex: 1; max-width: 520px; margin: 0 auto;
  height: 5px; border-radius: 3px; background: var(--bg-subtle);
  overflow: hidden;
}
.flow__bar i {
  display: block; height: 100%; width: 100%;
  background: var(--brand-45); border-radius: 3px;
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.35s var(--ease);
}
.flow__spacer { width: 36px; flex: none; }

/* The stage centres a short question and SCROLLS a tall one. The old grid
   place-items:center clipped overflowing content off BOTH ends of a fixed,
   full-viewport overlay, so on a phone the subjects step stranded its
   Continue button below the fold with no way to reach it (ledger
   20260820002). Flex plus margin:auto on the child is the classic safe
   centring: identical when the content fits, scrollable when it does not. */
.flow__stage { flex: 1; display: flex; overflow-y: auto; padding: 24px 22px 64px; }
.flow__q { width: 100%; max-width: 620px; text-align: center; margin: auto; }
.flow__q .door__art { width: 86px; margin-bottom: 10px; }
.flow__q h2 {
  margin: 0; font-size: clamp(26px, 4.6vw, 40px); font-weight: 800;
  letter-spacing: -0.02em; line-height: 1.22;
}
.flow__note { margin: 16px 0 0; font-size: 14px; color: var(--muted); line-height: 1.6; }

.flow__cards {
  display: flex; gap: 16px; justify-content: center; flex-wrap: wrap;
  margin: 40px 0 0;
}
.flow__card {
  min-width: 190px; padding: 32px 30px;
  font: inherit; font-size: 18px; font-weight: 750; color: var(--text);
  background: var(--panel); border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-plate); cursor: pointer;
}
.flow__card:hover { border-color: var(--text); }
.flow__card:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.flow__card[disabled] { opacity: 0.6; cursor: default; }

/* multi-select chips (subjects, grades) */
.flow__h3 {
  margin: 44px 0 0; font-size: clamp(19px, 2.6vw, 24px); font-weight: 800;
  letter-spacing: -0.015em; line-height: 1.25;
}
.flow__chips {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
  margin: 24px auto 0; max-width: 560px;
}
.flow__chip {
  font: inherit; font-size: 15px; font-weight: 650; color: var(--text);
  padding: 10px 18px; cursor: pointer;
  background: var(--panel); border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
}
.flow__chip:hover { border-color: var(--text); }
.flow__chip:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.flow__chip[aria-pressed="true"] {
  background: var(--ink); color: var(--ink-text); border-color: var(--ink);
}

.flow__fields {
  display: grid; gap: 18px; text-align: left;
  max-width: 340px; margin: 40px auto 0;
}
.flow__continue {
  margin: 44px auto 0; display: inline-block;
  font: inherit; font-size: 16px; font-weight: 750;
  padding: 14px 52px; cursor: pointer;
  background: var(--ink); color: var(--ink-text);
  border: 1.5px solid var(--ink); border-radius: var(--radius);
}
.flow__continue:hover { opacity: 0.92; }
.flow__continue[disabled] { opacity: 0.6; cursor: default; }
.flow__error { margin: 18px 0 0; font-size: 14px; color: #c22525; }
[data-theme="dark"] .flow__error { color: #ff7a7a; }

/* the account screen: the door's providers and fine print, reparented in */
.flow__q .door__providers { max-width: 340px; margin: 34px auto 0; }
.flow__q .door__swap { margin-top: 22px; }
.flow__q .door__fine { max-width: 420px; margin: 24px auto 0; }

/* ── the phone handoff (mobile discovery, 2026-08-20) ─────────────────────
   Finishing the questions on a phone ends at a handoff screen instead of
   the workspace: the account is ready, and the work itself belongs on a
   bigger screen. One ink primary, two quiet card buttons below it. */
.flow__handoff { display: grid; gap: 12px; max-width: 340px; margin: 34px auto 0; }
.flow__handoff .flow__continue { margin: 0; }
.flow__alt {
  display: block;
  font: inherit; font-size: 15px; font-weight: 650; color: var(--text);
  padding: 12px 20px; cursor: pointer; text-decoration: none;
  background: var(--panel); border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
}
.flow__alt:hover { border-color: var(--text); }
.flow__alt:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

/* ── the loading plate on the sign-up door (2026-08-20) ──────────────────────
   A person returning from Google or Microsoft used to glimpse the first
   question and the workspace before the finished screen. The plate covers
   that: it paints from inline HTML and the flow script drops it the moment a
   real screen renders. A copy of site.css's .p45-boot, because the doors do
   not load that sheet; the mark is the founder's own favicon, per the logo
   law (plot45_ci.md §11). */
.p45-boot {
  position: fixed; inset: 0; z-index: 150;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  opacity: 1; transition: opacity 0.18s ease;
}
.p45-boot__mark { display: block; width: 64px; height: 64px; }
.p45-boot.is-done { opacity: 0; pointer-events: none; }
@media (prefers-reduced-motion: no-preference) {
  .p45-boot__mark { animation: p45-boot-rise 0.4s ease backwards; }
  @keyframes p45-boot-rise {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
  }
}
@media print { .p45-boot { display: none !important; } }

/* one gentle arrival per question */
@media (prefers-reduced-motion: no-preference) {
  .flow__q { animation: flow-rise 0.35s var(--ease) backwards; }
  @keyframes flow-rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
  }
  .flow__q.is-yay h2 { animation: yay-pop 0.55s var(--ease) both; }
  @keyframes yay-pop {
    0% { opacity: 0; transform: scale(0.85); }
    60% { opacity: 1; transform: scale(1.04); }
    100% { opacity: 1; transform: scale(1); }
  }
}

/* the celebration: miniature lab equipment raining past the done screen */
.flow__confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.flow__confetti svg {
  position: absolute; top: -8%; left: var(--x);
  width: var(--s); height: auto; opacity: 0;
  animation: confetti-fall var(--d) linear var(--delay) forwards;
}
@keyframes confetti-fall {
  0% { opacity: 0; transform: translate(0, 0) rotate(var(--r0)); }
  6% { opacity: 1; }
  100% { opacity: 1; transform: translate(var(--dx), 116vh) rotate(var(--r1)); }
}
@media (prefers-reduced-motion: reduce) { .flow__confetti { display: none; } }

@media (max-width: 480px) {
  .flow__cards { flex-direction: column; align-items: stretch; }
  .flow__card { min-width: 0; }
}

/* the door pages keep one-row headers on phones (logo + theme toggle only) */
@media (max-width: 560px) {
  .door__col { padding-top: 30px; }
}

/* The "why am I here?" line, shown only when somebody was sent to a door
   mid-purchase. It is a fact about what happens next, not a sales line, so it
   is quiet: the same grey as the fine print, with the brand rule beside it. */
.door__why {
  margin: 0 0 22px;
  padding: 12px 14px;
  border-left: 3px solid var(--brand-45);
  background: var(--panel-2, rgba(0, 0, 0, .035));
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  text-align: left;
  border-radius: 0 6px 6px 0;
}
[data-theme="dark"] .door__why { background: rgba(255, 255, 255, .06); }

/* The house's "optional" tag, same shape as the teacher UI's: a quiet word
   beside the label. What is not marked optional is simply expected. */
.door__field small {
  margin-left: 8px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── The assistant-connect page (/connect.html): the MCP consent surface ────
   The same door column, with a fact list in place of a form. A consent page
   is a confirmation surface, which is the one legitimate home for saying
   what the action will do. */
.door__client { margin: 10px 0 0; font-size: 15px; color: var(--muted); }
.door__facts {
  margin: 26px 0 0; padding: 0; list-style: none; text-align: left;
  display: grid; gap: 10px;
}
.door__facts li {
  font-size: 13.5px; line-height: 1.55; color: var(--text);
  padding-left: 22px; position: relative;
}
.door__facts li::before {
  content: ""; position: absolute; left: 2px; top: 6px; width: 8px; height: 8px;
  background: var(--brand-45); border: 1px solid var(--art-ink);
}
.door__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 28px 0 0; }
.door__cancel {
  font: inherit; font-size: 15px; font-weight: 700;
  padding: 11px 20px; cursor: pointer; color: var(--text);
  background: var(--panel); border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
}
.door__cancel:hover { border-color: var(--text); }
.door__account { margin: 18px 0 0; font-size: 13px; color: var(--muted); }
.door__account a { color: var(--text); }
