* { box-sizing: border-box; }

html {
  font-family: sans-serif;
  font-size: 16px;
  line-height: 1.4;
  margin: 0;
  padding: 0;
}

body {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1rem;
  display: grid;
  grid-template-areas:
    "header header"
    "aside main"
    "footer footer";
  grid-template-columns: 250px auto;
  grid-template-rows: auto 1fr auto;
  gap: 1rem 2rem;
}

header {
  grid-area: header;
  position: relative;
  overflow: hidden;
  font-family: monospace;

  h1 {
    font-size: 1.2rem;
    position: relative;
    z-index: 2;
    text-transform: uppercase;
    padding: 11px 0;
    margin: 0 0 0 1rem;
    text-align: center;
  }

  span {
    position: absolute;
    white-space: nowrap;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    text-transform: uppercase;
    font-size: 75px;
    letter-spacing: 5px;
    opacity: 0.05;
    font-weight: 700;
  }
}

aside {
  grid-area: aside;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 1rem;
}

footer {
  grid-area: footer;
}

main {
  grid-area: main;
  padding-top: 2rem;
}

form label,
form .label {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin: 0.5rem 0 1rem;
}

.estimated-sag {
  color: #f07909;
  font-weight: 700;
  align-items: center;

  span {
    font-size: 1.2rem;
    font-family: monospace;
  }
}

fieldset {
  width: 100%;
  margin: 0 0 1.5rem;
  padding: 0;
  border: none;
}

fieldset > div:first-child {
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

fieldset > div:first-child hr {
  all: unset;
  border-top: 1px solid #d0d0d0;
  margin: 0;
  flex-grow: 1;
}

legend {
  font-weight: 700;
  font-size: 1.1rem;
  padding: 0;
  margin: 0;
}

input,
select {
  appearance: none;
  font-size: 1rem;
  background-color: white;
  border: 1px solid #d5d5d5;
  border-top-color: rgb(213, 213, 213);
  border-bottom-color: rgb(213, 213, 213);
  border-top-color: #00000017;
  border-bottom-color: #00000036;
  border-radius: 0.35em;
  font-size: 1rem;
  padding: 0.25em 0.65em;
  line-height: 1;
  box-shadow: 0 0.05em 0.15em #0000001a, 0 0.15em 0.9em #00000005;
}

input { max-width: 6em; }
select { line-height: 1.15; }

.search {
  position: relative;
  flex-grow: 1;
  max-width: 250px;
}

#search-results {
  position: absolute;
  z-index: 1;
  background: white;
  width: 100%;
  top: 2.3rem;
  border-radius: 0.6rem;
  box-shadow: 0 0.05em 0.15em #0000001a, 0 0.15em 0.9em #00000005;
  padding: 0.4rem 0;
}

#search-results > div {
  padding: 0.3rem 0.5rem;
}

#search-results > div[data-bike]:hover,
#search-results > div[data-bike]:focus {
  background: #efefef;
  cursor: pointer;
}

#search-results > div[data-bike] p {
  font-weight: 700;
  margin: 0;
}

#search-results > div[data-bike] small span {
  display: inline-block;
}


#search-results > div[data-bike] .meta {
  margin-right: 1em;
}

#search-results > div[data-bike] .metakey {
  text-transform: capitalize;
  margin-right: 0.3em;
  opacity: 0.7;
}

#search-results > div.empty,
#search-results > div.prompt {
  text-align: center;
}

#search-results > div.prompt {
  font-style: italic;
  opacity: 0.5;
}

#search-results > div.empty a {
  display: block;
  font-size: 0.8em;
}

#search-results > div.info {
  text-align: center;
  opacity: 0.5;
  font-size: 0.8em;
  margin-top: 0.7em;
}


input[type="search"] {
  max-width: none;
  width: 100%;
  padding: 0.25em 0.75em;
  border-radius: 20px;
}

input[type="search"]:not(:focus) {
  background: #efefef;
  box-shadow: none;
  border-color: #efefef;
}

button {
  appearance: none;
  font-size: 1.5rem;
  font-weight: 700;
  font-style: italic;
  font-family: monospace;
  display: block;
  padding: 0.5em 1em;
  border: none;
  border-radius: 0.5em;
  color: #f07909;
  background: white;
  box-shadow: 0 2px 0 5px #f07909;
  position: relative;
  top: 0;
  transition: 0.15s all;
  cursor: pointer;
  margin-top: 1.5rem;
}

button:active {
  top: 2px;
  box-shadow: 0 0px 0 5px #f07909;
}

.curve-container {
  padding-bottom: 30px;
  position: relative;
  margin: 1rem 0;
}

.curve-container > span {
  position: absolute;
  pointer-events: none;
}

.curve-container { padding-left: 40px; }

.curve-container > span:not(.x-axis) {
  text-align: right;
  display: inline-block;
  width: 30px;
}

#upper-leverage,
#base-leverage,
#lower-leverage {
  line-height: 1;
  font-family: monospace;
  font-size: 0.9em;
  transform: translateY(-50%);
  left: 0;
}

#upper-leverage { top: 0; }
#base-leverage { top: calc(50% - 15px); }
#lower-leverage { bottom: 15px; }

.x-axis {
  transform: translateX(-50%);
  bottom: 0;
  left: calc(50% + 20px);
  font-size: 0.7em;
  opacity: 0.5;
  text-transform: uppercase;
  font-weight: bold;
}

.curve-heading {
  margin-top: 1em;
  margin-bottom: 1.5em;
  display: flex;
  justify-content: space-between;
}

.curve-heading h2 {
  font-size: 1rem;
  font-weight: 400;
  margin: 0;
}

#curve {
  border: 1px solid #eaeaea;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: inset 1px 1px 2px 1px white,
              inset -1px -1px 2px 1px #0000000f;
  cursor: row-resize;
}

.disclaimer {
  margin-top: 2rem;
  text-align: justify;
  display: block;
  color: #777;
  line-height: 1.5;
}

@media (max-width: 800px) {
  body {
    grid-template-areas:
      "header"
      "aside"
      "main"
      "footer";
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    gap: 1rem 0;
  }

  aside {
    margin-top: 0;
  }
}

