/* The policy document.
 *
 * One tinted band per top-level block, and the same tint reused across the two
 * documents inside a policy (governs/fields, counters/states, rules/actions) so
 * the eye pairs the policy with the workflow that carries it.
 *
 * Shared by the homepage (web/index.html, hand-written markup) and the blog
 * (a ```policy fence, rendered by scripts/build-blog.js). Both emit the same
 * classes, so a policy reads identically wherever it appears.
 *
 *   <div class="policy-doc">
 *     <div class="pol-b pol-plain"><span class="k">policy</span>: <span class="v">refunds</span></div>
 *     <div class="pol-b pol-blue"><span class="h">roles</span>:
 *   <span class="n">agent</span>: <span class="v">issues refunds</span></div>
 *   </div>
 *
 *   .h   the block header      roles, governs, counters, rules, states, actions
 *   .n   a name being declared a role, a field, a counter, a rule, an action
 *   .k   a keyword             on, require, otherwise, by, from, to, limit
 *   .v   a value
 *   .sep the --- between the policy and the workflow
 */

.policy-doc {
  /* Declared here, not inherited: only the homepage carries green, amber and
     violet in its :root, and the bands must read the same on every page. */
  --pol-ink: #101114;
  --pol-ink-2: #2b2d33;
  --pol-gray: #63656d;
  --pol-gray-soft: #96989f;
  --pol-blue: #0060cc;
  --pol-blue-tint: #e6f0ff;
  --pol-green: #07724e;
  --pol-green-tint: #dcf3e8;
  --pol-amber: #8a5a00;
  --pol-amber-tint: #fdf0d5;
  /* Violet carries no state meaning on the site, unlike red (blocked, over cap,
     error), so the rules/actions bands use it. */
  --pol-violet: #734aa8;
  --pol-violet-tint: #ece8fb;

  background: var(--paper, #ffffff);
  color: var(--pol-ink);
  border-radius: var(--radius-md, 20px);
  padding: clamp(18px, 2vw, 28px);
  font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  font-size: clamp(12px, 1.05vw, 15px);
  line-height: 1.5;
  overflow-x: auto;
  /* One column, never narrower than the card and otherwise as wide as the
     longest line. When a long policy scrolls sideways on a phone, every tinted
     band is as wide as the widest and scrolls with its text, instead of the
     tint stopping at the card's edge while the words run on past it. */
  display: grid;
  grid-template-columns: minmax(max-content, 1fr);
  gap: 5px;
  /* When it does scroll, a thin grey bar rather than the platform's own. */
  scrollbar-width: thin;
  scrollbar-color: #c9cad0 transparent;
}
.policy-doc::-webkit-scrollbar { height: 6px; }
.policy-doc::-webkit-scrollbar-track { background: transparent; }
.policy-doc::-webkit-scrollbar-thumb { background: #c9cad0; border-radius: 999px; }

.pol-b { white-space: pre; border-radius: 12px; padding: 7px 14px; }
.pol-plain { padding-top: 3px; padding-bottom: 3px; }
.pol-blue { background: var(--pol-blue-tint); }
.pol-green { background: var(--pol-green-tint); }
.pol-amber { background: var(--pol-amber-tint); }
.pol-violet { background: var(--pol-violet-tint); }
.pol-blue .h { color: var(--pol-blue); }
.pol-green .h { color: var(--pol-green); }
.pol-amber .h { color: var(--pol-amber); }
.pol-violet .h { color: var(--pol-violet); }

.policy-doc .h { font-weight: 500; }
.policy-doc .n { color: var(--pol-ink); font-weight: 500; }
.policy-doc .k { color: var(--pol-ink-2); }
.policy-doc .v { color: var(--pol-gray); }
.policy-doc .sep { color: var(--pol-gray-soft); }

/* The YAML is around 45 characters at its widest and cannot wrap, so the type
   comes down to clear a 360-375px viewport without scrolling. The tinted bands
   carry their own inset, so the card's own padding gives some back. */
@media (max-width: 640px) {
  .policy-doc { font-size: 10.5px; padding: 14px 10px; }
  .pol-b { padding: 6px 10px; }
}
