/* ==UserStyle==
@name           NixOS Search Catppuccin
@namespace      github.com/catppuccin/userstyles/nixos-search
@version        0.2.0
@description    Soothing pastel theme for NixOS Search
@author         Catppuccin
@updateURL      https://github.com/catppuccin/userstyles/raw/main/styles/nixos-search/catppuccin.user.css
@preprocessor   less
@var select flavor "Theme" ["latte:Latte*", "frappe:Frappe", "macchiato:Macchiato", "mocha:Mocha"]
@var select accent "Accent" ["rosewater:Rosewater", "flamingo:Flamingo", "pink:Pink", "mauve:Mauve", "red:Red", "maroon:Maroon", "peach:Peach", "yellow:Yellow", "green:Green", "teal:Teal", "blue:Blue*", "sapphire:Sapphire", "sky:Sky", "lavender:Lavender", "subtext0:Gray"]
==/UserStyle== */
@-moz-document domain("search.nixos.org") {
  #catppuccin(@flavor);
  #accent(@accent);
  #nixos-search();

  #catppuccin(@flavor) when (@flavor = latte) {
    @rosewater: hsl(11, 59%, 67%);
    @flamingo: hsl(0, 60%, 67%);
    @pink: hsl(316, 73%, 69%);
    @mauve: hsl(266, 85%, 58%);
    @red: hsl(347, 87%, 44%);
    @maroon: hsl(355, 76%, 59%);
    @peach: hsl(22, 99%, 52%);
    @yellow: hsl(35, 77%, 49%);
    @green: hsl(109, 58%, 40%);
    @teal: hsl(183, 74%, 35%);
    @sky: hsl(197, 97%, 46%);
    @sapphire: hsl(189, 70%, 42%);
    @blue: hsl(220, 91%, 54%);
    @lavender: hsl(231, 97%, 72%);
    @text: hsl(234, 16%, 35%);
    @subtext1: hsl(233, 13%, 41%);
    @subtext0: hsl(233, 10%, 47%);
    @overlay2: hsl(232, 10%, 53%);
    @overlay1: hsl(231, 10%, 59%);
    @overlay0: hsl(228, 11%, 65%);
    @surface2: hsl(227, 12%, 71%);
    @surface1: hsl(225, 14%, 77%);
    @surface0: hsl(223, 16%, 83%);
    @base: hsl(220, 23%, 95%);
    @mantle: hsl(220, 22%, 92%);
    @crust: hsl(220, 21%, 89%);
  }

  #catppuccin(@flavor) when (@flavor = frappe) {
    @rosewater: hsl(10, 57%, 88%);
    @flamingo: hsl(0, 59%, 84%);
    @pink: hsl(316, 73%, 84%);
    @mauve: hsl(277, 59%, 76%);
    @red: hsl(359, 68%, 71%);
    @maroon: hsl(358, 66%, 76%);
    @peach: hsl(20, 79%, 70%);
    @yellow: hsl(40, 62%, 73%);
    @green: hsl(96, 44%, 68%);
    @teal: hsl(172, 39%, 65%);
    @sky: hsl(189, 48%, 73%);
    @sapphire: hsl(199, 55%, 69%);
    @blue: hsl(222, 74%, 74%);
    @lavender: hsl(239, 66%, 84%);
    @text: hsl(227, 70%, 87%);
    @subtext1: hsl(227, 44%, 80%);
    @subtext0: hsl(228, 29%, 73%);
    @overlay2: hsl(228, 22%, 66%);
    @overlay1: hsl(227, 17%, 58%);
    @overlay0: hsl(229, 13%, 52%);
    @surface2: hsl(228, 13%, 44%);
    @surface1: hsl(227, 15%, 37%);
    @surface0: hsl(230, 16%, 30%);
    @base: hsl(229, 19%, 23%);
    @mantle: hsl(231, 19%, 20%);
    @crust: hsl(229, 20%, 17%);
  }

  #catppuccin(@flavor) when (@flavor =macchiato) {
    @rosewater: hsl(10, 58%, 90%);
    @flamingo: hsl(0, 58%, 86%);
    @pink: hsl(316, 74%, 85%);
    @mauve: hsl(267, 83%, 80%);
    @red: hsl(351, 74%, 73%);
    @maroon: hsl(355, 71%, 77%);
    @peach: hsl(21, 86%, 73%);
    @yellow: hsl(40, 70%, 78%);
    @green: hsl(105, 48%, 72%);
    @teal: hsl(171, 47%, 69%);
    @sky: hsl(189, 59%, 73%);
    @sapphire: hsl(199, 66%, 69%);
    @blue: hsl(220, 83%, 75%);
    @lavender: hsl(234, 82%, 85%);
    @text: hsl(227, 68%, 88%);
    @subtext1: hsl(228, 39%, 80%);
    @subtext0: hsl(227, 27%, 72%);
    @overlay2: hsl(228, 20%, 65%);
    @overlay1: hsl(228, 15%, 57%);
    @overlay0: hsl(230, 12%, 49%);
    @surface2: hsl(230, 14%, 41%);
    @surface1: hsl(231, 16%, 34%);
    @surface0: hsl(230, 19%, 26%);
    @base: hsl(232, 23%, 18%);
    @mantle: hsl(233, 23%, 15%);
    @crust: hsl(236, 23%, 12%);
  }

  #catppuccin(@flavor) when (@flavor = mocha) {
    @rosewater: hsl(10, 56%, 91%);
    @flamingo: hsl(0, 59%, 88%);
    @pink: hsl(316, 72%, 86%);
    @mauve: hsl(267, 84%, 81%);
    @red: hsl(343, 81%, 75%);
    @maroon: hsl(350, 65%, 77%);
    @peach: hsl(23, 92%, 75%);
    @yellow: hsl(41, 86%, 83%);
    @green: hsl(115, 54%, 76%);
    @teal: hsl(170, 57%, 73%);
    @sky: hsl(189, 71%, 73%);
    @sapphire: hsl(199, 76%, 69%);
    @blue: hsl(217, 92%, 76%);
    @lavender: hsl(232, 97%, 85%);
    @text: hsl(226, 64%, 88%);
    @subtext1: hsl(227, 35%, 80%);
    @subtext0: hsl(228, 24%, 72%);
    @overlay2: hsl(228, 17%, 64%);
    @overlay1: hsl(230, 13%, 55%);
    @overlay0: hsl(231, 11%, 47%);
    @surface2: hsl(233, 12%, 39%);
    @surface1: hsl(234, 13%, 31%);
    @surface0: hsl(237, 16%, 23%);
    @base: hsl(240, 21%, 15%);
    @mantle: hsl(240, 21%, 12%);
    @crust: hsl(240, 23%, 9%);
  }

  /* ----- Accent Mixins ----- */
  #accent(@accent) when (@accent = rosewater) {
    @accent-color: @rosewater;
  }
  #accent(@accent) when (@accent = flamingo) {
    @accent-color: @flamingo;
  }
  #accent(@accent) when (@accent = pink) {
    @accent-color: @pink;
  }
  #accent(@accent) when (@accent = mauve) {
    @accent-color: @mauve;
  }
  #accent(@accent) when (@accent = red) {
    @accent-color: @red;
  }
  #accent(@accent) when (@accent = maroon) {
    @accent-color: @maroon;
  }
  #accent(@accent) when (@accent = peach) {
    @accent-color: @peach;
  }
  #accent(@accent) when (@accent = yellow) {
    @accent-color: @yellow;
  }
  #accent(@accent) when (@accent = green) {
    @accent-color: @green;
  }
  #accent(@accent) when (@accent = teal) {
    @accent-color: @teal;
  }
  #accent(@accent) when (@accent = blue) {
    @accent-color: @blue;
  }
  #accent(@accent) when (@accent = sapphire) {
    @accent-color: @sapphire;
  }
  #accent(@accent) when (@accent  =sky) {
    @accent-color: @sky;
  }
  #accent(@accent) when (@accent = lavender) {
    @accent-color: @lavender;
  }
  #accent(@accent) when (@accent = subtext0) {
    @accent-color: @subtext0;
  }

  #nixos-search {
    /* Generic */
    html,
    body {
      background-color: @base;
      color: @text;
    }

    code,
    pre {
      color: @red;
      background-color: @surface0;
      border: none;
    }

    a,
    a:hover,
    a:focus {
      color: @accent-color;
      outline: none;
    }

    /* Navbar */
    .navbar .navbar-static-top {
      background-color: @mantle;
    }

    .navbar-inner {
      background-color: @mantle;
      background-image: none;
      border: 1px solid @base;
    }

    .nav-tabs {
      border-bottom: 1px solid @surface0;
    }

    .nav-tabs > .active > a,
    .nav-tabs > .active > a:hover,
    .nav-tabs > .active > a:focus {
      background-color: @base;
      border: 1px solid @surface0;
      color: @text;
    }

    .navbar .nav > li > a {
      text-shadow: none;
      color: @subtext0;
    }

    .navbar .nav > li > a:focus,
    .navbar .nav > li > a:hover {
      color: @text;
      border: none;
    }

    .navbar .nav > .active > a,
    .navbar .nav > .active > a:hover,
    .navbar .nav > .active > a:focus {
      background-color: @surface0;
      color: @text;
    }

    /* Installation instructions tabs */
    .nav > li > a:hover,
    .nav > li > a:focus {
      background-color: @surface0;
      border: 1px solid @surface0;
    }

    /* "Experimental" label */
    .label,
    .badge {
      background-color: @accent-color;
      color: @crust;
      text-shadow: none;
    }

    /* Buttons */
    .btn {
      background-color: @surface0;
      background-image: none;
      text-shadow: none;
      box-shadow: none;
      color: @text;
      border: 1px solid @base;
    }

    .btn:focus {
      outline: none;
      color: @text;
      background-color: @surface1;
    }

    .btn:hover,
    .btn:active,
    .btn.active,
    .btn.disabled,
    .btn[disabled] {
      background-color: @surface1;
      color: @text;
    }

    /* "Sort" menu */
    .dropdown-menu {
      background-color: @mantle;
      border: 1px solid @crust;
      box-shadow: 0 5px 10px @mantle;
    }

    .dropdown-menu > li > a {
      color: @text;
    }

    .dropdown-menu > li > a:hover,
    .dropdown-menu > li > a:focus,
    .dropdown-submenu:hover > a,
    .dropdown-submenu:focus > a {
      background-color: @surface0;
      background-image: none;
    }

    .dropdown-menu .divider {
      background-color: @surface0;
      border-bottom: @surface0;
    }

    .dropdown .caret {
      border-top: 4px solid @text;
    }

    /* Overrides menu item hover color */
    .search-page
      > .search-results
      > div
      > :first-child
      > div:first-child
      > ul
      > li
      > a {
      color: @text;
    }

    /* Loading indicator */
    .loader {
      color: @crust;
    }

    /* Input box */
    textarea,
    input[type="text"],
    input[type="password"],
    input[type="datetime"],
    input[type="datetime-local"],
    input[type="date"],
    input[type="month"],
    input[type="time"],
    input[type="week"],
    input[type="number"],
    input[type="email"],
    input[type="url"],
    input[type="search"],
    input[type="tel"],
    input[type="color"],
    .uneditable-input {
      background-color: @surface0;
      color: @text;
      border: 1px solid @base;
    }

    textarea:focus,
    input[type="text"]:focus,
    input[type="password"]:focus,
    input[type="datetime"]:focus,
    input[type="datetime-local"]:focus,
    input[type="date"]:focus,
    input[type="month"]:focus,
    input[type="time"]:focus,
    input[type="week"]:focus,
    input[type="number"]:focus,
    input[type="email"]:focus,
    input[type="url"]:focus,
    input[type="search"]:focus,
    input[type="tel"]:focus,
    input[type="color"]:focus,
    .uneditable-input:focus {
      border-color: @accent-color;
      box-shadow: inset 0 1px 1px @crust, 0 0 8px @accent-color;
    }

    /* Fix input box placeholder text */
    textarea::placeholder,
    input[type="text"]::placeholder,
    input[type="password"]::placeholder,
    input[type="datetime"]::placeholder,
    input[type="datetime-local"]::placeholder,
    input[type="date"]::placeholder,
    input[type="month"]::placeholder,
    input[type="time"]::placeholder,
    input[type="week"]::placeholder,
    input[type="number"]::placeholder,
    input[type="email"]::placeholder,
    input[type="url"]::placeholder,
    input[type="search"]::placeholder,
    input[type="tel"]::placeholder,
    input[type="color"]::placeholder,
    .uneditable-input::placeholder {
      color: @subtext0;
    }

    /* Search results */
    .search-page > .search-results > div > :nth-child(2) > li {
      border-bottom: 1px solid @surface0;
    }

    .search-page > .search-results > div > :nth-child(2) > li > :first-child {
      color: @accent-color;
    }

    .search-page
      > .search-results
      > div
      > :nth-child(2)
      > li.package
      > :nth-child(5)
      > :nth-child(2)
      ul.nav-tabs
      > li
      > a {
      color: @text;
    }

    .search-page
      > .search-results
      > div
      > :nth-child(2)
      > li.package
      > :nth-child(5)
      > :nth-child(2)
      pre {
      color: @text;
      background-color: @mantle;
      border: none;
    }

    .search-page
      > .search-results
      > div
      > :nth-child(2)
      > li.package
      .result-item-show-more {
      background-color: @base;
      color: @text;
    }

    .search-page
      > .search-results
      > div
      > :nth-child(2)
      > li.package
      > :nth-child(3)
      > li {
      color: @text;
    }

    .search-page
      > .search-results
      > div
      > :nth-child(2)
      > li.package
      > :nth-child(5)
      > :nth-child(2)
      div.tab-content {
      border: 1px solid @surface0;
    }

    .search-page
      > .search-results
      > div
      > :nth-child(2)
      > li.option
      > :nth-child(2)
      > div:nth-child(2n)
      pre
      code {
      color: @text;
      background-color: @mantle;
    }

    /* Search sidebar */
    .search-page ul.search-sidebar > li {
      border-color: @surface0;
    }

    .search-page ul.search-sidebar > li > ul > li > a {
      color: @text;
    }

    .search-page ul.search-sidebar > li > ul > li > a:hover {
      background-color: @surface0;
    }

    .search-page ul.search-sidebar > li > ul > li > a.selected {
      color: @crust;
      background-color: @accent-color;
    }

    /* Override sidebar labels (number of packages) */
    .search-sidebar .label,
    .search-sidebar .badge {
      background-color: @surface0;
      color: @text;
      text-shadow: none;
    }

    /* Pager */
    .pager li > a,
    .pager li > span {
      color: @text;
      background-color: @surface0;
      border: none;
      border-radius: 5px;
    }

    .pager li > a:hover,
    .pager li > a:focus {
      background-color: @surface1;
      transition: all;
      transition-duration: 5ms;
    }

    .pager .disabled > a,
    .pager .disabled > a:hover,
    .pager .disabled > a:focus,
    .pager .disabled > span {
      color: @text;
      background-color: @mantle;
      border: none;
      border-radius: 5px;
    }
  }
}