/* OIDC Stories. Framed by its post, which cannot pass the site's light/dim
   switch in, so it follows the reader's system preference, as the other Web
   Security tools do. */

:root {
  --bg: #ffffff;
  --card: #ffffff;
  --border: #dfe3e8;
  --text: #22272e;
  --dim: #5f6b78;
  --btn: #f4f5f7;
  --accent: #0077b8;
  --line: #b4bfc9;
  --op: #8e44c9;
  --user: #c96a12;
  --app: #2f62cc;
  --op-bg: #f6effc;
  --user-bg: #fdf3ea;
  --app-bg: #eef3fc;
  --code: #f2f4f7;
  --bad: #d23b3b;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1d2b;
    --card: #112b40;
    --border: #234862;
    --text: #eaf1f6;
    --dim: #9fb2c2;
    --btn: #16374f;
    --accent: #4fb3ff;
    --line: #3d5a6e;
    --op: #c79bff;
    --user: #f0a050;
    --app: #7ea6ff;
    --op-bg: #1f2547;
    --user-bg: #2a2a2a;
    --app-bg: #13304f;
    --code: #0d2233;
    --bad: #ff6b6b;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
}
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.88em;
  background: var(--code); padding: 0 0.25em; border-radius: 3px; overflow-wrap: anywhere; }
.os-app { padding: 0.5rem 16px 1.5rem; max-width: 1200px; margin: 0 auto; }
.os-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.9rem; margin: 0 0 0.45rem; }
.os-head h1 { font-size: 1.3rem; margin: 0; }
.os-head p { margin: 0; color: var(--dim); font-size: 0.92rem; }
.in-viewer .os-head { display: none; }

/* The controls. */
.os-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; margin-bottom: 0.6rem; }
.os-btn { font: inherit; font-size: 0.9rem; padding: 0.35rem 0.8rem; border: 1px solid var(--border);
  background: var(--btn); color: var(--text); border-radius: 6px; cursor: pointer; }
.os-btn:disabled { opacity: 0.45; cursor: default; }
.os-btn.play { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; min-width: 10rem; }
#os-stories { font: inherit; font-size: 0.9rem; padding: 0.3rem; border: 1px solid var(--border);
  background: var(--btn); color: var(--text); border-radius: 6px; max-width: 100%; }
.os-count { color: var(--dim); font-size: 0.88rem; }

/* The story, told at the top. */
.os-story { border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem 0.9rem; background: var(--card);
  min-height: 6.2rem; }
.os-story h2 { margin: 0 0 0.25rem; font-size: 1.08rem; }
.os-story p { margin: 0.15rem 0; line-height: 1.45; }
.os-story .main { font-size: 1.12rem; font-weight: 600; }
.os-story .ask { margin-top: 0.4rem; font-size: 1.15rem; font-weight: 700; color: var(--accent); }
.bul { margin: 0.2rem 0 0; padding-left: 1.15rem; }
.bul .bul { margin: 0; }
.bul li { margin: 0.1rem 0; line-height: 1.4; }

/* The three parties in a row, before they move. A card that has left keeps
   its place, so the others stay put. */
.os-row { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; min-height: 4.4rem; margin: 0.8rem 0; }
.os-card { width: 15rem; display: flex; align-items: center; gap: 0.55rem; padding: 0.55rem 0.7rem;
  border: 2px solid var(--border); border-radius: 10px; background: var(--card);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08); }
.os-card .ic { font-size: 1.6rem; line-height: 1; flex: none; }
.os-card .nm { font-weight: 650; line-height: 1.25; }
.os-row .os-card.gone { visibility: hidden; }
.os-card.fly { position: relative; z-index: 5; }
.os-row .os-card.drag { cursor: grab; touch-action: none; }
.os-row .os-card.drag:hover { border-color: var(--accent); }
.os-row .os-card.dragging { cursor: grabbing; position: relative; z-index: 10; box-shadow: 0 12px 26px rgba(0, 0, 0, 0.25); }
.os-row .os-card.back { transition: transform 0.6s ease; }

/* The triangle: the provider on top, the user bottom left, the app bottom
   right, the token between the bottom two. */
.os-tri { position: relative; display: grid; grid-template-columns: 1fr minmax(0, 1.05fr) 1fr;
  grid-template-rows: auto auto; gap: 2.2rem 1.4rem; align-items: start; }
.os-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.os-lines line { stroke: var(--line); stroke-width: 2.5; stroke-dasharray: 7 6; }
.os-slot { position: relative; z-index: 1; border: 2px dashed var(--line); border-radius: 12px; padding: 0.55rem 0.7rem 0.7rem;
  background: var(--bg); min-height: 8.5rem; }
.os-slot[data-role="op"] { grid-column: 2; grid-row: 1; }
.os-slot[data-role="user"] { grid-column: 1; grid-row: 2; }
.os-slot[data-role="app"] { grid-column: 3; grid-row: 2; }
.os-slot .role { font-weight: 750; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; }
.os-slot .what { color: var(--dim); font-size: 0.86rem; margin: 0.1rem 0 0.45rem; }
.os-slot[data-role="op"] .role { color: var(--op); }
.os-slot[data-role="user"] .role { color: var(--user); }
.os-slot[data-role="app"] .role { color: var(--app); }
.os-slot.full { border-style: solid; }
.os-slot.full[data-role="op"] { border-color: var(--op); background: var(--op-bg); }
.os-slot.full[data-role="user"] { border-color: var(--user); background: var(--user-bg); }
.os-slot.full[data-role="app"] { border-color: var(--app); background: var(--app-bg); }
.os-slot .os-card { width: 100%; max-width: 15rem; }
.os-slot .bul { font-size: 0.9rem; margin-top: 0.5rem; }
.os-slot .late { animation: os-in 0.5s ease 1.5s both; }
.os-slot.over { border-color: var(--accent); border-style: solid; }
.os-slot.wrong { animation: os-shake 0.45s ease; border-color: var(--bad); }
.os-slot .nope { color: var(--bad); font-weight: 600; font-size: 0.88rem; margin: 0.3rem 0 0; animation: os-in 0.3s ease both; }
.os-story .how { color: var(--dim); font-weight: 400; font-size: 0.92rem; }
@keyframes os-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes os-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* The token, between the corners: each claim in its corner's colour. */
.os-token { grid-column: 2; grid-row: 2; position: relative; z-index: 1; align-self: center;
  border: 1px solid var(--border); border-radius: 10px; background: var(--card); padding: 0.6rem 0.75rem;
  font-size: 0.9rem; visibility: hidden; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); }
.os-token.on { visibility: visible; }
.os-token h3 { margin: 0 0 0.35rem; font-size: 0.98rem; }
.os-token .claim { border-left: 4px solid; padding: 0.15rem 0 0.15rem 0.5rem; margin: 0.25rem 0; line-height: 1.35; }
.os-token .claim.op { border-color: var(--op); }
.os-token .claim.user { border-color: var(--user); }
.os-token .claim.app { border-color: var(--app); }
.os-token .bul { margin-top: 0.4rem; }

/* A phone: one column, the corners one over another. */
@media (max-width: 760px) {
  .os-tri { grid-template-columns: 1fr; gap: 0.8rem; }
  .os-slot[data-role], .os-token { grid-column: 1; grid-row: auto; }
  .os-lines { display: none; }
  .os-card { width: 100%; max-width: 20rem; }
  .os-row { flex-direction: column; align-items: center; gap: 0.5rem; min-height: 0; }
  .os-row .os-card.gone:not(.leaving) { display: none; }
  .os-btn.play { min-width: 0; }
}
