/* ============================================================
   LoreFell FellGuide Theme for Obsidian Publish
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=EB+Garamond:ital,wght@0,400;0,500;1,400&family=Jost:wght@300;400;500&display=swap');

/* ── Color Tokens ── */
:root {
  --lf-parchment:       #e8e8e8;
  --lf-parchment-dark:  #dcdcdc;
  --lf-parchment-mid:   #d4d4d4;
  --lf-navy:            #1a2540;
  --lf-navy-mid:        #243058;
  --lf-navy-light:      #2e3d6e;
  --lf-gold:            #c9a84c;
  --lf-gold-light:      #e0c36a;
  --lf-gold-dim:        #a07830;
  --lf-text:            #1e1e1e;
  --lf-text-muted:      #4a4a4a;
  --lf-sidebar-bg:      #e8e8e8;
  --lf-sidebar-text:    #2a2a2a;
  --lf-toc-text:        #555555;
  --lf-toc-active:      #333333;
  --lf-callout-bg:      #1a2540;
  --lf-callout-text:    #e8e8e8;

  /* Override Obsidian Publish's built-in dark mode variables */
  --background-primary:          #e8e8e8 !important;
  --background-primary-alt:      #dcdcdc !important;
  --background-secondary:        #e0e0e0 !important;
  --background-secondary-alt:    #d8d8d8 !important;
  --text-normal:                 #1e1e1e !important;
  --text-muted:                  #555555 !important;
  --text-faint:                  #777777 !important;
  --nav-item-color:              #2a2a2a !important;
  --nav-item-color-hover:        #1a2540 !important;
  --nav-item-background-hover:   #d4d4d4 !important;
  --nav-item-background-active:  #dcdcdc !important;
  --interactive-accent:          #c9a84c !important;
  --interactive-accent-hover:    #e0c36a !important;
  --link-color:                  #a07830 !important;
  --link-color-hover:            #c9a84c !important;
}

/* ── Force light mode on ALL Obsidian Publish chrome ── */
body,
.theme-dark,
.publish-article-page,
.site-body,
.site-body-left-column,
.site-body-right-column,
.site-footer,
.nav-view-outer,
.outline-view-outer,
.graph-view-outer,
.site-header,
.published-container {
  background-color: var(--lf-parchment) !important;
  color: var(--lf-text) !important;
  color-scheme: light !important;
}

/* ── Left Sidebar ── */
.site-body-left-column {
  background-color: #d8d8d8 !important;
  border-right: 1px solid var(--lf-parchment-mid) !important;
}

.nav-view-outer {
  background-color: #d8d8d8 !important;
}

.tree-item-self {
  color: var(--lf-sidebar-text) !important;
  font-family: 'Jost', sans-serif !important;
  font-size: 0.88rem;
}

.tree-item-self:hover {
  background-color: var(--lf-parchment-mid) !important;
  color: var(--lf-navy) !important;
}

.tree-item-self.is-active,
.tree-item-self.is-selected {
  background-color: var(--lf-parchment) !important;
  color: var(--lf-gold-dim) !important;
  font-weight: 600;
}

.tree-item-children {
  border-left: 1px solid #bbbbbb !important;
  margin-left: 0.6rem;
}

.tree-item-icon svg,
.collapse-icon svg {
  color: var(--lf-text-muted) !important;
  stroke: var(--lf-text-muted) !important;
}

/* ── Site Header ── */
.site-header {
  background-color: var(--lf-navy) !important;
  border-bottom: 2px solid var(--lf-gold) !important;
}

.site-header-text,
.site-title,
.published-container .site-header .site-header-left .site-header-text {
  font-family: 'Cinzel', serif !important;
  color: var(--lf-gold) !important;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 1rem;
}

/* ── Search ── */
.search-view-outer,
.nav-search-container {
  background-color: #d8d8d8 !important;
}

input[type="search"],
.search-input {
  background-color: var(--lf-parchment) !important;
  border: 1px solid #aaaaaa !important;
  color: var(--lf-text) !important;
  font-family: 'Jost', sans-serif !important;
  border-radius: 3px;
}

input[type="search"]::placeholder,
.search-input::placeholder {
  color: #888888 !important;
}

/* ── Right Column: Graph + TOC ── */
.site-body-right-column {
  background-color: var(--lf-parchment) !important;
}

.outline-view-outer {
  background-color: var(--lf-parchment) !important;
}

/* "On This Page" label */
.outline-view-outer .tree-item-self,
.outline-view-outer .outline-heading,
.site-body-right-column .outline-heading,
.right-column-title {
  color: #555555 !important;
  font-family: 'Jost', sans-serif !important;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* TOC links */
.outline-view-outer .tree-item-self {
  color: #555555 !important;
  font-size: 0.85rem;
}

.outline-view-outer .tree-item-self:hover {
  color: var(--lf-navy) !important;
  background-color: var(--lf-parchment-dark) !important;
}

.outline-view-outer .tree-item-self.is-active {
  color: var(--lf-navy) !important;
  font-weight: 600;
}

/* Graph panel */
.graph-view-outer {
  background-color: var(--lf-parchment-dark) !important;
  border: 1px solid #cccccc !important;
  border-radius: 4px;
}

/* ── Main Content Area ── */
.page-content,
.markdown-preview-view,
.markdown-rendered,
.publish-article {
  background-color: var(--lf-parchment) !important;
  color: var(--lf-text) !important;
  font-family: 'EB Garamond', Georgia, serif !important;
  font-size: 1.08rem !important;
  line-height: 1.8 !important;
  max-width: 820px;
  padding: 2.5rem 2rem !important;
}

/* ── Fix raw # showing in headers ── */
.markdown-rendered h1,
.markdown-rendered h2,
.markdown-rendered h3,
.markdown-rendered h4,
.markdown-rendered h5,
.markdown-rendered h6,
.page-content h1,
.page-content h2,
.page-content h3,
.page-content h4,
.page-content h5,
.page-content h6 {
  display: block !important;
}

.markdown-rendered h1::before,
.markdown-rendered h2::before,
.markdown-rendered h3::before,
.markdown-rendered h4::before,
.page-content h1::before,
.page-content h2::before,
.page-content h3::before,
.page-content h4::before {
  content: none !important;
  display: none !important;
}

/* ── Headings ── */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Cinzel', 'Times New Roman', serif !important;
  color: var(--lf-navy) !important;
  font-weight: 700 !important;
  font-style: normal !important;
  letter-spacing: 0.03em;
  margin-top: 2rem !important;
  margin-bottom: 0.5rem !important;
  padding-top: 0 !important;
  line-height: 1.3 !important;
}

h1 {
  font-size: 2rem !important;
  border-bottom: 2px solid var(--lf-gold) !important;
  padding-bottom: 0.4rem !important;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

h2 {
  font-size: 1.5rem !important;
  border-bottom: 1px solid var(--lf-gold) !important;
  padding-bottom: 0.3rem !important;
}

h3 {
  font-size: 1.2rem !important;
  color: var(--lf-navy-mid) !important;
  font-style: normal !important;
}

h4 {
  font-size: 1rem !important;
  color: var(--lf-gold-dim) !important;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1 + p, h2 + p, h3 + p, h4 + p {
  margin-top: 0 !important;
}

/* ── Hide heading anchor link icons ── */
.heading-collapse-indicator,
.markdown-rendered .heading-after,
a.heading-after,
.anchor-link,
h1 a[aria-hidden],
h2 a[aria-hidden],
h3 a[aria-hidden],
h4 a[aria-hidden],
h5 a[aria-hidden],
h6 a[aria-hidden] {
  display: none !important;
}

/* Gold italic subtitle directly under h1 or h2 */
h1 + em,
h2 + em {
  display: block;
  font-family: 'Cinzel', serif;
  font-style: italic;
  color: var(--lf-gold) !important;
  font-size: 0.95rem;
  margin-top: -0.4rem;
  margin-bottom: 1rem;
  letter-spacing: 0.02em;
}

/* ── Images (full width, not shrunken) ── */
img,
.markdown-rendered img,
.page-content img {
  max-width: 100% !important;
  width: auto !important;
  height: auto !important;
  display: block;
  margin: 1.5rem auto;
  border-radius: 3px;
}

/* ── Body Text ── */
p {
  margin-bottom: 1rem;
  font-size: 1.05rem;
  color: var(--lf-text);
}

strong {
  color: var(--lf-navy) !important;
  font-weight: 600;
}

em {
  color: var(--lf-text-muted);
}

/* ── HR ── */
hr {
  border: none !important;
  border-top: 1px solid var(--lf-gold) !important;
  margin: 2rem 0 !important;
  opacity: 0.7;
}

/* ── Lists ── */
ul, ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

li {
  margin-bottom: 0.35rem;
  line-height: 1.7;
}

ul li::marker { color: var(--lf-gold); }
ol li::marker {
  color: var(--lf-gold);
  font-family: 'Cinzel', serif;
  font-weight: 600;
}

/* ── Links ── */
a {
  color: var(--lf-gold-dim) !important;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--lf-gold) !important;
}

/* ── Blockquote ── */
blockquote {
  border-left: 3px solid var(--lf-gold) !important;
  background-color: var(--lf-parchment-dark) !important;
  margin: 1.5rem 0;
  padding: 0.8rem 1.2rem !important;
  font-style: italic;
  color: var(--lf-navy-mid) !important;
  font-family: 'EB Garamond', serif;
  font-size: 1.1rem;
}

blockquote p { margin: 0; }

/* ── Callout Boxes ── */
.callout {
  background-color: var(--lf-callout-bg) !important;
  border: 1px solid var(--lf-gold) !important;
  border-left: 4px solid var(--lf-gold) !important;
  border-radius: 3px;
  padding: 1rem 1.2rem !important;
  margin: 1.5rem 0;
  color: var(--lf-callout-text) !important;
}

.callout-title {
  font-family: 'Cinzel', serif !important;
  font-size: 0.9rem !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--lf-gold) !important;
  margin-bottom: 0.5rem;
}

.callout-content,
.callout-content p {
  color: var(--lf-callout-text) !important;
  font-size: 0.98rem;
}

.callout-content a { color: var(--lf-gold-light) !important; }

/* ── Tables ── */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.98rem;
}

thead tr {
  background-color: var(--lf-navy) !important;
  color: var(--lf-gold) !important;
}

thead th {
  font-family: 'Cinzel', serif !important;
  font-size: 0.85rem !important;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.6rem 0.9rem;
  text-align: left;
  border-bottom: 2px solid var(--lf-gold);
  color: var(--lf-gold) !important;
}

tbody tr { border-bottom: 1px solid var(--lf-parchment-dark); }
tbody tr:nth-child(even) { background-color: var(--lf-parchment-dark) !important; }
tbody td { padding: 0.5rem 0.9rem; color: var(--lf-text); }

/* ── Inline Code ── */
code {
  background-color: var(--lf-navy) !important;
  color: var(--lf-gold-light) !important;
  font-size: 0.88em;
  padding: 0.1em 0.4em;
  border-radius: 3px;
  font-family: 'Jost', monospace;
}

/* ── Code Blocks ── */
pre {
  background-color: var(--lf-navy) !important;
  border: 1px solid var(--lf-gold-dim) !important;
  padding: 1rem 1.2rem !important;
  border-radius: 4px;
  overflow-x: auto;
}

pre code {
  background: transparent !important;
  color: var(--lf-parchment) !important;
  font-size: 0.9rem;
}

/* ── Tags ── */
.tag {
  background-color: var(--lf-parchment-dark) !important;
  color: var(--lf-navy) !important;
  font-family: 'Jost', sans-serif !important;
  font-size: 0.75rem;
  padding: 0.15em 0.6em;
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid #bbbbbb;
}

/* ── Footer ── */
.site-footer {
  background-color: var(--lf-navy) !important;
  border-top: 2px solid var(--lf-gold) !important;
  color: var(--lf-parchment) !important;
  font-family: 'Jost', sans-serif;
  font-size: 0.8rem;
  text-align: center;
  padding: 1rem;
}

/* ── "Powered by Obsidian Publish" badge ── */
.publish-footer,
.site-footer-powered-by,
a[href*="obsidian.md"],
.published-container > a,
div[class*="powered"] {
  background-color: transparent !important;
  border: none !important;
  color: #999999 !important;
  font-size: 0.72rem !important;
  font-family: 'Jost', sans-serif !important;
  opacity: 0.5;
  padding: 0.3rem 0.6rem !important;
  border-radius: 0 !important;
}

a[href*="obsidian.md"]:hover,
.publish-footer:hover {
  opacity: 0.8;
  color: #777777 !important;
  background-color: transparent !important;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 8px; background: #cccccc; }
::-webkit-scrollbar-thumb { background: #aaaaaa; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--lf-gold-dim); }

/* ── Mobile ── */
@media (max-width: 768px) {
  .page-content,
  .markdown-preview-view,
  .markdown-rendered {
    padding: 1.5rem 1rem !important;
    font-size: 1rem !important;
  }
  h1 { font-size: 1.6rem !important; }
  h2 { font-size: 1.3rem !important; }
  h3 { font-size: 1.1rem !important; }
}
