/* ---------- Fonts ---------- */
body {
  --font-text-theme: "Iowan Old Style", "Palatino Linotype", Georgia, "Times New Roman", serif;
  --font-interface-theme:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", system-ui, sans-serif;
  --font-monospace-theme:
    ui-monospace, "SF Mono", "Cascadia Code", "Fira Code", monospace;
}

/* ---------- Structure (same in both modes) ---------- */
.published-container {
  --page-width: 780px;
  --page-side-padding: 48px;
  --font-text-size: 18px;
  --line-height: 1.72;

  /* Navigation sidebar */
  --nav-parent-item-weight: 600;
  --nav-item-weight-active: 600;
  --nav-item-size: 15px;
  --nav-parent-item-size: 15px;
}

/* ============================================================
   LIGHT MODE
   ============================================================ */
.theme-light {
  /* Surfaces */
  --background-primary: #fbfbfa;      /* content */
  --background-primary-alt: #f7f9fc;
  --background-secondary: #f2f4f7;    /* sidebar + graph panel */
  --background-secondary-alt: #eef2f7;
  --background-modifier-border: #e3e7ee;
  --background-modifier-hover: #eef2f7;

  /* Body + headings */
  --text-normal: #22252b;
  --text-muted: #5a6b82;
  --text-faint: #6f7d92;
  --h1-color: #1a2a44;
  --h2-color: #24395c;
  --h3-color: #2c4a70;
  --h4-color: #2c4a70;
  --h5-color: #5a6b82;
  --h6-color: #5a6b82;

  /* Links / accent */
  --text-accent: #1f4e79;
  --text-accent-hover: #3a68a0;
  --interactive-accent: #2c4a70;
  --link-color: #1f4e79;
  --link-color-hover: #3a68a0;
  --link-decoration-color: #a8c0dc;

  /* Unresolved (unpublished) links — muted but readable */
  --link-unresolved-color: #5c6a80;
  --link-unresolved-opacity: 1;
  --link-unresolved-decoration-color: #b8c2d2;

  /* Selection / code */
  --text-selection: #d6e3f2;
  --code-background: #eef2f7;
  --code-normal: #1f4e79;
  --blockquote-border-color: #2c4a70;
  --hr-color: #e3e7ee;

  /* Navigation */
  --nav-parent-item-color: #24395c;
  --nav-parent-item-color-active: #1a2a44;
  --nav-item-color: #45526b;
  --nav-item-color-hover: #1f4e79;
  --nav-item-color-active: #2c4a70;
  --nav-item-border-color-active: #2c4a70;
  --nav-collapse-icon-color: #8695ab;
  --nav-collapse-icon-color-hover: #2c4a70;

  /* Graph */
  --graph-line: #cfd8e6;
  --graph-node: #5a6b82;
  --graph-node-focused: #2c4a70;
  --graph-node-tag: #3a68a0;
  --graph-node-unresolved: #b9c2d0;
  --graph-text: #45526b;
}

/* ============================================================
   DARK MODE
   ============================================================ */
.theme-dark {
  /* Surfaces — one family so content + chrome match */
  --background-primary: #12171f;
  --background-primary-alt: #161c26;
  --background-secondary: #0e131a;    /* sidebar + graph slightly deeper */
  --background-secondary-alt: #10151d;
  --background-modifier-border: #2a3444;
  --background-modifier-hover: #1b2432;

  /* Body + headings — slightly toned down from #d6dce6 to reduce glare */
  --text-normal: #c4ccd8;
  --text-muted: #9aa7bb;
  --text-faint: #748296;
  --h1-color: #eaf0f8;
  --h2-color: #cdd9ea;
  --h3-color: #b3c5de;
  --h4-color: #b3c5de;
  --h5-color: #9aa7bb;
  --h6-color: #9aa7bb;

  /* Links / accent — lightened so they read on dark */
  --text-accent: #8fb3dd;
  --text-accent-hover: #aecdf0;
  --interactive-accent: #4a7bb5;
  --link-color: #8fb3dd;
  --link-color-hover: #aecdf0;
  --link-decoration-color: #3f5a7d;

  /* Unresolved links — THE contrast fix.
     Was ~#8695ab (too dim). Now lighter + dashed underline
     so it stays distinguishable from resolved links without
     dropping below readable contrast. */
  --link-unresolved-color: #9fb0c8;
  --link-unresolved-opacity: 1;
  --link-unresolved-decoration-color: #4a5b74;

  /* Selection / code */
  --text-selection: #24344a;
  --code-background: #1b2432;
  --code-normal: #9fc0e6;
  --blockquote-border-color: #4a7bb5;
  --hr-color: #2a3444;

  /* Navigation */
  --nav-parent-item-color: #cdd9ea;
  --nav-parent-item-color-active: #eaf0f8;
  --nav-item-color: #9aa7bb;
  --nav-item-color-hover: #aecdf0;
  --nav-item-color-active: #8fb3dd;
  --nav-item-border-color-active: #4a7bb5;
  --nav-collapse-icon-color: #6f7d92;
  --nav-collapse-icon-color-hover: #aecdf0;

  /* Graph */
  --graph-line: #2c384a;
  --graph-node: #7f8da3;
  --graph-node-focused: #8fb3dd;
  --graph-node-tag: #6f97c8;
  --graph-node-unresolved: #45526b;
  --graph-text: #aab6c8;
}

/* ============================================================
   COMPONENT STYLING
   Uses .markdown-preview-view (Publish reading-view wrapper)
   with .published-container fallbacks where relevant.
   ============================================================ */

/* Headings */
.markdown-preview-view h1,
.markdown-preview-view h2,
.markdown-preview-view h3,
.markdown-preview-view h4,
.markdown-preview-view h5,
.markdown-preview-view h6 {
  font-family: var(--font-interface-theme);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.markdown-preview-view h1 {
  font-size: 2.1em;
  margin-bottom: 0.15em;
  padding-bottom: 0.3em;
  border-bottom: 3px solid var(--interactive-accent);
}

.markdown-preview-view h4,
.markdown-preview-view h5,
.markdown-preview-view h6 {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.85em;
}

/* Links — soft underline that firms up on hover */
.markdown-preview-view a.internal-link,
.markdown-preview-view a.external-link {
  color: var(--link-color);
  text-decoration: none;
  border-bottom: 1px solid var(--link-decoration-color);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.markdown-preview-view a.internal-link:hover,
.markdown-preview-view a.external-link:hover {
  color: var(--link-color-hover);
  border-bottom-color: var(--link-color-hover);
}

/* Unresolved (unpublished) links — dashed underline, no low-opacity */
.markdown-preview-view a.internal-link.is-unresolved {
  color: var(--link-unresolved-color);
  opacity: 1;
  border-bottom: 1px dashed var(--link-unresolved-decoration-color);
}

.markdown-preview-view a.internal-link.is-unresolved:hover {
  color: var(--link-color-hover);
  border-bottom-color: var(--link-color-hover);
}

/* Lists — navy markers */
.markdown-preview-view ul > li::marker {
  color: var(--interactive-accent);
}

.markdown-preview-view ol > li::marker {
  color: var(--interactive-accent);
  font-family: var(--font-interface-theme);
  font-weight: 600;
}

.markdown-preview-view input[type="checkbox"] {
  accent-color: var(--interactive-accent);
}

/* Blockquotes */
.markdown-preview-view blockquote {
  border-left: 3px solid var(--blockquote-border-color);
  background: var(--background-secondary-alt);
  color: var(--text-muted);
  font-style: italic;
  padding: 0.6em 1.1em;
  border-radius: 0 4px 4px 0;
}

/* Inline code + code blocks */
.markdown-preview-view code {
  font-family: var(--font-monospace-theme);
  font-size: 0.86em;
  background: var(--code-background);
  color: var(--code-normal);
  padding: 0.1em 0.4em;
  border-radius: 4px;
}

.markdown-preview-view pre {
  background: var(--background-secondary);
  border: 1px solid var(--background-modifier-border);
  border-radius: 8px;
}

.markdown-preview-view pre code {
  background: transparent;
}

/* Rules + tables */
.markdown-preview-view hr {
  border: none;
  height: 1px;
  background: var(--hr-color);
  margin: 2.2em 0;
}

.markdown-preview-view table {
  border-collapse: collapse;
  font-family: var(--font-interface-theme);
  font-size: 0.92em;
}

.markdown-preview-view th {
  background: var(--background-secondary-alt);
  color: var(--h2-color);
  font-weight: 600;
  text-align: left;
}

.markdown-preview-view th,
.markdown-preview-view td {
  border: 1px solid var(--background-modifier-border);
  padding: 0.5em 0.8em;
}

.markdown-preview-view tr:nth-child(even) td {
  background: var(--background-primary-alt);
}

/* Tags */
.markdown-preview-view a.tag {
  background: var(--background-secondary-alt);
  color: var(--text-accent);
  border: 1px solid var(--link-decoration-color);
  border-radius: 999px;
  padding: 0.05em 0.6em;
  font-family: var(--font-interface-theme);
  font-size: 0.82em;
  text-decoration: none;
}

/* Site title (sans, matches the journal masthead) */
.site-body-left-column-site-name,
.site-name {
  font-family: var(--font-interface-theme);
  font-weight: 600;
  color: var(--h1-color);
}

/* ------------------------------------------------------------
   Graph panel — lift the card off the page bg so it reads.
   (Nodes/lines are WebGL, colored via the --graph-* vars above;
   this only styles the surrounding panel surface.)
   ------------------------------------------------------------ */
.theme-dark .graph-view-container,
.theme-dark .graph-view-outer {
  background: #171d27;
  border: 0.5px solid var(--background-modifier-border);
  border-radius: 8px;
}

.theme-light .graph-view-container,
.theme-light .graph-view-outer {
  background: #f2f4f7;
  border: 0.5px solid var(--background-modifier-border);
  border-radius: 8px;
}

/* ------------------------------------------------------------
   Search input — bring into the navy scheme
   ------------------------------------------------------------ */
.published-container .search-input-container,
.site-body-left-column .search-input-container {
  background: var(--background-secondary-alt) !important;
  border: 1px solid var(--background-modifier-border) !important;
  border-radius: 6px !important;
}

.published-container .search-input-container input,
.published-container input.search-input,
.site-body-left-column .search-input-container input {
  background: transparent !important;
  border: none !important;
  color: var(--text-normal) !important;
  font-family: var(--font-interface-theme) !important;
}

.published-container .search-input-container input::placeholder,
.site-body-left-column .search-input-container input::placeholder {
  color: var(--text-faint) !important;
}

.published-container .search-input-container:focus-within,
.site-body-left-column .search-input-container:focus-within {
  border-color: var(--interactive-accent) !important;
  box-shadow: 0 0 0 2px var(--text-selection) !important;
}
/* ------------------------------------------------------------
   Size bumps
   ------------------------------------------------------------ */

/* Sidebar nav — fallback if the --nav-*-size vars above don't take */
.site-body-left-column .nav-file-title,
.site-body-left-column .nav-folder-title {
  font-size: 0.95rem;
}

/* "Interactive graph" panel heading (graph node labels are WebGL
   and can't be resized from CSS) */
.graph-view-outer .tree-item-heading,
.published-container .graph-heading {
  font-size: 0.8rem;
}
