/* mansplain man page stylesheet */

:root {
  --bg: #fff;
  --text: #131211;
  --heading: #030201;
  --code: #434241;
  --em: #232221;
  --link: #0000ff;
  --muted: #999;
  --border: #dbdbdb;
  --pre-bg: #f5f5f5;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a1a;
    --text: #d4d4d4;
    --heading: #e5e5e5;
    --code: #b0b0b0;
    --em: #c0c0c0;
    --link: #6cacff;
    --muted: #777;
    --border: #333;
    --pre-bg: #222;
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.42857;
  color: var(--text);
  background: var(--bg);
  max-width: 130ex;
  padding: 0 4ex 1ex 4ex;
  margin: 0 auto;
  text-align: justify;
}

/* Navigation */
nav {
  padding: 10px 0;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

nav a {
  color: var(--muted);
  text-decoration: none;
  margin-right: 2em;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 12px;
}

nav a:hover {
  color: var(--link);
}

nav a.current {
  color: var(--text);
}

/* Header and footer */
table.head, table.foot {
  width: 100%;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 13px;
}

table.head {
  margin-bottom: 10px;
}

table.foot {
  margin-top: 20px;
}

td.head-vol, td.foot-os {
  text-align: center;
}

td.head-rtitle, td.foot-date {
  text-align: right;
}

/* Sections */
section.Sh {
  margin-bottom: 0;
}

h1.Sh {
  color: var(--heading);
  font-size: 20px;
  line-height: 2;
  font-weight: bold;
  clear: left;
  margin-top: 10px;
}

h1.Sh a.permalink {
  color: inherit;
  text-decoration: none;
}

h2.Ss {
  color: var(--heading);
  font-size: 16px;
  line-height: 1.25;
  font-weight: bold;
  clear: left;
  margin: 0 0 0 4ex;
}

/* Body text indentation — indent everything except headings and subsections */
.manual-text section.Sh > *:not(h1):not(h2):not(section) {
  margin-left: 8ex;
}

.manual-text section.Ss > *:not(h2) {
  margin-left: 8ex;
}

/* Paragraphs */
p.Pp {
  margin: 0 0 20px 0;
}

/* Semantic elements — keep it plain */
code.Nm, code.Fl, code.Cm, code.Li,
span.Pa, code.Pa, code.Ev, span.Ev {
  font-family: inherit;
  font-size: inherit;
}

code.Nm {
  font-weight: bold;
  color: var(--text);
}

code.Fl {
  font-weight: bold;
  color: var(--text);
}

var.Ar, span.Va {
  font-style: italic;
  color: var(--em);
}

span.Nd {
  color: var(--text);
}

b, strong {
  font-weight: bold;
  color: var(--text);
}

em, i {
  font-style: italic;
  color: var(--em);
}

/* Links */
a, a:link, a:visited {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

b.man-ref {
  font-weight: normal;
  color: var(--code);
}

/* Tagged lists */
dl.Bl-tag {
  margin: 0 0 20px 0;
}

dl.Bl-tag dt {
  margin: 0;
  clear: left;
}

dl.Bl-tag dt.flush {
  float: left;
  width: 8ex;
}

dl.Bl-tag dd {
  margin: 0 0 0 9ex;
}

/* Code blocks */
pre {
  font-family: inherit;
  font-size: inherit;
  color: var(--code);
  padding: 0 4ex;
  margin: 0 0 20px 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-x: auto;
}

div.Bd-indent {
  margin: 0 0 20px 0;
  padding: 0 4ex;
  position: relative;
}

div.Bd-indent .copy-btn {
  position: absolute;
  top: 0;
  right: 0;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  padding: 2px 6px;
  opacity: 0;
  transition: opacity 0.15s;
}

div.Bd-indent:hover .copy-btn {
  opacity: 1;
}

div.Bd-indent .copy-btn:hover {
  color: var(--text);
}

div.Bd-indent pre {
  padding: 0;
  margin: 0;
}

/* Synopsis */
table.Nm {
  margin: 0 0 0 0;
}

table.Nm td {
  vertical-align: top;
}

/* Display block */
.Dl {
  margin-left: 8ex;
}
