.prose p.timestamp {
  @apply font-bold text-slate-600 text-xs tracking-wide;
  margin-bottom: -2em;
  position: relative;
  top: -4px;
}

.prose .timestamp + p {
  margin-bottom: 0.4em;
}

.prose .timestamp {
  cursor: pointer;
  color: var(--color-primary);
}

.prose {
  & :where(code):not(pre > code) {
    @apply bg-base-content/5 border-base-100;
  }

  & :where(a):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
    @apply decoration-base-content/25 hover:decoration-base-content duration-200;
  }

  &.textarea {
    width: 100%;
    max-width: 100%;
    padding-block: 0;
    padding-inline-start: 0;
    padding-inline-end: 0;

    .tiptap {
      height: 100%;
      min-height: calc(0.25rem * 34);
      padding-block: calc(0.25rem * 2);
      padding-inline-start: 0.75rem;
      padding-inline-end: 0.75rem;
      padding-bottom: 2rem;

      &:focus-visible {
        outline: none;
      }
    }
  }
}

.prose.no-max {
  max-width: 100%;
}

.prose [data-youtube-video],
.prose-sm [data-youtube-video],
.prose-xs [data-youtube-video] {
  position: relative;
  padding-bottom: 56.25%;

  iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }
}

.prose.post-type-5 .timestamp + p:not(.timestamp),
.prose .timestamp.transcript + p:not(.timestamp) {
  margin-top: -1.75rem;
  padding-left: 55px;
}

.prose.post-type-1 p.timestamp:not(.transcript):after {
  content: '- Jump to this section in video';
  opacity: 0.6;
  font-weight: 300;
  margin-left: 1ch;
}

.prose p.transcript.cutoff.active,
.prose p.transcript.cutoff.active + p:not(.timestamp) {
  display: none;
}

.transcript-cutoff {
  @apply xl:pl-6;

  width: 100%;
  height: 10ch;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  background-image: linear-gradient(to bottom, transparent, theme('color.base-300') 90%);
  pointer-events: none;
  position: absolute;
  bottom: 0;
  left: 0;
  transition: all 300ms ease;

  @media (prefers-reduced-motion: reduce) {
    transition: none;
  }
}

.transcript-cutoff.active {
  background-image: none;
  bottom: -3ch;
  z-index: 10;
}

.transcript-cutoff button {
  width: 100%;
  height: 3ch;
  display: block;
  text-align: left;
  font-size: theme('fontSize.sm');
  font-weight: 500;
  text-transform: uppercase;
  pointer-events: all;
  transition: all 300ms ease;

  @media (prefers-reduced-motion: reduce) {
    transition: none;
  }
}

.transcript-cutoff button:hover,
.transcript-cutoff button:active {
  @apply text-primary;
}

.transcript-cutoff button:before {
  content: '👇 Show Full Transcript';
}

.transcript-cutoff.active button:before {
  content: '👆 Hide Transcript';
}

.transcript-cutoff.active + .transcript-cutoff button {
  display: none;
}

.tiptap .code-block .hidden-content pre {
  @apply absolute my-0 text-transparent caret-base-content;

  background-color: transparent;
  top: 2.27rem;
  left: 2.05rem;
  line-height: 2;
  margin-top: 0;
  margin-bottom: 0;

  .ProseMirror-trailingBreak {
    margin-top: 1.5em;
  }
}

.tiptap .code-block .hidden-content {
  position: relative;
  z-index: 1;
}

.tiptap .shiki {
  pointer-events: none;
  user-select: none;
  position: relative;
  z-index: 0;
}

.language-selector {
  @apply top-1.5 right-4 absolute;

  .language-selector-select,
  .language-selector-placeholder {
    @apply rounded text-xs text-base-content/80 bg-base-content/10 border-base-100 px-2 py-1;
  }

  .language-selector-select {
    display: none;
  }
}

.prose pre code .line.del {
  opacity: 40%;
  transition: opacity 300ms ease;

  @media (prefers-reduced-motion: reduce) {
    transition: none;
  }
}

.prose pre code:hover .line.del {
  opacity: 100%;
}

.prose .line.del,
.prose .line.add {
  position: relative;
}

.prose .line.del:after,
.prose .line.add:after {
  content: '';
  height: 100%;
  left: -1.5rem;
  opacity: 30%;
  position: absolute;
  top: 0;
  width: calc(100% + 3rem);
}

.prose .line.del:after {
  @apply bg-error/50;
}

.prose .line.add:after {
  @apply bg-success/50;
}

.prose .line.del > span,
.prose .line.add > span {
  position: relative;
  z-index: 20;
}

.pose .line {
  display: block;
}

.prose .line,
.hidden-content pre code {
  line-height: 1.75;
  font-size: .8rem;
}

.prose img {
  border-radius: theme('borderRadius.xl');
}

.prose pre > code {
  display: flex;
  flex-flow: column;
}

pre {
  overflow: hidden;
  position: relative;
}

code {
  counter-reset: step delStep;
  counter-increment: step 0;
  counter-increment: delStep 0;
}

.prose :where(code):not(:where([class~='not-prose'], [class~='not-prose'] *))::before,
.prose :where(code):not(:where([class~='not-prose'], [class~='not-prose'] *))::after {
  content: none !important;
}

.prose :where(code):not(:where([class~='not-prose'], [class~='not-prose'] *)) {
  @apply font-mono;
  word-wrap: break-word;
  box-decoration-break: clone;
  padding: 0.1rem 0.3rem 0.2rem;
  border-radius: var(--radius-box);
}

code .line:before {
  width: 2rem;
  text-align: right;
  margin-right: 1rem;
  padding-right: 0.65rem;
  display: inline-block;
  opacity: 0.4;
}

code .line:not(.del):before {
  content: counter(step);
  counter-increment: step delStep;
}

code .line.del:before {
  content: counter(delStep);
  counter-increment: delStep;
}

code .line:first-of-type:before {
  @apply rounded-tr-lg;
}

code .line:last-of-type:before {
  @apply rounded-br-lg;
}

/* purgecss start ignore */
pre .filepath {
  @apply bg-base-100/50 rounded-t-md h-7 text-xs leading-none border-t border-base-100;
  padding: 0.3rem 0.75rem 0.2rem;
  line-height: 1;
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  position: absolute;
  top: 0.5rem;
  left: 5rem;
}

pre ul.filepath-list {
  @apply text-base-content/60;
  
  list-style: none;
  display: flex;
  margin: 0;
  padding: 0;

  li {
    padding: 0;
  }

  li:not(:first-of-type):before {
    content: '/';
    display: inline-block;
  }
}

pre .filepath .lang-icon {
  width: 1em;
  height: 1em;
  position: relative;
  top: -5px;

  &.ts,
  &.tsx {
    color: theme('colors.blue.500') !important;
  }

  &.js,
  &.jsx {
    color: theme('colors.yellow.500') !important;
  }

  &.edge {
    color: theme('colors.indigo.500') !important;
  }

  &.vue {
    color: theme('colors.green.500') !important;
  }
}

pre {
  max-width: 100%;
}

pre > code {
  max-width: 100%;
  overflow-x: auto;
}

.profile pre.shiki > code {
  @apply !px-0 !pb-0;
}

pre.shiki.github-dark,
pre.shiki.github-light {
  @apply !bg-base-100/50 px-0 pb-0 rounded-base border border-base-100;

  code {
    @apply !bg-base-300 py-3 rounded-[calc(var(--radius-box)_-_.25rem)] border-t border-base-content/5 max-h-[600px] overflow-auto;
  }

  &:before {
    content: '';
    margin-bottom: 0.75rem;
    margin-left: -0.5rem;
    display: block;
    height: 0.75rem;
    width: 0.75rem;
    border-radius: 9999px;
    opacity: 0.3;
    box-shadow:
      1.4em 0,
      2.8em 0,
      4.2em 0;
  }

  /* [style="color: #E1E4E8"] {
    color: theme('colors.slate-base.300') !important;
  }

  [style="color: #6A737D"] {
    color: theme('colors.slate-base.500') !important;
    font-style: italic;
  } */
}

/* purgecss end ignore */

.code-copy {
  position: absolute;
  top: 0.375rem;
  right: 1rem;
}

.cdx-block.ce-code {
  position: relative;
}

.ce-code__textarea {
  min-height: 200px;
  font-family:
    Menlo,
    Monaco,
    Consolas,
    Courier New,
    monospace;
  color: #41314e;
  line-height: 1.6em;
  font-size: 12px;
  background: #f8f7fa;
  border: 1px solid #f1f1f4;
  box-shadow: none;
  white-space: pre;
  word-wrap: normal;
  overflow-x: auto;
  resize: vertical;
}

.ce-code__languagecode {
  @apply px-3 py-1 rounded text-xs;
  position: absolute;
  bottom: 2ch;
  right: 0;
}

/** Comment Prose **/
/* purgecss start ignore */
.prose-comment {
  width: 100%;
  max-width: 100%;

  .ProseMirror {
    @apply p-6 pb-20 border border-base-100 rounded-base;
    min-height: 200px;
  }
}

.ProseMirror p.is-editor-empty:first-child::before {
  @apply text-base-content/40;
  content: attr(data-placeholder);
  float: left;
  height: 0;
  pointer-events: none;
}

.ProseMirror > :first-child {
  margin-top: 0;
}

.ProseMirror > :last-child {
  margin-bottom: 0;
}

.comment-wrap {
  &:has(.comment-info) .ProseMirror {
    @apply pt-14;
  }

  /* &:has(.comment-avatar) .ProseMirror {
    @apply md:pl-26;
  } */

  &:has(.comment-actions) .ProseMirror {
    @apply pb-26;
  }

  &:not(:has(.comment.info)):not(:has(.comment-actions)) .ProseMirror {
    @apply min-h-26;
  }

  .ProseMirror {
    @apply px-4 md:px-6 py-6;
  }

  .comment-avatar {
    @apply top-4 left-4 md:left-6 z-10 absolute;
  }

  .comment-info {
    @apply top-4 left-14 z-10 absolute;
  }

  .comment-actions {
    @apply right-4 bottom-4 z-10 absolute;
  }

  .tiptap-help {
    @apply bottom-4 left-4 md:left-6;
  }
}
