/* The frame: the sidebar, the top bar and the view beside it. Wide: a full sidebar. Under 900 px: an icon rail. Under 600 px: a drawer behind the menu button. */

.app { display: flex; align-items: stretch; min-height: 100vh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.view { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.view:focus { outline: none; }

.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  min-height: var(--bar-height); padding: 0 16px; background: var(--pn); border-bottom: 1px solid var(--ln);
}
.top-brand { display: none; align-items: center; gap: 8px; font-weight: 700; }
.top-brand img { width: 24px; height: 24px; }
.menu-btn { display: none; }
.theme-btn { margin-left: auto; }

.side {
  position: sticky; top: 0; align-self: flex-start; flex: none; width: var(--side-width); height: 100vh;
  display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; padding: 10px 8px 0;
  background: var(--sb); border-right: 1px solid var(--ln);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 12px; }
.brand img { width: 30px; height: 30px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text b { font-weight: 700; font-size: 13.5px; letter-spacing: -0.01em; }
.brand-text small { display: flex; align-items: center; gap: 5px; color: var(--dim); font-size: 11px; }

.switcher { position: relative; }
.switcher-btn {
  width: 100%; height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 8px; text-align: left;
  border: 1px solid var(--ln); border-radius: 6px; background: var(--bg); cursor: pointer;
}
.switcher-btn:hover { border-color: var(--dim); }
.switcher-btn[disabled] { cursor: default; }
.switcher-btn[disabled]:hover { border-color: var(--ln); }
.switcher-list {
  position: absolute; left: 0; right: 0; top: 44px; z-index: 8; display: flex; flex-direction: column; gap: 1px; padding: 4px;
  background: var(--pn); border: 1px solid var(--ln); border-radius: 8px; box-shadow: var(--shd);
}
.switcher-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 0; border-radius: 6px; background: none; cursor: pointer; text-align: left; }
.switcher-item:hover { background: var(--hov); }
.switcher-item[aria-selected="true"] { background: var(--accbg); }

.nav-cap { padding: 14px 10px 4px; font: 600 10.5px/1 var(--font); letter-spacing: 0.07em; text-transform: uppercase; color: var(--dim); }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 10px; width: 100%; height: 32px; padding: 0 10px; text-align: left;
  border: 0; border-radius: 6px; background: none; color: var(--dim); font-weight: 500; cursor: pointer;
}
.nav-item:hover { background: var(--hov); color: var(--tx); }
.nav-item[aria-current="page"] { background: var(--accbg); color: var(--tx); font-weight: 700; }
.nav-item[aria-current="page"] svg { color: var(--acct); }
.nav-item[aria-current="page"]::before, .nav-page[aria-current="page"]::before {
  content: ""; position: absolute; left: -8px; top: 5px; bottom: 5px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accm);
}
.nav-addon { height: 30px; font-size: 12.5px; padding-left: 12px; }
.nav-addon .chevron { margin-left: auto; display: inline-flex; flex: none; }
.nav-addon[aria-expanded="true"] .chevron svg { transform: rotate(180deg); }
.nav-page {
  position: relative; display: flex; align-items: center; height: 28px; margin-left: 28px; padding: 0 10px;
  border-radius: 6px; color: var(--dim); font-size: 12.5px; font-weight: 500;
}
.nav-page:hover { background: var(--hov); color: var(--tx); }
.nav-page[aria-current="page"] { background: var(--accbg); color: var(--tx); font-weight: 700; }
.nav-off { opacity: 0.62; cursor: not-allowed; }
.nav-off:hover { background: none; color: var(--dim); }
.nav-future { margin-left: auto; padding: 0 5px; border: 1px solid var(--ln2); border-radius: 4px; color: var(--dim); font-size: 10px; font-weight: 700; line-height: 15px; }

/* The foot of the sidebar stays in view whatever the nodes block holds: when the sidebar is too short for everything, the sections above it scroll beneath it. */
.side-bottom { position: sticky; bottom: 0; z-index: 2; margin-top: auto; padding: 8px 0 8px; display: flex; flex-direction: column; gap: 3px; border-top: 1px solid var(--ln); background: var(--sb); }
.node-block { display: flex; flex-direction: column; gap: 4px; padding: 7px 10px; border: 1px solid var(--ln); border-radius: 6px; background: var(--pn); }
.node-line { display: flex; align-items: center; gap: 10px; min-width: 0; }
.node-line .two { flex: 1; }
/* The state word keeps its own width and never wraps; what follows it shortens with an ellipsis, and the card's tooltip holds the whole. */
.node-state { display: flex; align-items: center; min-width: 0; }
.node-state .status { flex: none; font-size: 11px; }
.node-detail { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-state .status + .node-detail::before { content: "\00b7"; margin: 0 5px; }
.node-detail.is-warning { color: var(--wn); }
.node-detail.is-bad { color: var(--bd); }
.node-note { margin: 0; color: var(--dim); font-size: 11px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The line that says why the browser's card is gone carries a link, so it wraps rather than cut the link off. */
.node-note.node-aside { white-space: normal; overflow: visible; }
.node-note.node-purpose.is-whole { white-space: normal; overflow: visible; }
/* A failed node's reason is the one thing the person needs, so it wraps (to three lines; the tooltip holds the rest), and a refused permission, which says what to do, is never cut. */
.node-note.node-problem { color: var(--bd); white-space: normal; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.node-note.node-problem.is-whole { display: block; overflow: visible; }
.node-more > summary { display: flex; align-items: center; gap: 6px; min-height: 18px; list-style: none; cursor: pointer; font-size: 11px; line-height: 1.35; }
.node-more > summary::-webkit-details-marker { display: none; }
.node-more > summary .status { min-width: 0; font-weight: 500; }
.node-more > summary .status:not(:first-child) { flex: none; }
.node-more > summary .chevron { margin-left: auto; display: inline-flex; color: var(--dim); }
.node-more[open] > summary .chevron svg { transform: rotate(180deg); }
/* Closed, the line is the reach in short; open, the reach is written out below, so the line names what is below instead of saying it twice. */
.node-more-label { display: none; color: var(--dim); font-weight: 500; }
.node-more[open] > summary > .node-more-label { display: inline; }
.node-more[open] > summary > .status, .node-more[open] > summary > .web2 { display: none; }
/* Opened, the lines scroll inside the card rather than push the foot of the sidebar out of the window. */
.node-more-body { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; max-height: 30vh; overflow-y: auto; }
.node-reach, .node-identity, .node-body-state { margin: 0; font-size: 11px; line-height: 1.35; }
.node-reach .status, .node-identity .status, .node-body-state .status { align-items: flex-start; font-weight: 500; white-space: normal; }
.node-reach .status i, .node-identity .status i, .node-body-state .status i { margin-top: 4px; }
.node-reach-extra, .node-identity-extra, .node-body-extra { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0; font-size: 11px; line-height: 1.35; }
.node-fix { color: var(--acct); text-decoration: underline; white-space: nowrap; }
/* The relay link keeps its own line; the Web2 word and mark that go with it drop under it when the card is too narrow for all three. */
.node-reach-extra .web2, .node-body-extra .web2 { flex-wrap: wrap; gap: 4px 6px; }
.node-actions { display: flex; align-items: center; gap: 8px; }
.node-actions .btn { flex: 1; }

.scrim { display: none; }

@media (max-width: 899px) {
  .side { width: 64px; padding: 10px 6px 0; }
  .side:not(.open) .side-label { display: none; }
  .side:not(.open) .brand { justify-content: center; padding: 4px 0 10px; }
  .side:not(.open) .switcher-btn { justify-content: center; padding: 0; }
  .side:not(.open) .nav-cap { height: 1px; padding: 0; margin: 10px 8px; background: var(--ln); font-size: 0; }
  .side:not(.open) .nav-item { justify-content: center; padding: 0; }
  .side:not(.open) .nav-item[aria-current="page"]::before { left: -6px; }
  .side:not(.open) .switcher-list, .side:not(.open) .addon-nav { display: none; }
  .side:not(.open) .node-block { padding: 6px 0; align-items: center; border: 0; background: none; }
  .side:not(.open) .node-line { justify-content: center; }
  .side:not(.open) .node-line .two { flex: none; }
}

@media (max-width: 599px) {
  .side { display: none; }
  .side.open { display: flex; position: fixed; left: 0; top: 0; z-index: 70; width: 252px; box-shadow: var(--shd); }
  .scrim { position: fixed; inset: 0; z-index: 65; border: 0; padding: 0; background: var(--scrim); }
  .scrim.open { display: block; }
  .menu-btn { display: inline-grid; }
  .top-brand { display: inline-flex; }
}

/* The mark of a node (ui/node-mark.js): a picture in a square, and for IPFS Node (on-fly) a round badge with a bolt in its corner, drawn here so it needs no picture of its own. */
.node-mark { position: relative; display: inline-flex; flex: none; width: var(--mark, 22px); height: var(--mark, 22px); }
.node-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }
.node-mark-swarm img, .node-mark-picture img { border-radius: 5px; }
.node-mark-badge { position: absolute; right: -4px; bottom: -4px; width: 52%; height: 52%; border-radius: 50%; background: var(--acc); box-shadow: 0 0 0 2px var(--pn); }
.node-mark-badge::after { content: ""; position: absolute; inset: 18%; background: var(--on-acc); clip-path: polygon(58% 0, 14% 56%, 46% 56%, 38% 100%, 86% 40%, 54% 40%); }
