body {
  margin: 0;

  --hue: 210;
  --on-primary: hsl(var(--hue), 0%, 100%);
  --primary: hsl(var(--hue), 40%, 31%);
  --primary-light: #86a8cb;
  --surface: #fafafa;
  --surface-border: #fff;
  --on-surface: hsl(var(--hue), 19%, 26%);

  --secondary-surface: hsl(0, 0%, 99.5%);
  --secondary-surface-border: hsl(0, 0%, 93%);
  --link: hsl(var(--hue), 100%, 40%);

  --editable: #fff;
  --editable-border: #ddd;
  --on-editable: #333;

  --monospace-font-family: 'Berkeley Mono', 'JetBrains Mono', 'IBM Plex Mono',
    'Source Code Pro', Menlo, Monaco, 'Courier New', monospace;
  --system: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI',
    'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans',
    'Helvetica Neue', sans-serif;

  background: var(--surface);
  color: var(--on-surface);
  font-family: var(--system);
}

html {
  fill: currentColor;
  height: 100%;
  width: 100%;
}

h2 {
  font-size: 1em;
  font-weight: 600;
  line-height: 0.7;
  padding: 0;
  margin: 0;
  color: #666;
  border: none;
}
h3 {
  font-weight: 600;
  line-height: 0.7;
  margin-top: 3em;
  margin-bottom: 2em;
}

h4 {
  margin-top: 2em;
  margin-bottom: 1.5em;
}

h3 strong,
h4 strong {
  color: var(--primary);
}

h4 {
  font-weight: 400;
}

/* h2, h3 {
    background: linear-gradient(#eee, #333);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
} */

code {
  font-family: var(--monospace-font-family);
}

button.toggle {
  appearance: none;
  border: none;
  background: none;
  border-radius: 4px;
  width: 36px;
  height: 36px;
  color: #777;
}
button.toggle:hover,
button.toggle:active {
  background: #dadada;
  color: #000;
}
button.toggle.is-on {
  color: #fff;
  background: var(--primary);
}
button.toggle svg {
  width: 24px;
  height: 24px;
}

main {
  padding-top: 3rem;
  width: 640px;
  max-width: 100vw;
  display: flex;
  align-items: flex-start;
  flex-flow: column wrap;
  margin: auto;
}
main > div {
  width: 100%;
}

main > div.frame {
  margin-top: 2em;
  padding-left: 1em;
  padding-right: 1em;
  width: calc(100% - 2em);
  margin-bottom: 4em;
  background: var(--secondary-surface);
  border: 1px solid var(--secondary-surface-border);
  border-radius: 8px;
}

kbd {
  font-family: var(--monospace-font-family);
  background: #f4f4f4;
  color: #333;
  padding: 1px 5px;
  border-radius: 5px;
}

.links {
  display: flex;
  justify-content: space-around;
  padding-top: 1em;
  padding-bottom: 2em;
  width: 100%;
  font-size: 24px;
}
@media (max-width: 512px) {
  .links {
    font-size: 16px;
  }
}

.output {
  font-family: var(--monospace-font-family);
  color: #f0c674;

  background: #35434e;

  padding: 5px;
  margin: 10px 0 10px 0;
  border-radius: 5px;
  border: 1px solid #333;

  min-height: 1em;
  padding-top: 0.5em;
  padding-bottom: 0.5em;

  word-break: break-word;
  white-space: pre-wrap;
}

math-field,
.mathfield {
  border: 1px solid var(--editable-border);
  padding: 5px;
  margin: 10px 0 10px 0;
  border-radius: 5px;
  background: var(--editable);
  color: var(--on-editable);
}

.fa-w-24 {
  width: 24px;
  vertical-align: -5px;
}

a,
a:visited,
a:active {
  text-decoration: none;
  color: var(--link);
  border-radius: 1em;
  border: 1px solid transparent;
}

.links a {
  padding-left: 1em;
  padding-right: 1em;
  padding-top: 5px;
  padding-bottom: 5px;
}
.links a:visited:hover,
.links a:hover {
  border: 1px solid var(--secondary-surface-border);
  background: var(--surface);
}

a:hover {
  text-decoration: underline;
}
.links a:hover {
  text-decoration: none;
}

body > header {
  background-color: var(--primary);
  height: 130px;
  display: flex;
  justify-content: center;
  align-items: center;

  /* box-shadow: 16px 6px 24px rgba(0, 0, 0, 0.2); */
}

header h1 {
  /* font-size: 3rem; */
  color: var(--on-primary);
  /* text-transform: uppercase; */
  margin-left: auto;
  margin-right: auto;
  max-width: 1024px;
  letter-spacing: -0.04ex;
  text-rendering: optimizeLegibility;
  line-height: 0.9;
  width: 640px;
  text-align: left;
  font-weight: 700;
  letter-spacing: 0.004em;
  margin: auto;
}

footer {
  margin-top: 5em;
  margin-bottom: 5em;
  text-align: center;

  display: flex;
  justify-content: center;
  flex-flow: column wrap;
}

footer a,
footer a:visited,
footer a:active {
  font-size: 18px;
  padding-top: 6px;
  padding-bottom: 6px;
}

.segmented-control {
  display: flex;
  width: 100%;
  margin: 0 auto;
  font-size: 1rem;
  font-family: var(--system);
  font-weight: 600;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #eee;
  padding: 4px;
}

.segmented-control > input {
  display: none;
}
.segmented-control > input:checked + label {
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
}

.segmented-control label {
  flex: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  user-select: none;
  border-radius: 8px;

  padding: 8px 0;
  transition: all 250ms cubic-bezier(0, 0.95, 0.38, 0.98);

  width: calc(100% / var(--segments));
  margin-left: 2px;
}
.segmented-control label:first {
  margin-left: 0;
}
.segmented-control label:hover {
  background: #dadada;
}
.timing {
  font-family: var(--monospace-font-family);
  align-self: flex-end;
}

.output {
  width: 100%;
}

.output-section.is-visible {
  display: flex;
  flex-flow: column;
}

.output-section {
  display: none;
  margin-bottom: 1em;
}
.output-section.is-visible .toggled-element {
  display: none;
}
.output-section.is-visible .toggled-element.is-visible {
  display: inherit;
}

.static.mathjson {
  padding-left: 10px;
  font-family: var(--monospace-font-family);
}

@media only screen and (max-width: 512px) {
  header {
    height: 100px;
  }

  header h1 {
    max-width: 320px;
    width: auto;
    font-size: 2rem;
  }

  .examples {
    width: 320px;
  }
}

@media (prefers-color-scheme: dark) {
  body {
    --surface: hsl(var(--hue), 19%, 26%);
    --surface-border: hsl(0, 0%, 20%);
    --on-surface: hsl(0, 0%, 98%);
    --primary: hsl(var(--hue), 100%, 55%);

    --secondary-surface: hsl(0, 0%, 19%, 0.3);
    --secondary-surface-border: hsl(0, 0%, 22%);
    --link: hsl(var(--hue), 100%, 63%);

    --editable: #333;
    --editable-border: hsl(0, 0%, 13%);
    --on-editable: #fff;
  }
  h2,
  h3 {
    color: hsl(var(--hue), 20%, 90%);
  }
}
