:root {
  --accent-color: #1976D2;
  --accent-color-fixed: var(--accent-color);

  --window-background: #fff;
  --elevated-color: var(--window-background);
  --text-color: rgb(0 0 0 / 87%);
  --text-color-secondary: rgb(0 0 0 / 60%);
  --hover-color: rgb(0 0 0 / 10%);

  --white-overlay: rgb(255 255 255 / 20%);
  --white-overlay-light: rgb(255 255 255 / 10%);

  --max-width: 1080px;
  --border-radius: 8px;

  --card-shadow: 0 4px 6px 0 rgb(0 0 0 / 10%);

  --transition-duration: .25s;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  -webkit-text-size-adjust: none;
  -moz-text-size-adjust: none;
  -ms-text-size-adjust: none;
}

html, body {
  height: 100%;
  width: 100%;
  margin: 0;
  font: 14px sans-serif;
  line-height: 1.8;
  letter-spacing: .1px;
  background: var(--window-background);
  color: var(--text-color);
  scroll-behavior: smooth;
}

h2, h3, h4, h5, h6 {
  font-weight: normal;
  text-wrap: balance;
}

.p, p, ul, ol, label, figcaption {
  color: var(--text-color-secondary);
  text-transform: none;
  letter-spacing: .1px;
}

a {
  color: var(--accent-color);
  text-decoration-line: none;
  text-decoration-color: var(--accent-color);
  text-underline-offset: 4px;
}

a:hover,
a:focus {
  text-decoration-line: underline;
}

header {
  display: flex;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  height: 54px;
  width: 100%;
  background: var(--elevated-color);
  box-shadow: 0 0 12px rgb(0 0 0 / 20%);
  border-bottom: 1px solid var(--hover-color);
  z-index: 50;
}

header > * {
  min-width: 0;
}

header h1 {
  padding: 1em 0;
  font-weight: normal;
  font-size: 14px;
  letter-spacing: 3px;
  line-height: 1;
  text-transform: uppercase;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  flex: 1;
}

header a,
header a:hover,
header a:focus,
header a:active {
  color: inherit;
}

.link-back {
  display: block;
  width: 46px;
  height: 46px;
  margin: 4px;
  border-radius: var(--border-radius);
  flex-shrink: 0;
  background: center/18px transparent url("../images/back.svg") no-repeat;
}

.link-back:hover,
.link-back:focus {
  background-color: var(--hover-color);
}

main {
  box-sizing: border-box;
  max-width: var(--max-width);
  width: 100%;
  flex: 1;
  padding: 70px 16px 16px;
  margin: 0 auto;
}

input:not([type="checkbox"]),
textarea,
button,
a,
.btn {
  transition-duration: var(--transition-duration);
}

input:not([type="checkbox"]), textarea, button, .btn {
  box-sizing: border-box;
  display: inline-block;
  background: var(--elevated-color);
  color: var(--text-color);
  padding: 10px 18px;
  font-family: arial, sans-serif;
  font-size: 14px;
  box-shadow: var(--card-shadow);
  border-radius: var(--border-radius);
  border: 1px solid var(--hover-color);
  outline: none;
}

textarea {
  display: block;
  width: 100%;
  min-height: 256px;
  overflow-y: auto;
  resize: none;
  field-sizing: content;
}

input:not([type="checkbox"]):focus-visible {
  border: 1px solid var(--accent-color);
}

button,
.btn {
  cursor: pointer;
  background: var(--accent-color-fixed);
  color: #fff;
  line-height: 1.25;
  vertical-align: middle;
  border: 1px solid var(--accent-color-fixed);
  font-weight: bold;
  font-size: 12px;
}

button:not(:disabled):hover,
button:not(:disabled):focus,
.btn:not(:disabled):hover,
.btn:not(:disabled):focus {
  text-decoration: none;
  box-shadow: inset 100vw 100vh var(--white-overlay-light), var(--card-shadow);
}

button:not(:disabled):active,
.btn:not(:disabled):active {
  box-shadow: inset 100vw 100vh var(--white-overlay), var(--card-shadow);
}

input[type="file"] {
  display: none;
}

input[type="color"] {
  -webkit-appearance: none;
  height: 38px;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"]::-webkit-color-swatch {
  border: none;
}

input[type="range"] {
  -webkit-appearance: none;
  height: 4px;
  padding: 0;
  background: rgb(0 0 0 / 30%);
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--accent-color);
}

input[type="range"]::-moz-range-thumb {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--accent-color);
}

.button-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.w-100 {
  width: 100%;
}

.checkbox {
  display: flex;
  margin: 16px 0;
  gap: 8px;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.checkbox label {
  display: block;
}

#img-container {
  display: block;
  overflow: hidden;
  border: 1px solid var(--hover-color);
  border-radius: var(--border-radius);
  box-shadow: var(--card-shadow);
}

img {
  display: block;
  max-width: 100%;
}

@media only screen and (min-width: 768px) {
  main {
    display: grid;
    grid-template-columns: repeat(2, 2fr);
    gap: 32px;
  }

  .grid-v-span {
    grid-row: span 2;
  }

  section:first-child, section:nth-child(5) {
    margin: 2rem 0 0;
  }

  section:first-child {
    order: 0;
  }

  section:nth-child(2) {
    order: 3;
  }

  section:nth-child(3) {
    order: 2;
  }

  section:nth-child(4) {
    order: 4;
  }

  section:nth-child(5) {
    order: 1;
  }

  section:nth-child(6) {
    order: 5;
  }

  section:nth-child(7) {
    order: 6;
  }

  section:nth-child(8) {
    order: 7;
  }

  section:nth-child(9) {
    order: 8;
  }
}
