/* ==========================================================================
   Flowershow Obsidian-Parity Stylesheet (Dual Mode: Light + Dark)
   Vault: FORMARE ȘI PRACTICĂ LITURGICĂ
   Base Accent: #b71a1a (.obsidian/appearance.json) + tags-colores.css
   ========================================================================== */

:root {
  /* Fonts matching Obsidian macOS/Desktop default UI */
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", "Helvetica Neue", Arial, sans-serif;
  --font-heading: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Flowershow core light tokens */
  --color-l-background: #ffffff;
  --color-l-foreground: #222222;
  --color-l-accent: #b71a1a;
  --accent-color: #b71a1a;

  /* Flowershow core dark tokens */
  --color-d-background: #1e1e1e;
  --color-d-foreground: #dadada;
  --color-d-accent: #e05252;

  /* Semantic Obsidian surface tokens (Light default) */
  --obs-bg: #ffffff;
  --obs-bg-secondary: #f6f6f6;
  --obs-text: #222222;
  --obs-muted: #5c5c5c;
  --obs-accent: #b71a1a;
  --obs-accent-hover: #8f1414;
  --obs-border: #e0e0e0;
  --obs-border-subtle: #ebebeb;
  --obs-code-bg: #f5f5f5;
  --obs-quote-bg: rgba(183, 26, 26, 0.04);
  --obs-table-head: #f8f3f3;
  --obs-table-stripe: #fcfafa;
  --obs-border-radius: 6px;
}

[data-theme="dark"],
.dark {
  --color-l-background: #1e1e1e;
  --color-l-foreground: #dadada;
  --color-l-accent: #e05252;
  --accent-color: #e05252;

  --obs-bg: #1e1e1e;
  --obs-bg-secondary: #262626;
  --obs-text: #dadada;
  --obs-muted: #a3a3a3;
  --obs-accent: #e05252;
  --obs-accent-hover: #f27474;
  --obs-border: #363636;
  --obs-border-subtle: #2d2d2d;
  --obs-code-bg: #2a2a2a;
  --obs-quote-bg: rgba(224, 82, 82, 0.08);
  --obs-table-head: #2b2222;
  --obs-table-stripe: #242121;
}

/* ---------- Base Layout & Navbar / Sidebar ---------- */
html,
body {
  font-family: var(--font-body);
  background-color: var(--obs-bg);
  color: var(--obs-text);
  line-height: 1.6;
}

.site-navbar,
header {
  background-color: var(--obs-bg);
  border-bottom: 1px solid var(--obs-border);
}

/* ---------- Obsidian Reading View Typography ---------- */
article,
main .prose {
  font-family: var(--font-body);
  color: var(--obs-text);
  font-size: 16px;
  line-height: 1.6;
}

article h1,
.prose h1 {
  font-size: 1.85em;
  font-weight: 700;
  color: var(--obs-text);
  border-bottom: 1px solid var(--obs-border-subtle);
  padding-bottom: 0.25em;
  margin-top: 1.2em;
  margin-bottom: 0.6em;
  letter-spacing: -0.015em;
}

article h2,
.prose h2 {
  font-size: 1.45em;
  font-weight: 600;
  color: var(--obs-text);
  margin-top: 1.4em;
  margin-bottom: 0.5em;
}

article h3,
.prose h3 {
  font-size: 1.2em;
  font-weight: 600;
  color: var(--obs-accent);
  margin-top: 1.2em;
  margin-bottom: 0.4em;
}

article h4,
.prose h4 {
  font-size: 1.05em;
  font-weight: 600;
  color: var(--obs-text);
  margin-top: 1em;
  margin-bottom: 0.35em;
}

/* Links matching Obsidian accent */
article a:not([href^="/tags/"]):not(.tag),
.prose a:not([href^="/tags/"]):not(.tag) {
  color: var(--obs-accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--obs-accent) 38%, transparent);
  text-underline-offset: 2px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

article a:not([href^="/tags/"]):not(.tag):hover,
.prose a:not([href^="/tags/"]):not(.tag):hover {
  color: var(--obs-accent-hover);
  text-decoration-color: var(--obs-accent-hover);
}

/* Nested lists with subtle Obsidian indentation guides */
article ul ul,
article ol ul,
article ul ol,
.prose ul ul,
.prose ol ul,
.prose ul ol {
  border-left: 1px solid var(--obs-border);
  margin-left: 0.35rem;
  padding-left: 1.1rem;
}

article hr,
.prose hr {
  border: none;
  border-top: 1px solid var(--obs-border);
  margin: 1.75rem 0;
}

article code,
.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background-color: var(--obs-code-bg);
  padding: 0.12em 0.38em;
  border-radius: 4px;
}

article pre,
.prose pre {
  background-color: var(--obs-bg-secondary);
  border: 1px solid var(--obs-border);
  border-radius: var(--obs-border-radius);
  padding: 0.9rem 1rem;
  overflow-x: auto;
}

/* ---------- Obsidian Highlights (==text== & inline <mark>) ---------- */
mark:not([style]) {
  background-color: rgba(255, 193, 7, 0.28) !important;
  color: inherit !important;
  padding: 1px 5px;
  border-radius: 4px;
  border-bottom: 2px solid rgba(255, 179, 0, 0.65);
  font-weight: 500;
}

[data-theme="dark"] mark:not([style]),
.dark mark:not([style]) {
  background-color: rgba(255, 193, 7, 0.24) !important;
  color: #fef3c7 !important;
  border-bottom-color: rgba(251, 191, 36, 0.8);
}

mark[style*="background"] {
  padding: 1px 5px;
  border-radius: 4px;
}

/* Contrast fix for pastel highlights (#c5f6fa, #fff3bf, #ffc9c9, #d3f9d8) in dark mode */
[data-theme="dark"] mark[style*="background"],
.dark mark[style*="background"] {
  color: #1a1a1a !important;
  font-weight: 500;
}

/* ---------- Dark Mode Rubric <font> Contrast Fix ---------- */
[data-theme="dark"] font[color="#7f1d1d"],
[data-theme="dark"] font[color="#8b0000"],
[data-theme="dark"] font[color="#9b1c1c"],
[data-theme="dark"] font[color="#b71a1a"],
[data-theme="dark"] font[color="#b91c1c"],
[data-theme="dark"] font[color="#c0392b"],
[data-theme="dark"] font[color="red"],
.dark font[color="#7f1d1d"],
.dark font[color="#8b0000"],
.dark font[color="#9b1c1c"],
.dark font[color="#b71a1a"],
.dark font[color="#b91c1c"],
.dark font[color="#c0392b"],
.dark font[color="red"] {
  color: #ff6b6b !important;
}

/* ---------- Blockquotes ---------- */
article blockquote,
.prose blockquote {
  border-left: 3px solid var(--obs-accent);
  background-color: var(--obs-quote-bg);
  padding: 0.55rem 1rem;
  margin: 1.1rem 0;
  border-radius: 0 var(--obs-border-radius) var(--obs-border-radius) 0;
  color: var(--obs-text);
  font-style: normal;
}

article blockquote p:last-child,
.prose blockquote p:last-child {
  margin-bottom: 0;
}

/* ---------- Callouts (Obsidian Parity) ---------- */
.callout {
  border-radius: var(--obs-border-radius);
  border: 1px solid color-mix(in srgb, var(--callout-color, var(--obs-accent)) 28%, transparent);
  border-left: 4px solid var(--callout-color, var(--obs-accent));
  background-color: color-mix(in srgb, var(--callout-color, var(--obs-accent)) 8%, transparent);
  padding: 0.85rem 1rem;
  margin: 1.15rem 0;
}

.callout[data-callout="note"],
.callout[data-callout="info"] {
  --callout-color: #2563eb;
}

.callout[data-callout="important"],
.callout[data-callout="tip"],
.callout[data-callout="success"] {
  --callout-color: #0d9488;
}

.callout[data-callout="warning"],
.callout[data-callout="caution"] {
  --callout-color: #d97706;
}

.callout[data-callout="danger"],
.callout[data-callout="error"] {
  --callout-color: #dc2626;
}

.callout[data-callout="quote"] {
  --callout-color: #64748b;
}

[data-theme="dark"] .callout,
.dark .callout {
  background-color: color-mix(in srgb, var(--callout-color, var(--obs-accent)) 14%, var(--obs-bg));
}

.callout-title {
  color: var(--callout-color, var(--obs-accent));
  font-weight: 600;
}

/* ---------- Tables ---------- */
article table,
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2rem 0;
  font-size: 0.94em;
  display: block;
  overflow-x: auto;
}

article th,
article td,
.prose th,
.prose td {
  border: 1px solid var(--obs-border);
  padding: 0.5rem 0.75rem;
  text-align: left;
  vertical-align: top;
}

article th,
.prose th {
  background-color: var(--obs-table-head);
  color: var(--obs-accent);
  font-weight: 600;
  border-bottom: 2px solid color-mix(in srgb, var(--obs-accent) 55%, var(--obs-border));
}

article tbody tr:nth-child(even),
.prose tbody tr:nth-child(even) {
  background-color: var(--obs-table-stripe);
}

/* ---------- Images ---------- */
article img,
.prose img {
  border-radius: 6px;
  border: 1px solid var(--obs-border-subtle);
  max-width: 100%;
  height: auto;
}

/* ---------- Mermaid Diagrams ---------- */
.mermaid {
  display: flex;
  justify-content: center;
  margin: 1.25rem 0;
  padding: 0.75rem;
  border-radius: var(--obs-border-radius);
  background-color: var(--obs-bg-secondary);
  border: 1px solid var(--obs-border-subtle);
  overflow-x: auto;
}

.mermaid svg {
  max-width: 100% !important;
  height: auto !important;
}

/* Keep light pastel Mermaid diagrams legible in dark mode */
[data-theme="dark"] .mermaid,
.dark .mermaid {
  background-color: #252525;
  border-color: #3a3a3a;
}

/* ---------- Tag Pills (Ported from .obsidian/snippets/tags-colores.css) ---------- */
a[href^="/tags/"],
a[href*="/tags/"],
a.tag,
.tag {
  --tag-c: var(--obs-accent);
  color: var(--tag-c) !important;
  background-color: color-mix(in srgb, var(--tag-c) 15%, transparent) !important;
  border: 1px solid color-mix(in srgb, var(--tag-c) 45%, transparent) !important;
  border-radius: 999px !important;
  padding: 2px 10px !important;
  margin: 2px 4px 2px 0 !important;
  font-size: 0.84em !important;
  font-weight: 600 !important;
  line-height: 1.35 !important;
  text-decoration: none !important;
  display: inline-block !important;
  transition: transform 0.12s ease, background-color 0.15s ease;
}

a[href^="/tags/"]:hover,
a[href*="/tags/"]:hover,
a.tag:hover {
  background-color: color-mix(in srgb, var(--tag-c) 24%, transparent) !important;
  transform: translateY(-1px);
}

/* 8-color cyclic fallback palette (exact match with tags-colores.css) */
a[href^="/tags/"]:nth-of-type(8n+1), a.tag:nth-of-type(8n+1) { --tag-c: #1e88e5; }
a[href^="/tags/"]:nth-of-type(8n+2), a.tag:nth-of-type(8n+2) { --tag-c: #8e24aa; }
a[href^="/tags/"]:nth-of-type(8n+3), a.tag:nth-of-type(8n+3) { --tag-c: #2e7d32; }
a[href^="/tags/"]:nth-of-type(8n+4), a.tag:nth-of-type(8n+4) { --tag-c: #ef6c00; }
a[href^="/tags/"]:nth-of-type(8n+5), a.tag:nth-of-type(8n+5) { --tag-c: #d81b60; }
a[href^="/tags/"]:nth-of-type(8n+6), a.tag:nth-of-type(8n+6) { --tag-c: #00897b; }
a[href^="/tags/"]:nth-of-type(8n+7), a.tag:nth-of-type(8n+7) { --tag-c: #c99700; }
a[href^="/tags/"]:nth-of-type(8n+8), a.tag:nth-of-type(8n+8) { --tag-c: #3949ab; }

/* Specific tag overrides matching tags-colores.css + liturgical domain */
a[href$="/Index" i], a[href="#Index" i] { --tag-c: #1e88e5; }
a[href$="/Subtemă" i], a[href*="/Subtem" i], a[href="#Subtemă" i] { --tag-c: #1e88e5; }
a[href$="/Sinteză" i], a[href*="/Sintez" i], a[href="#Sinteză" i] { --tag-c: #8e24aa; }
a[href$="/Recapitulare" i], a[href="#Recapitulare" i] { --tag-c: #8e24aa; }
a[href$="/Precizări" i], a[href*="/Preciz" i], a[href="#Precizări" i] { --tag-c: #8e24aa; }
a[href$="/Glosar" i], a[href="#Glosar" i] { --tag-c: #8e24aa; }

a[href$="/Partea1" i], a[href="#Partea1" i] { --tag-c: #8e24aa; }
a[href$="/Partea2" i], a[href="#Partea2" i] { --tag-c: #8e24aa; }
a[href$="/Partea3" i], a[href="#Partea3" i] { --tag-c: #8e24aa; }
a[href$="/Partea4" i], a[href="#Partea4" i] { --tag-c: #8e24aa; }
a[href$="/Partea5" i], a[href="#Partea5" i] { --tag-c: #d81b60; }
a[href$="/Partea6" i], a[href="#Partea6" i] { --tag-c: #00897b; }

a[href$="/Complement" i], a[href="#Complement" i] { --tag-c: #1e88e5; }
a[href$="/Complemente" i], a[href="#Complemente" i] { --tag-c: #827717; }
a[href$="/Concept" i], a[href="#Concept" i] { --tag-c: #2e7d32; }
a[href$="/Concepte" i], a[href="#Concepte" i] { --tag-c: #00897b; }
a[href$="/Persoană" i], a[href*="/Persoan" i], a[href="#Persoană" i] { --tag-c: #1e88e5; }
a[href$="/Persoane" i], a[href="#Persoane" i] { --tag-c: #ef6c00; }

a[href$="/Tipic" i], a[href$="/TipicBisericesc" i] { --tag-c: #b71a1a; }
a[href$="/PracticaLiturgica" i], a[href$="/MasterMOC" i] { --tag-c: #b71a1a; }
a[href$="/FTOUBRoma" i], a[href$="/Examen" i] { --tag-c: #d81b60; }
a[href$="/Liturghie" i], a[href="#Liturghie" i] { --tag-c: #c62828; }
a[href$="/Liturghier" i], a[href$="/Liturghierul" i] { --tag-c: #b71a1a; }
a[href$="/Ceaslov" i], a[href$="/Octoih" i], a[href$="/Psaltire" i] { --tag-c: #1565c0; }
a[href$="/Mineie" i], a[href="#Mineie" i] { --tag-c: #ef6c00; }
a[href$="/Triod" i] { --tag-c: #6a1b9a; }
a[href$="/Penticostar" i] { --tag-c: #2e7d32; }
a[href$="/Molitfelnic" i] { --tag-c: #00897b; }
a[href$="/Altar" i], a[href$="/VaseLiturgice" i], a[href$="/Veșminte" i] { --tag-c: #8e24aa; }
a[href$="/Ierarh" i], a[href$="/Ierarhi" i] { --tag-c: #00897b; }
a[href$="/Preot" i], a[href="#Preot" i] { --tag-c: #d81b60; }
a[href$="/Monahism" i], a[href$="/Mănăstire" i] { --tag-c: #3949ab; }
a[href$="/Sfânt" i], a[href$="/Sfinți" i] { --tag-c: #ef6c00; }

[data-theme="dark"] a[href^="/tags/"],
[data-theme="dark"] a[href*="/tags/"],
[data-theme="dark"] a.tag,
.dark a[href^="/tags/"],
.dark a[href*="/tags/"],
.dark a.tag {
  background-color: color-mix(in srgb, var(--tag-c) 24%, transparent) !important;
  border-color: color-mix(in srgb, var(--tag-c) 60%, transparent) !important;
}

/* ---------- Liturgical Service Pages (Justification, Headings & Ornaments) ---------- */
article:has(.lit-ornament-top) p:not(:has(img)):not(:has(> em:only-child)):not(.lit-closing-doxology),
.prose:has(.lit-ornament-top) p:not(:has(img)):not(:has(> em:only-child)):not(.lit-closing-doxology) {
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
  line-height: 1.66;
}

article img[src*="ornament_"],
.prose img[src*="ornament_"] {
  display: block !important;
  margin: 0.7rem auto !important;
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  max-width: min(100%, 440px);
  height: auto;
}

[data-theme="dark"] article img[src*="ornament_"],
[data-theme="dark"] .prose img[src*="ornament_"],
.dark article img[src*="ornament_"],
.dark .prose img[src*="ornament_"] {
  filter: brightness(1.18) saturate(1.12);
}

article:has(.lit-ornament-top) h2,
.prose:has(.lit-ornament-top) h2 {
  text-align: center;
  color: var(--obs-accent);
  font-weight: 700;
  border-bottom: 1.5px solid color-mix(in srgb, var(--obs-accent) 35%, transparent);
  padding-bottom: 0.35rem;
  margin-top: 1.4rem;
}

article:has(.lit-ornament-top) h3,
.prose:has(.lit-ornament-top) h3 {
  color: var(--obs-accent);
  font-weight: 700;
}

article:has(.lit-ornament-top) h4,
.prose:has(.lit-ornament-top) h4 {
  color: color-mix(in srgb, var(--obs-accent) 85%, var(--obs-text));
  font-weight: 600;
}

article:has(.lit-ornament-top) p > font[color="#d83931"]:first-child > b:first-child,
.prose:has(.lit-ornament-top) p > font[color="#d83931"]:first-child > b:first-child {
  font-size: 1.18em;
  font-weight: 700;
}

.lit-closing-doxology {
  text-align: center !important;
  font-size: 0.96em;
  letter-spacing: 0.02em;
  margin: 0.5rem auto 0.25rem auto;
}

.lit-ornament-top,
.lit-ornament-bottom {
  display: block;
  height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
}
