/* Copyright 2015 Sam Hewitt.
*
* This file is part of the Paper GTK theme.
*
* The Paper GTK theme is free software: you can redistribute it
* and/or modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* The Paper GTK theme is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with the Paper GTK theme. If not, see http://www.gnu.org/licenses/.
*/


/******************
 * Linked Buttons *
 ******************/

/* Middle button */
.linked .entry,
.linked .button,
.linked .button:active,
.linked .button:active:hover,
.linked .button:insensitive {
    border-right-width: 0;
    border-left-width: 0;
    border-radius: 0;
}

/* Leftmost button */
.linked .entry:first-child,
.linked .button:first-child,
.linked .button:active:first-child,
.linked .button:active:hover:first-child,
.linked .button:insensitive:first-child {
    border-right-width: 0;
    border-left-width: 1px;
    border-bottom-right-radius: 0;
    border-top-right-radius: 0;
}

/* Rightmost button */
.linked .entry:last-child,
.linked .button:last-child,
.linked .button:active:last-child,
.linked .button:active:hover:last-child,
.linked .button:insensitive:last-child {
    border-right-width: 1px;
    border-left-width: 0;
    border-bottom-left-radius: 0;
    border-top-left-radius: 0;
}

/* Linked single button */
.linked .entry:only-child,
.linked .button:only-child,
.linked .button:active:only-child,
.linked .button:active:hover:only-child,
.linked .button:insensitive:only-child {
    border-right-width: 1px;
    border-left-width: 1px;
    border-radius: 0px;
}

/* Middle button (vertical) */
.linked.vertical .entry,
.linked.vertical .button,
.linked.vertical .button:active,
.linked.vertical .button:active:hover,
.linked.vertical .button:insensitive {
    border-top-width: 0;
    border-bottom-width: 0;
    border-radius: 0;
}

/* Top button (vertical) */
.linked.vertical .entry:first-child,
.linked.vertical .button:first-child,
.linked.vertical .button:active:first-child,
.linked.vertical .button:active:hover:first-child,
.linked.vertical .button:insensitive:first-child {
    border-bottom-width: 0;
    border-radius: 3px 3px 0 0;
}

/* Bottom button (vertical) */
.linked.vertical .entry:last-child,
.linked.vertical .button:last-child,
.linked.vertical .button:active:last-child,
.linked.vertical .button:active:hover:last-child,
.linked.vertical .button:insensitive:last-child {
    border-top-width: 0;
    border-radius: 0 0 3px 3px;
}

/* Linked single button (vertical) */
.linked.vertical .entry:only-child,
.linked.vertical .button:only-child,
.linked.vertical .button:active:only-child,
.linked.vertical .button:active:hover:only-child,
.linked.vertical .button:insensitive:only-child {
    border-top-width: 1px;
    border-bottom-width: 1px;
    border-radius: 0px;
}


/* Images */
.linked.button GtkImage {
    color: @text;
}

.linked.button:active GtkImage,
.linked.button:focus GtkImage,
.linked.button:hover GtkImage {
    color: @selected_foreground;
}

.linked.button:backdrop GtkImage,
.linked.button:backdrop:hover GtkImage,
.linked.button:active:backdrop GtkImage {
    color: @backdrop_text;
    -gtk-image-effect: dim;
}

.linked.button:insensitive GtkImage {
    color: @insensitive_text;
    -gtk-image-effect: dim;
}

.linked.button:insensitive:backdrop GtkImage {
    color: mix(@backdrop_text, @insensitive_text, 0.5);
    -gtk-image-effect: dim;
}

/* Labels */
.linked.button GtkLabel {
    color: @text;
}

.linked.button:active GtkLabel,
.linked.button:focus GtkLabel,
.linked.button:hover GtkLabel {
    color: @selected_foreground;
}

.linked.button:backdrop GtkLabel,
.linked.button:backdrop:hover GtkLabel,
.linked.button:active:backdrop GtkLabel {
    color: @backdrop_text;
}

.linked.button:insensitive GtkLabel {
    color: @insensitive_text;
}

.linked.button:insensitive:backdrop GtkLabel {
    color: mix(@backdrop_text, @insensitive_text, 0.5);
}

/* Labels */
.linked.text-button GtkLabel {
    color: @text;
}

.linked.text-button:focus GtkLabel {
    /*color: shade(@text, 2.0);*/
    color: @text;
}

.linked.text-button:active GtkLabel,
.linked.text-button:hover GtkLabel {
    color: alpha(#000, 0.5);
    /*color: @text;*/
}

.linked.text-button:backdrop GtkLabel,
.linked.text-button:backdrop:hover GtkLabel,
.linked.text-button:active:backdrop GtkLabel {
    color: @backdrop_text;
}

.linked.text-button:insensitive GtkLabel {
    color: @insensitive_text;
}

.linked.text-button:insensitive:backdrop GtkLabel {
    color: mix(@backdrop_text, @insensitive_text, 0.5);
}


/* Images */
.linked.image-button GtkImage {
    color: @text;
}

.linked.image-button:focus GtkImage {
    /*color: shade(@text, 2.0);*/
    color: @text;
}

.linked.image-button:active GtkImage,
.linked.image-button:hover GtkImage {
    color: alpha(#000, 0.5);
    /*color: @text;*/
}

.linked.image-button:backdrop GtkImage,
.linked.image-button:backdrop:hover GtkImage,
.linked.image-button:active:backdrop GtkImage {
    color: @backdrop_text;
}

.linked.image-button:insensitive GtkImage {
    color: @insensitive_text;
}

.linked.image-button:insensitive:backdrop GtkImage {
    color: mix(@backdrop_text, @insensitive_text, 0.5);
}

/* Linked buttons on primary toolbars */

/* Middle button */
.primary-toolbar .button.raised.linked,
.primary-toolbar .button.raised.linked:active,
.primary-toolbar .button.raised.linked:insensitive,
.primary-toolbar .button.raised.linked:backdrop,
.primary-toolbar .button.raised.linked:active:backdrop,
.primary-toolbar .button.raised.linked:focus:backdrop,
.primary-toolbar .button.raised.linked:hover,
.primary-toolbar .linked .entry,
.primary-toolbar .linked .button,
.primary-toolbar .linked .button:active,
.primary-toolbar .linked .button:insensitive,
.primary-toolbar .linked .button:backdrop,
.primary-toolbar .linked .button:active:backdrop,
.primary-toolbar .linked .button:focus:backdrop,
.primary-toolbar .linked .button:hover,
.inline-toolbar.toolbar .button,
.inline-toolbar.toolbar .button:active,
.inline-toolbar.toolbar .button:insensitive,
.inline-toolbar.toolbar .button:backdrop,
.inline-toolbar.toolbar .button:hover,
.inline-toolbar.toolbar .button:active:backdrop,
.inline-toolbar.toolbar .button:backdrop:insensitive,
.inline-toolbar.toolbar GtkToolButton > .button,
.inline-toolbar.toolbar GtkToolButton > .button:active,
.inline-toolbar.toolbar GtkToolButton > .button:insensitive,
.inline-toolbar.toolbar GtkToolButton > .button:backdrop,
.inline-toolbar.toolbar GtkToolButton > .button:backdrop:active,
.inline-toolbar.toolbar GtkToolButton > .button:backdrop:insensitive {
    border-right-width: 0;
    border-left-width: 0;
    border-radius: 0;
}

/* Leftmost button */
.primary-toolbar .button.raised.linked:first-child,
.primary-toolbar .button.raised.linked:active:first-child,
.primary-toolbar .button.raised.linked:insensitive:first-child,
.primary-toolbar .button.raised.linked:backdrop:first-child,
.primary-toolbar .linked .entry:first-child,
.primary-toolbar .linked .button:first-child,
.primary-toolbar .linked .button:active:first-child,
.primary-toolbar .linked .button:insensitive:first-child,
.primary-toolbar .linked .button:backdrop:first-child,
.inline-toolbar.toolbar .button:first-child,
.inline-toolbar.toolbar .button:active:first-child,
.inline-toolbar.toolbar .button:insensitive:first-child,
.inline-toolbar.toolbar .button:backdrop:first-child,
.inline-toolbar.toolbar .button:backdrop:active:first-child,
.inline-toolbar.toolbar .button:backdrop:insensitive:first-child,
.inline-toolbar.toolbar GtkToolButton:first-child > .button,
.inline-toolbar.toolbar GtkToolButton:first-child > .button:active,
.inline-toolbar.toolbar GtkToolButton:first-child > .button:insensitive,
.inline-toolbar.toolbar GtkToolButton:first-child > .button:backdrop,
.inline-toolbar.toolbar GtkToolButton:first-child > .button:backdrop:active,
.inline-toolbar.toolbar GtkToolButton:first-child > .button:backdrop:insensitive {
    border-left-width: 2px;
    border-right-width: 0;
    border-bottom-right-radius: 0;
    border-top-right-radius: 0;
}

/* Rightmost button */
.primary-toolbar .button.raised.linked:last-child,
.primary-toolbar .button.raised.linked:active:last-child,
.primary-toolbar .button.raised.linked:insensitive:last-child,
.primary-toolbar .button.raised.linked:backdrop:last-child,
.primary-toolbar .linked .entry:last-child,
.primary-toolbar .linked .button:last-child,
.primary-toolbar .linked .button:active:last-child,
.primary-toolbar .linked .button:insensitive:last-child,
.primary-toolbar .linked .button:backdrop:last-child,
.inline-toolbar.toolbar .button:last-child,
.inline-toolbar.toolbar .button:active:last-child,
.inline-toolbar.toolbar .button:insensitive:last-child,
.inline-toolbar.toolbar .button:backdrop:last-child,
.inline-toolbar.toolbar .button:backdrop:active:last-child,
.inline-toolbar.toolbar .button:backdrop:insensitive:last-child,
.inline-toolbar.toolbar GtkToolButton:last-child > .button,
.inline-toolbar.toolbar GtkToolButton:last-child > .button:active,
.inline-toolbar.toolbar GtkToolButton:last-child > .button:insensitive,
.inline-toolbar.toolbar GtkToolButton:last-child > .button:backdrop,
.inline-toolbar.toolbar GtkToolButton:last-child > .button:backdrop:active,
.inline-toolbar.toolbar GtkToolButton:last-child > .button:backdrop:insensitive {
    border-left-width: 0;
    border-right-width: 2px;
    border-bottom-left-radius: 0;
    border-top-left-radius: 0;
}

/* Single button */
.inline-toolbar.toolbar .button:only-child,
.inline-toolbar.toolbar .button:active:only-child,
.inline-toolbar.toolbar .button:insensitive:only-child,
.inline-toolbar.toolbar .button:backdrop:only-child,
.inline-toolbar.toolbar .button:backdrop:active:only-child,
.inline-toolbar.toolbar .button:backdrop:insensitive:only-child,
.inline-toolbar.toolbar GtkToolButton:only-child > .button,
.inline-toolbar.toolbar GtkToolButton:only-child > .button:active,
.inline-toolbar.toolbar GtkToolButton:only-child > .button:insensitive,
.inline-toolbar.toolbar GtkToolButton:only-child > .button:backdrop,
.inline-toolbar.toolbar GtkToolButton:only-child > .button:backdrop:active,
.inline-toolbar.toolbar GtkToolButton:only-child > .button:backdrop:insensitive {
    border-right-width: 2px;
    border-left-width: 2px;
    border-radius: 3px;
}

/* Special-case GtkMenuToolButton, since it's a GtkToolButton, but it
 * has a box inside to pack the button and the actual menu */
.inline-toolbar.toolbar GtkMenuToolButton .button:first-child,
.inline-toolbar.toolbar GtkMenuToolButton .button:active:first-child,
.inline-toolbar.toolbar GtkMenuToolButton .button:insensitive:first-child,
.inline-toolbar.toolbar GtkMenuToolButton .button:backdrop:first-child,
.inline-toolbar.toolbar GtkMenuToolButton .button:backdrop:insensitive:first-child,
.inline-toolbar.toolbar GtkMenuToolButton .button:last-child,
.inline-toolbar.toolbar GtkMenuToolButton .button:active:last-child,
.inline-toolbar.toolbar GtkMenuToolButton .button:insensitive:last-child,
.inline-toolbar.toolbar GtkMenuToolButton .button:backdrop:last-child,
.inline-toolbar.toolbar GtkMenuToolButton .button:backdrop:insensitive:last-child {
    border-right-width: 0;
    border-left-width: 0;
    border-radius: 0;
}

.inline-toolbar.toolbar GtkMenuToolButton:first-child .button:first-child,
.inline-toolbar.toolbar GtkMenuToolButton:first-child .button:active:first-child,
.inline-toolbar.toolbar GtkMenuToolButton:first-child .button:insensitive:first-child,
.inline-toolbar.toolbar GtkMenuToolButton:first-child .button:backdrop:first-child,
.inline-toolbar.toolbar GtkMenuToolButton:first-child .button:backdrop:insensitive:first-child {
    border-left-width: 2px;
    border-right-width: 0;
    border-bottom-right-radius: 0;
    border-top-right-radius: 0;
}

.inline-toolbar.toolbar GtkMenuToolButton:last-child .button:last-child,
.inline-toolbar.toolbar GtkMenuToolButton:last-child .button:active:last-child,
.inline-toolbar.toolbar GtkMenuToolButton:last-child .button:insensitive:last-child,
.inline-toolbar.toolbar GtkMenuToolButton:last-child .button:backdrop:last-child,
.inline-toolbar.toolbar GtkMenuToolButton:last-child .button:backdrop:insensitive:last-child {
    border-left-width: 0;
    border-right-width: 2px;
    border-bottom-left-radius: 0;
    border-top-left-radius: 0;
}

/* Vertical inline toolbars */

/* Middle button */
.inline-toolbar.toolbar.vertical .button,
.inline-toolbar.toolbar.vertical .button:active,
.inline-toolbar.toolbar.vertical .button:insensitive,
.inline-toolbar.toolbar.vertical .button:backdrop,
.inline-toolbar.toolbar.vertical .button:backdrop:active,
.inline-toolbar.toolbar.vertical .button:backdrop:insensitive,
.inline-toolbar.toolbar.vertical GtkToolButton > .button,
.inline-toolbar.toolbar.vertical GtkToolButton > .button:active,
.inline-toolbar.toolbar.vertical GtkToolButton > .button:insensitive,
.inline-toolbar.toolbar.vertical GtkToolButton > .button:backdrop,
.inline-toolbar.toolbar.vertical GtkToolButton > .button:backdrop:active,
.inline-toolbar.toolbar.vertical GtkToolButton > .button:backdrop:insensitive {
    border-bottom-width: 0;
    border-top-width: 0;
    border-radius: 0;
}

/* Topmost button */
.inline-toolbar.toolbar.vertical .button:first-child,
.inline-toolbar.toolbar.vertical .button:active:first-child,
.inline-toolbar.toolbar.vertical .button:insensitive:first-child,
.inline-toolbar.toolbar.vertical .button:backdrop:first-child,
.inline-toolbar.toolbar.vertical .button:backdrop:active:first-child,
.inline-toolbar.toolbar.vertical .button:backdrop:insensitive:first-child,
.inline-toolbar.toolbar.vertical GtkToolButton:first-child > .button,
.inline-toolbar.toolbar.vertical GtkToolButton:first-child > .button:active,
.inline-toolbar.toolbar.vertical GtkToolButton:first-child > .button:insensitive,
.inline-toolbar.toolbar.vertical GtkToolButton:first-child > .button:backdrop,
.inline-toolbar.toolbar.vertical GtkToolButton:first-child > .button:backdrop:active,
.inline-toolbar.toolbar.vertical GtkToolButton:first-child > .button:backdrop:insensitive {
    border-width: 1px 1px 0 1px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

/* Bottommost button */
.inline-toolbar.toolbar.vertical .button:last-child,
.inline-toolbar.toolbar.vertical .button:active:last-child,
.inline-toolbar.toolbar.vertical .button:insensitive:last-child,
.inline-toolbar.toolbar.vertical .button:backdrop:last-child,
.inline-toolbar.toolbar.vertical .button:backdrop:active:last-child,
.inline-toolbar.toolbar.vertical .button:backdrop:insensitive:last-child,
.inline-toolbar.toolbar.vertical GtkToolButton:last-child > .button,
.inline-toolbar.toolbar.vertical GtkToolButton:last-child > .button:active,
.inline-toolbar.toolbar.vertical GtkToolButton:last-child > .button:insensitive,
.inline-toolbar.toolbar.vertical GtkToolButton:last-child > .button:backdrop,
.inline-toolbar.toolbar.vertical GtkToolButton:last-child > .button:backdrop:active,
.inline-toolbar.toolbar.vertical GtkToolButton:last-child > .button:backdrop:insensitive {
    border-width: 0 1px 2px 1px;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

/* Single button */
.inline-toolbar.toolbar.vertical .button:only-child,
.inline-toolbar.toolbar.vertical .button:active:only-child,
.inline-toolbar.toolbar.vertical .button:insensitive:only-child,
.inline-toolbar.toolbar.vertical .button:backdrop:only-child,
.inline-toolbar.toolbar.vertical .button:backdrop:active:only-child,
.inline-toolbar.toolbar.vertical .button:backdrop:insensitive:only-child,
.inline-toolbar.toolbar.vertical GtkToolButton:only-child > .button,
.inline-toolbar.toolbar.vertical GtkToolButton:only-child > .button:active,
.inline-toolbar.toolbar.vertical GtkToolButton:only-child > .button:insensitive,
.inline-toolbar.toolbar.vertical GtkToolButton:only-child > .button:backdrop,
.inline-toolbar.toolbar.vertical GtkToolButton:only-child > .button:backdrop:active,
.inline-toolbar.toolbar.vertical GtkToolButton:only-child > .button:backdrop:insensitive {
    border-top-width: 1px;
    border-bottom-width: 2px;
    border-radius: 3px;
}

/* Middle button */
.linked .entry,
.linked .button,
.linked .button:active,
.linked .button:backdrop,
.linked .button:active:hover,
.linked .button:insensitive {
    border-right-width: 0;
    border-left-width: 0;
    border-radius: 0;
}

/* Leftmost button */
.linked .entry:first-child,
.linked .button:first-child,
.linked .button:active:first-child,
.linked .button:active:hover:first-child,
.linked .button:insensitive:first-child {
    border-right-width: 0;
    border-left-width: 1px;
    border-bottom-right-radius: 0;
    border-top-right-radius: 0;
}

/* Rightmost button */
.linked .entry:last-child,
.linked .button:last-child,
.linked .button:active:last-child,
.linked .button:active:hover:last-child,
.linked .button:insensitive:last-child {
    border-right-width: 1px;
    border-left-width: 0;
    border-bottom-left-radius: 0;
    border-top-left-radius: 0;
}

/* Linked single button */
.linked .entry:only-child,
.linked .button:only-child,
.linked .button:active:only-child,
.linked .button:active:hover:only-child,
.linked .button:insensitive:only-child {
    border-right-width: 1px;
    border-left-width: 1px;
    border-radius: 0px;
}

/* Middle button (vertical) */
.linked.vertical .entry,
.linked.vertical .button,
.linked.vertical .button:active,
.linked.vertical .button:active:hover,
.linked.vertical .button:insensitive {
    border-top-width: 0;
    border-bottom-width: 0;
    border-radius: 0;
}

/* Top button (vertical) */
.linked.vertical .entry:first-child,
.linked.vertical .button:first-child,
.linked.vertical .button:active:first-child,
.linked.vertical .button:active:hover:first-child,
.linked.vertical .button:insensitive:first-child {
    border-bottom-width: 0;
    border-radius: 3px 3px 0 0;
}

/* Bottom button (vertical) */
.linked.vertical .entry:last-child,
.linked.vertical .button:last-child,
.linked.vertical .button:active:last-child,
.linked.vertical .button:active:hover:last-child,
.linked.vertical .button:insensitive:last-child {
    border-top-width: 0;
    border-radius: 0 0 3px 3px;
}

/* Linked single button (vertical) */
.linked.vertical .entry:only-child,
.linked.vertical .button:only-child,
.linked.vertical .button:active:only-child,
.linked.vertical .button:active:hover:only-child,
.linked.vertical .button:insensitive:only-child {
    border-top-width: 1px;
    border-bottom-width: 1px;
    border-radius: 0px;
}
/* Linked buttons on primary toolbars */

/* Middle button */
.primary-toolbar .button.raised.linked,
.primary-toolbar .button.raised.linked:active,
.primary-toolbar .button.raised.linked:insensitive,
.primary-toolbar .button.raised.linked:backdrop,
.primary-toolbar .linked .entry,
.primary-toolbar .linked .button,
.primary-toolbar .linked .button:active,
.primary-toolbar .linked .button:insensitive,
.primary-toolbar .linked .button:backdrop,
.inline-toolbar.toolbar .button,
.inline-toolbar.toolbar .button:active,
.inline-toolbar.toolbar .button:insensitive,
.inline-toolbar.toolbar .button:backdrop,
.inline-toolbar.toolbar .button:backdrop:active,
.inline-toolbar.toolbar .button:backdrop:insensitive,
.inline-toolbar.toolbar GtkToolButton > .button,
.inline-toolbar.toolbar GtkToolButton > .button:active,
.inline-toolbar.toolbar GtkToolButton > .button:insensitive,
.inline-toolbar.toolbar GtkToolButton > .button:backdrop,
.inline-toolbar.toolbar GtkToolButton > .button:backdrop:active,
.inline-toolbar.toolbar GtkToolButton > .button:backdrop:insensitive {
    border-right-width: 0;
    border-left-width: 0;
    border-radius: 0;
}

/* Leftmost button */
.primary-toolbar .button.raised.linked:first-child,
.primary-toolbar .button.raised.linked:active:first-child,
.primary-toolbar .button.raised.linked:insensitive:first-child,
.primary-toolbar .button.raised.linked:backdrop:first-child,
.primary-toolbar .linked .entry:first-child,
.primary-toolbar .linked .button:first-child,
.primary-toolbar .linked .button:active:first-child,
.primary-toolbar .linked .button:insensitive:first-child,
.primary-toolbar .linked .button:backdrop:first-child,
.inline-toolbar.toolbar .button:first-child,
.inline-toolbar.toolbar .button:active:first-child,
.inline-toolbar.toolbar .button:insensitive:first-child,
.inline-toolbar.toolbar .button:backdrop:first-child,
.inline-toolbar.toolbar .button:backdrop:active:first-child,
.inline-toolbar.toolbar .button:backdrop:insensitive:first-child,
.inline-toolbar.toolbar GtkToolButton:first-child > .button,
.inline-toolbar.toolbar GtkToolButton:first-child > .button:active,
.inline-toolbar.toolbar GtkToolButton:first-child > .button:insensitive,
.inline-toolbar.toolbar GtkToolButton:first-child > .button:backdrop,
.inline-toolbar.toolbar GtkToolButton:first-child > .button:backdrop:active,
.inline-toolbar.toolbar GtkToolButton:first-child > .button:backdrop:insensitive {
    border-left-width: 2px;
    border-right-width: 0;
    border-bottom-right-radius: 0;
    border-top-right-radius: 0;
}

/* Rightmost button */
.primary-toolbar .button.raised.linked:last-child,
.primary-toolbar .button.raised.linked:active:last-child,
.primary-toolbar .button.raised.linked:insensitive:last-child,
.primary-toolbar .button.raised.linked:backdrop:last-child,
.primary-toolbar .linked .entry:last-child,
.primary-toolbar .linked .button:last-child,
.primary-toolbar .linked .button:active:last-child,
.primary-toolbar .linked .button:insensitive:last-child,
.primary-toolbar .linked .button:backdrop:last-child,
.inline-toolbar.toolbar .button:last-child,
.inline-toolbar.toolbar .button:active:last-child,
.inline-toolbar.toolbar .button:insensitive:last-child,
.inline-toolbar.toolbar .button:backdrop:last-child,
.inline-toolbar.toolbar .button:backdrop:active:last-child,
.inline-toolbar.toolbar .button:backdrop:insensitive:last-child,
.inline-toolbar.toolbar GtkToolButton:last-child > .button,
.inline-toolbar.toolbar GtkToolButton:last-child > .button:active,
.inline-toolbar.toolbar GtkToolButton:last-child > .button:insensitive,
.inline-toolbar.toolbar GtkToolButton:last-child > .button:backdrop,
.inline-toolbar.toolbar GtkToolButton:last-child > .button:backdrop:active,
.inline-toolbar.toolbar GtkToolButton:last-child > .button:backdrop:insensitive {
    border-left-width: 0;
    border-right-width: 2px;
    border-bottom-left-radius: 0;
    border-top-left-radius: 0;
}

/* Single button */
.inline-toolbar.toolbar .button:only-child,
.inline-toolbar.toolbar .button:active:only-child,
.inline-toolbar.toolbar .button:insensitive:only-child,
.inline-toolbar.toolbar .button:backdrop:only-child,
.inline-toolbar.toolbar .button:backdrop:active:only-child,
.inline-toolbar.toolbar .button:backdrop:insensitive:only-child,
.inline-toolbar.toolbar GtkToolButton:only-child > .button,
.inline-toolbar.toolbar GtkToolButton:only-child > .button:active,
.inline-toolbar.toolbar GtkToolButton:only-child > .button:insensitive,
.inline-toolbar.toolbar GtkToolButton:only-child > .button:backdrop,
.inline-toolbar.toolbar GtkToolButton:only-child > .button:backdrop:active,
.inline-toolbar.toolbar GtkToolButton:only-child > .button:backdrop:insensitive {
    border-right-width: 2px;
    border-left-width: 2px;
    border-radius: 3px;
}

/* Special-case GtkMenuToolButton, since it's a GtkToolButton, but it
 * has a box inside to pack the button and the actual menu */
.inline-toolbar.toolbar GtkMenuToolButton .button:first-child,
.inline-toolbar.toolbar GtkMenuToolButton .button:active:first-child,
.inline-toolbar.toolbar GtkMenuToolButton .button:insensitive:first-child,
.inline-toolbar.toolbar GtkMenuToolButton .button:backdrop:first-child,
.inline-toolbar.toolbar GtkMenuToolButton .button:backdrop:insensitive:first-child,
.inline-toolbar.toolbar GtkMenuToolButton .button:last-child,
.inline-toolbar.toolbar GtkMenuToolButton .button:active:last-child,
.inline-toolbar.toolbar GtkMenuToolButton .button:insensitive:last-child,
.inline-toolbar.toolbar GtkMenuToolButton .button:backdrop:last-child,
.inline-toolbar.toolbar GtkMenuToolButton .button:backdrop:insensitive:last-child {
    border-right-width: 0;
    border-left-width: 0;
    border-radius: 0;
}

.inline-toolbar.toolbar GtkMenuToolButton:first-child .button:first-child,
.inline-toolbar.toolbar GtkMenuToolButton:first-child .button:active:first-child,
.inline-toolbar.toolbar GtkMenuToolButton:first-child .button:insensitive:first-child,
.inline-toolbar.toolbar GtkMenuToolButton:first-child .button:backdrop:first-child,
.inline-toolbar.toolbar GtkMenuToolButton:first-child .button:backdrop:insensitive:first-child {
    border-left-width: 2px;
    border-right-width: 0;
    border-bottom-right-radius: 0;
    border-top-right-radius: 0;
}

.inline-toolbar.toolbar GtkMenuToolButton:last-child .button:last-child,
.inline-toolbar.toolbar GtkMenuToolButton:last-child .button:active:last-child,
.inline-toolbar.toolbar GtkMenuToolButton:last-child .button:insensitive:last-child,
.inline-toolbar.toolbar GtkMenuToolButton:last-child .button:backdrop:last-child,
.inline-toolbar.toolbar GtkMenuToolButton:last-child .button:backdrop:insensitive:last-child {
    border-left-width: 0;
    border-right-width: 2px;
    border-bottom-left-radius: 0;
    border-top-left-radius: 0;
}

/* Vertical inline toolbars */

/* Middle button */
.inline-toolbar.toolbar.vertical .button,
.inline-toolbar.toolbar.vertical .button:active,
.inline-toolbar.toolbar.vertical .button:insensitive,
.inline-toolbar.toolbar.vertical .button:backdrop,
.inline-toolbar.toolbar.vertical .button:backdrop:active,
.inline-toolbar.toolbar.vertical .button:backdrop:insensitive,
.inline-toolbar.toolbar.vertical GtkToolButton > .button,
.inline-toolbar.toolbar.vertical GtkToolButton > .button:active,
.inline-toolbar.toolbar.vertical GtkToolButton > .button:insensitive,
.inline-toolbar.toolbar.vertical GtkToolButton > .button:backdrop,
.inline-toolbar.toolbar.vertical GtkToolButton > .button:backdrop:active,
.inline-toolbar.toolbar.vertical GtkToolButton > .button:backdrop:insensitive {
    border-bottom-width: 0;
    border-top-width: 0;
    border-radius: 0;
}

/* Topmost button */
.inline-toolbar.toolbar.vertical .button:first-child,
.inline-toolbar.toolbar.vertical .button:active:first-child,
.inline-toolbar.toolbar.vertical .button:insensitive:first-child,
.inline-toolbar.toolbar.vertical .button:backdrop:first-child,
.inline-toolbar.toolbar.vertical .button:backdrop:active:first-child,
.inline-toolbar.toolbar.vertical .button:backdrop:insensitive:first-child,
.inline-toolbar.toolbar.vertical GtkToolButton:first-child > .button,
.inline-toolbar.toolbar.vertical GtkToolButton:first-child > .button:active,
.inline-toolbar.toolbar.vertical GtkToolButton:first-child > .button:insensitive,
.inline-toolbar.toolbar.vertical GtkToolButton:first-child > .button:backdrop,
.inline-toolbar.toolbar.vertical GtkToolButton:first-child > .button:backdrop:active,
.inline-toolbar.toolbar.vertical GtkToolButton:first-child > .button:backdrop:insensitive {
    border-width: 1px 1px 0 1px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

/* Bottommost button */
.inline-toolbar.toolbar.vertical .button:last-child,
.inline-toolbar.toolbar.vertical .button:active:last-child,
.inline-toolbar.toolbar.vertical .button:insensitive:last-child,
.inline-toolbar.toolbar.vertical .button:backdrop:last-child,
.inline-toolbar.toolbar.vertical .button:backdrop:active:last-child,
.inline-toolbar.toolbar.vertical .button:backdrop:insensitive:last-child,
.inline-toolbar.toolbar.vertical GtkToolButton:last-child > .button,
.inline-toolbar.toolbar.vertical GtkToolButton:last-child > .button:active,
.inline-toolbar.toolbar.vertical GtkToolButton:last-child > .button:insensitive,
.inline-toolbar.toolbar.vertical GtkToolButton:last-child > .button:backdrop,
.inline-toolbar.toolbar.vertical GtkToolButton:last-child > .button:backdrop:active,
.inline-toolbar.toolbar.vertical GtkToolButton:last-child > .button:backdrop:insensitive {
    border-width: 0 1px 2px 1px;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

/* Single button */
.inline-toolbar.toolbar.vertical .button:only-child,
.inline-toolbar.toolbar.vertical .button:active:only-child,
.inline-toolbar.toolbar.vertical .button:insensitive:only-child,
.inline-toolbar.toolbar.vertical .button:backdrop:only-child,
.inline-toolbar.toolbar.vertical .button:backdrop:active:only-child,
.inline-toolbar.toolbar.vertical .button:backdrop:insensitive:only-child,
.inline-toolbar.toolbar.vertical GtkToolButton:only-child > .button,
.inline-toolbar.toolbar.vertical GtkToolButton:only-child > .button:active,
.inline-toolbar.toolbar.vertical GtkToolButton:only-child > .button:insensitive,
.inline-toolbar.toolbar.vertical GtkToolButton:only-child > .button:backdrop,
.inline-toolbar.toolbar.vertical GtkToolButton:only-child > .button:backdrop:active,
.inline-toolbar.toolbar.vertical GtkToolButton:only-child > .button:backdrop:insensitive {
    border-top-width: 1px;
    border-bottom-width: 2px;
    border-radius: 3px;
}