:root {
  color-scheme: dark;
  /* The Anchorpoint house palette (matched to the-anchorpoint.pages.dev) */
  --ink: #e8e0d8;
  --muted: #c8c0b8;
  --subtle: rgba(200, 192, 184, 0.55);
  --night: #0a0a0c;
  --panel: rgba(18, 16, 20, 0.8);
  --panel-solid: #121014;
  --line: rgba(212, 205, 196, 0.14);
  --line-strong: rgba(212, 205, 196, 0.26);
  --gold: #c8a050;
  --rose: #c25a6e;
  --teal: #5eaaa8;
  --moss: #8aa06d;
  --violet: #8b5cf6;
  --danger: #ff6b6b;
  --shadow: rgba(0, 0, 0, 0.6);
  --font-display: 'Cinzel', Georgia, serif;
  --font-body: 'Cormorant Garamond', Georgia, serif;
  --font-ui: 'Inter', ui-sans-serif, system-ui, sans-serif;
  font-family: var(--font-ui);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(circle at 50% -10%, rgba(139, 92, 246, 0.16), transparent 30rem),
    radial-gradient(circle at 85% 110%, rgba(200, 160, 80, 0.08), transparent 26rem),
    linear-gradient(135deg, #0a0a0c 0%, #100e14 45%, #14100c 100%);
  color: var(--ink);
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(245, 239, 230, 0.84) 0 1px, transparent 1.5px),
    radial-gradient(circle, rgba(217, 182, 107, 0.68) 0 1px, transparent 1.5px),
    radial-gradient(circle, rgba(110, 183, 176, 0.38) 0 1px, transparent 1.5px);
  background-position:
    8px 14px,
    47px 63px,
    91px 22px;
  background-size:
    127px 127px,
    193px 193px,
    251px 251px;
  opacity: 0.48;
  animation: star-twinkle 7s ease-in-out infinite alternate;
}

.stars::after {
  position: absolute;
  inset: 0;
  content: "";
  background-image:
    radial-gradient(circle, rgba(245, 239, 230, 0.9) 0 1px, transparent 1.6px),
    radial-gradient(circle, rgba(200, 121, 135, 0.58) 0 1px, transparent 1.6px);
  background-position:
    31px 78px,
    109px 44px;
  background-size:
    173px 173px,
    229px 229px;
  opacity: 0.28;
  animation: star-pulse 5.5s ease-in-out infinite alternate;
}

@keyframes star-twinkle {
  0% {
    opacity: 0.34;
    filter: brightness(0.85);
  }

  50% {
    opacity: 0.58;
    filter: brightness(1.18);
  }

  100% {
    opacity: 0.44;
    filter: brightness(1);
  }
}

@keyframes star-pulse {
  from {
    opacity: 0.12;
    transform: translateY(0);
  }

  to {
    opacity: 0.42;
    transform: translateY(-0.35rem);
  }
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(17rem, 22rem) 1fr;
  height: 100vh;
  min-height: 38rem;
  transition: grid-template-columns 180ms ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 4.6rem 1fr;
}

.sidebar {
  display: flex;
  min-height: 0;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: rgba(8, 8, 13, 0.75);
  backdrop-filter: blur(18px);
  transition:
    background-color 180ms ease,
    width 180ms ease;
}

.brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 1.3rem 1.15rem 0.95rem;
}

.hamburger-button {
  display: inline-grid;
  flex: 0 0 auto;
  width: 2.45rem;
  height: 2.45rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(245, 239, 230, 0.07);
  color: var(--ink);
}

.hamburger-button span {
  display: block;
  width: 1.05rem;
  height: 1px;
  background: var(--ink);
}

.hamburger-button:hover {
  border-color: var(--line-strong);
  background: rgba(245, 239, 230, 0.11);
}

.sigil {
  position: relative;
  display: grid;
  width: 3rem;
  height: 3rem;
  place-items: center;
  border: 1px solid rgba(217, 182, 107, 0.56);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(245, 239, 230, 0.08), 0 0 2rem rgba(217, 182, 107, 0.08);
}

.sigil::before,
.sigil::after,
.sigil span {
  position: absolute;
  content: "";
  background: var(--gold);
}

.sigil::before {
  width: 1.55rem;
  height: 1px;
}

.sigil::after {
  width: 1px;
  height: 1.55rem;
}

.sigil span {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: var(--teal);
}

.kicker {
  margin: 0 0 0.15rem;
  color: var(--gold);
  font-size: 0.74rem;
  letter-spacing: 0.16rem;
  text-transform: uppercase;
}

.sidebar.is-collapsed .brand {
  justify-content: center;
  padding-inline: 0.75rem;
}

.sidebar.is-collapsed .sigil,
.sidebar.is-collapsed .brand-text,
.sidebar.is-collapsed .search-row,
.sidebar.is-collapsed .tree,
.sidebar.is-collapsed .sidebar-actions {
  display: none;
}

h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--gold);
}

.search-row {
  padding: 0 1rem 0.8rem;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: rgba(245, 239, 230, 0.055);
  color: var(--ink);
}

input:focus,
textarea:focus {
  border-color: rgba(217, 182, 107, 0.74);
  box-shadow: 0 0 0 3px rgba(217, 182, 107, 0.11);
}

#searchInput {
  min-height: 2.65rem;
  padding: 0 0.8rem;
}

.tree {
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding: 0.25rem 0.65rem 0.8rem;
}

.tree-group {
  display: grid;
  gap: 0.15rem;
}

.tree-node {
  display: grid;
  grid-template-columns: 1.25rem 1fr;
  align-items: center;
  width: 100%;
  min-height: 2.15rem;
  border: 1px solid transparent;
  border-radius: 8px;
  margin: 0;
  padding: 0.34rem 0.45rem;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.tree-node:hover {
  background: rgba(245, 239, 230, 0.06);
  color: var(--ink);
}

.tree-node.active {
  border-color: rgba(217, 182, 107, 0.34);
  background: rgba(217, 182, 107, 0.11);
  color: var(--ink);
}

.tree-mark {
  color: var(--gold);
  font-size: 0.95rem;
  text-align: center;
}

.tree-node.depth-0 {
  color: var(--ink);
  font-weight: 680;
}

.tree-node.depth-1 {
  color: var(--muted);
}

.tree-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-actions {
  display: flex;
  gap: 0.45rem;
  padding: 0.85rem 1rem 1rem;
  border-top: 1px solid var(--line);
}

.icon-button,
.tool-button {
  min-width: 2.45rem;
  min-height: 2.45rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(245, 239, 230, 0.07);
  color: var(--ink);
}

.icon-button:hover,
.tool-button:hover {
  border-color: var(--line-strong);
  background: rgba(245, 239, 230, 0.11);
}

.icon-button.compact {
  min-width: 2rem;
  min-height: 2rem;
}

.file-button {
  display: grid;
  place-items: center;
  cursor: pointer;
}

.file-button input {
  display: none;
}

.danger {
  color: #ffd6d6;
}

.workspace {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: clamp(1rem, 2.5vw, 2.5rem);
}

.page-panel {
  width: min(76rem, 100%);
  min-height: calc(100vh - clamp(2rem, 5vw, 5rem));
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(24, 22, 30, 0.75), rgba(12, 11, 16, 0.75)),
    repeating-linear-gradient(90deg, transparent 0 3.2rem, rgba(245, 239, 230, 0.018) 3.2rem 3.25rem);
  box-shadow: 0 1.8rem 5rem var(--shadow);
  padding: clamp(1rem, 2.3vw, 2.1rem);
}

.page-topline {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.breadcrumb {
  min-width: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.breadcrumb span {
  color: var(--gold);
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.tool-button {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  justify-content: center;
  padding: 0 0.75rem;
  white-space: nowrap;
}

.tool-button.primary {
  border-color: rgba(110, 183, 176, 0.48);
  background: rgba(110, 183, 176, 0.14);
}

.title-row {
  margin-top: clamp(1.4rem, 4vw, 3rem);
}

.page-title-input {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 4.2rem);
  line-height: 1.1;
  letter-spacing: 0.03em;
  padding: 0.15rem 0 0.65rem;
}

.page-title-input:focus {
  box-shadow: none;
}

.page-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.page-meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.32rem 0.62rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.child-shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
  gap: 0.65rem;
  margin-top: 1.55rem;
}

.child-card {
  min-height: 4.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(245, 239, 230, 0.075);
  color: var(--ink);
  text-align: left;
  padding: 0.75rem;
}

.child-card:hover {
  border-color: rgba(217, 182, 107, 0.46);
  background: rgba(217, 182, 107, 0.08);
}

.child-card strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 0.95rem;
}

.child-card span {
  display: block;
  margin-top: 0.35rem;
  color: var(--subtle);
  font-size: 0.78rem;
}

.entries {
  display: grid;
  gap: 0.8rem;
  margin-top: 1.2rem;
}

.entry-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 8, 13, 0.75);
  padding: 0.85rem;
}

.entry-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
  align-items: center;
}

.entry-title {
  min-height: 2.35rem;
  padding: 0 0.7rem;
  color: var(--gold);
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: 0.02em;
}

.entry-body {
  min-height: 9rem;
  margin-top: 0.65rem;
  padding: 0.75rem;
  resize: vertical;
  line-height: 1.5;
  font-family: var(--font-body);
  font-size: 1.12rem;
}

.entry-foot {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.7rem;
  align-items: center;
  margin-top: 0.65rem;
}

.entry-tags {
  min-height: 2.25rem;
  padding: 0 0.7rem;
}

.entry-foot time {
  color: var(--subtle);
  font-size: 0.8rem;
  white-space: nowrap;
}

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  margin-top: 1rem;
  padding: 1rem;
  color: var(--muted);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (max-width: 820px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }

  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar {
    max-height: 46vh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar.is-collapsed {
    max-height: 4.6rem;
  }

  .workspace {
    padding: 0.8rem;
  }

  .page-panel {
    min-height: 34rem;
  }

  .page-topline {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-actions {
    justify-content: flex-start;
  }

  .entry-foot {
    grid-template-columns: 1fr;
  }
}
