/* Documents (documents.html, and the homepage's Documents section): three animations, played by
   js/scripted-demo.js, in the app's dark look (go-port/frontend/src/ui/components/docs).
   .dc-blocks: a page builds up one block at a time, each named beside it: heading, text, the
   lists, checklist, quote and code (all of them in the app's own first documents).
   .dc-space: the Documents screen as the app draws it (a list of documents, the open one on the
   app's dark page): a new document gets its title, an emoji and two teammates in its settings,
   then its first lines.
   .dc-shared: three teammates in one document at once, each with their own cursor.
   Only what the app does today (no whiteboard or images), except the cursors and faces in
   .dc-shared, which the app plans but does not show yet. */

/* Steps of the script wait hidden for their time; without the script, the scene shows finished */
.js .dc-window [data-at]:not(.is-on) { display: none; }
html:not(.js) .dc-window [data-until] { display: none; }

.dc-window {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  height: 26rem;
  background: #0d0f12;
  color: #e9ecef;
  font: 0.9375rem / 1.4 system-ui, sans-serif;
  text-align: left;
}

.dc-window p,
.dc-window h3,
.dc-window h4 { margin: 0; }

/* The app's small buttons (button.styles.js .btn): a 1px outline, no fill; a lit one is being pressed */
.dc-btn {
  display: inline-flex;
  align-items: center;
  min-height: 1.5rem;
  padding: 0 0.625rem;
  border: 1px solid #495057;
  border-radius: 0.25rem;
  color: #e9ecef;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.dc-btn.is-lit { background: rgb(233 236 239 / 0.1); }

/* ---- The Documents screen: the list on the left, the open document on the right ---- */

/* The list (docs-list.js): "Documents" and "+ New doc" on top, then one row per document, its emoji
   only when it has one */
.dc-list {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: 0 0.25rem 0.75rem;
  border-right: 1px solid #495057;
  background: #212529;
}

.dc-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.375rem;
  font-weight: 600;
}

.dc-doc {
  overflow: hidden;
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.dc-doc.is-current { background: color-mix(in srgb, #748ffc 18%, #212529); }

.dc-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
}

/* The open document's bar: its title, and how its saving goes */
.dc-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 2.5rem;
  padding: 0 1rem;
  border-bottom: 1px solid #343a40;
  font-weight: 600;
}

.dc-status {
  margin-left: auto;
  color: #868e96;
  font-size: 0.75rem;
  font-weight: 400;
}

/* The page itself, as the editor draws it */
.dc-page {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow: hidden;
  padding: 1.25rem 1.75rem;
}

.dc-title {
  min-height: 1.2em;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
}

/* A title not yet typed shows the editor's hint */
.dc-title:empty::before { content: 'Title'; color: #495057; }

.dc-h {
  margin-top: 0.375rem;
  font-size: 1.1875rem;
  font-weight: 700;
}

.dc-check,
.dc-bullet {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.dc-check::before {
  content: '';
  flex: none;
  width: 0.9375rem;
  height: 0.9375rem;
  border: 1.5px solid #868e96;
  border-radius: 0.25rem;
}

/* A ticked item: its box filled with a check, its text struck through */
.dc-check.is-lit,
.dc-check.is-done { color: #868e96; text-decoration: line-through; }

.dc-check.is-lit::before,
.dc-check.is-done::before {
  border-color: #1c7ed6;
  background: #1c7ed6 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat;
}

.dc-bullet::before {
  content: '';
  flex: none;
  width: 0.375rem;
  height: 0.375rem;
  margin-inline: 0.3rem;
  border-radius: 50%;
  background: #ced4da;
}

/* ---- Writing together: one document, three teammates in it at once, as in Google Docs: who is in
   it at the top, and each one's cursor in their own color (--c) with their name on a flag ---- */

.dc-shared {
  grid-template-rows: auto minmax(0, 1fr);
  max-width: 48rem;
  height: 24rem;
  margin-inline: auto;
}

.dc-people {
  display: flex;
  margin-left: auto;
}

.dc-people > span {
  display: grid;
  place-items: center;
  width: 1.625rem;
  height: 1.625rem;
  margin-left: -0.375rem;
  border: 2px solid #0d0f12;
  border-radius: 50%;
  background: var(--c);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}

.dc-shared .dc-status { margin-left: 0.25rem; }

.dc-shared .dc-page { gap: 0.625rem; padding: 1.75rem 2.5rem; }

/* A teammate's cursor: a line in their color, their name on a flag above it */
.dc-cursor {
  position: relative;
  display: inline-block;
  width: 2px;
  height: 1.2em;
  margin-left: 1px;
  vertical-align: text-bottom;
  background: var(--c);
}

.dc-cursor::after {
  content: attr(data-name);
  position: absolute;
  bottom: 100%;
  left: 0;
  padding: 0 0.375rem;
  border-radius: 0.25rem 0.25rem 0.25rem 0;
  background: var(--c);
  color: #fff;
  font: 600 0.6875rem / 1.5 system-ui, sans-serif;
  font-style: normal;
  text-decoration: none;
  white-space: nowrap;
}

/* ---- Blocks: each block of the page with its kind named on the right; the newest one lights up
   as it lands (css/motion.css) ---- */

.dc-blocks {
  grid-template-rows: auto minmax(0, 1fr);
  height: 27.5rem;
}

.dc-blocks .dc-page { gap: 0.375rem; }

.dc-block {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-inline: -0.5rem;
  padding: 0.125rem 0.5rem;
  border-radius: 0.375rem;
}

.dc-block > :first-child {
  display: grid;
  flex: 1;
  gap: 0.25rem;
  min-width: 0;
}

.dc-blocks .dc-h { margin-top: 0; }

.dc-kind {
  flex: none;
  margin-top: 0.125rem;
  padding: 0 0.375rem;
  border: 1px solid #343a40;
  border-radius: 0.25rem;
  color: #868e96;
  font: 500 0.625rem / 1.6 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.dc-nums { counter-reset: dc-num; }

.dc-nums > p {
  display: flex;
  gap: 0.5rem;
  counter-increment: dc-num;
}

.dc-nums > p::before {
  content: counter(dc-num) '.';
  width: 1rem;
  color: #ced4da;
  text-align: right;
}

.dc-quote {
  padding-left: 0.75rem;
  border-left: 3px solid #1c7ed6;
  color: #ced4da;
  font-style: italic;
}

.dc-block > .dc-code {
  display: block;
  padding: 0.375rem 0.625rem;
  border-radius: 0.375rem;
  background: #1c1f24;
  font: 0.8125rem / 1.5 var(--font-mono);
}

.dc-code span { color: #69db7c; }

/* ---- Your space: the Documents screen as the app draws it, the page on the app's own dark color;
   the document's settings open over it to pick an emoji and add people ---- */

.dc-space {
  position: relative;
  grid-template-columns: 12.5rem minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  height: 27rem;
}

.dc-sprite { display: none; }

.dc-space svg {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dc-space .dc-main { grid-column: 2; grid-row: 1; }

/* The open document's bar (docs-bar.js): the ⚙, its name, and how its saving goes */
.dc-space .dc-bar {
  gap: 0.5rem;
  min-height: 2.25rem;
  padding: 0 0.75rem 0 0.5rem;
  border-bottom-color: #495057;
  white-space: nowrap;
}

.dc-space .dc-status { color: #495057; font-size: 0.6875rem; }

.dc-gear {
  display: grid;
  flex: none;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 0.375rem;
  color: #868e96;
  font-size: 1rem;
}

.dc-gear.is-lit { background: #495057; color: #e9ecef; }

/* The page, as the editor draws it: on the app's own dark color, in the editor's sans-serif, its
   text in a column with room on either side */
.dc-paper {
  padding: 1.5rem 2.25rem;
  font-family: Arial, "Liberation Sans", Helvetica, sans-serif;
}

.dc-paper .dc-title { color: #f1f3f5; font-size: 1.875rem; }
.dc-paper .dc-title:empty::before { content: 'Untitled'; color: #495057; }
.dc-paper .dc-h { color: #f1f3f5; font-size: 1.375rem; }
.dc-paper :is(.dc-bullet, .dc-check) { gap: 0.5rem; }
.dc-paper .dc-bullet::before { background: #e9ecef; }

/* A checklist item: a small white box; a ticked one fills blue, its text dimmed */
.dc-paper .dc-check::before {
  width: 0.8125rem;
  height: 0.8125rem;
  border-color: #e9ecef;
  border-radius: 0.1875rem;
}

.dc-paper .dc-check:is(.is-lit, .is-done) { color: #868e96; text-decoration: none; }

.dc-paper .dc-check:is(.is-lit, .is-done)::before { border-color: #1e96eb; background-color: #1e96eb; }

/* The document's settings (docs-bar.js): over the dimmed screen, its emoji (the one in use, Clear,
   and some to pick from, room-settings.js), then its members (members-panel.js): the filter,
   "+ Add people", and who is in it, by role */
.dc-modal {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  background: rgb(0 0 0 / 0.45);
}

.dc-dialog {
  width: min(18rem, 90%);
  overflow: hidden;
  border: 1px solid #495057;
  border-radius: 0.5rem;
  background: #0d0f12;
  box-shadow: 0 24px 60px -12px rgb(0 0 0 / 0.8);
  font-size: 0.8125rem;
  line-height: 1.3;
}

.dc-dialog-head {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid #495057;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}

.dc-x { display: inline-flex; margin-left: auto; color: #868e96; }

.dc-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid #495057;
}

.dc-label { font-weight: 600; }

.dc-emoji-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* The emoji field: a hint until one is set */
.dc-pick {
  display: grid;
  place-items: center;
  width: 4rem;
  height: 1.625rem;
  border: 1px solid #495057;
  border-radius: 0.25rem;
  background: #212529;
  font-size: 1.0625rem;
  opacity: 0.45;
}

.dc-pick.is-set { opacity: 1; }

.dc-clear {
  display: inline-flex;
  align-items: center;
  height: 1.625rem;
  padding: 0 0.625rem;
  border: 1px solid #495057;
  border-radius: 0.25rem;
}

.dc-emojis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.125rem;
  font-size: 1.0625rem;
  text-align: center;
}

.dc-emojis > span {
  padding: 0.25rem 0;
  border: 1px solid transparent;
  border-radius: 0.25rem;
}

/* The pick pressed, then the one in use */
.dc-emojis > .is-lit {
  border-color: color-mix(in oklab, #748ffc 45%, transparent);
  background: color-mix(in oklab, #748ffc 22%, transparent);
}

.dc-hint { color: #868e96; font-size: 0.75rem; }

.dc-tool {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #495057;
}

.dc-filter {
  display: flex;
  flex: 1;
  align-items: center;
  height: 1.625rem;
  padding: 0 0.5rem;
  border-radius: 0.25rem;
  background: rgb(255 255 255 / 0.1);
  color: #868e96;
}

.dc-add {
  display: inline-flex;
  align-items: center;
  height: 1.625rem;
  padding: 0 0.625rem;
  border-radius: 0.25rem;
  background: #748ffc;
  color: #f8f9fa;
  font-weight: 600;
  white-space: nowrap;
}

.dc-add.is-lit { filter: brightness(1.12); outline: 2px solid #748ffc; outline-offset: 2px; }

.dc-sec { padding: 0.5rem 0.75rem; }

.dc-sec-label {
  margin-bottom: 0.125rem;
  color: #868e96;
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.dc-member + .dc-sec-label { margin-top: 0.5rem; }

.dc-member {
  display: flex;
  align-items: baseline;
  gap: 0.375rem;
  padding: 0.25rem 0;
  font-size: 0.875rem;
}

.dc-at { margin-right: -0.375rem; color: #51cf66; }

.dc-tag { color: #748ffc; font-size: 0.75rem; }

/* Phones: Your space shows the open document alone, its list folded away (its title, with the
   emoji, stays in the bar) */
@media (max-width: 760px) {
  .dc-window { height: 23rem; font-size: 0.875rem; }
  .dc-blocks { height: 28rem; }
  .dc-shared { height: 23rem; }
  .dc-shared .dc-page { padding: 1.25rem; }
  .dc-page { padding: 1rem 1.25rem; }
  .dc-space { grid-template-columns: minmax(0, 1fr); height: 25rem; }
  .dc-space .dc-list { display: none; }
  .dc-space .dc-main { grid-column: 1; }
}
