/* or.munir.sh. The same plain monospace page as munir.sh, plus form controls
   and a video. Follows the system light/dark setting. */

@font-face {
  font-family: "JetBrains Mono";
  font-weight: 100 800;
  font-display: swap;
  src: url("/fonts/jetbrains-mono-var.woff2") format("woff2");
}

:root {
  --sh-bg: #060607;
  --sh-fg: #f3ede6;
  --sh-link: #35c2c2;
  --sh-line: #211d23;
  --sh-dim: #8d8790;
  --sh-bad: #ff8a80;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --sh-bg: #f5f5f4;
    --sh-fg: #2f2f2f;
    --sh-link: #137a7b;
    --sh-line: #e2e2e0;
    --sh-dim: #77777a;
    --sh-bad: #b3261e;
    color-scheme: light;
  }
}

* {
  box-sizing: border-box;
}
body,
h2,
p,
pre,
ul,
table,
fieldset {
  margin: 0;
  padding: 0;
}
ul {
  list-style: none;
}
body {
  background: var(--sh-bg);
}

.sh {
  display: grid;
  grid-template-areas:
    "main"
    "side"
    "foot";
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--sh-bg);
  color: var(--sh-fg);
  font-family: "JetBrains Mono", ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
  font-variant-ligatures: none;
  font-size: 1rem;
  line-height: 1.65;
}

a {
  color: var(--sh-link);
  text-decoration: none;
}
a:hover {
  text-decoration: underline dotted;
}
:focus-visible {
  outline: 1px solid var(--sh-link);
  outline-offset: 3px;
}

/* ---- main column -------------------------------------------------- */

.sh-main {
  grid-area: main;
  padding: 1.5rem 0.75rem 1rem;
  min-width: 0;
}
.sh-main > p,
.sh-main > table,
.sh-main > form {
  max-width: 80ch;
  margin-bottom: 2em;
}
.sh-banner {
  margin-bottom: 2.2em;
  font-family: inherit;
  line-height: 1.2;
  overflow-x: auto;
}
.sh-banner a {
  color: inherit;
  text-decoration: none;
}
.sh-banner small {
  display: block;
  margin-left: 6em;
  font-size: 0.8em;
  font-style: italic;
}
.sh-main h2 {
  margin-bottom: 0.6rem;
  font-size: 1.3rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.sh-main h2::before {
  content: "$ ";
  color: var(--sh-dim);
}
table {
  border-collapse: collapse;
}
td {
  padding: 0;
  text-align: left;
  vertical-align: top;
}
.sh-list td:first-child {
  padding-right: 3ch;
}
.sh-list td:last-child {
  white-space: nowrap;
  color: var(--sh-dim);
}
.sh-error {
  color: var(--sh-bad);
}

.sh-block {
  max-width: 80ch;
  margin-bottom: 1em;
  padding: 0.5em 0 0.5em 2ch;
  border-left: 4px solid var(--sh-line);
}
.sh-block > strong {
  display: block;
  margin: 0.45rem 0;
}
.sh-block table {
  margin: 0.6em 0;
}
.sh-block td:first-child {
  padding-right: 2ch;
  white-space: nowrap;
}

/* ---- form --------------------------------------------------------- */

.sh-form td {
  padding-bottom: 0.6em;
}
.sh-form td:first-child {
  width: 18ch;
  padding-right: 1ch;
  white-space: nowrap;
}
.sh-form em {
  display: block;
  color: var(--sh-dim);
  font-size: 0.85em;
}
.sh-form input,
.sh-form button {
  font: inherit;
  color: inherit;
}
.sh-form input[type="number"] {
  width: 7ch;
  padding: 0.1em 0.5ch;
  border: 1px solid var(--sh-dim);
  border-radius: 0.4em;
  background: var(--sh-line);
}
.sh-form input[type="file"] {
  max-width: 100%;
}
.sh-form input[type="file"]::file-selector-button,
.sh-form button {
  margin-right: 1ch;
  padding: 0.2em 1.5ch;
  border: 1px solid var(--sh-fg);
  border-radius: 0.6em;
  background: var(--sh-line);
  color: var(--sh-fg);
  font: inherit;
  cursor: pointer;
}
.sh-form input[type="file"]::file-selector-button:hover,
.sh-form button:hover {
  background: var(--sh-fg);
  color: var(--sh-bg);
}
.sh-form button:disabled {
  opacity: 0.5;
  cursor: default;
}
.sh-form input[type="checkbox"],
.sh-form input[type="radio"] {
  accent-color: var(--sh-link);
  margin-right: 1ch;
}
.sh-choice {
  display: inline-block;
  min-width: 26ch;
  margin-right: 2ch;
  cursor: pointer;
}
.sh-form details {
  margin: 0.4em 0 1.2em;
}
.sh-form summary {
  cursor: pointer;
  color: var(--sh-link);
}
.sh-form summary:hover {
  text-decoration: underline dotted;
}
.sh-form fieldset {
  margin: 0.8em 0 1em;
  padding: 0.5em 0 0.5em 2ch;
  border: 0;
  border-left: 4px solid var(--sh-line);
}
.sh-form legend {
  padding: 0;
  color: var(--sh-dim);
}

/* ---- progress and the list of renders ------------------------------ */

.sh-progress {
  margin-bottom: 0.4em;
  font-family: inherit;
  color: var(--sh-link);
  overflow-x: auto;
}
.sh-renders {
  display: grid;
  gap: 0.9em;
  max-width: 100ch;
  margin-bottom: 2em;
}
.sh-renders li {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 2ch;
  align-items: center;
}
.sh-renders em {
  display: block;
  color: var(--sh-dim);
}
.sh-thumb {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--sh-line);
  background: #000;
  color: var(--sh-link);
  overflow: hidden;
}
.sh-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---- video -------------------------------------------------------- */

.sh-video {
  display: block;
  width: 100%;
  max-width: 100ch;
  aspect-ratio: 16 / 9;
  margin-bottom: 0.8em;
  background: #000;
  border: 1px solid var(--sh-line);
}

/* ---- sidebar and footer ------------------------------------------- */

.sh-side {
  grid-area: side;
  padding: 0.5rem 0.75rem;
}
.sh-side ul {
  margin: 0.6em 0;
}
.sh-foot {
  grid-area: foot;
  padding: 0.5em;
  border-top: 4px solid var(--sh-line);
  background: var(--sh-bg);
  text-align: center;
}
@media (min-height: 30em) {
  .sh-foot {
    position: sticky;
    bottom: 0;
  }
}

@media (min-width: 70ch) {
  .sh-main,
  .sh-side {
    padding-left: 4.5em;
  }
}
@media (min-width: 120ch) {
  .sh {
    grid-template-columns: 1fr 34ch;
    grid-template-rows: 1fr auto;
    grid-template-areas:
      "main side"
      "foot foot";
  }
  .sh-side {
    padding: 0.5rem 0.5rem 0 0;
  }
}
@media (max-width: 60ch) {
  .sh-form td,
  .sh-list td {
    display: block;
    width: auto;
  }
  .sh-form td:first-child {
    width: auto;
    padding-bottom: 0;
  }
  .sh-list tr {
    display: block;
    margin-bottom: 0.7em;
  }
  .sh-choice {
    display: block;
    min-width: 0;
  }
  .sh-renders li {
    grid-template-columns: 112px 1fr;
    gap: 1.5ch;
  }
}
