/* Grayscale to match the P01 wireframes. Colors live in variables so the
   P02 visual pass can change them in one place. */
:root {
  --ink: #1f1f1f;
  --muted: #5c5c5c;
  --line: #c4c4c4;
  --panel: #f2f2f2;
  --strong: #1f1f1f;
  --focus: #000;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: #fff;
  overflow-wrap: anywhere; /* long IDs/strings wrap instead of widening the page */
}

a { color: var(--ink); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1:focus, h1:focus-visible { outline: none; } /* focused by script only */

[hidden] { display: none !important; }

/* Header */
.site-header { background: #333; padding: 14px 24px; }
.site-title { color: #fff; font-size: 1.25rem; font-weight: 700; text-decoration: none; }

main { max-width: 1100px; margin: 0 auto; padding: 24px; }
h1 { font-size: 1.75rem; margin: 0 0 16px; }

/* Search */
.search-bar label { display: block; font-weight: 600; margin-bottom: 6px; }
.search-bar input {
  width: 100%;
  max-width: 640px;
  font: inherit;
  padding: 10px 12px;
  border: 2px solid var(--muted);
  border-radius: 6px;
}
.hint { color: var(--muted); font-size: 0.85rem; margin: 6px 0 16px; }
kbd {
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 5px;
  font-size: 0.8rem;
  background: var(--panel);
}

/* Category chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip {
  font: inherit;
  font-size: 0.9rem;
  padding: 6px 14px;
  border: 1px solid var(--muted);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}
.chip:hover { background: var(--panel); }
.chip[aria-pressed="true"] { background: var(--strong); border-color: var(--strong); color: #fff; }

.result-count { color: var(--muted); font-size: 0.9rem; margin: 0 0 12px; }

/* Cards */
.procedure-list { display: grid; gap: 12px; }
.card { border: 1px solid var(--line); border-radius: 6px; padding: 16px; }
.card-title { font-size: 1.1rem; margin: 0 0 6px; }
.card-title a { text-decoration: none; }
.card-title a:hover { text-decoration: underline; }
.symptom { margin: 8px 0 0; color: var(--muted); }

.meta { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-block;
  border: 1px solid var(--muted);
  border-radius: 12px;
  padding: 1px 10px;
  font-size: 0.8rem;
}
.tag-unset { border-style: dashed; color: var(--muted); }

/* Empty / status states */
.status { color: var(--muted); }
.status.error { color: var(--ink); font-weight: 600; }
.no-results { border: 1px dashed var(--muted); border-radius: 6px; padding: 16px; }
.no-results h2 { font-size: 1.1rem; margin: 0 0 4px; }
.no-results p { margin: 0; }
.escalate-note {
  margin-top: 24px;
  padding: 12px 16px;
  border-left: 4px solid var(--strong);
  background: var(--panel);
}

/* Procedure view */
.back-link { display: inline-block; margin-bottom: 16px; }
#procedure-view .meta { margin: -8px 0 20px; }
.proc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 32px;
  align-items: start;
}
.proc-section h2 { font-size: 1.1rem; margin: 0 0 6px; }
.proc-section { margin-bottom: 20px; }
.proc-section ol, .proc-section ul { margin: 0; padding-left: 1.4em; }
.proc-section li { margin-bottom: 4px; }

/* Escalation panel: heavy border + tinted background so it reads as
   "stop and check this" rather than another step. */
.escalate-panel {
  border: 3px solid var(--strong);
  border-radius: 6px;
  background: var(--panel);
  padding: 16px;
  position: sticky;
  top: 16px;
}
.escalate-panel h2 { font-size: 1.1rem; margin: 0 0 8px; }
.escalate-panel ul { margin: 0 0 12px; padding-left: 1.2em; }
.escalate-to { margin: 12px 0 0; }
.not-defined {
  display: inline-block;
  border: 1px dashed var(--muted);
  border-radius: 4px;
  padding: 2px 8px;
  color: var(--muted);
  font-style: italic;
  background: #fff;
}

/* Narrow screens: one column, escalation panel first so it stays prominent. */
@media (max-width: 760px) {
  main { padding: 16px; }
  .site-header { padding: 14px 16px; }
  .chip { min-height: 44px; padding: 8px 16px; } /* recommended touch-target size */
  .back-link { padding: 10px 0; }
  .proc-layout { grid-template-columns: 1fr; gap: 16px; }
  .escalate-panel { order: -1; position: static; }
}

/* Hide the "/" and Esc hint on touch devices with no physical keyboard. */
@media (hover: none) and (pointer: coarse) {
  .hint { display: none; }
}
