@font-face {
  font-family: americanGrotesk;
  src: url("/fonts/american-grotesk-regular.woff2") format("woff2");
  font-display: block;
  font-weight: 400;
}

@font-face {
  font-family: americanGrotesk;
  src: url("/fonts/american-grotesk-medium.woff2") format("woff2");
  font-display: block;
  font-weight: 500;
}

:root {
  --bg: #140c08;
  --ink: #fff6e8;
  --line: color-mix(in srgb, var(--ink) 14%, var(--bg));
  --font: americanGrotesk, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

body {
  min-width: 280px;
  min-height: 100svh;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-size: 1rem;
  line-height: 1.4;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
input,
select,
textarea,
dialog {
  color: var(--ink);
  background: var(--bg);
  border-radius: 0;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--line);
}

textarea {
  min-height: 7rem;
  resize: vertical;
  line-height: 1.45;
}

.markdown-preview {
  min-height: 7rem;
  padding: 0.45rem 0.5rem;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  line-height: 1.45;
}

.markdown-preview > :first-child {
  margin-top: 0;
}

.markdown-preview > :last-child {
  margin-bottom: 0;
}

.markdown-preview :is(h1, h2, h3, h4, h5, h6) {
  margin: 0 0 0.7rem;
  font: inherit;
  font-weight: 500;
}

.markdown-preview :is(p, ul, ol, blockquote, pre) {
  margin: 0 0 0.7rem;
}

.markdown-preview :is(ul, ol) {
  padding-left: 1.3rem;
}

.markdown-preview blockquote {
  margin-left: 0;
  padding-left: 0.7rem;
  border-left: 1px solid var(--line);
}

.markdown-preview code {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.45;
}

input:disabled,
select:disabled,
textarea:disabled {
  cursor: default;
  opacity: 1;
}

a,
.plain-button {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.14em;
}

a:hover,
.plain-button:hover:not(:disabled) {
  text-decoration-thickness: 2px;
}

:focus,
:focus-visible {
  outline: none !important;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font: inherit;
  font-weight: 500;
}

[hidden] {
  display: none !important;
}

.plain-button {
  min-height: 0;
  padding: 0;
  background: transparent;
  border: 0;
}

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

.skip-link:focus {
  z-index: 20;
  top: 0.5rem;
  left: 0.5rem;
  width: auto;
  height: auto;
  padding: 0.4rem;
  clip: auto;
  color: var(--bg);
  background: var(--ink);
}

.admin-shell {
  display: grid;
  grid-template-columns: 17rem minmax(0, 1fr);
  min-height: 100svh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100svh;
  min-height: 0;
  padding: 1rem;
  border-right: 1px solid var(--line);
}

.sidebar-header,
.sidebar-footer,
.editor-header,
.region-header,
.block-header,
.dialog-header,
.dialog-actions,
.save-area,
.add-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.sidebar-header,
.editor-header,
.region-header,
.dialog-header {
  justify-content: space-between;
}

.sidebar-header > :first-child,
.dialog-header h2 {
  margin: 0;
  font-weight: 500;
  text-decoration: none;
}

.page-tree {
  min-height: 0;
  margin: 1.25rem 0;
  overflow: auto;
  scrollbar-color: var(--line) transparent;
}

.page-tree-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tree-row {
  display: flex;
  align-items: baseline;
  width: 100%;
  min-height: 0;
  padding: 0.18rem 0.2rem 0.18rem calc(0.2rem + var(--depth, 0) * 0.9rem);
  color: inherit;
  background: transparent;
  border: 0;
  text-align: left;
}

.tree-row[draggable="true"] {
  cursor: grab;
}

.tree-row[draggable="true"]:active {
  cursor: grabbing;
}

.tree-row[aria-current="page"] {
  font-weight: 500;
}

.tree-row.is-dragging {
  opacity: 0.35;
}

.tree-row.is-drop-target,
.page-tree.is-root-target {
  outline: 1px solid var(--ink);
  outline-offset: -1px;
}

.tree-draft::after {
  content: " (draft)";
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.sidebar-footer span {
  width: 100%;
}

main {
  width: 100%;
  max-width: 56rem;
  margin: 0 auto;
  padding: 1.5rem 2rem 5rem;
}

.empty-state {
  padding-top: 0.1rem;
}

.editor-header {
  margin-bottom: 0.5rem;
}

.page-title {
  min-width: 0;
  padding: 0;
  font-weight: 500;
  background: transparent;
  border: 0;
}

.page-title:focus-visible {
  outline-offset: 4px;
}

.save-area {
  flex: 0 0 auto;
}

#save-state,
.live-warning {
  margin: 0;
}

.live-warning {
  padding-bottom: 1rem;
}

.region {
  padding: 1rem 0 1.5rem;
}

.bottom-region,
.settings {
  border-top: 1px solid var(--line);
}

.region-header {
  margin-bottom: 0.6rem;
}

.region-header h2 {
  margin: 0;
  font-weight: 400;
}

.blocks {
  min-height: 1.4rem;
}

.empty-blocks,
.empty-links {
  margin: 0.3rem 0;
}

.block-editor {
  margin: 0;
  padding: 0.7rem 0 1rem;
  border: 0;
  border-top: 1px solid var(--line);
}

.block-editor:first-child {
  border-top: 0;
}

.block-header {
  justify-content: flex-start;
  margin-bottom: 0.55rem;
}

.block-kind {
  font-weight: 400;
}

.markdown-mode {
  margin-left: 0.25rem;
}

.drag-handle {
  width: 1.15rem;
  min-height: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.drag-handle:active {
  cursor: grabbing;
}

.remove-button {
  margin-left: auto;
}

.block-editor.is-dragging,
.link-editor.is-dragging {
  opacity: 0.35;
}

.block-editor.is-drop-before,
.link-editor.is-drop-before {
  box-shadow: inset 0 1px var(--ink);
}

.block-editor.is-drop-after,
.link-editor.is-drop-after {
  box-shadow: inset 0 -1px var(--ink);
}

.link-list {
  display: grid;
}

.link-editor {
  display: grid;
  grid-template-columns: 1.15rem minmax(7rem, 0.75fr) minmax(12rem, 1.25fr) auto;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0;
}

.link-editor input {
  min-width: 0;
}

.add-link {
  margin-top: 0.4rem;
}

.settings {
  padding-top: 1rem;
}

.settings summary {
  width: max-content;
  cursor: pointer;
  font-weight: 400;
}

.settings-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  margin: 1rem 0;
}

label {
  display: grid;
  gap: 0.3rem;
}

.check-label {
  display: flex;
  align-items: center;
  align-self: end;
  gap: 0.45rem;
  min-height: 2.35rem;
}

.check-label input {
  width: auto;
}

.settings-fields label:has(textarea) {
  grid-column: 1 / -1;
}

.status {
  position: fixed;
  z-index: 10;
  right: 1rem;
  bottom: 1rem;
  max-width: min(28rem, calc(100% - 2rem));
  padding: 0.35rem 0;
  background: var(--bg);
}

.status:empty {
  display: none;
}

dialog {
  width: min(28rem, calc(100% - 2rem));
  padding: 1rem;
  border: 1px solid var(--line);
}

dialog::backdrop {
  background: rgb(20 12 8 / 72%);
}

dialog form {
  display: grid;
  gap: 1rem;
}

.dialog-header h2 {
  margin: 0;
}

.dialog-actions {
  justify-content: flex-end;
}

@media (max-width: 720px) {
  .admin-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: min(40svh, 24rem);
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  main {
    padding: 1.25rem 1rem 5rem;
  }

  .settings-fields {
    grid-template-columns: 1fr;
  }

  .settings-fields label:has(textarea) {
    grid-column: auto;
  }
}

@media (max-width: 480px) {
  .editor-header {
    align-items: flex-start;
  }

  .link-editor {
    grid-template-columns: 1.15rem minmax(0, 1fr) auto;
  }

  .link-editor > .drag-handle {
    grid-column: 1;
    grid-row: 1;
  }

  .link-label {
    grid-column: 2;
    grid-row: 1;
  }

  .link-editor > .remove-button {
    grid-column: 3;
    grid-row: 1;
  }

  .link-target {
    grid-column: 2 / -1;
    grid-row: 2;
  }
}
