/* The files card in "Not just an SSH terminal app.": a failed build in the
   mobile device's terminal, the path to its log tapped, the app's path menu,
   Open in Files, and the explorer scrolled through the project. files.js plays
   it; with no script, or with reduced motion, the terminal stands on its own. */

/* The frame is a crop of the screen, held at the height every illustration
   in the row shares, so the headings stay level. */
.mini.files {
  display: block;
  height: var(--mini-height);
  padding: 0;
}

/* Everything but the fingertip, so one opacity fades a whole pass out. */
.files-stage {
  position: absolute;
  inset: 0;
  transition: opacity 360ms var(--ease-out-soft);
}

.files[data-fading] .files-stage {
  opacity: 0;
}

/* The two screens sit on top of each other; `hidden` is drawn as opacity 0
   rather than display:none, so a change of screen can cross-fade. The display
   is forced because base.css hides every [hidden] with !important. */
.files-pane {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--base);
  transition: opacity 380ms var(--ease-out-soft), translate var(--spring-gentle-ms) var(--spring-gentle);
}

.files-pane[hidden] {
  display: flex !important;
  opacity: 0;
  pointer-events: none;
}

/* The explorer a path opens arrives from the right, as every forward screen
   in the app does, fully drawn while it slides. */
.files-pane[data-pane="files"] {
  z-index: 4;
  box-shadow: -18px 0 30px -12px rgba(0, 0, 0, 0.5);
}

.files-pane[data-pane="files"][hidden] {
  opacity: 1;
  translate: 101% 0;
}

.files .crumbs {
  position: relative;
  z-index: 1;
  flex: none;
  padding: 9px 12px;
  background: var(--material);
  box-shadow: 0 0.5px 0 var(--hairline);
  font-size: 9.5px;
}

/* ----------------------------------------------------------------- list --- */

.files-list {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.files-rows {
  translate: 0 calc(-1 * var(--scroll, 0px));
  transition: translate var(--scroll-ms, 0ms) cubic-bezier(0.2, 0.7, 0.2, 1);
}

.files .row {
  --row-text: 43px;
  gap: 9px;
  padding: 5px 12px;
  transition: background-color 260ms var(--ease-out-soft);
}

.files .thumb {
  width: 22px;
  height: 22px;
  border-radius: 7px;
}

.files .thumb svg {
  width: 12px;
  height: 12px;
}

.files .row-copy {
  gap: 2px;
}

.files .row-copy b {
  font-size: 11px;
}

.files .row-copy small {
  font-size: 8.5px;
}

/* The file a path opened: it arrives in the accent's tint and edge, which
   fade over a second, as the app's explorer reveals it. */
.files .row.is-arrived {
  animation: files-arrive 1s ease-out;
}

@keyframes files-arrive {
  from {
    background-color: var(--tint-fill);
  }
  to {
    background-color: transparent;
  }
}

/* The scrollbar, shown only while the list moves. */
.files-bar {
  position: absolute;
  top: 0;
  right: 3px;
  width: 2px;
  height: var(--bar-h, 20px);
  border-radius: 1px;
  background: var(--label-3);
  opacity: 0;
  translate: 0 var(--bar-y, 0px);
  transition: opacity 300ms var(--ease-out-soft), translate var(--scroll-ms, 0ms) cubic-bezier(0.2, 0.7, 0.2, 1);
}

.files-list[data-scrolling] .files-bar {
  opacity: 1;
}

/* ------------------------------------------------------------- terminal --- */

.files-term {
  justify-content: flex-end;
  padding: 0 12px 10px;
  background: var(--term-bg);
  color: #cccccc;
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.6;
}

.files-term .line {
  overflow: hidden;
  white-space: pre;
}

.files-term .t-err {
  color: #e74856;
}

/* A path the terminal has recognised: a faint underline in the text's own
   colour. Tapped, its letters glow in the accent while its menu is up. */
.files-link {
  text-decoration: underline rgba(204, 204, 204, 0.32);
  text-decoration: underline color-mix(in srgb, currentColor 32%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: text-shadow 200ms var(--ease-out-soft);
}

.files-link.is-marked {
  text-shadow: 0 0 3px rgba(46, 155, 255, 0.8), 0 0 7px rgba(46, 155, 255, 0.8);
}

/* The menu a tap on a path puts up, beside the path and never over it: the
   file's name, then what to do with it. No scrim; the terminal stays
   readable behind it. */
.path-menu {
  position: absolute;
  right: 14px;
  bottom: 30px;
  z-index: 3;
  display: grid;
  width: 136px;
  padding: 4px;
  border-radius: 11px;
  background: var(--material-thick);
  -webkit-backdrop-filter: var(--material-blur);
  backdrop-filter: var(--material-blur);
  box-shadow: var(--highlight), 0 0 0 0.5px var(--hairline), var(--shadow-float);
  transition: opacity 180ms var(--ease-out-soft), scale var(--spring-snappy-ms) var(--spring-snappy);
  transform-origin: 70% 100%;
}

.path-menu[hidden] {
  display: grid !important;
  opacity: 0;
  scale: 0.9
}

.path-menu-name {
  padding: 3px 7px 4px;
  color: var(--label-2);
  font-size: 7.5px;
  font-weight: 510;
}

.path-menu-item {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 24px;
  padding: 0 7px;
  border-radius: 7px;
  color: var(--label);
  font-size: 8.5px;
  font-weight: 510;
  transition: background-color 160ms var(--ease-out-soft);
}

.path-menu-item.is-pressed {
  background: var(--tint-fill);
  transition-duration: 0s;
}

.path-menu svg {
  width: 10px;
  height: 10px;
  flex: none;
  color: var(--tint);
}

@media (prefers-reduced-motion: reduce) {
  .files-stage,
  .files-pane,
  .files-rows {
    transition: none;
  }
}

/* ------------------------------------------------------------- file rows --- */

.row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 13px;
}

/* The hairline between rows starts past the glyph, at the name. */
.row + .row {
  background-image: linear-gradient(var(--hairline), var(--hairline));
  background-size: calc(100% - var(--row-text, 54px)) 1px;
  background-position: right top;
  background-repeat: no-repeat;
}

.thumb {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 8px;
  font-size: 0;
}

.thumb svg {
  width: 15px;
  height: 15px;
}

/* Folders carry the tint; every other kind of file the quiet glyph tone,
   as the app's explorer draws them. */
.t-dir {
  background: var(--tint-fill);
  color: var(--tint);
}

.t-code {
  background: var(--fill-2);
  color: var(--label-2)
}

.t-img {
  background: var(--fill-2);
  color: var(--label-2)
}

.t-doc {
  background: var(--fill-2);
  color: var(--label-2);
}

.row-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.row-copy b {
  overflow: hidden;
  color: var(--label);
  font-size: 13px;
  font-weight: 510;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-copy small {
  color: var(--label-2);
  font-size: 10px;
}

/* The path, as the explorer shows it: each step a chip of fill. */
.crumbs {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 9px 13px;
  color: var(--label-2);
  font-size: 10.5px;
}

.crumbs b {
  padding: 2px 7px;
  border-radius: var(--r-pill);
  background: var(--fill);
  color: var(--label);
  font-weight: 600
}

.crumbs span {
  padding: 2px 7px;
  border-radius: var(--r-pill);
  background: var(--fill-2);
}

.crumbs i {
  color: var(--label-3);
  font-style: normal;
}
