/* App shell: three-column grid, sidebar, and right detail panel chrome. */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(109, 127, 164, .05) 1px, transparent 1px),
    linear-gradient(rgba(109, 127, 164, .05) 1px, transparent 1px),
    var(--bg);
  background-size: 22px 22px;
  font-family: var(--font-sans);
}
button, a { font: inherit; }
a { color: inherit; }

.app {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr) 300px;
  height: 100vh;
  min-height: 0;
}

.left, .right {
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 5;
  background: rgba(249, 251, 255, .66);
  backdrop-filter: blur(10px);
}
.left  { padding: 20px; border-right: 1px solid var(--line); overflow: auto; }
.right { padding: 16px; border-left: 1px solid var(--line); overflow: auto; }
.mobile-detail-head { display: none; }

/* --- Sidebar --- */
.brand { font-weight: 800; letter-spacing: -.03em; }
.sub {
  font: 12px var(--font-mono);
  color: var(--muted);
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-top: 3px;
}
.identity { margin-top: 18px; }
.avatar {
  width: clamp(120px, 62%, 150px);
  aspect-ratio: 1;
  padding: 5px;
  border: 1px solid #bdcae1;
  background: #fff;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cli {
  margin-top: 12px;
  border: 1px solid #bdcae1;
  background: rgba(255, 255, 255, .76);
  padding: 9px;
  font: 11px/1.55 var(--font-mono);
  color: #4a5568;
}
.cli b { color: #283b69; }
.prompt { color: #25a797; }
.cli-line { white-space: nowrap; }

/* `whoami` output — the condensed "at a glance", aligned key/value like a shell. */
.whoami {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 10px;
  margin: 6px 0;
}
.whoami dt { color: #6b768d; }
.whoami dd { margin: 0; color: #2d446e; }

.cursor { color: #25a797; animation: cli-blink 1.1s steps(1) infinite; }
@keyframes cli-blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .cursor { animation: none; }
}

.menu-title { margin: 26px 0 8px; font: 11px var(--font-mono); color: #6b768d; letter-spacing: .12em; }
nav { display: grid; gap: 4px; }
nav button {
  display: grid;
  grid-template-columns: 25px 1fr;
  width: 100%;
  text-align: left;
  border: 0;
  border-left: 1px solid transparent;
  background: transparent;
  padding: 9px 7px;
  color: #414b60;
  cursor: pointer;
}
nav button:hover, nav button.active {
  border-left-color: var(--violet);
  background: linear-gradient(90deg, rgba(143, 130, 238, .10), transparent);
}
nav button:focus-visible { outline: 2px solid var(--violet); outline-offset: 1px; }
nav .n { font-size: 11px; color: #7a869a; padding-top: 2px; }
nav strong { display: block; font-size: 13px; font-weight: 650; }
nav small { display: block; font-size: 11px; color: #7a869a; margin-top: 2px; }

.hint {
  margin-top: 20px;
  border: 1px dashed #b9c6dd;
  background: rgba(255, 255, 255, .6);
  padding: 10px;
  font: 11px/1.6 var(--font-mono);
  color: #556175;
}
.hint b { color: #3d4a5f; }

/* --- Right detail panel --- */
.panel {
  border: 1px solid #bcc9df;
  background: rgba(255, 255, 255, .77);
  padding: 14px;
  margin-bottom: 12px;
}
.panel h2, .panel h3 { margin: 0; }
.panel-kicker {
  font: 11px var(--font-mono);
  color: #6b768d;
  letter-spacing: .13em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.detail-name { font-size: 22px; letter-spacing: -.03em; }
.detail-type {
  display: inline-block;
  margin: 9px 0;
  padding: 3px 6px;
  border: 1px solid #cad4e5;
  font: 11px var(--font-mono);
  color: #4d5868;
}
.detail-desc { font-size: 13px; line-height: 1.7; color: #4a5568; }

.detail-section { margin-top: 14px; }
.detail-section > .field-label {
  font: 11px var(--font-mono);
  color: #6b768d;
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.detail-purpose { font-size: 13px; line-height: 1.7; color: #4a5568; margin: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: 12px var(--font-mono);
  color: #3d4a5f;
  border: 1px solid #ccd6e6;
  background: rgba(255, 255, 255, .7);
  padding: 3px 7px;
  border-radius: 2px;
}

.detail-list { display: grid; gap: 7px; margin-top: 14px; }
.detail-row { display: grid; grid-template-columns: 78px 1fr; gap: 8px; font: 12px/1.5 var(--font-mono); }
.detail-row dt { color: #6b768d; }
.detail-row dd { margin: 0; color: #3d4a5f; }

.links-row { display: flex; flex-wrap: wrap; gap: 8px; }
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  border: 1px solid #c4cfe1;
  background: #fff;
  color: #3d4a5f;
  padding: 6px 9px;
  font: 12px var(--font-mono);
}
.link-btn:hover { border-color: var(--violet); color: #5b4fc0; }

.connections { display: grid; gap: 7px; margin-top: 10px; }
.connection-item {
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px dotted #d4dbe7;
  background: transparent;
  padding: 7px 2px;
  color: #3d4a5f;
  cursor: pointer;
  font: 12px var(--font-mono);
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.connection-item:hover { color: #6655cb; }
.connection-item .rel { color: #7a869a; font-size: 11px; white-space: nowrap; }
.connection-item:focus-visible { outline: 2px solid var(--violet); outline-offset: 1px; }

.legend { display: grid; gap: 8px; font: 12px var(--font-mono); color: #556175; }
.legend span { display: flex; align-items: center; gap: 8px; }
.legend i { width: 8px; height: 8px; border: 1px solid currentColor; background: #fff; }

.controls { display: grid; gap: 8px; }
.controls button {
  border: 1px solid #c4cfe1;
  background: #fff;
  color: #3d4a5f;
  padding: 8px;
  cursor: pointer;
  font-size: 12px;
}
.controls button:hover { border-color: var(--violet); }

/* --- Responsive --- */
@media (max-width: 1120px) {
  .app { position: relative; grid-template-columns: 210px minmax(0, 1fr); }
  .right {
    position: absolute;
    inset: auto 0 0 210px;
    display: block;
    width: auto;
    height: min(54%, 440px);
    padding: 0 14px 18px;
    overflow: auto;
    overscroll-behavior: contain;
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 16px 16px 0 0;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    box-shadow: 0 -18px 52px rgba(8, 24, 48, .24);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(calc(100% + 16px));
    transition: transform .28s cubic-bezier(.2, .8, .2, 1), opacity .2s ease, visibility 0s linear .28s;
  }
  .right.is-mobile-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
    transition-delay: 0s;
  }
  .mobile-detail-head {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 48px;
    margin: 0 -14px 12px;
    padding: 11px 14px 8px;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 96%, transparent);
    backdrop-filter: blur(12px);
  }
  .mobile-detail-head::before {
    content: "";
    position: absolute;
    top: 5px;
    left: 50%;
    width: 34px;
    height: 3px;
    border-radius: 99px;
    background: var(--line);
    transform: translateX(-50%);
  }
  .mobile-detail-head > span { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font: 600 10px var(--font-mono); letter-spacing: .1em; }
  .mobile-detail-head > span i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }
  .mobile-detail-close { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 4px 9px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; background: transparent; font: 600 10px var(--font-mono); }
  .mobile-detail-close span { font-size: 17px; font-weight: 400; line-height: 1; }
  .mobile-detail-close:focus-visible { color: var(--ink); outline: 2px solid var(--violet); outline-offset: 2px; }
  .right > .panel:nth-of-type(n + 3) { display: none; }
}
@media (max-width: 760px) {
  .app { display: grid; grid-template-columns: minmax(0, 1fr); }
  .left { display: none; }
  .center { min-height: 0; }
  .right { left: 0; height: min(58%, 460px); }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
