/* =============================================================================
   IRIX 4Dwm / Motif Theme — blas.cc
   Faithful recreation of Silicon Graphics IRIX desktop aesthetics.
   No preprocessors, no frameworks — raw CSS for raw iron.
   =============================================================================

   Color reference (SGI IRIX palette):
     Desktop teal:    #4d7182  (octane/indigo background)
     Motif gray:      #b0b0b0  (widget surface)
     Bevel light:     #d8d8d8  (outset top/left highlight)
     Bevel dark:      #666666  (outset bottom/right shadow)
     Panel bg:        #ababab
     Title bar:       #1a5276  (SGI window title blue)
     Title fg:        #ffffff
     Terminal bg:     #1c1c1c
     Terminal fg:     #e0e0e0
*/

/* =============================================================================
   RESET & BASE
============================================================================= */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden; /* WM controls the scroll, not the body */
}

body {
  /* IRIX desktop: the iconic teal/slate background */
  background-color: #4d7182;
  font-family: "Courier New", Courier, "Lucida Console", monospace;
  font-size: 13px;
  color: #000000;
  /* Subtle dithered texture — approximate the IRIX root window pattern */
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 1px,
    rgba(0,0,0,0.04) 1px,
    rgba(0,0,0,0.04) 2px
  );
}

/* =============================================================================
   MOTIF BEVEL UTILITIES
   The heart of the 3D Motif look. Two classes: raised (outset) and sunken (inset).
============================================================================= */

.motif-raised {
  border: 2px solid;
  border-color: #d8d8d8 #666666 #666666 #d8d8d8;
}

.motif-sunken {
  border: 2px solid;
  border-color: #666666 #d8d8d8 #d8d8d8 #666666;
}

/* =============================================================================
   WM ROOT — The outermost window container
============================================================================= */

#wm-root {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  /* The "window" itself sits on the desktop with a thick Motif frame */
  border: 3px solid;
  border-color: #d8d8d8 #555555 #555555 #d8d8d8;
  background-color: #ababab;
}

/* =============================================================================
   TITLE BAR — SGI 4Dwm window chrome
============================================================================= */

#titlebar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px;
  /* SGI classic: deep blue-teal title bar */
  background-color: #1a3a5c;
  color: #ffffff;
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
  font-weight: bold;
  border-bottom: 2px solid #666666;
  flex-shrink: 0;
  user-select: none;
}

#titlebar-icon {
  color: #7fb3d3;
  font-size: 10px;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #2e6da0;
  border: 1px solid;
  border-color: #aaccee #113355 #113355 #aaccee;
  flex-shrink: 0;
}

#titlebar-title {
  flex: 1;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#titlebar-buttons {
  display: flex;
  gap: 3px;
}

/* Window chrome buttons: minimize, maximize */
.wm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background-color: #ababab;
  color: #000;
  font-size: 10px;
  cursor: pointer;
  border: 2px solid;
  border-color: #d8d8d8 #555555 #555555 #d8d8d8;
  user-select: none;
}

.wm-btn:active {
  border-color: #555555 #d8d8d8 #d8d8d8 #555555;
}

/* =============================================================================
   LAYOUT — Sidebar + Main content pane
============================================================================= */

#layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  gap: 0;
}

/* =============================================================================
   SIDEBAR
============================================================================= */

#sidebar {
  width: 210px;
  flex-shrink: 0;
  background-color: #ababab;
  border-right: 2px solid;
  border-right-color: #666666;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Custom scrollbar — keep it Motif-esque */
#sidebar::-webkit-scrollbar {
  width: 14px;
  background-color: #ababab;
}

#sidebar::-webkit-scrollbar-thumb {
  background-color: #b0b0b0;
  border: 2px solid;
  border-color: #d8d8d8 #666666 #666666 #d8d8d8;
}

#sidebar::-webkit-scrollbar-button {
  background-color: #ababab;
  border: 2px solid;
  border-color: #d8d8d8 #666666 #666666 #d8d8d8;
  height: 14px;
}

/* =============================================================================
   PANELS — Motif-style grouped widgets
============================================================================= */

.panel {
  background-color: #ababab;
  border: 2px solid;
  border-color: #d8d8d8 #555555 #555555 #d8d8d8;
}

.panel-titlebar {
  background-color: #4d7182;
  color: #ffffff;
  font-family: "Courier New", Courier, monospace;
  font-size: 11px;
  font-weight: bold;
  padding: 2px 6px;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #2a4f5e;
  user-select: none;
}

.panel-body {
  padding: 6px 8px;
  font-size: 12px;
  line-height: 1.6;
  color: #111111;
}

/* =============================================================================
   LINK LISTS — sidebar links
============================================================================= */

.link-list, .project-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.link-list li, .project-list li {
  padding: 2px 0;
  border-bottom: 1px solid #999999;
}

.link-list li:last-child, .project-list li:last-child {
  border-bottom: none;
}

a {
  color: #003377;
  text-decoration: none;
  font-family: "Courier New", Courier, monospace;
}

a:hover {
  color: #0000aa;
  text-decoration: underline;
}

a:visited {
  color: #550055;
}

.proj-status {
  color: #884400;
  font-weight: bold;
}

.proj-desc {
  color: #555555;
  font-size: 11px;
  margin-left: 8px;
}

/* =============================================================================
   NAVIGATION BUTTONS — Motif push-button style
============================================================================= */

.nav-buttons {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.nav-btn {
  display: block;
  text-align: center;
  padding: 4px 8px;
  background-color: #b8b8b8;
  color: #000000;
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
  font-weight: bold;
  text-decoration: none;
  border: 2px solid;
  border-color: #e0e0e0 #555555 #555555 #e0e0e0;
  letter-spacing: 1px;
  cursor: pointer;
  user-select: none;
  transition: none; /* No smooth transitions — this is a workstation, not a toy */
}

.nav-btn:hover {
  background-color: #c8c8c8;
  color: #000000;
  text-decoration: none;
}

.nav-btn:active,
.nav-btn.active {
  /* Pressed state: invert bevel */
  border-color: #555555 #e0e0e0 #e0e0e0 #555555;
  background-color: #a8a8a8;
}

/* =============================================================================
   CONTENT PANE — Main dynamic area
============================================================================= */

#content-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: #c0c0c0;
  border-left: 2px solid #d8d8d8; /* mirror sidebar border */
}

#content-titlebar {
  background-color: #888888;
  color: #ffffff;
  padding: 2px 8px;
  font-size: 11px;
  font-family: "Courier New", Courier, monospace;
  border-bottom: 2px solid #555555;
  border-top: 1px solid #d8d8d8;
  flex-shrink: 0;
  user-select: none;
}

#content-path {
  color: #e8e8e8;
  font-weight: bold;
}

#content-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 20px;
  background-color: #c2c2c2;
}

/* Content scrollbar */
#content-body::-webkit-scrollbar {
  width: 14px;
  background-color: #ababab;
}

#content-body::-webkit-scrollbar-thumb {
  background-color: #b0b0b0;
  border: 2px solid;
  border-color: #d8d8d8 #666666 #666666 #d8d8d8;
}

/* =============================================================================
   RENDERED MARKDOWN CONTENT
   Styles applied to the HTML produced by marked.js
============================================================================= */

#content-body h1,
#content-body h2,
#content-body h3,
#content-body h4 {
  font-family: "Courier New", Courier, monospace;
  color: #111111;
  margin-top: 18px;
  margin-bottom: 6px;
  border-bottom: 2px solid #888888;
  padding-bottom: 3px;
  letter-spacing: 0.5px;
}

#content-body h1 { font-size: 16px; }
#content-body h2 { font-size: 14px; }
#content-body h3 { font-size: 13px; border-bottom-style: dashed; }
#content-body h4 { font-size: 12px; border-bottom: none; }

#content-body p {
  margin: 8px 0;
  line-height: 1.7;
  font-size: 13px;
  color: #1a1a1a;
  max-width: 78ch; /* keep line length terminal-like */
}

#content-body ul, #content-body ol {
  margin: 8px 0 8px 20px;
  line-height: 1.7;
}

#content-body li {
  font-size: 13px;
  color: #1a1a1a;
}

#content-body blockquote {
  border-left: 4px solid #4d7182;
  margin: 10px 0;
  padding: 6px 12px;
  background-color: #b8b8b8;
  color: #333333;
  font-style: italic;
}

/* Inline code */
#content-body code {
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
  background-color: #2a2a2a;
  color: #e0e0e0;
  padding: 1px 5px;
  border: 1px solid #111111;
}

/* Code blocks — dark terminal aesthetic, keep it brutal */
#content-body pre {
  background-color: #1c1c1c;
  color: #e0e0e0;
  border: 2px solid;
  border-color: #555555 #d8d8d8 #d8d8d8 #555555; /* sunken/inset look */
  padding: 12px 14px;
  overflow-x: auto;
  margin: 12px 0;
  font-size: 12px;
  line-height: 1.5;
}

#content-body pre code {
  /* Reset inline code styles inside code blocks */
  background-color: transparent;
  color: inherit;
  border: none;
  padding: 0;
  font-size: inherit;
}

#content-body hr {
  border: none;
  border-top: 2px solid #888888;
  margin: 16px 0;
}

#content-body a {
  color: #003377;
}

#content-body strong {
  font-weight: bold;
  color: #000000;
}

#content-body em {
  font-style: italic;
  color: #333333;
}

#content-body table {
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 12px;
  width: auto;
}

#content-body th, #content-body td {
  border: 1px solid #888888;
  padding: 4px 10px;
  text-align: left;
}

#content-body th {
  background-color: #999999;
  font-weight: bold;
}

#content-body tr:nth-child(even) {
  background-color: #b8b8b8;
}

/* =============================================================================
   HOME VIEW — post list rendering
============================================================================= */

.post-section-header {
  font-family: "Courier New", Courier, monospace;
  font-size: 13px;
  font-weight: bold;
  color: #ffffff;
  background-color: #4d7182;
  padding: 3px 8px;
  margin-top: 14px;
  margin-bottom: 6px;
  border: 2px solid;
  border-color: #7fa8bb #2a4f5e #2a4f5e #7fa8bb;
  letter-spacing: 0.5px;
}

.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.post-list-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 4px 8px;
  border-bottom: 1px solid #aaaaaa;
  background-color: #bbbbbb;
}

.post-list-item:nth-child(odd) {
  background-color: #c4c4c4;
}

.post-list-item:hover {
  background-color: #4d7182;
  color: #ffffff;
}

.post-list-item:hover a {
  color: #ffffff;
}

.post-date {
  font-size: 11px;
  color: #555555;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: "Courier New", Courier, monospace;
}

.post-list-item:hover .post-date {
  color: #ccddee;
}

.post-title-link {
  font-size: 13px;
  font-weight: bold;
}

.post-tag {
  font-size: 10px;
  color: #ffffff;
  background-color: #4d7182;
  padding: 1px 5px;
  border: 1px solid #2a4f5e;
  white-space: nowrap;
}

.post-tag.tag-short {
  background-color: #5c5c7a;
  border-color: #333355;
}

/* =============================================================================
   ERROR / LOADING STATES
============================================================================= */

.error-box {
  border: 2px solid;
  border-color: #555555 #d8d8d8 #d8d8d8 #555555;
  background-color: #cc4444;
  color: #ffffff;
  padding: 10px 14px;
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
  margin: 10px 0;
}

.loading-msg {
  color: #555555;
  font-style: italic;
  font-size: 12px;
}

/* =============================================================================
   STATUS BAR — bottom chrome
============================================================================= */

#statusbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 8px;
  background-color: #999999;
  border-top: 2px solid #d8d8d8;
  font-size: 11px;
  font-family: "Courier New", Courier, monospace;
  color: #111111;
  flex-shrink: 0;
  user-select: none;
}

#status-left {
  color: #222222;
}

#status-right {
  color: #444444;
}

/* =============================================================================
   RESPONSIVE — narrow viewports (graceful degradation only)
   IRIX workstations had huge screens but we handle small ones minimally.
============================================================================= */

@media (max-width: 640px) {
  #layout {
    flex-direction: column;
  }

  #sidebar {
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 2px solid #666666;
    overflow-y: visible;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .panel {
    flex: 1 1 150px;
  }

  #content-body {
    padding: 10px 12px;
  }
}
