/* ==========================================================================
   Experiment 04 · Confidence as ink (experiments/confidence-ink/).
   A model's answer set in type whose ink follows the model's own certainty
   per word. Sure words sit in full ink; shaky ones fade. A line you can
   move decides what counts as shaky; hover or focus a word for the
   alternatives it weighed. Skin: editorial (warm paper, serif, one rust).
   Motion: opacity/transform only; reduced motion = instant.
   ========================================================================== */

.ci { grid-column: 1 / 13; --pap: #F3EDE1; --pap-2: #EAE2D3; --ink: #1C1915; --ink-2: #5B5448; --rule: rgba(28,25,21,.18); --rust: #B8431E; --rust-soft: rgba(184,67,30,.12);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  background: var(--pap); color: var(--ink); font-family: var(--serif); border-radius: 16px; overflow: hidden; border: 1px solid rgba(245,242,235,.12); box-shadow: 0 30px 80px rgba(0,0,0,.45);
  background-image: radial-gradient(ellipse at 20% 0%, rgba(255,255,255,.5), transparent 55%); display: grid; grid-template-columns: minmax(0, 1fr) 280px; grid-template-rows: auto minmax(0, 1fr) auto; }
.ci *, .ci *::before, .ci *::after { box-sizing: border-box; }
.ci button { font: inherit; cursor: pointer; color: inherit; }
.ci button:focus-visible, .ci [tabindex]:focus-visible { outline: 2px solid var(--rust); outline-offset: 3px; }
.ci .sans { font-family: var(--sans); }
.ci .small { font-family: var(--sans); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); }

/* masthead */
.ci-head { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 18px; padding: 18px 32px 14px; border-bottom: 1px solid var(--ink); }
.ci-head .mast { font-family: var(--serif); font-size: 22px; letter-spacing: -.01em; font-style: italic; }
.ci-head .small { margin-left: auto; }
.ci-head .small b { color: var(--ink); font-weight: 500; }

/* the article */
.ci-body { padding: 28px 32px 32px; min-width: 0; border-right: 1px solid var(--rule); }
.ci-q { font-family: var(--sans); font-size: 13px; color: var(--ink-2); margin: 0 0 6px; }
.ci-q b { color: var(--ink); font-weight: 600; }
.ci-title { font-size: clamp(26px, 2.6vw, 34px); line-height: 1.12; letter-spacing: -.015em; margin: 0 0 18px; max-width: 24ch; font-weight: 400; }
.ci-text { font-size: clamp(19px, 1.7vw, 23px); line-height: 1.55; max-width: 58ch; margin: 0; hyphens: none; }
.ci-text::first-letter { font-size: 3.1em; float: left; line-height: .82; padding: 6px 8px 0 0; color: var(--ink); }
.ci-text .w { position: relative; display: inline; color: rgba(28,25,21, var(--a, 1)); transition: color .35s, text-decoration-color .35s, background .35s; border-radius: 2px; text-decoration: none; text-decoration-thickness: 1.5px; text-underline-offset: 5px; }
.ci-text .w.lo { cursor: help; }
.ci-text .w.lo:hover, .ci-text .w.lo:focus-visible { background: var(--rust-soft); }
/* modes */
.ci.mode-flags .ci-text .w { color: var(--ink); }
.ci.mode-flags .ci-text .w.lo { text-decoration: underline wavy var(--rust); }
.ci.mode-plain .ci-text .w { color: var(--ink); }
.ci.mode-plain .ci-text .w.lo { cursor: text; }
.ci.only-shaky .ci-text .w { color: rgba(28,25,21,.12); }
.ci.only-shaky .ci-text .w.lo { color: var(--ink); background: var(--rust-soft); }
.ci.only-shaky .ci-text::first-letter { color: rgba(28,25,21,.12); }
/* the footnote line under the text */
.ci-foot { margin: 22px 0 0; padding-top: 14px; border-top: 1px solid var(--rule); font-family: var(--sans); font-size: 13px; color: var(--ink-2); line-height: 1.5; max-width: 58ch; }
.ci-foot b { color: var(--ink); font-weight: 600; }
.ci-foot b.r { color: var(--rust); }

/* popover with alternatives */
.ci-pop { position: absolute; z-index: 9; width: 250px; background: var(--ink); color: var(--pap); border-radius: 10px; padding: 12px 14px; font-family: var(--sans); font-size: 12.5px; line-height: 1.4; box-shadow: 0 16px 40px rgba(0,0,0,.3); opacity: 0; transform: translateY(6px); pointer-events: none; transition: opacity .18s, transform .18s; }
.ci-pop.on { opacity: 1; transform: none; }
.ci-pop small { display: block; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: rgba(243,237,225,.6); margin-bottom: 6px; }
.ci-pop .alts { display: grid; gap: 5px; margin-top: 8px; }
.ci-pop .alt { display: grid; grid-template-columns: minmax(0, 1fr) 42px; gap: 8px; align-items: center; }
.ci-pop .alt span { font-family: var(--serif); font-size: 14px; }
.ci-pop .alt b { font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; font-size: 12px; }
.ci-pop .alt i { grid-column: 1 / -1; height: 3px; background: rgba(243,237,225,.14); position: relative; border-radius: 2px; }
.ci-pop .alt i::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: var(--w, 0%); background: var(--pap); border-radius: 2px; }
.ci-pop .alt.chosen i::after { background: var(--rust); }
.ci-pop .alt.chosen span { color: #fff; }
.ci-pop::before { content: ""; position: absolute; left: 18px; top: -5px; width: 10px; height: 10px; background: var(--ink); transform: rotate(45deg); border-radius: 2px; }
.ci-pop.above::before { top: auto; bottom: -5px; }

/* the margin: controls and the ramp */
.ci-rail { padding: 24px 24px 28px; display: flex; flex-direction: column; gap: 22px; font-family: var(--sans); }
.ci-how { font-size: 13px; line-height: 1.5; color: var(--ink); padding: 12px 14px; background: rgba(28,25,21,.05); border-radius: 8px; }
.ci-how b { font-weight: 600; }
.ci-rail h4 { margin: 0 0 10px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); font-weight: 500; }
.ci-seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--ink); border-radius: 999px; padding: 3px; gap: 3px; }
.ci-seg button { height: 32px; border: 0; border-radius: 999px; background: transparent; font-size: 12.5px; font-weight: 500; transition: background .2s, color .2s; }
.ci-seg button[aria-pressed="true"] { background: var(--ink); color: var(--pap); }
.ci-line label { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 8px; }
.ci-line label b { font-variant-numeric: tabular-nums; font-weight: 600; }
.ci-range { width: 100%; appearance: none; -webkit-appearance: none; background: transparent; height: 22px; display: block; cursor: ew-resize; margin: 0; }
.ci-range::-webkit-slider-runnable-track { height: 2px; background: linear-gradient(90deg, var(--rust) var(--p, 50%), var(--rule) 0); }
.ci-range::-moz-range-track { height: 2px; background: var(--rule); }
.ci-range::-moz-range-progress { height: 2px; background: var(--rust); }
.ci-range::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--pap); border: 2px solid var(--ink); margin-top: -7px; }
.ci-range::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--pap); border: 2px solid var(--ink); }
.ci-range:focus-visible { outline: none; }
.ci-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--rust-soft); }
.ci-ramp { height: 14px; border-radius: 3px; background: linear-gradient(90deg, rgba(28,25,21,.18), rgba(28,25,21,1)); position: relative; margin-top: 6px; }
.ci-ramp i { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--rust); left: var(--p, 60%); }
.ci-ramp-l { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-2); margin-top: 6px; }
.ci-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12.5px; }
.ci-toggle button { width: 42px; height: 24px; border-radius: 999px; border: 1px solid var(--ink); background: transparent; position: relative; padding: 0; }
.ci-toggle button::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink); transition: transform .2s; }
.ci-toggle button[aria-pressed="true"] { background: var(--ink); }
.ci-toggle button[aria-pressed="true"]::after { background: var(--pap); transform: translateX(18px); }
.ci-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ci-stat { border-top: 1px solid var(--ink); padding-top: 8px; }
.ci-stat b { display: block; font-family: var(--serif); font-size: 30px; line-height: 1; letter-spacing: -.02em; font-weight: 400; font-variant-numeric: tabular-nums; }
.ci-stat b.r { color: var(--rust); }
.ci-stat span { display: block; font-size: 11.5px; color: var(--ink-2); margin-top: 4px; line-height: 1.35; }
.ci-shaky { display: flex; flex-wrap: wrap; gap: 6px; }
.ci-shaky button { font-family: var(--serif); font-size: 14px; padding: 4px 10px; border: 1px solid var(--rule); border-radius: 999px; background: transparent; transition: border-color .2s, background .2s; }
.ci-shaky button:hover { border-color: var(--rust); background: var(--rust-soft); }
.ci-shaky button b { font-family: var(--sans); font-size: 10.5px; font-weight: 500; color: var(--rust); margin-left: 6px; font-variant-numeric: tabular-nums; }
.ci-rail .note { font-size: 11.5px; color: var(--ink-2); line-height: 1.45; margin-top: auto; }

/* key under the instrument */
.ci-key { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 10px 32px; border-top: 1px solid var(--rule); font-family: var(--sans); font-size: 11.5px; color: var(--ink-2); }
.ci-key b { color: var(--ink); font-weight: 600; }

@media (max-width: 1000px) {
  .ci { grid-template-columns: minmax(0, 1fr); }
  .ci-body { border-right: 0; border-bottom: 1px solid var(--rule); }
  .ci-rail { padding-top: 20px; }
}
@media (max-width: 640px) {
  .ci-head, .ci-body, .ci-key { padding-inline: 20px; }
  .ci-rail { padding-inline: 20px; }
  .ci-head .mast { font-size: 18px; }
  .ci-pop { width: 220px; }
}
@media (prefers-reduced-motion: reduce) {
  .ci *, .ci *::after { transition: none !important; }
}
