@font-face {
  font-family: "Mitr";
  src: url("/static/fonts/mitr/Mitr-Light.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #fbfaf7;
  --fg: #23201c;
  --muted: #7a7168;
  --line: #ded7cc;
  --error: #8b2f24;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: "Mitr", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.6;
}

.page {
  width: min(760px, calc(100% - 32px));
  margin: 0 auto;
  padding: 64px 0;
}

.page-header {
  margin-bottom: 40px;
}

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

h1,
h2,
h3 {
  margin-bottom: 0;
  font-size: 0.875rem;
  font-weight: 400;
}

.page-title {
  margin-bottom: 1.5rem;
}

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

a {
  color: inherit;
  text-decoration: none;
}

a:hover,
a:focus {
  text-decoration: none;
}

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

.tree-list .tree-list {
  margin: 0.25rem 0;
  padding-left: 1rem;
}

.node-line {
  align-items: baseline;
  color: var(--muted);
  display: flex;
  font-size: 0.875rem;
  gap: 1rem;
  justify-content: space-between;
  min-width: 0;
  border-bottom: 2px solid transparent;
  transition: color 120ms ease, border-color 120ms ease;
  padding: .25rem 0;
}

.node-line:focus:not(:focus-visible) {
  outline: none;
}

.node-line:focus-visible {
  outline: 1px solid var(--line);
  outline-offset: 0.2rem;
}

.node-line:hover,
.node-line:focus {
  /* border-color: var(--muted); */
  color: var(--fg);
}

.node-line:hover .muted,
.node-line:focus .muted {
  color: var(--fg);
}

.node-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  scroll-margin-top: 2rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-line .muted {
  flex-shrink: 0;
  font-size: 0.75rem;
  text-align: right;
  transition: color 120ms ease;
}

.note-meta {
  align-items: center;
  display: flex;
  gap: 0.35rem;
}

.author-meta {
  transition: color 120ms ease;
}

.active.note-node > .node-line .author-meta {
  color: var(--fg);
}

.attachment-icons {
  align-items: center;
  display: flex;
  gap: 0.25rem;
}

.attachment-icon {
  font-size: 0.9rem;
  line-height: 1;
  transform: translateY(-1px);
}

.active > .node-line {
  border-color: var(--line);
  color: var(--fg);
}

/* .active > .node-line:hover, */
/* .active > .node-line:focus { */
/*   border-color: var(--muted); */
/* } */

.active > .node-line .node-title {
  font-weight: inherit;
}

.muted {
  color: var(--muted);
  font-size: 0.875rem;
}

.nested {
  margin-left: 1.45rem;
}

.note-content {
  border-left: 2px dashed var(--line);
  display: grid;
  gap: 1rem;
  margin: 0.65rem 0 1rem 1.45rem;
  max-width: 60ch;
  padding: 0.45rem 1.25rem;
}

.note-body {
  color: var(--muted);
  margin: 0;
  white-space: pre-wrap;
}

.content-separator {
  color: var(--muted);
  font-size: 0.75rem;
  margin: 0;
}

.attachments {
  display: grid;
  gap: 1rem;
  margin: 0;
}

.attachment {
  margin: 0;
}

.image-attachment img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
}

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

.audio-player {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  width: 100%;
}

.audio-toggle,
.audio-progress {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease;
}

.audio-toggle {
  font-size: 0.75rem;
  min-width: 3rem;
  padding: 0.15rem 0.4rem;
}

.audio-progress {
  flex: 1;
  height: 0.45rem;
  overflow: hidden;
  padding: 0;
}

.audio-progress-fill {
  display: block;
  width: 0;
  height: 100%;
  background: var(--muted);
  transition: background 120ms ease;
}

.audio-time {
  color: var(--muted);
  flex-shrink: 0;
  font-size: 0.75rem;
}

.audio-toggle:hover,
.audio-progress:hover {
  border-color: var(--fg);
  background: transparent;
  color: var(--fg);
}

.audio-progress:hover .audio-progress-fill {
  background: var(--fg);
}

.audio-toggle:focus,
.audio-toggle:active,
.audio-progress:focus,
.audio-progress:active {
  outline: none;
}

.transcript,
.transcription-status {
  margin: 0.45rem 0 0;
}

.transcript {
  color: var(--muted);
  white-space: pre-wrap;
}

.empty,
.notice,
.error,
.hint,
.intro {
  color: var(--muted);
  margin: 0;
}

.intro {
  max-width: 33ch;
  padding: .25rem 0 1.5rem;
}

.home-links {
  display: flex;
  flex-wrap: wrap;
}

.home-links a,
.home-links .link-button {
  border: 0;
  border-bottom: 1px solid var(--muted);
  border-radius: 0;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  padding: 0;
  transition: border-color 120ms ease;
}

.home-links .hidden-read-link {
  border-bottom: 0;
  cursor: default;
  position: fixed;
  inset: auto 0 0 auto;
  opacity: 0;
  padding: 1rem;
  user-select: none;
  white-space: nowrap;
  z-index: 10;
  transition: opacity 120ms ease;
}

.hidden-read-link:hover,
.hidden-read-link:focus-visible {
  opacity: 0.1;
}

.site-title a {
  color: #4b4640;
  display: inline-block;
  transition: color 120ms ease;
}

.site-logo {
  display: block;
  width: 61px;
  height: 35px;
  background: currentColor;
  -webkit-mask: url("/static/rip.svg") center / contain no-repeat;
  mask: url("/static/rip.svg") center / contain no-repeat;
}

.site-title a:hover,
.site-title a:focus {
  color: var(--fg);
}

.home-links a:hover,
.home-links a:focus,
.home-links .link-button:hover,
.home-links .link-button:focus {
  border-color: var(--muted);
}

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

.notice,
.error {
  margin-bottom: 1.5rem;
}

.hint {
  margin: -0.8rem 0 0;
  font-size: 0.875rem;
}

.note-form {
  display: grid;
  gap: 1.2rem;
}

.form-row {
  align-items: end;
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr) max-content;
}

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

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdfa;
  color: var(--fg);
  font-size: 16px;
  padding: 0.6rem 0.7rem;
}

input[type="date"] {
  max-width: fit-content;
}

input:disabled,
textarea:disabled {
  background: transparent;
  color: var(--muted);
  opacity: 1;
}

textarea {
  resize: vertical;
}

button {
  justify-self: start;
  border: 1px solid var(--fg);
  border-radius: 6px;
  background: var(--fg);
  color: var(--bg);
  padding: 0.35rem 1rem;
  cursor: pointer;
}

button:not(.audio-toggle):not(.audio-progress):not(.link-button):not(.secondary-button):not(.danger-button):hover,
button:not(.audio-toggle):not(.audio-progress):not(.link-button):not(.secondary-button):not(.danger-button):focus {
  background: #000;
}

.form-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.secondary-button {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--fg);
  padding: 0.35rem 1rem;
}

.secondary-button:hover,
.secondary-button:focus {
  border-color: var(--muted);
}

.admin-kicker {
  color: var(--muted);
  font-size: 0.75rem;
  margin-bottom: 1rem;
}

.admin-kicker a {
  border-bottom: 1px solid var(--line);
}

.admin-kicker a:hover,
.admin-kicker a:focus {
  border-color: var(--muted);
  color: var(--fg);
}

.admin-attachments {
  display: grid;
  gap: 1rem;
}

.admin-attachment {
  border-left: 2px dashed var(--line);
  display: grid;
  gap: 0.75rem;
  padding-left: 1rem;
}

.admin-attachment-meta {
  font-size: 0.75rem;
  margin: 0;
}

.delete-form {
  border-top: 1px solid var(--line);
  margin-top: 2rem;
  padding-top: 1rem;
}

.danger-button {
  border-color: var(--error);
  background: transparent;
  color: var(--error);
}

.danger-button:hover,
.danger-button:focus {
  background: var(--error);
  color: var(--bg);
}

.auth-dialog {
  width: min(24rem, calc(100% - 2rem));
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  padding: 1.5rem;
}

.auth-dialog[open] {
  position: fixed;
  inset: 0;
  margin: auto;
  max-height: calc(100vh - 2rem);
  z-index: 30;
}

.auth-dialog::backdrop,
.auth-dialog-scrim {
  background: rgba(35, 32, 28, 0.04);
}

.auth-dialog-scrim {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 20;
}

.auth-dialog[open] + .auth-dialog-scrim {
  display: block;
}

.auth-dialog:modal + .auth-dialog-scrim {
  display: none;
}

.auth-form {
  display: grid;
  gap: 1rem;
}

.auth-form .error {
  margin-bottom: 0;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.dialog-actions .secondary-button {
  border-color: var(--line);
  background: transparent;
  color: var(--fg);
}

.dialog-actions .secondary-button:hover,
.dialog-actions .secondary-button:focus {
  border-color: var(--muted);
  background: transparent;
}

@media (max-width: 520px) {
  .date-meta {
    display: none;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}
