:root {
  color-scheme: light dark;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  line-height: 1.5;
}

body {
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

h1 {
  font-size: 1.75rem;
  margin: 0 0 1.5rem;
}

form {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.auth {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.auth form {
  margin: 0;
}

input {
  box-sizing: border-box;
  padding: 0.55rem 0.65rem;
  font: inherit;
}

textarea {
  box-sizing: border-box;
  width: 100%;
  min-height: 9rem;
  resize: vertical;
  padding: 0.75rem;
  font: inherit;
}

button {
  justify-self: start;
  padding: 0.55rem 0.85rem;
  font: inherit;
  cursor: pointer;
}

.button {
  display: inline-block;
  padding: 0.55rem 0.85rem;
  border: 1px solid currentColor;
  color: inherit;
  text-decoration: none;
}

article {
  position: relative;
  border-top: 1px solid color-mix(in srgb, currentColor 25%, transparent);
  padding: 1rem 0;
}

time {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.875rem;
  color: color-mix(in srgb, currentColor 70%, transparent);
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  font-size: 0.875rem;
  color: color-mix(in srgb, currentColor 70%, transparent);
}

.article-meta time {
  margin: 0;
}

.content {
  white-space: pre-wrap;
}

.article-graph {
  position: relative;
  padding-left: calc(3.5rem + var(--relation-extra-gutter, 0px));
}

.mode-switch {
  display: inline-flex;
  margin: 0 0 0.75rem calc(-3.5rem - var(--relation-extra-gutter, 0px));
  border: 1px solid color-mix(in srgb, currentColor 35%, transparent);
  border-radius: 4px;
}

.mode-switch button {
  min-width: 4rem;
  padding: 0.35rem 0.65rem;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.mode-switch button + button {
  border-left: 1px solid color-mix(in srgb, currentColor 35%, transparent);
}

.mode-switch button[aria-pressed="true"] {
  background: Highlight;
  color: HighlightText;
}

.article-graph > p {
  margin-left: calc(-3.5rem - var(--relation-extra-gutter, 0px));
}

.relation-layer {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.relation-edge,
.relation-preview,
.relation-delete-target {
  fill: none;
  stroke: color-mix(in srgb, currentColor 62%, transparent);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.relation-delete-target {
  stroke: transparent;
  stroke-width: 14;
  pointer-events: none;
}

.relation-preview {
  stroke-dasharray: 5 4;
  visibility: hidden;
}

.relation-preview.is-visible {
  visibility: visible;
}

.relation-arrowhead {
  fill: color-mix(in srgb, currentColor 62%, Canvas);
  fill-opacity: 1;
  opacity: 1;
}

.relation-arrowhead-delete {
  fill: #d92d20;
}

.relation-point {
  position: absolute;
  z-index: 1;
  top: 1.25rem;
  left: -1.6rem;
  box-sizing: border-box;
  width: 0.875rem;
  height: 0.875rem;
  padding: 0;
  border: 2px solid currentColor;
  border-radius: 50%;
  background: Canvas;
  color: inherit;
}

.relation-point:not(:disabled):hover,
.relation-point:not(:disabled):focus-visible,
.relation-point.is-source {
  outline: 3px solid color-mix(in srgb, Highlight 35%, transparent);
  outline-offset: 2px;
}

.relation-point:disabled {
  cursor: default;
  opacity: 0.55;
}

.article-graph.is-linking {
  cursor: crosshair;
}

.article-graph article[data-owned="true"] {
  cursor: pointer;
}

.article-graph
  article[data-owned="true"]:hover:not(:has(.relation-point:hover)),
.article-graph article[data-owned="true"]:focus-visible {
  z-index: 2;
  outline: 2px solid #d92d20;
  outline-offset: 3px;
  background: color-mix(in srgb, #d92d20 9%, transparent);
}

.article-graph .relation-delete-target[data-owned="true"] {
  pointer-events: stroke;
  cursor: pointer;
}

.article-graph
  .article-relation:has(.relation-delete-target[data-owned="true"]:hover)
  .relation-edge,
.article-graph
  .article-relation:has(
    .relation-delete-target[data-owned="true"]:focus-visible
  )
  .relation-edge {
  marker-end: url("#relation-arrowhead-delete");
  stroke: #d92d20;
  stroke-width: 3;
}

.relation-status {
  min-height: 1.5rem;
  margin-top: 0;
  margin-bottom: 0;
  color: #b42318;
  font-size: 0.875rem;
}

.relation-status:empty {
  display: none;
}
