/* Colors follow app/src/styles/globals.css. */
:root {
  --background: #171717;
  --fg: #fff;
  --muted: #262626;
  --muted-fg: #636363;
  --primary: #e5e5e5;
  --border: rgb(255 255 255 / 10%);
  --sidebar: #151414;
  --text-muted: #8c8c8c;
  --font:
    -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui,
    sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  background: #141414 url(bg.png) repeat;
  background-size: 128px;
}

body {
  margin: 0;
  overflow-x: clip;
  background: transparent;
  color: var(--fg);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration-color: #5a5a5a;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-color: currentColor;
}

.icon {
  flex: none;
  border-radius: 11px;
}

/* Stage */

.stage {
  position: relative;
  display: grid;
  flex: 1;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 16px;
}

/* App window: mirrors the app's own Tailwind classes. */

.window {
  position: relative;
  display: flex;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: #141414 url(bg.png) repeat;
  background-size: 128px;
  box-shadow: 0 16px 40px rgb(0 0 0 / 35%);
  font-size: 14px;
  line-height: 20px;
  user-select: none;
}

.window svg {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lights {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 2;
  display: flex;
  gap: 9px;
}

.lights i {
  width: 14px;
  height: 14px;
  border: 0.5px solid rgb(0 0 0 / 20%);
  border-radius: 50%;
  background: #ec6765;
}

.lights i:nth-child(2) {
  background: #ebc33f;
}

.lights i:nth-child(3) {
  background: #65c466;
}

/* Buttons (components/ui/button.tsx) */

.btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 8px 16px;
  border: 0;
  border-radius: 24px;
  background: none;
  color: var(--fg);
  font: 500 14px/20px var(--font);
  white-space: nowrap;
  cursor: default;
}

.btn:has(> svg) {
  padding-inline: 12px;
}

.btn.outline {
  border: 1px solid var(--border);
  background: rgb(23 23 23 / 30%);
  box-shadow: 0 1px 2px rgb(0 0 0 / 5%);
}

.btn.sm {
  height: 28px;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  line-height: 16px;
}

.btn.icon {
  width: 40px;
  padding: 0;
}

.btn.select {
  justify-content: space-between;
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: rgb(23 23 23 / 30%);
  font-weight: 400;
}

.btn.select .chevron {
  opacity: 0.5;
}

.btn.destructive {
  background: rgb(251 44 54 / 60%);
}

.btn.destructive svg {
  color: #fb2c36;
}

.rot90 {
  transform: rotate(90deg);
}

/* Sidebar (components/sidebar/album-list.tsx) */

.sidebar-wrap {
  flex: none;
  width: 22%;
  min-width: 200px;
  max-width: 260px;
  padding: 8px 0 8px 8px;
}

.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 40px 8px 8px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--sidebar);
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 10%);
}

.album {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  padding: 4px 8px 4px 8px;
  border: 2px solid transparent;
  border-radius: 12px;
  transition:
    background 0.1s,
    border-color 0.1s;
}

.album.active {
  background: rgb(255 255 255 / 5%);
}

.album.highlighted {
  border-color: var(--primary);
}

.album.fresh {
  animation: grow 0.15s ease-out;
}

@keyframes grow {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}

.album .thumb {
  flex: none;
  width: 28px;
  height: 28px;
  overflow: hidden;
  border-radius: 8px;
  background: rgb(255 255 255 / 20%) center / cover;
}

.album .name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.album .count {
  color: var(--muted-fg);
}

.new-album {
  width: 100%;
  transition: background 0.15s;
}

.new-album.pressed {
  background: rgb(229 229 229 / 10%);
}

.sidebar-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: auto;
  padding: 0 0 0 8px;
}

.sidebar-bottom .settings {
  width: 32px;
  height: 32px;
  padding: 0;
}

/* Main column (components/media-grid-header.tsx, media-grid.tsx) */

.main {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
}

.grid-header {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px;
  border: 1px solid rgb(255 255 255 / 5%);
  border-radius: 24px;
  background: rgb(23 23 23 / 50%);
  box-shadow: 0 10px 15px -3px rgb(23 23 23 / 20%);
  backdrop-filter: blur(16px);
}

.controls {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.slider {
  position: relative;
  display: flex;
  align-items: center;
  width: 160px;
  height: 36px;
  margin: 0 8px;
}

.slider .track {
  position: relative;
  width: 100%;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--muted);
}

.slider .range {
  position: absolute;
  inset: 0 80% 0 0;
  background: var(--primary);
}

.slider .thumb {
  position: absolute;
  left: 20%;
  transform: translateX(-50%);
  padding: 1px 8px;
  border: 1px solid var(--primary);
  border-radius: 999px;
  background: var(--background);
  font-size: 12px;
  line-height: 16px;
}

.slider .min,
.slider .max {
  position: absolute;
  color: var(--muted-fg);
  font-size: 10px;
  line-height: 1;
}

.slider .min {
  bottom: 2px;
  left: -4px;
}

.slider .max {
  top: 2px;
  right: -10px;
}

.masonry {
  display: flex;
  flex: 1;
  align-items: flex-start;
  min-height: 0;
  overflow: hidden;
  gap: var(--gap);
  --gap: 13.3px;
}

.column {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: var(--gap);
}

.tile {
  position: relative;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 5%);
  border-radius: 6px;
  background: rgb(23 23 23 / 40%);
  box-shadow: 0 1px 3px rgb(0 0 0 / 10%);
  transition: opacity 0.3s;
}

.tile img {
  display: block;
  width: 100%;
}

.tile.lifted {
  opacity: 0.3;
}

.tile.fresh {
  animation: appear 0.35s ease-out;
}

@keyframes appear {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
}

/* Folder on disk */

.disk {
  min-height: 0;
  padding: 16px 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--sidebar);
  font: 12px/20px var(--mono);
}

.disk-title {
  margin-bottom: 4px;
  color: var(--text-muted);
}

.tree {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tree li {
  padding-left: 4px;
  border-radius: 4px;
  white-space: nowrap;
}

.tree .file {
  padding-left: 22px;
  color: #c8c8c8;
}

.tree .folder::before {
  content: "▾ ";
  color: #5a5a5a;
}

.tree .folder.collapsed::before {
  content: "▸ ";
}

.tree .folder span {
  color: #5a5a5a;
}

.tree .fresh {
  animation: flash 1.6s ease-out;
}

@keyframes flash {
  from,
  30% {
    background: rgb(255 255 255 / 14%);
    color: var(--fg);
  }
}

/* Cursor and dragged photo */

.cursor,
.drag-ghost {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

.cursor {
  z-index: 3;
  filter: drop-shadow(0 1px 2px rgb(0 0 0 / 60%));
}

.drag-ghost {
  z-index: 2;
  width: 72px;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 60%);
}

.drag-ghost img {
  display: block;
  width: 100%;
  border-radius: 6px;
}

.drag-ghost span {
  position: absolute;
  top: 100%;
  left: 50%;
  margin-top: 4px;
  padding: 1px 6px;
  transform: translateX(-50%);
  border-radius: 4px;
  background: #2f6fde;
  font: 11px/16px var(--font);
  white-space: nowrap;
}

/* The header controls drop out as the window narrows, like a resized app. */
@media (max-width: 1180px) {
  .slider {
    display: none;
  }
}

@media (max-width: 980px) {
  .grid-header .btn.select,
  .grid-header .btn.icon {
    display: none;
  }
}

@media (max-width: 820px) {
  .stage {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .window {
    height: 256px;
  }

  .sidebar-wrap {
    width: 42%;
    min-width: 0;
  }

  .sidebar-bottom,
  .grid-header .btn.destructive {
    display: none;
  }

  .album {
    gap: 6px;
    padding: 2px 4px;
  }

  .album .thumb {
    width: 24px;
    height: 24px;
  }

  .masonry {
    --gap: 6px;
  }

  .disk {
    padding: 12px 14px;
    font-size: 10.5px;
    line-height: 16px;
  }

  .tree {
    columns: 2;
    column-gap: 8px;
  }

  .tree .file {
    padding-left: 14px;
  }
}

/* The animated cursor belongs to the demo, including during a resize. */
.stage {
  overflow: clip;
}
