@import url('spacing.css');

/* apply a natural box layout model to all elements, but allowing components to change */
html {
  box-sizing: border-box;
}
*,
*:before,
*:after {
  box-sizing: inherit;
}

:root {
  --color-primary: #3e39d2;
  --color-lightHoverBg: #fff;
}

@media (prefers-color-scheme: dark) {
  html {
    filter: invert(90%) hue-rotate(180deg);
  }

  a:hover {
    opacity: 1 !important;
  }
}

body {
  font-family: -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui,
    helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial,
    sans-serif;
  background-color: var(--bg-secondary-color);
  /* background-color: var(--bg);
  color: var(--text-color); */
}

.container {
  margin: 2em auto;
  padding: 0 1.5em;
  max-width: 960px;
}

.sr-only,
.assistive-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.sr-only-focusable:active,
.sr-only-focusable:focus {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
}

/* ANCHOR General typography
--------------------------------------- */

a {
  text-decoration: none;
  /* color: var(--link-color); */
}

a:hover {
  text-decoration: underline;
}

.title {
  font-size: 1.2em;
  font-weight: normal;
  line-height: 1.2em;
}

.strong {
  font-weight: bold;
}

.normal {
  font-weight: normal;
}

.muted {
  color: var(--color-grey);
}

.error,
.danger,
.red {
  color: var(--color-error);
}

/* ANCHOR Search control
--------------------------------------- */

.search-form {
  display: flex;
}

.search-input {
  width: 100%;
  box-shadow: 0 1px 4px #00000011;
}
input.search-input:focus {
  box-shadow: 0 1px 8px #00000022;
}

@media (prefers-color-scheme: dark) {
  .search-input {
    box-shadow: 0 1px 4px #ffffff11;
  }
  input.search-input:focus {
    box-shadow: 0 1px 8px #ffffff22;
  }
}

/* ANCHOR Bookmarks list
--------------------------------------- */

.selected-tag:not(:last-child)::after {
  content: ', ';
}

.bookmark-item + .bookmark-item {
  border-top: 1px solid var(--border-color);
}

.url {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.description {
  line-height: 1.45;
}

.tags {
  padding-left: 0;
  list-style: none;
}

.tags li {
  display: inline-block;
}

.bookmark-meta,
.url {
  font-size: 1.4rem;
}

.bookmark-meta {
  display: flex;
}

.bookmark-actions a {
  color: var(--color-grey);
}

.bookmark-actions .bookmark-delete:hover {
  color: var(--color-error);
}

/* ANCHOR Pagination
--------------------------------------- */
.pagination {
  display: flex;
  justify-content: center;
}

input.pagination-input {
  display: inline-block;
  width: 5em;
  text-align: center;
}

/* ANCHOR Tag Autocomplete
--------------------------------------- */

.fieldset-wrap {
  position: relative;
}

.tag-autocomplete {
  --color-lightHoverBg: #e8ecf1;
  position: absolute;
  left: 0;
  top: 100%;
  margin: 0;
  padding-left: 0;
  border: 1px solid var(--color-grey);
  border-top: none;
  box-sizing: border-box;
  min-width: 250px;
  list-style: none;
  background-color: var(--bg-color);
  z-index: 10;
}

.tag-autocomplete-search {
  top: 100%;
}

/* ANCHOR Forms 
--------------------------------------- */

.control {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

.button-arrow {
  font-size: 1.2em;
  line-height: 1em;
}

label,
input,
textarea {
  box-sizing: border-box;
}

input[type='date'].error,
input[type='date'].error:focus,
input[type='date'].danger,
input[type='date'].danger:focus,
input[type='number'].error,
input[type='number'].error:focus,
input[type='number'].danger,
input[type='number'].danger:focus,
input[type='text'].error,
input[type='text'].error:focus,
input[type='text'].danger,
input[type='text'].danger:focus,
input[type='url'].error,
input[type='url'].error:focus,
input[type='url'].danger,
input[type='url'].danger:focus {
  border-color: var(--color-error);
  color: unset;
}

@media (prefers-color-scheme: dark) {
  .button.primary,
  button[type='submit'] {
    /* filter: invert(100%) hue-rotate(180deg); */
    /* background: var(--color-primary);
    color: #222222; */
  }
}

/* ANCHOR Menu
--------------------------------------- */

.menu-list {
  padding-left: 0;
  list-style: none;
}

.menu-item-button {
  display: block;
  padding: 0.4em 0.8em;
  width: 100%;
  text-align: left;

  &.clear {
    color: var(--color-darkGrey);
  }

  &:hover {
    background: var(--color-lightHoverBg);
    text-decoration: underline;
    opacity: 1;
  }
}

.menu-item-selected > .menu-item-button,
.menu-item-selected > .menu-item-button {
  text-decoration: underline;
  color: var(--text-color) !important;
}

.button.menu-item-active {
  font-weight: bold;
  color: var(--color-primary);
}

@media (prefers-color-scheme: dark) {
  .menu-item-button {
    color: var(--color-grey);
  }

  .menu-link:focus,
  .menu-link:hover {
    background: #1a1a1a;
  }
}

/* ANCHOR Card
--------------------------------------- */

.card {
  box-shadow: 0 1px 6px #00000022;
}

@media (prefers-color-scheme: dark) {
  .card {
    border: 1px solid #ddd;
    box-shadow: 0 1px 6px #ffffff55;
  }
}

/* ANCHOR Loader
--------------------------------------- */

.loader-main {
  position: absolute;
  left: 50%;
  top: 200px;
  transform: translateX(-50%);
}

.loader {
  width: 48px;
  height: 48px;
  border: 3px solid var(--color-grey);
  border-radius: 50%;
  display: inline-block;
  position: relative;
  box-sizing: border-box;
  animation: rotation 1s linear infinite;
}

.loader::after {
  content: '';
  box-sizing: border-box;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid transparent;
  border-bottom-color: var(--color-grey);
}

@keyframes rotation {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}
