/* ============================================================
   ALLY TOM — KNOWLEDGE GRAPH
   stark / utilitarian / mono
   ============================================================ */

:root {
  --bg: #0b0b0c;
  --bg-raise: #101012;
  --ink: #e8e6e1;
  --ink-dim: #8a8780;
  --ink-faint: #4a4843;
  --line: #26262a;
  --accent: #ff4d00;
  --accent-dim: rgba(255, 77, 0, 0.35);

  --edge: #605c54;

  --c-self: #e8e6e1;
  --c-employer: #9ad1ff;
  --c-background: #ffb38a;
  --c-project: #ff4d00;
  --c-skill: #b5e853;
  --c-deliverable: #5fd0c0;
  --c-outcome: #ffd23f;

  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

/* ====== LIGHT MODE ====== */
html.light {
  --bg: #f3f1ec;
  --bg-raise: #eae7e0;
  --ink: #181715;
  --ink-dim: #6b6860;
  --ink-faint: #a5a198;
  --line: #d9d5cc;
  --accent: #e63f00;
  --accent-dim: rgba(230, 63, 0, 0.35);

  --edge: #b3aea3;

  --c-self: #181715;
  --c-employer: #1f6fc4;
  --c-background: #c96a2e;
  --c-project: #e63f00;
  --c-skill: #5d8a00;
  --c-deliverable: #1f8a7a;
  --c-outcome: #b8860b;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  -webkit-font-smoothing: antialiased;
}

.accent { color: var(--accent); }

/* ====== TOP BAR ====== */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  z-index: 30;
  letter-spacing: 0.08em;
}
.topbar__name { font-weight: 600; }
.topbar__sep { color: var(--ink-faint); margin: 0 6px; }
.topbar__role { color: var(--ink-dim); }
.topbar__title { font-weight: 500; }
.topbar__meta { color: var(--ink-dim); font-size: 11px; }

/* ====== FILTER RAIL ====== */
.rail {
  position: fixed;
  top: 44px;
  left: 0;
  bottom: 28px;
  width: 188px;
  padding: 16px 14px;
  border-right: 1px solid var(--line);
  background: var(--bg);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rail__label {
  color: var(--ink-faint);
  font-size: 10px;
  letter-spacing: 0.2em;
  margin-bottom: 2px;
}
.rail__label--gap { margin-top: 18px; }
.rail__filters { display: flex; flex-direction: column; gap: 6px; }

.filter {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1px solid var(--line);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  padding: 6px 8px;
  cursor: pointer;
  text-align: left;
  transition: border-color 120ms, opacity 120ms;
}
.filter:hover { border-color: var(--ink-dim); }
.filter.off { opacity: 0.32; }
.filter__swatch {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
}
.filter__count { margin-left: auto; color: var(--ink-faint); }

.rail__search {
  background: var(--bg-raise);
  border: 1px solid var(--line);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  padding: 7px 8px;
  outline: none;
  text-transform: uppercase;
}
.rail__search:focus { border-color: var(--accent); }
.rail__search::placeholder { color: var(--ink-faint); }

.rail__reset {
  margin-top: auto;
  background: none;
  border: none;
  color: var(--ink-dim);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  cursor: pointer;
  text-align: left;
  padding: 4px 0;
}
.rail__reset:hover { color: var(--accent); }

/* ====== STAGE ====== */
.stage {
  position: fixed;
  top: 44px;
  left: 188px;
  right: 0;
  bottom: 28px;
  background:
    repeating-linear-gradient(0deg, transparent 0 47px, var(--line) 47px 48px),
    repeating-linear-gradient(90deg, transparent 0 47px, var(--line) 47px 48px);
  background-color: var(--bg);
}
#graph { width: 100%; height: 100%; display: block; cursor: grab; }
#graph:active { cursor: grabbing; }

.stage__hint {
  position: absolute;
  bottom: 14px;
  left: 16px;
  color: var(--ink-faint);
  font-size: 10px;
  letter-spacing: 0.18em;
  pointer-events: none;
  transition: opacity 400ms;
}
.stage__hint.faded { opacity: 0; }

.stage__crosshair {
  position: absolute;
  pointer-events: none;
  background: var(--ink-faint);
  opacity: 0.5;
}
.stage__crosshair--h { top: 50%; left: 16px; width: 14px; height: 1px; }
.stage__crosshair--v { top: calc(50% - 7px); left: 22px; width: 1px; height: 14px; }

/* ====== GRAPH ELEMENTS (SVG) ====== */
.link {
  stroke: var(--edge);
  stroke-opacity: 0.65;
  stroke-width: 1px;
  transition: stroke-opacity 150ms, stroke 150ms;
}
.link.hl { stroke: var(--accent); stroke-opacity: 0.9; }
.link.dim { stroke-opacity: 0.08; }

.node { cursor: pointer; }
.node__shape {
  stroke-width: 1.25px;
  fill: var(--bg);
  transition: fill 150ms, stroke 150ms, opacity 150ms;
}
.node.dim { opacity: 0.14; }
.node.hl .node__shape,
.node.selected .node__shape { fill: currentColor; }
.node.selected .node__ring { display: block; }

.node__ring {
  display: none;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1px;
  stroke-dasharray: 3 3;
}

.node__label {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  fill: var(--ink);
  paint-order: stroke;
  stroke: var(--bg);
  stroke-width: 3px;
  pointer-events: none;
  text-transform: uppercase;
}
.node__index {
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.08em;
  fill: var(--ink-faint);
  paint-order: stroke;
  stroke: var(--bg);
  stroke-width: 3px;
  pointer-events: none;
}
.node.dim .node__label, .node.dim .node__index { opacity: 0; }

/* ====== DETAIL PANEL ====== */
.panel {
  position: fixed;
  top: 44px;
  right: 0;
  bottom: 28px;
  width: 340px;
  background: var(--bg);
  border-left: 1px solid var(--line);
  padding: 18px 18px 24px;
  z-index: 25;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.panel.open { transform: translateX(0); }

.panel__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 18px;
}
.panel__index { color: var(--accent); letter-spacing: 0.15em; font-size: 11px; }
.panel__close {
  background: none;
  border: none;
  color: var(--ink-dim);
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
  letter-spacing: 0.1em;
}
.panel__close:hover { color: var(--accent); }

.panel__type {
  display: inline-block;
  font-size: 9px;
  letter-spacing: 0.2em;
  padding: 3px 6px;
  border: 1px solid var(--line);
  color: var(--ink-dim);
  margin-bottom: 10px;
}
.panel__title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.3;
  margin-bottom: 14px;
}
/* parent / employer subtitle link */
.panel__parent {
  display: inline-block;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-dim);
  text-decoration: underline;
  text-underline-offset: 3px;
  margin: -8px 0 14px;
  cursor: pointer;
}
.panel__parent[hidden] { display: none; }
.panel__parent:hover { color: var(--accent); }

/* media area: image / avatar / color block / gallery */
.panel__media { margin-bottom: 16px; }
.panel__media[hidden] { display: none; }
.media__img {
  width: 100%;
  display: block;
  border: 1px solid var(--line);
  object-fit: cover;
}
.media__ph,
.media__block,
.media__main {
  width: 100%;
  aspect-ratio: 16 / 10;
  border: 1px solid var(--line);
}
.media__ph { background: var(--bg-raise); }
.media__block { aspect-ratio: 16 / 9; }
.media__avatar {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg-raise);
  object-fit: cover;
  display: block;
  margin: 4px auto 4px 0;
}
.media__logo {
  height: 56px;
  width: auto;
  max-width: 100%;
  display: block;
}
.media__thumbs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 8px;
}
.media__thumb {
  aspect-ratio: 1 / 1;
  background: var(--bg-raise);
  border: 1px solid var(--line);
}

/* meta */
.panel__meta {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 5px 14px;
  font-size: 10.5px;
  margin-bottom: 16px;
}
.panel__meta:empty { display: none; }
.panel__meta dt { color: var(--ink-faint); letter-spacing: 0.12em; }
.panel__meta dd { color: var(--ink); white-space: pre-line; }

/* body + inline links */
.panel__desc {
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--ink-dim);
  margin-bottom: 18px;
  white-space: pre-line;
}
.panel__desc:empty { display: none; }
.desc-link {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.desc-link:hover { color: var(--accent); }

.panel__quote {
  border-left: 2px solid var(--accent);
  padding: 8px 0 8px 12px;
  margin-bottom: 18px;
  font-size: 11.5px;
  font-style: italic;
  line-height: 1.6;
  color: var(--ink);
}

/* grouped connection sections */
.panel__sections { display: flex; flex-direction: column; }
.sec {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-bottom: 14px;
}
.sec__label {
  color: var(--ink-faint);
  font-size: 10px;
  letter-spacing: 0.2em;
  margin-bottom: 8px;
}
.bullet { width: 8px; height: 8px; flex: 0 0 8px; display: inline-block; }

/* list rows (skillset / outcomes / linked) */
.sec__list { list-style: none; }
.sec__list .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  background: none;
  border: none;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 2px;
  cursor: pointer;
  text-align: left;
}
.sec__list .row:hover { color: var(--accent); }
.row__l { display: flex; align-items: center; gap: 9px; min-width: 0; }
.row__a { color: var(--ink-faint); }
.sec__list .row:hover .row__a { color: var(--accent); }

/* project cards */
.sec__cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  font-family: var(--mono);
}
.card__media {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--bg-raise);
  border: 1px solid var(--line);
}
.card:hover .card__media { border-color: var(--accent); }
.card__row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.card:hover .card__row { color: var(--accent); }

/* ====== STATUS BAR ====== */
.statusbar {
  position: fixed;
  inset: auto 0 0 0;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-top: 1px solid var(--line);
  background: var(--bg);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  z-index: 30;
}
#status-selected { color: var(--ink-dim); }

.statusbar__left { display: flex; align-items: center; gap: 12px; }
.statusbar__theme {
  background: none;
  border: 1px solid var(--line);
  color: var(--ink-dim);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  padding: 2px 6px;
  cursor: pointer;
}
.statusbar__theme:hover { color: var(--accent); border-color: var(--accent); }

/* ====== EDIT MODE ====== */
.topbar__edit {
  background: none;
  border: 1px solid var(--line);
  color: var(--ink-dim);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  padding: 4px 8px;
  margin-left: 14px;
  cursor: pointer;
}
.topbar__edit:hover { color: var(--ink); border-color: var(--ink-dim); }
.topbar__edit.active { color: var(--accent); border-color: var(--accent); }

body.editing .panel { display: none; }      /* detail panel yields to editor */
body.connecting #graph { cursor: crosshair; }

.editor {
  position: fixed;
  top: 44px;
  right: 0;
  bottom: 28px;
  width: 340px;
  background: var(--bg);
  border-left: 1px solid var(--accent);
  padding: 16px 18px 24px;
  z-index: 26;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.editor.open { transform: translateX(0); }

.editor__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
}
.editor__title { color: var(--accent); letter-spacing: 0.2em; font-size: 11px; font-weight: 600; }
.editor__flash {
  font-size: 9.5px;
  color: var(--ink-dim);
  letter-spacing: 0.08em;
  opacity: 0;
  transition: opacity 200ms;
  text-align: right;
}
.editor__flash.show { opacity: 1; }

.editor__section {
  border-top: 1px solid var(--line);
  padding: 12px 0 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.editor__label {
  color: var(--ink-faint);
  font-size: 10px;
  letter-spacing: 0.2em;
  margin-bottom: 2px;
}
.editor__state { color: var(--accent); }

.editor__input {
  background: var(--bg-raise);
  border: 1px solid var(--line);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 7px 8px;
  outline: none;
  resize: vertical;
  width: 100%;
}
.editor__input:focus { border-color: var(--accent); }
.editor__input::placeholder { color: var(--ink-faint); }
select.editor__input { text-transform: uppercase; }

.editor__row { display: flex; gap: 6px; }

.editor__btn {
  background: none;
  border: 1px solid var(--line);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  padding: 7px 8px;
  cursor: pointer;
  flex: 1;
}
.editor__btn:hover:not(:disabled) { border-color: var(--ink-dim); }
.editor__btn:disabled { opacity: 0.3; cursor: default; }
.editor__btn--wide { width: 100%; }
.editor__btn--danger:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }
.editor__btn--accent { color: var(--accent); border-color: var(--accent-dim); }
.editor__btn--accent:hover { border-color: var(--accent); background: rgba(255, 77, 0, 0.08); }
.editor__btn.active { color: var(--accent); border-color: var(--accent); }

.editor__hint {
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 0.1em;
  padding: 4px 0;
}

.editor__edges { list-style: none; }
.editor__edges li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.edge__name {
  background: none;
  border: none;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 2px;
  cursor: pointer;
  text-align: left;
  flex: 1;
}
.edge__name:hover { color: var(--accent); }
.edge__del {
  background: none;
  border: none;
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 10px;
  cursor: pointer;
  padding: 4px 0;
}
.edge__del:hover { color: var(--accent); }
.edge__empty { color: var(--ink-faint); font-size: 10px; letter-spacing: 0.12em; padding: 4px 0; }

#ed-dirty.dirty { color: var(--accent); }
#ed-dirty.clean { color: var(--ink-faint); }
#ed-dirty { font-size: 9.5px; letter-spacing: 0.08em; }

.editor__versions { list-style: none; }
.version {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}
.version__info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.version__id { font-size: 10.5px; color: var(--ink); letter-spacing: 0.08em; }
.version__note {
  font-size: 9.5px;
  color: var(--ink-dim);
  letter-spacing: 0.04em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.version__restore {
  background: none;
  border: none;
  color: var(--ink-dim);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  cursor: pointer;
  white-space: nowrap;
}
.version__restore:hover { color: var(--accent); }

/* ====== SMALL SCREENS ====== */
@media (max-width: 760px) {
  .rail { display: none; }
  .stage { left: 0; }
  .panel { width: 100%; }
  .topbar__meta { display: none; }
}
