/* Drev (views/drive.js) and the ArtCraft editor page (views/drive-editor.js). */

/* At least the workspace's height, so a file dropped below a short list still lands on the page (views/drive.js). */
.drive {
  min-height: 100%;
}

/* Files from the desktop are over the page. */
.drive--dropping {
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
  background: color-mix(in srgb, var(--accent-soft) 40%, transparent);
}

.drive__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.drive__tools {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.drive__search {
  flex: 1;
  min-width: 0;
  max-width: 28rem;
  border-radius: var(--radius-pill);
}

.drive__tools > .btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.drive__views {
  display: flex;
  margin-left: auto;
}

.drive__view[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent-ink-soft);
}

/* Ny's pop-up: a folder or an upload, then the apps. */
.drive-new__choices {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.drive-new__choices .drive__choice {
  width: auto;
  border: 1px solid var(--line);
}

.drive__choice,
.drive-move__folder {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 0;
  border-radius: var(--radius-s);
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.drive__choice:hover,
.drive-move__folder:hover {
  background: var(--hover);
}

.drive__path {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--text-s);
  color: var(--ink-muted);
}

.drive__path li + li::before {
  content: "›";
  margin-right: var(--space-1);
}

.drive__path a,
.drive__path span {
  padding: 2px var(--space-1);
  border-radius: var(--radius-s);
  color: inherit;
}

.drive__path [aria-current] {
  color: var(--ink);
  font-weight: 600;
}

.drive__list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

/* Name, when changed and by whom, size and the row's actions; phones keep the name and the actions. */
.drive__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 14rem 6rem auto;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-1) var(--space-2);
  border-bottom: 1px solid var(--line);
}

.drive__row:hover {
  background: var(--hover);
}

.drive__name {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  padding: var(--space-2) 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.drive__name span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* A kind of file's glyph on a tile of its tone (file-kinds.js); a kind without one of its own stays muted. The tones
   are a step dark enough to hold 3:1 on their tile in the light themes, and mixed toward white in the dark ones. */
.file-icon {
  --tone: var(--ink-muted);
  align-items: center;
  justify-content: center;
  flex: none;
  box-sizing: border-box;
  border-radius: var(--radius-s);
  background: color-mix(in srgb, var(--tone) 14%, transparent);
  color: var(--tone);
}

.ui-icon.file-icon svg {
  width: 100%;
  height: 100%;
}

:root[data-theme="dark"] .file-icon,
:root[data-theme="70s"] .file-icon {
  color: color-mix(in srgb, var(--tone) 60%, white);
}

.file-tone--photocraft { --tone: #db2777; }
.file-tone--wordcraft { --tone: #2563eb; }
.file-tone--gridcraft { --tone: #15803d; }
.file-tone--deckcraft { --tone: #c2410c; }
.file-tone--pdfcraft { --tone: #dc2626; }
.file-tone--vectorcraft { --tone: #b45309; }
.file-tone--designcraft { --tone: #c026d3; }
.file-tone--figcraft { --tone: #7c3aed; }
.file-tone--filmcraft { --tone: #4f46e5; }
.file-tone--effectcraft { --tone: #0e7490; }
.file-tone--lightcraft { --tone: #a16207; }
.file-tone--soundcraft { --tone: #0f766e; }
.file-tone--cadcraft { --tone: #0369a1; }
.file-tone--gif { --tone: #e11d48; }
.file-tone--code { --tone: #475569; }
.file-tone--archive { --tone: #78716c; }

/* 3D is one family: textures, materials and the models they go on. */
.file-tone--texturecraft,
.file-tone--materialcraft,
.file-tone--model {
  --tone: #4d7c0f;
}

.drive__icon {
  width: 28px;
  height: 28px;
  padding: 4px;
}

.drive__meta,
.drive__size {
  color: var(--ink-muted);
  font-size: var(--text-s);
}

.drive__size {
  text-align: right;
}

.drive__actions {
  display: flex;
}

.drive__empty {
  padding: var(--space-5) var(--space-2);
}

/* The grid: a card per item, its kind's tile (or an image's own picture) above the name, size and actions; two
   columns on a phone. */
.drive__list--grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: var(--space-3);
  padding-top: var(--space-3);
  border-top: 0;
}

.drive__list--grid .drive__row {
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-1);
  padding: var(--space-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--surface-raised);
}

.drive__list--grid .drive__name {
  flex-direction: column;
  align-items: stretch;
  padding: 0;
}

.drive__list--grid .drive__icon,
.drive__thumb {
  width: 100%;
  height: 6.5rem;
  border-radius: var(--radius-s);
}

.drive__list--grid .drive__icon {
  padding: 1.9rem;
}

.drive__thumb {
  object-fit: cover;
  background: var(--hover);
}

.drive__list--grid .drive__meta {
  display: none;
}

.drive__list--grid .drive__size {
  display: block;
  min-height: 1lh;
  text-align: left;
}

.drive__list--grid .drive__actions {
  justify-content: space-between;
}

.drive__list--grid .drive__actions .icon-btn {
  width: 28px;
  height: 28px;
}

.drive__list--grid .drive__empty {
  grid-column: 1 / -1;
}

/* Where a dragged row would land. */
.drive__drop {
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
  background: var(--accent-soft);
}

@media (max-width: 819px) {
  .drive__row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .drive__meta,
  .drive__size {
    display: none;
  }
}

.drive-preview {
  display: grid;
  gap: var(--space-3);
}

.drive-preview__image {
  max-width: 100%;
  max-height: 70vh;
  justify-self: center;
  object-fit: contain;
}

.drive-preview__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.drive-move__list {
  margin: 0;
  padding-left: var(--space-5);
  list-style: none;
}

.drive-move__top {
  font-weight: 600;
}

/* The editor fills the workspace under a thin bar. */
.drive-editor__bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  border-bottom: 1px solid var(--line);
}

.drive-editor__status {
  margin: 0 0 0 auto;
  color: var(--ink-muted);
  font-size: var(--text-s);
}

.drive-editor__status--error {
  color: var(--danger);
}

.drive-editor__stage {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
}

.drive-editor__frame {
  flex: 1 1 auto;
  width: 100%;
  min-height: 70vh;
  border: 0;
}

/* Over the app while the file comes in (views/drive-editor.js). */
.drive-editor__cover {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: var(--space-3);
  background: var(--surface);
  color: var(--ink-muted);
}

.drive-editor__cover progress {
  width: min(20rem, 70vw);
  accent-color: var(--accent);
}

/* While the user is on another page the app stays laid out at the page area's size, out of sight, rather than
   display: none (page-keep.js keeps it): a canvas app sized to nothing cannot draw or show the assistant what it built,
   and the assistant may go on building in it meanwhile. */
.page[hidden]:has(> .drive-editor) {
  display: flex;
  position: fixed;
  inset: var(--page-top, 0) var(--page-right, 0) var(--page-bottom, 0) var(--page-left, 0);
  flex-direction: column;
  visibility: hidden;
  pointer-events: none;
}

/* The ArtCraft apps in Ny's pop-up: a tile each, wrapping to as many columns as fit. */
.drive-apps__title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-m);
}

.drive-apps__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(12rem, 45%), 1fr));
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.drive-app {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: var(--space-2);
  align-items: center;
  align-content: center;
  width: 100%;
  height: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--surface-raised);
  color: var(--ink);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.drive-app:hover {
  background: var(--hover);
}

/* An app's own icon (site/craft/icons/), already a rounded square; the GIF maker, which has none, a tile of its tone. */
.drive-app__icon {
  grid-row: span 2;
  width: 2.5rem;
  height: 2.5rem;
}

.drive-app__icon.file-icon {
  padding: 0.5rem;
}

.drive__app-logo {
  width: 20px;
  height: 20px;
}

.drive-editor__logo {
  width: 24px;
  height: 24px;
}

.drive-app__name {
  font-weight: 600;
}

/* Up to two lines, so a phone's narrow tile still says what the app is for. */
.drive-app__about {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink-muted);
  font-size: var(--text-s);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

/* The picker that opens a file in an app: new, upload, then the files of its types. */
.drive-pick__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.drive-pick__actions .btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.drive-pick__list {
  display: grid;
  max-height: 50vh;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.drive-pick__file {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: var(--space-2);
  align-items: center;
  width: 100%;
  padding: var(--space-2);
  border: 0;
  border-radius: var(--radius-s);
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.drive-pick__file:hover {
  background: var(--hover);
}

.drive-pick__file .drive__icon {
  grid-row: span 2;
}

.drive-pick__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drive-pick__where {
  color: var(--ink-muted);
  font-size: var(--text-s);
}

/* How far an upload has come (views/drive.js). */
.drive__progress {
  width: 100%;
  height: 6px;
  accent-color: var(--accent);
}
