/*
  ClipReady landing page: the mock dashboard inside the Analytics window, as the home page has it.
  It is d1g of the round 2 drafts ("the usual line"): d1's table, with "your usual" as a ruled line
  across it, in its place in the order. The reels above the line beat the usual; the ones under it do not.

  Cut from round2/dashboard2.css as it stands: the shared part, the table, and d1g's own block.
  Nothing from the other nine versions is here. To change the mock, change it there (or in d1g.html)
  and cut again, so this file and the draft do not drift apart.

  The window is the landing page's own .dash (landing.css grows it and stands it up as it comes up
  the screen). This file only fills it. Every value is a token from design/tokens.css.

  States (set by dashboard-home.js): is-waiting until the window has grown, then is-grown (the line
  draws across, then the best rows turn white); is-made while "Make more like this" is pressed.
  With "reduce motion" on, nothing here moves.
*/

/* ---------- The window ---------- */
/* Its height comes from what is in it: the figures have to stay readable on a phone,
   where a 16:10 window would be 350 by 219. */
.dash.db { --pad: var(--cr-space-4); aspect-ratio: auto; text-align: left; font-size: var(--cr-text-sm); line-height: var(--cr-leading-snug); color: var(--cr-ink); }
.db :where(p, dl, dt, dd, ol, ul, li) { margin: 0; padding: 0; list-style: none; }
.db__in { position: relative; padding: var(--pad); }
.db__top { display: flex; align-items: center; gap: var(--cr-space-3); min-height: var(--cr-space-8); margin-bottom: var(--cr-space-4); }
.db__title { font-weight: var(--cr-weight-semibold); font-size: var(--cr-text-base); letter-spacing: var(--cr-tracking-tight); white-space: nowrap; }
.db__by { display: none; color: var(--cr-grey); white-space: nowrap; }
.db__note { margin-left: auto; padding: var(--cr-space-1) var(--cr-space-3); border: var(--cr-border) solid var(--cr-line); border-radius: var(--cr-radius-pill); background: var(--cr-white); color: var(--cr-grey); font-weight: var(--cr-weight-semibold); white-space: nowrap; }
.db__usual { display: none; flex-wrap: wrap; align-items: baseline; gap: var(--cr-space-1) var(--cr-space-4); margin-bottom: var(--cr-space-4); color: var(--cr-grey); }
.db__usual b { color: var(--cr-ink); }

/* ---------- The pieces ---------- */
.db__reels { display: grid; gap: var(--cr-space-2); }
.db__reel { min-width: 0; }
.db__card { min-width: 0; }
.db__body { min-width: 0; }
/* A reel's picture: the gradient a reel frame shows before its video loads, turned a little for each */
.db__thumb { display: block; flex: none; width: 28px; aspect-ratio: 9 / 16; border-radius: calc(var(--cr-radius-sm) / 2); background: linear-gradient(calc(120deg + var(--i, 0) * 47deg), var(--cr-grad-1), var(--cr-grad-2) 62%, var(--cr-grad-3)); }
.db__name { font-weight: var(--cr-weight-semibold); text-wrap: balance; }
.db__mark { display: inline-flex; align-items: center; justify-self: start; padding: 1px var(--cr-space-2); border-radius: var(--cr-radius-pill); background: var(--cr-ink); color: var(--cr-white); font-weight: var(--cr-weight-semibold); white-space: nowrap; }
.db__rank, .db__verdict, .db__lab--short, .db__delta, .db__meter { display: none; }   /* each layout turns on what it uses */
.db__verdict { color: var(--cr-grey); }
.db__num { min-width: 0; }
.db__num dt { color: var(--cr-grey); white-space: nowrap; }
.db__fig { font-weight: var(--cr-weight-semibold); font-size: var(--cr-text-base); letter-spacing: var(--cr-tracking-tight); white-space: nowrap; }
.db__vs { color: var(--cr-grey); white-space: nowrap; }
.db__delta { color: var(--cr-grey); font-weight: var(--cr-weight-semibold); white-space: nowrap; }
.db__num.is-up .db__delta { color: var(--cr-accent-ink); }
/* The bar: full width is twice the usual, so the tick in the middle is "your usual" */
.db__meter { position: relative; height: 6px; border-radius: var(--cr-radius-pill); background: var(--cr-line); }
.db__meter i { display: block; width: calc(var(--v) * 100%); height: 100%; border-radius: inherit; background: var(--cr-grey-2); }
.db__num.is-up .db__meter i { background: var(--cr-accent); }
.db__meter::after { content: ""; position: absolute; left: 50%; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--cr-ink); }
.db__more { white-space: nowrap; cursor: pointer; }
.db__more[aria-pressed="true"] { background: var(--cr-accent-hover); }

/* The drafts: not there until "Make more like this" is pressed */
.db__drafts { display: none; }
.db.is-made .db__drafts { display: block; }
.db__drafts-h { margin-bottom: var(--cr-space-2); color: var(--cr-grey); font-weight: var(--cr-weight-semibold); }
.db__drafts ul { display: grid; gap: var(--cr-space-2); }
.db__drafts li { display: flex; align-items: center; gap: var(--cr-space-3); min-width: 0; padding: var(--cr-space-1) var(--cr-space-3); border: var(--cr-border) dashed var(--cr-grey-2); border-radius: var(--cr-radius-sm); background: var(--cr-white); }
.db__dthumb { display: block; flex: none; width: 16px; aspect-ratio: 9 / 16; border-radius: 3px; opacity: .55; background: linear-gradient(calc(120deg + var(--n, 0) * 60deg), var(--cr-grad-1), var(--cr-grad-2) 62%, var(--cr-grad-3)); }
.db__draft-t { min-width: 0; font-weight: var(--cr-weight-semibold); }
.db__draft-s { margin-left: auto; color: var(--cr-grey); }

@media (min-width: 760px) {
  .dash.db { --pad: var(--cr-space-8); }
  .db__top { margin-bottom: var(--cr-space-5); }
  .db__by { display: block; }
  .db__thumb { width: 32px; }
  .db__drafts li { padding-block: var(--cr-space-2); }
}

@media (prefers-reduced-motion: no-preference) {
  .db.is-made .db__drafts li { animation: db-in var(--lv-rise) var(--lv-ease) both; animation-delay: calc(var(--n) * var(--lv-gap)); }
}
@keyframes db-in { from { opacity: 0; transform: translateY(var(--cr-space-2)); } }


/* ==========================================================================
   The table, as d1 has it: rows and columns, each figure with its usual beside it,
   the best rows white with a "Best" label. (d1's own moment, the white wiping in,
   is not here: each version below has its own.)
   ========================================================================== */
.db__lab-u, .db__word { display: none; }                 /* each version turns on what it uses */
.db__lab-u { color: var(--cr-grey); white-space: nowrap; }
.db__word { color: var(--cr-grey); white-space: nowrap; }
.db__num.is-up .db__word { color: var(--cr-accent-ink); }

.db--table .db__reel { order: calc(var(--i) * 2); }       /* the reels in their order; the "usual" row can then sit between two of them */
.db--table .db__card { position: relative; z-index: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--cr-space-3); align-items: start; padding: var(--cr-space-3); border-radius: var(--cr-radius-md); }
/* the white of a best row is a layer of its own */
.db--table .db__card::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--cr-white); opacity: 0; }
.db--table .is-best .db__card::before { opacity: 1; }
.db--table .db__reel:not(.is-best) + .db__reel:not(.is-best) { border-top: var(--cr-border) solid var(--cr-line); }
.db--table .db__body { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--cr-space-2) var(--cr-space-2); align-items: start; }
.db--table .db__name { grid-column: 1 / span 2; }
.db--table .db__reel:not(.is-best) .db__name { grid-column: 1 / -1; }
.db--table .db__mark { grid-column: 3; justify-self: end; }
.db--table .db__nums { display: contents; }
.db--table .db__lab { display: none; }
.db--table .db__lab--short { display: inline; }
.db--table .db__vs { display: block; }
.db--table .db__act { grid-column: 1 / -1; margin-top: var(--cr-space-1); }
.db--table .db__drafts { padding: 0 var(--cr-space-3) var(--cr-space-3); }
.db--table .db__reel:nth-child(n + 4) { display: none; }

/* the wide layout starts at 900: between 760 and 900 the window is too narrow for its columns */
@media (min-width: 900px) {
  .db--table .db__reels { gap: 0; padding-top: var(--cr-space-8); }
  .db--table .db__reel:nth-child(n + 4) { display: block; }
  .db--table .db__card { align-items: center; gap: var(--cr-space-4); padding: var(--cr-space-3) var(--cr-space-4); }
  .db--table .db__body { grid-template-columns: minmax(0, 1fr) 124px 116px 100px 176px; gap: 0 var(--cr-space-4); align-items: center; }
  .db--table .db__name, .db--table .db__reel:not(.is-best) .db__name { grid-column: 1; }
  .db--table .db__mark { grid-column: 1; grid-row: 2; justify-self: start; margin-top: var(--cr-space-1); }
  .db--table .db__num { position: relative; grid-row: 1 / span 2; align-self: stretch; display: flex; align-items: center; }
  .db--table .db__num[data-m="views"] { grid-column: 2; }
  .db--table .db__num[data-m="hold"] { grid-column: 3; }
  .db--table .db__num[data-m="watch"] { grid-column: 4; }
  /* the column titles are the first reel's labels, lifted above it */
  .db--table .db__num dt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .db--table .db__reel--first .db__num dt { left: 0; bottom: calc(100% + var(--cr-space-5)); width: auto; height: auto; overflow: visible; clip-path: none; }
  .db--table .db__lab { display: inline; }
  .db--table .db__lab--short { display: none; }
  .db--table .db__vs { display: inline; margin-left: var(--cr-space-1); }
  .db--table .db__act { grid-column: 5; grid-row: 1 / span 2; margin: 0; justify-self: end; }
  .db--table .db__drafts { padding: 0 var(--cr-space-4) var(--cr-space-4) calc(var(--cr-space-4) * 2 + 32px); }
  .db--table .db__drafts-h { display: none; }
  .db--table .db__drafts ul { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* the "usual" row: not shown unless a version asks for it */
.db--table .db__reel.db__reel--usual { display: none; border-top: 0; }
.db--table .db__reel--usual .db__thumb { visibility: hidden; height: 0; aspect-ratio: auto; }
.db--table .db__reel--usual .db__name { grid-column: 1 / -1; color: var(--cr-grey); }
.db--table .db__reel--usual .db__fig { color: var(--cr-ink-2); }
@media (hover: hover) {
  .db--table .db__card:hover::before { opacity: 1; }
}
@media (prefers-reduced-motion: no-preference) {
  .db--table .db__card::before { transition: opacity var(--cr-duration) var(--cr-ease); }
}

/* ==========================================================================
   db--table-g: "your usual" is a ruled line across the table, in its place in
   the order: the reels above it beat the usual, the reels under it do not.
   Best: as d1. The moment: the line draws across, then the best rows turn white.
   ========================================================================== */
.db--table-g .db__reel.db__reel--usual { display: block; }
.db--table-g .db__reel--usual::before { content: ""; display: block; height: 2px; border-radius: 1px; background: var(--cr-ink); }
.db--table-g .db__reel--usual .db__card { padding-block: var(--cr-space-2); }
.db--table-g .db__reel--usual .db__fig { font-size: var(--cr-text-sm); color: var(--cr-grey); }
.db--table-g .db__vs { display: none; }
.db--table-g .db__num.is-down .db__fig { color: var(--cr-grey); }
.db--table-g .db__reel:nth-child(4) { border-top: 0; }
@media (max-width: 899px) {
  .db--table-g .db__reel:nth-child(4) { display: block; }
  .db--table-g .db__reel:not(.db__reel--first) .db__num dt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .db--table-g .db__reel--usual .db__body { gap: 0 var(--cr-space-2); }
}
@media (prefers-reduced-motion: no-preference) {
  .db--table-g.is-waiting:not(.is-grown) .db__reel--usual::before { transform: scaleX(0); }
  .db--table-g.is-waiting:not(.is-grown) .db__reel--usual .db__card { opacity: 0; }
  .db--table-g.is-waiting:not(.is-grown) .is-best .db__card:not(:hover)::before { opacity: 0; }
  .db--table-g.is-waiting:not(.is-grown) .db__mark { opacity: 0; }
  .db--table-g.is-waiting .db__reel--usual::before { transform-origin: 0 50%; transition: transform var(--lv-fill) var(--lv-ease); }
  .db--table-g.is-waiting .db__reel--usual .db__card { transition: opacity var(--lv-lit) var(--lv-ease) 500ms; }
  .db--table-g.is-waiting .is-best .db__card:not(:hover)::before { transition: opacity var(--lv-rise) var(--lv-ease) calc(var(--i) * 140ms + 700ms); }
  .db--table-g.is-waiting .db__mark { transition: opacity var(--lv-lit) var(--lv-ease) calc(var(--i) * 140ms + 900ms); }
}
