/* The formcast showcase: a project sheet from landonthornton.com (chrome, tokens, dot grid and .sec
   grid as on the classifier page), with the tool in layout C: the page on the left, sticky on
   desktop, and one steps panel on the right. Below 760px the page goes on top. */

:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
body { margin: 0; }
[hidden] { display: none !important; }

:root {
  /* Flexoki (stephango.com/flexoki), neutrals only, as on landonthornton.com */
  --paper: #FFFCF0;
  --ink: #100F0F;
  --graphite: #6F6E69;
  --rule: rgba(16, 15, 15, .16);
  --dot: rgba(16, 15, 15, .16);
  --panel: #E6E4D9;
  --wash: rgba(255, 252, 240, .94);
  --serif: "EB Garamond", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --gutter: max(16px, env(safe-area-inset-left, 0px), calc((100vw - 1040px) / 2 + 16px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px), calc((100vw - 1040px) / 2 + 16px));
  --line-top: 0 -0.5px 0 0 var(--rule), inset 0 0.5px 0 0 var(--rule), 0 -1.75px 0 0 var(--paper), inset 0 1.75px 0 0 var(--paper);
  --line-box-gap: 0 0 0 1.75px var(--paper), inset 0 0 0 1.75px var(--paper);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --paper: #100F0F; --ink: #CECDC3; --graphite: #878580; --rule: rgba(206, 205, 195, .16); --dot: rgba(206, 205, 195, .12); --panel: #282726; --wash: rgba(16, 15, 15, .94); color-scheme: dark; }
}
:root[data-theme="dark"] { --paper: #100F0F; --ink: #CECDC3; --graphite: #878580; --rule: rgba(206, 205, 195, .16); --dot: rgba(206, 205, 195, .12); --panel: #282726; --wash: rgba(16, 15, 15, .94); color-scheme: dark; }

body {
  background-color: var(--paper);
  background-image: radial-gradient(circle at 12px 12px, var(--dot) 1.15px, transparent 1.65px);
  background-size: 24px 24px;
  background-position: calc(var(--gutter) - 12px) -12px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 4px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 48px;
  padding-left: var(--gutter); padding-right: var(--gutter-r); background: var(--wash); box-shadow: 0 0.5px 0 0 var(--rule);
  font-family: var(--mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
}
.topbar span:last-child { color: var(--graphite); }
.topbar .home { color: inherit; text-decoration: none; }
.topbar .home:hover { text-decoration: underline; }

.wrap { padding-left: var(--gutter); padding-right: var(--gutter-r); padding-bottom: 48px; }
.sec { display: grid; grid-template-columns: 168px minmax(0, 672px); gap: 0 48px; padding-block: 48px; box-shadow: var(--line-top); }
.sec.first { box-shadow: none; }
.label { font-family: var(--mono); font-weight: 400; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--graphite); margin: 0; line-height: 24px; }
.body { min-width: 0; }
.body > p { margin: 0 0 24px; line-height: 24px; max-width: 62ch; text-wrap: pretty; }
.body > p:last-child { margin-bottom: 0; }
h1 { font-weight: 400; font-size: clamp(44px, 6vw, 64px); line-height: 72px; letter-spacing: -.015em; margin: 0 0 24px; text-wrap: balance; }
.lead { font-style: italic; font-size: clamp(22px, 2.4vw, 26px); color: var(--graphite); }
.body > p.lead { line-height: 48px; margin-bottom: 24px; text-wrap: balance; }
.meta { display: flex; flex-wrap: wrap; gap: 0 24px; font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--graphite); }
.body > p.meta { line-height: 24px; }

/* ---------- controls (as on the classifier page) ---------- */
.btn {
  box-sizing: border-box; display: grid; place-items: center; height: 48px; width: 100%; padding: 0 12px;
  background: var(--paper); border: 0; outline: 1px solid var(--ink); outline-offset: -0.5px; box-shadow: var(--line-box-gap);
  color: var(--ink); font-family: var(--mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; cursor: pointer;
}
.btn:focus-within { outline-width: 2px; }
.btn:disabled { color: var(--graphite); outline-color: var(--rule); cursor: default; }
.btn.quiet { outline-color: var(--rule); }
/* the one action each step leads with: Detect, Auto map, Fill */
.btn.go { background: var(--ink); color: var(--paper); }
.btn.go:disabled { background: var(--paper); color: var(--graphite); }
/* only where there is a real hover: a tapped button on a phone would otherwise stay inverted */
@media (hover: hover) {
  .btn:hover:not(:disabled) { background: var(--ink); color: var(--paper); }
  .btn.quiet:hover:not(:disabled) { outline-color: var(--ink); }
  .btn.go:hover:not(:disabled) { background: var(--paper); color: var(--ink); }
}
.file { position: relative; }
.file input { position: absolute; width: 1px; height: 1px; opacity: 0; }
select {
  box-sizing: border-box; width: 100%; height: 48px; padding: 0 12px; border: 0; border-radius: 0;
  outline: 1px solid var(--ink); outline-offset: -0.5px; box-shadow: var(--line-box-gap);
  background: var(--paper); color: var(--ink); font-family: var(--mono); font-size: 12px; cursor: pointer;
}
.panel .fc-in { box-shadow: none; }
textarea {
  box-sizing: border-box; display: block; width: 100%; padding: 8px 12px; resize: vertical;
  border: 0; border-radius: 0; outline: 1px solid var(--rule); outline-offset: -0.5px;
  background: var(--paper); color: var(--ink); font: 12px/18px var(--mono);
}
textarea:focus-visible { outline: 2px solid var(--ink); outline-offset: -1px; }
.hint { margin: 12px 0 0; font-style: italic; font-size: 15px; line-height: 24px; color: var(--graphite); }
.note { margin: 0; font-size: 16px; line-height: 24px; color: var(--ink); }
.readout { margin: 12px 0 0; padding-top: 12px; box-shadow: inset 0 0.5px 0 0 var(--rule); font-family: var(--mono); font-size: 11px; line-height: 24px; color: var(--graphite); }
.readout:empty { display: none; }
.readout b { font-weight: 500; color: var(--ink); }
.msg { margin: 0 0 24px; padding-left: 12px; box-shadow: inset 2px 0 0 0 var(--ink); font-style: italic; font-size: 16px; line-height: 24px; color: var(--ink); overflow-wrap: anywhere; }
.check { display: flex; align-items: center; gap: 12px; min-height: 48px; font-size: 17px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--ink); }
.row { display: flex; gap: 12px; margin-top: 12px; }
.row > * { flex: 1 1 0; min-width: 0; }
.group .btn + .btn { margin-top: 12px; }
.row .btn + .btn { margin-top: 0; }
.row .btn { height: auto; min-height: 48px; padding: 6px 8px; line-height: 18px; text-align: center; }
.ib {
  width: 32px; height: 32px; padding: 0; background: var(--paper); color: var(--ink); border: 0;
  outline: 1px solid var(--rule); outline-offset: -0.5px; font: 14px/1 var(--mono); cursor: pointer;
}
.ib:disabled { color: var(--graphite); opacity: .5; cursor: default; }

/* ---------- the tool (layout C) ---------- */
.tool { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px 48px; padding-block: 48px; box-shadow: var(--line-top); }
.fig { position: sticky; top: 12px; align-self: start; margin: 0; min-width: 0; }
.figbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 32px; margin-bottom: 12px; }
.docline { margin: 0; min-width: 0; font-family: var(--mono); font-size: 11px; line-height: 24px; letter-spacing: .06em; color: var(--graphite); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.docline b { font-weight: 500; color: var(--ink); }
.pager { display: flex; align-items: center; gap: 8px; flex: none; font-family: var(--mono); font-size: 11px; color: var(--graphite); }
/* Tags and selection handles may stick out past the page; the stage clips them sideways so the
   page never scrolls horizontally, and lets them show above and below. */
.stage { position: relative; min-height: 240px; overflow-x: clip; overflow-y: visible; padding-top: 4px; }
.stage.drag { outline: 2px dashed var(--ink); outline-offset: 4px; }
.empty { margin: 24px 0 0; font-style: italic; color: var(--graphite); line-height: 24px; }
.fig figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0 24px; font-family: var(--mono); font-size: 11px; line-height: 24px; padding-block: 12px; letter-spacing: .04em; color: var(--graphite); }
.key { display: flex; flex-wrap: wrap; gap: 0 18px; }
.key span { display: inline-flex; align-items: center; gap: 8px; }
.sw { display: inline-block; width: 18px; height: 12px; outline-offset: -0.5px; }
.sw.linked { outline: 1px solid var(--ink); background: var(--rule); }
.sw.unlinked { outline: 1px dashed var(--graphite); }
.sw.selected { outline: 2px solid var(--ink); outline-offset: -1px; }
.fig .msg { margin: 0; }

/* ---------- the scan and the links landing (scan.js) ---------- */
/* On the page sheet, so its tokens are the sheet's light ones in both themes. A thin line and a
   soft light just above it sweep down while the detector runs; one last pass brings the boxes in. */
.scan { position: absolute; inset: 0; z-index: 5; overflow: hidden; pointer-events: none; display: none; }
.scan.is-sweeping, .scan.is-pass { display: block; }
.scan::before, .scan::after { content: ""; position: absolute; left: 0; right: 0; top: 0; }
.scan::before { height: 64px; transform: translateY(-100%); background: linear-gradient(to bottom, transparent, var(--tint-strong)); }
.scan::after { height: 1px; background: var(--ink); opacity: .6; }
.scan.is-sweeping::before, .scan.is-sweeping::after { animation: scan-sweep 2.2s cubic-bezier(.45, 0, .55, 1) infinite; }
.scan.is-pass::before, .scan.is-pass::after { animation: scan-pass 1.4s linear both; }
@keyframes scan-sweep { from { top: 0; } to { top: 100%; } }
@keyframes scan-pass { 0% { top: 0; opacity: .6; } 90% { opacity: .6; } 100% { top: 100%; opacity: 0; } }
.scan.is-pass::before { opacity: 1; }

#pageview.is-revealing .fc-box { animation: box-in 320ms ease-out both; animation-delay: var(--reveal-delay, 0ms); }
@keyframes box-in { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
/* a link landing: the box starts as not linked and turns linked, with a brief ring */
#pageview.is-mapping .fc-box.is-landing { animation: link-in 420ms ease-out both; animation-delay: var(--land-delay, 0ms); }
#pageview.is-mapping .fc-box.is-landing .fc-tag { animation: box-in 300ms ease-out both; animation-delay: var(--land-delay, 0ms); }
@keyframes link-in {
  0% { outline: 1px dashed var(--graphite); background: var(--tint-unlinked); box-shadow: 0 0 0 0 transparent; }
  45% { box-shadow: 0 0 0 4px var(--tint-strong); }
  100% { outline: 1px solid var(--ink); background: var(--tint); box-shadow: 0 0 0 0 transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .scan { display: none !important; }
  #pageview .fc-box, #pageview .fc-box .fc-tag { animation: none !important; }
}

.panel { min-width: 0; }
.steps { display: flex; margin-bottom: 24px; }
.steps [role="tab"] {
  flex: 1; height: 48px; padding: 0; background: none; border: 0; color: var(--graphite); cursor: pointer;
  font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  box-shadow: inset 0 -1px 0 var(--rule);
}
.steps [role="tab"] b { font-weight: 500; margin-right: 6px; }
.steps [role="tab"][aria-selected="true"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); }
.steps [role="tab"]:focus-visible { outline-offset: -2px; }
.step { min-width: 0; }
.group { display: grid; gap: 0; margin-bottom: 24px; min-width: 0; }
.group > .label { margin-bottom: 8px; }
.btn.next { margin-top: 12px; }

.paste { margin-bottom: 12px; }
.paste summary { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; line-height: 36px; color: var(--graphite); cursor: pointer; }
.paste[open] summary { color: var(--ink); }
.paste .msg { margin: 12px 0 0; }
#schemalist { max-height: 360px; overflow: auto; padding: 1px; }


/* ---------- write-up (as on the classifier and docrooter pages) ---------- */
.body h3.sub { margin: 48px 0 24px; font-family: var(--mono); font-weight: 500; font-size: 11px; line-height: 24px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink); }
.body > p + h3.sub, .body > div + h3.sub, .body > dl + h3.sub { margin-top: 48px; }
.body b { font-weight: 500; }
.list { margin: 0 0 24px; padding-left: 24px; max-width: 62ch; }
.list li { line-height: 24px; }
.body > .note, .body > div > .note, .body .defs { margin: 24px 0 0; font-size: 17px; line-height: 24px; color: var(--graphite); max-width: 62ch; }
.body > .note b, .body > div > .note b { color: var(--ink); }
.note.sources { font-family: var(--mono); font-size: 11px; overflow-wrap: anywhere; }
.defs { display: grid; grid-template-columns: minmax(0, max-content) minmax(0, 1fr); gap: 12px 24px; }
.defs dt { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink); white-space: nowrap; }
.defs dd { margin: 0; }

.diagram { margin: 0 0 24px; width: round(down, 100%, 24px); }
.diagram svg { display: block; width: 100%; height: auto; overflow: visible; }
.diagram .tall { display: none; max-width: 336px; }  /* laid out for phones; never scaled up */
.diagram .bx { fill: var(--paper); stroke: var(--ink); stroke-width: 1; }
.diagram .bx.you { fill: none; stroke: var(--graphite); stroke-dasharray: 4 3; }
.diagram .ln { fill: none; stroke: var(--ink); stroke-width: 1; }
.diagram .ln.you { stroke: var(--graphite); stroke-dasharray: 4 3; }
.diagram .ah { fill: var(--ink); }
.diagram .t { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; fill: var(--ink); }
.diagram .s { font-family: var(--mono); font-size: 10px; letter-spacing: .04em; fill: var(--graphite); }
.diagram .bl circle { fill: var(--paper); stroke: var(--ink); stroke-width: 1; }
.diagram .bl text { font-family: var(--mono); font-size: 10px; fill: var(--ink); text-anchor: middle; dominant-baseline: central; }
.diagram figcaption { font-family: var(--mono); font-size: 11px; line-height: 24px; padding-block: 12px; letter-spacing: .04em; color: var(--graphite); }

.tablebox { overflow-x: auto; width: round(down, 100%, 24px); }
.tablebox + .tablebox { margin-top: 48px; }
.tablebox table { width: 100%; min-width: 480px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tablebox thead th + th { width: 64px; }
#agent-table thead th + th { width: 120px; }
.tablebox caption { text-align: left; font-family: var(--mono); font-size: 11px; letter-spacing: .06em; color: var(--graphite); line-height: 24px; padding-bottom: 12px; }
.tablebox th, .tablebox td { padding: 12px 0 12px 12px; line-height: 24px; text-align: right; vertical-align: top; box-shadow: inset 0 -0.5px 0 0 var(--rule); white-space: nowrap; }
.tablebox thead th { padding-top: 0; font-family: var(--mono); font-weight: 400; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--graphite); vertical-align: bottom; white-space: normal; }
.tablebox th:first-child, .tablebox td:first-child { text-align: left; padding-left: 0; }
.tablebox td { font-family: var(--mono); font-size: 13px; color: var(--ink); }
.tablebox tbody th { font-family: var(--serif); font-weight: 400; font-size: 18px; color: var(--ink); white-space: normal; min-width: 168px; }
.tablebox tbody th .k { display: block; font-family: var(--mono); font-size: 10px; line-height: 24px; letter-spacing: .08em; text-transform: uppercase; color: var(--graphite); }
.tablebox tr.grp th { padding: 24px 0 0; font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink); box-shadow: inset 0 -1px 0 0 var(--ink); }
.tablebox tbody:first-of-type tr.grp th { padding-top: 0; }
.tablebox tr.pick th, .tablebox tr.pick td { font-weight: 500; }
.tablebox tr.pick th { font-style: italic; }

.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 24px; padding-block: 24px; line-height: 24px; box-shadow: var(--line-top); font-family: var(--mono); font-size: 11px; letter-spacing: .08em; color: var(--graphite); }
.foot a { color: inherit; }

/* the wide diagram needs about 612 px to keep its 10 px labels near 10 px; narrower columns get the tall one */
@media (max-width: 860px) {
  .diagram .wide { display: none; }
  .diagram .tall { display: block; }
}
.more { margin: 24px 0 0; }
.more > summary { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; line-height: 48px; color: var(--graphite); cursor: pointer; }
.more[open] > summary { color: var(--ink); }
.more > summary + .tablebox { margin-top: 24px; }

@media (max-width: 960px) {
  .tool { grid-template-columns: minmax(0, 1fr) 320px; gap: 24px 32px; }
}
@media (max-width: 760px) {
  .sec { grid-template-columns: minmax(0, 1fr); }
  .defs { grid-template-columns: minmax(0, 1fr); }
  .defs { gap: 0; }
  .tablebox tbody th { position: sticky; left: 0; background: var(--paper); }  /* names stay put while the figures scroll */
  .defs dd + dt { margin-top: 12px; }
  .sec > .label { margin-bottom: 24px; }
  .tool { grid-template-columns: minmax(0, 1fr); }
  .fig { position: static; }
  #schemalist { max-height: none; }
}
@media (pointer: coarse) {
  .ib { width: 40px; height: 40px; }
}
.readout + .btn { margin-top: 12px; }
