/* LintelWorks — Tiers interactive: move a rule and see what changes.
   Mounted by tiers.js into every [data-anim="tiers"]. All classes are prefixed tr-.
   Never animates on its own; every move is a response to the person and lasts under 400ms. */
.tr-root {
  display: block; width: 100%;
  color: var(--ink, #16201B);
  font-family: var(--font-body, "IBM Plex Sans", "Segoe UI", Helvetica, Arial, sans-serif);
  font-size: 16px; line-height: 1.5; text-align: left;
}
.tr-root *, .tr-root *::before, .tr-root *::after { box-sizing: border-box; }
.tr-root p { margin: 0; max-width: none; }
.tr-root button { font-family: inherit; }
.tr-root button:focus-visible { outline: 3px solid var(--beam, #18372C); outline-offset: 2px; border-radius: 4px; position: relative; z-index: 2; }

/* the panel stands under its own beam, which overhangs the posts by 9px each side */
.tr-panel {
  position: relative; margin: 0 9px; padding-top: 8px;
  background: var(--surface, #FFFFFF);
  border: 1px solid var(--line, #D5D9D1); border-top: 0;
  border-radius: 0 0 var(--radius, 6px) var(--radius, 6px);
}
.tr-panel::before {
  content: ""; position: absolute; top: 0; left: -9px; right: -9px; height: 8px;
  background: var(--beam, #18372C); border-radius: 1px;
}
.tr-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.tr-left { display: grid; gap: 26px; align-content: start; padding: 26px 28px 28px; }
.tr-right {
  display: grid; gap: 14px; align-content: start; padding: 26px 28px 28px;
  background: var(--plaster, #F2F3EF);
  border-left: 1px solid var(--line, #D5D9D1);
  border-radius: 0 0 var(--radius, 6px) 0;
}
.tr-label { font: 600 14px/1.3 var(--font-body, sans-serif); color: var(--ink-2, #55605A); }
.tr-fig { font-family: var(--font-mono, ui-monospace, Menlo, Consolas, monospace); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.tr-ic { flex: none; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- rule list ---------- */
.tr-block { display: grid; gap: 8px; }
.tr-rules { display: grid; border-top: 1px solid var(--line, #D5D9D1); }
.tr-rule {
  position: relative; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px;
  width: 100%; min-height: 52px; padding: 10px 10px 10px 16px;
  background: transparent; border: 0; border-bottom: 1px solid var(--line, #D5D9D1);
  font: 500 16px/1.3 var(--font-body, sans-serif); color: var(--ink, #16201B); text-align: left; cursor: pointer;
  transition: background 150ms var(--ease, cubic-bezier(0.2, 0, 0, 1));
}
.tr-rule:hover { background: rgba(24, 55, 44, 0.05); }
.tr-rule[aria-pressed="true"] { background: var(--plaster, #F2F3EF); font-weight: 600; }
.tr-rule::before { content: ""; position: absolute; left: 0; top: -1px; bottom: -1px; width: 4px; background: transparent; }
.tr-rule[aria-pressed="true"]::before { background: var(--beam, #18372C); }
.tr-rule-name { flex: 1 1 150px; min-width: 0; }
.tr-badge {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  padding: 3px 9px 3px 7px; border-radius: 4px;
  font: 600 13px/1.35 var(--font-body, sans-serif); white-space: nowrap;
}
.tr-badge--go { background: var(--go-tint, #E3EFE7); color: var(--go, #1F6F4A); }
.tr-badge--ask { background: var(--ask-tint, #FCF1D8); color: var(--ask-ink, #7A4206); }
.tr-badge--never { background: var(--never-tint, #E9EBE7); color: var(--never, #55605A); }

/* ---------- the rule as a sentence, with its three-way control ---------- */
.tr-edit { display: grid; gap: 14px; }
.tr-sentence {
  font: 600 23px/1.2 var(--font-display, "Archivo", Arial, sans-serif);
  font-stretch: 112%; letter-spacing: -0.012em; text-wrap: balance;
}
.tr-sentence .tr-fig { font-size: 0.92em; letter-spacing: -0.03em; }
.tr-seg {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; padding: 3px;
  background: var(--surface, #FFFFFF); border: 1px solid #9AA39C; border-radius: var(--radius, 6px);
}
.tr-opt {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 46px; padding: 6px 6px;
  background: transparent; border: 0; border-radius: 4px;
  font: 500 15px/1.2 var(--font-body, sans-serif); color: var(--ink, #16201B); cursor: pointer;
  transition: background 150ms var(--ease, cubic-bezier(0.2, 0, 0, 1)), color 150ms var(--ease, cubic-bezier(0.2, 0, 0, 1));
}
.tr-opt span { white-space: nowrap; }
.tr-opt:hover { background: rgba(24, 55, 44, 0.06); }
.tr-opt[aria-checked="true"] { font-weight: 600; box-shadow: inset 0 0 0 2px currentColor; }
.tr-opt--go[aria-checked="true"] { background: var(--go-tint, #E3EFE7); color: var(--go, #1F6F4A); }
.tr-opt--ask[aria-checked="true"] { background: var(--ask-tint, #FCF1D8); color: var(--ask-ink, #7A4206); }
.tr-opt--never[aria-checked="true"] { background: var(--never-tint, #E9EBE7); color: var(--ink, #16201B); }
.tr-opt.is-pending { box-shadow: inset 0 0 0 1px var(--surface, #fff); outline: 2px dashed var(--ink-2, #55605A); outline-offset: -3px; }
.tr-opt[aria-disabled="true"] { color: #868F89; cursor: not-allowed; background: transparent; }
.tr-opt[aria-disabled="true"] span { text-decoration: line-through; text-decoration-thickness: 1px; }

.tr-slot { min-height: 124px; }
.tr-explain { color: var(--ink-2, #55605A); font-size: 15px; }
.tr-confirm, .tr-fixed {
  display: grid; gap: 12px; padding: 14px 16px;
  border-left: 4px solid var(--ask, #F2B33D); background: var(--ask-tint, #FCF1D8);
  border-radius: 0 var(--radius, 6px) var(--radius, 6px) 0; font-size: 15px;
}
.tr-fixed { grid-template-columns: 20px minmax(0, 1fr); gap: 10px; border-left-color: var(--never, #55605A); background: var(--never-tint, #E9EBE7); }
.tr-fixed .tr-ic { margin-top: 2px; }
.tr-row { display: flex; flex-wrap: wrap; gap: 8px 10px; }
.tr-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 9px 16px;
  font: 600 15px/1.2 var(--font-body, sans-serif); color: var(--beam, #18372C);
  background: var(--surface, #FFFFFF); border: 1px solid var(--beam, #18372C); border-radius: var(--radius, 6px);
  cursor: pointer; transition: background 150ms var(--ease, cubic-bezier(0.2, 0, 0, 1)), transform 150ms var(--ease, cubic-bezier(0.2, 0, 0, 1));
}
.tr-btn:hover { background: #EEF1EC; }
.tr-btn:active { transform: translateY(1px); }
.tr-btn--primary { background: var(--beam, #18372C); color: #fff; }
.tr-btn--primary:hover { background: #0F2A21; }
.tr-link {
  min-height: 44px; padding: 8px 0; background: none; border: 0; cursor: pointer;
  font: 600 15px/1.2 var(--font-body, sans-serif); color: var(--beam, #18372C);
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; justify-self: start;
}

/* ---------- preview: one piece of work ---------- */
.tr-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 24px; }
.tr-example { flex: none; font: 600 13px/1.3 var(--font-body, sans-serif); color: var(--ink-2, #55605A); border: 1px dashed #9AA39C; border-radius: 4px; padding: 2px 8px; }
.tr-item {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 12px;
  padding: 14px 16px; background: var(--surface, #FFFFFF);
  border: 1px solid var(--line, #D5D9D1); border-radius: var(--radius, 6px);
}
.tr-item-text { flex: 1 1 170px; min-width: 0; display: grid; gap: 2px; }
.tr-item-title { font-weight: 600; font-size: 16px; line-height: 1.35; }
.tr-item-sub { color: var(--ink-2, #55605A); font-size: 14px; }
.tr-out { display: grid; align-content: start; min-height: 344px; }
.tr-out > * { position: relative; }
/* a short connector from the work to what happened to it */
.tr-out > *::before { content: ""; position: absolute; left: 24px; top: -14px; height: 14px; border-left: 1.5px solid var(--ink, #16201B); }

.tr-activity { list-style: none; margin: 0; padding: 14px 16px; display: grid; gap: 10px; background: var(--surface, #FFFFFF); border: 1px solid var(--line, #D5D9D1); border-radius: var(--radius, 6px); }
.tr-act { margin: 0; display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; align-items: start; font-size: 15px; line-height: 1.4; }
.tr-act--past { color: var(--ink-2, #55605A); }
.tr-act--now { font-weight: 500; }
.tr-dot { width: 20px; height: 20px; display: grid; place-items: center; }
.tr-dot::before { content: ""; width: 8px; height: 8px; border: 1.5px solid var(--ink-2, #55605A); border-radius: 50%; }
.tr-done { width: 20px; height: 20px; flex: none; }
.tr-done circle { fill: var(--go, #1F6F4A); }
.tr-done path { fill: none; stroke: #fff; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 14; stroke-dashoffset: 0; }
.tr-after { display: grid; gap: 6px; }

.tr-phone {
  display: grid; gap: 12px; width: 100%; max-width: 340px; padding: 28px 16px 16px;
  background: var(--surface, #FFFFFF); border: 1.5px solid var(--ink, #16201B); border-radius: 20px;
}
.tr-phone::after { content: ""; position: absolute; top: 11px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: var(--line, #D5D9D1); }
.tr-q { display: flex; align-items: center; gap: 8px; font: 600 17px/1.25 var(--font-display, "Archivo", Arial, sans-serif); font-stretch: 108%; }
.tr-q .tr-ic { color: var(--ask-ink, #7A4206); }
.tr-kv { margin: 0; display: grid; gap: 0; border-top: 1px solid var(--line, #D5D9D1); }
.tr-kv > div { display: grid; grid-template-columns: 68px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line, #D5D9D1); }
.tr-kv dt { color: var(--ink-2, #55605A); font-size: 14px; line-height: 1.45; }
.tr-kv dd { margin: 0; font-size: 15px; line-height: 1.4; font-weight: 500; }
.tr-why { color: var(--ink-2, #55605A); font-size: 14px; line-height: 1.4; }
.tr-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.tr-actions .tr-btn--primary { grid-column: 1 / -1; min-height: 48px; }
.tr-actions .tr-btn { padding-left: 8px; padding-right: 8px; }
.tr-hint { font-size: 14px; line-height: 1.4; padding: 10px 12px; background: var(--plaster, #F2F3EF); border-radius: 4px; }
.tr-result { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; align-items: start; font-size: 16px; line-height: 1.35; }
.tr-result strong { font-weight: 600; }
.tr-undo { display: grid; gap: 8px; }
.tr-undo .tr-btn { justify-self: start; min-width: 120px; }
.tr-bar { height: 3px; background: var(--line, #D5D9D1); border-radius: 2px; overflow: hidden; }
.tr-bar i { display: block; height: 100%; background: var(--go, #1F6F4A); transform-origin: left center; animation: tr-drain 10s linear forwards; }

.tr-hand {
  display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; align-items: center;
  padding: 14px 16px; background: var(--surface, #FFFFFF); border: 1px solid var(--line, #D5D9D1); border-radius: var(--radius, 6px);
  font-size: 16px; line-height: 1.4; font-weight: 500;
}
.tr-hand-ic { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 4px; background: var(--never-tint, #E9EBE7); color: var(--never, #55605A); }
.tr-hand--stop { grid-template-columns: 40px minmax(0, 1fr); }
.tr-hand--stop .tr-btn { grid-column: 2; justify-self: start; }

/* ---------- motion: only in response to the person ---------- */
.tr-in { animation: tr-in 260ms var(--ease, cubic-bezier(0.2, 0, 0, 1)) both; }
.tr-in .tr-done path { animation: tr-draw 300ms var(--ease, cubic-bezier(0.2, 0, 0, 1)) 80ms both; }
.tr-pop { animation: tr-pop 240ms var(--ease, cubic-bezier(0.2, 0, 0, 1)) both; }
@keyframes tr-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes tr-pop { from { opacity: 0; } to { opacity: 1; } }
@keyframes tr-draw { from { stroke-dashoffset: 14; } to { stroke-dashoffset: 0; } }
@keyframes tr-drain { from { transform: scaleX(1); } to { transform: scaleX(0); } }

.tr-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- narrower slots: stack under 640px, tighten under 400px ---------- */
.tr--stack .tr-grid { grid-template-columns: minmax(0, 1fr); }
.tr--stack .tr-left { padding: 22px 20px 22px; gap: 22px; }
.tr--stack .tr-right { padding: 20px 20px 22px; border-left: 0; border-top: 1px solid var(--line, #D5D9D1); border-radius: 0 0 var(--radius, 6px) var(--radius, 6px); }
.tr--stack .tr-slot { min-height: 0; }
.tr--stack .tr-out { min-height: 0; }
.tr--stack .tr-sentence { font-size: 21px; }
.tr--tight .tr-left { padding: 18px 14px 20px; }
.tr--tight .tr-right { padding: 18px 14px 18px; }
.tr--tight .tr-rule { padding-left: 14px; padding-right: 6px; }
.tr--tight .tr-phone { padding-left: 14px; padding-right: 14px; }
.tr--tight .tr-out > *::before { left: 20px; }
.tr--tight .tr-row .tr-btn { flex: 1 1 100%; }
/* a slim left column (a narrow slot, or two columns in a medium one): icon over word, tier under the rule name */
.tr--slim .tr-opt { flex-direction: column; gap: 4px; min-height: 60px; font-size: 14px; }
.tr--slim .tr-rule { flex-direction: column; align-items: flex-start; justify-content: center; flex-wrap: nowrap; }
.tr--slim .tr-rule-name { flex: none; }
.tr--slim.tr--wide .tr-left, .tr--slim.tr--wide .tr-right { padding: 22px 20px 24px; }

@media (prefers-reduced-motion: reduce) {
  .tr-root *, .tr-root *::before, .tr-root *::after { animation: none !important; transition: none !important; }
  .tr-bar { display: none; }
}
