/* SENTINEL v12 — application shell: masthead, tabs, banners, drawer,
   command palette, footer, boot screen. */

/* ── masthead ─────────────────────────────────────────────────────── */
.mast {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--ink) 90%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.mast-row { display: flex; flex-wrap: nowrap; align-items: center; gap: var(--s-3) var(--s-5); padding-block: 14px 10px; min-height: 64px; }
.mast-row > * { flex: none; }
.mark { display: inline-flex; align-items: center; gap: 10px; color: var(--paper); text-decoration: none; }
.mark:hover { color: var(--paper); }
.wordmark { font-family: var(--f-display); font-size: var(--t-22); font-weight: 500; letter-spacing: 0.01em; }
.tlp { font-family: var(--f-data); font-size: var(--t-12); font-weight: 600; letter-spacing: .04em; border: 1px solid var(--paper); border-radius: 3px; padding: 0 7px; line-height: 1.6; }
.utc { font-family: var(--f-data); font-size: var(--t-14); color: var(--fog); font-variant-numeric: tabular-nums; }
.utc span { color: var(--paper); }

/* v12.2.1: feed health is one indicator; the full list opens beneath it */
.health-anchor { position: relative; margin-left: auto; }
.health-pop {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 60; width: min(480px, calc(100vw - 32px));
  background: var(--slate); border: 1px solid var(--rule-2); border-radius: var(--radius-lg); box-shadow: var(--shadow-float);
  padding: var(--s-4) var(--s-5) var(--s-5);
}
.health-pop[hidden] { display: none; }
.health-pop-h { font-size: var(--t-12); font-weight: 700; letter-spacing: var(--track-label, .08em); text-transform: uppercase; color: var(--paper); margin-bottom: var(--s-3); }
.health-pop-h span { display: block; margin-top: 2px; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--mist); }
.health { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px var(--s-4); list-style: none; }
.health li { display: flex; align-items: center; gap: 8px; font-size: var(--t-13); color: var(--fog); min-width: 0; }
.health li .h-word { margin-left: auto; font-family: var(--f-data); font-size: var(--t-12); color: var(--mist); }
.health .pip { width: 7px; height: 7px; border-radius: 50%; background: var(--rule-2); flex: none; }
.health li.ok .pip { background: var(--ok); }
.health li.down { color: var(--sev-high); }
.health li.down .h-word { color: var(--sev-high); }
.health li.down .pip { background: transparent; border: 1.5px solid var(--sev-crit); }
.health li.wait .pip { background: var(--rule-2); }

.palette-btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--rule-2); background: var(--ink-2); color: var(--fog);
  border-radius: var(--radius); padding: 5px 8px 5px 10px; font-size: var(--t-13);
}
.palette-btn:hover { color: var(--paper); border-color: var(--fog); }

.tabs { display: flex; }
.tabs-scroll { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; margin-inline: -10px; }
.tabs-scroll::-webkit-scrollbar { display: none; }
.tabs a {
  position: relative; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 10px 12px 12px; color: var(--fog); text-decoration: none;
  font-size: var(--t-14); font-weight: 600;
  transition: color var(--t-fast) var(--ease);
}
.tabs a:hover { color: var(--paper); }
.tabs a::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 2px; border-radius: 2px; background: transparent; transition: background var(--t-mid) var(--ease); }
.tabs a[aria-current="page"] { color: var(--paper); }
.tabs a[aria-current="page"]::after { background: var(--amber); }
.tab-n { font-family: var(--f-data); font-size: var(--t-12); font-weight: 500; color: var(--mist); }
.tab-n:empty { display: none; }

@media (max-width: 1100px) { .palette-btn kbd { display: none; } }
@media (max-width: 760px) { .utc { display: none; } }
@media (max-width: 560px) {
  .mast-row { flex-wrap: wrap; gap: var(--s-2) var(--s-3); min-height: 0; }
  .health-anchor { order: 5; width: 100%; margin-left: 0; }
  .health-pop { left: 0; right: auto; width: 100%; }
  .health { grid-template-columns: minmax(0, 1fr); }
  .mast-tools { margin-left: auto; }
  .palette-btn span { display: none; }
  .mast { position: static; }
}

/* ── integrity banner ─────────────────────────────────────────────── */
.integrity {
  margin-top: var(--s-4);
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s-3);
  padding-block: var(--s-3);
  border: 1px solid color-mix(in srgb, var(--sev-high) 50%, transparent);
  border-radius: var(--radius-lg);
  background: rgba(255, 154, 77, .06);
  font-size: var(--t-14);
}
.integrity[hidden] { display: none !important; }
.integrity b { color: var(--sev-high); }
.integrity .sub { color: var(--fog); font-size: var(--t-13); }

/* ── boot screen (pure CSS fallback if the app never starts) ─────── */
.boot { padding-block: 18vh; }
.boot-msg { font-family: var(--f-display); font-size: var(--t-28); color: var(--fog); }
.boot-fail { margin-top: var(--s-4); max-width: 56ch; color: var(--sev-high); opacity: 0; animation: bootfail 0s linear 9s forwards; }
@keyframes bootfail { to { opacity: 1; } }

/* ── footer ───────────────────────────────────────────────────────── */
.foot { border-top: 1px solid var(--rule); margin-top: var(--s-7); padding-block: var(--s-6) var(--s-7); font-size: var(--t-13); color: var(--fog); }
.foot-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--s-6); }
.foot p + p { margin-top: var(--s-3); }
.foot-lede { font-family: var(--f-display); font-size: var(--t-18); color: var(--paper); line-height: 1.45; }
.foot-h { font-weight: 700; color: var(--paper); }
@media (max-width: 800px) { .foot-grid { grid-template-columns: minmax(0, 1fr); } }

/* ── drawer ───────────────────────────────────────────────────────── */
.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(2, 4, 7, .62); backdrop-filter: blur(2px); }
.drawer {
  position: fixed; z-index: 61; top: 0; right: 0; bottom: 0;
  width: min(560px, 100vw);
  background: var(--slate);
  border-left: 1px solid var(--rule-2);
  box-shadow: var(--shadow-float);
  overflow-y: auto;
  padding: var(--s-6) var(--s-6) var(--s-7);
  padding-top: max(var(--s-6), env(safe-area-inset-top, 0px));
}
@media (prefers-reduced-motion: no-preference) {
  .drawer:not([hidden]) { animation: slidein var(--t-mid) var(--ease) both; }
  @keyframes slidein { from { transform: translateX(24px); opacity: .001; } to { transform: none; opacity: 1; } }
}
.drawer-close { position: absolute; top: 16px; right: 16px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--rule-2); background: var(--ink-2); color: var(--fog); display: grid; place-items: center; }
.drawer-close:hover { color: var(--paper); border-color: var(--fog); }
.drawer h2 { font-family: var(--f-display); font-weight: 500; font-size: var(--t-28); line-height: 1.2; padding-right: 44px; overflow-wrap: anywhere; }
.drawer .d-sub { color: var(--fog); margin-top: 4px; }
.drawer section { margin-top: var(--s-5); }
.drawer section > h3 { font-size: var(--t-12); font-weight: 700; text-transform: uppercase; letter-spacing: var(--track-label); color: var(--fog); margin-bottom: var(--s-2); }
.drawer p { line-height: var(--lh-body); }
@media (max-width: 560px) { .drawer { padding-inline: var(--s-4); } }

/* ── command palette ─────────────────────────────────────────────── */
.palette { position: fixed; inset: 0; z-index: 70; background: rgba(2, 4, 7, .66); display: grid; justify-items: center; align-items: start; padding: 12vh 16px 16px; }
.palette-box { width: min(680px, 100%); background: var(--slate); border: 1px solid var(--rule-2); border-radius: var(--radius-lg); box-shadow: var(--shadow-float); overflow: hidden; }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--rule); background: transparent; padding: 16px 18px; font-size: var(--t-18); color: var(--paper); }
.palette input:focus { outline: none; }
.palette ul { list-style: none; max-height: 52vh; overflow-y: auto; }
.palette li { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 12px; padding: 10px 18px; cursor: pointer; align-items: baseline; }
.palette li[aria-selected="true"] { background: var(--slate-2); box-shadow: inset 3px 0 0 var(--amber); }
.palette li .k { font-family: var(--f-data); font-size: var(--t-12); color: var(--mist); text-transform: uppercase; letter-spacing: .04em; }
.palette li .t { overflow-wrap: anywhere; }
.palette li .t small { display: block; color: var(--fog); font-size: var(--t-13); }
.palette-hint { padding: 10px 18px; font-size: var(--t-12); color: var(--mist); border-top: 1px solid var(--rule); }
.palette .none { padding: 18px; color: var(--fog); }

/* ── toast (copy confirmations) ───────────────────────────────────── */
.toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 80; background: var(--paper); color: var(--ink); font-weight: 600; font-size: var(--t-14); padding: 8px 16px; border-radius: 999px; box-shadow: var(--shadow-float); }

/* health indicator */
.health-sum { display: inline-flex; align-items: center; gap: 8px; background: none; border: 1px solid transparent; border-radius: 999px; padding: 5px 12px; font: inherit; font-size: var(--t-13); color: var(--fog); cursor: pointer; white-space: nowrap; transition: border-color var(--t-fast), color var(--t-fast); }
.health-sum:hover, .health-sum[aria-expanded="true"] { border-color: var(--rule-2); color: var(--paper); }
.health-sum .pip { width: 8px; height: 8px; border-radius: 50%; background: var(--rule-2); flex: none; }
.health-sum.ok .pip { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent); }
.health-sum.down { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 45%, transparent); }
.health-sum.down .pip { background: var(--amber); }
.health-sum::after { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); opacity: .6; transition: transform var(--t-fast); }
.health-sum[aria-expanded="true"]::after { transform: translateY(1px) rotate(225deg); }
@media (max-width: 560px) { .health-sum { padding-inline: 0; border: 0; } }

/* v12.6: full-screen Wall: the site chrome steps aside */
body.is-wall .mast, body.is-wall .tabs, body.is-wall .foot, body.is-wall footer, body.is-wall #integrity, body.is-wall .skip { display: none !important; }
body.is-wall main { padding: 0; max-width: none; }
