/* © 2026 William C. Chesher. All Rights Reserved.
   door.css - the suite's one sign-in door, laid out the same on every product (Maestro, 2026-11-20: "all of the login
   pages need to be standardized and identically laid out, but branded with a hero"). Served by the edge at
   /_cromulent/door.css on every product host (conf.d/_mark.caddy), so one file lays every door out; standpoints serves
   a byte copy at the same path (web/static/_cromulent/).

   SPAWN IS THE MODEL (its gate took the suite's longest run of passes): the word large under a central hero, the
   fields stacked under it with mono labels, one full-width button in the lead, the PIN line, and the other ways in
   quiet at the foot. Only the hero differs from product to product (door.js draws it), and the hero is black, white
   and the product's lead, cromulent.tech style, as the research pages are.

   THE CONTRACT. A product's door is this markup (tests/deploy/test_suite_door.py reads every door against it):
     <section class="cd-door" data-product="NAME" style="--cd-lead:#RRGGBB">
       <figure class="cd-hero"><canvas></canvas><button class="cd-pause" type="button">Pause</button></figure>
       <div class="cd-word"><h1 class="cd-title">NAME<i class="cd-pt"></i></h1><p class="cd-line">...</p></div>
       <form class="cd-form"> .cd-say, then .cd-label + .cd-input pairs, an optional .cd-hint, .cd-door .cd-go </form>
       <p class="cd-pin">Need a PIN, or forgot it? ...</p>
       <nav class="cd-others"> the advisor and admin ways in </nav>
       <p class="cd-legal"> the legal line (docs/brand/cromulentech-brand.md) </p>
     </section>
   A product keeps its own ids, names and submit wiring on the form; the door only lays it out. The product's own
   display face reaches the word through --cd-display (set where the product sets --cd-lead), mono through --cd-mono. */

.cd-door {
  --cd-ink: #f4f5f6;
  --cd-muted: #9aa0a8;
  --cd-line-colour: rgba(255, 255, 255, .16);
  --cd-ground: #000;
  --cd-field: #0b0c0e;
  --cd-bad: #ff6b5e;
  position: relative;
  box-sizing: border-box;
  width: 100%;
  min-height: min(100svh, 900px);
  margin: 0;
  padding: clamp(24px, 6vh, 64px) 16px clamp(28px, 6vh, 56px);
  display: grid;
  align-content: center;
  justify-items: center;
  background: var(--cd-ground);
  color: var(--cd-ink);
  font-family: var(--cd-body, system-ui, -apple-system, "Segoe UI", sans-serif);
  text-align: center;
  isolation: isolate;
}
.cd-door *, .cd-door *::before, .cd-door *::after { box-sizing: border-box; }

/* EACH PRODUCT'S LEAD AND TYPE, here and not on the page: a product whose Content-Security-Policy refuses inline style
   (tag's is style-src 'self') still gets its colour. The leads are A+ (docs/brand/cromulentech-brand.md, the lineup
   line); sfhsbta/admin/test_product_leads.py holds this copy to it. The faces are each product's own tokens. */
.cd-door[data-product="spawn"] { --cd-lead: #95FE46; --cd-display: var(--display); --cd-body: var(--body); --cd-mono: var(--mono); }
.cd-door[data-product="bench"] { --cd-lead: #18B194; --cd-display: var(--disp); --cd-body: var(--body); --cd-mono: var(--mono); }
.cd-door[data-product="launch"] { --cd-lead: #FD8719; }
.cd-door[data-product="glitch"] { --cd-lead: #FD52E1; }
.cd-door[data-product="tag"] { --cd-lead: #EDC81E; --cd-display: var(--display); --cd-body: var(--body); --cd-mono: var(--mono); }
.cd-door[data-product="claim"] { --cd-lead: #D51249; --cd-on-lead: #fff; --cd-display: var(--face); --cd-body: var(--face); --cd-mono: var(--mono); }
.cd-door[data-product="train"] { --cd-lead: #0D72DA; --cd-on-lead: #fff; }
.cd-door[data-product="data"] { --cd-lead: #72E3FE; --cd-display: var(--disp); --cd-body: var(--disp); --cd-mono: var(--mono); }
.cd-door[data-product="standpoints"] { --cd-lead: #8434F4; --cd-on-lead: #fff; }

/* a page that is the door wears its black edge to edge (a door inside another page, spawn's gate, brings its own) */
body:has(main.cd-door) { background: #000; }
body:has(main.cd-door)::before { display: none; }
.cd-door[hidden] { display: none; }

/* the hero: one central figure, the product's own kinetic drawing (door.js) */
.cd-door .cd-hero { position: relative; width: min(100%, 440px); height: clamp(132px, 22vh, 196px); margin: 0 0 18px; }
.cd-door .cd-hero canvas { display: block; width: 100%; height: 100%; }
.cd-door .cd-pause {
  position: absolute; right: 0; bottom: 0; padding: 4px 8px; border: 1px solid var(--cd-line-colour); border-radius: 999px;
  background: transparent; color: var(--cd-muted); cursor: pointer;
  font: 500 11px/1 var(--cd-mono, ui-monospace, "SFMono-Regular", Menlo, monospace); letter-spacing: .08em; text-transform: lowercase;
  opacity: .55;
}
.cd-door .cd-pause:hover, .cd-door .cd-pause:focus-visible { opacity: 1; color: var(--cd-ink); }
.cd-door .cd-pause:focus-visible { outline: 2px solid var(--cd-lead, #fff); outline-offset: 2px; }

/* the word: the product's name, large, its full stop in the lead */
.cd-door .cd-word { width: min(100%, 440px); margin: 0 0 28px; }
.cd-door .cd-title {
  margin: 0; color: var(--cd-ink); font: 700 clamp(56px, 15vw, 96px)/.95 var(--cd-display, var(--cd-body, system-ui, -apple-system, "Segoe UI", sans-serif));
  letter-spacing: -.02em; text-transform: lowercase;
}
/* a long name steps down so it holds one line at the door's width */
.cd-door[data-long] .cd-title { font-size: clamp(40px, 11vw, 66px); }
.cd-door .cd-pt { display: inline-block; width: .16em; height: .16em; margin-left: .05em; background: var(--cd-lead, #fff); vertical-align: baseline; }
.cd-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cd-door .cd-line {
  margin: 12px 0 0; color: var(--cd-muted);
  font: 400 12px/1.4 var(--cd-mono, ui-monospace, "SFMono-Regular", Menlo, monospace); letter-spacing: .14em; text-transform: uppercase;
}

/* the form: label over field, the same on every product */
.cd-door .cd-form { width: min(100%, 440px); display: grid; gap: 8px; margin: 0; text-align: left; }
.cd-door .cd-form[hidden] { display: none; }
.cd-door .cd-label {
  display: block; margin: 0; color: var(--cd-muted);
  font: 500 12px/1.4 var(--cd-mono, ui-monospace, "SFMono-Regular", Menlo, monospace); letter-spacing: .1em; text-transform: uppercase;
}
.cd-door .cd-input + .cd-label { margin-top: 10px; }
.cd-door .cd-input {
  display: block; width: 100%; min-height: 52px; padding: 12px 14px; margin: 0;
  border: 1px solid var(--cd-line-colour); border-radius: 8px; background: var(--cd-field); color: var(--cd-ink);
  font: 400 18px/1.2 var(--cd-body, system-ui, -apple-system, "Segoe UI", sans-serif); appearance: none;
}
.cd-door .cd-input::placeholder { color: #5d636b; }
.cd-door .cd-input:focus { outline: none; border-color: var(--cd-lead, #fff); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cd-lead, #fff) 30%, transparent); }
.cd-door .cd-hint { margin: 2px 0 0; color: var(--cd-muted); font-size: 14px; line-height: 1.4; }
.cd-door .cd-go {
  display: block; width: 100%; min-height: 52px; margin: 10px 0 0; padding: 12px 18px;
  border: 0; border-radius: 8px; background: var(--cd-lead, #fff); color: var(--cd-on-lead, #000); cursor: pointer;
  font: 700 18px/1 var(--cd-body, system-ui, -apple-system, "Segoe UI", sans-serif);
}
.cd-door .cd-go:hover { filter: brightness(1.08); }
.cd-door .cd-go:focus-visible { outline: 2px solid var(--cd-ink); outline-offset: 3px; }
.cd-door .cd-go:disabled { opacity: .55; cursor: progress; }

/* what the door says back: a refusal, or a note on the way in; empty, it takes no room */
.cd-door .cd-say { margin: 0 0 6px; padding: 10px 12px; border-left: 3px solid var(--cd-bad); background: rgba(255, 107, 94, .08); color: var(--cd-ink); font-size: 15px; line-height: 1.4; }
.cd-door .cd-say:empty, .cd-door .cd-say[hidden] { display: none; }
.cd-door .cd-say.ok { border-left-color: var(--cd-lead, #fff); background: rgba(255, 255, 255, .05); }
.cd-door .cd-say p { margin: 0; }
.cd-door .cd-say p + p { margin-top: 4px; color: var(--cd-muted); }

/* the PIN line and the other ways in: quiet, centred, last */
.cd-door .cd-pin { width: min(100%, 440px); margin: 18px 0 0; color: var(--cd-muted); font-size: 14px; line-height: 1.5; }
.cd-door .cd-pin[hidden] { display: none; }
.cd-door .cd-pin a, .cd-door .cd-others a, .cd-door .cd-others button { color: var(--cd-ink); text-decoration: underline; text-decoration-color: var(--cd-lead, #fff); text-underline-offset: 3px; }
.cd-door .cd-others { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; width: min(100%, 440px); margin: 14px 0 0; font-size: 14px; }
.cd-door .cd-others a, .cd-door .cd-others button { padding: 6px 2px; background: none; border: 0; font: inherit; cursor: pointer; }
.cd-door .cd-others:empty { display: none; }

/* signed in: who, and the way out, in the form's place */
.cd-door .cd-in { width: min(100%, 440px); display: grid; gap: 10px; margin: 0; }
.cd-door .cd-in[hidden] { display: none; }
.cd-door .cd-in p { margin: 0 0 4px; font-size: 18px; }

@media (prefers-reduced-motion: reduce) { .cd-pause { display: none; } }
@media print { .cd-door { background: #fff; color: #000; min-height: 0; } .cd-hero { display: none; } }

/* a product's own sentence-case rule (bench and spawn lift every heading's first letter) never reaches the door's word,
   which is the product's name and lowercase always */
.cd-door h1.cd-title::first-letter { text-transform: none; }
.cd-door button.cd-pause::first-letter { text-transform: lowercase; }

/* the ways in, as one group a page can hide when someone is signed in; it lays out as if it were not there */
.cd-ways { display: contents; }
.cd-ways[hidden] { display: none; }

/* right ID and PIN, but the product is closed for this student (the admin's access switches): its own state, never
   read as a wrong PIN, so it wears no warning colour */
.cd-door .cd-say.closed { border-left-color: var(--cd-muted); background: rgba(255, 255, 255, .05); }

/* THE LEGAL LINE AT THE DOOR'S FOOT (Maestro, 2026-11-20: "standardize terms of use and privacy links across 9 rooms and
   main site"): the one line every footer carries (docs/brand/cromulentech-brand.md, "Legal line"), small and quiet
   under the other ways in, so no sign-in page is the one page without it. */
.cd-door .cd-legal { width: min(100%, 440px); margin: 28px 0 0; color: var(--cd-muted); font-size: 12px; line-height: 1.5; }
.cd-door .cd-legal a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
