/* ===========================
   Windows
   =========================== */
.windows {
  position: relative;
  z-index: 1;
}

.window {
  position: fixed;
  left: var(--win-left, 10vw);
  top: var(--win-top, 10vh);
  width: var(--win-w, 600px);
  height: var(--win-h, 500px);
  max-width: calc(100vw - 2rem);
  max-height: calc(100vh - var(--nav-height) - 2rem);
  display: flex;
  flex-direction: column;
  background: var(--xp-face);
  border: 1px solid var(--xp-titlebar-dark);
  border-radius: 8px 8px 0 0;
  box-shadow:
    inset 0 0 0 1px var(--xp-titlebar-pale),
    0 8px 24px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  z-index: var(--win-z, 10);
}

.window[hidden] {
  display: none;
}

.window__titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 0.4rem;
  padding: 5px 5px 5px 6px;
  min-height: 30px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
  background: linear-gradient(
    to right,
    var(--xp-titlebar-dark) 0%,
    var(--xp-titlebar-mid) 10%,
    var(--xp-titlebar-light) 46%,
    var(--xp-titlebar-mid) 82%,
    var(--xp-titlebar-pale) 100%
  );
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.window__titlebar[data-drag-handle] {
  cursor: grab;
  touch-action: none;
}

.window__titlebar[data-drag-handle]:active {
  cursor: grabbing;
}

.window__titlebar-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  background-image: var(--icon-url);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.25));
}

.window__title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.window__controls {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.window__btn {
  width: 26px;
  height: 23px;
  flex-shrink: 0;
  border-radius: 3px;
  border: 1px solid #0A246A;
  background: linear-gradient(to bottom, #6DA8FA 0%, #3E7FE0 45%, #1D53B8 50%, #4886E8 100%);
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.65),
    inset -1px -1px 0 rgba(0, 0, 0, 0.25);
  cursor: pointer;
  position: relative;
}

.window__btn:hover {
  filter: brightness(1.1);
}

.window__btn:active {
  filter: brightness(0.85);
  box-shadow:
    inset 1px 1px 2px rgba(0, 0, 0, 0.4);
}

.window__btn:disabled {
  background: linear-gradient(to bottom, #C9CDD4 0%, #9FA3AC 100%);
  border-color: #7C7F87;
  cursor: default;
  pointer-events: none;
}

.window__btn:disabled::before,
.window__btn:disabled::after {
  opacity: 0.55;
}

.window__btn--minimize::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 6px;
  width: 11px;
  height: 2.5px;
  background: #fff;
  transform: translateX(-50%);
}

.window__btn--maximize::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 11px;
  height: 10px;
  border: 1.5px solid #fff;
  border-top-width: 3px;
  box-sizing: border-box;
  transform: translate(-50%, -50%);
}

.window__btn--close {
  background: linear-gradient(to bottom, #F3A99C 0%, #E8604C 45%, #C53B28 50%, #EF7A63 100%);
  border-color: #7A1C10;
}

.window__btn--close::before,
.window__btn--close::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 13px;
  height: 2.5px;
  background: #fff;
}

.window__btn--close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.window__btn--close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.window__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 1.5rem 1.75rem;
}

#window-hero .window__body {
  padding: 0;
}

#window-resume .window__body {
  padding: 0;
}

.resume-viewer__frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.window--fullscreen {
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  border-radius: 0;
  z-index: 900;
}

.window--fullscreen .window__body--scroll {
  padding: 0;
  overflow-y: auto;
}

.window--maximized {
  left: 0 !important;
  top: 0 !important;
  width: 100vw !important;
  height: calc(100vh - var(--nav-height)) !important;
  max-width: none !important;
  max-height: none !important;
  border-radius: 0 !important;
}

.window--maximized .window__titlebar[data-drag-handle] {
  cursor: default;
  touch-action: auto;
}

.window__resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  touch-action: none;
  z-index: 5;
}

.window__resize-handle::before {
  content: '';
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 8px;
  height: 8px;
  background-image: repeating-linear-gradient(
    135deg,
    var(--xp-bevel-dark) 0,
    var(--xp-bevel-dark) 1px,
    transparent 1px,
    transparent 3px
  );
}

.window--maximized .window__resize-handle,
.window--fullscreen .window__resize-handle {
  display: none;
}

@media (max-width: 768px) {
  .window {
    left: 0 !important;
    top: 0 !important;
    width: 100vw !important;
    height: calc(100vh - var(--nav-height)) !important;
    max-width: none;
    max-height: none;
    border-radius: 0;
  }

  .window__titlebar[data-drag-handle] {
    cursor: default;
    touch-action: auto;
  }

  .window__resize-handle {
    display: none;
  }
}
