Skip to content
Snippets Groups Projects
style.css 9.00 KiB
body {
  font-size: 2em;
}

header {
  margin-bottom: 1.5em;
}

main {
  font-size: 0.75em;
}

/* *****************************************************************************

  reset user agent styles
  see: https://andy-bell.co.uk/a-modern-css-reset

***************************************************************************** */

/* Box sizing rules */
*, *::before, *::after {
  box-sizing: border-box;
}

/* Remove default margin */
body, h1, h2, h3, h4,
p, figure, blockquote, dl, dd {
  margin-block-end: 0;
}

/* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */
ul[role='list'], ol[role='list'] {
  list-style: none;
}

/* Set core root defaults */
html:focus-within {
  scroll-behavior: smooth;
}

/* Set core body defaults */
body {
  /* disable because of my personal header */
  /* min-height: 100vh; */
  text-rendering: optimizeSpeed;
}

main {
  line-height: 1.5;
}

/* A elements that don't have a class get default styles */
a:not([class]) {
  text-decoration-skip-ink: auto;
}

/* Make images easier to work with */
img, picture {
  max-width: 100%;
  display: block;
}

/* Inherit fonts for inputs and buttons */
input, button, textarea, select {
  font: inherit;
}

/* Remove all animations, transitions and smooth scroll for people that prefer not to see them */
@media (prefers-reduced-motion: reduce) {
  html:focus-within {
   scroll-behavior: auto;
  }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* *****************************************************************************

  style dialog for error or busy messages

***************************************************************************** */

dialog {
  color: white;
}

dialog:focus {
  outline: none;
}

dialog::backdrop {
  background: rgba(85, 85, 85, 0.80);
}

.error-dialog {
  color: white;
  background-color: #AE0000;
}

.busy-dialog {
  color: white;
  background-color: #006900;
}

dialog p {
  margin-top: 0;
}

dialog.busy-dialog p {
  margin-bottom: 0;
}

dialog button {
  float: right;
}

dialog.busy-dialog button {
  display: none;
}

/* *****************************************************************************

  colors

***************************************************************************** */

button, input {
  color: white;
  background-color: #333;
}

select {
  color: black;
  background-color: white;
}

input[type="file"] {
  background-color: inherit;
}

input::file-selector-button {
  color: black;
}

input:disabled::file-selector-button {
  color: #AAAAAA;
}

button:disabled, input:disabled, textarea:disabled,
div.disabled, p.disabled, label.disabled,
#input.disabled, #output.disabled,
label:has(> input:disabled) {
  color: #AAAAAA;
  background-color: inherit;
}

/* *****************************************************************************

  borders and outlines

***************************************************************************** */

details[open] > #details {
  outline: 2px solid white;
  /* margin above needed this outline offset */
  outline-offset: calc(1.5vmin - 1px);
}

input[type=checkbox]:focus {
  /* reduce default offset as it seems a very big gap */
  outline-offset: 1px;
}

button, input, select {
  border: 2px solid white;
}

button, input {
  -webkit-border-radius: 5px;
  border-radius: 5px;
}

select {
  -webkit-border-radius: 3px;
  border-radius: 3px;
}

input[type="file"] {
  border: 0;
}

/* iOS */
input::file-selector-button {
  -webkit-border-radius: 3px;
  border-radius: 3px;
}

#input, #output {
  border: 1px solid white;
  outline: 1px solid white;
}

#input:focus {
  outline: 2px solid white;
}

button:disabled, input:disabled, textarea:disabled,
div.disabled, p.disabled, label.disabled,
#input.disabled, #output.disabled {
  border-color: #AAAAAA;
  outline-color: #AAAAAA;
}

/* *****************************************************************************

  specials

***************************************************************************** */

button, input, select,
details summary {
  cursor: pointer;
}

summary {
  /* just to avoid a big white border on focus */
  /* make it a bit wider as iOS otherwise would make a new line after the marker */
  width: 10ch;
}

p.label {
  font-size: 1.2em;
  display: inline;
  pointer-events: none;
}

button:disabled, input:disabled, textarea:disabled,
div.disabled, p.disabled, label.disabled,
#input.disabled, #output.disabled {
  pointer-events: none;
}

/* *****************************************************************************

  styles below are necessary for *not* styling the preview in the #output

***************************************************************************** */

/* this pre wraps the whole html #output if html is selected */
pre {
  text-wrap: pretty;
  word-break: break-word;
  margin: 0;
  font-family: inherit;
}

/* this is code in #output if preview is selected */
pre:has(code) {
  margin-block-start: 1em;
}

/* default is center and looks ugly */
th {
  text-align: left;
}

/* *****************************************************************************

  all margins and paddings to have them together

***************************************************************************** */

main .first-in-main {
  padding-top: calc(var(--default-top-padding) - 0.8em);
}

.two-column {
  padding-top: var(--default-top-padding);
}

details {
  padding-top: var(--default-top-padding);
}

details summary {
  padding-bottom: 0;
}

details[open] summary {
  margin-bottom: 2vmin;
  margin-left: 3px;
  padding-bottom: 1vmin;
}

#details {
  margin: 1.5vmin;
}

button, input[type=button] {
  padding: 5px 10px;
}

select {
  padding-right: 0px;
}

input[type=checkbox] {
  margin: 0;
  margin-right: 1vmin;
}

input[type="file"] {
  padding: 0;
}

#selects {
  padding-top: var(--default-top-padding);
}

#example {
  margin-top: var(--default-top-padding);
}

form.file {
  padding-top: calc(var(--default-top-padding) / 2);
}

div.download {
  /* + 5px to align with the button in the left segment */
  padding-top: calc(var(--default-top-padding) / 2 + 2px);
}

p.label {
  margin:0;
}

#input, #output {
  margin-top: var(--default-top-padding);
  /* replaces the margin-bottom of the body
  as these elements should go till the end */
  margin-bottom: var(--default-body-bottom-margin);
  padding: 0.5rem;
}

/* *****************************************************************************

  positioning of elements

***************************************************************************** */

.two-column {
  display: grid;
  /* columns with exactly the same size
  instead of "grid-template-columns: 1fr 1fr;" <-- buggy */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 3vmin;
  /* that is only working if #input and #output are among each other */
  row-gap: var(--default-top-padding);
}

#checkboxes, #selects {
  display: flex;
  column-gap: 3vmin;
  row-gap: 2vmin;
}

#selects > label {
  display: flex;
  column-gap: 1vmin;
}

/* used to set both buttons on the right side of both columns */
.flex-space-between {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

/* select shall fill the rest of the column right from label */
.left.label-w-select, .right.label-w-select {
  display: flex;
  justify-content: start;
  flex-direction: row;
  column-gap: 1vmin;
}

.label-w-select select {
  flex-grow: 1;
}

/* *****************************************************************************

  positioning of elements - special
  following styles keep track, that at least both last divs #input and #output
  side by side will always fill up to the end of the page

***************************************************************************** */

body {
  display: flex;
  flex-direction: column;
  /* disabled here because my personal default body seen on top */
  /* height: 100%; */
}

main {
  display: flex;
  flex-direction: column;
  height: 100%
}

.max-height {
  display: flex;
  flex-direction: column;
  height: 100%
}

.max-height > .two-column {
  flex-grow: 1;
  flex-basis: auto;
  height: 100%
}

.left, .right {
  display: flex;
  flex-direction: column;
  height: 100%;
}

#input {
  min-height: calc(100vh - 6vmin - 15.5em);
}

#input, #output {
  flex-grow: 1;
}


/* *****************************************************************************

  media queries here

***************************************************************************** */

/* from here two columns side by side are not working */
@media (max-width: 1170px) {
  .two-column {
    grid-template-columns: minmax(0, 1fr);
  }
  #input {
      height: calc(100vh - 6vmin - 25.5em);
  }
  div.download {
    /* padding is only needed if it must align to file input when side by side */
    padding-top: 0;
  }
}

@media (max-width: 710px) {
  #checkboxes > label, #selects > label {
    display: grid;
  }
}

/* iPhone 13 mini portrait */
@media (max-width: 490px) {
  .left.label-w-select, .right.label-w-select {
    flex-direction: column;
  }
}