:root {
  --canvas: #e8e8e6;
  --rail: #ffffff;
  --text: #6a6a6a;
  --charcoal: #292929;
  --link-height: 3.5rem;
  --rail-radius: 10px;
  --motion: 250ms;
  --rail-fade: 2000ms;
}

* {
  box-sizing: border-box;
}

html,
body,
.app {
  min-height: 100%;
}

html {
  background: var(--canvas);
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--canvas);
  color: var(--charcoal);
  font-family: "Open Sans", Arial, sans-serif;
}

button,
textarea {
  font: inherit;
}

.rail {
  --indicator-y: 0px;
  position: fixed;
  z-index: 2;
  top: 50%;
  left: 1rem;
  width: 5.5rem;
  padding: 1rem 0;
  overflow: visible;
  isolation: isolate;
  background: var(--rail);
  border-radius: var(--rail-radius);
  box-shadow: 0 0 40px rgb(0 0 0 / 3%);
  opacity: 1;
  transform: translateY(-50%);
  transition: opacity var(--rail-fade) ease;
}

.rail.is-writing:not(:hover):not(:focus-within) {
  opacity: 0.1;
}

.rail.is-writing:hover,
.rail.is-writing:focus-within,
.rail.is-writing.is-highlighted {
  opacity: 1;
  transition-duration: var(--motion);
}

.rail::before {
  position: absolute;
  z-index: -1;
  top: 1rem;
  left: 1rem;
  width: var(--link-height);
  height: var(--link-height);
  content: "";
  pointer-events: none;
  opacity: 0;
  background: var(--charcoal);
  border-radius: 17.5px;
  transform: translateY(var(--indicator-y));
  transition:
    opacity var(--motion) ease,
    transform var(--motion) cubic-bezier(1, 0.2, 0.1, 1.2);
}

.rail.is-highlighted::before {
  opacity: 1;
}

.rail:has(.rail__link:hover)::before {
  opacity: 1;
}

.rail:has(#share-note:hover) {
  --indicator-y: 0px;
}

.rail:has(#new-note:hover) {
  --indicator-y: var(--link-height);
}

.rail:has(#lock-note:hover) {
  --indicator-y: calc(var(--link-height) + var(--link-height));
}

.rail:has(#share-note:hover)::before {
  animation: gooey-effect-share var(--motion) cubic-bezier(1, 0.2, 0.1, 1.2);
}

.rail:has(#new-note:hover)::before {
  animation: gooey-effect-new var(--motion) cubic-bezier(1, 0.2, 0.1, 1.2);
}

.rail:has(#lock-note:hover)::before {
  animation: gooey-effect-lock var(--motion) cubic-bezier(1, 0.2, 0.1, 1.2);
}

.rail.is-gooey::before {
  animation: gooey-effect var(--motion) cubic-bezier(1, 0.2, 0.1, 1.2);
}

.rail__link {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: var(--link-height);
  padding: 0;
  color: var(--text);
  cursor: pointer;
  background: transparent;
  border: 0;
  transition: color var(--motion) ease;
}

.rail__link svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.rail__label {
  position: absolute;
  top: 50%;
  left: 100%;
  padding: 0.75rem;
  margin-left: 1rem;
  color: var(--charcoal);
  pointer-events: none;
  white-space: nowrap;
  opacity: 0;
  background: var(--rail);
  border-radius: 17.5px;
  transform: translate(-3rem, -50%);
  transition:
    opacity var(--motion) ease,
    transform var(--motion) ease;
}

.rail__link:hover,
.rail__link.is-highlighted,
.rail__link:focus-visible {
  color: var(--rail);
}

.rail__link:focus-visible {
  outline: 2px solid var(--charcoal);
  outline-offset: -0.4rem;
  border-radius: 1.25rem;
}

.rail__link[aria-disabled="true"] {
  cursor: default;
}

.rail__link:hover .rail__label,
.rail__link.is-highlighted .rail__label,
.rail__link:focus-visible .rail__label,
.rail__link.is-message .rail__label {
  opacity: 1;
  transform: translate(0, -50%);
}

.lock-icon--closed {
  display: none;
}

#lock-note[data-locked="true"] .lock-icon--open {
  display: none;
}

#lock-note[data-locked="true"] .lock-icon--closed {
  display: block;
}

.note-surface {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  min-height: 100vh;
  padding: clamp(4.25rem, 10vh, 7rem) clamp(2rem, 10vw, 12rem) 5rem clamp(10rem, 17vw, 16rem);
  color: var(--charcoal);
  background: transparent;
  border: 0;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.8;
}

#note-body {
  resize: none;
  outline: 0;
}

#note-body::placeholder {
  color: var(--charcoal);
  opacity: 0.3;
}

#note-body[readonly] {
  cursor: text;
}

.note-view {
  overflow: auto;
  overflow-wrap: anywhere;
  white-space: break-spaces;
  user-select: text;
  cursor: text;
}

.note-view a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.note-view a:focus-visible {
  outline: 2px solid var(--charcoal);
  outline-offset: 3px;
  border-radius: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes gooey-effect {
  0%,
  100% {
    transform: translateY(var(--indicator-y)) scale(1, 1);
  }

  50% {
    transform: translateY(var(--indicator-y)) scale(0.5, 1.5);
  }
}

@keyframes gooey-effect-share {
  0%,
  100% {
    transform: translateY(var(--indicator-y)) scale(1, 1);
  }

  50% {
    transform: translateY(var(--indicator-y)) scale(0.5, 1.5);
  }
}

@keyframes gooey-effect-new {
  0%,
  100% {
    transform: translateY(var(--indicator-y)) scale(1, 1);
  }

  50% {
    transform: translateY(var(--indicator-y)) scale(0.5, 1.5);
  }
}

@keyframes gooey-effect-lock {
  0%,
  100% {
    transform: translateY(var(--indicator-y)) scale(1, 1);
  }

  50% {
    transform: translateY(var(--indicator-y)) scale(0.5, 1.5);
  }
}

@media (max-width: 640px) {
  .rail {
    left: 0.75rem;
    width: 4.5rem;
    padding: 0.75rem 0;
  }

  .rail::before {
    top: 0.75rem;
    left: 0.5rem;
  }

  .note-surface {
    height: 100svh;
    min-height: 100svh;
    padding: 6rem 1.75rem 3rem 6.75rem;
    font-size: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
  }
}
