/* novawiki — nova-Optik für Outline, angelehnt an novaplan (plan.foamnova.online/static/app.css).
   Wird von novawiki_style (nginx) in jede Seite gehängt. Outline bleibt unverändert.

   Regel: nur stabile Ansatzpunkte verwenden — Elemente, IDs (#sidebar), Rollen (role=main/menu/dialog),
   aria-/data-Attribute (data-variant, aria-current) und die Editor-Klassen von ProseMirror.
   Nie die erzeugten Klassen von Outline (sc-xxxx, zufällige Kürzel): die ändern sich mit jeder Version.
   Nach jedem Outline-Update: Runbook Abschnitt 9, Sichtprüfung der Optik. */

/* Nunito (SIL Open Font License), selbst gehostet wie in novaplan */
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 400 800; font-display: swap; src: url("/nova/nunito.woff2") format("woff2"); }

:root {
  --ground: #F3EEE6;
  --ground-2: #E9E2D6;
  --panel: #FFFFFF;
  --card: #FBF9F5;
  --hair: #EFE8DC;
  --hair-2: #E2D9CB;
  --ink: #2B2622;
  --ink-2: #6E645B;
  --ink-3: #74695E;
  /* Toolfarbe novawiki: Mahagoni (Portal-Kachel). Knopffläche mit weißem Text ≥ 4.5:1 */
  --act: #A86A58;
  --act-ink: #7A4A3C;
  --act-fill: #8C5A4A;
  --act-fill-hover: #774B3D;
  --act-soft: #F4E6E0;
  --r-panel: 16px;
  --r-card: 14px;
  --r-pill: 999px;
  --shadow-pop: 0 12px 32px -8px rgba(70, 50, 25, .22), 0 2px 6px rgba(70, 50, 25, .06);
  --font: "Nunito", ui-rounded, "SF Pro Rounded", -apple-system, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}

/* --- Schrift ------------------------------------------------------------ */
html, body, #root, button, input, textarea, select, .ProseMirror {
  font-family: var(--font) !important;
}
code, pre, kbd, samp, .ProseMirror code, .ProseMirror pre, .ProseMirror pre * {
  font-family: var(--mono) !important;
}
body { color: var(--ink); -webkit-font-smoothing: antialiased; }
::selection { background: var(--act-soft); color: var(--ink); }
* { scrollbar-width: thin; scrollbar-color: var(--hair-2) transparent; }
:focus-visible { outline-color: var(--act) !important; }
input, textarea { caret-color: var(--act); }

/* --- Seitenleiste: warmer Grund wie novaplan ------------------------------ */
#sidebar {
  background: var(--ground) !important;
  border-right: 1px solid var(--hair) !important;
}
#sidebar a {
  border-radius: 10px !important;
  color: var(--ink-2) !important;
  font-weight: 650;
  transition: background-color .15s;
}
#sidebar a:hover { background: rgba(255, 255, 255, .7) !important; color: var(--ink) !important; }
#sidebar a[aria-current="page"] {
  background: var(--panel) !important;
  color: var(--ink) !important;
  box-shadow: 0 1px 2px rgba(80, 60, 30, .1);
}
#sidebar a svg { color: var(--ink-3); }
#sidebar a[aria-current="page"] svg { color: var(--act-fill); }
#sidebar button:hover { background-color: rgba(255, 255, 255, .7) !important; }
/* Abschnittstitel („Sammlungen", „Persönlich") */
#sidebar [data-section] > div:first-child { color: var(--ink-3) !important; }

/* Logo des Arbeitsbereichs (aria-label „Logo“) durch die Wiki-Kachel ersetzen, wie in allen nova-Tools */
[aria-label="Logo"] {
  background: url("/nova/wiki.svg") center / cover no-repeat !important;
  color: transparent !important;
  font-size: 0 !important;
  border-radius: 6px !important;
}
img[aria-label="Logo"] { object-position: -9999px 0; }

/* Wortmarke wie bei novaplan: „nova“ normal in Grau, „wiki“ fett in Toolfarbe.
   Ersetzt den Namen des Arbeitsbereichs im Kontoknopf oben links (aria-label „Konto“). */
#sidebar button[aria-label="Konto"]:has([aria-label="Logo"]) span:not(:has(*)) { font-size: 0 !important; letter-spacing: 0; }
#sidebar button[aria-label="Konto"]:has([aria-label="Logo"]) span:not(:has(*))::before {
  content: "nova"; font-size: 19px; font-weight: 400; color: #8B9099; letter-spacing: -.015em;
}
#sidebar button[aria-label="Konto"]:has([aria-label="Logo"]) span:not(:has(*))::after {
  content: "wiki"; font-size: 19px; font-weight: 700; color: var(--act-fill); letter-spacing: -.015em;
}

/* --- Knöpfe -------------------------------------------------------------- */
[data-variant="primary"] {
  background: var(--act-fill) !important;
  color: #fff !important;
  border-radius: var(--r-pill) !important;
  box-shadow: none !important;
  font-weight: 650;
  transition: background-color .15s, transform .15s var(--ease);
}
[data-variant="primary"]:hover { background: var(--act-fill-hover) !important; }
[data-variant="primary"]:active { transform: scale(.97); }
[data-variant="primary"] svg { color: #fff !important; fill: currentColor; }
[data-variant="neutral"] {
  border-radius: 10px !important;
  font-weight: 650;
}
[data-variant="neutral"]:hover { background-color: var(--ground) !important; }
[data-variant="danger"] { border-radius: var(--r-pill) !important; }

/* --- Felder -------------------------------------------------------------- */
[role="main"] label > div:has(> input) {
  border-radius: var(--r-pill) !important;
  border-color: var(--hair-2) !important;
}
[role="main"] label > div:has(> input:focus) {
  border-color: var(--act) !important;
  box-shadow: 0 0 0 3px var(--act-soft) !important;
}
[role="dialog"] input:not([type="checkbox"]):not([type="radio"]),
[role="dialog"] textarea { border-radius: 12px; }

/* --- Menüs, Popover, Dialoge --------------------------------------------- */
[role="menu"], [role="listbox"] {
  border-radius: var(--r-panel) !important;
  box-shadow: var(--shadow-pop) !important;
  border: 0 !important;
}
[role="menuitem"], [role="option"], [role="menuitemcheckbox"], [role="menuitemradio"] {
  border-radius: 10px !important;
}
[role="menuitem"]:hover, [role="menuitem"]:focus,
[role="option"]:hover, [role="option"][aria-selected="true"] {
  background: var(--ground) !important;
  color: var(--ink) !important;
}
[role="dialog"] { border-radius: 20px; }

/* --- Hauptbereich -------------------------------------------------------- */
[role="main"] h1 { letter-spacing: -.02em; color: var(--ink); }
/* Reiter auf der Startseite: aktiver Reiter in Toolfarbe */
[role="main"] a[aria-current="page"] { color: var(--ink) !important; }

/* --- Editor (ProseMirror-Klassen sind stabil) ----------------------------- */
.ProseMirror { color: var(--ink); }
.ProseMirror h1, .ProseMirror h2, .ProseMirror h3, .ProseMirror h4 {
  letter-spacing: -.015em;
  color: var(--ink);
}
.ProseMirror a:not(.heading-anchor):not(.heading-position-anchor) {
  color: var(--act-ink) !important;
  text-decoration-color: color-mix(in srgb, var(--act) 45%, transparent);
  text-underline-offset: 2px;
}
.ProseMirror blockquote {
  border-left: 3px solid var(--act) !important;
  color: var(--ink-2);
}
.ProseMirror :not(pre) > code, .ProseMirror code.inline {
  background: var(--ground) !important;
  border: 1px solid var(--hair) !important;
  border-radius: 6px !important;
  color: var(--ink) !important;
}
.ProseMirror pre {
  background: var(--card) !important;
  border: 1px solid var(--hair) !important;
  border-radius: var(--r-card) !important;
}
.ProseMirror hr { border-color: var(--hair-2) !important; }
.ProseMirror .notice-block {
  border-radius: var(--r-card) !important;
  border: 0 !important;
}
.ProseMirror .notice-block.info { background: #E6EEF3 !important; }
.ProseMirror .notice-block.success { background: #E1EDD9 !important; }
.ProseMirror .notice-block.tip { background: var(--act-soft) !important; }
.ProseMirror .notice-block.warning { background: #F6E6C8 !important; }
.ProseMirror table { border-radius: var(--r-card); overflow: hidden; }
.ProseMirror th { background: var(--card) !important; color: var(--ink-2); font-weight: 700; }
.ProseMirror td, .ProseMirror th { border-color: var(--hair) !important; }
.ProseMirror img { border-radius: var(--r-card); }
.ProseMirror mark { background: #F6E6C8 !important; color: inherit; border-radius: 3px; }
