/* Sundial component styles — dock, badge, modal, and shared widgets.
 * Flat per the design system: depth = border + surface tone only. */

/* ---- bottom dock ---- */

#dock-slot { display: contents; }

.dock {
  position: fixed;
  left: 50%;
  translate: -50% 0;
  bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  gap: var(--space-3);
  max-width: calc(100vw - 2 * var(--space-3));
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-sheet);
  z-index: 20;
}

.dock-badge {
  display: inline-flex;
  border-radius: var(--radius-glyph);
}

fs-shard-badge {
  position: relative;
  display: inline-flex;
  width: 110px;
  height: 30px;
  flex: none;
}

fs-shard-badge .badge-content {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

fs-shard-badge .badge-content img { height: 17px; }
fs-shard-badge .badge-content .mono { font-size: 13px; color: var(--line); }
fs-shard-badge .badge-content i { display: inline-block; width: .45em; }

.dock-nav, .dock-utils {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.dock-item {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 10px;
  border: var(--border-w) solid transparent;
  border-radius: var(--radius-control);
  background: none;
  color: var(--ink-muted);
  font: 400 11px/1 var(--font-ui);
  text-decoration: none;
  cursor: pointer;
}

.dock-item:hover { color: var(--ink); border-color: var(--border); }

.dock-item--active {
  color: var(--line);
  border-color: var(--border-cool);
}

.dock-item .icon { display: block; }

.dock-status {
  position: relative;
  display: inline-flex;
  padding: 6px;
  border: none;
  background: none;
  border-radius: var(--radius-control);
  cursor: default;
}

.dock-status--warn { color: var(--accent); }
.dock-status--danger { color: var(--danger); }

.dock-classic { color: var(--ink-muted); font-size: 11px; }

@media (max-width: 640px) {
  .dock { gap: var(--space-2); padding: var(--space-1) var(--space-2); bottom: var(--space-2); }
  .dock-label { display: none; }
  .dock-badge { display: none; }
  .dock-item { padding: 8px; }
}

/* ---- page recede under modals (DECISIONS: veil + mild desaturation) ---- */

.page-receded {
  filter: grayscale(0.5);
  opacity: 0.45;
  pointer-events: none;
  user-select: none;
}

/* ---- modal ---- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  overflow-y: auto;
}

.modal-sheet {
  background: var(--surface);
  border: var(--border-w) solid var(--border-cool);
  border-radius: var(--radius-sheet);
  padding: var(--space-5);
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 2 * var(--space-4));
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.modal-sheet--lg { max-width: 760px; }

.modal-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}
.modal-title h2 { margin: 0; }

.modal-close {
  border: none;
  background: none;
  color: var(--ink-muted);
  font-size: 15px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-control);
}
.modal-close:hover { color: var(--ink); }

.modal-body { display: flex; flex-direction: column; gap: var(--space-3); }
.modal-body p { margin: 0; }
/* Most callers build the body as a single wrapper div (innerHTML'd) that
   openModal() appends as bodyEl's one child, rather than passing content
   as bodyEl's direct children — so the gap above has no siblings to apply
   between in those cases. Give that wrapper the same treatment so spacing
   applies either way. */
.modal-body > div { display: flex; flex-direction: column; gap: var(--space-3); }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}
.modal-footer > div { display: flex; gap: var(--space-2); }

/* ---- shard-down overlay: reuses .modal-overlay/.modal-sheet (same dimming,
   same z-index layer) but isn't a modal — no close affordance, it only
   clears when the websocket actually reconnects. */

.shard-down-sheet {
  align-items: center;
  text-align: center;
  max-width: 420px;
}

.shard-down-sheet h2 { margin: 0; }
.shard-down-message { max-width: 40ch; }

/* ---- feedback ---- */

.feedback-text { max-width: none; } /* resize: vertical comes from the general textarea.fs-input rule below */
.feedback-note { font-size: var(--fs-small); }

/* ---- generic bits ---- */

.icon { flex: none; }

textarea.fs-input { line-height: 1.45; resize: vertical; }

.fs-btn { display: inline-flex; align-items: center; gap: 6px; }

/* alert sheet — bordered note, kind encoded by border colour */
.alert {
  border: var(--border-w) solid var(--border-cool);
  border-radius: var(--radius-control);
  padding: var(--space-3) var(--space-4);
  font-size: var(--fs-small);
}
.alert--warn { border-color: var(--accent); }
.alert--danger { border-color: var(--danger); color: var(--danger); }
.alert--info { border-color: var(--border-cool); }
.alert a { color: inherit; }

/* ---- banner strip ---- */

.banner {
  padding: var(--space-2) var(--space-4);
  text-align: center;
  font-size: var(--fs-small);
  border-bottom: var(--border-w) solid var(--border);
  background: var(--surface);
}
.banner--warning { border-bottom-color: var(--accent); }
.banner--danger { border-bottom-color: var(--danger); }
.banner p { margin: 0; }

/* ---- update banner — sticky, loud, persists until the user refreshes.
   Replaces the old dock icon-only notice (hover-tooltip, no text, invisible
   on touch); stays pinned to the top of the viewport across every route so
   it can't be scrolled past the way a toast can be missed. ---- */

.update-banner {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  background: var(--surface);
  border-bottom: var(--border-w) solid var(--accent);
  font-size: var(--fs-small);
  text-align: center;
}

.update-banner__refresh { flex: none; }
