/* BELZORA sign-in pages: an obsidian brand plate beside the same flat sheet the viewer uses.
   Ink and grey carry the chrome; violet marks the mark, mint marks "safe", the status hues mark
   status. No shadows except the one focus target that matters (the Microsoft button). */

:root {
  color-scheme: light dark;
  --ink: var(--bz-text);
  --muted: var(--bz-text-muted);
  --line: var(--bz-border);
  --sheet: var(--bz-bg);
  --card: var(--bz-surface);
  --primary: var(--bz-text);
  --on-primary: var(--bz-surface);
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--sheet); color: var(--ink);
       font: 15px/1.55 var(--bz-font-family-text); -webkit-font-smoothing: antialiased; }
h1, p, ul { margin: 0; }
button { font: inherit; color: inherit; }
a { color: inherit; }
::selection { background: var(--bz-accent-subtle); }
:focus-visible { outline: 2px solid var(--bz-focus); outline-offset: 3px; border-radius: 6px; }

/* Language: every phrase is written twice; the root says which one shows. */
:root[data-lang="en"] [lang="th"]:not([data-set-lang]),
:root[data-lang="th"] [lang="en"]:not([data-set-lang]) { display: none; }
:root[data-lang="th"] body { line-height: var(--bz-font-line-height-thai); }
:root[data-lang="th"] h1 { line-height: var(--bz-font-line-height-heading-thai); letter-spacing: 0; }
/* Thai has no spaces between words: headings keep each written phrase whole. */
.nb { white-space: nowrap; }

/* One view at a time, chosen by the server. */
.view { display: none; }
body[data-view="signin"] .view[data-for="signin"],
body[data-view="unregistered"] .view[data-for="unregistered"],
body[data-view="signedout"] .view[data-for="signedout"],
body[data-view="error"] .view[data-for="error"] { display: flex; }
.why { display: none; }
body[data-error="cancelled"] .why[data-why="cancelled"],
body[data-error="unverified"] .why[data-why="unverified"],
body[data-error="busy"] .why[data-why="busy"],
body[data-error="unavailable"] .why[data-why="unavailable"] { display: inline; }
body[data-named="no"] .who { display: none; }

/* Frame: plate | sheet. */
.frame { display: grid; grid-template-columns: minmax(320px, 0.82fr) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }

.plate { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between;
         padding: 40px 44px; color: #F3F0FA; isolation: isolate; border-right: 1px solid rgb(243 240 250 / 0.07);
         background:
           radial-gradient(120% 70% at 100% 100%, rgb(118 81 232 / 0.30), transparent 60%),
           radial-gradient(60% 40% at 0% 0%, rgb(154 229 207 / 0.07), transparent 70%),
           var(--bz-brand-obsidian); }
/* Ledger rules: the viewer's 1px lines, as a quiet ruled page. */
.plate::before { content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0.55;
                 background: repeating-linear-gradient(to bottom, transparent 0 39px, rgb(243 240 250 / 0.06) 39px 40px);
                 mask-image: linear-gradient(to right, transparent, #000 30%, #000 80%, transparent); }
.plate-logo { width: 117px; height: auto; display: block; }
.plate-line { max-width: 15ch; font-family: var(--bz-font-family-display); font-size: clamp(28px, 3.1vw, 40px);
              line-height: 1.15; font-weight: 500; letter-spacing: -0.02em; text-wrap: balance; margin-top: auto; margin-bottom: 28px; }
:root[data-lang="th"] .plate-line { max-width: 13em; line-height: 1.45; letter-spacing: 0; font-size: clamp(24px, 2.5vw, 32px); }
.plate-mark { position: absolute; right: -16%; top: 12%; width: 68%; max-width: 380px; z-index: -1;
              fill: none; stroke: var(--bz-violet-300); stroke-width: 0.5; opacity: 0.45; }
.plate-foot { display: flex; align-items: center; gap: 10px; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase;
              color: var(--bz-brand-descriptor-on-dark); }
:root[data-lang="th"] .plate-foot { text-transform: none; letter-spacing: 0; font-size: 13px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--bz-brand-mint); box-shadow: 0 0 0 4px rgb(154 229 207 / 0.14); }

/* Sheet */
.sheet { display: flex; flex-direction: column; min-width: 0; padding: 28px clamp(20px, 6vw, 88px); }
.bar { display: flex; align-items: center; justify-content: flex-end; gap: 16px; min-height: 36px; }
.bar-logo { display: none; height: 20px; width: auto; margin-right: auto; }
.lang { display: none; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }
:root.js .lang { display: inline-flex; }
.lang button { min-width: 44px; height: 28px; padding: 0 12px; border: 0; border-radius: 999px; background: none;
               color: var(--muted); font-size: 13px; cursor: pointer; transition: background 160ms var(--ease), color 160ms var(--ease); }
.lang button:hover { color: var(--ink); }
.lang button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }

.view { flex-direction: column; align-items: flex-start; gap: 20px; width: 100%; max-width: 440px; margin: auto 0; padding: 48px 0; }
.view > * { animation: rise 520ms var(--ease) both; }
.view > :nth-child(2) { animation-delay: 50ms; }
.view > :nth-child(3) { animation-delay: 100ms; }
.view > :nth-child(4) { animation-delay: 150ms; }
.view > :nth-child(5) { animation-delay: 200ms; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--bz-accent); }
:root[data-lang="th"] .eyebrow { letter-spacing: 0; text-transform: none; font-size: 13px; }
h1 { font-family: var(--bz-font-family-display); font-size: clamp(28px, 3.4vw, 36px); line-height: 1.15;
     font-weight: 600; letter-spacing: -0.02em; text-wrap: balance; }
.lede { color: var(--muted); font-size: 16px; max-width: 42ch; text-wrap: pretty; }
.lede b { color: var(--ink); font-weight: 600; }

/* The Microsoft button: Microsoft's own light/dark treatment, the one raised object on the page. */
.ms { display: inline-flex; align-items: center; justify-content: center; gap: 12px; width: 100%; height: 52px; margin-top: 8px;
      padding: 0 20px; border: 1px solid #8C8C8C; border-radius: 8px; background: #FFFFFF; color: #5E5E5E;
      font: 600 15px/1 "Segoe UI", var(--bz-font-family-text); text-decoration: none;
      box-shadow: 0 1px 2px rgb(23 20 31 / 0.06), 0 6px 18px rgb(23 20 31 / 0.06);
      transition: transform 160ms var(--ease), box-shadow 160ms var(--ease), border-color 160ms var(--ease); }
.ms:hover { border-color: #5E5E5E; box-shadow: 0 1px 2px rgb(23 20 31 / 0.08), 0 10px 26px rgb(118 81 232 / 0.16); }
.ms:active { transform: translateY(1px) scale(0.995); }
.ms-logo { width: 20px; height: 20px; flex: none; }

.facts { list-style: none; padding: 0; display: grid; gap: 8px; font-size: 13px; color: var(--muted); }
.facts li { display: flex; align-items: center; gap: 10px; }
.facts li::before { content: ""; width: 14px; height: 1px; background: var(--line); flex: none; }

/* Status chips */
.chip { display: inline-flex; align-items: center; gap: 8px; height: 26px; padding: 0 10px; border-radius: 999px;
        border: 1px solid; font-size: 12px; font-weight: 600; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.warn { color: var(--bz-status-warning-fg); background: var(--bz-status-warning-bg); border-color: var(--bz-status-warning-border); }
.chip.ok { color: var(--bz-status-success-fg); background: var(--bz-status-success-bg); border-color: var(--bz-status-success-border); }
.chip.bad { color: var(--bz-status-danger-fg); background: var(--bz-status-danger-bg); border-color: var(--bz-status-danger-border); }

/* The two IDs: a small ledger card, monospaced, each with its own copy. */
.ids { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--card); overflow: hidden; }
.id-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center;
          padding: 14px 14px 14px 16px; border-bottom: 1px solid var(--line); }
.id-label { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.id-value { font: 500 13.5px/1.4 var(--bz-font-family-mono); color: var(--ink); overflow-wrap: anywhere; user-select: all;
            letter-spacing: 0.01em; }
.copy { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; padding: 0 12px;
        border: 1px solid var(--line); border-radius: 6px; background: var(--sheet); font-size: 13px; cursor: pointer;
        transition: background 140ms var(--ease), border-color 140ms var(--ease), transform 140ms var(--ease); }
.copy:hover { border-color: var(--bz-border-strong); }
.copy:active { transform: scale(0.97); }
.copy.done { color: var(--bz-status-success-fg); border-color: var(--bz-status-success-border); background: var(--bz-status-success-bg); }
.copy.all { width: calc(100% - 28px); margin: 14px; height: 38px; font-weight: 600; }
.copied { min-height: 0; padding: 0 16px; font-size: 12px; color: var(--muted); }
.copied:not(:empty) { padding-bottom: 12px; margin-top: -4px; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; width: 100%; }
.btn { display: inline-flex; align-items: center; justify-content: center; height: 42px; padding: 0 18px; border-radius: 8px;
       border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 14px; font-weight: 600;
       text-decoration: none; transition: border-color 140ms var(--ease), background 140ms var(--ease), transform 140ms var(--ease); }
.btn:hover { border-color: var(--bz-border-strong); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: color-mix(in srgb, var(--primary) 86%, var(--bz-accent)); }

.foot { padding-top: 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }

/* Dark: the sheet goes obsidian too; the Microsoft button follows Microsoft's dark style. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ms { background: #2F2F2F; border-color: #2F2F2F; color: #FFFFFF;
                                         box-shadow: 0 0 0 1px rgb(243 240 250 / 0.08); }
  :root:not([data-theme="light"]) .ms:hover { border-color: var(--bz-violet-300); }
  :root:not([data-theme="light"]) .bar-logo.light { display: none !important; }
}
:root[data-theme="dark"] .ms { background: #2F2F2F; border-color: #2F2F2F; color: #FFFFFF; }

/* Narrow: the plate folds away; the logo moves into the bar. */
@media (max-width: 860px) {
  .frame { grid-template-columns: 1fr; }
  .plate { display: none; }
  .bar-logo.light { display: block; }
  .sheet { padding-top: 20px; }
  .view { margin: 0 auto; padding: 40px 0 32px; }
  .foot { max-width: 440px; width: 100%; margin: auto auto 0; }
}
@media (max-width: 860px) and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .bar-logo.dark { display: block; }
}
@media (max-width: 420px) {
  .actions .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .view > * { animation: none; }
  * { transition: none !important; }
}
