/*
 * Application-specific styles that must live outside Tailwind's layer
 * system (unlayered CSS beats layered CSS regardless of specificity).
 */

/* ── Tiptap WYSIWYG editor ─────────────────────────────────────────── */

.tiptap-wrapper {
  border: 1px solid rgb(209 213 219);
  border-radius: 0.375rem;
  overflow: hidden;
}

.tiptap-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 0.375rem;
  border-bottom: 1px solid rgb(209 213 219);
  background: rgb(249 250 251);
}

.tiptap-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.375rem;
  border: none;
  border-radius: 0.25rem;
  background: transparent;
  color: rgb(75 85 99);
  font-size: 0.8125rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.tiptap-btn:hover {
  background: rgb(229 231 235);
  color: rgb(17 24 39);
}
.tiptap-btn.active {
  background: rgb(199 210 254);
  color: rgb(67 56 202);
}

.tiptap-sep {
  width: 1px;
  height: 1.5rem;
  align-self: center;
  margin: 0 0.25rem;
  background: rgb(209 213 219);
}

.tiptap-editor {
  padding: 0.75rem;
  outline: none;
  font-size: 0.875rem;
  line-height: 1.625;
  color: rgb(17 24 39);
  display: flex;
  flex-direction: column;
  cursor: text;
}
.tiptap-editor .tiptap {
  outline: none;
  flex: 1;
}
.tiptap-editor .tiptap > *:first-child { margin-top: 0; }
.tiptap-editor .tiptap > *:last-child { margin-bottom: 0; }

.tiptap-editor .tiptap h1 { font-size: 1.5rem; font-weight: 700; margin: 1rem 0 0.5rem; }
.tiptap-editor .tiptap h2 { font-size: 1.25rem; font-weight: 600; margin: 0.75rem 0 0.375rem; }
.tiptap-editor .tiptap h3 { font-size: 1.125rem; font-weight: 500; margin: 0.5rem 0 0.25rem; }
.tiptap-editor .tiptap p { margin: 0.5rem 0; }
.tiptap-editor .tiptap ul,
.tiptap-editor .tiptap ol { padding-left: 1.5rem; margin: 0.5rem 0; }
.tiptap-editor .tiptap ul { list-style: disc; }
.tiptap-editor .tiptap ol { list-style: decimal; }
.tiptap-editor .tiptap li { margin: 0.125rem 0; }
.tiptap-editor .tiptap a { color: rgb(79 70 229); text-decoration: underline; }
.tiptap-editor .tiptap hr {
  border: none;
  border-top: 1px solid rgb(209 213 219);
  margin: 1rem 0;
}
.tiptap-editor .tiptap code {
  background: rgb(243 244 246);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.8125rem;
}
.tiptap-editor .tiptap pre {
  background: rgb(243 244 246);
  padding: 0.75rem;
  border-radius: 0.375rem;
  overflow-x: auto;
}
.tiptap-editor .tiptap pre code {
  background: none;
  padding: 0;
}
.tiptap-editor .tiptap blockquote {
  border-left: 3px solid rgb(209 213 219);
  padding-left: 1rem;
  color: rgb(107 114 128);
  margin: 0.5rem 0;
}
.tiptap-editor .tiptap strong { font-weight: 700; }
.tiptap-editor .tiptap em { font-style: italic; }
.tiptap-editor .tiptap s { text-decoration: line-through; }

/* Placeholder for empty editor */
.tiptap-editor .tiptap p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  color: rgb(156 163 175);
  pointer-events: none;
  float: left;
  height: 0;
}

/* ── Ease active (desaturated, slightly dimmed) ───────────────────── */

body.ease-active main {
  filter: saturate(0.8) brightness(0.97);
  transition: filter 0.3s ease;
}

/* ── Dark mode ─────────────────────────────────────────────────────── */

.dark .tiptap-wrapper {
  border-color: rgb(51 65 85);
}
.dark .tiptap-toolbar {
  background: rgb(15 23 42);
  border-color: rgb(51 65 85);
}
.dark .tiptap-btn {
  color: rgb(148 163 184);
}
.dark .tiptap-btn:hover {
  background: rgb(51 65 85);
  color: rgb(241 245 249);
}
.dark .tiptap-btn.active {
  background: rgb(49 46 129);
  color: rgb(165 180 252);
}
.dark .tiptap-sep {
  background: rgb(51 65 85);
}
.dark .tiptap-editor {
  color: rgb(241 245 249);
}
.dark .tiptap-editor .tiptap a { color: rgb(129 140 248); }
.dark .tiptap-editor .tiptap hr { border-color: rgb(51 65 85); }
.dark .tiptap-editor .tiptap code { background: rgb(30 41 59); }
.dark .tiptap-editor .tiptap pre { background: rgb(15 23 42); }
.dark .tiptap-editor .tiptap blockquote { border-color: rgb(51 65 85); color: rgb(148 163 184); }
.dark .tiptap-editor .tiptap p.is-editor-empty:first-child::before { color: rgb(100 116 139); }
