/* PHL Technical Toolkit. Desktop first (1920x1080). Light and dark follow the system setting.
   Colours: red = fault state (reset required), orange = burner blocked,
   blue = keeps running, and all buttons and links. */

:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --text: #1a1f26;
  --muted: #5a6472;
  --border: #d6dce4;
  --red: #c62828;
  --orange: #c45a00;
  --blue: #1d5fc4;
  --red-soft: #fdecec;
  --orange-soft: #fff1e3;
  --blue-soft: #e8f0fc;
  --on-colour: #ffffff;
  --focus: #1d5fc4;
  --radius: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --surface: #1a1f25;
    --surface-2: #232a32;
    --text: #e4e8ed;
    --muted: #9aa5b2;
    --border: #2e3640;
    --red: #f26b6b;
    --orange: #ffa24d;
    --blue: #6ea8ff;
    --red-soft: #3a1d1f;
    --orange-soft: #3a2a17;
    --blue-soft: #1a2a42;
    --on-colour: #111418;
    --focus: #6ea8ff;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
}

a { color: var(--blue); }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
code, kbd { font-family: var(--mono); font-size: 0.92em; }
kbd {
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 0.35em;
  background: var(--surface);
}
h1 { font-size: 1.6rem; margin: 1.25rem 0 0.75rem; }
h2 { font-size: 1.25rem; margin: 0 0 0.75rem; }
h3 { font-size: 1.05rem; margin: 1rem 0 0.5rem; }
h4 { font-size: 0.95rem; margin: 1rem 0 0.35rem; color: var(--muted); }
.muted { color: var(--muted); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.wrap { max-width: 1400px; margin: 0 auto; padding: 0 24px; }

/* --- header --- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-row { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.who { display: flex; align-items: center; gap: 12px; }
.who form { margin: 0; }
.role {
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted);
}
.crumbs { margin-top: 16px; font-size: 0.9rem; color: var(--muted); }

/* --- buttons and forms --- */
.button {
  display: inline-block; border: 1px solid var(--blue); border-radius: var(--radius);
  background: var(--blue); color: var(--on-colour); font: inherit; font-weight: 600;
  padding: 8px 16px; cursor: pointer; text-decoration: none;
}
.button:hover { filter: brightness(1.08); }
.button-quiet { background: transparent; color: var(--blue); padding: 4px 12px; }
input, select {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px;
}
input:focus, select:focus { border-color: var(--focus); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 24px;
}

.login { max-width: 420px; margin: 80px auto; }
.login form { display: grid; gap: 8px; }
.login label { font-weight: 600; margin-top: 8px; }
.login .button { margin-top: 16px; }
.form-error {
  color: var(--red); background: var(--red-soft); border-radius: var(--radius); padding: 8px 12px;
}

/* --- home tiles --- */
.tiles {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px;
}
.tile {
  display: block; height: 100%; padding: 24px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none;
}
a.tile { border-top: 4px solid var(--blue); }
a.tile:hover { border-color: var(--blue); }
a.tile h2 { color: var(--blue); }
.tile p { margin: 0; color: var(--muted); }
.tile-disabled { opacity: 0.6; cursor: not-allowed; border-top: 4px solid var(--border); }
.soon {
  display: inline-block; margin-top: 12px; font-size: 0.8rem; font-weight: 600;
  padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted);
}

/* --- tables --- */
.table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.table th, .table td {
  text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--border);
}
.table th { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.table .num { text-align: right; white-space: nowrap; }
.maker { margin-bottom: 20px; }

/* --- lookup page --- */
.lookup-head h1 { margin-bottom: 0.25rem; }
.lookup-head .variant { color: var(--blue); }
.lookup {
  display: grid; grid-template-columns: 460px 1fr; gap: 24px; align-items: start;
  margin: 16px 0 40px;
}
.lookup-left { position: sticky; top: 16px; display: grid; gap: 12px; }
.search { padding: 16px; display: grid; gap: 12px; }
#q { width: 100%; font-size: 1.15rem; padding: 10px 12px; }
.filters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.filters label { display: grid; gap: 4px; font-size: 0.8rem; color: var(--muted); }
.filters select { width: 100%; padding: 6px 8px; font-size: 0.9rem; }

.results {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  max-height: calc(100vh - 360px); min-height: 200px; overflow-y: auto;
}
.count { margin: 0; padding: 8px 14px; font-size: 0.85rem; border-bottom: 1px solid var(--border); }
.result-list { list-style: none; margin: 0; padding: 0; }
.result {
  display: grid; grid-template-columns: 6px 52px 1fr; gap: 10px; align-items: start;
  padding: 8px 14px 8px 0; color: var(--text); text-decoration: none;
  border-bottom: 1px solid var(--border);
}
.result:hover { background: var(--surface-2); }
.result.is-selected { background: var(--blue-soft); }
.result .bar { align-self: stretch; }
.result .code { font-family: var(--mono); font-weight: 700; font-size: 1.05rem; }
.result .causes { display: grid; gap: 2px; font-size: 0.92rem; }
.result em { font-style: normal; color: var(--muted); }
.empty { padding: 16px; }

.sev-fault_state .bar { background: var(--red); }
.sev-burner_blocked .bar { background: var(--orange); }
.sev-keeps_running .bar { background: var(--blue); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: -1px; }
.tab {
  padding: 8px 16px; text-decoration: none; font-weight: 600;
  border: 1px solid transparent; border-bottom: none; border-radius: var(--radius) var(--radius) 0 0;
}
.tab.is-active { background: var(--surface); border-color: var(--border); color: var(--text); }
.panel { border-top-left-radius: 0; min-height: 400px; }

.detail-head { display: flex; align-items: baseline; gap: 16px; }
.code-big { font-family: var(--mono); font-size: 2.4rem; margin: 0; }
.entry {
  border: 1px solid var(--border); border-left: 6px solid var(--blue);
  border-radius: var(--radius); padding: 12px 20px; margin-top: 16px;
}
.entry.sev-fault_state { border-left-color: var(--red); }
.entry.sev-burner_blocked { border-left-color: var(--orange); }
.entry-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.entry-head h3 { margin: 0; font-family: var(--mono); font-size: 1.3rem; }
.qualifier {
  font-family: var(--font); font-size: 0.95rem; font-weight: 600;
  padding: 2px 10px; border-radius: 999px; background: var(--surface-2); margin-left: 6px;
}
.badge {
  font-size: 0.85rem; font-weight: 700; padding: 3px 12px; border-radius: 999px;
  color: var(--on-colour); white-space: nowrap;
}
.badge.sev-fault_state { background: var(--red); }
.badge.sev-burner_blocked { background: var(--orange); }
.badge.sev-keeps_running { background: var(--blue); }

.facts { display: grid; grid-template-columns: 170px 1fr; gap: 6px 16px; margin: 12px 0 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.steps { margin: 0; padding-left: 1.6em; display: grid; gap: 4px; }
.steps li { padding: 2px 8px; }
.step-reset {
  background: var(--red-soft); border-left: 3px solid var(--red); border-radius: 3px; font-weight: 600;
}
.refs { margin: 0; padding-left: 1.2em; }
.note {
  background: var(--orange-soft); border-radius: var(--radius); padding: 8px 12px; margin: 12px 0 0;
}
.source { font-size: 0.9rem; color: var(--muted); margin: 12px 0 0; }
.placeholder { padding: 40px 0; text-align: center; }

.procedure { scroll-margin-top: 80px; }
.procedure:target, .procedure.flash { animation: flash 2s ease-out; }
@keyframes flash { from { background: var(--blue-soft); } to { background: transparent; } }
