/* The site dressed as the mLink desktop (client/src/ui/vstyle.h).
   Loaded LAST on every page, after manual.css, demo.css and any inline
   <style>, so it overrides them; the window and taskbar markup it styles is
   added by dress.py. Screen only: printing the books is unchanged. */

/* The client's DejaVu faces cut to the characters the site uses (Latin, punctuation, arrows: theme/fonts/,
   about 77 KB for all three); a glyph outside them falls back to the next face in the list. */
@font-face { font-family: "mLink Sans"; src: local("DejaVu Sans"), url("fonts/DejaVuSans.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "mLink Sans"; src: local("DejaVu Sans Bold"), url("fonts/DejaVuSans-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "mLink Mono"; src: local("DejaVu Sans Mono"), url("fonts/DejaVuSansMono.woff2") format("woff2"); font-display: swap; }

/* The client's palette, same names as vstyle.h / vtext.h. The selector list
   also beats manual.css's dark tokens: the desktop has one look. */
:root, :root:not([data-theme="light"]), :root[data-theme="dark"] {
  color-scheme: light;
  --vs-desktop: #008080;  --vs-face: #c0c0c0;   --vs-light: #ffffff;  --vs-hilite: #dfdfdf;
  --vs-shadow: #808080;   --vs-dark: #000000;   --vs-title: #000080;  --vs-title-off: #808080;
  --vs-field: #f4f2ec;    --vs-white: #ffffff;  --vs-text: #000000;   --vs-muted: #484848;
  --vs-ok: #005a00;       --vs-warn: #6b4000;   --vs-alert: #8b0000;  --vs-link: #1040a0;
  --vs-section: #606060;  --vs-plain: #5a1e7a;  --vs-sos: #c01010;    --vs-tip: #ffffe1;
  --vs-sans: "mLink Sans", "DejaVu Sans", Verdana, "Segoe UI", sans-serif;
  --vs-mono: "mLink Mono", "DejaVu Sans Mono", Consolas, monospace;

  /* manual.css tokens, mapped onto the palette */
  --ink: var(--vs-text); --muted: var(--vs-muted); --rule: var(--vs-shadow); --paper: var(--vs-white);
  --accent: var(--vs-link); --accent-soft: var(--vs-field);
  --why: var(--vs-ok); --why-soft: var(--vs-field);
  --tempt: var(--vs-warn); --tempt-soft: var(--vs-field);
  --plain: var(--vs-plain); --plain-soft: var(--vs-field);
  --note: var(--vs-muted); --note-soft: var(--vs-field);
  --code-bg: var(--vs-field); --sos: var(--vs-sos); --sos-soft: #f6dcdc;
  --serif: var(--vs-sans); --sans: var(--vs-sans); --mono: var(--vs-mono);

  /* the four bevels every control is drawn with */
  --raised: inset -1px -1px var(--vs-dark), inset 1px 1px var(--vs-light),
            inset -2px -2px var(--vs-shadow), inset 2px 2px var(--vs-hilite);
  --sunken: inset 1px 1px var(--vs-shadow), inset -1px -1px var(--vs-light),
            inset 2px 2px var(--vs-dark), inset -2px -2px var(--vs-hilite);
  --frame:  inset -1px -1px var(--vs-dark), inset 1px 1px var(--vs-hilite),
            inset -2px -2px var(--vs-shadow), inset 2px 2px var(--vs-light);
  --well:   inset 1px 1px var(--vs-shadow), inset -1px -1px var(--vs-light);
}

@media screen {

/* ---------------------------------------------------------- the desktop */
html { background: var(--vs-desktop); }
html body, body.page {
  max-width: none; margin: 0; padding: 20px 16px 64px;
  background: var(--vs-desktop); color: var(--vs-text);
  font-family: var(--vs-sans); font-size: 16px; line-height: 1.55;
}
::selection { background: var(--vs-title); color: var(--vs-light); }

/* ----------------------------------------------------------- the window */
.w95-win {
  max-width: 54rem; margin: 0 auto; padding: 3px;
  background: var(--vs-face); box-shadow: var(--frame);
}
.w95-title {
  display: flex; align-items: center; gap: 6px; height: 26px; padding: 0 3px 0 5px;
  background: var(--vs-title); color: var(--vs-light);
  font-weight: 700; font-size: 15px; line-height: 1; white-space: nowrap; overflow: hidden;
  user-select: none;
}
.w95-title .w95-name { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.w95-ico { width: 18px; height: 18px; flex: none; image-rendering: auto; }
.w95-btns { display: flex; gap: 2px; flex: none; }
.w95-btns a, .w95-btns span {
  display: inline-grid; place-items: center; width: 20px; height: 18px;
  background: var(--vs-face); box-shadow: var(--raised);
  color: var(--vs-text); font: 700 12px/1 var(--vs-sans); text-decoration: none;
}
.w95-btns a:active { box-shadow: var(--sunken); }
.w95-btns .w95-gap { margin-right: 2px; }
.w95-pane {
  margin-top: 3px; padding: 1.2rem 1.6rem 1.4rem;
  background: var(--vs-white); box-shadow: var(--sunken);
  overflow-wrap: break-word;
}
.w95-status {
  display: flex; gap: 3px; margin-top: 3px; font-size: 13px; color: var(--vs-text);
}
.w95-status span { padding: 2px 6px; box-shadow: var(--well); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w95-status span:first-child { flex: 1; }

/* ------------------------------------------------------------- the type */
h1, h2, h3, h4, .chapno, .toc, figcaption, caption, th, .part-title,
aside::before, .backrefs, .tagline, .go-note, .go-row, .rp-app { font-family: var(--vs-sans); }
h1 { font-size: 1.75rem; line-height: 1.2; font-weight: 700; }
h3 { font-size: 1.05rem; padding-bottom: .15em; border-bottom: 1px solid var(--vs-face); }
p, li { line-height: 1.6; }
a { color: var(--vs-link); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--vs-title); }
a:focus-visible { outline: 1px dotted var(--vs-text); outline-offset: 1px; }
a.term { color: inherit; text-decoration: underline dotted var(--vs-link); }
a.term:hover { background: var(--vs-title); color: var(--vs-light); }
.dim, .muted, .go-note, .rp-lede, .more, .tp-sub { color: var(--vs-muted); }

/* A section header is the client's section bar: gray, white bold text. */
.w95-pane h2 {
  margin: 2rem 0 .7rem; padding: .25em .55em;
  background: var(--vs-section); color: var(--vs-light);
  font-size: 1.02rem; font-weight: 700; line-height: 1.35;
}
.w95-pane h2 .secno { color: var(--vs-hilite); }
.w95-pane h2 a { color: inherit; }

/* The title page of a book and the front page's hero. */
.tp-mark { color: var(--vs-title); letter-spacing: .06em; font-size: 1rem; }
.tp-title { font-size: 2.4rem; }
.titlepage { min-height: 0; padding: 2.5rem 0 1.5rem; }
.tp-sub { border-top-color: var(--vs-face); }

/* A chapter opens with a title bar of its own. */
.chapter-head {
  border: 0; margin: 0 0 1.2rem; padding: .45rem .7rem .55rem;
  background: var(--vs-title); color: var(--vs-light);
}
.chapter-head h1 { margin: .1rem 0 0; font-size: 1.45rem; color: var(--vs-light); }
.chapno { color: var(--vs-hilite); font-size: .78rem; }
.part { padding: 3rem 0 1rem; }
.part-title { color: var(--vs-desktop); font-size: 2.1rem; }
.secno { color: var(--vs-muted); }

/* Contents: a tree view in a sunken white well. */
.toc { margin: 1rem 0 2rem; }
.toc > ol { padding: .5rem .8rem; background: var(--vs-white); box-shadow: var(--sunken); }
.toc a { color: var(--vs-text); text-decoration: none; padding: 0 .2em; }
.toc a:hover, .toc a:focus-visible { background: var(--vs-title); color: var(--vs-light); outline: 0; }
.toc .toc-part { color: var(--vs-text); }

/* ----------------------------------------------------- code and figures */
code, kbd, pre { font-family: var(--vs-mono); }
code { background: var(--vs-field); border: 1px solid var(--vs-hilite); border-radius: 0; padding: 0 .25em; }
pre { background: var(--vs-field); border-radius: 0; box-shadow: var(--sunken); padding: .8em 1em; }
pre code { border: 0; padding: 0; }
kbd {
  display: inline-block; padding: 0 .35em; font-size: .82em;
  background: var(--vs-face); box-shadow: var(--raised); border-radius: 0;
}
figure img, .shot, .rp-still img { border: 0; border-radius: 0; box-shadow: var(--sunken); padding: 2px; background: var(--vs-face); }
figcaption, caption { color: var(--vs-muted); }
.figno { color: var(--vs-text); }

/* ------------------------------------------- tables: the client's sheet */
table { border-collapse: separate; border-spacing: 0; background: var(--vs-white);
        border: 2px solid; border-color: var(--vs-shadow) var(--vs-light) var(--vs-light) var(--vs-shadow);
        font-size: .9rem; }
th {
  background: var(--vs-face); color: var(--vs-text); box-shadow: var(--raised);
  border: 0; padding: .3em .55em; font-weight: 400; font-size: .8rem;
  text-transform: uppercase; letter-spacing: .02em; white-space: nowrap;
}
td { border: 0; border-bottom: 1px solid var(--vs-hilite); padding: .32em .55em; }
tbody tr:hover td { background: var(--vs-field); }
caption { text-align: left; }
table.headline { border: 0; background: none; }
table.headline td { border: 0; background: var(--vs-face); box-shadow: var(--raised); }
table.headline tr:hover td { background: var(--vs-face); }

/* ------------------------------ callouts: the client's group boxes */
aside, .wip {
  position: relative; margin: 1.6em 0 1.2em; padding: 1em 1em .3em;
  background: var(--vs-field); border: 2px groove var(--vs-light); border-radius: 0;
  font-style: normal;
}
aside::before {
  position: absolute; top: -.75em; left: .7em; padding: 0 .35em;
  background: var(--vs-white); font-size: .78rem; letter-spacing: .03em;
}
aside.plain, aside.why, aside.tempting, aside.note, aside.operator { border-color: var(--vs-light); background: var(--vs-field); }
aside.plain::before { color: var(--vs-plain); }
aside.why::before { color: var(--vs-ok); }
aside.tempting::before { color: var(--vs-warn); }
aside.note::before { color: var(--vs-muted); }
aside.operator::before { color: var(--vs-link); }
.wip { border-left: 2px groove var(--vs-light); padding: .7em 1em .7em 2.4em; }
.wip::before { content: "!"; position: absolute; left: .7em; top: .65em; width: 1.2em; height: 1.2em;
  display: grid; place-items: center; background: #ffd830; color: #201800;
  font: 700 .8rem/1 var(--vs-sans); clip-path: polygon(50% 0, 100% 100%, 0 100%); padding-top: .25em; }

/* demo.css / download page notes: a message strip, alert-red edge */
.note, .msg { border: 0; border-left: 4px solid var(--vs-alert); padding: .55em .9em;
              background: var(--vs-field); box-shadow: var(--well); }
p.review-notice { font-style: normal; border-left: 4px solid var(--vs-face); background: var(--vs-field); padding: .4em .8em; }
p.more { border-top: 1px solid var(--vs-face); }

/* --------------------------------------------------- buttons and fields */
button, a.big, .btn, .w95-pane .rp-clips button, .w95-pane .rp-ctl button, .w95-tbtn, .w95-start > summary {
  font: 400 .95rem/1.2 var(--vs-sans); color: var(--vs-text);
  background: var(--vs-face); border: 0; border-radius: 0; box-shadow: var(--raised);
  padding: .45rem 1rem; min-height: 2.1rem; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: .4rem;
}
button:hover, .btn:hover, a.big:hover { color: var(--vs-text); background: var(--vs-face); border-color: transparent; }
button:active, .btn:active, a.big:active, .w95-pane .rp-clips button:active, .w95-pane .rp-ctl button:active,
.w95-pane .rp-clips button[aria-pressed="true"], .w95-pane .rp-ctl .rp-sound[aria-pressed="true"] {
  box-shadow: var(--sunken); background: #d4d0c8; color: var(--vs-text); font-weight: 400;
  border-color: transparent; padding-top: calc(.45rem + 1px); padding-bottom: calc(.45rem - 1px);
}
button:focus-visible, .btn:focus-visible, a.big:focus-visible, .w95-pane .rp-clips button:focus-visible, .w95-pane .rp-ctl button:focus-visible {
  outline: 1px dotted var(--vs-text); outline-offset: -5px; filter: none;
}
/* The default button: one more black line round it, as on a dialog. */
.btn.primary, button[type="submit"], a.big {
  font-weight: 700; color: var(--vs-text); background: var(--vs-face);
  box-shadow: 0 0 0 1px var(--vs-dark), var(--raised);
}
.btn.primary:hover, .btn.primary:focus-visible { color: var(--vs-text); filter: none; }
button.plain { font-weight: 400; padding: .2em .7em; min-height: 0; }
.go-row { gap: .6rem; }

input, textarea, select {
  font: 400 1rem/1.3 var(--vs-sans); color: var(--vs-text);
  background: var(--vs-field); border: 0; border-radius: 0; box-shadow: var(--sunken);
  padding: .45em .55em;
}
input:focus, textarea:focus, select:focus { outline: 1px dotted var(--vs-text); outline-offset: -4px; }
input[type="range"], .rp-seek { accent-color: var(--vs-title); box-shadow: none; background: none; }

details > summary { cursor: pointer; }
.how summary { color: var(--vs-link); text-decoration: underline; }
details.changes { border: 2px groove var(--vs-light); border-radius: 0; background: var(--vs-field); }
details.changes summary { font-weight: 700; }

/* ---------------------------------------------------- the front page */
.wide { width: auto; margin-left: 0; }
.hero { margin-bottom: 1.6rem; }
.tagline { color: var(--vs-text); }
.w95-pane .rp-stage { border-radius: 0; box-shadow: var(--sunken); padding: 2px; background: var(--vs-face); }
.rp-stage canvas { background: #0c111b; }
.w95-pane .rp-st { border: 0; border-radius: 0; background: var(--vs-face); box-shadow: var(--raised); padding: .45rem .6rem .5rem; }
.w95-pane .rp-st h3 { border: 0; padding: .15rem .3rem; margin: -.1rem -.2rem .2rem; background: var(--vs-title); color: var(--vs-light); }
.rp-st h3 .rp-nm { color: var(--vs-hilite); }
.rp-dot { box-shadow: 0 0 0 1px var(--vs-light); }
.rp-role, .rp-hears { color: var(--vs-muted); }
.w95-pane .rp-log { background: var(--vs-white); box-shadow: var(--sunken); border: 0; padding: .3rem .4rem; }
.w95-pane .rp-note { border-left-color: var(--vs-warn); }

/* -------------------------------------- download page and site stats */
.untested { color: var(--vs-warn); border-color: var(--vs-warn); border-radius: 0; background: var(--vs-tip); }
.left, .n { color: var(--vs-muted); }
.left.soon { color: var(--vs-alert); }
a.dl { font-weight: 700; }
/* A count bar is the desktop's progress bar: navy blocks. */
span.bar { height: .85em; background: repeating-linear-gradient(90deg, var(--vs-title) 0 7px, transparent 7px 9px); }
.count { color: var(--vs-title); }

/* ------------------------------------------------- dialogs (the notice) */
dialog {
  padding: 0 1.1em 1em; border: 0; border-radius: 0; max-width: 34em;
  background: var(--vs-face); box-shadow: var(--frame), 4px 4px 0 rgba(0,0,0,.35); color: var(--vs-text);
}
dialog::before {
  content: "mLink"; display: block; margin: 3px -1.1em .9em; padding: 0 .5em; height: 26px; line-height: 26px;
  background: var(--vs-title); color: var(--vs-light); font: 700 15px/26px var(--vs-sans);
  margin-left: calc(-1.1em + 3px); margin-right: calc(-1.1em + 3px);
}
dialog::backdrop { background: rgba(0, 64, 64, .35); }

/* ---------------------------------------------- the demo's station page */
body.seat { padding: 0; }
body.seat > .bar { background: var(--vs-title); color: var(--vs-light); font-family: var(--vs-sans); padding: 3px 6px; }
body.seat > .bar button { color: var(--vs-text); background: var(--vs-face); box-shadow: var(--raised); padding: .1em .7em; min-height: 0; font-size: 13px; }
body.seat .banner { background: var(--vs-tip); color: var(--vs-text); border-bottom: 1px solid var(--vs-dark); }
body.seat .cover { background: var(--vs-desktop); color: var(--vs-light); }
body.seat .cover a { color: var(--vs-light); }

/* -------------------------------------------------------- the taskbar */
.w95-taskbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; align-items: center; gap: 4px; height: 40px; padding: 4px 4px 3px;
  background: var(--vs-face); box-shadow: inset 0 1px var(--vs-hilite), inset 0 2px var(--vs-light);
  font-family: var(--vs-sans); font-size: 14px;
}
.w95-start { position: relative; flex: none; }
.w95-start > summary { list-style: none; font-weight: 700; padding: 0 .6rem; height: 32px; min-height: 0; }
.w95-start > summary::-webkit-details-marker { display: none; }
.w95-start[open] > summary { box-shadow: var(--sunken); }
.w95-start > summary img { width: 20px; height: 20px; }
.w95-menu {
  position: absolute; left: -2px; bottom: calc(100% + 4px); display: flex; min-width: 15rem;
  background: var(--vs-face); box-shadow: var(--frame); padding: 3px;
}
.w95-menu .w95-band {
  writing-mode: vertical-rl; transform: rotate(180deg); padding: .5rem .2rem;
  background: linear-gradient(var(--vs-title), var(--vs-shadow)); color: var(--vs-face);
  font-weight: 700; font-size: 1.2rem; letter-spacing: .05em;
}
.w95-menu ul { list-style: none; margin: 0; padding: 0; flex: 1; }
.w95-menu li { margin: 0; }
.w95-menu li.sep { height: 0; margin: 3px 2px; border-top: 1px solid var(--vs-shadow); border-bottom: 1px solid var(--vs-light); }
.w95-menu a { display: block; padding: .4rem .9rem; color: var(--vs-text); text-decoration: none; white-space: nowrap; }
.w95-menu a:hover, .w95-menu a:focus-visible { background: var(--vs-title); color: var(--vs-light); outline: 0; }
.w95-tasks { display: flex; gap: 4px; flex: 1; min-width: 0; overflow: hidden; }
.w95-tbtn { flex: 0 1 10rem; min-width: 0; height: 32px; min-height: 0; padding: 0 .6rem; font-size: 14px;
            justify-content: flex-start; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w95-tbtn[aria-current="page"] { box-shadow: var(--sunken); font-weight: 700;
  background: repeating-conic-gradient(var(--vs-face) 0 25%, var(--vs-light) 0 50%) 0 0 / 2px 2px; }
.w95-tray { flex: none; display: flex; align-items: center; gap: .5rem; height: 32px; padding: 0 .7rem;
            box-shadow: var(--well); font-variant-numeric: tabular-nums; white-space: nowrap; }

@media (max-width: 640px) {
  html body, body.page { padding: 0 0 52px; }
  .w95-win { max-width: none; }
  .w95-pane { padding: 1rem 1rem 1.2rem; }
  .w95-btns span:not(.w95-close), .w95-status span:not(:first-child) { display: none; }
  .w95-tbtn:not([aria-current="page"]) { display: none; }
  .tp-title { font-size: 1.9rem; }
  .w95-pane h2 { margin-left: -.3rem; margin-right: -.3rem; }
  table { font-size: .85rem; }
}
/* The phone forms of a manual table (manual.css draws them; build.py picks
   one): a table of prose is a column of cards on the client's white sheet,
   each column's name in the sheet's header lettering; a grid of numbers keeps
   its header buttons and scrolls inside its frame. */
@media (max-width: 600px) {
  table.stack { border: 0; background: none; }
  table.stack > tbody { border: 2px solid; border-color: var(--vs-shadow) var(--vs-light) var(--vs-light) var(--vs-shadow);
                        background: var(--vs-white); }
  table.stack > tbody > tr, table.stack > tbody > tr:first-child,
  table.stack > tbody > tr:last-child { padding: .5em .6em .45em; border: 0; border-top: 1px solid var(--vs-face); }
  table.stack > tbody > tr:first-child { border-top: 0; }
  table.stack > tbody > tr > td { border: 0; }
  table.stack tbody tr:hover td, table.grid tbody tr:hover td { background: none; }  /* a tap leaves hover on */
  table.stack td[data-label]:not(:first-child)::before {
    font-weight: 400; font-size: .72rem; text-transform: uppercase; letter-spacing: .02em; }
  table.grid > caption { background: var(--vs-white); padding: .2em .4em 0; margin: 0; }
  table.grid th:first-child { background: var(--vs-face); }
}
} /* @media screen */

@media print {
  .w95-title, .w95-status, .w95-taskbar { display: none !important; }
  .w95-win, .w95-pane { box-shadow: none; padding: 0; margin: 0; background: none; max-width: none; }
}

/* The download page's SHA-256 column: one plain block, not a chip per line. */
@media screen { td.sha code { background: none; border: 0; padding: 0; } }

/* The stamp ship.sh puts on the public pages (inline styles, so these must
   say !important): the "Last updated" strip as a tooltip-yellow line at the top
   of the pane. */
@media screen {
  #last-updated { font: 13px/1.4 var(--vs-sans) !important; background: var(--vs-tip) !important;
                  color: var(--vs-text) !important; border: 1px solid var(--vs-dark) !important;
                  margin: -.4rem 0 1rem !important; }
}

/* The site figures page (/stats/): headline tiles as raised panels, the
   section tabs as a property sheet's tabs, each chart in a sunken white well. */
@media screen {
  .tiles .tile { border: 0; background: var(--vs-face); box-shadow: var(--raised); padding: .6em .85em .7em; }
  .tiles .tile .big { color: var(--vs-title); font-family: var(--vs-sans); }
  .tiles .tile .more { color: var(--vs-muted); }
  .tabs { border-bottom: 2px solid var(--vs-light); box-shadow: 0 1px 0 var(--vs-shadow); margin-bottom: 1rem; }
  .tabs a { border: 0; background: var(--vs-face); color: var(--vs-text); padding: .3em .9em .25em;
            box-shadow: inset 1px 1px var(--vs-light), inset -1px 0 var(--vs-dark), inset -2px 0 var(--vs-shadow); }
  .tabs a:hover, .tabs a:focus-visible { background: var(--vs-title); color: var(--vs-light); outline: 0; }
  .chart { margin: .6em 0 .4em; }
  .chart svg { background: var(--vs-white); box-shadow: var(--sunken); padding: 4px; box-sizing: border-box; }
  .chart svg text { font-family: var(--vs-sans); }
  .chart svg rect.b { fill: var(--vs-title); }
  .chart svg g:hover rect.b { fill: var(--vs-link); }
  .chart svg g:hover rect:first-of-type { fill: rgba(0, 0, 128, .06); }
  .chart .cap { font-family: var(--vs-sans); }
  td.share { padding-right: .8em; }
  td.share span.bar { max-width: calc(100% - 2px); }
  details.days summary { color: var(--vs-link); text-decoration: underline; }
  .cols h2 { margin-top: 1.2rem; }
}
