/* Adwaita look for Strata: shapes, spacing and neutral states modelled on
   libadwaita 1.6+ and Nautilus. Install as ~/.config/strata/style.css and pair
   with the "Adwaita" or "Adwaita Dark" theme. Only @strata_* colors are used,
   so it works with both variants. */

/* ---------------------------------------------------------------- Window */

window.csd {
  border-radius: 12px;
  box-shadow: 0 1px 3px 1px alpha(black, 0.09),
              0 2px 14px 5px alpha(black, 0.05),
              0 0 0 1px alpha(black, 0.05);
}

window.csd:backdrop {
  box-shadow: 0 2px 14px 5px alpha(black, 0.03),
              0 0 0 1px alpha(black, 0.05);
}

window.csd.maximized,
window.csd.fullscreen,
window.csd.tiled,
window.csd.tiled-top,
window.csd.tiled-right,
window.csd.tiled-bottom,
window.csd.tiled-left {
  border-radius: 0;
  box-shadow: none;
}

/* ---------------------------------------------------------- Shared shapes */

button,
entry,
spinbutton,
modelbutton.flat {
  border-radius: 6px;
}

popover > contents,
.breadcrumb-popover contents,
.peek-popover,
.appearance-popover contents {
  border-radius: 12px;
  box-shadow: 0 1px 5px 1px alpha(black, 0.09),
              0 2px 14px 3px alpha(black, 0.05);
}

.peek-popover .column-header {
  border-radius: 12px 12px 0 0;
}

tooltip {
  border-radius: 9px;
}

check {
  border-radius: 6px;
}

/* Libadwaita focus ring */
button:focus-visible,
entry:focus-visible,
switch:focus-visible,
row:focus-visible,
flowboxchild:focus-visible {
  outline: 2px solid alpha(@strata_accent, 0.5);
  outline-offset: -2px;
}

/* ---------------------------------------------------------------- Header */

/* Strata has one header across sidebar and content; Adwaita draws a
   single-pane header in the view color with a hairline below. */
headerbar,
headerbar.browser-header,
.tab-strip {
  background: @strata_bg;
}

headerbar.browser-header {
  min-height: 47px;
}

headerbar .sidebar-toggle {
  color: @strata_text;
}

/* Flat header buttons: neutral hover/press like .flat in libadwaita */
headerbar .sidebar-toggle,
button.header-action,
headerbar menubutton.header-action > button,
.location-action,
.copy-path {
  border-radius: 6px;
  min-height: 34px;
  min-width: 34px;
  transition: background 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

headerbar .sidebar-toggle:hover,
button.header-action:hover,
headerbar menubutton.header-action > button:hover,
button.header-action.active,
.location-action:hover,
.copy-path:hover {
  background: alpha(@strata_text, 0.07);
}

headerbar .sidebar-toggle:active,
button.header-action:active,
headerbar menubutton.header-action > button:active,
headerbar menubutton.header-action > button:checked,
.location-action:active {
  background: alpha(@strata_text, 0.16);
  transform: none;
}

.header-actions {
  border-spacing: 2px;
  padding-right: 8px;
}

/* Close button: circular window control. It is the last visible header
   action whenever Close is shown (GNOME's default button layout). */
.header-actions > button.header-action:last-child {
  background: transparent;
  margin-left: 6px;
  min-width: 24px;
  min-height: 24px;
  padding: 5px;
}

.header-actions > button.header-action:last-child image {
  background: alpha(@strata_text, 0.10);
  border-radius: 999px;
  padding: 4px;
  -gtk-icon-size: 16px;
}

.header-actions > button.header-action:last-child:hover image {
  background: alpha(@strata_text, 0.15);
}

.header-actions > button.header-action:last-child:active image {
  background: alpha(@strata_text, 0.30);
}

/* -------------------------------------------------------------- Path bar */

/* GTK CSS has no max-width or percentages, so the path bar (and the location
   entry that replaces it) is shortened by a fixed gap before the header
   buttons instead. Lower it if tiled windows leave the bar too short. */
.location-control {
  margin-right: 400px;
}

/* Nautilus' rounded path bar */
.breadcrumb-container {
  background: alpha(@strata_text, 0.08);
  border-radius: 9px;
  min-height: 34px;
  margin: 0 6px;
  padding: 0 6px;
}

.breadcrumb-fade-left {
  background: linear-gradient(to right, mix(@strata_bg, @strata_text, 0.08), alpha(mix(@strata_bg, @strata_text, 0.08), 0));
  border-radius: 9px 0 0 9px;
}

.breadcrumb-fade-right {
  background: linear-gradient(to left, mix(@strata_bg, @strata_text, 0.08), alpha(mix(@strata_bg, @strata_text, 0.08), 0));
  border-radius: 0 9px 9px 0;
}

.breadcrumb,
.breadcrumbs,
.breadcrumb-container .breadcrumb-fade {
  min-height: 28px;
}

.breadcrumb {
  border-radius: 6px;
  color: alpha(@strata_text, 0.6);
  font-weight: 700;
  padding: 0 8px;
}

.breadcrumb:hover {
  background: alpha(@strata_text, 0.07);
  color: @strata_text;
}

.breadcrumb:not(.current):active {
  background: alpha(@strata_text, 0.16);
  transform: none;
}

.breadcrumb.current,
.breadcrumb.current:hover,
.breadcrumb.current:disabled {
  background: transparent;
  color: @strata_text;
}

.breadcrumb-separator,
.breadcrumb.breadcrumb-root {
  color: alpha(@strata_text, 0.4);
  font-size: 1em;
  margin: 0 4px;
}

.location-entry,
.location-entry:focus,
.location-entry:focus-visible,
.location-entry:focus-within {
  background: alpha(@strata_text, 0.08);
  border: none;
  border-radius: 9px;
  box-shadow: none;
  min-height: 34px;
  padding: 0 9px;
}

.location-entry:focus,
.location-entry:focus-visible,
.location-entry:focus-within {
  outline: 2px solid alpha(@strata_accent, 0.5);
  outline-offset: -2px;
}

.location-entry selection,
.inline-rename selection {
  background: alpha(@strata_accent, 0.25);
  color: @strata_text;
}

/* ---------------------------------------------------------------- Tabs */

/* AdwTabBar: rounded tabs, neutral selection */
.tab-strip {
  min-height: 40px;
  padding: 0 3px;
}

.browser-tab {
  border-radius: 9px;
  margin: 3px 2px;
  padding: 0 4px 0 0;
  transition: background 200ms ease-out;
}

.browser-tab.active,
.browser-tab.hovered,
.browser-tab.drag-hovered {
  color: @strata_text;
}

.browser-tab.hovered {
  background: alpha(@strata_text, 0.05);
}

.browser-tab.active {
  background: alpha(@strata_text, 0.10);
}

.tab-strip .tab-select {
  font-weight: 400;
  opacity: 0.85;
  padding: 3px 8px 3px 12px;
}

.browser-tab.active .tab-select {
  font-weight: 700;
}

.tab-strip .tab-close {
  border-radius: 999px;
}

.tab-strip .tab-close:hover:not(:disabled) {
  background: alpha(@strata_text, 0.10);
}

.tab-indicator,
.tab-key-hint {
  color: @strata_text;
}

.tab-key-hint {
  background: alpha(@strata_text, 0.10);
  border-radius: 6px;
}

/* -------------------------------------------------------------- Sidebar */

.sidebar {
  padding: 6px;
}

.sidebar-row,
.sidebar-device {
  border-radius: 6px;
}

.sidebar-row {
  min-height: 34px;
}

.sidebar-row:hover,
.sidebar-device:hover {
  background: alpha(@strata_text, 0.07);
}

/* .navigation-sidebar selection: neutral, no accent underline */
.sidebar-row.active,
.sidebar-row.active:hover,
.sidebar-device.active,
.sidebar-device.active:hover {
  background: alpha(@strata_text, 0.10);
  background-image: none;
  color: @strata_text;
}

.sidebar-row image,
.sidebar-row.active image,
.sidebar-device.active .sidebar-row image {
  color: @strata_text;
}

.sidebar-row:focus,
.sidebar-device.focused {
  outline-color: transparent;
}

.sidebar-row:focus-visible,
.sidebar-device > .sidebar-row:focus-visible {
  outline: 2px solid alpha(@strata_accent, 0.5);
  outline-offset: -2px;
}

.sidebar-eject:hover,
.sidebar-device-action:hover {
  background: alpha(@strata_text, 0.10);
}

.sidebar-heading {
  color: alpha(@strata_text, 0.55);
  font-size: 0.85em;
  padding-left: 6px;
}

.sidebar-separator {
  background: alpha(@strata_text, 0.15);
  margin: 6px 6px;
}

.sidebar-update:hover {
  background: alpha(@strata_text, 0.07);
}

/* ------------------------------------------------------ Pane and columns */

.mode-pane-header {
  background: @strata_bg;
  box-shadow: none;
}

.list-headings {
  background: @strata_bg;
  border-bottom: none;
  color: alpha(@strata_text, 0.4);
  font-size: 0.9em;
}

.list-heading-cell {
  border-right: none;
}

.list-heading-button {
  border-radius: 6px;
  color: alpha(@strata_text, 0.4);
}

.list-heading-button:hover {
  background: alpha(@strata_text, 0.07);
  color: @strata_text;
}

.list-heading-button:active {
  background: alpha(@strata_text, 0.16);
  color: @strata_text;
  transform: none;
}

/* Miller columns: quiet titles, no accent bar */
.column-header,
.active-column .column-header {
  background: transparent;
  border-top-color: transparent;
  border-bottom: 1px solid alpha(@strata_text, 0.10);
}

.column-header {
  color: alpha(@strata_text, 0.55);
}

.directory-column:focus-within .column-header,
.active-column .column-header {
  color: @strata_text;
}

.column-resize-handle {
  border-right-color: alpha(@strata_text, 0.10);
}

button.column-header-action,
menubutton.column-header-action > button,
.list-navigation-button {
  border-radius: 6px;
}

button.column-header-action:hover,
button.column-header-action:checked,
menubutton.column-header-action > button:hover,
menubutton.column-header-action > button:checked,
.list-navigation-button:hover:not(:disabled) {
  background: alpha(@strata_text, 0.07);
  color: @strata_text;
}

button.column-header-action:active,
menubutton.column-header-action > button:active,
.list-navigation-button:active {
  background: alpha(@strata_text, 0.16);
  color: @strata_text;
  transform: none;
}

/* ------------------------------------------------------------ File rows */

.file-list row,
.file-list-mode row,
.file-row,
.list-row,
.list-row.drop-destination,
.list-row:drop(active) {
  border-radius: 8px;
}

.file-list-mode row {
  margin: 1px 12px;
}

.file-list row:hover:not(:selected),
.file-list-mode row:hover:not(:selected),
.file-list row:hover .file-row.active-path {
  background: alpha(@strata_text, 0.05);
}

.file-list row:selected,
.file-list-mode row:selected,
.preview-archive-list row:selected,
.directory-column:not(:focus-within) .file-list:not(.context-selection) row:selected,
.file-list-mode:not(:focus-within):not(.context-selection) row:selected,
.keyboard-navigation .file-list row:selected:hover,
.keyboard-navigation .file-list-mode row:selected:hover {
  background: alpha(@strata_accent, 0.15);
}

.file-list row:selected:hover,
.file-list-mode row:selected:hover,
.directory-column:not(:focus-within) .file-list:not(.context-selection) row:selected:hover,
.file-list-mode:not(:focus-within):not(.context-selection) row:selected:hover {
  background: alpha(@strata_accent, 0.20);
}

/* Path leading to the open column */
.file-list .file-row.active-path {
  background: alpha(@strata_text, 0.06);
}

.file-list .file-row.active-path.active-parent,
.file-list row:hover .file-row.active-path.active-parent,
.directory-column:not(:focus-within) .file-list row:selected .file-row.active-parent {
  background: alpha(@strata_accent, 0.15);
}

/* Keyboard cursor: Nautilus' grey rounded ring */
.file-list-mode row:focus-visible,
.keyboard-navigation .file-list-mode row:focus-within,
.keyboard-navigation .file-list:focus-within .file-row.keyboard-cursor:not(.filter-result) {
  outline: 2px solid alpha(@strata_text, 0.3);
  outline-offset: -2px;
}

.file-size,
.file-list .file-row.active-path .file-size {
  background: transparent;
}

.file-chevron {
  opacity: 0.4;
}

.inline-rename {
  background: @strata_bg;
  border: none;
  border-radius: 6px;
  box-shadow: none;
  outline: 2px solid alpha(@strata_accent, 0.5);
  outline-offset: -2px;
}

.inline-rename:focus,
.inline-rename:focus-visible,
.inline-rename:focus-within {
  box-shadow: none;
}

.file-marquee,
.file-icons rubberband,
.file-list-mode rubberband {
  background: alpha(@strata_accent, 0.2);
  border: 1px solid @strata_accent;
  border-radius: 6px;
}

/* --------------------------------------------------------------- Icons */

.icons-card,
.icons-card-icon-frame {
  border-radius: 12px;
}

.icons-card-label {
  border-radius: 6px;
}

.file-icons > child .icons-card.content-hover .icons-card-label,
.file-icons > child:hover:not(:selected) .icons-card-icon-frame {
  background: alpha(@strata_text, 0.05);
}

.file-icons > child:selected .icons-card-icon-frame,
.keyboard-navigation .file-icons > child:selected .icons-card.content-hover .icons-card-icon-frame {
  background: alpha(@strata_accent, 0.15);
  outline: none;
}

.file-icons > child:selected .icons-card.content-hover .icons-card-icon-frame {
  background: alpha(@strata_accent, 0.20);
}

.file-icons > child:selected .icons-card-label,
.file-icons > child:selected:hover .icons-card-label,
.file-icons > child:selected .icons-card.content-hover .icons-card-label {
  background: @strata_accent;
  color: @strata_bg;
}

.keyboard-navigation .file-icons > child:focus-visible .icons-card-icon-frame {
  outline: 2px solid alpha(@strata_text, 0.3);
}

.type-group-heading {
  border-bottom: none;
  color: alpha(@strata_text, 0.55);
  font-size: 0.9em;
}

/* ---------------------------------------------------------- Chrome icons */

/* Strata renders its interface icons as textures in the accent color, which
   CSS colors can't reach. Desaturating them gives Adwaita's neutral symbolic
   look: blue #0461be turns dark grey, light blue #81d0ff turns light grey.
   File and folder icons in the listing keep their color, like Nautilus. */
.sidebar-row image,
.sidebar-device image,
headerbar image,
.tab-strip image,
.column-header image,
.mode-pane-header image,
.list-navigation-button image,
.preview-header-action image,
.location-action image,
.copy-path image {
  -gtk-icon-filter: grayscale(1);
}

/* ------------------------------------------------------------ Status bar */

.shortcut-footer {
  background: @strata_bg;
  border-top: 1px solid alpha(@strata_text, 0.10);
  color: alpha(@strata_text, 0.55);
}

.shortcut-footer-paste {
  color: @strata_text;
  background-color: alpha(@strata_text, 0.08);
  border: none;
}

/* ------------------------------------------------------------ Scrollbars */

/* Libadwaita overlay scrollbars: grey pill, wider when hovered */
scrollbar > range > trough,
scrollbar:hover > range > trough,
scrollbar.hovering > range > trough,
scrollbar.dragging > range > trough {
  background: transparent;
  border-radius: 999px;
}

scrollbar > range > trough > slider {
  background: alpha(@strata_text, 0.2);
  border-radius: 999px;
}

scrollbar:hover > range > trough > slider,
scrollbar.hovering > range > trough > slider {
  background: alpha(@strata_text, 0.4);
}

scrollbar.dragging > range > trough > slider,
scrollbar > range > trough > slider:active {
  background: alpha(@strata_text, 0.6);
}

/* ---------------------------------------------------------- Controls */

/* Libadwaita switch */
switch {
  background: alpha(@strata_text, 0.15);
  border: none;
  border-radius: 999px;
  padding: 3px;
}

switch:checked {
  background: @strata_accent;
  border: none;
}

switch slider,
switch:checked slider {
  background: white;
  border-radius: 999px;
  box-shadow: 0 2px 4px alpha(black, 0.2);
  margin: 0;
  min-width: 20px;
  min-height: 20px;
}

/* ---------------------------------------------------------- Dialogs */

.settings-dialog,
.action-dialog,
.search-dialog {
  border-radius: 15px;
}

.settings-navigation {
  border-radius: 14px 0 0 14px;
}

.settings-navigation button {
  border-radius: 6px;
}

.settings-navigation button.settings-nav-active {
  background: alpha(@strata_text, 0.10);
}

.settings-navigation button:hover {
  background: alpha(@strata_text, 0.07);
}
