/*
 * heyMHK Digital Garden - Terminal Style
 * Matches hey-mhk.com landing page aesthetic
 * 
 * Greyscale + Viridis · IBM Plex · Sharp Corners · No Radius
 */

/* ==========================================================================
   1. FONTS & CSS VARIABLES
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,400;0,500;0,600;1,400&family=IBM+Plex+Sans:ital,wght@0,400;0,500;0,600&family=IBM+Plex+Serif:ital,wght@0,400;1,400&display=swap');

:root {
  /* Typography */
  --font-mono: 'IBM Plex Mono', 'SF Mono', monospace;
  --font-sans: 'IBM Plex Sans', -apple-system, sans-serif;
  --font-serif: 'IBM Plex Serif', Georgia, serif;
  
  --font-text-theme: var(--font-sans);
  --font-monospace-theme: var(--font-mono);
  --font-interface-theme: var(--font-mono);

  /* Viridis Accents */
  --viridis-green: #22a884;
  --viridis-teal: #2a788e;
  --viridis-lime: #7ad151;
  
  /* Type Scale */
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  
  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;

  /* CRITICAL: No border radius anywhere */
  --radius-s: 0;
  --radius-m: 0;
  --radius-l: 0;
  --radius-xl: 0;
  --image-radius: 0;
  --input-radius: 0;
  --button-radius: 0;
  --toggle-radius: 0;
  --checkbox-radius: 0;
  --tag-radius: 0;
  --modal-radius: 0;
  --prompt-radius: 0;
}

/* ==========================================================================
   2. DARK THEME (default)
   ========================================================================== */

.theme-dark,
.theme-dark.publish-css {
  /* Greyscale */
  --grey-00: #0a0a0a;
  --grey-05: #0f0f0f;
  --grey-10: #141414;
  --grey-15: #1a1a1a;
  --grey-20: #1f1f1f;
  --grey-25: #262626;
  --grey-30: #2e2e2e;
  --grey-50: #6b6b6b;
  --grey-70: #a3a3a3;
  --grey-90: #e5e5e5;

  /* Functional */
  --background-primary: var(--grey-05);
  --background-secondary: var(--grey-00);
  --background-secondary-alt: var(--grey-10);
  --background-modifier-border: var(--grey-30);
  --background-modifier-hover: var(--grey-20);
  
  --text-normal: var(--grey-90);
  --text-muted: var(--grey-70);
  --text-faint: var(--grey-50);
  
  --text-accent: var(--viridis-green);
  --text-accent-hover: var(--viridis-lime);
  --interactive-accent: var(--viridis-green);
  --interactive-accent-hover: var(--viridis-lime);
  
  --text-selection: rgba(34, 168, 132, 0.3);
}

/* ==========================================================================
   3. LIGHT THEME
   ========================================================================== */

.theme-light,
.theme-light.publish-css {
  /* Greyscale */
  --grey-100: #fafafa;
  --grey-90: #e5e5e5;
  --grey-80: #c4c4c4;
  --grey-70: #8a8a8a;
  --grey-50: #6b6b6b;
  --grey-35: #3d3d3d;
  --grey-10: #141414;

  /* Functional */
  --background-primary: var(--grey-100);
  --background-secondary: var(--grey-90);
  --background-secondary-alt: var(--grey-80);
  --background-modifier-border: var(--grey-80);
  --background-modifier-hover: rgba(0, 0, 0, 0.05);
  
  --text-normal: var(--grey-10);
  --text-muted: var(--grey-35);
  --text-faint: var(--grey-50);
  
  --text-accent: var(--viridis-teal);
  --text-accent-hover: var(--viridis-green);
  --interactive-accent: var(--viridis-teal);
  --interactive-accent-hover: var(--viridis-green);
  
  --text-selection: rgba(42, 120, 142, 0.2);
}

/* ==========================================================================
   4. BASE STYLES
   ========================================================================== */

body {
  font-family: var(--font-sans) !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Kill all border-radius */
*,
*::before,
*::after {
  border-radius: 0 !important;
}

::selection {
  background: var(--text-selection);
}

/* ==========================================================================
   5. LEFT SIDEBAR - HEADER
   ========================================================================== */

.site-body-left-column {
  background: var(--background-secondary);
  border-right: 1px solid var(--background-modifier-border);
}

/* Hide default site name - we'll replace it via JS */
.site-body-left-column-site-name {
  display: none !important;
}

/* Custom header container (injected via JS) */
.heymhk-header {
  padding: var(--space-4) var(--space-4) var(--space-3);
  border-bottom: 1px solid var(--background-modifier-border);
  margin-bottom: var(--space-3);
}

.heymhk-title {
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  font-weight: 500;
  letter-spacing: 0.02em;
  margin: 0;
}

.heymhk-title a {
  color: var(--text-accent);
  text-decoration: none;
}

.heymhk-title a:hover {
  color: var(--text-accent-hover);
}

.heymhk-title .prompt {
  opacity: 0.5;
}

.heymhk-subtitle {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  color: var(--text-faint);
  margin: var(--space-1) 0 0 0;
  letter-spacing: 0.02em;
}

/* ==========================================================================
   6. LEFT SIDEBAR - SEARCH
   ========================================================================== */

.search-input-container {
  padding: 0 var(--space-4);
  margin-bottom: var(--space-4);
}

.search-input-container input {
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  background: var(--background-primary);
  border: 1px solid var(--background-modifier-border);
  padding: var(--space-2) var(--space-3);
  color: var(--text-normal);
  width: 100%;
}

.search-input-container input:focus {
  border-color: var(--text-accent);
  outline: none;
  box-shadow: none;
}

.search-input-container input::placeholder {
  color: var(--text-faint);
}

/* ==========================================================================
   7. LEFT SIDEBAR - TWO-PANEL NAVIGATION
   ========================================================================== */

/* Section labels */
.heymhk-nav-label {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  padding: var(--space-2) var(--space-4);
  margin-top: var(--space-2);
}

/* Folders panel */
.heymhk-folders {
  padding: 0 var(--space-3);
  max-height: 200px;
  overflow-y: auto;
  border-bottom: 1px solid var(--background-modifier-border);
  padding-bottom: var(--space-3);
}

.heymhk-folder-item {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  padding: var(--space-1) var(--space-2);
  cursor: pointer;
  text-transform: lowercase;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.heymhk-folder-item:hover {
  background: var(--background-modifier-hover);
  color: var(--text-normal);
}

.heymhk-folder-item.is-active {
  color: var(--text-accent);
  border-left: 2px solid var(--text-accent);
  padding-left: calc(var(--space-2) - 2px);
}

.heymhk-folder-item .folder-icon {
  opacity: 0.6;
}

.heymhk-folder-item .folder-count {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-faint);
}

/* Subfolder items (atoms, molecules, organisms) */
.heymhk-subfolder-item {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  padding: var(--space-1) var(--space-2);
  padding-left: var(--space-6);
  cursor: pointer;
}

.heymhk-subfolder-item:hover {
  color: var(--text-muted);
}

.heymhk-subfolder-item.is-active {
  color: var(--text-accent);
}

/* Notes list panel */
.heymhk-notes {
  padding: var(--space-2) var(--space-3);
  flex: 1;
  overflow-y: auto;
}

.heymhk-notes-empty {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  color: var(--text-faint);
  padding: var(--space-4);
  text-align: center;
  font-style: italic;
}

.heymhk-note-item {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  padding: var(--space-1) var(--space-2);
  cursor: pointer;
  text-transform: lowercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.8;
}

.heymhk-note-item:hover {
  opacity: 1;
  background: var(--background-modifier-hover);
  color: var(--text-normal);
}

.heymhk-note-item.is-active {
  opacity: 1;
  color: var(--text-accent);
  border-left: 2px solid var(--text-accent);
  padding-left: calc(var(--space-2) - 2px);
}

/* Hide default nav when custom nav is active */
.heymhk-nav-active .nav-view-outer {
  display: none !important;
}

/* ==========================================================================
   8. MAIN CONTENT
   ========================================================================== */

.site-body-center-column {
  background: var(--background-primary);
}

.markdown-preview-view,
.publish-renderer {
  padding: var(--space-8);
  max-width: 720px;
}

/* Hide the ugly filename title */
.page-header {
  display: none !important;
}

/* ==========================================================================
   9. TYPOGRAPHY - Headings
   ========================================================================== */

h1, h2, h3, h4, h5, h6,
.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-mono) !important;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-normal);
}

.markdown-preview-view h1:first-child {
  font-size: var(--font-size-2xl);
  font-weight: 500;
  margin-top: 0;
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--background-modifier-border);
}

.markdown-preview-view h2 {
  font-size: var(--font-size-xl);
  margin-top: var(--space-8);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--background-modifier-border);
}

.markdown-preview-view h3 {
  font-size: var(--font-size-lg);
  font-weight: 500;
  margin-top: var(--space-6);
  margin-bottom: var(--space-3);
}

.markdown-preview-view h4 {
  font-size: var(--font-size-base);
  font-weight: 600;
  margin-top: var(--space-6);
  margin-bottom: var(--space-2);
}

.markdown-preview-view h5,
.markdown-preview-view h6 {
  font-size: var(--font-size-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

/* ==========================================================================
   10. TYPOGRAPHY - Body
   ========================================================================== */

.markdown-preview-view p {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: 1.7;
  margin-bottom: var(--space-4);
}

.markdown-preview-view h1:first-child + p {
  font-size: var(--font-size-lg);
  color: var(--text-muted);
}

strong, b {
  font-weight: 600;
  color: var(--text-normal);
}

/* ==========================================================================
   11. LINKS
   ========================================================================== */

a {
  color: var(--text-accent);
  text-decoration: none;
  transition: color 100ms ease;
}

a:hover {
  color: var(--text-accent-hover);
}

.internal-link {
  border-bottom: 1px dotted var(--text-faint);
}

.internal-link:hover {
  border-bottom-color: var(--text-accent);
  border-bottom-style: solid;
}

/* ==========================================================================
   12. CODE
   ========================================================================== */

code {
  font-family: var(--font-mono) !important;
  font-size: 0.9em;
  background: var(--background-secondary);
  padding: 0.15em 0.4em;
  color: var(--viridis-lime);
}

pre {
  font-family: var(--font-mono) !important;
  font-size: var(--font-size-sm);
  background: var(--background-secondary);
  border: 1px solid var(--background-modifier-border);
  padding: var(--space-4);
  overflow-x: auto;
  line-height: 1.5;
}

pre code {
  background: none;
  padding: 0;
  color: var(--text-normal);
}

/* ==========================================================================
   13. BLOCKQUOTES
   ========================================================================== */

blockquote {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--text-normal);
  border-left: 2px solid var(--viridis-green);
  padding-left: var(--space-4);
  margin: var(--space-6) 0;
  background: none;
}

blockquote p {
  font-family: var(--font-serif);
  font-size: var(--font-size-lg);
  line-height: 1.6;
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   14. CALLOUTS
   ========================================================================== */

.callout {
  background: var(--background-secondary);
  border: 1px solid var(--background-modifier-border);
  border-left: 2px solid var(--viridis-green);
  padding: var(--space-4);
  margin: var(--space-6) 0;
}

.callout-title {
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-accent);
  margin-bottom: var(--space-2);
}

.callout-content p:last-child {
  margin-bottom: 0;
}

.callout[data-callout="engine"],
.callout[data-callout="engine-room"] {
  border-left-color: var(--viridis-teal);
  background: rgba(42, 120, 142, 0.08);
}

.callout[data-callout="engine"] .callout-title,
.callout[data-callout="engine-room"] .callout-title {
  color: var(--viridis-teal);
}

.theme-light .callout[data-callout="engine"],
.theme-light .callout[data-callout="engine-room"] {
  background: rgba(42, 120, 142, 0.05);
}

.callout[data-callout="note"],
.callout[data-callout="info"] {
  border-left-color: var(--viridis-green);
}

.callout[data-callout="warning"] {
  border-left-color: #e5b567;
}

.callout[data-callout="warning"] .callout-title {
  color: #e5b567;
}

.callout[data-callout="tip"] {
  border-left-color: var(--viridis-lime);
}

.callout[data-callout="tip"] .callout-title {
  color: var(--viridis-lime);
}

/* ==========================================================================
   15. TABLES
   ========================================================================== */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
  margin: var(--space-6) 0;
}

th {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
  padding: var(--space-3);
  background: var(--background-secondary);
  border-bottom: 1px solid var(--background-modifier-border);
  color: var(--text-muted);
}

td {
  padding: var(--space-3);
  border-bottom: 1px solid var(--background-modifier-border);
}

tr:hover {
  background: var(--background-modifier-hover);
}

/* ==========================================================================
   16. LISTS
   ========================================================================== */

ul, ol {
  padding-left: var(--space-6);
  margin: var(--space-4) 0;
}

li {
  margin: var(--space-2) 0;
  line-height: 1.6;
}

li::marker {
  color: var(--text-faint);
}

/* ==========================================================================
   17. HORIZONTAL RULE
   ========================================================================== */

hr {
  border: none;
  border-top: 1px solid var(--background-modifier-border);
  margin: var(--space-8) 0;
}

/* ==========================================================================
   18. TAGS
   ========================================================================== */

.tag:not(.token) {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  padding: 2px var(--space-2);
  background: transparent;
  border: 1px solid var(--background-modifier-border);
  color: var(--text-muted);
  text-transform: lowercase;
}

.tag:hover {
  border-color: var(--text-accent);
  color: var(--text-accent);
}

.tag[href*="atom"] {
  border-color: var(--viridis-teal);
  color: var(--viridis-teal);
}

.tag[href*="molecule"] {
  border-color: var(--viridis-green);
  color: var(--viridis-green);
}

.tag[href*="organism"] {
  border-color: var(--viridis-lime);
  color: var(--viridis-lime);
}

/* ==========================================================================
   19. FRONTMATTER / PROPERTIES
   ========================================================================== */

.metadata-container {
  background: var(--background-secondary);
  border: 1px solid var(--background-modifier-border);
  border-left: 2px solid var(--text-accent);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-6);
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
}

.metadata-property-key {
  color: var(--text-faint);
  text-transform: lowercase;
}

.metadata-property-value {
  color: var(--text-muted);
}

/* ==========================================================================
   20. RIGHT SIDEBAR
   ========================================================================== */

.site-body-right-column {
  background: var(--background-secondary);
  border-left: 1px solid var(--background-modifier-border);
}

/* Section titles */
.graph-view-outer .graph-title,
.backlinks-title,
.outline-view-outer .mod-header {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
}

/* Graph */
.graph-view-outer {
  background: var(--background-primary);
  border: 1px solid var(--background-modifier-border);
}

/* Table of contents */
.outline-view-outer .tree-item-self {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  color: var(--text-faint);
  text-transform: lowercase;
}

.outline-view-outer .tree-item-self:hover {
  color: var(--text-muted);
}

.outline-view-outer .tree-item-self.is-active {
  color: var(--text-accent);
}

/* ==========================================================================
   21. RIGHT SIDEBAR - ENHANCED PROPERTIES PANEL
   ========================================================================== */

.heymhk-properties {
  padding: var(--space-3);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--background-modifier-border);
}

.heymhk-properties-title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  margin-bottom: var(--space-3);
}

.heymhk-prop-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-1) 0;
  font-family: var(--font-mono);
  font-size: 11px;
}

.heymhk-prop-key {
  color: var(--text-faint);
  text-transform: lowercase;
}

.heymhk-prop-value {
  color: var(--text-muted);
  text-align: right;
}

/* Type badge */
.heymhk-prop-value.type-atom {
  color: var(--viridis-teal);
}

.heymhk-prop-value.type-molecule {
  color: var(--viridis-green);
}

.heymhk-prop-value.type-organism {
  color: var(--viridis-lime);
}

/* Status badge */
.heymhk-prop-value.status-evergreen {
  color: var(--viridis-green);
}

.heymhk-prop-value.status-seedling {
  color: #e5b567;
}

/* ==========================================================================
   22. FOOTER
   ========================================================================== */

.site-footer {
  background: var(--background-secondary);
  border-top: 1px solid var(--background-modifier-border);
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  color: var(--text-faint);
  padding: var(--space-4);
}

/* ==========================================================================
   23. IMAGES
   ========================================================================== */

img {
  max-width: 100%;
}

/* ==========================================================================
   24. SCROLLBAR
   ========================================================================== */

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

::-webkit-scrollbar-track {
  background: var(--background-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--background-modifier-border);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-faint);
}

/* ==========================================================================
   25. FOCUS STATES
   ========================================================================== */

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--text-accent);
  outline-offset: 2px;
}

/* ==========================================================================
   26. RESPONSIVE
   ========================================================================== */

@media (max-width: 750px) {
  .markdown-preview-view,
  .publish-renderer {
    padding: var(--space-4);
  }
  
  .markdown-preview-view h1:first-child {
    font-size: var(--font-size-xl);
  }
  
  .heymhk-folders {
    max-height: 150px;
  }
}

/* ==========================================================================
   27. PRINT
   ========================================================================== */

@media print {
  .site-body-left-column,
  .site-body-right-column {
    display: none !important;
  }
  
  * {
    background: white !important;
    color: black !important;
  }
}
