/*
 * Rich-text styles: Tiptap editor chrome + rendered ActionText content.
 * The "rich-text-content" class wraps every <%= record.content %> render
 * (see app/views/layouts/action_text/contents/_content.html.erb).
 */

/* ---------- Tiptap editor wrapper ---------- */
.tiptap-editor {
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--bg);
  overflow: hidden;
}

.tiptap-editor:focus-within {
  border-color: var(--moss);
  box-shadow: 0 0 0 3px rgba(152, 149, 88, 0.18);
}

/* ---------- Toolbar ---------- */
.tiptap-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  padding: 0.4rem 0.5rem;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--rule);
}

.tiptap-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.85rem;
  height: 1.85rem;
  padding: 0 0.45rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.tiptap-btn:hover {
  background: rgba(38, 40, 25, 0.06);
  color: var(--ink);
}

.tiptap-btn:focus-visible {
  outline: 2px solid var(--moss);
  outline-offset: 1px;
}

.tiptap-btn.is-active {
  background: rgba(152, 149, 88, 0.18);
  border-color: rgba(152, 149, 88, 0.45);
  color: var(--ink);
}

.tiptap-sep {
  width: 1px;
  height: 1.1rem;
  background: var(--rule);
  margin: 0 0.15rem;
}

.tiptap-sep-grow {
  background: transparent;
  flex: 1;
  height: 0;
  margin: 0;
}

/* ---------- Editor surface (ProseMirror) ---------- */
.tiptap-mount {
  padding: 0.7rem 0.9rem;
  min-height: 12rem;
  max-height: 60vh;
  overflow-y: auto;
}

.tiptap-surface {
  outline: none;
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
}

/* The hidden textarea must stay submittable; just remove it from the visual flow. */
textarea[data-tiptap-editor-target="input"] {
  display: none;
}

/* ---------- Shared rich-text content styles (editor + rendered) ---------- */
.tiptap-surface,
.rich-text-content {
  font-family: var(--serif);
  line-height: 1.65;
  color: var(--ink);
}

.tiptap-surface > * + *,
.rich-text-content > * + * {
  margin-top: 0.85em;
}

.tiptap-surface h2,
.rich-text-content h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.45rem;
  letter-spacing: -0.01em;
  margin-top: 1.4em;
}

.tiptap-surface h3,
.rich-text-content h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.15rem;
  letter-spacing: -0.005em;
  margin-top: 1.2em;
}

.tiptap-surface ul,
.tiptap-surface ol,
.rich-text-content ul,
.rich-text-content ol {
  padding-left: 1.5rem;
}

.tiptap-surface ul,
.rich-text-content ul {
  list-style: disc;
}

.tiptap-surface ol,
.rich-text-content ol {
  list-style: decimal;
}

.tiptap-surface li > p,
.rich-text-content li > p {
  margin: 0;
}

.tiptap-surface blockquote,
.rich-text-content blockquote {
  border-left: 3px solid var(--rule);
  padding-left: 0.9rem;
  color: var(--ink-mute);
  font-style: italic;
}

.tiptap-surface code,
.rich-text-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
  background: rgba(38, 40, 25, 0.06);
  border-radius: 3px;
  padding: 0.1em 0.35em;
}

.tiptap-surface pre,
.rich-text-content pre {
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.7rem 0.9rem;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88rem;
}

.tiptap-surface pre code,
.rich-text-content pre code {
  background: transparent;
  padding: 0;
}

.tiptap-surface a,
.rich-text-content a {
  color: var(--moss-bright);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.tiptap-surface hr,
.rich-text-content hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 1.4em 0;
}

/* ---------- Static-content admin listing ---------- */
.static-content-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.65rem;
}

.static-content-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.05rem;
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: 4px;
}

.static-content-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.static-content-meta .title {
  font-family: var(--serif);
  font-size: 1.05rem;
  color: var(--ink);
  text-decoration: none;
}

.static-content-meta .title:hover {
  text-decoration: underline;
}

.static-content-meta .slug {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  color: var(--ink-mute);
}

.static-content-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.static-content-preview {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: 4px;
  max-width: 48rem;
}

@media (max-width: 540px) {
  .static-content-card {
    flex-wrap: wrap;
  }

  .static-content-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
