@font-face {
  font-family: 'Geneva';
  src:
    url('assets/Geneva.ttf') format('truetype');
  font-display: swap;
}

html {
  background-color: black;
  width: 100%;
  height: 100%;
}

body {
  font-family: monospace;
  display:flex;
  flex-direction:column;
  margin: 0px;
  background-color: gainsboro;
  color: black;
  height: 100dvh;
  width: 100%;
  max-width: 100vw;
  overflow: hidden;
  overscroll-behavior: none;
}

html, body {
  overscroll-behavior: none;
  overflow-x: hidden;
}

a { 
  color:black; 
}

#debug-hud {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.7);
  color: #0f0;
  font: 11px monospace;
  padding: 6px 8px;
  pointer-events: none;
  white-space: pre;
}

#bar {
  position: relative;
  width: 100%;
  max-width: 100%;
  background-color: blue;
  height: 32px;
  padding-top: env(safe-area-inset-top);
  z-index: 99;
}

#bar-menu {
  position: absolute;   /* change from fixed */

  font-size:11px;
  font-family: monospace;

  background-color: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(2px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);

  padding: 6px 0;
  border-radius: 0px;

  display: flex;
  flex-direction: column;
  gap: 6px;

  z-index: 999;
}

#bar-menu[hidden] {
  display: none !important;
}

#file-menu {
  /*position: fixed;*/

  padding-top: 8px;
  padding-bottom: 8px;

  font-size:11px;
  font-family: monospace;
  
  position: absolute;
  color: black;

  background-color: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(2px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);

  border-radius: 0px;
  z-index: 9999;
  overflow: hidden;

  display: flex;
  flex-direction: column;
  gap: 6px; /* spacing between items */
}

#file-menu[hidden] {
  display: none !important;
}

.menu-item {
  position: relative;
  width:100px;
  padding: 2px 6px;
  cursor: pointer;
  white-space: nowrap;
  margin-left:6px;
  margin-right:6px;
}

.menu-item:has(.submenu-item)::after {
  content: "";
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 6px solid currentColor;
}

.menu-item:hover {

  background-color: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color:white;
  border-radius:99px;
}

.submenu-item {
  position: absolute;
  top: 0;
  left: 100%;

  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(2px);
  padding: 6px;
  border-radius: 0px;

  display: none;
  grid-template-columns: repeat(3, 20px);
  gap: 6px;

  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.menu-item:hover .submenu-item {
  display: grid;
}

.bg-menu {
  position: fixed;

  font-size:11px;
  font-family: monospace;

  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(2px);
  padding: 6px;
  border-radius: 0px;

  padding: 6px;
  z-index: 9999;
}

.bg-menu div {
  padding: 6px 12px;
  cursor: pointer;
}

.bg-menu div:hover {
  background: #333;
}

.swatch {
  height: 16px;
  position: relative;
  cursor: pointer;
  border: 1px solid white;
  box-shadow:0 0px 1px rgba(0,0,0,0.8);
}

.swatch[data-color="none"] {
  background: repeating-linear-gradient(
    45deg,
    #666,
    #666 4px,
    #999 4px,
    #999 8px
  );
}

.swatch:hover .label {
  opacity: 1;
}

#name {
  font-family: 'Arial Narrow', sans-serif;
  font-size: 18px;
  letter-spacing: 0.4px;
  height: 100%;
  display: flex;
  align-items: center;
  border: none;
  background: none;
  color: white;
  padding: 8px;
  position: absolute;
  left: 0;
}

#desktop {
  position:relative;
  box-sizing: border-box;
  height: calc(100vh - 32px);
  overflow: hidden;
  -webkit-user-select: none;
}

.file-icon {
  position: absolute;
  cursor: default;
  user-select: none;
  touch-action: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  outline: none;
  -webkit-tap-highlight-color: transparent; /* fixes weird box! */
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  border-radius:100%;
}

.thumb-wrap {
  width: 40px;
  height: 40px;

  display: flex;
  align-items: center;
  justify-content: center;
}


/* blue focus ring */
.file-icon:focus-visible > .file-name {
  box-shadow: 0 0 0 2px rgba(0, 120, 255, 0.75);
  border-radius:99px;
}
.file-icon:focus-visible .thumb-wrap {
  box-shadow: 0 0 0 2px rgba(0, 120, 255, 0.75);
  border-radius: 0px;
}


.thumb-wrap, 
.file-icon .file-name,
.dock .pet {
  user-select: none;
  -webkit-user-select: none;   /* disable text selection */
  -webkit-touch-callout: none; /* disable context menu on long-press */
}

.file-icon.dragging-lift .thumb-wrap {
  transform: translateY(-5px) scale(1.05);
  transition: transform 0.1s ease;
}

.file-icon.dragging-lift > .file-name {
  transform: translateY(-5px) scale(1.05);
  transition: transform 0.1s ease; 

  background-color: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  border-radius: 99px;

  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.thumb-wrap img {
  display: block;
  max-width: 100%;
  max-height: 100%;

  object-fit: contain;

  border: 1px white solid;
  box-shadow:0 0px 1px rgba(0,0,0,0.8);

  vertical-align: middle;
  z-index:101;
}

.file-audio img {
  width: 100%;
}


.sc-file img {
  width: 40px;
}

.player-window {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #222;
  padding: 12px;
  border-radius: 12px;
}

.file-name {
  display: inline-block;

  color:white;
  text-shadow:0 0px 6px rgba(0,0,0,0.9);

  font-size: 11px;
  max-width: 150px; 

  text-align: center;
  white-space: nowrap;
  word-break: break-word;

  overflow-wrap: anywhere;

  padding: 2px 6px;
}

.file-name.editing {
  max-width: none;      /* remove clamp */
  white-space: nowrap; /* keep one line */
  width: auto;
}

.file-name.editing:focus {
  border-radius: 50px;
}

.dock {
  position: absolute;
  background-color: none;
  display: flex;
  align-items: center;
  z-index:98;
  bottom: 8px;
  padding: 0px;
  gap: 10px;

  left: 50%;
  transform: translateX(-50%);
  border-radius:16px;
}

.dock button {
  background: none;
  padding: 12px;
  margin: 12px;
  cursor: pointer;
  border: none;
  border-radius:12px;
  box-shadow: none;
}

.pet {
  width: 32px;
  height: 32px;
  transform: scale(1.5);
  background-image: url("assets/cat.png");
  background-repeat: no-repeat;
  background-size: auto;
  image-rendering: pixelated;
  pointer-events: none;
}

.dock-item {
  position: relative;
  touch-action: manipulation;
  transform-origin: center bottom;
}

.label {
  font-family: monospace;
  font-size: 11px;
  position: absolute;

  color:white;
  text-shadow:0 0.5px 1px rgba(0,0,0,0.8);

  background-color: rgba(0, 0, 0, 0.9);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);

  line-height: 1;
  padding-left: 6px;
  padding-right: 6px;
  padding-top: 4px;
  padding-bottom: 4px;
  border-radius:3px;
  bottom: calc(100% + 4px);
  pointer-events: none;
  opacity: 0;
  white-space:nowrap;
  left: 50%;
  transform: translateX(-50%);
  z-index:999;
}

.label::after {
  content: "";
  position: absolute;
  top: 100%;   /* place below label */
  left: 50%;
  transform: translateX(-50%);
  /* classic triangle shape */
  width: 0;
  height: 0;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
  border-top: 5px solid rgba(0, 0, 0, 0.9);
  opacity: inherit;  /* inherit the fade from the label */
}

.label.is-visible {
  opacity: 1;
}
