/* This could be redone as
   https://developer.mozilla.org/en-US/docs/Web/CSS/@media/scripting
*/
.nojs {
    /* we will add rules using JS to this later to hide such elements */
}

.jsonly {
    /* we will remove these rules using JS to this later to show such elements */
    display: none;
}

nav {
    display: flex;
    align-items: center;
}

nav ul {
    display: flex;
    justify-content: space-between;
}

nav ul li {
  list-style-type: none;
}

.grid-layout {
    display: grid;
    /* 480px looks good on desktop, maybe 240px for mobile?! */
    grid-template-columns: repeat(auto-fill, minmax(480px, 1fr));
    grid-template-rows: masonry; /* Still experimental on FF */
    grid-gap: 1px;
    /*
    grid-auto-rows: minmax(180px, auto);
    grid-auto-flow: dense;
    */
    padding: 1px;

}

.grid-item {
    padding: 1rem;
    font-size: 14px;
    color: #000;
    background-color: #ccc;
    border-radius: 10px;
}

.grid-item img {
    width: 100%;
}

.span-2 {
    grid-column-end: span 2;
    grid-row-end: span 2;
}

.span-3 {
    grid-column-end: span 3;
    grid-row-end: span 4;
}

.note {
    border: solid 1px black;
}

/* Limit the maximum display size of a single note to ~20 lines */
.content {
    @supports (-webkit-line-clamp: 10) {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: initial;
      display: -webkit-box;
      -webkit-line-clamp: 10;
      -webkit-box-orient: vertical;
    }
}

/* Make links within a note directly clickable */
.content a {
    position: relative;
    z-index: 1;
}

/* Make audio within a note directly clickable */
.content audio {
    position: relative;
    z-index: 1;
}

/* Make video within a note directly clickable */
.content video {
    position: relative;
    z-index: 1;
}

/* Move our UI above the clickable links */
#btn-new {
    z-index: 2;
}

#single-note {
    display: flex;
}

.single-note {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
 }

.single-note .title {
    font-size: 24pt;
}

.single-note img {
    max-width: 100%;
}

a.editable {
    color: #bbb;
    text-decoration: none;
}

.note-container {
    min-height: 400px;
}

.note-container > textarea {
  /* box-sizing: border-box; /* fit parent width */
  flex: 1;
  height: 100%;
  width: 100%;
  min-height: 400px;
}

.color-circle {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.note-ui {
    position: absolute;
    top: 0px;
    left: 0px;
    width: 100%;
    z-index: 2;
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    padding-left: 16px;
    padding-top: 4px;
}

.note-ui a.title {
    font-size: 12pt;
    font-weight: bold;
    position: static;
    text-decoration: inherit;
    color: black;
    flex: auto;
}

/* Expand the note title across the whole note so clicking it immediately
 * leads to the note itself */
.note a.title-cover {
    /* expand the pseudo-element to cover the note area */
    &::before {
        content: "";
        position: absolute;
        z-index: 0; /* we'll elevate inner links above that */
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        /* ... */
        text-decoration: inherit;
    }
}

.pin-location {
    flex: stretch;
}

.pinned {
    transform: rotate(-45deg);
    font-weight: bold;
}

/* Mark external links as "open in new window */
a.pop-out {
  flex: stretch;
  content: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAQElEQVR42qXKwQkAIAxDUUdxtO6/RBQkQZvSi8I/pL4BoGw/XPkh4XigPmsUgh0626AjRsgxHTkUThsG2T/sIlzdTsp52kSS1wAAAABJRU5ErkJggg==);
  margin: 0 3px 0 5px;
  /*
      position: absolute;
      z-index: 2; /* so it's even above the in-app link*/
      top: 0;
      right: 0;
*/
  width: 16px;
  height: 16px;
  text-decoration: inherit;
}

.label:not(:hover) .delete-label {
    visibility: hidden;
}

/* So the label takes up the whole width of the popup menu */
.edit-label label {
    width: 100%;
}

.sidebar-current {
    background-color: green;
}

.svg_icon {
  width: 1em;
  max-height: 1.5em;
  display: inline-block;
  position: relative;
  vertical-align: bottom;
}

.htmx-indicator{
}

@media print {
    .noprint {
        display: none !important;
    }

    ..note-container {
        width: 100%;
        max-width: 100%;
        box-shadow: none;
    }
}

/* HTML editor toolbar */
    #toolbar {
      --position: sticky;
      --position: -webkit-sticky;
      --gap: 8px;
      --top: 5px;
      --padding: 0 10px;
      --z-index: 9999;
      --background-color: #f8f9fa;
      --border-radius: 12px;
      display: flex;
      flex-wrap: wrap;
      justify-content: flex-start;
      align-items: center;
    }

    #toolbar #splitbar {
      margin-left: auto;
    }

    #toolbar input[type="file"] {
      --display: none;
    }


    #toolbar button,
    #toolbar label,
    #toolbar select {
      padding: 8px;
      border: none;
      background: none;
      font-size: 16px;
      cursor: pointer;
      transition: opacity 0.2s
    }

    #toolbar button.toolbar-active,
    #toolbar label.toolbar-active,
    #toolbar select.toolbar-active {
      background: #ddd;
      border-color: #aaa;
      border: 1px;
    }

    #toolbar button:hover,
    #toolbar label:hover,
    #toolbar select:hover {
      background: #f0f0f0;
      border-color: #bbb;
    }
