@use "Colors";
@use "Headings";
@use "Emphasis";
@use "Lists";
@use "Frontmatter";
@use "ContextMenu";
@use "Blockquote";
@use "Codeblock";
@use "tailwindcss";

.root-layout {
  display: flex;
  height: 100vh;
  font-size: 1rem;
  overflow: hidden;
  margin: 0;
}

.content {
  flex-grow: 1;
  background-color: white;
  height: 100%;
  padding: 10px;
  box-sizing: border-box;
  flex-direction: column;
}

.file-explorer-header {
  display: flex;
}

.resizer {
  width: 1px;
  cursor: ew-resize;
  margin-left: 1em;
}

.file-explorer {
  color: Colors.$gray-4;
  margin-right: 0.5em;
  width: 100%;

  .file-explorer-category {
    color: Colors.$gray-5;
    font-weight: bold;
    margin-top: 0.7em;
    font-size: 0.9rem;
  }
}

math {
  font-size: 1em;
}

.file-explorer-list {
  margin-top: 0.5em;
  user-select: none;

  max-height: 90vh;
  overflow-y: auto;
}

.file-explorer-item {
  @apply flex items-center gap-[0.3em] p-[0.2em] rounded-[var(--radius)] cursor-pointer;

  .span {
    @apply whitespace-nowrap overflow-hidden overflow-ellipsis flex-1;
  }

  &:hover {
    @apply bg-[var(--sidebar-accent)] text-[#222222];
  }

  &.active {
    @apply bg-[var(--sidebar-border)] text-[#222222];
  }
}

.file-explorer-button {
  display: flex;
  align-items: center;
  flex-direction: row;
  background-color: white;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid Colors.$gray-2;

  svg {
    width: 1.4em;
    height: 1.4em;
  }

  span {
    margin-left: 0.3em;
    vertical-align: auto;
  }

  &.add-button {
    flex-grow: 2;
  }

  &:hover {
    border: 1px solid Colors.$foreground-color;
    cursor: pointer;
  }
}

// file-explorer-children should have a vertical line indicating the indentation
@for $i from 0 through 10 {
  .file-explorer-children-#{$i} {
    position: relative;

    &::before {
      content: "";
      position: absolute;
      top: 0;
      left: #{0.75em + $i * 1.5em}; // Increases by 1.5em per level
      width: 1px;
      height: 100%;
      background-color: #e5e7eb;
    }
  }
}

.cm-selectionMatch {
  @apply bg-transparent;
}

.cm-activeLine {
  @apply bg-transparent!;
}

.cm-focused > .cm-scroller > .cm-selectionLayer,
.cm-selectionBackground {
  @apply bg-blue-100!;
}

@mixin default-font {
  font-size: 16px;
  // font-weight: 500;
  // color: $foreground-color;
  // text-rendering: optimizeLegibility;
}

.main-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

.cm-image-widget {
  display: flex;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;

  img {
    max-width: 100%;
    height: auto;
    display: block;
  }

  &.cm-image-error {
    border-radius: 4px;
    padding: 4px;
    font-weight: 400;
    font-size: 12px;
    @apply text-[#5C5C5C];
  }
}

.cm-window {
  height: 100%;
  min-height: 100vh;
  justify-content: center;
  display: flex;
}

.editor-comp {
  padding: 20px 50px 0px 50px;
  outline-color: red;
  width: 55em;
}

.cm-editor {
  height: inherit;

  &.cm-focused {
    outline: none;
  }
}

.cm-scroller {
  flex: 1 1 auto;
  display: flex !important;
  overflow-x: visible;
  align-items: flex-start;
  padding-bottom: 600px;
  // padding: 0 5em 0 5em;
}

/*
 * hide the gutters for the dev process*/
.cm-gutter.cm-lineNumbers {
  display: none !important;
}

.cm-gutter.cm-foldGutter {
  display: none !important;
}

.cm-activeLineGutter {
  background-color: transparent !important;
}

.cm-gutters {
  background-color: transparent !important;
  border: none !important;
  font-size: 12px;
}

.cm-gutterElement {
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  margin-right: 0.5em;
}

body {
  font-family:
    "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  font-weight: 400;
}

.cm-content {
  font-family:
    "Cascadia Mono", "Menlo", "Consolas", "Liberation Mono", "Courier New",
    monospace !important;
  font-weight: 400;
  font-size: 14px;
  color: Colors.$font-color;
  // width: 50em;
}

.cm-content.cm-lineWrapping {
  padding-bottom: 600px;
}

.cm-horizontal-rule-widget-container {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: -10px 0;
}

.cm-horizontal-rule-widget-container hr {
  width: 100%;
  border: none;
  border-top: 2px solid Colors.$border-color;
  margin: 0;
}

.cm-line:has(.cm-horizontal-rule-widget-container) {
  height: 19.59px;
  padding: 0px;
}

.cm-line {
  position: relative;
}

.cm-widgetBuffer {
  height: 0 !important;
}

table {
  border-collapse: collapse;
  border: 1px solid Colors.$border-color;

  th,
  td {
    border: 1px solid Colors.$border-color;
    padding: 5px;
  }
}
