/*
 * Marc's CSS - Clean & Structured
 */

/* ============================================================================
   FONTS (DejaVu Sans Mono - classic Linux terminal font, free license)
   ============================================================================ */
@font-face {
  font-family: 'DejaVu Sans Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/static/DejaVuSansMono.ttf') format('truetype');
}

@font-face {
  font-family: 'DejaVu Sans Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/static/DejaVuSansMono-Bold.ttf') format('truetype');
}

/* ============================================================================
   CSS VARIABLES
   ============================================================================ */
:root {
  /* Colors - Background */
  --color-bg:                  #1d1d1f;   /* Main background */
  --color-nav-bg:              #282828;   /* Header/footer background */
  --color-pre-bg:              #1a1a1a;   /* Code block background */

  /* Colors - Text */
  --color-text:                #faf8f0;   /* Main text (near-white) */
  --color-heading:             #e0e0e0;   /* Headings (lighter gray) */
  --color-pre:                 #8ba3b7;   /* Code block text (light blue-gray) */
  --color-code:                #a3c9c4;   /* Inline code (soft teal) */

  /* Colors - Interactive */
  --color-link:                #6b8fa3;   /* Links (muted blue-gray) */
  --color-link-hover:          #9bb4c8;   /* Link hover (lighter blue) */
  --color-accent:              #4a7ba7;   /* Header/logo/glow (medium blue) */

  /* Colors - UI */
  --color-border:              #333333;   /* Borders */
  --color-selection:           #FF0000;   /* Text selection */
}

/* ============================================================================
   GLOBAL RESET & BASE STYLES
   ============================================================================ */
* {
  font-family: 'DejaVu Sans Mono', monospace;
  font-weight: 400;
  scrollbar-width: thin;
  scrollbar-color: var(--color-accent) var(--color-pre-bg);
}

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

img, video {
  max-width: 100%;
  height: auto;
}

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

::-moz-selection {
  background: var(--color-selection);
}

body {
  color: var(--color-text);
  background: var(--color-bg);
  margin: 0;
  padding: 0;
  font-size: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============================================================================
   TYPOGRAPHY
   ============================================================================ */

/* Headings */
h1, h2, h3, h4 {
  color: var(--color-heading);
}

h1 {
  margin-bottom: 0.25ex;
  padding: 0;
}

h1::after, h2::after {
  content: "_";
  padding-left: 2px;
  animation: blink 1.2s ease infinite;
}

h3::before {
  content: ">";
}

h3 {
  margin-top: 1em;
  margin-bottom: 0.5em;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Text elements */
p {
  margin: 0;
}

p, ul, li, td, th, figcaption {
  color: var(--color-text);
}

figcaption {
  font-size: 0.8rem;
  font-style: italic;
  margin-top: 0.25em;
  text-align: left;
  line-height: 1.3;
  user-select: none;
}

strong {
  background: #FF0000;
  color: var(--color-text);
  padding: 2px 4px;
  font-weight: 400;
}

b {
  font-weight: bold;
}

/* ============================================================================
   LINKS & INTERACTIVE ELEMENTS
   ============================================================================ */
a, summary {
  color: var(--color-link);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover, summary:hover {
  color: var(--color-link-hover);
  text-decoration: underline;
}

details > summary {
  cursor: pointer;
}

details:open {
  padding: 5px;
}

details.donation:open {
  background-color: transparent;
}

summary h1, summary h2, summary h3, summary h4, summary h5, summary h6 {
  display: inline;
  margin: 0;
}

/* ============================================================================
   LAYOUT - HEADER, CONTENT, FOOTER
   ============================================================================ */

/* Header */
header {
  color: var(--color-accent);
  background-color: var(--color-nav-bg);
  height: 50px;
  width: 100%;
  margin-bottom: 20px;
  border-bottom: dotted 1px var(--color-border);
  position: sticky;
  top: 0;
  z-index: 9999;
  margin: 0 auto;
  max-width: 100%;
}

nav {
  color: var(--color-link);
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 auto;
  max-width: 900px;
  padding: 0 5px;
}

nav a {
  padding: 0 5px;
}

/* Content */
main {
  padding: 5px;
  margin: 0 auto;
  max-width: 900px;
  flex: 1;
}

article {
  max-width: 900px;
}

/* Footer */
footer {
  width: 100%;
  background-color: var(--color-nav-bg);
  text-align: center;
  box-sizing: border-box;
  padding: 15px;
  margin-top: 4rem;
}

/* ============================================================================
   CODE BLOCKS & INLINE CODE
   ============================================================================ */
pre {
  max-height: 500px;
  overflow-y: auto;
  max-width: 900px;
  font-family: 'DejaVu Sans Mono', monospace;
  color: var(--color-pre);
  background: var(--color-pre-bg);
  padding: 1em;
  margin: 10px auto;
  border: 1px solid var(--color-border);
  word-wrap: break-word;
  white-space: pre-wrap;
}

code {
  position: relative;
  color: var(--color-code);
  background: var(--color-pre-bg);
  padding: 2px 4px;
  border-radius: 2px;
  font-family: 'DejaVu Sans Mono', monospace;
}

/* ============================================================================
   TABLES
   ============================================================================ */
table {
  margin-top: 20px;
  width: 100%;
  border-collapse: collapse;
  display: block;
  max-width: 100%;
  overflow-x: auto;
}

th, td {
  border: 1px solid var(--color-border);
  padding: 2px;
}

/* ============================================================================
   LISTS
   ============================================================================ */
ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

ul li {
  word-break: break-all;
}

ul li img {
  max-height: 1em;
  max-width: 1em;
}

ul li details::marker {
  display: none;
}

ul li summary {
  list-style: none;
}

/* ============================================================================
   COMPONENTS
   ============================================================================ */

/* Note boxes */
.note-box {
  border: 2px solid var(--color-border);
  padding: 10px;
  margin: 20px 0;
  font-family: 'DejaVu Sans Mono', monospace;
  color: var(--color-text);
}

/* Config boxes */
.config-box {
  margin: 15px 0;
}

/* Man-page styled posts */
.manpage .man-head,
.manpage .man-foot {
  display: flex;
  justify-content: space-between;
  gap: 1em;
  color: var(--color-link-hover);
  font-size: 0.8em;
  white-space: nowrap;
  overflow: hidden;
}

.manpage .man-head {
  border-bottom: 1px solid var(--color-link);
  padding-bottom: 0.4em;
  margin-top: 1.5em;
  margin-bottom: 1.5em;
}

.manpage .man-foot {
  border-top: 1px solid var(--color-link);
  padding-top: 0.4em;
  margin-top: 2.5em;
}

/* post section headers: semantic <h2>, styled like a man-page section line */
.manpage h2 {
  font-size: 1em;
  font-weight: bold;
  color: var(--color-heading);
  letter-spacing: 0.08em;
  margin: 1.5em 0 0.2em;
}

/* no blinking cursor inside posts (kept on index + non-post pages) */
.manpage h2::after,
.manpage h1::after {
  content: none;
}

/* man-page indentation: section headers flush left, bodies indented one tab */
.manpage .man-name,
.manpage p,
.manpage ul,
.manpage ol,
.manpage dl,
.manpage figcaption {
  margin-left: 4ch;
}

/* vertical rhythm — replaces the old manual <br> spacers */
.manpage p,
.manpage ul,
.manpage ol,
.manpage dl {
  margin-bottom: 0.8em;
}

.manpage h3 {
  margin-left: 2ch;
}

/* man subsection: bold + indented, no terminal '>' marker */
.manpage h3::before {
  content: none;
}

/* flatten boxes into plain indented text */
.manpage pre {
  border: none;
  background: none;
  padding: 0;
  margin: 0.5em 0 1em 4ch;
  max-height: none;     /* drop legacy 500px box + inner scrollbar */
  overflow: visible;
}

/* images align to the indented text column (not the full content width) */
.manpage img {
  display: block;
  margin-left: 4ch;
  max-width: calc(100% - 4ch);
}

.manpage code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-weight: bold;
  color: #66d9ef;
}

.manpage strong {
  background: none;
  color: inherit;
  padding: 0;
  font-weight: bold;
}

.manpage table {
  width: auto;
  border-collapse: collapse;
  margin: 0.5em 0 1em 4ch;
  display: table;       /* drop legacy block+overflow-x scrollbar */
  overflow: visible;
}

.manpage th,
.manpage td {
  border: none;
  padding: 1px 1.5em 1px 0;
}

/* keybinding tables (e.g. ql-demos OPTIONS): accent the key column */
.manpage table.keys td.k {
  color: var(--color-link-hover);
  white-space: nowrap;
}

/* before/after comparison lists (e.g. x220-thermal): label + value inline */
.manpage dl.compare div {
  display: flex;
  gap: 1.5em;
}
.manpage dl.compare dt {
  color: var(--color-link-hover);
  min-width: 9ch;
}
.manpage dl.compare dd {
  margin: 0;
}

.manpage .note-box {
  border: none;
  padding: 0;
  margin: 1em 0 1em 4ch;
}

/* containers add no indent of their own (children handle it) */
.manpage .config-box {
  margin-left: 0;
}

.manpage .note-box p {
  margin-left: 0;
}

/* collapsible blocks read as man subsections */
.manpage details {
  margin: 0.5em 0 1em 4ch;
}

.manpage summary {
  color: var(--color-heading);
  font-weight: bold;
  cursor: pointer;
}

/* lists: simple man-style bullets, indented under the section */
.manpage ul li {
  word-break: normal;
}

.manpage ul li::before {
  content: "- ";
  color: var(--color-link);
}

/* 88x31-style image badge (footer) */
.badge88 {
  vertical-align: middle;
  image-rendering: pixelated;
}

/* Badge wall */
.badge-wall {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 1rem;
}

/* Image link badges (88x31) - retro, static */
.lbadge {
  display: block;
  image-rendering: pixelated;
}

/* Private badge (about page): animated rainbow frame on hover */
.mybadge {
  display: inline-block;
  padding: 2px;
  background: transparent;
}

.mybadge:hover {
  background-image: linear-gradient(90deg,
    #ff004d, #ff8a00, #ffe600, #00d26a, #00b3ff, #7a5cff, #ff004d);
  background-size: 300% 100%;
  animation: badge-rainbow 1.8s linear infinite;
}

@keyframes badge-rainbow {
  from { background-position: 0 0; }
  to   { background-position: 300% 0; }
}

/* Posts list (index /docs) */
/* apropos-style index: name(1) aligned column + description */
.posts {
  list-style: none;
  padding: 0;
  margin: 1em 0;
}

.posts li {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1ch;
  padding: 0.1em 0;
}

.posts a {
  flex: 0 0 22ch;
  white-space: nowrap;
}

.posts .desc {
  flex: 1 1 16em;
  color: var(--color-text);
  opacity: 0.8;
}

.badge {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 200px;
  height: 28px;
  padding: 4px 12px;
  font-family: 'DejaVu Sans Mono', monospace;
  text-align: center;
  color: #2a5d8f;
  text-decoration: none;
  background: #c0c0c0;
  box-sizing: border-box;
  border-top: 2px solid #ffffff;
  border-left: 2px solid #ffffff;
  border-right: 2px solid #808080;
  border-bottom: 2px solid #808080;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: none;
}

.badge:hover {
  background: #a0a0a0;
  border-top: 2px solid #808080;
  border-left: 2px solid #808080;
  border-right: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  text-decoration: none;
  text-shadow: none;
}

/* Treeview (regedit / Win95 explorer style) */
.treeview {
  background: var(--color-nav-bg);
  border-top: 2px solid #808080;
  border-left: 2px solid #808080;
  border-right: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  padding: 4px 4px 4px 20px;
  font-family: 'DejaVu Sans Mono', monospace;
  font-size: 14px;
  color: var(--color-text);
  margin-top: 0.5rem;
}

.treeview, .treeview ul {
  list-style: none;
}

.treeview ul {
  margin: 0;
  padding: 0 0 0 18px;
}

.treeview li {
  position: relative;
  padding: 1px 0 1px 18px;
  color: var(--color-text);
  word-break: normal;
}

/* no lines on top-level items */
.treeview > li {
  padding-left: 0;
}

/* horizontal branch line (nested items only) */
.treeview ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 50%;
  width: 14px;
  border-left: 1px dotted #808080;
  border-bottom: 1px dotted #808080;
}

/* vertical line connecting siblings (nested items only) */
.treeview ul li::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-left: 1px dotted #808080;
}

.treeview ul li:last-child::after {
  bottom: 50%;
}

.treeview ul li:first-child::before {
  top: 50%;
  border-left: none;
}

.treeview ul li:only-child::after {
  display: none;
}

.treeview a {
  color: var(--color-link);
}

.treeview a:hover {
  color: #ffffff;
  background: #000080;
  text-shadow: none;
  text-decoration: none;
}

.treeview summary {
  cursor: pointer;
  color: var(--color-text);
  text-shadow: none;
  list-style: none;
}

.treeview summary::-webkit-details-marker {
  display: none;
}

.treeview summary::before {
  content: "[+]";
  font-family: 'DejaVu Sans Mono', monospace;
  font-size: 11px;
  margin-right: 4px;
  color: #808080;
}

.treeview details[open] > summary::before {
  content: "[-]";
}

.treeview summary:hover {
  color: #ffffff;
  background: #000080;
  text-shadow: none;
  text-decoration: none;
}

.treeview details {
  padding: 0;
}

.treeview details[open] {
  padding: 0;
  background: transparent;
}

/* ============================================================================
   FORMS
   ============================================================================ */
form {
  background-color: var(--color-nav-bg);
  padding: 1rem 1.5rem;
  border-radius: 1px;
  border: 1px solid var(--color-border);
  max-width: 500px;
  margin: 5.5rem auto;
  font-family: 'DejaVu Sans Mono', monospace;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

form input[type="file"] {
  background-color: var(--color-pre-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  padding: 0.5rem;
  border-radius: 1px;
  cursor: pointer;
}

form input[type="submit"] {
  background-color: var(--color-pre-bg);
  color: var(--color-text);
  border: none;
  padding: 0.6rem 1rem;
  border-radius: 1px;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.2s ease;
}

form input[type="submit"]:hover {
  background-color: var(--color-text);
  color: var(--color-bg);
}

/* ============================================================================
   SCROLLBARS (Webkit)
   ============================================================================ */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--color-pre-bg);
  border: 1px dotted var(--color-border);
}

::-webkit-scrollbar-thumb {
  background: var(--color-accent);
  border: 1px solid var(--color-border);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-link-hover);
}

::-webkit-scrollbar-corner {
  background: var(--color-pre-bg);
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */
@media print {
  main {
    margin: 0 50px 50px 0;
    padding: 10px;
  }
  nav {
    display: none;
  }
}

