/* feedtagger — Windows 95 UI, light and dark.
 *
 * Rules of the house: no border-radius, no box-shadow, no gradients, no
 * transitions, no animations, no webfonts. Bevels are made of 1px+2px borders
 * and nothing else, and both palettes share identical geometry.
 */

:root {
  --face: #c0c0c0;   /* button/window face          */
  --text: #000000;   /* body text                   */
  --hi:   #ffffff;   /* top-left bevel highlight    */
  --lo:   #808080;   /* bottom-right bevel shadow   */
  --dk:   #000000;   /* outer 1px frame             */
  --title:#000080;   /* active title bar            */
  --title-text: #ffffff;
  --field:#ffffff;   /* text input / list surface   */
  --field-text: #000000;
  --sel:  #000080;   /* selection                   */
  --sel-text: #ffffff;
  --desktop: #008080;
  --dim:  #4a4a4a;   /* secondary text, AA on face  */
  --bad:  #800000;
  --warn-face: #ffffcc;
  --link: #000080;
  --link-visited: #551a8b;
}

:root[data-theme="dark"] {
  --face: #3a3a3a;
  --text: #e0e0e0;
  --hi:   #6e6e6e;
  --lo:   #1a1a1a;
  --dk:   #000000;
  --title:#000080;
  --title-text: #ffffff;
  --field:#1e1e1e;
  --field-text: #e0e0e0;
  --sel:  #000080;
  --sel-text: #ffffff;
  --desktop: #004f4f;
  --dim:  #b8b8b8;
  --bad:  #ff9a8f;
  --warn-face: #4a4520;
  --link: #9fc4ff;
  --link-visited: #d2aaff;
}

/* The OS preference applies on first paint, with no JavaScript and therefore no
 * flash of the wrong theme. The cookie-driven data-theme attribute above wins. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --face: #3a3a3a;
    --text: #e0e0e0;
    --hi:   #6e6e6e;
    --lo:   #1a1a1a;
    --dk:   #000000;
    --title:#000080;
    --title-text: #ffffff;
    --field:#1e1e1e;
    --field-text: #e0e0e0;
    --sel:  #000080;
    --sel-text: #ffffff;
    --desktop: #004f4f;
    --dim:  #b8b8b8;
    --bad:  #ff9a8f;
    --warn-face: #4a4520;
    --link: #9fc4ff;
    --link-visited: #d2aaff;
  }
}

*, *::before, *::after {
  box-sizing: border-box;
  border-radius: 0 !important;
  box-shadow: none !important;
  transition: none !important;
  animation: none !important;
}

html {
  background: var(--desktop);
}

body {
  margin: 0;
  padding: 8px;
  background: var(--desktop);
  color: var(--text);
  font-family: "MS Sans Serif", "Pixelated MS Sans Serif", Tahoma, Verdana, sans-serif;
  font-size: 12px;
  line-height: 1.45;
}

.mono, .mono * {
  font-family: "Courier New", Courier, "DejaVu Sans Mono", monospace;
}

.break { word-break: break-all; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* --- bevels ------------------------------------------------------------- */

.raised {
  border: 1px solid var(--dk);
  border-top-color: var(--hi);
  border-left-color: var(--hi);
}

/* --- window ------------------------------------------------------------- */

.desktop {
  max-width: 1200px;
  margin: 0 auto;
}

.window {
  background: var(--face);
  border: 1px solid var(--dk);
  border-top: 2px solid var(--hi);
  border-left: 2px solid var(--hi);
  border-right: 2px solid var(--lo);
  border-bottom: 2px solid var(--lo);
  padding: 2px;
}

.titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: var(--title);
  color: var(--title-text);
  padding: 2px 2px 2px 4px;
  font-weight: bold;
  font-size: 12px;
}

.titlebar-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.titlebar-buttons {
  display: flex;
  flex: 0 0 auto;
  gap: 2px;
}

.tbtn {
  min-width: 18px;
  height: 16px;
  padding: 0 3px;
  font-size: 11px;
  font-weight: bold;
  line-height: 14px;
  text-align: center;
}

a.tbtn, a.tbtn:visited { color: var(--text); text-decoration: none; }

/* --- menu bar ----------------------------------------------------------- */

.menubar {
  border-bottom: 1px solid var(--lo);
  padding: 1px 0 2px;
  margin-bottom: 4px;
}

.menu {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.menu a {
  display: block;
  padding: 2px 8px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid transparent;
}

.menu a:hover {
  border: 1px solid var(--dk);
  border-top-color: var(--hi);
  border-left-color: var(--hi);
}

.menu a.active {
  background: var(--sel);
  color: var(--sel-text);
}

.window-body { padding: 4px 6px 8px; }

/* --- status bar --------------------------------------------------------- */

.statusbar {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: 4px;
}

.statusfield {
  padding: 1px 6px;
  border: 1px solid var(--hi);
  border-top-color: var(--lo);
  border-left-color: var(--lo);
  color: var(--text);
}

.statusfield-grow { flex: 1 1 auto; }

/* --- typography --------------------------------------------------------- */

h1, h2, h3 { font-size: 13px; margin: 0 0 4px; }
h2 { font-size: 14px; }
p { margin: 0 0 6px; }

a { color: var(--link); }
a:visited { color: var(--link-visited); }

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 1px;
}

.hint { color: var(--dim); font-size: 11px; }
.sep { color: var(--dim); padding: 0 2px; }
.ok { color: var(--text); font-weight: bold; }
.bad { color: var(--bad); font-weight: bold; }
.warn { color: var(--dim); }
.num { text-align: right; }

mark {
  background: var(--sel);
  color: var(--sel-text);
}

/* --- banners ------------------------------------------------------------ */

.banner {
  border: 1px solid var(--dk);
  border-top-color: var(--hi);
  border-left-color: var(--hi);
  padding: 5px 8px;
  margin: 0 0 6px;
  background: var(--face);
}

.banner-warn { background: var(--warn-face); color: var(--text); }
.banner-warn a { color: var(--link); }
.banner-head { font-weight: bold; margin: 0 0 2px; }
.banner ul { margin: 0; padding-left: 18px; }

.banner-icon, .dialog-icon {
  display: inline-block;
  width: 16px; height: 16px;
  margin-right: 4px;
  text-align: center;
  line-height: 14px;
  font-weight: bold;
  font-family: "Times New Roman", Times, serif;
  background: var(--field);
  color: var(--field-text);
  border: 1px solid var(--lo);
  border-top-color: var(--hi);
  border-left-color: var(--hi);
}

/* --- layout ------------------------------------------------------------- */

.columns { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.col-side { flex: 1 1 280px; min-width: 260px; }
.col-main { flex: 3 1 460px; min-width: 300px; }
.col-half { flex: 1 1 300px; min-width: 260px; }

/* --- fieldsets ---------------------------------------------------------- */

fieldset {
  border: 1px solid var(--lo);
  border-right-color: var(--hi);
  border-bottom-color: var(--hi);
  margin: 0 0 8px;
  padding: 8px 8px 6px;
  min-width: 0;
}

legend {
  padding: 0 4px;
  font-weight: bold;
  color: var(--text);
}

.legend-inline { font-weight: bold; display: block; }

/* --- controls ----------------------------------------------------------- */

.field { margin: 0 0 6px; }
.field > label { display: block; margin-bottom: 2px; }

.checkline { display: flex; align-items: center; gap: 5px; }
.checkline > label { display: inline; margin: 0; }
.radios { display: flex; flex-wrap: wrap; gap: 4px 12px; }

input[type="text"], input[type="search"], input[type="number"],
input[type="date"], select, textarea {
  font-family: inherit;
  font-size: 12px;
  width: 100%;
  max-width: 100%;
  padding: 2px 3px;
  background: var(--field);
  color: var(--field-text);
  border: 1px solid var(--dk);
  border-top-color: var(--lo);
  border-left-color: var(--lo);
  border-right-color: var(--hi);
  border-bottom-color: var(--hi);
}

input.mono { font-family: "Courier New", Courier, monospace; }

input[readonly] { color: var(--field-text); }

input[type="checkbox"], input[type="radio"] {
  width: 13px; height: 13px;
  flex: 0 0 auto;
  accent-color: var(--title);
}

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

/* Buttons: the raised bevel is a 2px highlight/shadow pair plus a 1px dark ring
 * drawn one pixel outside it by ::before (box-shadow is banned, so the outer
 * frame has to be a real box). :active swaps the pair and shifts the label. */
.btn, button {
  position: relative;
  display: inline-block;
  margin: 1px;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.3;
  padding: 2px 9px;
  background: var(--face);
  color: var(--text);
  text-decoration: none;
  text-align: center;
  cursor: default;
  border-top: 2px solid var(--hi);
  border-left: 2px solid var(--hi);
  border-right: 2px solid var(--lo);
  border-bottom: 2px solid var(--lo);
  outline-offset: 2px;
}

.btn::before, button::before {
  content: "";
  position: absolute;
  inset: -3px;
  border: 1px solid var(--dk);
  pointer-events: none;
}

a.btn, a.btn:visited { color: var(--text); }

.btn:active, button:active {
  border-top-color: var(--lo);
  border-left-color: var(--lo);
  border-right-color: var(--hi);
  border-bottom-color: var(--hi);
  padding: 3px 8px 1px 10px;
}

.btn-default { font-weight: bold; }

.btn-disabled, .btn-disabled:visited {
  color: var(--lo);
  text-shadow: 1px 1px 0 var(--hi);
}

.actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.paging { display: flex; gap: 6px; margin-top: 8px; }

/* --- taxonomy tree ------------------------------------------------------ */

.treebox {
  background: var(--field);
  color: var(--field-text);
  border: 1px solid var(--dk);
  border-top-color: var(--lo);
  border-left-color: var(--lo);
  border-right-color: var(--hi);
  border-bottom-color: var(--hi);
  max-height: 340px;
  overflow: auto;
  padding: 4px 6px;
  margin-bottom: 6px;
}

.treebox-tall { max-height: 620px; }
.treebox a { color: var(--link); }

.tree, .tree ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tree ul { padding-left: 14px; border-left: 1px dotted var(--lo); margin-left: 4px; }

.node > details > summary {
  cursor: default;
  padding: 1px 0;
  list-style: none;
}

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

.node > details > summary::before {
  content: "+";
  display: inline-block;
  width: 11px; height: 11px;
  margin-right: 4px;
  font-family: "Courier New", Courier, monospace;
  font-size: 10px;
  line-height: 9px;
  text-align: center;
  border: 1px solid var(--lo);
  background: var(--field);
  color: var(--field-text);
  vertical-align: middle;
}

.node > details[open] > summary::before { content: "\2212"; }

.node-head { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.node-head label { cursor: default; }
.node-lazy > details > summary { font-style: normal; }
.node-more { margin: 2px 0 4px 16px; display: flex; gap: 6px; align-items: center; }

.count {
  /* Reads as part of the label -- "film industry (5)" -- rather than as a
     separate chip, which was visually heavier than the label it annotated. */
  color: var(--lo);
  font-weight: normal;
}

.badge {
  padding: 0 3px;
  font-size: 10px;
  text-transform: uppercase;
  background: var(--sel);
  color: var(--sel-text);
}

/* --- chips -------------------------------------------------------------- */

.chips { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 5px;
  background: var(--face);
  border: 1px solid var(--dk);
  border-top-color: var(--hi);
  border-left-color: var(--hi);
}

.chip-x { text-decoration: none; font-weight: bold; }

/* --- results ------------------------------------------------------------ */

.resultline { border-bottom: 1px solid var(--lo); padding-bottom: 4px; }
.empty { padding: 8px 0; color: var(--dim); }

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

.post {
  padding: 6px 0;
  border-bottom: 1px solid var(--lo);
}

.post:last-child { border-bottom: none; }
.post-title { font-size: 13px; margin: 0 0 2px; }
.post-title-lg { font-size: 15px; }
.post-meta { font-size: 11px; color: var(--dim); margin: 0 0 3px; }
.post-meta a { color: var(--link); }
.post-summary { margin: 0 0 4px; }

/* A quiet, secondary control -- excluding a blog is a step away from what the
   line is mainly telling you (title, date, score), so it must not compete
   with the blog-name link for attention. */
.post-exclude {
  margin-left: 4px;
  font-size: 10px;
  color: var(--dim);
  text-decoration: none;
}

.post-exclude:hover { color: var(--link); }

.tags { list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 3px 6px; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 4px;
  font-size: 11px;
  background: var(--face);
  border: 1px solid var(--lo);
  border-top-color: var(--hi);
  border-left-color: var(--hi);
}

.tag-derived { font-style: italic; }
.derived-mark { font-style: normal; font-weight: bold; }
.tag-score { color: var(--dim); }

/* --- segmented meter ---------------------------------------------------- */

.meter {
  display: inline-flex;
  gap: 1px;
  padding: 1px;
  background: var(--face);
  border: 1px solid var(--dk);
  border-top-color: var(--lo);
  border-left-color: var(--lo);
  border-right-color: var(--hi);
  border-bottom-color: var(--hi);
  vertical-align: middle;
}

.meter .cell {
  display: block;
  width: 4px;
  height: 9px;
  background: var(--face);
}

.meter .cell.on { background: var(--title); }

:root[data-theme="dark"] .meter .cell.on { background: #6f8fff; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .meter .cell.on { background: #6f8fff; }
}

/* --- tables ------------------------------------------------------------- */

.grid {
  width: 100%;
  border-collapse: collapse;
  background: var(--field);
  color: var(--field-text);
  font-size: 11px;
  border: 1px solid var(--dk);
  border-top-color: var(--lo);
  border-left-color: var(--lo);
}

.grid th, .grid td {
  border: 1px solid var(--lo);
  padding: 2px 5px;
  text-align: left;
  vertical-align: top;
}

.grid thead th {
  background: var(--face);
  color: var(--text);
  font-weight: bold;
  border: 1px solid var(--dk);
  border-top-color: var(--hi);
  border-left-color: var(--hi);
}

.grid a { color: var(--link); }
.grid .row-bad th, .grid .row-bad td { color: var(--bad); }
.grid .row-derived th, .grid .row-derived td { font-style: italic; }
.pathcell { max-width: 26em; overflow-wrap: anywhere; }

.scrollbox {
  max-height: 300px;
  overflow: auto;
  border: 1px solid var(--dk);
  border-top-color: var(--lo);
  border-left-color: var(--lo);
}

/* --- definition lists --------------------------------------------------- */

.props {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 1px 10px;
  margin: 0 0 6px;
}

.props dt { font-weight: bold; }
.props dd { margin: 0; overflow-wrap: anywhere; }

.definition { max-width: 62em; }
.topic-label { font-size: 16px; margin-bottom: 2px; }
.crumbs { font-size: 11px; color: var(--dim); }
.crumbs a { color: var(--link); }

.linklist { margin: 0; padding-left: 18px; }
.linklist li { margin-bottom: 1px; }

.hypothesis {
  margin: 0;
  padding: 6px 8px;
  background: var(--field);
  color: var(--field-text);
  border: 1px solid var(--dk);
  border-top-color: var(--lo);
  border-left-color: var(--lo);
  border-right-color: var(--hi);
  border-bottom-color: var(--hi);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.reader {
  background: var(--field);
  color: var(--field-text);
  border: 1px solid var(--dk);
  border-top-color: var(--lo);
  border-left-color: var(--lo);
  border-right-color: var(--hi);
  border-bottom-color: var(--hi);
  padding: 8px 10px;
  max-height: 460px;
  overflow: auto;
  white-space: pre-wrap;
  max-width: 68em;
}

/* --- dialog ------------------------------------------------------------- */

.dialog {
  background: var(--face);
  border: 1px solid var(--dk);
  border-top: 2px solid var(--hi);
  border-left: 2px solid var(--hi);
  border-right: 2px solid var(--lo);
  border-bottom: 2px solid var(--lo);
  padding: 2px;
  margin: 0 0 8px;
}

.titlebar-dialog { font-size: 11px; }
.dialog-body { padding: 8px 10px 10px; }
.dialog-lead { display: flex; align-items: flex-start; font-weight: bold; }
.dialog-actions { display: flex; justify-content: center; margin: 10px 0 0; }
.dialog-actions .btn { min-width: 76px; }

/* "derived" carries a real explanation on hover, so mark it as an abbreviation
   rather than leaving users to guess what the arrow means. */
.derived-help {
  border-bottom: 1px dotted var(--lo);
  cursor: help;
  text-decoration: none;
}

/* The language list reuses the tree's row layout but is flat, so it needs no
   indentation. */
.lang-list { margin-left: 0; padding-left: 0; }
.lang-list .node { list-style: none; }
