/* Paper v5 — tool layer: global index, quickbar, packing helpers. */

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

.index-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

.index-trigger:hover {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.index-trigger svg {
  width: 14px;
  height: 14px;
}

.index-trigger kbd {
  padding: 0 4px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.5;
}

/* ---------- global index ---------- */

.index-search {
  width: min(900px, calc(100vw - 28px));
  max-height: min(84vh, 780px);
  padding: 0;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 34px 100px rgba(25, 25, 22, 0.28);
}

.index-search::backdrop {
  background: rgba(25, 25, 22, 0.52);
  backdrop-filter: blur(5px);
}

.index-search-panel {
  display: flex;
  max-height: min(84vh, 780px);
  flex-direction: column;
}

.is-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 26px 16px;
  border-bottom: 1px solid var(--line);
}

.is-kicker {
  color: var(--red-dark);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.is-head h2 {
  margin-top: 5px;
  font-family: var(--serif);
  font-size: clamp(1.8rem, 3.2vw, 2.6rem);
  font-weight: 520;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.is-close {
  flex: none;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.05em;
}

.is-close:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.is-field {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 26px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--ink);
}

.is-field svg {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--muted);
}

.is-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: clamp(19px, 2.4vw, 26px);
  font-weight: 500;
  letter-spacing: -0.03em;
}

.is-field input::placeholder {
  color: var(--muted);
}

.is-field kbd {
  flex: none;
  padding: 1px 5px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
}

.is-hint {
  margin: 10px 26px 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
}

.is-results {
  overflow-y: auto;
  padding: 4px 26px 18px;
  overscroll-behavior: contain;
}

.is-group {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-top: 14px;
  padding: 9px 0 7px;
  border-top: 1px solid var(--line-strong);
  color: var(--red-dark);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.is-group span:last-child {
  color: var(--muted);
}

.is-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.is-result.is-active {
  background: rgba(213, 71, 42, 0.055);
  box-shadow: inset 3px 0 0 var(--red);
}

.is-result-main {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 12px 8px;
  color: var(--ink);
}

.is-type {
  padding-top: 3px;
  color: var(--red-dark);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.04em;
}

.is-result-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.is-result-copy b {
  overflow: hidden;
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 540;
  letter-spacing: -0.02em;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.is-result-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.is-result-meta {
  padding-top: 3px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.is-copy-btn {
  margin-right: 8px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.is-copy-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.is-empty {
  display: grid;
  gap: 6px;
  min-height: 160px;
  place-content: center;
  text-align: center;
  color: var(--muted);
}

.is-empty b {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 520;
}

.is-empty span {
  font-size: 12px;
}

.is-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 26px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

/* ---------- quickbar ---------- */

.quickbar {
  position: fixed;
  top: var(--head-h);
  right: 0;
  left: 0;
  z-index: 54;
  border-bottom: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  box-shadow: 0 10px 30px rgba(25, 25, 22, 0.06);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-100%);
  transition:
    opacity 0.2s ease,
    transform 0.25s var(--ease-out),
    visibility 0s 0.25s;
  backdrop-filter: blur(14px);
}

.quickbar.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition:
    opacity 0.2s ease,
    transform 0.25s var(--ease-out),
    visibility 0s;
}

@media (min-width: 1181px) {
  .quickbar {
    right: var(--folio-w);
  }
}

.quickbar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  width: min(calc(100% - 2 * var(--pad)), 1360px);
  margin-inline: auto;
}

.qb-label {
  flex: none;
  padding-right: 12px;
  border-right: 1px solid var(--line);
  color: var(--red-dark);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.qb-search-field {
  display: flex;
  min-width: 0;
  max-width: 420px;
  flex: 1;
  align-items: center;
  gap: 8px;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--line-strong);
}

.qb-search-field svg {
  width: 13px;
  height: 13px;
  flex: none;
  color: var(--muted);
}

.qb-search {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13px;
}

.qb-select {
  max-width: 170px;
  min-height: 30px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 8.5px;
}

.qb-count {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  white-space: nowrap;
}

.qb-global,
.qb-action,
.qb-step {
  flex: none;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.03em;
}

.qb-global:hover,
.qb-action:hover,
.qb-step:hover {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.qb-progress {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  font-family: var(--mono);
}

.qb-progress b {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 520;
}

.qb-progress small {
  color: var(--muted);
  font-size: 8px;
}

.qb-note {
  color: var(--red-dark);
  font-family: var(--mono);
  font-size: 8px;
  white-space: nowrap;
}

.qb-plate {
  color: var(--red-dark);
  font-family: var(--serif);
  font-size: 1.2rem;
}

.qb-plate-name {
  overflow: hidden;
  max-width: 320px;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- checklist tools ---------- */

.check-find {
  display: grid;
  gap: 4px;
  margin-top: 10px;
}

.check-find-label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.check-find input {
  width: 100%;
  padding: 6px 0;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  outline: 0;
  background: transparent;
  font-size: 14px;
}

.check-find input:focus {
  border-color: var(--red);
}

.check-empty {
  padding: 24px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.check-empty button {
  margin-top: 8px;
}

.check-row.is-target {
  background: rgba(213, 71, 42, 0.08);
  box-shadow: inset 3px 0 0 var(--red);
}

@media (max-width: 760px) {
  .index-trigger span,
  .index-trigger kbd {
    display: none;
  }

  .index-trigger {
    width: 38px;
    padding: 0;
  }

  .is-head,
  .is-field,
  .is-hint,
  .is-results,
  .is-foot {
    padding-inline: 18px;
  }

  .is-field {
    margin-inline: 18px;
    padding-inline: 0;
  }

  .is-hint {
    margin-inline: 18px;
  }

  .is-result-main {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .is-result-meta {
    display: none;
  }

  .quickbar-inner {
    gap: 8px;
    padding-inline: 14px;
  }

  .qb-label,
  .qb-count,
  .qb-plate-name {
    display: none;
  }

  .qb-search-field {
    max-width: none;
  }

  .qb-select {
    max-width: 106px;
  }

  .qb-action {
    padding-inline: 7px;
    font-size: 8px;
  }

  .qb-global {
    padding-inline: 7px;
  }
}

@media (max-width: 520px) {
  .quickbar-inner {
    flex-wrap: nowrap;
  }

  .qb-select {
    display: none;
  }

  .qb-note {
    font-size: 7.5px;
  }
}

@media print {
  .index-trigger,
  .quickbar,
  .index-search {
    display: none !important;
  }
}
.is-field input::-webkit-search-cancel-button,
.is-field input::-webkit-search-decoration,
.qb-search::-webkit-search-cancel-button,
.check-find input::-webkit-search-cancel-button {
  display: none;
}

.check-jump {
  display: inline-flex;
  margin: -8px 0 10px 44px;
  padding-bottom: 1px;
  border-bottom: 1px solid var(--red-dark);
  color: var(--red-dark);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.03em;
}

.check-jump:hover {
  border-color: var(--red);
  color: var(--red);
}

.link-note-inner a {
  color: var(--red-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.qa-copy {
  margin-left: auto;
  padding: 3px 7px;
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.03em;
}

.qa-copy:hover {
  border-color: var(--red);
  color: var(--red);
}

@media print {
  html.print-current .cat-section[hidden],
  html.print-current .check-row[hidden] {
    display: none !important;
  }
}

@media (max-width: 760px) {
  .quickbar-inner {
    min-height: 52px;
  }

  .qb-global,
  .qb-action,
  .qb-step {
    min-height: 36px;
  }

  .qb-search-field {
    padding-block: 6px;
  }
}

html.index-open,
html.index-open body {
  overflow: hidden;
}

.hero-shuffle {
  margin-top: 10px;
  padding: 2px 0;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
}

.hero-shuffle:hover {
  border-color: var(--red);
  color: var(--red);
}

.hero-figure.is-living .plate-canvas {
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.hero-figure.is-living .plate-canvas img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-headline-switch {
  align-self: center;
  padding: 2px 0;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
}

.hero-headline-switch:hover {
  border-color: var(--red);
  color: var(--red);
}
