/* ============================================================
   Blog — Win95 themed
   ============================================================
   Index page = Windows Explorer "Details" view (file list).
   Single post = Notepad document.

   The outer browser-window (title bar, drag, resize) is provided
   by index.html's window manager — we render only the *contents*
   of a Win95 window here. The blog template (blog.html) is just
   an HTML shell; build.js injects the menubar / status bar /
   listview chrome around the markdown content.
   ============================================================ */

:root {
  --w95-face: #c0c0c0;
  --w95-light: #ffffff;
  --w95-shadow: #808080;
  --w95-dark: #000000;
  --w95-highlight: #dfdfdf;
  --w95-text: #000000;
  --w95-select: #000080;
  --w95-select-text: #ffffff;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body.zine {
  font-family: "Tahoma", "MS Sans Serif", "Arial", sans-serif;
  font-size: 11px;
  color: var(--w95-text);
  background: var(--w95-face);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

main.paper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--w95-face);
}

.paper-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ============================================================
   Menu bar  (File Edit View Help)
   ============================================================ */

.menubar {
  display: flex;
  align-items: center;
  padding: 1px 2px;
  background: var(--w95-face);
  border-bottom: 1px solid var(--w95-shadow);
  flex-shrink: 0;
  user-select: none;
}
.menubar .mi {
  padding: 2px 8px 3px;
  cursor: default;
}
.menubar .mi u {
  text-decoration: underline;
}
.menubar .mi:hover {
  background: var(--w95-select);
  color: var(--w95-select-text);
}

/* ============================================================
   Address bar (Explorer-style)
   ============================================================ */

.addressbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 4px 4px;
  background: var(--w95-face);
  border-bottom: 1px solid var(--w95-shadow);
  flex-shrink: 0;
}
.addressbar label {
  padding: 0 4px;
}
.addressbar .addr-input {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  background: #fff;
  border-top: 1px solid var(--w95-shadow);
  border-left: 1px solid var(--w95-shadow);
  border-right: 1px solid var(--w95-light);
  border-bottom: 1px solid var(--w95-light);
  box-shadow:
    inset 1px 1px 0 #404040,
    inset -1px -1px 0 var(--w95-highlight);
  padding: 1px 4px;
  height: 18px;
  font-size: 11px;
}
.addressbar .addr-input img {
  width: 14px;
  height: 14px;
  image-rendering: pixelated;
}

/* ============================================================
   Toolbar  (Back button on post pages)
   ============================================================ */

.toolbar {
  display: flex;
  align-items: center;
  padding: 2px 4px;
  background: var(--w95-face);
  border-bottom: 1px solid var(--w95-shadow);
  flex-shrink: 0;
  gap: 2px;
}
.toolbar button {
  background: var(--w95-face);
  color: var(--w95-text);
  font-family: inherit;
  font-size: 11px;
  padding: 2px 10px 3px;
  border-top: 1px solid var(--w95-light);
  border-left: 1px solid var(--w95-light);
  border-right: 1px solid var(--w95-dark);
  border-bottom: 1px solid var(--w95-dark);
  box-shadow:
    inset 1px 1px 0 var(--w95-highlight),
    inset -1px -1px 0 var(--w95-shadow);
  cursor: pointer;
}
.toolbar button:active {
  border-top: 1px solid var(--w95-dark);
  border-left: 1px solid var(--w95-dark);
  border-right: 1px solid var(--w95-light);
  border-bottom: 1px solid var(--w95-light);
  box-shadow:
    inset 1px 1px 0 var(--w95-shadow),
    inset -1px -1px 0 var(--w95-highlight);
}

/* ============================================================
   Status bar
   ============================================================ */

.statusbar {
  display: flex;
  background: var(--w95-face);
  border-top: 1px solid var(--w95-light);
  padding: 2px;
  flex-shrink: 0;
  gap: 2px;
}
.statusbar > .cell {
  border-top: 1px solid var(--w95-shadow);
  border-left: 1px solid var(--w95-shadow);
  border-right: 1px solid var(--w95-light);
  border-bottom: 1px solid var(--w95-light);
  padding: 1px 6px 2px;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.statusbar > .cell.grow {
  flex: 1;
}

/* ============================================================
   Index page — Explorer "Details" listview
   ============================================================
   Markup (emitted by build.js wrapBlogIndex):

     <div class="index">
       <div class="colheaders">
         <div>Name</div><div>Size</div><div>Type</div><div>Modified</div>
       </div>
       <ul class="post-list">
         <li><a>title</a><span class="date">Apr 7, 2026</span></li>
         ...
       </ul>
     </div>

   We render <li>s as 4-column grid rows. Size and Type aren't in
   the markup at all — they're synthesized via ::before / ::after
   on the row. ============================================== */

.index {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
  border-top: 1px solid var(--w95-shadow);
  border-left: 1px solid var(--w95-shadow);
  border-right: 1px solid var(--w95-light);
  border-bottom: 1px solid var(--w95-light);
  box-shadow:
    inset 1px 1px 0 #404040,
    inset -1px -1px 0 var(--w95-highlight);
  margin: 2px;
}

.colheaders {
  display: grid;
  grid-template-columns: minmax(120px, 2fr) 48px 100px 96px;
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--w95-face);
  border-bottom: 1px solid var(--w95-shadow);
  flex-shrink: 0;
}
.colheaders > div {
  padding: 3px 6px 4px;
  background: var(--w95-face);
  border-top: 1px solid var(--w95-light);
  border-left: 1px solid var(--w95-light);
  border-right: 1px solid var(--w95-shadow);
  border-bottom: 1px solid var(--w95-shadow);
  box-shadow:
    inset 1px 1px 0 var(--w95-highlight),
    inset -1px -1px 0 #404040;
  user-select: none;
  cursor: default;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.colheaders > div:active {
  border-top: 1px solid var(--w95-shadow);
  border-left: 1px solid var(--w95-shadow);
  border-right: 1px solid var(--w95-light);
  border-bottom: 1px solid var(--w95-light);
  box-shadow: none;
}

.index .post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  overflow: auto;
  background: #fff;
}

.index .post-list li {
  display: grid;
  grid-template-columns: minmax(120px, 2fr) 48px 100px 96px;
  /* Items are explicitly placed in cols 1-4 but their DOM order is
     2, 1, 4, 3 (::before, <a>, .date, ::after). With the default
     row-major auto-flow the cursor advances past col 2 before
     reaching <a> at col 1, which forces a new row. `dense` lets
     the grid backfill earlier gaps so everything stays on row 1. */
  grid-auto-flow: dense;
  align-items: center;
  padding: 1px 0;
  cursor: default;
  border: 1px dotted transparent;
}
.index .post-list li:hover {
  background: #e8eef7;
}

/* Selected row visual flavour — first item only. */
.index .post-list li:first-child {
  background: var(--w95-select);
  color: var(--w95-select-text);
  border: 1px dotted var(--w95-select-text);
}
.index .post-list li:first-child a {
  color: var(--w95-select-text);
}

/* Each row's children are placed in DOM order: ::before, <a>,
   .date, ::after. We override that with explicit grid-column so
   they match the Name | Size | Type | Modified header layout. */
.index .post-list a {
  grid-column: 1;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 1px 6px;
  color: var(--w95-text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.index .post-list a::before {
  content: "";
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  background: url("/static/icons/blog.png") no-repeat center / contain;
  image-rendering: pixelated;
}
.index .post-list a:hover {
  text-decoration: underline;
}

/* Synthesized "Size" column (col 2). */
.index .post-list li::before {
  grid-column: 2;
  content: "1 KB";
  text-align: right;
  padding: 0 12px 0 6px;
  white-space: nowrap;
}
/* Synthesized "Type" column (col 3). */
.index .post-list li::after {
  grid-column: 3;
  content: "Text Document";
  padding: 0 6px;
  white-space: nowrap;
}

/* The .date span occupies the "Modified" column (col 4). */
.index .post-list .date {
  grid-column: 4;
  padding: 0 6px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   Single-post view — Notepad
   ============================================================ */

main.paper.note {
  /* Notepad's text area fills the window. */
}

.notepad {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
  border-top: 1px solid var(--w95-shadow);
  border-left: 1px solid var(--w95-shadow);
  border-right: 1px solid var(--w95-light);
  border-bottom: 1px solid var(--w95-light);
  box-shadow:
    inset 1px 1px 0 #404040,
    inset -1px -1px 0 var(--w95-highlight);
  margin: 2px;
  overflow: auto;
  padding: 8px 10px 14px;
  font-family: "Lucida Console", "Courier New", "Courier", monospace;
  font-size: 14px;
  color: var(--w95-text);
  line-height: 1.5;
}

.notepad h1 {
  font-size: 22px;
  font-weight: bold;
  font-family: inherit;
  margin: 0 0 6px;
  text-transform: none;
  letter-spacing: 0;
}

.notepad h2 { font-size: 15px; font-weight: bold; margin: 1em 0 0.4em; }
.notepad h3 { font-size: 14px; font-weight: bold; margin: 1em 0 0.4em; }

/* The italic date buildPage injects right after the H1 → render
   as a plaintext metadata line in [brackets]. */
.notepad h1 + p {
  margin: 0 0 1em;
  color: #404040;
}
.notepad h1 + p > em {
  font-style: normal;
}
.notepad h1 + p > em::before { content: "[ "; }
.notepad h1 + p > em::after  { content: " ]"; }

.notepad p { margin: 0 0 1em; }

.notepad ul,
.notepad ol {
  margin: 0 0 1em;
  padding-left: 0;
  list-style: none;
}
.notepad ul > li {
  padding-left: 0;
}
.notepad ul > li::before {
  content: "  * ";
  white-space: pre;
}
.notepad ol { counter-reset: nl; }
.notepad ol > li { counter-increment: nl; padding-left: 0; }
.notepad ol > li::before {
  content: "  " counter(nl) ". ";
  white-space: pre;
}

.notepad a {
  color: var(--w95-select);
  text-decoration: underline;
}
.notepad a:hover { color: #1084d0; }

.notepad code {
  font-family: inherit;
  background: #ececec;
  padding: 0 3px;
}
.notepad pre {
  background: #ececec;
  padding: 6px 8px;
  margin: 0 0 1em;
  overflow-x: auto;
}

.notepad blockquote {
  margin: 0 0 1em;
  padding-left: 1em;
  border-left: 2px solid var(--w95-shadow);
  color: #404040;
}

/* ============================================================
   Win95 scrollbars
   ============================================================ */

::-webkit-scrollbar {
  width: 16px;
  height: 16px;
}
::-webkit-scrollbar-track {
  background: repeating-conic-gradient(var(--w95-face) 0% 25%, #fff 0% 50%) 50% /
    2px 2px;
}
::-webkit-scrollbar-thumb {
  background: var(--w95-face);
  border-top: 2px solid var(--w95-light);
  border-left: 2px solid var(--w95-light);
  border-right: 2px solid var(--w95-dark);
  border-bottom: 2px solid var(--w95-dark);
  box-shadow:
    inset 1px 1px 0 var(--w95-highlight),
    inset -1px -1px 0 var(--w95-shadow);
}
::-webkit-scrollbar-button {
  background: var(--w95-face);
  border-top: 2px solid var(--w95-light);
  border-left: 2px solid var(--w95-light);
  border-right: 2px solid var(--w95-dark);
  border-bottom: 2px solid var(--w95-dark);
  box-shadow:
    inset 1px 1px 0 var(--w95-highlight),
    inset -1px -1px 0 var(--w95-shadow);
  display: block;
  height: 16px;
  width: 16px;
}
::-webkit-scrollbar-button:start:increment,
::-webkit-scrollbar-button:end:decrement {
  display: none;
}
::-webkit-scrollbar-button:vertical:decrement {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='4'%3E%3Cpolygon points='3,0 0,4 6,4' fill='black'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}
::-webkit-scrollbar-button:vertical:increment {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='4'%3E%3Cpolygon points='3,4 0,0 6,0' fill='black'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}
::-webkit-scrollbar-corner {
  background: var(--w95-face);
}
