// based on:
// https://gitlab.gnome.org/GNOME/libhandy/-/tree/master/src/themes

/**
 * libhandy
 */

// HdyComboRow

popover.combo {
  padding: 8px 0;

  list {
    border-style: none;
    background-color: transparent;

    > row {
      min-height: 32px;
      padding: 0 12px;

      &:not(:last-child) {
        // border-bottom: 1px solid divider($on-surface);
      }
    }
  }

  @each $border in top, bottom {
    overshoot.#{$border} {
      // @include rounded-border($border);
    }
  }

  scrollbar.vertical {
    // padding-top: 2px;
    // padding-bottom: 2px;

    &:dir(ltr) {
      // @include rounded-border(right);
    }

    &:dir(rtl) {
      // @include rounded-border(left);
    }
  }
}

// HdyExpanderRow

row.expander {
  // padding: 0;

  image.expander-row-arrow {
    // @include margin-start(6px);
  }
}

// HdyKeypad

keypad {
  .digit {
    font-size: 200%;
    font-weight: bold;
  }

  .letters {
    font-size: 70%;
  }

  .symbol {
    font-size: 160%;
  }
}

// HdyViewSwitcher

viewswitcher {
  &,
  button {
    // margin: 0;
    // padding: 0;
  }

  button {
    // border-radius: 0;
    // border-top: 0;
    // border-bottom: 0;
    // box-shadow: none;
    // font-size: 1rem;

    // View switcher in a header bar
    headerbar &:not(:checked) {
    }

    // View switcher button
    > stack > box {
      &.narrow {
        // font-size: 0.75rem;
        // padding-top: 7px;
        // padding-bottom: 5px;

        image,
        label {
          // padding-left: 8px;
          // padding-right: 8px;
        }
      }

      &.wide {
        // padding: 8px 12px;

        label {
          &:dir(ltr) {
            // padding-right: 7px;
          }

          &:dir(rtl) {
            // padding-left: 7px;
          }
        }
      }

      label.active {
        // font-weight: bold;
      }
    }

    &.needs-attention {
      > stack > box label {
        // @extend %needs-attention;
      }

      &:checked > stack > box label {
        // animation: none;
        // background-image: none;
      }
    }
  }
}

// HdyViewSwitcherBar

viewswitcherbar actionbar > revealer > box {
  // padding: 0;
}

// Content list

list.content {
  border: 1px solid divider($on-surface);
  background-clip: padding-box;
  background-color: $surface-z1;

  &,
  list {
    // background-color: transparent;
  }

  // Nested rows background
  list.nested > row:not(:active) {
    &:not(:hover):not(:selected),
    &:hover:not(.activatable):not(:selected) {
      // background-color: hdymix($bg_color, $base_color, 0.5);
    }

    &:hover.activatable:not(:selected) {
      // background-color: hdymix($fg_color, $base_color, 0.95);
    }
  }

  > row {
    // Regular rows and expander header rows background
    &:not(.expander):not(:active):not(:hover):not(:selected),
    &:not(.expander):not(:active):hover:not(.activatable):not(:selected),
    &.expander row.header:not(:active):not(:hover):not(:selected),
    &.expander row.header:not(:active):hover:not(.activatable):not(:selected) {
      // background-color: $base_color;
    }

    &:not(.expander):not(:active):hover.activatable:not(:selected),
    &.expander row.header:not(:active):hover.activatable:not(:selected) {
      // background-color: hdymix($fg_color, $base_color, 0.95);
    }

    &,
    list > row {
      // border-color: hdyalpha($borders_color, 0.7);
      // border-style: solid;
      // transition: 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }

    // Top border
    &:not(:first-child) {
      // border-width: 1px 1px 0;
      border-top: 1px solid divider($on-surface);
    }

    // Rounded top
    &:first-child,
    &.expander:first-child row.header,
    &.expander:checked,
    &.expander:checked row.header,
    &.expander:checked + row,
    &.expander:checked + row.expander row.header {
      // @include rounded-border(top);
    }

    // Bottom border
    &:last-child,
    &.checked-expander-row-previous-sibling,
    &.expander:checked {
      // border-width: 1px;
    }

    // Rounded bottom
    &:last-child,
    &.checked-expander-row-previous-sibling,
    &.expander:checked,
    &.expander:not(:checked):last-child row.header,
    &.expander:not(:checked).checked-expander-row-previous-sibling row.header,
    &.expander.empty:checked row.header,
    &.expander list.nested > row:last-child {
      // @include rounded-border(bottom);
    }

    // Add space around expanded rows
    &.expander:checked:not(:first-child),
    &.expander:checked + row {
      // margin-top: 6px;
    }
  }
}

// List button

button.list-button {
}

// Unified window

window.csd.unified:not(.solid-csd):not(.maximized):not(.fullscreen):not(.tiled):not(.tiled-top):not(.tiled-bottom):not(.tiled-left):not(.tiled-right) {
  // Remove the sheen on headerbar...
  headerbar {
    box-shadow: $shadow-z1;

    &.selection-mode {
      // box-shadow: $shadow-z1;
    }
  }

  // ...and add it on the window itself
  > decoration-overlay {
    box-shadow: inset 0 1px highlight($titlebar);
  }

  &,
  > decoration,
  > decoration-overlay {
    border-radius: $corner-radius;
  }
}
