/* Marz-OS Shell — compositor-friendly browser animations */

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.marz-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
  background: currentColor;
  -webkit-mask: var(--marz-icon, url('/marz-icons/mdi/help-circle.svg')) center / contain no-repeat;
  mask: var(--marz-icon, url('/marz-icons/mdi/help-circle.svg')) center / contain no-repeat;
}

body.marz-os {
  font-family: var(--marz-font-display);
  background: var(--marz-bg);
  color: var(--marz-fg);
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  isolation: isolate;
}
body.marz-os.no-animations *,
body.marz-os.no-animations *::before,
body.marz-os.no-animations *::after,
html[data-animations='false'] body.marz-os *,
html[data-animations='false'] body.marz-os *::before,
html[data-animations='false'] body.marz-os *::after {
  animation-duration: 1ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 1ms !important;
}

/* Appearance panel — the remove control on an installed theme, and the status
   line the theme importer writes into. */
.marz-theme-remove {
  margin-left: auto;
  align-self: flex-start;
  padding: 0 4px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.2;
  opacity: 0.5;
  cursor: pointer;
}
.marz-theme-remove:hover,
.marz-theme-remove:focus-visible {
  opacity: 1;
  color: var(--marz-urgent);
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}
.marz-theme-status {
  min-height: 14px;
  font-family: var(--marz-font);
  font-size: 11px;
  opacity: 0.75;
}
.marz-theme-status[data-tone='error'] {
  color: var(--marz-urgent);
  opacity: 1;
}
.marz-theme-status[data-tone='ok'] {
  color: var(--marz-ok);
  opacity: 1;
}

/* Accent buttons are shared by theme and plugin installation. Keeping this in
   the shell stylesheet makes every `Button({ variant: 'accent' })` identical,
   including buttons rendered by a plugin panel rather than the bar. */
.marz-btn-accent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border: 0;
  border-radius: 8px;
  background: var(--marz-accent);
  color: var(--marz-accent-contrast);
  font: 600 12px var(--marz-font);
  cursor: pointer;
  transition:
    filter var(--dur-fast) var(--ease-hypr),
    transform var(--dur-fast) var(--ease-spring);
}
.marz-btn-accent:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}
.marz-btn-accent:active {
  transform: scale(0.97);
}
.marz-btn-accent:disabled {
  cursor: wait;
  opacity: 0.6;
}

/* Layout primitives (core/UI.js Row / Column / Grid).
 *
 * These defaults live here rather than in inline styles so a plugin's own
 * stylesheet can still lay out an element the primitives built. Anything the
 * caller passes explicitly is inlined and outranks both. */
.marz-row,
.marz-column {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
}
.marz-row {
  flex-direction: row;
}
.marz-column {
  flex-direction: column;
  align-items: stretch;
}
.marz-grid {
  display: grid;
  gap: 6px;
  align-items: stretch;
}

/* Static WebP wallpaper. The image is intentionally not animated. */
#marz-wallpaper {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background-color: var(--marz-bg);
  /* An installed theme may bring its own wallpaper; the shipped image is the
     fallback, so a theme without one changes nothing here. */
  background-image: var(--marz-wallpaper, url('/images/background.webp'));
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}
/* Desktop stage */
#marz-stage {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}
#marz-stage > * {
  pointer-events: auto;
}
#marz-stage:focus {
  outline: none;
}


/* Windows — Hyprland-inspired tiling/floating animation. Browser compositing is implementation-dependent. */
.marz-window {
  position: absolute;
  box-sizing: border-box;
  min-width: 0;
  min-height: 0;
  background: var(--marz-bg-window);
  border: 1px solid var(--marz-border-strong);
  border-radius: var(--marz-corner);
  box-shadow: var(--marz-shadow-window);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  contain: layout paint style;
  will-change: transform, opacity;
  /* Hyprland window open: scale 0.96 + fade */
  transition:
    transform var(--dur-normal) var(--ease-hypr),
    opacity var(--dur-normal) var(--ease-hypr),
    box-shadow var(--dur-fast) var(--ease-hypr),
    border-color var(--dur-fast) var(--ease-hypr);
  transform-origin: center center;
}
.marz-window.entering {
  transform: scale(0.96) translateZ(0);
  opacity: 0;
}
.marz-window.entered {
  transform: scale(1) translateZ(0);
  opacity: 1;
}
.marz-window.closing {
  transform: scale(0.96) translateZ(0);
  opacity: 0;
  pointer-events: none;
}
.marz-window.focused {
  border-color: rgba(var(--marz-accent-rgb), 0.52);
  box-shadow:
    var(--marz-shadow-window),
    0 0 0 1px rgba(var(--marz-accent-rgb), 0.2);
}
.marz-window.focused .marz-window-header {
  border-bottom-color: rgba(var(--marz-accent-rgb), 0.28);
}
.marz-window.maximized {
  border-radius: 0;
  border-color: transparent;
}
.marz-window[data-gesture='move'],
.marz-window[data-gesture='swap'] {
  cursor: grabbing;
}
.marz-window[data-gesture='resize'] {
  cursor: nwse-resize;
}
/* A tiled window being dragged onto another slot lifts off the layout. */
.marz-window[data-gesture='swap'] {
  opacity: 0.92;
  box-shadow:
    var(--marz-shadow-window),
    0 0 0 2px rgba(var(--marz-accent-rgb), 0.45);
}
/* ...and the tiles it displaces slide into their new slots rather than
   teleporting. Only set while a swap gesture is in flight, so an ordinary
   reflow or a drag commit still lands instantly. */
.marz-window[data-tiling='animated'] {
  transition:
    left var(--dur-normal) var(--ease-hypr),
    top var(--dur-normal) var(--ease-hypr),
    width var(--dur-normal) var(--ease-hypr),
    height var(--dur-normal) var(--ease-hypr),
    transform var(--dur-normal) var(--ease-hypr),
    opacity var(--dur-normal) var(--ease-hypr),
    box-shadow var(--dur-fast) var(--ease-hypr),
    border-color var(--dur-fast) var(--ease-hypr);
}

.marz-window-header {
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--marz-border);
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.marz-window-header:active {
  cursor: grabbing;
}
.marz-window-title {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.marz-win-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.06);
  color: var(--marz-fg-muted);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-hypr);
  font-size: 10px;
}
.marz-win-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--marz-fg);
  transform: scale(1.08);
}
.marz-win-btn.close:hover {
  background: var(--marz-urgent);
  color: var(--marz-accent-contrast);
  border-color: var(--marz-urgent);
}
.marz-win-btn.max:hover {
  background: var(--marz-accent);
  color: var(--marz-accent-contrast);
  border-color: var(--marz-accent);
}

.marz-window-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  position: relative;
  background: var(--marz-bg-window);
}
.marz-window:focus-visible {
  outline: 2px solid var(--marz-accent);
  outline-offset: -2px;
}
.marz-window[hidden] {
  display: none !important;
}
.marz-window-body iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: white;
}

/* Resize handles stay inside the clipped window so they work reliably. */
.marz-resize {
  position: absolute;
  z-index: 3;
  touch-action: none;
}
.marz-resize.n {
  top: 0;
  left: 8px;
  right: 8px;
  height: 6px;
  cursor: ns-resize;
}
.marz-resize.ne {
  top: 0;
  right: 0;
  width: 10px;
  height: 10px;
  cursor: nesw-resize;
}
.marz-resize.e {
  right: 0;
  top: 8px;
  bottom: 8px;
  width: 6px;
  cursor: ew-resize;
}
.marz-resize.se {
  right: 0;
  bottom: 0;
  width: 12px;
  height: 12px;
  cursor: nwse-resize;
}
.marz-resize.s {
  bottom: 0;
  left: 8px;
  right: 8px;
  height: 6px;
  cursor: ns-resize;
}
.marz-resize.sw {
  left: 0;
  bottom: 0;
  width: 10px;
  height: 10px;
  cursor: nesw-resize;
}
.marz-resize.w {
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 6px;
  cursor: ew-resize;
}
.marz-resize.nw {
  top: 0;
  left: 0;
  width: 10px;
  height: 10px;
  cursor: nwse-resize;
}

/* Panels / popovers — OSD like */
.marz-panel {
  position: fixed;
  z-index: 200;
  max-width: calc(100vw - 20px);
  max-height: calc(100vh - var(--marz-exclusive-top) - 20px);
  background: var(--marz-bg-panel);
  backdrop-filter: blur(var(--marz-blur)) saturate(1.2);
  -webkit-backdrop-filter: blur(var(--marz-blur)) saturate(1.2);
  border: 1px solid rgba(var(--marz-accent-rgb), 0.42);
  border-radius: var(--marz-corner);
  box-shadow:
    var(--marz-shadow),
    0 0 0 1px rgba(var(--marz-accent-rgb), 0.1);
  overflow: hidden;
  contain: layout paint style;
  transform: translateX(var(--panel-x, 0));
  transform-origin: top center;
  animation: panelIn var(--dur-normal) var(--ease-hypr);
  will-change: transform, opacity;
}
@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateX(var(--panel-x, 0)) translateY(-8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateX(var(--panel-x, 0)) translateY(0) scale(1);
  }
}
@keyframes panelOut {
  from {
    opacity: 1;
    transform: translateX(var(--panel-x, 0)) translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateX(var(--panel-x, 0)) translateY(-8px) scale(0.98);
  }
}
.marz-panel.closing {
  animation: panelOut var(--dur-fast) var(--ease-hypr) forwards;
}

.marz-panel-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid rgba(var(--marz-accent-rgb), 0.24);
}
.marz-panel-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--marz-fg-muted);
}
.marz-panel-body {
  padding: 12px 16px 16px;
  overflow: auto;
}
.marz-appearance-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 2px 0 8px;
  color: var(--marz-fg-muted);
  font-family: var(--marz-font);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.marz-appearance-label span {
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0;
  opacity: 0.65;
  text-transform: none;
}
.marz-mode-grid,
.marz-theme-grid {
  display: grid;
  gap: 6px;
}
.marz-mode-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 16px;
}
.marz-theme-grid {
  grid-template-columns: 1fr 1fr;
}
.marz-mode-choice,
.marz-theme-choice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--marz-border);
  border-radius: var(--marz-corner-sm);
  background: rgba(255, 255, 255, 0.04);
  color: var(--marz-fg);
  cursor: pointer;
  text-align: left;
  transition:
    border-color var(--dur-fast) var(--ease-hypr),
    background var(--dur-fast) var(--ease-hypr),
    transform var(--dur-fast) var(--ease-spring);
}
.marz-mode-choice:hover,
.marz-theme-choice:hover {
  border-color: rgba(var(--marz-accent-rgb), 0.55);
  background: rgba(var(--marz-accent-rgb), 0.08);
  transform: translateY(-1px);
}
.marz-mode-choice.selected,
.marz-theme-choice.selected {
  border-color: var(--marz-accent);
  background: rgba(var(--marz-accent-rgb), 0.14);
  box-shadow: 0 0 0 1px rgba(var(--marz-accent-rgb), 0.12) inset;
}
.marz-choice-icon {
  flex: 0 0 auto;
  font-size: 17px;
  line-height: 1;
}
.marz-mode-choice b,
.marz-theme-choice b {
  display: block;
  font-size: 11px;
  line-height: 1.2;
}
.marz-mode-choice small,
.marz-theme-choice small {
  display: block;
  margin-top: 4px;
  color: var(--marz-fg-muted);
  font-size: 9px;
  line-height: 1.35;
}
.marz-theme-choice small em {
  color: var(--marz-accent);
  font-style: normal;
  text-transform: capitalize;
}
.marz-panel button:focus-visible,
.marz-panel input:focus-visible,
.marz-ws-btn:focus-visible,
.marz-dock-app:focus-visible {
  outline: 2px solid var(--marz-accent);
  outline-offset: 2px;
}

/* Dock styles live with the marz.dock plugin (plugins/dock/dock.css). */

.marz-welcome-logo {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(var(--marz-accent-rgb), 0.26), rgba(252, 181, 181, 0.18));
  border: 1px solid rgba(var(--marz-accent-rgb), 0.3);
  box-shadow: 0 0 18px rgba(var(--marz-accent-rgb), 0.15);
  overflow: hidden;
}
.marz-welcome-logo img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  image-rendering: pixelated;
}
/* Workspace dots */
.marz-ws {
  display: flex;
  gap: 4px;
  padding: 2px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 999px;
  border: 1px solid var(--marz-border);
}
.marz-ws-btn {
  min-width: 28px;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-family: var(--marz-font);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  color: var(--marz-fg-muted);
  transition: all var(--dur-fast) var(--ease-hypr);
}
.marz-ws-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--marz-fg);
}
/* The active workspace carries the shell's standard emphasis — the accent
   pair — because fg-on-bg can drop near the bar's own colors on user themes
   (Omarchy imports especially), and then nothing on the bar reads as
   "selected". Occupied stays a plain outline. */
.marz-ws-btn.active {
  background: var(--marz-accent);
  color: var(--marz-accent-contrast);
  border-color: transparent;
  box-shadow: 0 0 10px rgba(var(--marz-accent-rgb), 0.4);
}
.marz-ws-btn.occupied:not(.active) {
  color: var(--marz-fg-strong);
  border-color: var(--marz-accent);
}

/* Utilities */
.marz-hidden {
  display: none !important;
}
.marz-divider {
  height: 1px;
  background: var(--marz-border);
  margin: 8px 0;
}
.marz-kbd {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--marz-border);
  font-family: var(--marz-font);
  font-size: 10px;
}
.tray-divider {
  width: 1px;
  height: 12px;
  background: var(--marz-border);
}
.marz-hint {
  position: fixed;
  left: 12px;
  bottom: 12px;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  max-width: calc(100vw - 24px);
  padding: 8px 10px;
  border: 1px solid var(--marz-border);
  border-radius: 999px;
  background: var(--marz-bg-panel);
  backdrop-filter: blur(12px);
  color: var(--marz-fg-muted);
  font-family: var(--marz-font);
  font-size: 10px;
}
.marz-hint a {
  margin-left: 6px;
  color: var(--marz-accent);
  text-decoration: none;
}

/* Lite mode — weak-hardware overrides (ShellHost detectLiteMode / marz:lite).
   Overrides only: the originals above stay untouched and win whenever the
   attribute is absent. */
[data-lite='true'] .marz-panel,
[data-lite='true'] .marz-hint {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: var(--marz-bg-elevated);
  box-shadow: none;
  border: 1px solid var(--marz-border);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .marz-window,
  .marz-panel {
    transition: none !important;
    animation: none !important;
  }
}
@media (max-width: 640px) {
}
@media (max-width: 520px) {
  .marz-panel {
    left: 10px !important;
    right: 10px !important;
    width: auto !important;
    transform: none !important;
  }
  .marz-hint {
    left: 8px;
    bottom: 8px;
    border-radius: 12px;
    gap: 5px;
  }
  .marz-hint .hint-separator {
    display: none;
  }
}
@media (max-width: 380px) {
  .marz-hint {
    display: none;
  }
}
