/* PHASIC sign-in, direction C (the owner's choice, 20 November 2026). The icon's three stages run the flow: lilac is
   what is done, cream what you are doing, the blue-green outline what happens next, and it fills while the sign-in
   checks. The name stands large in its own face over the room's ink. Shapes carry the tenses as well as colours:
   a filled dot, a dot with a ring, an outline. */
:root {
  --lilac: #786a92;
  --past-text: #b8acd3;
  --cream: #f5f0e8;
  --muted: rgb(245 240 232 / .8);
  --quiet: rgb(245 240 232 / .78);
  --next: #a4ecd9;
  --warn: #ff9c8a;
  --line: rgb(245 240 232 / .42);
  --ground: var(--kit-ground, #20192b);
  --serif: "PHASIC Masthead", Georgia, serif;
  --mono: "PHASIC Ink Mono", ui-monospace, Menlo, monospace;
  color-scheme: dark;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--ground);
  color: var(--cream);
  font-family: var(--serif);
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
/* A room's ground before the ink's sheet lands. The client inserts that sheet (never on the birthday host, whose gate
   refuses it), so it does not hold the first paint. These are its values (shared/phasic-ink.css; signin.test.mjs keeps
   the two equal) at zero specificity, so its own rules win as soon as it arrives. */
:where(:root[data-phasic-ink]) { --kit-ground: #1a2023; }
:where(:root[data-phasic-ink="look"], :root[data-phasic-ink="darkroom"]) { --kit-ground: #0a0a0a; }
:where(:root[data-phasic-ink="capture"]) { --kit-ground: #111d29; }
:where(:root[data-phasic-ink="write"], :root[data-phasic-ink="graphite"]) { --kit-ground: #2c2c2c; }
:where(:root[data-phasic-ink="listen"]) { --kit-ground: #27171f; }
:where(:root[data-phasic-ink="plan"], :root[data-phasic-ink="waybill"]) { --kit-ground: #101d1b; }
:where(:root[data-phasic-ink="search"]) { --kit-ground: #20192b; }
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
::selection { background: rgb(164 236 217 / .35); color: var(--cream); }
:focus-visible { outline: 2px solid var(--next); outline-offset: 3px; border-radius: 6px; }

/* Held still under a finger: only main scrolls, and only when a small screen and the keyboard leave no room. */
body {
  margin: 0;
  height: var(--vvh, 100%);
  overflow: hidden;
  overscroll-behavior: none;
  display: flex;
  flex-direction: column;
  background: var(--ground);
}
canvas[data-phasic-ink-canvas] { touch-action: none; }

.auth-masthead { flex: none; position: relative; z-index: 2; background: var(--ground); }
.way-back {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--cream);
  box-shadow: inset 0 0 0 1.5px rgb(245 240 232 / .45);
}
.way-back svg { width: 32px; height: 32px; fill: currentColor; }
.way-back:hover { box-shadow: inset 0 0 0 1.5px var(--cream); }

main.auth {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  padding: clamp(12px, 3.5vh, 40px) max(20px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}
.name {
  flex: none;
  margin: 0;
  padding-top: clamp(6px, 3vh, 32px);
  font-family: "PHASIC Mark", "PHASIC Masthead", Georgia, serif;
  font-weight: 590;
  font-size: clamp(46px, 19.5vw, 92px);
  line-height: .8;
  letter-spacing: 0;
  white-space: nowrap;
  text-align: center;
  color: var(--cream);
  font-optical-sizing: none;
  font-variation-settings: "opsz" 144, "SOFT" 40, "WONK" 1;
  user-select: none;
}

/* The three stages, down the phone. */
.tl {
  position: relative;
  flex: none;
  display: grid;
  gap: 26px;
  width: min(100%, 460px);
  margin: auto auto 0;
  padding-top: clamp(22px, 5vh, 52px);
}
.tl::before {
  content: "";
  position: absolute;
  left: 7.25px;
  top: calc(clamp(22px, 5vh, 52px) + 10px);
  bottom: 34px;
  width: 1.5px;
  background: linear-gradient(var(--lilac), rgb(245 240 232 / .7) 45%, var(--next));
}
#view-check::before { display: none; }
.t { position: relative; min-width: 0; padding-left: 36px; overflow-wrap: anywhere; }
.t > .dot { position: absolute; left: 0; top: 2px; width: 16px; height: 16px; border-radius: 50%; }
.t.past > .dot { background: var(--lilac); left: 2px; top: 5px; width: 12px; height: 12px; }
.t.now > .dot { background: var(--cream); box-shadow: 0 0 0 5px rgb(245 240 232 / .16); }
.t.next > .dot { background: transparent; border: 2px solid var(--next); }
.t.next.done > .dot { background: var(--next); }

.past-text { margin: 0; font-size: 19px; line-height: 1.3; color: var(--past-text); }
.past-text small { margin-left: 6px; font: 500 14px/1.3 var(--mono); color: var(--quiet); white-space: nowrap; }

.lab { display: block; margin: 0 0 4px; font-size: 16px; line-height: 1.25; color: var(--muted); }
.fld + .lab { margin-top: 18px; }
.fld {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  border-bottom: 2px solid var(--line);
  transition: border-color .2s;
}
.fld:focus-within { border-bottom-color: var(--cream); }
.fld[data-bad] { border-bottom: 3px dashed var(--warn); }
.at { flex: none; font-size: 30px; line-height: 1; color: var(--cream); transform: translateY(-2px); font-variation-settings: "opsz" 36, "SOFT" 50, "WONK" 1; }
.fld input {
  flex: 1;
  min-width: 0;
  height: 54px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  color: var(--cream);
  caret-color: var(--next);
  font: 500 24px/1.2 var(--mono);
  -webkit-appearance: none;
  appearance: none;
}
.fld input:-webkit-autofill,
.fld input:-webkit-autofill:hover,
.fld input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--cream);
  -webkit-box-shadow: 0 0 0 60px color-mix(in srgb, var(--next) 9%, var(--ground)) inset;
  caret-color: var(--next);
  transition: background-color 9999s;
}
.show {
  flex: none;
  min-width: 64px;
  min-height: 44px;
  margin: 0;
  padding: 0 10px;
  border: 0;
  border-radius: 22px;
  background: transparent;
  color: var(--muted);
  font: 500 16px/1 var(--serif);
  cursor: pointer;
}
.show[data-shown] { color: var(--next); }
.keychain { position: absolute; width: 1px; height: 1px; margin: 0; padding: 0; border: 0; opacity: 0; pointer-events: none; }

.msg { display: flex; gap: 10px; align-items: flex-start; min-height: 1.4em; margin: 12px 0 0; font-size: 16px; line-height: 1.4; color: var(--cream); }
.msg::before { content: ""; flex: none; width: 8px; height: 8px; margin-top: .45em; border-radius: 50%; }
.msg:empty::before, .msg:not([data-tone])::before { display: none; }
/* An error is a diamond, a wait a ring, a done a dot: shapes as well as colours. */
.msg[data-tone="bad"]::before { background: var(--warn); border-radius: 1px; transform: rotate(45deg) scale(.9); }
.msg[data-tone="wait"]::before { box-shadow: inset 0 0 0 1.5px var(--next); }
.msg[data-tone="ok"]::before { background: var(--next); }
.hint { margin: 10px 0 0; font-size: 15px; line-height: 1.4; color: var(--muted); }

.pill {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  margin: 0;
  padding: 0 20px 0 22px;
  border: 0;
  border-radius: 29px;
  background: transparent;
  color: var(--next);
  box-shadow: inset 0 0 0 1.5px var(--next);
  font: 600 18px/1.2 var(--serif);
  text-align: left;
  cursor: pointer;
}
.pill .fill { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: inherit; padding: inherit;
  background: var(--next); color: var(--ground); pointer-events: none; clip-path: inset(0 100% 0 0); }
.pill .fill .fill-text { min-width: 0; }
.pill .fill::after { content: ""; flex: none; width: 16px; height: 16px; background: currentColor;
  clip-path: polygon(12.5% 43.75%, 56.25% 43.75%, 56.25% 25%, 68.75% 25%, 68.75% 31.25%, 75% 31.25%, 75% 37.5%, 81.25% 37.5%, 81.25% 43.75%, 87.5% 43.75%, 87.5% 56.25%,
    81.25% 56.25%, 81.25% 62.5%, 75% 62.5%, 75% 68.75%, 68.75% 68.75%, 68.75% 75%, 56.25% 75%, 56.25% 56.25%, 12.5% 56.25%); }
.pill > .pill-text, .pill > .arrow { position: relative; z-index: 1; }
.pill > .pill-text { min-width: 0; }
.arrow { flex: none; width: 16px; height: 16px; fill: currentColor; }
.pill:hover { background: rgb(164 236 217 / .08); }
.tl[data-busy] .pill { cursor: progress; }
.tl[data-busy] .pill .fill { animation: checking 15s cubic-bezier(.12, .7, .25, 1) forwards; }
@keyframes checking { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 4% 0 0); } }
.tl[data-done] .pill { background: var(--next); color: var(--ground); }
.tl:not([data-busy]) .pill:disabled { opacity: .45; cursor: not-allowed; }

.act {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  margin: 0;
  border: 0;
  border-radius: 29px;
  background: var(--cream);
  color: var(--ground);
  font: 600 19px/1 var(--serif);
  cursor: pointer;
}
.alt { display: flex; flex-wrap: wrap; gap: 0 18px; margin: 10px 0 0; font: 400 16px/1.35 var(--serif); color: var(--muted); }
.alt.quiet { margin-top: 4px; color: var(--quiet); }
.link {
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--cream);
  font: inherit;
  text-decoration: underline;
  text-decoration-color: rgb(245 240 232 / .4);
  text-underline-offset: 4px;
  cursor: pointer;
}
.link:hover { text-decoration-color: currentColor; }
.say { margin: 0; font-size: 30px; font-weight: 500; line-height: 1.15; font-variation-settings: "opsz" 36, "SOFT" 40; }
.say.quiet { font: 400 16px/1.4 var(--serif); color: var(--quiet); min-height: 1.4em; }
.say-next { margin: 0; font-size: 22px; line-height: 1.2; color: var(--next); }
#retry-navigation { margin-top: 16px; }
.noscript { margin: 24px; font-size: 18px; }

/* The keyboard is up: the name steps back so the fields and the next step sit above the keys. */
html.kb .name { font-size: 38px; padding-top: 2px; }
html.kb .tl { padding-top: 12px; gap: 16px; }
html.kb .tl::before { top: 22px; }
html.kb .alt.quiet { display: none; }

/* Time runs across the desktop: past, present and next side by side on one line. */
@media (min-width: 900px) and (min-height: 560px) {
  main.auth { padding: clamp(24px, 6vh, 72px) clamp(48px, 8vw, 120px) 56px; }
  .name { font-size: clamp(120px, 13.6vw, 200px); text-align: left; padding-top: 0; }
  .tl {
    width: 100%;
    max-width: 1200px;
    margin: auto 0 0;
    grid-template-columns: minmax(160px, 1fr) minmax(320px, 1.35fr) minmax(250px, 1fr);
    column-gap: clamp(32px, 4vw, 72px);
    padding-top: 56px;
  }
  .tl::before { left: 0; right: 0; top: 63px; bottom: auto; width: auto; height: 1.5px; background: linear-gradient(90deg, var(--lilac), rgb(245 240 232 / .7) 45%, var(--next)); }
  .t { padding-left: 0; padding-top: 36px; }
  .t > .dot { top: 0; }
  .t.past > .dot { top: 2px; }
  .tl > .t.past { grid-column: 1; }
  .tl > .t.now { grid-column: 2; }
  .tl > .t.next { grid-column: 3; }
  .tl:not(:has(> .t.past:not([hidden]))) { grid-template-columns: minmax(320px, 520px) minmax(250px, 420px); justify-content: space-between; }
  .tl:not(:has(> .t.past:not([hidden]))) > .t.now { grid-column: 1; }
  .tl:not(:has(> .t.past:not([hidden]))) > .t.next { grid-column: 2; }
  .say { font-size: 36px; }
}
/* On its side a phone takes the desktop's line, smaller. */
@media (orientation: landscape) and (max-height: 520px) and (min-width: 700px) {
  main.auth { padding: 20px max(24px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left)); }
  .name { font-size: 44px; text-align: left; padding-top: 0; }
  .tl {
    width: 100%;
    margin: auto 0 0;
    grid-template-columns: minmax(120px, .8fr) minmax(250px, 1.4fr) minmax(200px, 1fr);
    column-gap: 28px;
    gap: 0 28px;
    padding-top: 12px;
  }
  .tl::before { left: 0; right: 0; top: 19px; bottom: auto; width: auto; height: 1.5px; background: linear-gradient(90deg, var(--lilac), rgb(245 240 232 / .7) 45%, var(--next)); }
  .t { padding-left: 0; padding-top: 26px; }
  .t > .dot { top: 0; }
  .tl > .t.past { grid-column: 1; }
  .tl > .t.now { grid-column: 2; }
  .tl > .t.next { grid-column: 3; }
  .tl:not(:has(> .t.past:not([hidden]))) { grid-template-columns: minmax(250px, 1.4fr) minmax(200px, 1fr); }
  .tl:not(:has(> .t.past:not([hidden]))) > .t.now { grid-column: 1; }
  .tl:not(:has(> .t.past:not([hidden]))) > .t.next { grid-column: 2; }
  .fld { min-height: 46px; }
  .fld input { height: 44px; font-size: 20px; }
  .fld + .lab { margin-top: 8px; }
  .lab { font-size: 15px; }
  .pill, .act { min-height: 50px; }
  .msg { margin-top: 6px; }
  .hint { margin-top: 4px; font-size: 14px; }
  html.kb .name { display: none; }
}
@media (max-height: 640px) and (orientation: portrait) {
  .name { font-size: clamp(40px, 16vw, 62px); padding-top: 4px; }
  .tl { padding-top: 14px; gap: 18px; }
  .hint { margin-top: 6px; font-size: 14px; }
}
/* F4: a small phone on its side: a small name and compact stages; from 480 px wide the present and the next step sit
   side by side, and a near-square screen keeps one column so its fields keep their width. */
@media (orientation: landscape) and (max-height: 520px) and (max-width: 699px) {
  main.auth { padding: 6px max(16px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  .name { font-size: 32px; text-align: left; padding-top: 0; }
  .tl { width: 100%; margin: auto 0 0; gap: 8px; padding-top: 6px; }
  .tl::before { top: 16px; bottom: 26px; }
  .fld { min-height: 46px; }
  .fld input { height: 44px; font-size: 19px; }
  .fld + .lab { margin-top: 4px; }
  .lab { margin-bottom: 2px; font-size: 14px; }
  .past-text { font-size: 17px; }
  .pill, .act { min-height: 48px; }
  .msg { margin-top: 2px; font-size: 14px; }
  .hint { margin-top: 2px; font-size: 13px; }
  .alt { margin-top: 4px; font-size: 14px; }
  html.kb .name { display: none; }
}
@media (orientation: landscape) and (max-height: 520px) and (min-width: 480px) and (max-width: 699px) {
  .tl { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 6px 20px; }
  .tl::before { display: none; }
  .tl > .t.past { grid-column: 1 / -1; }
  .tl > .t.now { grid-column: 1; }
  .tl > .t.next { grid-column: 2; align-self: start; }
}
@media (max-width: 360px) {
  main.auth { padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right)); }
  .fld input { font-size: 21px; }
  .pill { font-size: 17px; padding-inline: 18px 16px; }
  .say { font-size: 26px; }
}
/* A two-pane fold keeps the whole flow in the first pane. */
@media (horizontal-viewport-segments: 2) {
  body > .auth-masthead.phasic-suite-header, main.auth { width: env(viewport-segment-width 0 0, 100%); margin-inline-start: env(viewport-segment-left 0 0, 0px); }
  main.auth { padding: 20px 20px 24px; }
  .name { font-size: clamp(46px, 10vw, 92px); text-align: center; }
  .tl, .tl:not(:has(> .t.past:not([hidden]))) { display: grid; grid-template-columns: minmax(0, 1fr); width: min(100%, 460px); max-width: none; margin: auto auto 0; padding-top: 28px; gap: 26px; }
  .tl::before { left: 7.25px; right: auto; top: 38px; bottom: 34px; width: 1.5px; height: auto; background: linear-gradient(var(--lilac), rgb(245 240 232 / .7) 45%, var(--next)); }
  .t { padding-left: 36px; padding-top: 0; }
  .t > .dot { top: 2px; }
  .tl > .t, .tl:not(:has(> .t.past:not([hidden]))) > .t { grid-column: auto !important; }
  .tl, .tl:not(:has(> .t.past:not([hidden]))) { grid-template-columns: minmax(0, 1fr) !important; justify-content: stretch; }
}
@media (vertical-viewport-segments: 2) {
  main.auth { flex: none; height: max(0px, calc(env(viewport-segment-height 0 0, 100%) - var(--phasic-suite-height, 56px))); }
}
@media (prefers-reduced-motion: reduce) {
  .tl[data-busy] .pill .fill { animation: none; clip-path: inset(0 40% 0 0); }
  .fld { transition: none; }
}
@media (forced-colors: active) {
  :root, body { background: Canvas; color: CanvasText; }
  .t > .dot { forced-color-adjust: none; }
  .t.past > .dot { background: GrayText; }
  .t.now > .dot { background: CanvasText; }
  .t.next > .dot { border-color: Highlight; }
  .fld { border-bottom-color: CanvasText; }
  .fld[data-bad] { border-bottom-color: Highlight; }
  .pill, .act, .show, .link, .way-back { color: ButtonText; background: ButtonFace; box-shadow: none; border: 1px solid ButtonText; }
  .pill .fill { forced-color-adjust: none; background: Highlight; color: HighlightText; }
  .pill .fill .fill-text { color: HighlightText; }
  .msg[data-tone]::before { forced-color-adjust: none; background: CanvasText; box-shadow: none; }
  .msg[data-tone="wait"]::before { background: transparent; border: 1.5px solid CanvasText; }
  .fld[data-bad] { border-bottom: 3px dashed Highlight; }
  .past-text, .lab, .hint, .alt, .msg, .say, .say-next { color: CanvasText; }
  .tl::before { background: CanvasText; }
}
