/* ============================================================
   iyoahsOS — window manager chrome
   ============================================================ */

.windows {
  position: fixed;
  inset: 0;
  z-index: var(--z-windows);
  pointer-events: none;
}

.win {
  position: fixed;
  display: flex;
  flex-direction: column;
  min-width: 320px;
  min-height: 220px;
  background: var(--paper);
  border: var(--px) solid var(--line);
  box-shadow: 7px 7px 0 var(--shadow);
  pointer-events: auto;
  animation: win-open .16s steps(3);
  will-change: transform;
}

@keyframes win-open {
  0% { opacity: 0; transform: scale(.965) translateY(8px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.win.is-closing {
  animation: win-close .12s steps(2) forwards;
  pointer-events: none;
}

@keyframes win-close {
  to { opacity: 0; transform: scale(.97) translateY(6px); }
}

.win__bar {
  height: 34px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px 0 9px;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: var(--accent-ink);
  border-bottom: 2px solid var(--line);
  user-select: none;
  cursor: grab;
  touch-action: none;
}

.win__bar:active {
  cursor: grabbing;
}

.win:not(.is-focused) .win__bar {
  filter: saturate(.5) brightness(.94);
}

.win__icon {
  width: 18px;
  height: 18px;
  flex: none;
  display: grid;
  place-items: center;
  color: currentColor;
}

.win__icon svg {
  width: 18px;
  height: 18px;
}

.win__title {
  flex: 1;
  min-width: 0;
  font-family: var(--font-en);
  font-size: 9px;
  line-height: 1.4;
  letter-spacing: .02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, .35);
}

.win__title em {
  font-style: normal;
  font-family: var(--font-zh);
  font-size: 11px;
  opacity: .8;
  margin-left: 7px;
}

.win__ctrls {
  display: flex;
  gap: 3px;
  flex: none;
}

.win__btn {
  width: 25px;
  height: 23px;
  display: grid;
  place-items: center;
  background: var(--paper-2);
  color: var(--ink);
  border: 2px solid var(--line);
  box-shadow: inset 2px 2px 0 var(--hi), inset -2px -2px 0 var(--lo);
  font-family: var(--font-en);
  font-size: 8px;
  line-height: 1;
}

.win__btn:hover {
  background: var(--paper-3);
}

.win__btn:active {
  box-shadow: inset -2px -2px 0 var(--hi), inset 2px 2px 0 var(--lo);
}

.win__btn[data-act="close"]:hover {
  background: var(--err);
  color: #fff;
}

.win__body {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--paper);
}

.win__body > * {
  height: 100%;
}

.win.is-focused {
  box-shadow: 9px 9px 0 var(--shadow), 0 0 0 3px var(--accent-3);
}

.win.is-minimized {
  display: none;
}

.win__resize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
  touch-action: none;
  background:
    repeating-linear-gradient(135deg,
      transparent 0 4px,
      var(--line) 4px 5px,
      transparent 5px 8px);
  opacity: .5;
  z-index: 2;
}

.win__resize:hover {
  opacity: .9;
}

/* window with no chrome border (used by the room) */
.win--plain .win__body {
  background: var(--paper);
}

@media (max-width: 760px) {
  .win {
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: calc(100% - var(--taskbar-h)) !important;
    min-width: 0;
    min-height: 0;
    border-left: 0;
    border-right: 0;
    border-top: 0;
    box-shadow: none;
    animation: sheet-up .2s var(--ease);
  }

  @keyframes sheet-up {
    from { opacity: .4; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .win__bar {
    height: 46px;
    padding-left: 12px;
    cursor: default;
    touch-action: auto;
  }

  .win__title {
    font-size: 10px;
  }

  .win__btn {
    width: 36px;
    height: 32px;
    font-size: 10px;
  }

  .win__resize {
    display: none;
  }

  .win.is-focused {
    box-shadow: none;
  }

  body.sheet-open .desk-icons,
  body.sheet-open .desk-brand,
  body.sheet-open .desk-note,
  body.sheet-open .sun-spot {
    display: none;
  }
}
