/* The integrations: TAK destinations, shared pictures (and the partner's view of one), the
   watch list and the analytics of who comes back. Redwood tokens only (web/DESIGN.md 2). */

/* ── Dialogs with more to say ───────────────────────────────────────────── */
dialog.ds-dialog-wide { width: min(46rem, calc(100vw - 2 * var(--rw-space-4x))); }
.ds-dialog-wide .ds-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 40rem) { .ds-dialog-wide .ds-form { grid-template-columns: minmax(0, 1fr); } }

/* ── TAK destinations ───────────────────────────────────────────────────── */
.ds-tak-health { gap: var(--rw-space-1x); min-width: 9rem; }
.ds-tak-health .ds-state { white-space: nowrap; }
.ds-tak-host { overflow-wrap: anywhere; }
.ds-tak-error { color: var(--rw-text-secondary); font-size: var(--rw-body-xs-size); line-height: var(--rw-body-xs-lh); max-width: 28em; }
.ds-tak-now { margin-block-end: var(--rw-space-4x); padding: var(--rw-space-3x) var(--rw-space-4x); border-radius: var(--rw-radius-md); background: var(--rw-bg-muted); }
.ds-tak-form > .rw-banner { grid-column: 1 / -1; }
.ds-tak-address, .ds-tak-timing { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); gap: var(--rw-space-4x); }
.ds-tak-timing { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ds-tak-cert { display: grid; gap: var(--rw-space-3x); margin: 0; padding: var(--rw-space-4x); border: 1px solid var(--rw-divider); border-radius: var(--rw-radius-lg); }
.ds-tak-cert > legend { padding-inline: var(--rw-space-1x); }
.ds-tak-cert-now { display: grid; gap: var(--rw-space-3x); justify-items: start; }
.ds-file { display: grid; gap: var(--rw-space-1x); }
.ds-file > input[type="file"] { padding: var(--rw-space-2x); }
.ds-file-kind { color: var(--rw-text-secondary); font-size: var(--rw-body-sm-size); }
@media (max-width: 40rem) { .ds-tak-address, .ds-tak-timing { grid-template-columns: minmax(0, 1fr); } }

/* ── Shared pictures ────────────────────────────────────────────────────── */
.ds-shares-log { display: grid; gap: var(--rw-space-2x); margin-block-start: var(--rw-space-10x); }
.ds-shares-log > h2 { font-size: var(--rw-body-md-size); line-height: var(--rw-body-md-lh); }
.ds-share-form > .rw-banner, .ds-share-sentence, .ds-share-end { grid-column: 1 / -1; }
.ds-share-who { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--rw-space-4x); }
.ds-share-end { display: flex; flex-wrap: wrap; align-items: end; gap: var(--rw-space-3x); }
.ds-share-custom { display: grid; gap: var(--rw-space-1x); }
.ds-share-end-label { flex-basis: 100%; }
.ds-share-secret { display: grid; gap: var(--rw-space-1x); }
/* The sentence follows every choice: it is what the partner will see, in words, and it stays
   in view at the foot of the form while the choices scroll. */
.ds-share-sentence {
  position: sticky;
  inset-block-end: calc(-1 * var(--rw-space-1x));
  z-index: 1;
  margin-block-start: var(--rw-space-2x);
  border: 1px solid var(--rw-divider);
  font-size: var(--rw-body-md-size);
}
.ds-share-reveal { animation: ds-share-in 180ms ease-out; }
@keyframes ds-share-in { from { opacity: 0; transform: translateY(var(--rw-space-2x)); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ds-share-reveal { animation: none; } }
@media (max-width: 40rem) {
  .ds-share-who { grid-template-columns: minmax(0, 1fr); }
  /* A phone has no room to keep it pinned over the fields: it closes the form instead. */
  .ds-share-sentence { position: static; }
}

/* ── The partner's view ─────────────────────────────────────────────────── */
.ds-shared { grid-template-rows: auto auto minmax(0, 1fr); }
.ds-shared > .ds-topbar { grid-row: 1; }
.ds-shared > .ds-shared-strip { grid-row: 2; grid-column: 1 / -1; }
.ds-shared > .ds-main { grid-row: 3; }
.ds-shared-bar { gap: var(--rw-space-3x); }
.ds-shared-kind { color: var(--rw-text-secondary); font-size: var(--rw-body-sm-size); white-space: nowrap; }
.ds-shared-site { width: auto; min-height: var(--rw-space-8x); padding-block: 0; font-size: var(--rw-body-sm-size); }
.ds-shared-status { margin-inline-start: auto; }
/* Who disclosed the picture and until when: it stays over everything, in the chrome's ink. */
.ds-shared-strip {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: var(--rw-space-6x);
  padding: var(--rw-space-3x) var(--rw-space-4x) var(--rw-space-3x);
  border-bottom: 1px solid var(--rw-divider);
  background: var(--rw-bg-subtle);
}
.ds-shared-strip-text { display: grid; gap: var(--rw-space-1x); min-width: 0; }
.ds-shared-by { font-size: var(--rw-body-md-size); line-height: var(--rw-body-md-lh); font-weight: 600; overflow-wrap: anywhere; }
.ds-shared-for { color: var(--rw-text-secondary); font-size: var(--rw-body-sm-size); line-height: var(--rw-body-sm-lh); overflow-wrap: anywhere; }
.ds-shared-left { margin-inline-start: auto; flex-shrink: 0; font-size: var(--rw-body-sm-size); font-weight: 600; white-space: nowrap; }
/* The share's time as a hairline along the strip's foot: how much of it is left. */
.ds-shared-time { position: absolute; inset-inline: 0; inset-block-end: -1px; height: 2px; background: transparent; }
.ds-shared-time > span { display: block; height: 100%; background: var(--rw-text-secondary); transition: inline-size 600ms linear; }
@media (prefers-reduced-motion: reduce) { .ds-shared-time > span { transition: none; } }
.ds-shared-note { margin-block-start: var(--rw-space-2x); font-size: var(--rw-body-sm-size); }
.ds-share-code { display: grid; gap: var(--rw-space-4x); justify-items: start; width: 100%; }
.ds-share-code .rw-field { width: min(16rem, 100%); }
.ds-share-code-input { letter-spacing: 0.08em; font-size: var(--rw-body-lg-size); }
@media (max-width: 59.99rem) {
  .ds-shared-kind, .ds-shared-hide-sm { display: none; }
  .ds-shared-strip { flex-wrap: wrap; gap: var(--rw-space-1x) var(--rw-space-4x); padding-block: var(--rw-space-2x); }
  .ds-shared-by { font-size: var(--rw-body-sm-size); }
  .ds-shared-for { font-size: var(--rw-body-xs-size); line-height: var(--rw-body-xs-lh); }
  .ds-shared-left { margin-inline-start: 0; font-size: var(--rw-body-xs-size); }
}

/* ── Watch list ─────────────────────────────────────────────────────────── */
.ds-drone-tabs { margin-block-end: var(--rw-space-4x); }
.ds-watch-tools { flex-wrap: wrap; gap: var(--rw-space-3x); }
.ds-watch-tools > .ds-search { flex: 1 1 16rem; }
.ds-watch-tools > .rw-btn-primary { margin-inline-start: auto; }
.ds-watch-seen { color: var(--rw-text-secondary); font-size: var(--rw-body-sm-size); }
.ds-watch-rf { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: var(--rw-space-4x); }
.ds-watch-end { display: flex; flex-wrap: wrap; align-items: center; gap: var(--rw-space-3x); }
.ds-watch-end > .rw-input { width: auto; }
.ds-watch-match { display: grid; gap: var(--rw-space-2x); }
.ds-watch-head { display: flex; align-items: center; gap: var(--rw-space-2x); min-width: 0; }
.ds-watch-what { font-weight: 600; overflow-wrap: anywhere; }
.ds-watch-line { font-size: var(--rw-body-md-size); line-height: var(--rw-body-md-lh); }
.ds-watch-reason { margin: 0; padding: var(--rw-space-2x) var(--rw-space-3x); border-inline-start: 2px solid var(--rw-border-enabled); color: var(--rw-text-secondary); font-size: var(--rw-body-sm-size); line-height: var(--rw-body-md-lh); overflow-wrap: anywhere; }
@media (max-width: 40rem) { .ds-watch-rf { grid-template-columns: minmax(0, 1fr); } }

/* A phone has no width for six lengths in a row: they become a grid of separate choices. */
@media (max-width: 40rem) {
  :is(.ds-share-end, .ds-watch-end) > .rw-buttonset { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--rw-space-1x); width: 100%; }
  :is(.ds-share-end, .ds-watch-end) > .rw-buttonset > .rw-btn { margin: 0; padding-inline: var(--rw-space-1x); border-radius: var(--rw-radius-md); border-inline-start-color: var(--rw-border-enabled); font-weight: 400; }
  :is(.ds-share-end, .ds-watch-end) > .rw-buttonset > .rw-btn[aria-pressed="true"] { border-color: var(--rw-border-selected); }
}

/* ── Launch hotspots ────────────────────────────────────────────────────── */
.ds-launch { display: grid; grid-template-columns: minmax(0, 1fr) 16rem; gap: var(--rw-space-4x); align-items: start; }
.ds-launch-map { display: grid; gap: var(--rw-space-2x); min-width: 0; }
.ds-launch-spots { display: grid; gap: var(--rw-space-1x); align-content: start; }
.ds-launch-spot { display: grid; grid-template-columns: var(--rw-space-6x) minmax(0, 1fr) auto; align-items: center; gap: var(--rw-space-2x); min-height: var(--rw-space-12x); padding: var(--rw-space-1x) 0; border-bottom: 1px solid var(--rw-divider); }
.ds-launch-rank { color: var(--rw-text-secondary); font-size: var(--rw-body-sm-size); text-align: end; }
.ds-launch-text { display: grid; min-width: 0; font-size: var(--rw-body-sm-size); line-height: var(--rw-body-sm-lh); }
.ds-launch-count { font-weight: 600; }
@media (max-width: 60rem) { .ds-launch { grid-template-columns: minmax(0, 1fr); } }

/* ── A share's changes ──────────────────────────────────────────────────── */
/* The edit dialog says what will change before it is saved; widening is marked, never quiet. */
.ds-share-preview {
  grid-column: 1 / -1;
  display: grid;
  gap: var(--rw-space-2x);
  margin-block-start: var(--rw-space-2x);
  padding: var(--rw-space-3x) var(--rw-space-4x);
  border: 1px solid var(--rw-divider);
  border-radius: var(--rw-radius-md);
  background: var(--rw-bg-muted);
}
.ds-share-preview > h3 { margin: 0; }
.ds-share-preview-wider { border-color: var(--rw-text-warning); }
.ds-share-preview-note { font-size: var(--rw-body-sm-size); line-height: var(--rw-body-sm-lh); }
.ds-share-end-help { flex-basis: 100%; margin: 0; }
.ds-share-change-list { display: grid; gap: var(--rw-space-1x); margin: 0; padding: 0; list-style: none; font-size: var(--rw-body-sm-size); line-height: var(--rw-body-md-lh); overflow-wrap: anywhere; }
.ds-share-change-list > li::first-letter { text-transform: uppercase; }
.ds-share-widens { font-weight: 600; }
.ds-share-was { display: block; font-weight: 400; }
/* The history beside the openings: the evidence of what was disclosed, and how it changed. */
.ds-share-history { display: grid; gap: var(--rw-space-3x); margin: 0; padding: 0; list-style: none; }
.ds-share-change { display: grid; gap: var(--rw-space-1x); padding-block-end: var(--rw-space-3x); border-bottom: 1px solid var(--rw-divider); }
.ds-share-change:last-child { border-bottom: 0; padding-block-end: 0; }
.ds-share-change-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--rw-space-2x); font-size: var(--rw-body-sm-size); }
.ds-share-change-text { margin: 0; font-size: var(--rw-body-sm-size); line-height: var(--rw-body-md-lh); }
