:root {
  --beastie-red: #8c0707;
  --background-color: white;
  --body-text: black;
  --accent-text: white;
  --code-text: #461b7e;
  --link-color: #36f;
  --gsc-button: #cecece;
  --file-text: #007a00;
  --link-hover: #666666;
  --nomaintainer-text: blueviolet;
  --quote-border: #ddd;
  --version-hover-bg: #777;
  --version-hover-text: white;
  --input-background: white;
  --input-border: #767676;
  color-scheme: light dark;
}

/*
 * dark mode: every text colour here keeps a contrast ratio of at least 4.5:1
 * against --background-color (WCAG AA)
 */
@media (prefers-color-scheme: dark) {
  :root {
    --background-color: #151515;
    --body-text: #c9d9d9;
    --code-text: #dfc7ff;
    --link-color: #33cdff;
    --gsc-button: var(--background-color);
    --file-text: #5fd35f;
    --link-hover: #a0b4b4;
    --nomaintainer-text: #b48cff;
    --quote-border: #444;
    --version-hover-bg: #3a3a3a;
    --version-hover-text: var(--body-text);
    --input-background: #3b3b3b;
    --input-border: #858585;
  }

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

  a:visited {
    color: var(--code-text);
  }
}

* {
  box-sizing: border-box;
}

/* pride month */
.holiday.pride {
  background-image: linear-gradient(
    #cc66ff 0, #cc66ff 2em,
    #ff6699 2em, #ff6699 4em,
    #ff0000 4em, #ff0000 6em,
    #ff9900 6em, #ff9900 8em,
    #ffff00 8em, #ffff00 10em,
    #009900 10em, #009900 12em,
    #0099cc 12em, #0099cc 14em,
    #330099 14em, #330099 16em,
    #990099 16em, #990099 18em
  );
  background-attachment: fixed;
  background-color: white;
  background-color: var(--background-color);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 18em;
  height: 100%;
}

.holiday.pride body > table,
.holiday.pride body > header {
  background-color: white;
  background-color: var(--background-color);
}

body {
  background-color: white;
  background-color: var(--background-color);
  color: black;
  color: var(--body-text);
}

/*
body.dark-theme {
 --text-color: #eee;
}
*/

/*
 * font sizes are in rem (1rem = 16px at the browser default) so they all
 * follow the root font size: the browser's own setting, and later the
 * visitor's choice - see issue #690
 */
BODY, TD, TR, P, UL, OL, LI, INPUT, SELECT, DL, DD, DT, FONT
{
    font-size: 0.75rem;
}
@media only screen and (min-resolution: 140dpi) {
  BODY, TD, TR, P, UL, OL, LI, INPUT, SELECT, DL, DD, DT, FONT
  {
      font-size: 1rem;
  }
}

/*
 * the visitor's choice of text size does not apply to the site header lines
 * (git branch, Amazon, All times are UTC), announcements, the footer, or the
 * sponsors in the sidebar.  Dividing by
 * --fontsize-scale, set by include/fontsize.php, undoes it; the browser's own
 * text size still applies - see issue #702
 */
.site-header-main,
.announcements :is(TD, P, UL, OL, LI, DL, DD, DT, FONT),
.footer TD,
.sidebar-sponsors P
{
    font-size: calc(0.75rem / var(--fontsize-scale, 1));
}
@media only screen and (min-resolution: 140dpi) {
  .site-header-main,
  .announcements :is(TD, P, UL, OL, LI, DL, DD, DT, FONT),
  .footer TD,
  .sidebar-sponsors P
  {
      font-size: calc(1rem / var(--fontsize-scale, 1));
  }
}

table.maincontent > tbody > tr > td {
  padding: 8px;
}

.maincontent p {
  margin-block-end: 0;
}

td.content {
  width: 100%;
  vertical-align: top;
}

.sidebar {
  vertical-align: top;
  text-align: center;
}

.sidebar > table {
  width: 160px;
  text-align: left;
}

@media only screen and (min-resolution: 140dpi) {
  .sidebar > table {
    width: 230px;
  }
}

.sidebar > table:first-child td {
  white-space: nowrap;
}

.sidebar table tr > td:first-child {
    width: 100%;
}


.sidebar > table table td:nth-child(2) {
  text-align: right;
  white-space: nowrap;
}

.sidebar > table > tbody > tr > td,
.sidebar > table > tbody > tr > th {
  padding: 5px;
}

.sidebar th {
  text-align: left;
  font-weight: bolder;
}

.sidebar p {
  text-align: center;
}

.sidebar form {
  margin-bottom: 1em;
}

.accent {
  background-color: #8c0707;
  background-color: var(--beastie-red);
  color: white;
  color: var(--accent-text);
  font-size: larger;
  height: 30px;
}

.accent > span {
  font-size: larger;
}

/* the page title banner: an h1 which looks like the other banners */
.accent > h1 {
  font-size: larger;
  font-weight: inherit;
  margin: 0;
}

.icon {
  max-height: 22px;
  max-width: 22px;
  height: auto;
  vertical-align: bottom;
  margin: 2px;
}

/* a watch-list icon is the button of a small form - see freshports_Watch_Link() */
form.watch-icon {
  display: inline;
  margin: 0;
}

form.watch-icon button {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  cursor: pointer;
}

/* the Sigma before a port's watch list count, replacing sum.gif - see issue #598 */
.watchlist-count {
  font-weight: bold;
  text-decoration: none;
}

.commit-list th, .files-list th {
  text-align: left;
}

.commit-list td, .commit-list th,
.pkg-upload-info > tbody > tr > td, .pkg-upload-info > tbody > tr > th,
.pkg-upload-info table.bordered td, .pkg-upload-info table.bordered th,
.ports-moved td, .ports-moved th,
.ports-updating td, .ports-updating th,
.files-list td, .files-list th,
.search-options td, .search-options th,
.spam-info td, .spam-info th,
.watch-categories td, .watch-categories th,
.watch-maintenance table td, .watch-maintenance table th,
.textcontent table td, .textcontent table th {
  padding: 5px;
}

/* following nested under body for specificity */
body .gsc-control-cse, body .gsc-input-box {
  background-color: inherit;
}

body .gsc-control-cse input {
  background-color: inherit !important;
}

body .gsc-search-button-v2 {
  background-color: var(--gsc-button);
}


.watch-maintenance td {
  vertical-align: top;
}

.watch-maintenance input[type="submit"] {
  /* --button-width is set by watch-list-maintenance.php from the longest label */
  width: calc(var(--button-width, 8ch) + 2em);
  min-width: 85px;
  height: 24px;
}

.report-list td, .report-list th {
  padding: 3px;
}

.announce-notes {
  border-spacing: 4px;
}

.announce-notes td, .announce-notes th {
  padding: 4px;
}

.announce-notes th {
  font-weight: bold;
  text-align: right;
  vertical-align: top;
  white-space: nowrap;
}

.commit-list td:first-child, .commit-list th:first-child {
  width: 192px;
}

.files-list td:last-child {
  width: 100%;
}

.commit-details, .report-list td {
  vertical-align: top;
  white-space: nowrap;
}

.commit-details .meta {
  font-family: monospace;
}

.commit-details .element-list {
  list-style: none;
  padding-left: 0;
}

.hash {
  font-family: monospace;
}


.element-details {
/*  font-family: monospace;*/
  font-size: larger;
  font-weight: bold;
}

.element-details > span {
  font-size: larger;
}

table.maincontent td > *:first-child, .commit-list td > *:first-child {
  margin-block-start: 0;
}

table.maincontent td.textcontent {
  padding-bottom: 2em;
}

table.cellpadding0 td, table.cellpadding0 th {
  padding: 0px;
}

table.cellpadding3 td, table.cellpadding3 th {
  padding: 3px;
}

table.cellpadding4 td, table.cellpadding4 th {
  padding: 4px;
}

table.cellpadding5 td, table.cellpadding5 th {
  padding: 5px;
}

.category-list td {
  vertical-align: top;
}

.category-list td:last-child, .category-list th:last-child {
  white-space: nowrap;
}

.category-list th {
  text-align: left;
  font-weight: bold;
  vertical-align: top;
}

td.numeric-cell {
  text-align: right;
}

td.summary-cell {
  font-weight: bold;
}

.pagination {
  margin: 1em auto 0;
  text-align: center;
}

.graph-sidebar {
  vertical-align: top;
  width: 300px;
}

.graph-sidebar select {
  display: block;
  width: 300px;
  margin: auto;
}

.graphs #holder {
  width: 800px;
  height: 500px;
}

.graphs table {
  margin: auto;
}

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

.graphs label {
  cursor: pointer;
}

.graphs #title, .graphs #overview {
  text-align: center;
}

.graphs #overview {
  width: 400px;
  height: 100px;
  margin: auto;
}

td.captcha {
  text-align: center;
}

.captcha table {
  margin: auto;
}

.spam-info, .pkg-upload-info {
  margin-top: 1em;
}

.pkg-upload-info table.bordered {
  margin: auto;
}

.pkg-upload-controls {
  display: block;
  margin: auto;
  text-align: center;
}

.pkg-upload-controls > input, .pkg-upload-controls > select {
  vertical-align: middle;
}

.pkg-upload-info td {
  vertical-align: top;
}

table.maincontent table.watch-categories {
  margin: 2em auto;
}

.watch-categories td {
  vertical-align: top;
}

.watchlist-selector {
  float: right;
}

input[type="image"], .watchlist-selector select {
  vertical-align: middle;
}

/* watch-list.php: the notes beside the list box, or under it when there is no room */
.watch-list-choose {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1em 2em;
}

.watch-list-notes {
  flex: 1 1 15em;
}

.watch-list-notes ul {
  margin-top: 0.25em;
}

IMG#fp-logo { max-width: 100%; height: auto }

/* page header: logo, notices, and follow-us links - see issue #636 */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1em;
  margin-top: 1em;
}

/* a basis of 0 keeps the aside on the same row, at the top right - see issue #702 */
.site-header-main {
  flex: 1 1 0;
  min-width: 0;
  display: flow-root;
}

.site-header-aside {
  flex: 0 0 auto;
}

.site-header-aside.hcentered {
  align-self: flex-start;
}

/* only shown on narrow screens */
.menu-link, .menu-button {
  display: none;
}

/* the search box and the language picker share a row in the header, on every device - re #678 */
.header-tools {
  display: flex;
  flex-wrap: wrap;
  flex-basis: 100%;
  align-items: center;
  gap: 0.5em 1.5em;
  margin-bottom: 0.5em;
}

.header-search {
  display: flex;
  flex: 1 1 20em;
  align-items: center;
  gap: 0.5em;
}

/*
 * the language picker is shown only when a translation is installed; on narrow
 * screens the pickers wrap below the search box.  Whichever picker comes first
 * is pushed to the right.
 */
.language-picker, .fontsize-picker {
  display: flex;
  align-items: center;
  gap: 0.4em;
  margin-left: auto;
  white-space: nowrap;
}

.language-picker + .fontsize-picker {
  margin-left: 0;
}

/* with JavaScript, picking an option submits the form, so the Change button is
   not needed; the js class is set in <head>, so the button never flashes up */
.js .language-picker input[type="submit"],
.js .fontsize-picker input[type="submit"] {
  display: none;
}

.header-search input[type="search"] {
  flex: 0 1 25em;
  min-width: 0;
  padding: 0.3em;
  /* without this, Safari draws its own borderless rounded search field, which
     in dark mode looks nothing like the box other browsers show */
  -webkit-appearance: none;
  appearance: none;
  border: 1px solid #767676;
  border: 1px solid var(--input-border);
  border-radius: 2px;
  background-color: white;
  background-color: var(--input-background);
  color: black;
  color: var(--body-text);
}

.header-search input[type="submit"] {
  padding: 0.3em 0.8em;
}

CODE.code, kbd.code {
  color: #461b7e;
  color: var(--code-text);
}

PRE.code {
  color: #461b7e;
  color: var(--code-text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* UPDATING entries can contain very long lines, e.g. stack traces - see issue #674 */
.ports-updating pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.port {
  font-family: monospace;
}

PRE.commit,
dd.port-description {
/*  color: black;*/
/*  color: var(--code-text); */
  font-family: monospace;
  white-space: pre-wrap;
  word-break: break-all;
  margin-top: 15px;
  margin-bottom: 15px;
  margin-left: 25px;
}

dd.www-description {
  white-space: pre-wrap;
  word-break: break-all;
  margin-left: 25px;
}

a.man,
.uses,
.options,
.config,
.distinfo,
.pkg-message {
/*  color: black; */
/*  color: var(--code-text);*/
  font-family: monospace;
  white-space: pre-wrap;
  word-break: break-all;
  margin-top: 15px;
  margin-bottom: 15px;
  margin-left: 25px;
}

a.man {
  margin-left: 0px;
}

ul.man,
dd.man {
  margin-inline-start: 0px;
}


.conflicts,
.pkgname,
.only_for_archs {
/*  color: black; */
/*  color: var(--code-text);*/
  font-family: monospace;
  white-space: pre-wrap;
  word-break: break-all;
}

.configure > li, .pkg-plist  > li {
/*    color: #461b7e;
    color: var(--code-text);*/
    font-family: monospace;
}


LI.configure {
    color: #461b7e;
    color: var(--code-text);
    display: block;
    font-family: monospace;
}

li#configureplist-Extra {
    color: #461b7e;
    color: var(--code-text);
    font-family: monospace;
    padding-inline-start: 0px;
}
blockquote.code {
  color: #461b7e;
  color: var(--code-text);
}
TD.sans { font-size: smaller; }
P.white {
  color: white;
  color: var(--background-color);
}
P.blackhead {
  color: black;
  color: var(--body-text);
  font-weight: 900;
}
P.whitehead {
  color: white;
  color: var(--background-color);
  font-weight: 900;
}
P.yellow { color: #FFCC33; }
A:hover {
  color: #666666;
  color: var(--link-hover);
}
A.white { color: white; text-decoration: none; font-size: smaller; }
A.black { color: black; text-decoration: none; font-size: smaller; }
A.red   { color: red; text-decoration: none; }
A.white:hover { text-decoration: underline; }

div.section {
	padding          : 0.25em;
	background-color : #FFCC33;
	border           : 2px outset #333;
	font-size        : 120%;
	font-weight      : bold;
	text-align       : left;
}

div.section .left {
	float : left;
}

blockquote {
	margin: 15px 30px 15px 10px;
	padding-left: 20px;
	border-left: 5px solid #ddd;
	border-left: 5px solid var(--quote-border);
}

div#time
{
    font-size: smaller
}

div#followus
{
    float: right;
    font-size: 0.9375rem;
}

div#followus .header
{
    font-size: 2.3125rem;
}


dt.required, p.required, dt.description, dt.www
{
    font-weight: bold;
}

pre.description {
/*    overflow-x: scroll; */
    /* in ch, not px, so a larger text size widens the box and keeps 72-column commit lines whole */
    max-width: 80ch;
/*    white-space: nowrap;*/
    /* wrap long lines, e.g. URLs, instead of overflowing - see issue #674 */
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

html {
    overflow: -moz-scrollbars-vertical; 
    overflow-y: scroll;
}

dt.description
{
  margin-top: 5px;
  margin-bottom: 15px;
  font-weight: bold;
}

/*
dt.www-description
{
  margin-top: 0px;
  margin-bottom: 0px;
  font-weight: bold;
}
*/

dd.required
{
  margin-top: 5px;
  margin-inline-start: 30px;
}

dt.pkg-plist, dd.pkg-plist, dt.pkgname, dt.flavors
{
  margin-top: 10px;
  margin-bottom: 10px;
  margin-inline-start: 0px;
}

dt.notice
{
  margin-top: 10px;
  margin-bottom: 10px;
  margin-inline-start: 0px;
  font-size: 0.9375rem;
}

dt.h2
{
  margin-top: 10px;
  margin-bottom: 10px;
  font-size: 1.5625rem;
}

dt.h3
{
  margin-top: 10px;
  margin-bottom: 10px;
  font-size: 1.125rem;
}

ol.required, ol.depends, ol.mastersites
{
    margin-bottom: 10px;
    padding-inline-start: 0px;
}

div.showLink
{
    margin-bottom: 20px;
}

div.header-notes
{
  float:     right;
  margin-left: 1em;
}

/* em, not rem: sized from .site-header-main, so the chosen text size does not apply - see issue #702 */
span.amazon, span.timezone
{
  display:   block;
  font-size: 1em;
}

/* the bug, under All times are UTC - see issue #702 */
span.header-badges
{
  display:   block;
}

span.logo
{
  float:     left;
}

/* not floated: it takes the width left between the logo and div.header-notes,
   wrapping a long branch name if need be - see issue #702 */
span.branch
{
  display:   flow-root;
  font-size: 0.85em;
  overflow-wrap: anywhere;
}

span.fp_description_short
{
  font-size:   1rem;
}

span.file {
    color: #007a00;
    color: var(--file-text);
    font-family: monospace;
}

/* monospace looks larger than the text around it - see issue #702 */
span.branch span.file {
    font-size: 0.85em;
}

a.hash {
    font-family: monospace;
}

a.showLink, a.hideLink {
    text-decoration: none;
    color: #36f;
    color: var(--link-color);
    padding-left: 16px;
    background: transparent url(/images/expand.gif) no-repeat left;
}

a.hideLink {
    background: transparent url(/images/contract.gif) no-repeat left;
}

a.showLink:hover, a.hideLink:hover {
    border-bottom: 1px dotted #36f;
    border-bottom: 1px dotted var(--link-color);
}

/*
  visible links to the anchors on a page, e.g. #packages on a port page - see issue #675
  faint text colour until the pointer is over the heading, or the link has keyboard focus
*/
a.anchor-link {
  font-family: monospace;
  font-weight: normal;
  text-decoration: none;
  opacity: 0.35;
}

a.anchor-link:link, a.anchor-link:visited {
  color: black;
  color: var(--body-text);
}

:hover > a.anchor-link, a.anchor-link:focus {
  opacity: 1;
}

a.anchor-link:hover, a.anchor-link:focus {
  text-decoration: underline;
}

.accent a.anchor-link:link, .accent a.anchor-link:visited {
  color: white;
  color: var(--accent-text);
}

li.nostyle {
    list-style-type: none;
}

li.extraspace {
    margin-top: 10px;
}

.packages { 
  background-color:#eee;
  background-color: var(--background-color);
  border-collapse:collapse; 
  display: inline-block;
}

.packages caption { font-size: 1rem; }
.packages th {
  background-color:#000;
  background-color: var(--body-text);
  color: white;
  color: var(--background-color);
}
.packages td, .packages th {
  padding:8px;
  border:1px solid #000;
  border:1px solid var(--body-text);
}

.footer > tbody > tr > td > table {
  width: 98%;
  margin: 0 auto;
}

.footer small {
  display: block;
}

.footer .sponsors {
  text-align: left;
}

.footer .copyright {
  text-align: right;
}

/* equal widths either side keep the IPv6 badge in the middle - see issue #702 */
.footer .sponsors, .footer .copyright {
  width: 50%;
}

.footer .ipv6-badge {
  text-align: center;
  vertical-align: middle;
}

/* for horizontal scrolling of package tables - re https://www.w3schools.com/howto/howto_css_menu_horizontal_scroll.asp#contact */

div.scrollmenu table {
  display: inline-block;
}

a > img {
  border: 0;
}

table.fullwidth, td.fullwidth {
  width: 100%;
}

/* a bulleted list whose second column lines up - e.g. the 404 port suggestions */
ul.aligned {
  display: table;
  padding-left: 1em;
}

ul.aligned > li {
  display: table-row;
}

ul.aligned > li::before {
  content: "\2022";
  display: table-cell;
  padding-right: 0.5em;
}

ul.aligned > li > span {
  display: table-cell;
  padding: 2px 1em 2px 0;
}

table.borderless {
  border: 0 none black;
  border: 0 none var(--body-text);
}

table.bordered {
  border: 1px outset black;
  border: 1px outset var(--body-text);
  border-spacing: 0;
}

table.bordered > tbody > tr > td, table.bordered > tbody > tr > th {
  border: 1px inset black;
  border: 1px inset var(--body-text);
}

td.version:hover, td.version:focus {
  background-color: #777;
  background-color: var(--version-hover-bg);
  color: white;
  color: var(--version-hover-text);
  position: relative;
}

td.version:hover::after, td.version:focus::after {
  content: attr(data-title);
  position: absolute;
  width: auto;
  padding: .5em;
  border: 1px solid black;
  border: 1px solid var(--body-text);
  font-family: monospace;
  text-align: left;
  white-space: pre;
  background-color: white;
  background-color: var(--background-color);
  color: black;
  color: var(--body-text);
}

.packages .version.noversion, .footer, .maintenance, .fp-banner {
  text-align: center;
}

table.packages {
  vertical-align: top;
}


/*
  from https://www.w3schools.com/css/css_tooltip.asp
  Initially planned for Quarterly branch information: https://github.com/FreshPorts/freshports/issues/115
*/
.tooltip {
  position: relative;
  display: inline-block;
  border-bottom: 1px dotted black;
  border-bottom: 1px dotted var(--body-text);
}

.tooltip .tooltiptext {
  visibility: hidden;
  width: 120px;
  background-color: black;
  background-color: var(--body-text);
  color: #fff;
  color: var(--background-color);
  text-align: center;
  border-radius: 6px;
  padding: 5px 0;

  /* Position the tooltip */
  position: absolute;
  z-index: 1;
  top: -5px;
  left: 105%;
}

.tooltip:hover .tooltiptext {
  visibility: visible;
}

.commit-branch {
    border-radius: 6px;
    padding: 0 6px;
    background-color: darkred;
    border-style: none;
    color: white;
}


.nomaintainer {
  color: blueviolet;
  color: var(--nomaintainer-text);
  font-size: 1.25rem;
}

.hcentered { text-align: center; }

.hleft { text-align: left; }

.hright { text-align: right; }

.red { color: red; }

.vtop { vertical-align: top; }

.vcentered { vertical-align: middle; }

.vbottom { vertical-align: bottom; }

.nowrap { white-space: nowrap; }

.cmd {
  color: #007a00;
  color: var(--file-text);
  font-family: monospace;
}


/*
  Narrow screens (phones, tablets) - see issue #636

  Pages are laid out with tables: the content and the sidebar are two cells
  of table.layout. Here those cells are stacked, the sidebar boxes are put
  into a grid below the content, and wide tables scroll within their cell
  instead of widening the whole page.

  The side-by-side layout needs about 1110px (content ~870px, sidebar
  ~230px), so anything narrower than that gets the stacked layout.  That
  includes iPads in portrait (810-834px) and the iPad mini in landscape.
*/
@media only screen and (max-width: 1120px) {
  .site-header {
    gap: 0.5em;
    margin-top: 0.5em;
  }

  .site-header-main {
    flex-basis: 100%;
  }

  /* leave room beside the logo for the Menu button pinned to the top-right corner */
  IMG#fp-logo {
    max-width: calc(100% - 110px);
  }

  span.logo, div.header-notes, div#followus {
    float: none;
  }

  div.header-notes {
    margin-left: 0;
  }

  span.logo, span.branch, span.amazon, span.timezone {
    display: block;
  }

  span.amazon {
    font-size: inherit;
    margin: 0.5em 0;
  }

  div#followus .header {
    font-size: 1.25rem;
  }

  .menu-link {
    display: block;
    flex-basis: 100%;
    padding: 0.5em;
    text-align: center;
    font-weight: bold;
    text-decoration: none;
    background-color: #8c0707;
    background-color: var(--beastie-red);
  }

  /* pinned top-right; with the drawer, it sits above it and becomes the Close button */
  .menu-button {
    display: block;
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 40;
    padding: 0.6em 0.9em;
    border-radius: 6px;
    font-weight: bold;
    text-decoration: none;
    background-color: #8c0707;
    background-color: var(--beastie-red);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  }

  .menu-link:link, .menu-link:visited,
  .menu-button:link, .menu-button:visited {
    color: white;
    color: var(--accent-text);
  }

  /* fill the width, and 16px or more stops iOS zooming in on focus,
     so these never go below 16px even when the root font size is smaller */
  .header-search input[type="search"] {
    flex: 1;
    padding: 0.4em;
    font-size: max(16px, 1rem);
  }

  .header-search input[type="submit"] {
    padding: 0.4em 0.8em;
    font-size: max(16px, 1rem);
  }

  .language-picker select, .fontsize-picker select {
    font-size: max(16px, 1rem);
  }

  /* let the header shrink to the screen, so large text does not push it off
     the side; the search box gets narrower instead */
  .header-tools, .header-search {
    min-width: 0;
  }

  /* the pickers wrap onto lines of their own, so line them up on the left */
  .language-picker, .fontsize-picker {
    margin-left: 0;
  }

  table.layout,
  table.layout > tbody,
  table.layout > tbody > tr,
  table.layout > tbody > tr > td,
  table.maincontent,
  table.maincontent > tbody,
  table.maincontent > tbody > tr,
  table.maincontent > tbody > tr > td {
    display: block;
    width: 100%;
  }

  td.content {
    overflow-wrap: break-word;
  }

  table.maincontent > tbody > tr > td {
    padding: 4px;
    overflow-x: auto;
  }

  /* long banner text wraps on narrow screens, so it cannot have a fixed height */
  .accent {
    height: auto;
    min-height: 30px;
  }

  table.layout > tbody > tr > td.sidebar {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 1em;
    align-items: start;
    margin-top: 1em;
    text-align: left;
  }

  .sidebar > table,
  .sidebar > table:first-child td {
    width: 100%;
    white-space: normal;
  }

  .sidebar > br {
    display: none;
  }

  .sidebar input[type="text"] {
    width: 70%;
  }

  /* one commit per block, instead of three side-by-side columns */
  .commit-list,
  .commit-list > tbody,
  .commit-list > tbody > tr,
  .commit-list > tbody > tr > td {
    display: block;
    width: auto;
  }

  .commit-list td:first-child {
    width: auto;
  }

  .commit-list > tbody > tr:has(> th) {
    display: none;
  }

  .commit-list > tbody > tr {
    border-bottom: 1px solid black;
    border-bottom: 1px solid var(--body-text);
  }

  table.bordered.commit-list > tbody > tr > td {
    border: 0 none;
  }

  .commit-details {
    white-space: normal;
  }

  pre.description {
    max-width: none;
  }

  div.scrollmenu {
    overflow-x: auto;
  }

  .graph-sidebar, .graph-sidebar select, .graphs #holder, .graphs #overview {
    width: auto;
    max-width: 100%;
  }

  .footer table,
  .footer tbody,
  .footer tr,
  .footer td {
    display: block;
    width: 100%;
  }

  .footer .sponsors, .footer .copyright {
    text-align: center;
    padding: 0.25em 0;
  }
}

/*
  Narrow screens, with JavaScript: the sidebar flies in from the right as an
  overlay, instead of sitting below the page content - see issue #636

  freshports.js adds has-drawer to <html> when it can run the drawer, and
  toggles drawer-open.  Without JavaScript, the stacked layout above is used.
*/
@media only screen and (max-width: 1120px) {
  html.has-drawer table.layout > tbody > tr > td.sidebar {
    display: block;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    width: 260px;
    max-width: 85vw;
    margin: 0;
    padding: 60px 8px 8px 8px; /* clear of the Menu / Close button */
    box-sizing: border-box;
    overflow-y: auto;
    overscroll-behavior: contain;
    background-color: white;
    background-color: var(--background-color);
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.4);
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.25s ease, visibility 0.25s;
  }

  html.drawer-open table.layout > tbody > tr > td.sidebar {
    transform: none;
    visibility: visible;
  }

  html.has-drawer .sidebar > table {
    margin-bottom: 1em;
  }

  .drawer-backdrop {
    display: none;
  }

  html.drawer-open .drawer-backdrop {
    display: block;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    background-color: rgba(0, 0, 0, 0.25);
  }

  /* the pinned button does the job; the header link is only for no JavaScript */
  html.has-drawer .menu-link {
    display: none;
  }
}

/* the backdrop is only used on narrow screens */
@media only screen and (min-width: 1121px) {
  .drawer-backdrop {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html.has-drawer table.layout > tbody > tr > td.sidebar {
    transition: none;
  }
}
