/* PF-04 Speed Bump. Page styles for the setup page and the checkpoint.
   Loaded after shared/style.css. */

/* ---- Setup page ---- */

.lead { line-height: 1.5; margin-bottom: 1.5rem; }

.preset-fieldset { margin-top: 0; }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 6.75rem), 1fr)); gap: .5rem; margin-top: .6rem; }
.preset-tile {
  padding: .6rem .4rem;
  font-size: .8rem;
  letter-spacing: .03em;
  text-transform: none;
  min-height: 2.75rem;
  background: var(--bg);
  overflow-wrap: anywhere;
  -webkit-tap-highlight-color: transparent;
}
.preset-tile[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.preset-tile[aria-pressed="true"]::before { content: "✓ "; }

.sub-field { padding-left: 1.75rem; margin-bottom: .5rem; }
.sub-field label { margin-top: .25rem; }

/* A link that does what a button does, drawn as one. */
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: .6rem 1.1rem;
  border: 2px solid var(--text);
  font-family: var(--mono);
  font-size: .875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  background: transparent;
}
.button-link:hover { background: var(--text); color: var(--bg); }

/* The panel shown once a checkpoint is issued. */
.next-panel { border: 2px solid var(--text); background: var(--panel); padding: 1rem 1.25rem 1.25rem; }
.next-panel h2:focus { outline: none; }
.next-panel h2:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.next-panel .notice { background: var(--bg); }
.next-steps-list { list-style: none; padding: 0; margin: 1rem 0; counter-reset: next; }
.next-steps-list > li { counter-increment: next; display: grid; grid-template-columns: 2.25rem 1fr; column-gap: .25rem; align-items: start; border-top: 1px solid var(--rule); padding: .75rem 0; margin: 0; }
.next-steps-list > li::before { content: counter(next, decimal-leading-zero); font-family: var(--mono); font-weight: 700; padding-top: .1rem; }
.next-steps-list > li > * { grid-column: 2; }
.next-steps-list p { margin: 0; }
.next-steps-list .button-link { margin-top: .6rem; justify-self: start; }
.other-devices summary {
  display: list-item;
  padding: .75rem 0;
  cursor: pointer;
  font-family: var(--mono);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.other-devices p { font-size: 1rem; }

/* Checkpoints on file, one card each. */
.bump-cards { list-style: none; padding: 0; display: grid; gap: .75rem; }
.bump-card { border: 1px solid var(--rule); background: var(--panel); padding: .85rem 1rem 1rem; margin: 0; break-inside: avoid; }
.bump-card h3 { margin: 0 0 .2rem; }
.bump-card p { margin: 0; }
.card-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin-top: .75rem; max-width: 26rem; }
.card-actions > button, .card-actions > a { padding: .5rem .4rem; font-size: .8rem; min-height: 2.75rem; }
button.quiet { border-color: var(--muted); color: var(--muted); }
button.quiet:hover { background: var(--text); border-color: var(--text); color: var(--bg); }
.copy-field label { margin-top: .75rem; }

/* ---- Checkpoint page ---- */

.checkpoint-page .page-header { padding-bottom: 1rem; margin-bottom: 1.25rem; }
.checkpoint-name { font-size: clamp(2.5rem, 12vw, 4rem); line-height: 1.05; letter-spacing: -.03em; margin-bottom: .4rem; overflow-wrap: anywhere; }
.checkpoint-page .page-header #visits { margin-bottom: .75rem; }
.checkpoint-page .record-block { font-size: .7rem; padding: .4rem 0; margin-bottom: 0; color: var(--muted); }
.checkpoint-page .record-block dl { display: flex; flex-wrap: wrap; gap: 0 .5em; }
.checkpoint-page .record-block dd + dt::before { content: "· "; }

/* Pattern choice: a compact grid of names, one definition below. */
.pattern-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; margin-top: .6rem; }
.pattern-option {
  display: flex;
  align-items: center;
  gap: .45rem;
  min-height: 2.75rem;
  margin: 0;
  padding: .35rem .55rem;
  border: 1px solid var(--rule);
  background: var(--bg);
  font-family: var(--sans);
  font-size: .9375rem;
  line-height: 1.2;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pattern-option:has(input:checked) { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.pattern-option .pattern-number { font-family: var(--mono); font-size: .8rem; color: var(--muted); }
.pattern-option .pattern-name { font-weight: 500; overflow-wrap: normal; word-break: normal; hyphens: manual; }
.pattern-option { min-width: 0; }
@media (max-width: 400px) { .pattern-option .pattern-name { font-size: .95rem; } }
.pattern-definition { font-style: italic; color: var(--muted); margin: .75rem 0 0; min-height: 3.2em; }
.pattern-definition.chosen { color: var(--text); }
.pattern-definition em { font-style: italic; font-weight: 600; }

/* The wait: a quiet rule that drains. */
.wait { margin: 0 0 .75rem; }
.wait-rule { height: 3px; background: var(--rule); overflow: hidden; }
.wait-fill { height: 100%; width: 100%; background: var(--text); transition-property: width; transition-timing-function: linear; }
.wait-fill.draining { width: 0; }
.wait-count { margin: .35rem 0 0; font-size: .8rem; }
.wait-over .wait-rule { display: none; }
.wait-over .wait-count { color: var(--text); margin-top: 0; }

.protocol-responses { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin: 0; }
.protocol-responses > button { width: 100%; padding: .7rem .5rem; }
.protocol-responses > #continue { grid-column: 1 / -1; }
.protocol-responses > #delay[hidden] + #notNow { grid-column: 1 / -1; }

@media (max-width: 600px) {
  /* Responses stay in reach at the foot of the screen. Focused fields are
     scrolled clear of the bar, not under it. */
  html:has(body.checkpoint-page) { scroll-padding-bottom: 11rem; }
  .respond-bar {
    position: sticky;
    bottom: 0;
    z-index: 5;
    margin: 1.5rem -1.25rem 0;
    padding: .6rem 1.25rem calc(.75rem + env(safe-area-inset-bottom));
    border: 0;
    border-top: 2px solid var(--text);
    background: var(--bg);
  }
  .respond-bar legend { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .respond-bar .wait { margin-bottom: .5rem; }
  .protocol-responses > button { font-size: .8rem; letter-spacing: .03em; }
  .page-header .tool-icon { width: 2.5rem; height: 2.5rem; margin-bottom: .6rem; }
  .preset-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .next-panel { padding: .85rem 1rem 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .wait-fill { transition: none; }
}

@media print {
  .next-panel, .preset-fieldset, .card-actions, .respond-bar { display: none; }
}
