<|start_filename|>homotopy-web/static/styles.css<|end_filename|>
:root {
  --sidebar-background: #0A0E14;
  --sidebar-foreground: #FAFAFA;
  --sidebar-width: 48px;
  --sidebar-icon-size: 1px;
  --sidebar-hover: #4D5566;

  --tooltip-background: var(--sidebar-background);
  --tooltip-foreground: var(--sidebar-foreground);

  --drawer-width: 250px;
  --drawer-background: #f9f9f9;
  --drawer-background-dimmed: #f1f1f1;
  --drawer-foreground: #575f66;
  --drawer-border: #e1e1e1;
  --drawer-selected: #d1e4f4;

  --button-border: #e1e1e1;
  --button-background: #f0f0f0;

  --toolbar-background: #ffffff;
  --toolbar-foreground: #575f66;
  --toolbar-border: #8A919966;
  --toolbar-hover: #d1e4f4;

  --space-0: 4px;
  --space-1: calc(2 * var(--space-0));
  --space-2: calc(2 * var(--space-1));

  --generator-color-border: #8A919966;

  --signature-height: 32px;
}

body, html {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  font-family: 'IBM Plex Sans', 'sans';
  display: flex;
  flex: 1;
  font-size: 14px;
  overflow: hidden;
}

input, button {
  font-family: 'IBM Plex Sans', 'sans';
  color: var(--draw-foreground);
  font-size: 14px;
}

*:focus {
  outline: none;
}

.app {
  display: flex;
  flex: 1;
  position: relative;
}

button, .button {
  padding: var(--space-0);
  border: 1px solid var(--button-border);
  border-radius: 1px;
  background: var(--button-background);
  cursor: pointer;
}

/* Sidebar */

.sidebar {
  background: var(--sidebar-background);
  border: var(--sidebar-border) 1px solid;
  color: var(--sidebar-foreground);
  display: flex;
  flex-direction: column;
  z-index: 1001;
}

.sidebar__logo {
  width: var(--sidebar-width);
  padding: var(--space-1);
  box-sizing: border-box;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
}

.sidebar__tools {
  flex: 1;
  justify-content: flex-end;
  display: flex;
  flex-direction: column;
}

.sidebar__button {
  font-size: var(--sidebar-icon-size);
  user-select: none;
  cursor: pointer;
  padding: var(--space-1);
  text-align: center;
}


@media (pointer: fine) {
  .sidebar__button:hover {
    background: var(--sidebar-hover);
  }
}

/* Panzoom */

.panzoom {
  touch-action: none;
  width: 100%;
  height: 100%;
}

.panzoom__inner {
  position: absolute;
  z-index: 0;
  left: 50%;
  top: 50%;
  transform-origin: 50% 50%;
}

/* Workspace */

.workspace {
  flex: 1;
  display: flex;
  align-items: stretch;
  position: relative;
  overflow: hidden;
}

.workspace__toolbar {
  position: fixed;
  display: flex;
  z-index: 10;
  right: 0;
  margin: var(--space-0);
}

.workspace__toolbar__segment,
.workspace__slice-buttons {
  background: var(--toolbar-background);
  border: 1px solid var(--toolbar-border);
  color: var(--toolbar-foreground);
  border-radius: var(--space-0);
  align-items: stretch;
  display: flex;
}

.workspace__path-segment {
  width: 24px;
  justify-content: center;
  align-items: center;
}

.workspace__toolbar__button {
  padding: var(--space-1);
  align-items: center;
  display: flex;
  cursor: pointer;
  user-select: none;
}

@media (pointer: fine) {
  .workspace__toolbar__button:hover,
  .workspace__slice-button:hover {
    background: var(--toolbar-hover);
  }
}

.workspace__slice-buttons {
  position: absolute;
  right: 0;
  top: 50%;
  box-sizing: border-box;
  z-index: 5;
  user-select: none;
  transform-origin: 0px 50%;
  flex-direction: column;
}

.workspace__slice-button {
  user-select: none;
  display: flex;
  box-sizing: border-box;
  flex-direction: column;
  justify-content: center;
  cursor: pointer;
  flex: 1;
}

/* Tooltips */

.tooltip {
  position: relative;
}

.tooltip::after {
  background: var(--tooltip-background);
  border-radius: 10px;
  color: var(--tooltip-foreground);
  display: none;
  padding: 10px 15px;
  position: absolute;
  text-align: center;
  z-index: 1001;
  content: attr(data-tooltip);
  font-size: 12px;
  white-space: nowrap;
  top: 50%;
}

.tooltip--right::after {
  right: 0;
  transform: translate(calc(100% + 10px), -50%);
}

.tooltip--left::after {
  left: 0;
  transform: translate(calc(-100% - 10px), -50%);
}

.tooltip::before {
  background: var(--tooltip-background);
  content: ' ';
  display: none;
  position: absolute;
  width: 15px;
  height: 15px;
  z-index: 1001;
  top: 50%;
}

.tooltip--right::before {
  right: 0;
  transform: translate(calc(100% + 5px), -50%) rotate(45deg);
}

.tooltip--left::before {
  left: 0;
  transform: translate(calc(-100% - 5px), -50%) rotate(45deg);
}

@media (pointer: fine) {
  .tooltip:hover::after {
    display: block;
  }

  .tooltip:hover::before {
    display: block;
  }
}

/* Drawer */

.drawer {
  width: var(--drawer-width);
  border-right: 1px solid var(--drawer-border);
  background: var(--drawer-background);
  color: var(--drawer-foreground);
  display: flex;
  flex-direction: column;
  touch-action: none;
  z-index: 1000;
}

.drawer__header {
  height: var(--sidebar-width);
  min-height: var(--sidebar-width);

  padding: var(--space-0);
  border-bottom: 1px solid var(--drawer-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
}

.drawer__title {
  font-size: 1.2em;
  padding: var(--space-0);
}

.drawer__content {
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--drawer-border) var(--drawer-background);
  touch-action: pan-y;
  width: 100%;
  height: 100%;
  padding: var(--space-1);
  box-sizing: border-box;
}

.drawer__close {
  cursor: pointer;
}

/* Signature */

.signature__item {
  border-radius: var(--space-0);
  box-sizing: border-box;
  display: flex;
  user-select: none;
  cursor: pointer;
  height: var(--signature-height);
  overflow: hidden;
  flex-direction: column;
  transition: height 100ms;
}

.signature__item.signature__item-coloring {
  height: 120px;
}

.signature__item-info {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  width: 100%;
  height: var(--signature-height);
}

.signature__branch {
  width: 100%;
  list-style-type: none;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

.signature__branch .signature__branch {
  border-left: solid 2px var(--toolbar-border);
  margin-top: var(--space-0);
  padding-left: var(--space-1);
}

.signature__dropzone {
  height: var(--space-1);
  width: 100%;
  cursor: pointer;
  transition: height 100ms;
}

.signature__branch-empty .signature__dropzone {
  height: var(--signature-height);
  color: var(--drawer-border);
  content: "(Empty)";
}

.signature__branch-empty .signature__dropzone::after {
  content: "(Empty)";
  display: flex;
  align-items: center;
  margin-left: var(--space-0);
  height: 100%;
}

.signature__dropzone.drag-over {
  height: var(--signature-height);
}

.signature__item-child {
  padding: var(--space-0);
  display: flex;
  align-items: center;
  transition: background-color 100ms;
}

.signature__item-name, .signature__item-fill {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  height: 100%;
  box-sizing: border-box;
}

.signature__item-name {
  padding-left: 0;
  padding-right: 0;
  border-left: var(--space-1) solid transparent;
  border-right: var(--space-1) solid transparent;
}

.signature__item-name-input {
  padding: var(--space-1);
  border: none;
  background: transparent;
  user-select: text;
}

.signature__generator-color {
  color: var(--drawer-background);
}

.signature__generator-picker {
  width: 100%;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-1);
  gap: var(--space-0);
  box-sizing: border-box;
}

.signature__generator-picker-preset {
  flex: 1 1 21%;
  height: 24px;
  border-radius: var(--space-0);
}

.signature__generator-picker-custom {
  flex: 1 1 100%;
  width: 100%;
  height: 24px;
  border-radius: var(--space-0);
  overflow: hidden;
  cursor: pointer;
  outline: none;
}

@media (pointer: fine) {
  .signature__item-child:hover {
    background: var(--drawer-selected);
  }
}

/* Diagram SVG */

.diagram-svg__attach-highlight {
  stroke-width: 1px;
  stroke-dasharray: 4;
  stroke: black;
  fill: #ffff0033;
}

.diagram-svg__slice-highlight {
  fill: #ffffff33;
}

svg {
  display: block;
}

/* Attachment Options */

.attach__options {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.attach__option {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  cursor: pointer;
}

.attach__option-name {
  padding: var(--space-1);
  flex: 1;
  display: flex;
  align-items: center;
}

.attach__option-color {
  padding-left: var(--space-1);
}

@media (pointer: fine) {
  .attach__option:hover {
    background: var(--drawer-selected);
  }
}

/* Settings */

.settings__segment {
  border-bottom: 1px solid var(--drawer-border);
  padding: var(--space-1) 0;
  box-sizing: border-box;
}

.settings__segment h4 {
  margin: 0;
  margin-bottom: var(--space-1);
}

.settings__toggle-setting {
  display: flex;
  align-items: left;
}

.settings__toggle-setting input {
  margin-right: var(--space-1);
  cursor: pointer;
}

.settings__slider-setting {
  padding: var(--space-0) var(--space-1);
}

.settings__slider-setting input {
  width: 100%;
  cursor: pointer;
}

.version {
  position: absolute;
  bottom: 4px;
  right: 4px;
  color: red;
  pointer-events: none;
}

/* Toaster */
.toaster {
  position: absolute;
  bottom: 0;
  right: 0;
  padding: var(--space-2);
  width: 300px;
}

.toaster__toast {
  position: relative;
  width: 300px;
  min-height: 30px;
  z-index: 1002;
  margin: var(--space-1);
}

.toaster__toast__inner {
  position: relative;
  display: block;
  width: 100%;
  animation: toast__inner 2500ms ease-in-out 0s 1 forwards;
  padding: var(--space-1);
  box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2);
  box-sizing: border-box;
}

.toaster__toast--error .toaster__toast__inner {
  background: #c0392b;
  color: white;
}

.toaster__toast--success .toaster__toast__inner {
  background: #27ae60;
}

@keyframes toast__inner {
  0% { opacity: 0; }
  20% { opacity: 1; }
  80% {
    opacity: 1;
    left: 0;
  }
  100% {
    opacity: 0;
    left: calc(300px + var(--space-2));
  }
}

/* Spinner */

.loader,
.loader:before,
.loader:after {
  border-radius: 50%;
  width: 2.5em;
  height: 2.5em;
  -webkit-animation-fill-mode: both;
  animation-fill-mode: both;
  -webkit-animation: load7 1.8s infinite ease-in-out;
  animation: load7 1.8s infinite ease-in-out;
}
.loader {
  color: #ffffff;
  font-size: 10px;
  margin: 80px auto;
  position: relative;
  text-indent: -9999em;
  -webkit-transform: translateZ(0);
  -ms-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-animation-delay: -0.16s;
  animation-delay: -0.16s;
}
.loader:before,
.loader:after {
  content: '';
  position: absolute;
  top: 0;
}
.loader:before {
  left: -3.5em;
  -webkit-animation-delay: -0.32s;
  animation-delay: -0.32s;
}
.loader:after {
  left: 3.5em;
}
@-webkit-keyframes load7 {
  0%,
  80%,
  100% {
    box-shadow: 0 2.5em 0 -1.3em;
  }
  40% {
    box-shadow: 0 2.5em 0 0;
  }
}
@keyframes load7 {
  0%,
  80%,
  100% {
    box-shadow: 0 2.5em 0 -1.3em;
  }
  40% {
    box-shadow: 0 2.5em 0 0;
  }
}

/* About */

/* The modal's background */
.modal {
  display: none;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.4);
}

/* Display the modal when targeted */
.modal:target {
  display: table;
  position: absolute;
}

/* The modal box */
.modal-dialog {
  display: table-cell;
  vertical-align: middle;
}

/* The modal's content */
.modal-dialog .modal-content {
  margin: auto;
  background-color: #f3f3f3;
  border: 1px #777 solid;
  width: 80%;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}

.modal-content > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--sidebar-foreground);
  background-color: var(--sidebar-background);
}

.modal-close {
  text-decoration: none;
  color: var(--sidebar-foreground);
}

.modal-close:hover,.modal-close:focus {
  background: var(--sidebar-hover);
  cursor: pointer;
}

/* https://developer.mozilla.org/en-US/docs/Web/API/File/Using_files_from_web_applications#using_a_label_element_to_trigger_a_hidden_file_input_element */

.visually-hidden {
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
}

/* Separate rule for compatibility, :focus-within is required on modern Firefox and Chrome */
input.visually-hidden:focus + label {
  outline: thin dotted;
}
input.visually-hidden:focus-within + label {
  outline: thin dotted;
}

input[type="text"] { width:100%; }

input[type="color"] {
	-webkit-appearance: none;
	border: none;
  padding: 0;
}

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

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


<|start_filename|>homotopy-graphics/glsl/wireframe_frag.glsl<|end_filename|>
#version 300 es

precision highp float;

in vec3 frag_diffuse;

out vec4 frag_color;

void main() {
  frag_color = vec4(frag_diffuse, 1.);
}


<|start_filename|>homotopy-graphics/glsl/vert_4d.glsl<|end_filename|>
#version 300 es

precision highp float;

in vec4 position_start;
in vec4 position_end;

in vec4 normal_start;
in vec4 normal_end;

uniform float t;

out float hidden;
out vec3 frag_pos;
out vec3 frag_normal;

uniform mat4 mvp;

void main() {
  float lerp = (t - position_start.w) / (position_end.w - position_start.w);

  if (lerp < 0. || lerp > 1.) {
    hidden = 1.;
    gl_Position = vec4(0., 0., 0., 1.);
    return;
  }

  frag_pos = position_start.xyz + lerp * (position_end.xyz - position_start.xyz);
  frag_normal = normal_start.xyz + lerp * (normal_end.xyz - normal_start.xyz);
  gl_Position = mvp * vec4(frag_pos, 1.);
}


<|start_filename|>homotopy-graphics/glsl/wireframe_vert.glsl<|end_filename|>
#version 300 es

precision highp float;

in vec3 position;
in vec3 color;

out vec3 frag_diffuse;

uniform mat4 mvp;

void main() {
  frag_diffuse = color;
  gl_Position = mvp * vec4(position, 1.);
}


<|start_filename|>homotopy-graphics/glsl/frag.glsl<|end_filename|>
#version 300 es

precision highp float;

uniform bool debug_normals;
uniform vec3 camera_pos;
uniform vec3 d;

in float hidden;
in vec3 frag_pos;
in vec3 frag_normal;

out vec4 frag_color;

const float a = 0.3;
const vec3 s = vec3(1., 1., 1.);

const vec3 light_offset = vec3(-.75, .25, -.5);

const float alpha = 64.;
const float gamma = 2.2;

void main() {
  if (hidden != 0.) {
    discard;
  }

  vec3 normal = normalize(frag_normal);

  if (!gl_FrontFacing) {
      normal = -normal;
  }

  if (debug_normals) {
    frag_color = vec4(0.5 * (normal + vec3(1.)), 1.);
  } else {
    vec3 l = normalize(camera_pos + light_offset - frag_pos);

    float lambertian = max(dot(l, normal), 0.);
    float specular = 0.;

    if (lambertian > 0.) {
      vec3 view = normalize(camera_pos - frag_pos);
      vec3 halfway = normalize(l + view);
      float theta = max(dot(halfway, normal), 0.);
      specular = pow(theta, alpha);
    }

    vec3 color = d * (a + lambertian) + .25 * s * specular;
    frag_color = vec4(color, 1.);
  }
}


<|start_filename|>homotopy-graphics/glsl/vert_3d.glsl<|end_filename|>
#version 300 es

precision highp float;

in vec3 position;
in vec3 normal;

out float hidden;
out vec3 frag_pos;
out vec3 frag_normal;

uniform mat4 mvp;

void main() {
  frag_pos = position;
  frag_normal = normal;
  hidden = 0.;

  gl_Position = mvp * vec4(position, 1.);
}
