/* ==========================================================================
   boxlegs: Vista glass. Every page is one window on a wallpaper.
   Sections: tokens, base, window chrome, menus, buttons, home, prose, code,
   tooltips, contents, dialogs, wallpaper picker, modes, 404, responsive.
   ========================================================================== */

/* ---- Tokens & base ------------------------------------------------------- */
:root {
  --ink: #17314a;
  --text: #1e3d5a;
  --heading: #0f3f6e;
  --link: #1c5a96;
  --muted: #55718c;          /* 5:1 on --paper; the one secondary text colour */
  --paper: #fbfdff;
  --rule: #b7d2ec;
  --frame: rgba(120,185,235,.55);
  --frame-edge: rgba(255,255,255,.8);
  --font: "Segoe UI", "Open Sans", "Frutiger", system-ui, sans-serif;
  --measure: 920px;          /* reading column; post windows are sized to it */
  --zs: .9;                  /* text size; vista.js keeps it in step with the View menu */
  --mono: Consolas, "SF Mono", Menlo, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  color: var(--ink); min-height: 100vh; padding-bottom: 20px; overflow-x: hidden;
  /* Default wallpaper; the picker swaps it via body[data-wall]. */
  background: #1f78d1 url("../img/wallpapers/bliss.jpg") center / cover no-repeat fixed;
}
[hidden] { display: none !important; }   /* grid/flex display rules would otherwise beat the attribute */
.desk { max-width: 940px; margin: 0 auto; padding: 26px 18px; }

/* Browser surfaces take the palette. */
::selection { background: #3a8cde; color: #fff; }
input { caret-color: var(--link); }
* { scrollbar-width: thin; scrollbar-color: #8fb4da transparent; }
pre { scrollbar-color: #5d7a96 #0c0c0c; }
:focus-visible { outline: 2px solid #2b7fd6; outline-offset: 2px; }
a { text-underline-offset: .18em; }

/* ---- Window chrome ------------------------------------------------------- */
.win { margin-bottom: 26px; border-radius: 12px 12px 6px 6px; padding: 0 7px 7px;
  background: linear-gradient(180deg, rgba(146,205,248,.82), var(--frame)); border: 1px solid var(--frame-edge);
  box-shadow: 0 0 0 1px rgba(20,70,120,.55), 0 22px 46px rgba(0,0,0,.38), inset 0 1px 0 rgba(255,255,255,.9); backdrop-filter: blur(10px); }
.titlebar { display: flex; align-items: center; gap: 10px; padding: 7px 4px 7px 6px; color: #08243d; font-weight: 600; font-size: 13.5px;
  text-shadow: 0 0 8px rgba(255,255,255,.95), 0 1px 0 rgba(255,255,255,.6); }
.titlebar .ico { display: inline-flex; width: 18px; height: 18px; position: relative; flex-shrink: 0; }
.titlebar .ico i { position: absolute; }
.titlebar .ico .c { left: 0; top: 2px; width: 9px; height: 9px; border-radius: 50%; background: #1e88e5; }
.titlebar .ico .s { right: 0; top: 0; width: 8px; height: 8px; background: #e53935; border-radius: 2px; }
.titlebar .ico .t { left: 5px; bottom: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 8px solid #fbc02d; }
.titlebar .ttl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Window buttons, drawn rather than typed. */
.ctl { display: flex; gap: 3px; }
.ctl b, .ctl a { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 19px; color: #123; border-radius: 4px; cursor: pointer; user-select: none;
  background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(180,215,245,.65) 50%, rgba(140,190,235,.7) 51%, rgba(200,230,250,.85)); border: 1px solid rgba(20,70,120,.6); }
.ctl .x { width: 44px; color: #fff; background: linear-gradient(180deg, #f5a79c, #e0523f 50%, #c8301c 51%, #e56a58); }
.ctl b:hover, .ctl a:hover { filter: brightness(1.08); }
.ctl b:active, .ctl a:active { filter: brightness(.92); }
.ctl .mn::before { content: ""; position: absolute; left: 50%; top: 50%; width: 9px; height: 2px; margin: 2px 0 0 -4.5px; background: currentColor; border-radius: 1px; }
.ctl b[data-ctl="max"]::before { content: ""; position: absolute; left: 50%; top: 50%; width: 10px; height: 8px; margin: -4px 0 0 -5px; border: 1.5px solid currentColor; border-top-width: 3px; border-radius: 1px; }
.ctl .x::before, .ctl .x::after { content: ""; position: absolute; left: 50%; top: 50%; width: 11px; height: 2px; margin: -1px 0 0 -5.5px; background: currentColor; border-radius: 1px; }
.ctl .x::before { transform: rotate(45deg); } .ctl .x::after { transform: rotate(-45deg); }

/* Maximised: the window takes the whole viewport width and text re-wraps to it. Remembered across pages. */
body.max .desk { max-width: none !important; padding-left: 14px; padding-right: 14px; }
body.max .prose > * { max-width: none; }
body.max .ctl b[data-ctl="max"]::before { width: 7px; height: 6px; margin: -2px 0 0 -5px; border-width: 1.5px; }
body.max .ctl b[data-ctl="max"]::after { content: ""; position: absolute; left: 50%; top: 50%; width: 7px; height: 5px; margin: -5px 0 0 -2px; border: 1.5px solid currentColor; border-left: 0; border-bottom: 0; }
.win.flash { box-shadow: 0 0 0 1px rgba(20,70,120,.55), 0 0 0 4px rgba(255,236,140,.9), 0 22px 46px rgba(0,0,0,.38); }

.toolbar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 8px 10px; background: linear-gradient(180deg, #eef4fb, #dae7f6);
  border: 1px solid rgba(20,70,120,.35); border-top: 1px solid #fff; border-bottom: none; }
.addr { flex: 1; min-width: 160px; padding: 4px 10px; font-size: 12.5px; background: #fff; border: 1px solid #8fa9c4; border-radius: 3px; box-shadow: inset 0 1px 2px rgba(0,0,0,.12); color: #345;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.addr.search { display: flex; align-items: center; gap: 8px; cursor: text; transition: .12s; }
.addr.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; color: #1d3a56; }
.addr.search input::placeholder { color: var(--muted); }
.addr.search:focus-within { border-color: #3c8ad3; box-shadow: inset 0 1px 2px rgba(0,0,0,.12), 0 0 0 2px rgba(60,140,230,.28); }
.addr .mag { width: 14px; height: 14px; flex-shrink: 0; background: var(--muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='7' cy='7' r='4.5' fill='none' stroke='black' stroke-width='2'/%3E%3Cpath d='M10.5 10.5L14 14' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='7' cy='7' r='4.5' fill='none' stroke='black' stroke-width='2'/%3E%3Cpath d='M10.5 10.5L14 14' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat; }

.content > .back { margin-bottom: 18px; }
.content { background: var(--paper); border: 1px solid rgba(20,70,120,.5); padding: 24px 28px; zoom: var(--zs, 1); }

/* ---- Menus --------------------------------------------------------------- */
.menu { position: relative; display: flex; gap: 2px; padding: 3px 6px; font-size: 13px; background: linear-gradient(180deg, #f4f8fd, #e4edf8);
  border: 1px solid rgba(20,70,120,.35); border-bottom: none; border-radius: 3px 3px 0 0; }
.menu .m { position: relative; }
.menu .mb { font: inherit; font-size: 13px; color: var(--ink); background: none; border: 1px solid transparent; border-radius: 3px; padding: 3px 9px; cursor: default; }
.menu .mb:hover, .menu .mb:focus-visible { background: linear-gradient(180deg, #fff, #cfe5fb); border-color: #8fbbe4; outline: none; }
.menu .mb[aria-expanded="true"] { background: linear-gradient(180deg, #e2f0fd, #bcdaf7); border-color: #7fb0e0; }
.dd { position: absolute; top: 100%; left: 0; z-index: 60; min-width: 238px; padding: 3px; margin-top: 1px;
  background: linear-gradient(180deg, #fdfeff, #eef4fb); border: 1px solid #7f9db9; border-radius: 3px;
  box-shadow: 3px 4px 10px rgba(0,0,0,.3), inset 0 0 0 1px rgba(255,255,255,.9); }
.dd .it { display: flex; align-items: center; width: 100%; gap: 8px; padding: 4px 10px 4px 6px; border: 1px solid transparent; border-radius: 3px;
  background: none; font: inherit; font-size: 13px; color: var(--ink); text-align: left; cursor: default; }
.dd .it .ck { display: grid; place-items: center; width: 14px; height: 14px; flex-shrink: 0; }
.dd .it .ck.is-check::after { content: ""; width: 4px; height: 8px; border: solid var(--link); border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }
.dd .it .ck.is-radio::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--link); }
.dd .it .lb { flex: 1; white-space: nowrap; }
.dd .it .ac { color: #4a6580; font-size: 12px; margin-left: 18px; }
.dd .it:hover:not(:disabled), .dd .it:focus-visible { background: linear-gradient(180deg, #f6fbff, #d3e8fb); border-color: #9cc3e8; outline: none; }
.dd .it:disabled { color: #a5b6c6; }
.dd .sep { height: 1px; margin: 3px 4px 3px 26px; background: #c9d8e8; border-bottom: 1px solid #fff; }

/* Search lives at the right end of the menu bar. */
.menu { align-items: center; }
.menu .addr.search { order: 2; margin-left: auto; flex: 0 1 230px; min-width: 120px; padding: 2px 8px; }

/* ---- Buttons ------------------------------------------------------------- */
.btn { border: 1px solid #6a8cb0; cursor: pointer; padding: 5px 14px; border-radius: 4px; font: 600 12.5px var(--font); color: var(--ink); text-decoration: none;
  display: inline-flex; align-items: center; gap: 7px;
  background: linear-gradient(180deg, #fff 0%, #e6f0fa 48%, #cfe1f4 50%, #dcebf8 100%); box-shadow: inset 0 0 0 1px rgba(255,255,255,.9); transition: .12s; }
.btn:hover { border-color: #3c8ad3; background: linear-gradient(180deg, #fdfeff 0%, #dff0ff 48%, #b8dcff 50%, #cfe8ff 100%); box-shadow: inset 0 0 0 1px #fff, inset 0 -6px 8px rgba(80,160,235,.28); }
.btn:active { background: linear-gradient(180deg, #8ec3f1, #cfe5fa); border-color: #2b6fb5; box-shadow: inset 0 2px 4px rgba(20,70,130,.45); padding-top: 6px; padding-bottom: 4px; }
.btn.primary { border-color: #3c8ad3; box-shadow: inset 0 0 0 1px #fff, 0 0 0 1px rgba(60,140,230,.35); }
.btn.back::before { content: ""; display: inline-block; width: 12px; height: 12px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M10 3L5 8l5 5' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M10 3L5 8l5 5' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; }

/* ---- Home: hero + timeline ----------------------------------------------- */
.home > h1 { font-size: 40px; line-height: 1.08; font-weight: 700; color: var(--heading); letter-spacing: -.01em; }
.home > p { margin: 12px 0 30px; font-size: 16px; line-height: 1.6; color: #44627f; max-width: 470px; }
.year { line-height: 1.3; margin: 22px 0 8px; padding-bottom: 4px; font-size: 16px; font-weight: 700; color: var(--link); border-bottom: 1px solid var(--rule); font-variant-numeric: tabular-nums; }
.row { display: grid; grid-template-columns: 1fr 72px; column-gap: 18px; align-items: start; padding: 13px 14px; margin: 0 -15px;
  border: 1px solid transparent; border-radius: 4px; text-decoration: none; color: inherit; transition: .1s; }
.row:hover { background: linear-gradient(180deg, #f3f9ff, #dcecfb); border-color: #a9cdee; box-shadow: inset 0 0 0 1px rgba(255,255,255,.9); }
.row h3 { font-size: 17.5px; font-weight: 600; color: var(--heading); line-height: 1.3; }
.row p { margin-top: 4px; font-size: 14px; color: #5a748d; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row .when { text-align: right; padding-top: 3px; line-height: 1.35; font-variant-numeric: tabular-nums; }
.row .when b { display: block; font-size: 13px; font-weight: 600; color: var(--link); }
.none { padding: 34px 0 20px; text-align: center; color: var(--muted); font-size: 14.5px; }

/* ---- Prose (posts) ------------------------------------------------------- */
.prose { font-size: 17px; line-height: 1.72; color: var(--text); }
.prose h1 { font-size: 34px; line-height: 1.12; font-weight: 700; color: var(--heading); margin: 6px 0 0; }
.prose h2, .prose h3, .prose h4, .prose h5, .prose h6 { scroll-margin-top: 20px; color: var(--heading); }
.prose h2 { font-size: 25px; line-height: 1.25; font-weight: 700; margin: 42px 0 14px; }
.prose h3 { font-size: 20px; line-height: 1.3; font-weight: 700; margin: 32px 0 12px; }
.prose h4 { font-size: 16.5px; line-height: 1.4; font-weight: 700; margin: 26px 0 8px; }
.prose h5, .prose h6 { font-size: 14.5px; line-height: 1.6; font-weight: 400; color: var(--muted); margin: 0 0 14px; }   /* quiet intro line */
.prose p { margin-bottom: 15px; }
.prose a { color: var(--link); }
.prose a:hover { color: #0f3f6e; }
.prose strong { font-weight: 700; }
.prose del { text-decoration: line-through; color: var(--muted); }
.prose ul, .prose ol { margin: 0 0 15px; padding-left: 1.5em; }
.prose li { margin-bottom: 4px; }
.prose li > ul, .prose li > ol { margin: 4px 0 4px; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 36px 0; }
.prose blockquote { margin: 18px 0; padding: 12px 18px; background: #eef5fc; border: 1px solid #cfe1f3; border-radius: 4px; }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose code { font: 600 .86em var(--mono); padding: 1px 7px; border-radius: 3px; background: #e8f1fb; color: var(--link); border: 1px solid #c2d8ee; overflow-wrap: anywhere; }
.prose table { display: block; overflow-x: auto; border-collapse: collapse; margin: 22px 0; font-size: 15px; line-height: 1.5; }
.prose th, .prose td { padding: 8px 14px; border-bottom: 1px solid #d3e3f3; text-align: left; vertical-align: top; }
.prose th { font-size: 13px; font-weight: 700; color: var(--heading); border-bottom: 2px solid var(--rule); white-space: nowrap; }
.prose kbd { font: 12px var(--mono); padding: 1px 7px; border: 1px solid #9bb3cc; border-bottom-width: 2px; border-radius: 4px; background: linear-gradient(180deg, #fff, #e6f0fa); }
.prose img { display: block; max-width: 100%; height: auto; border-radius: 4px; }
.prose figure { margin: 24px 0; }
.prose figcaption { margin-top: 8px; font-size: 13px; line-height: 1.5; color: var(--muted); text-align: center; }
/* One reading column: text, code, figures and tables share the same width. */
.prose > * { max-width: var(--measure); }   /* px, not ch: ch scales with each element's own font size */
/* The post window hugs the column at any text size, so there is no dead space on the right.
   Extras: column + content padding scale with zoom; desk padding, window frame and borders do not. */
body[data-page="post"] .desk { max-width: calc((var(--measure) + 56px) * var(--zs) + 54px); }

.prose .meta { margin-top: 10px; font-size: 12.5px; color: var(--muted); letter-spacing: .08em; font-variant-numeric: tabular-nums; }
.prose .tick { width: 54px; height: 5px; margin: 12px 0 20px; background: linear-gradient(90deg, #ee5a45, #ff9a88); border-radius: 3px; }
.prose .msg { margin-top: 36px; font-size: 13px; line-height: 1.55; color: #44627f; }
.prose .msg a { font-weight: 600; }

/* ---- Code ---------------------------------------------------------------- */
.console { margin: 20px 0; border-radius: 6px 6px 3px 3px; border: 1px solid #243a52; overflow: hidden; }
.console .cb { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 28px; padding: 3px 8px; font: 12px var(--mono); color: #0a2036;
  background: linear-gradient(180deg, #dcecfb, #a9cbec); text-shadow: 0 1px 0 rgba(255,255,255,.6); }
.console .cb-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.console .cb-copy { margin-left: auto; padding: 1px 10px; font: inherit; color: inherit; text-shadow: none; border: 1px solid #5f86ad; border-radius: 3px; cursor: pointer; user-select: none;
  background: linear-gradient(180deg, #fff, #cfe1f4); transition: background .08s, box-shadow .08s; }
.console .cb-copy:hover { border-color: #3c8ad3; background: linear-gradient(180deg, #fdfeff, #b8dcff); box-shadow: inset 0 -5px 7px rgba(80,160,235,.3); }
/* Pressed: the gradient inverts, an inner shadow appears and the label sinks 1px, like a real Aero button. */
.console .cb-copy:active { background: linear-gradient(180deg, #8ec3f1, #cfe5fa); border-color: #2b6fb5; box-shadow: inset 0 2px 4px rgba(20,70,130,.45); padding-top: 2px; padding-bottom: 0; }
.console pre { margin: 0; padding: 14px 16px; background: #0c0c0c; color: #c9d4de; font: 13.5px/1.6 var(--mono); overflow-x: auto; }
.console pre code { font: inherit; color: inherit; background: none; border: 0; padding: 0; white-space: pre; overflow-wrap: normal; word-break: normal; }
/* highlight.js tokens on the console palette (no theme stylesheet is loaded). */
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-section, .hljs-name { color: #7fd0ff; }
.hljs-string, .hljs-regexp, .hljs-symbol, .hljs-attr, .hljs-bullet { color: #f3d36b; }
.hljs-number { color: #ffab8a; }
.hljs-built_in, .hljs-type, .hljs-class .hljs-title, .hljs-title.class_ { color: #8fe0c0; }
.hljs-comment, .hljs-quote { color: #6f8aa0; font-style: italic; }
.hljs-meta, .hljs-doctag, .hljs-variable, .hljs-template-variable { color: #b3c6d6; }
.hljs-emphasis { font-style: italic; } .hljs-strong { font-weight: 700; }

/* ---- Tooltips: [term]{text} ---------------------------------------------- */
.term { position: relative; border-bottom: 2px dotted #2a8bdc; cursor: help; }
.term .tip { position: absolute; bottom: 132%; left: 50%; z-index: 20; transform: translate(-50%, 6px); width: 250px; padding: 9px 12px; font-size: 13px; line-height: 1.45; color: #1a2d40; border-radius: 4px;
  background: linear-gradient(180deg, #ffffe9, #fbf4c4); border: 1px solid #b6a64c; box-shadow: 2px 3px 8px rgba(0,0,0,.3); opacity: 0; pointer-events: none; transition: .15s; }
.term .tip code { font-size: .92em; }
.term:hover .tip, .term:focus .tip { opacity: 1; transform: translate(-50%, 0); }
.term .tip::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -6px; border: 6px solid transparent; border-top-color: #fbf4c4; }

/* ---- Contents (collapsed by default, under the title) -------------------- */
.toc { margin: 0 0 22px; }
.toc summary { display: inline-flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; list-style: none; font: 600 13px var(--font); color: var(--link); }
.toc summary::-webkit-details-marker { display: none; }
.toc summary::before { content: ""; width: 5px; height: 5px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(-45deg); transition: transform .15s; }
.toc[open] summary::before { transform: rotate(45deg); }
.toc ul { list-style: none; margin: 6px 0 0; padding: 0; }
.toc ul ul { margin: 4px 0 0; padding-left: 18px; }
.toc li { margin: 0 0 4px; font-size: 14px; line-height: 1.45; }
.toc a { color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--link); text-decoration: underline; }

/* ---- Dialogs (native <dialog>: focus trap and Esc come free) ------------- */
dialog.dlg { border: 0; padding: 0 7px 7px; border-radius: 12px 12px 6px 6px; margin: auto; color: var(--ink); font-family: inherit; width: min(460px, calc(100vw - 28px));
  background: linear-gradient(180deg, rgba(146,205,248,.97), rgba(120,185,235,.93));
  box-shadow: 0 0 0 1px rgba(20,70,120,.6), 0 24px 60px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.9); }
dialog.dlg::backdrop { background: rgba(6,24,48,.45); }
dialog.dlg .dbody { background: var(--paper); border: 1px solid rgba(20,70,120,.5); padding: 20px 22px; font-size: 14.5px; line-height: 1.55; }
dialog.dlg .dbody h4 { font-size: 16px; color: var(--heading); margin-bottom: 6px; }
dialog.dlg .dbody p + p { margin-top: 8px; }
dialog.dlg .dbody a { color: var(--link); }
dialog.dlg .dfoot { display: flex; gap: 8px; justify-content: flex-end; padding: 10px; background: linear-gradient(180deg, #eef4fb, #dae7f6); border: 1px solid rgba(20,70,120,.35); border-top: none; }
.about { display: flex; gap: 18px; align-items: flex-start; }
.biglogo { position: relative; width: 58px; height: 58px; flex-shrink: 0; }
.biglogo i { position: absolute; }
.biglogo .c { left: 0; top: 6px; width: 28px; height: 28px; border-radius: 50%; background: radial-gradient(circle at 30% 26%, #fff 0 8%, #86d0ff 28%, #1d84dd 75%); box-shadow: 0 3px 6px rgba(11,85,156,.4); }
.biglogo .s { right: 0; top: 0; width: 24px; height: 24px; border-radius: 6px; background: linear-gradient(150deg, #ffc1b4, #ee5a45 60%, #c0301d); box-shadow: 0 3px 6px rgba(192,48,29,.4); }
.biglogo .t { left: 16px; bottom: 0; border-left: 14px solid transparent; border-right: 14px solid transparent; border-bottom: 24px solid #f6b122; filter: drop-shadow(0 3px 3px rgba(160,100,0,.4)); }
.fine { font-size: 12.5px; color: var(--muted); }
.tipbox { display: flex; gap: 14px; align-items: flex-start; }
.tipbox .bulb svg { display: block; }
.kb { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; align-items: center; }
kbd { font: 12px var(--mono); padding: 1px 7px; border: 1px solid #9bb3cc; border-bottom-width: 2px; border-radius: 4px; background: linear-gradient(180deg, #fff, #e6f0fa); }
.feed { display: flex; gap: 8px; margin-top: 10px; }
.feed input { flex: 1; min-width: 0; font: 13px var(--mono); padding: 5px 8px; border: 1px solid #8fa9c4; border-radius: 3px; color: #1d3a56; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 16px); opacity: 0; z-index: 90; pointer-events: none; padding: 9px 18px; border-radius: 6px;
  background: linear-gradient(180deg, #fffff0, #fbf4c4); border: 1px solid #b6a64c; box-shadow: 2px 3px 10px rgba(0,0,0,.3); font-size: 13px; color: #2a2a18; transition: opacity .2s, transform .2s; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }


/* ---- Wallpapers & picker ------------------------------------------------- */
body[data-wall] { background-color: #12304f; background-repeat: no-repeat; background-position: center; background-size: cover; background-attachment: fixed; }
body[data-wall="bliss"]           { background-image: url("../img/wallpapers/bliss.jpg"); }
body[data-wall="swirl"]           { background-image: url("../img/wallpapers/swirl.jpg"); }
body[data-wall="vista-aurora"]    { background-image: url("../img/wallpapers/vista-aurora.jpg"); }
body[data-wall="aurora-borealis"] { background-image: url("../img/wallpapers/aurora-borealis.jpg"); }
body[data-wall="hills"]           { background-image: url("../img/wallpapers/hills.jpg"); }

/* Collapsed to its label until hovered or focused, then the swatches slide out. */
.wall { position: fixed; right: 16px; bottom: 16px; z-index: 30; display: flex; align-items: center; padding: 8px 12px; border-radius: 10px; outline: none; cursor: default;
  background: linear-gradient(180deg, rgba(255,255,255,.82), rgba(214,232,250,.7)); border: 1px solid rgba(255,255,255,.9);
  box-shadow: 0 0 0 1px rgba(20,70,120,.45), 0 8px 22px rgba(0,0,0,.3); backdrop-filter: blur(10px); font-size: 12px; font-weight: 600; color: #1c4670; }
.wall:focus-visible { box-shadow: 0 0 0 2px #2b7fd6, 0 8px 22px rgba(0,0,0,.3); }
.wall .sw { display: flex; gap: 9px; align-items: center; max-width: 0; opacity: 0; overflow: hidden; padding: 4px 0; margin: -4px 0; transition: max-width .28s ease, opacity .2s ease, margin-left .28s ease; }
.wall:hover .sw, .wall:focus-within .sw, .wall:focus .sw { max-width: 220px; opacity: 1; margin-left: 12px; padding-left: 3px; padding-right: 3px; }
.wall button { width: 30px; height: 22px; border-radius: 4px; cursor: pointer; padding: 0; border: 1px solid rgba(20,50,80,.6);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.55), 0 1px 2px rgba(0,0,0,.3); transition: transform .12s, box-shadow .12s; }
.wall button:hover { transform: translateY(-2px); }
.wall button[aria-pressed="true"] { box-shadow: inset 0 0 0 1px #fff, 0 0 0 2px #2b7fd6; }
.wall [data-w="bliss"]           { background: #123 url("../img/wallpapers/thumbs/bliss.jpg") center / cover; }
.wall [data-w="swirl"]           { background: #123 url("../img/wallpapers/thumbs/swirl.jpg") center / cover; }
.wall [data-w="vista-aurora"]    { background: #123 url("../img/wallpapers/thumbs/vista-aurora.jpg") center / cover; }
.wall [data-w="aurora-borealis"] { background: #123 url("../img/wallpapers/thumbs/aurora-borealis.jpg") center / cover; }
.wall [data-w="hills"]           { background: #123 url("../img/wallpapers/thumbs/hills.jpg") center / cover; }

/* ---- Modes --------------------------------------------------------------- */
/* Reader: the article alone on a plain page. Esc or the button leaves. */
.reader-exit { display: none; }
body.reader { background: var(--paper) !important; padding-bottom: 0; }
body.reader .wall { display: none; }
body.reader .desk { max-width: 720px !important; }
body.reader .prose > * { max-width: none; }
body.reader .win { background: none; border: 0; box-shadow: none; backdrop-filter: none; padding: 0; margin: 0 auto; left: auto; transform: none; width: auto; }
body.reader .win .titlebar, body.reader .win .menu, body.reader .win .toolbar, body.reader .win .status { display: none; }
body.reader .win .content { border: 0; background: transparent; padding: 36px 6px 60px; }
body.reader .reader-exit { display: block; position: fixed; top: 14px; right: 14px; z-index: 80; font: 600 12.5px var(--font); padding: 6px 14px; border-radius: 4px; cursor: pointer;
  color: var(--ink); border: 1px solid #6a8cb0; background: linear-gradient(180deg, #fff, #cfe1f4); }

/* Reduce effects: no blur, motion or transitions. On by default for prefers-reduced-motion. */
body.calm *, body.calm *::before, body.calm *::after { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; animation: none !important; transition: none !important; }
body.calm .win { background: #8fc3ee; }
body.calm .wall { background: #e4eefa; }

/* ---- 404 ----------------------------------------------------------------- */
body[data-page="404"] { display: grid; place-items: center; padding: 20px; }
.dlg-page { width: min(470px, 100%); padding: 0 7px 7px; border-radius: 12px 12px 6px 6px;
  background: linear-gradient(180deg, rgba(146,205,248,.97), rgba(120,185,235,.93));
  box-shadow: 0 0 0 1px rgba(20,70,120,.6), 0 24px 60px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.9); animation: pop .22s ease-out; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.nf-body { display: flex; gap: 18px; align-items: flex-start; background: var(--paper); border: 1px solid rgba(20,70,120,.5); padding: 24px 24px 22px; }
.nf-body h1 { font-size: 17px; font-weight: 700; color: var(--heading); }
.nf-body p { margin-top: 8px; font-size: 14.5px; line-height: 1.55; color: #3a5878; }
.nf-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 10px; background: linear-gradient(180deg, #eef4fb, #dae7f6); border: 1px solid rgba(20,70,120,.35); border-top: none; }
.err { position: relative; flex-shrink: 0; width: 46px; height: 46px; border-radius: 50%; border: 2px solid #fff; color: #fff;
  background: radial-gradient(circle at 32% 26%, #ffd0c8 0 10%, #ee5a45 40%, #b82a17 100%); box-shadow: 0 0 0 1px #b82a17, 0 4px 8px rgba(120,20,0,.4); }
.err::before, .err::after { content: ""; position: absolute; left: 50%; top: 50%; width: 20px; height: 3px; margin: -1.5px 0 0 -10px; background: currentColor; border-radius: 2px; }
.err::before { transform: rotate(45deg); } .err::after { transform: rotate(-45deg); }

/* ---- Responsive (declared last so it beats the base rules above) --------- */
@media (max-width: 680px) {
  .content { padding: 18px; }
  .home > h1 { font-size: 30px; }
  .prose h1 { font-size: 26px; }
  .prose h2 { font-size: 22px; margin-top: 34px; }
  .row { grid-template-columns: 1fr; }
  .row .when { grid-column: 1; text-align: left; margin-top: 6px; padding: 0; }
  .menu { flex-wrap: wrap; }
  .menu .addr.search { flex: 1 0 100%; margin: 4px 0 2px; padding: 6px 10px; }
  .menu .mb { padding: 9px 11px; }
  .dd { min-width: 214px; }
  .dd .it { padding: 10px 10px 10px 6px; }
  .ctl b, .ctl a { height: 26px; }
  .btn { min-height: 36px; }
  .wall { display: none; }   /* it would sit on the article; the View menu offers the same choices */
}
@media (prefers-reduced-motion: reduce) { .dlg-page { animation: none; } }
