.text-input-surface {
  position: fixed;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  resize: none;
  overflow: hidden;
  background: transparent;
  color: var(--arhix-text-editing-ink, var(--arhix-document-ink, #111111));
  caret-color: var(--arhix-text-editing-ink, var(--arhix-document-ink, #111111));
  cursor: text;
  line-height: 1.25;
  z-index: 80;
}

.text-input-surface[data-font-face="gost"] {
  font-family: "Arhix GOST A", sans-serif;
}

.text-input-surface[data-font-face="gost-italic"] {
  font-family: "Arhix GOST A Italic", "Arhix GOST A", sans-serif;
}

.text-input-surface[data-font-face="gost-bold"] {
  font-family: "Arhix GOST B", "Arhix GOST A", sans-serif;
}

.text-input-surface[data-font-face="gost-bold-italic"] {
  font-family: "Arhix GOST B Italic", "Arhix GOST B", sans-serif;
}

.text-input-surface[data-horizontal-alignment="start"] {
  text-align: left;
}

.text-input-surface[data-horizontal-alignment="center"] {
  text-align: center;
}

.text-input-surface[data-horizontal-alignment="end"] {
  text-align: right;
}

.text-input-surface[data-text-underline="true"] {
  text-decoration: underline;
}

.text-input-surface[data-wrap-text="false"] {
  white-space: pre;
}

.text-input-surface[data-wrap-text="true"] {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.text-input-surface[data-sticky-projection-input="true"] {
  color: transparent;
  caret-color: transparent;
  -webkit-text-fill-color: transparent;
}

.text-input-surface[data-sticky-projection-input="true"]::selection {
  background: transparent;
  -webkit-text-fill-color: transparent;
}

.text-input-surface[data-leader-projection-input="true"] {
  color: transparent;
  caret-color: transparent;
  -webkit-text-fill-color: transparent;
}

.text-input-surface[data-leader-projection-input="true"]::selection {
  background: transparent;
  -webkit-text-fill-color: transparent;
}

.text-input-surface[data-table-projection-input="true"] {
  color: transparent;
  caret-color: transparent;
  -webkit-text-fill-color: transparent;
}

.text-input-surface[data-table-projection-input="true"]::selection {
  background: transparent;
  -webkit-text-fill-color: transparent;
}

.text-input-surface[data-story-projection-input="true"] {
  color: transparent;
  caret-color: transparent;
  -webkit-text-fill-color: transparent;
  pointer-events: none;
}

.text-input-surface[data-story-projection-input="true"]::selection {
  background: transparent;
  -webkit-text-fill-color: transparent;
}

.text-input-surface[data-story-projection-input="true"][data-pointer-selection="true"] {
  pointer-events: auto;
}

.text-frame-live-outline {
  position: fixed;
  box-sizing: border-box;
  border: 2px solid var(--arhix-document-selection);
  pointer-events: none;
  z-index: 79;
}

.text-input-surface[data-story-projection-input="true"] + .text-frame-live-outline {
  display: none;
}

.text-story-projection {
  z-index: 81;
  pointer-events: none;
}

.text-story-projection[data-coordinate-space="viewport"] {
  position: fixed;
  inset: 0;
}

.text-story-projection[data-coordinate-space="host"] {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.text-story-projection__frame {
  position: absolute;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--arhix-document-ink, #111111);
  line-height: 1.25;
  white-space: pre;
}

.text-story-projection__frame[data-vertical-alignment="center"] {
  justify-content: center;
}

.text-story-projection__frame[data-vertical-alignment="end"] {
  justify-content: end;
}

.text-story-projection__line {
  flex: 0 0 1.25em;
  min-width: 0;
  overflow: hidden;
}

.text-story-projection__selection {
  background: var(--arhix-document-selection-fill);
}

.text-story-projection__caret {
  display: inline-block;
  width: calc(3 * var(--arhix-border-hairline));
  height: 1em;
  margin-right: calc(-3 * var(--arhix-border-hairline));
  background: currentColor;
  vertical-align: -0.12em;
}

.text-story-projection__svg-frame {
  pointer-events: none;
}

.text-story-projection__svg-text {
  white-space: pre;
}

.text-story-projection__svg-selection-range {
  fill: var(--arhix-document-selection-fill);
}

.text-story-projection__svg-caret {
  stroke: var(--arhix-text-editing-ink, var(--arhix-document-ink, #111111));
  stroke-width: calc(3 * var(--arhix-border-hairline));
  animation: text-story-caret-blink 1s steps(1, end) infinite;
}

.text-story-projection__svg-caret--insertion {
  stroke: var(--arhix-accent);
  animation: none;
}

@keyframes text-story-caret-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}
