:root {
  --font-family: system-monospace, ui-monospace, monospace;
  --font-size: 1rem;
  --page-max-width: 50rem;

  --fg-color: #132333;
  --bg-color: #fefdfc;
  --body-background: #fefdfc;
  --offset-bg-color: #e7e6e5;
  --err-color: #c00;

  --fill-color: #0c0;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fg-color: #fefdfc;
    --bg-color: #2e2e2e;;
    --body-background: linear-gradient(135deg, #1e1e1e, #2c2c2c);
    --offset-bg-color: #393939;
  }
}

/* flex base layout */
body {
  display: flex;
  flex-direction: column;
  padding: 0 1rem;
}
main {
  flex: 1 0 auto;
}
footer {
  flex-shrink: 0;
}

/* margins */
html, body {
  margin: 0;
  height: 100dvh;
}
header, main, footer {
  max-width: var(--page-max-width, 50rem);
  width: 100%;
  margin: auto;
  padding: 0;
}
main {
  margin-top: 1.5rem;
}
footer {
  padding: 1rem 0;
}

main > * {
  margin-top: 0;
}

/* nice default margin between elements (owl) */
* + * { margin-top: 1.5rem; }
/* fixes missing gap, pages with p has it by default... */
main > div { margin-top: 1.5rem; }

/* narrow the top margin between a label and its input */
label + * {
  margin-top: .5rem;
}

/* setup font-family, size and base colors */
body {
  color: var(--fg-color);
  background: var(--body-background);
  font-family: var(--font-family);
}
input, select, textarea, button {
  font-family: var(--font-family);
}

body, input, button { font-size: var(--font-size); }
h1 { font-size: calc(var(--font-size) + .7rem); }
h2 { font-size: calc(var(--font-size) + .3rem); }
h3 { font-size: calc(var(--font-size) + .1rem); }

a {
  color: var(--fg-color);
}
a:hover {
  font-weight: bold;
  transition: all 0.1s ease-in-out;
}

/* special nav styles */
nav a {
  text-decoration: none;
  text-transform: uppercase;
}
nav h3 {
  display: inline;
  margin-right: 2rem;
}

/* form elements */
form, input, select, textarea, button, label {
  display: block;
  box-sizing: border-box;
}
input, select, textarea, button { 
  background: var(--bg-color);
  color: var(--fg-color);
  border: 0.1rem solid var(--offset-bg-color);
  border-radius: 0.25rem;
  &:active, &:focus {
    box-shadow: 0 0 0 0.1rem var(--offset-bg-color);
    outline: none;
  }
}
input[type="radio"], input[type="checkbox"] {
  display: inline;
  width: auto;
}

/* make text inputs full width */
input,
textarea {
  padding: .5rem;
  width: 100%;
}

/* reset input button width */
input[type="submit"] { width: auto; }

/* weird but ok... */
input[type="submit"], button { cursor: pointer; }
button { padding: .5rem; }

input:invalid {
  border: 0.1rem solid var(--err-color);
}


/* table basics */
table {
  width: 100%;
  border-spacing: 0;
}
tr { margin: 0; }
tr:nth-child(even) {
  background: var(--offset-bg-color);
}
td,th { padding: 1rem; }
th {
  text-align: left;
  border-bottom: 0.1rem solid var(--fg-color);
}

/* util classes */
.inline { display: inline; }
.num { text-align: right; }
.no-owl { margin-top: 0 !important; }
.flex {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.flex > * {
  margin-top: 0 !important; /* override owl margin */
}
a[href].active {
  font-weight: bold;
}
.message {
  padding: 1rem;
  background: .1rem solid var(--fg-color);
  font-weight: bold;
}
.error {
  color: var(--err-color);
}

/* custom */

label {
  flex: 1;
  text-align: center;
  div {
    background: linear-gradient(0deg, var(--fill-color) 90%, var(--bg-color) 90%);
    background-size: 200%;
    background-position: bottom;
  }
  p {
    background: white;
    margin-bottom: 0;
    padding-bottom:1rem;
  }
}

input[type="range"] {
  appearance: none;
  border: none;
  outline: none;
  margin:0;
  background: transparent;
  height: 20rem;

  /* chrome and safari fix */
  writing-mode: vertical-lr;
  direction: rtl;

}
input[type="range"]:active {
  outline: none;
  appearance: none;
  border: none;
}
input[type="range"]::-webkit-slider-thumb {

  /* ios fix */
 width: 165px;
 height: 100px;
 -webkit-appearance: none;
 appearance: none;
 cursor: pointer;
 background: transparent;
 box-shadow: 0 0 0;
}

input[type="range"]::-moz-range-thumb {
  appearance: none;
  visibility: hidden;
}
