/* ============================================
   0xGuy — Obsidian Publish Theme
   Tokyo Night + Tech Orange Accent
   ============================================
   
   Place this file in the ROOT of your Publish vault
   as `publish.css`, then upload it via the Publish modal.
   
   Inspired by: chriskirby.net (generous whitespace,
   content-forward, dark theme, clean typography)
   
   Built from existing snippets:
   - accent-orange.css
   - callout-styling.css
   - links-and-tags.css
   - ui-elements.css
   ============================================ */


/* ============================================
   1. COLOR TOKENS & BASE THEME
   ============================================ */

:root {
  /* -- Core Accent -- */
  --accent-orange:        #E8734A;
  --accent-orange-bright: #F28C5E;
  --accent-orange-soft:   #D4623D;
  --accent-orange-dim:    rgba(232, 115, 74, 0.4);

  /* -- Tokyo Night Palette -- */
  --tn-bg:                #1a1b26;
  --tn-bg-alt:            #16161e;
  --tn-bg-highlight:      #292e42;
  --tn-fg:                #c0caf5;
  --tn-fg-dim:            #a9b1d6;
  --tn-comment:           #565f89;
  --tn-blue:              #7aa2f7;
  --tn-cyan:              #7dcfff;
  --tn-magenta:           #bb9af7;
  --tn-green:             #9ece6a;
  --tn-yellow:            #e0af68;
  --tn-red:               #f7768e;

  /* -- Obsidian Variable Overrides -- */
  --background-primary:       var(--tn-bg);
  --background-primary-alt:   var(--tn-bg-alt);
  --background-secondary:     #1f2030;
  --background-secondary-alt: var(--tn-bg-highlight);
  --text-normal:              var(--tn-fg);
  --text-muted:               var(--tn-fg-dim);
  --text-faint:               var(--tn-comment);
  --text-accent:              var(--accent-orange);
  --text-accent-hover:        var(--accent-orange-bright);
  --interactive-accent:       var(--accent-orange);
  --interactive-accent-hover: var(--accent-orange-bright);

  /* -- Link Colors -- */
  --link-orange:              var(--accent-orange);
  --link-orange-hover:        var(--accent-orange-bright);
  --link-orange-dim:          rgba(232, 115, 74, 0.5);
  --ext-link:                 var(--tn-cyan);
  --ext-link-hover:           #a9dcff;
  --unresolved-link:          rgba(224, 175, 104, 0.6);

  /* -- Tag Colors -- */
  --tag-bg:                   rgba(232, 115, 74, 0.10);
  --tag-bg-hover:             rgba(232, 115, 74, 0.20);
  --tag-text:                 var(--accent-orange-bright);
  --tag-text-hover:           var(--accent-orange);

  /* -- Callout Colors (RGB triplets) -- */
  --callout-color-note:       122, 162, 247;
  --callout-color-tip:        232, 115, 74;
  --callout-color-warning:    224, 175, 104;
  --callout-color-info:       125, 207, 255;
}


/* ============================================
   2. GLOBAL LAYOUT & TYPOGRAPHY
   ============================================
   Inspired by chriskirby.net: wide content area,
   generous line height, comfortable reading width,
   lots of breathing room.
   ============================================ */

/* Dark background everywhere */
body,
.published-container {
  background-color: var(--tn-bg) !important;
  color: var(--tn-fg);
}

/* ---- Layout — use Publish's own CSS variables ---- */

.published-container {
  --sidebar-left-width: 260px;
  --sidebar-right-width: 250px;
  --sidebar-left-background: var(--tn-bg-alt);
  --sidebar-right-background: transparent;
  --page-width: 900px;
}

/* Fix search bar overflow in sidebar */
.site-body-left-column .search-view-outer {
  padding-inline-end: 18px;
  box-sizing: border-box;
}

.site-body-left-column .search-view-container .search-bar {
  width: 100%;
  box-sizing: border-box;
}

/* Content area — comfortable reading with breathing room */
.markdown-rendered {
  max-width: 100%;
  margin: 0 auto;
  padding: 2rem 2.5rem 4rem;
  line-height: 1.75;
  font-size: 16.5px;
  color: var(--tn-fg);
}

/* Generous spacing between elements */
.markdown-rendered p {
  margin-bottom: 1.2em;
}

.markdown-rendered h1,
.markdown-rendered h2,
.markdown-rendered h3,
.markdown-rendered h4 {
  margin-top: 2.2em;
  margin-bottom: 0.8em;
  line-height: 1.3;
}


/* ============================================
   3. HEADINGS
   ============================================ */

.markdown-rendered h1 {
  color: var(--accent-orange);
  font-size: 2em;
  font-weight: 700;
  letter-spacing: -0.01em;
  border-bottom: 2px solid rgba(232, 115, 74, 0.2);
  padding-bottom: 0.4em;
  margin-top: 0;
}

.markdown-rendered h2 {
  color: var(--tn-fg);
  font-size: 1.5em;
  font-weight: 600;
  letter-spacing: -0.005em;
  border-bottom: 1px solid rgba(86, 95, 137, 0.25);
  padding-bottom: 0.3em;
}

.markdown-rendered h3 {
  color: var(--tn-fg-dim);
  font-size: 1.25em;
  font-weight: 600;
}

.markdown-rendered h4 {
  color: var(--tn-comment);
  font-size: 1.1em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}


/* ============================================
   4. BOLD & ITALIC — ORANGE ACCENT
   ============================================ */

.markdown-rendered strong {
  color: var(--accent-orange);
  font-weight: 700;
}

.markdown-rendered em {
  color: var(--accent-orange-bright);
}

.markdown-rendered strong em,
.markdown-rendered em strong {
  color: var(--accent-orange);
}

.markdown-rendered strong code,
.markdown-rendered em code {
  color: var(--accent-orange);
}


/* ============================================
   5. LINKS
   ============================================ */

/* Internal / wiki-links */
.markdown-rendered .internal-link {
  color: var(--link-orange);
  text-decoration: none;
  border-bottom: 1px solid var(--link-orange-dim);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.markdown-rendered .internal-link:hover {
  color: var(--link-orange-hover);
  border-bottom-color: var(--link-orange-hover);
}

/* Unresolved links */
.markdown-rendered .internal-link.is-unresolved {
  color: var(--unresolved-link);
  border-bottom: 1px dashed var(--unresolved-link);
  opacity: 0.8;
}

/* External links */
.markdown-rendered .external-link {
  color: var(--ext-link);
  text-decoration: none;
  border-bottom: 1px solid rgba(125, 207, 255, 0.3);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.markdown-rendered .external-link:hover {
  color: var(--ext-link-hover);
  border-bottom-color: var(--ext-link-hover);
}

/* External link icon */
.external-link::after {
  opacity: 0.4;
  transition: opacity 0.15s ease;
}

.external-link:hover::after {
  opacity: 0.7;
}


/* ============================================
   6. TAGS — PILL STYLE
   ============================================ */

.markdown-rendered .tag {
  background: var(--tag-bg);
  color: var(--tag-text);
  border: 1px solid rgba(232, 115, 74, 0.15);
  border-radius: 12px;
  padding: 1px 10px 2px 10px;
  font-size: 0.85em;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.markdown-rendered .tag:hover {
  background: var(--tag-bg-hover);
  color: var(--tag-text-hover);
  border-color: rgba(232, 115, 74, 0.35);
}


/* ============================================
   7. CODE BLOCKS
   ============================================ */

/* Inline code */
.markdown-rendered code {
  background: rgba(41, 46, 66, 0.7);
  color: var(--tn-cyan);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.88em;
  border: 1px solid rgba(86, 95, 137, 0.15);
}

/* Fenced code blocks */
.markdown-rendered pre {
  background: var(--tn-bg-alt) !important;
  border: 1px solid rgba(86, 95, 137, 0.2);
  border-radius: 8px;
  padding: 1.2em 1.4em;
  margin: 1.5em 0;
  overflow-x: auto;
}

.markdown-rendered pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.88em;
  color: var(--tn-fg);
  line-height: 1.6;
}


/* ============================================
   8. TABLES
   ============================================ */

.markdown-rendered table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.5em 0;
  font-size: 0.92em;
}

.markdown-rendered thead tr {
  border-bottom: 2px solid var(--accent-orange);
}

.markdown-rendered thead th {
  color: var(--accent-orange);
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  letter-spacing: 0.02em;
  background: rgba(232, 115, 74, 0.04);
}

.markdown-rendered tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(86, 95, 137, 0.15);
  color: var(--tn-fg);
}

.markdown-rendered tbody tr:nth-child(even) {
  background: rgba(41, 46, 66, 0.3);
}

.markdown-rendered tbody tr:hover {
  background: rgba(232, 115, 74, 0.04);
}

.markdown-rendered table,
.markdown-rendered th,
.markdown-rendered td {
  border-left: none;
  border-right: none;
}

.markdown-rendered tbody td:first-child {
  font-weight: 500;
}

.markdown-rendered td code,
.markdown-rendered th code {
  font-size: 0.88em;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(41, 46, 66, 0.6);
}


/* ============================================
   9. CALLOUTS
   ============================================ */

/* NOTE — blue */
.callout[data-callout="note"] {
  --callout-color: var(--callout-color-note);
  --callout-icon: lucide-bookmark;
  border-left: 3px solid rgba(var(--callout-color-note), 0.7);
  background: rgba(var(--callout-color-note), 0.06);
}

/* TIP — orange */
.callout[data-callout="tip"] {
  --callout-color: var(--callout-color-tip);
  --callout-icon: lucide-flame;
  border-left: 3px solid rgba(var(--callout-color-tip), 0.7);
  background: rgba(var(--callout-color-tip), 0.06);
}

/* WARNING — amber */
.callout[data-callout="warning"] {
  --callout-color: var(--callout-color-warning);
  --callout-icon: lucide-alert-triangle;
  border-left: 3px solid rgba(var(--callout-color-warning), 0.7);
  background: rgba(var(--callout-color-warning), 0.06);
}

/* INFO — cyan */
.callout[data-callout="info"] {
  --callout-color: var(--callout-color-info);
  --callout-icon: lucide-info;
  border-left: 3px solid rgba(var(--callout-color-info), 0.7);
  background: rgba(var(--callout-color-info), 0.06);
}

/* Shared callout styling */
.callout {
  border-radius: 4px;
  border-top: none;
  border-right: none;
  border-bottom: none;
  margin: 1.5em 0;
}

.callout .callout-title {
  gap: 8px;
  letter-spacing: 0.02em;
  font-weight: 600;
}

.callout .callout-content {
  opacity: 0.92;
}

.callout .callout-title .callout-icon .svg-icon {
  width: 18px;
  height: 18px;
}


/* ============================================
   10. HORIZONTAL RULES
   ============================================ */

.markdown-rendered hr {
  border: none;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    rgba(232, 115, 74, 0.3),
    rgba(232, 115, 74, 0.3),
    transparent
  );
  margin: 2.5em 0;
}


/* ============================================
   11. BLOCKQUOTES
   ============================================ */

.markdown-rendered blockquote {
  border-left: 3px solid rgba(232, 115, 74, 0.4);
  background: rgba(41, 46, 66, 0.3);
  padding: 0.8em 1.2em;
  margin: 1.5em 0;
  border-radius: 0 4px 4px 0;
  color: var(--tn-fg-dim);
}


/* ============================================
   12. LISTS
   ============================================ */

.markdown-rendered ul,
.markdown-rendered ol {
  padding-left: 1.5em;
  margin-bottom: 1.2em;
}

.markdown-rendered li {
  margin-bottom: 0.4em;
}

.markdown-rendered li::marker {
  color: var(--accent-orange-dim);
}


/* ============================================
   13. IMAGES
   ============================================ */

.markdown-rendered img {
  border-radius: 8px;
  border: 1px solid rgba(86, 95, 137, 0.2);
  margin: 1em 0;
  max-width: 100%;
}


/* ============================================
   14. PUBLISH NAVIGATION & SIDEBAR
   ============================================ */

/* Site title in sidebar */
.site-body-left-column-site-name {
  color: var(--accent-orange) !important;
  font-weight: 700;
  letter-spacing: 0.03em;
}

/* Nav file items */
.nav-file-title,
.tree-item-self {
  color: var(--tn-fg-dim);
  transition: color 0.15s ease, background 0.15s ease;
  border-radius: 4px;
}

.nav-file-title:hover,
.tree-item-self:hover {
  color: var(--accent-orange-bright);
  background: rgba(232, 115, 74, 0.05);
}

.nav-file-title.is-active,
.tree-item-self.is-active {
  color: var(--accent-orange) !important;
  background: rgba(232, 115, 74, 0.08);
}

/* Nav folder names */
.nav-folder-title,
.tree-item-self.is-clickable {
  color: var(--tn-fg-dim);
  font-weight: 600;
}

.nav-folder-title:hover {
  color: var(--tn-fg);
}

/* Nav folder indent guides */
.nav-folder-children {
  border-left: 1px solid rgba(86, 95, 137, 0.15);
  margin-left: 10px;
  padding-left: 8px;
}


/* ============================================
   15. PUBLISH HEADER / NAVBAR
   ============================================ */

.publish-renderer {
  background-color: var(--tn-bg) !important;
}

/* Search input */
.search-input-container input {
  background: var(--tn-bg-highlight) !important;
  border: 1px solid rgba(86, 95, 137, 0.3);
  color: var(--tn-fg);
  border-radius: 6px;
}

.search-input-container input:focus {
  border-color: var(--accent-orange);
  box-shadow: 0 0 0 2px rgba(232, 115, 74, 0.15);
}


/* ============================================
   16. GRAPH VIEW
   ============================================ */

.graph-view.canvas {
  background-color: var(--tn-bg) !important;
}

.graph-view.color-fill {
  color: var(--accent-orange);
}

.graph-view.color-line {
  color: rgba(86, 95, 137, 0.35);
}

.graph-view.color-fill-focused {
  color: var(--accent-orange-bright);
}

.graph-view.color-line-highlight {
  color: var(--accent-orange-dim);
}

.graph-view.color-text {
  color: var(--tn-fg-dim);
}

.graph-view.color-fill-attachment {
  color: var(--tn-comment);
}


/* ============================================
   17. SCROLLBAR
   ============================================ */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(86, 95, 137, 0.3);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-orange-dim);
}


/* ============================================
   18. MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .markdown-rendered {
    padding: 1.2rem 1rem 3rem;
    font-size: 15.5px;
  }

  .markdown-rendered h1 {
    font-size: 1.6em;
  }

  .markdown-rendered h2 {
    font-size: 1.3em;
  }

  .markdown-rendered pre {
    padding: 0.8em 1em;
    font-size: 0.82em;
  }
}


/* ============================================
   19. LIGHT MODE — Tokyo Night Day
   ============================================
   Uses the official Tokyo Night "Day" palette
   with the same orange accent for consistency.
   ============================================ */

.theme-light {
  /* -- Tokyo Night Day Palette -- */
  --tn-bg:                #e1e2e7;
  --tn-bg-alt:            #d5d6db;
  --tn-bg-highlight:      #c8c9ce;
  --tn-fg:                #3760bf;
  --tn-fg-dim:            #4c6399;
  --tn-comment:           #848cb5;
  --tn-blue:              #2e7de9;
  --tn-cyan:              #007197;
  --tn-magenta:           #9854f1;
  --tn-green:             #587539;
  --tn-yellow:            #8c6c3e;
  --tn-red:               #f52a65;

  /* -- Adjusted Orange for Light -- */
  --accent-orange:        #c9593a;
  --accent-orange-bright: #e06840;
  --accent-orange-soft:   #b54d30;
  --accent-orange-dim:    rgba(201, 89, 58, 0.4);

  /* -- Obsidian Overrides -- */
  --background-primary:       #e1e2e7;
  --background-primary-alt:   #d5d6db;
  --background-secondary:     #d0d1d6;
  --background-secondary-alt: #c8c9ce;
  --text-normal:              #343b58;
  --text-muted:               #4c6399;
  --text-faint:               #848cb5;
  --text-accent:              var(--accent-orange);
  --text-accent-hover:        var(--accent-orange-bright);
  --interactive-accent:       var(--accent-orange);
  --interactive-accent-hover: var(--accent-orange-bright);

  /* -- Link Colors -- */
  --link-orange:              var(--accent-orange);
  --link-orange-hover:        var(--accent-orange-bright);
  --link-orange-dim:          rgba(201, 89, 58, 0.4);
  --ext-link:                 #007197;
  --ext-link-hover:           #005a78;
  --unresolved-link:          rgba(140, 108, 62, 0.6);

  /* -- Tag Colors -- */
  --tag-bg:                   rgba(201, 89, 58, 0.08);
  --tag-bg-hover:             rgba(201, 89, 58, 0.16);
  --tag-text:                 var(--accent-orange);
  --tag-text-hover:           var(--accent-orange-bright);

  /* -- Callout Colors (darker for readability on light bg) -- */
  --callout-color-note:       46, 125, 233;
  --callout-color-tip:        201, 89, 58;
  --callout-color-warning:    140, 108, 62;
  --callout-color-info:       0, 113, 151;
}

/* --- Light mode: backgrounds --- */
.theme-light body,
.theme-light .published-container {
  background-color: #e1e2e7 !important;
  color: #343b58;
}

.theme-light .published-container {
  --sidebar-left-background: #d5d6db;
}

.theme-light .publish-renderer {
  background-color: #e1e2e7 !important;
}

/* --- Light mode: content text --- */
.theme-light .markdown-rendered {
  color: #343b58;
}

.theme-light .markdown-rendered h2 {
  color: #343b58;
  border-bottom: 1px solid rgba(132, 140, 181, 0.3);
}

.theme-light .markdown-rendered h3 {
  color: #4c6399;
}

.theme-light .markdown-rendered h4 {
  color: #848cb5;
}

.theme-light .markdown-rendered tbody td {
  color: #343b58;
  border-bottom: 1px solid rgba(132, 140, 181, 0.2);
}

.theme-light .markdown-rendered tbody tr:nth-child(even) {
  background: rgba(197, 198, 203, 0.4);
}

/* --- Light mode: code blocks --- */
.theme-light .markdown-rendered code {
  background: rgba(197, 198, 203, 0.6);
  color: #007197;
  border: 1px solid rgba(132, 140, 181, 0.2);
}

.theme-light .markdown-rendered pre {
  background: #d5d6db !important;
  border: 1px solid rgba(132, 140, 181, 0.25);
}

.theme-light .markdown-rendered pre code {
  background: none;
  border: none;
  color: #343b58;
}

.theme-light .markdown-rendered td code,
.theme-light .markdown-rendered th code {
  background: rgba(197, 198, 203, 0.5);
}

/* --- Light mode: blockquotes --- */
.theme-light .markdown-rendered blockquote {
  background: rgba(197, 198, 203, 0.4);
  border-left: 3px solid rgba(201, 89, 58, 0.4);
  color: #4c6399;
}

/* --- Light mode: external links --- */
.theme-light .markdown-rendered .external-link {
  color: #007197;
  border-bottom: 1px solid rgba(0, 113, 151, 0.3);
}

.theme-light .markdown-rendered .external-link:hover {
  color: #005a78;
  border-bottom-color: #005a78;
}

/* --- Light mode: images --- */
.theme-light .markdown-rendered img {
  border: 1px solid rgba(132, 140, 181, 0.25);
}

/* --- Light mode: navigation --- */
.theme-light .nav-file-title,
.theme-light .tree-item-self {
  color: #4c6399;
}

.theme-light .nav-file-title:hover,
.theme-light .tree-item-self:hover {
  color: var(--accent-orange-bright);
  background: rgba(201, 89, 58, 0.06);
}

.theme-light .nav-file-title.is-active,
.theme-light .tree-item-self.is-active {
  color: var(--accent-orange) !important;
  background: rgba(201, 89, 58, 0.1);
}

.theme-light .nav-folder-title,
.theme-light .tree-item-self.is-clickable {
  color: #343b58;
}

.theme-light .nav-folder-title:hover {
  color: #343b58;
}

.theme-light .nav-folder-children {
  border-left: 1px solid rgba(132, 140, 181, 0.2);
}

/* --- Light mode: search input --- */
.theme-light .search-input-container input {
  background: #d5d6db !important;
  border: 1px solid rgba(132, 140, 181, 0.3);
  color: #343b58;
}

/* --- Light mode: graph view --- */
.theme-light .graph-view.canvas {
  background-color: #e1e2e7 !important;
}

.theme-light .graph-view.color-line {
  color: rgba(132, 140, 181, 0.35);
}

.theme-light .graph-view.color-text {
  color: #4c6399;
}

.theme-light .graph-view.color-fill-attachment {
  color: #848cb5;
}

/* --- Light mode: scrollbar --- */
.theme-light ::-webkit-scrollbar-thumb {
  background: rgba(132, 140, 181, 0.3);
}

/* --- Light mode: hr --- */
.theme-light .markdown-rendered hr {
  background: linear-gradient(
    to right,
    transparent,
    rgba(201, 89, 58, 0.25),
    rgba(201, 89, 58, 0.25),
    transparent
  );
}
