/* The application shell: the grid that holds the banner, the top bar, the view and the
   assistant; the top bar; the sign-in page. */

.ds-app {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr);
  height: 100%;
}
.ds-app > .rw-banner { grid-row: 1; grid-column: 1 / -1; }
.ds-topbar { grid-row: 2; grid-column: 1 / -1; }
.ds-main { grid-row: 3; grid-column: 1; position: relative; min-width: 0; min-height: 0; overflow: hidden; }

/* At 80rem and wider the assistant pushes the page (guide 9b). */
.ds-app-pushed { grid-template-columns: minmax(0, 1fr) var(--ds-assistant-width, 25rem); }

/* ── Top bar ────────────────────────────────────────────────────────────── */
.ds-topbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--rw-space-4x);
  height: var(--rw-space-12x);
  padding: 0 var(--rw-space-3x) 0 var(--rw-space-4x);
  background: var(--rw-bg-content);
  border-bottom: 1px solid var(--rw-divider);
}
.ds-product { flex-shrink: 0; color: var(--rw-text-primary); font-size: var(--rw-body-md-size); font-weight: var(--rw-heading-weight); text-decoration: none; white-space: nowrap; }
.ds-site { color: var(--rw-text-secondary); font-size: var(--rw-body-sm-size); font-weight: 600; white-space: nowrap; }

.ds-topnav { align-self: stretch; flex-shrink: 0; gap: var(--rw-space-6x); margin-inline-start: var(--rw-space-2x); border-bottom: 0; overflow: visible; }
.ds-topnav > .rw-tab { min-width: 0; min-height: 0; }
.ds-topnav-split { margin-inline-start: var(--rw-space-6x); }
.ds-topnav-split::before {
  content: "";
  position: absolute;
  inset-inline-start: calc(-0.5 * (var(--rw-space-6x) + var(--rw-space-1x)));
  inset-block: var(--rw-space-3x);
  width: 1px;
  background: var(--rw-divider);
}

/* The end of the bar takes the room the start leaves, and its parts give way by that room
   (container queries below), whoever is signed in and however many tabs they have. */
.ds-topbar-end { display: flex; flex: 1 1 0; align-items: center; justify-content: safe flex-end; gap: var(--rw-space-1x); min-width: 0; container-type: inline-size; }
.ds-topbar-end > * { flex-shrink: 0; }
.ds-topbar-end > .rw-btn { flex-shrink: 0; }

/* The bar's tabs and buttons must read as things to click (Redwood's tabs only brighten their
   label on hover, which people missed): a rounded fill behind the label on hover and keyboard
   focus, a faint underline preview on hover, and Redwood's 3px underline on the selected tab.
   The fill is the stronger overlay, because the plain one barely shows on the dark bar. */
.ds-topnav { gap: var(--rw-space-1x); }
.ds-topnav > .rw-tab { padding-inline: var(--rw-space-3x); transition: color 120ms ease, border-color 120ms ease; }
.ds-topnav > .rw-tab::after {
  content: "";
  position: absolute;
  inset: var(--rw-space-2x) 0;
  border-radius: var(--rw-radius-md);
  background-color: transparent;
  outline: none;
  pointer-events: none;
  transition: background-color 120ms ease;
}
.ds-topnav > .rw-tab:hover::after,
.ds-topnav > .rw-tab:focus-visible::after,
.ds-topnav > .rw-tab:active::after { background-color: var(--rw-bg-active); }
.ds-topnav > .rw-tab:hover:not(.rw-selected) { border-bottom-color: var(--rw-text-secondary); }
.ds-topnav > .rw-tab:focus-visible::after { outline: 2px solid var(--rw-text-primary); outline-offset: 0; }
.ds-topbar .rw-btn-borderless:hover,
.ds-topbar .rw-btn-borderless:focus-visible { background-image: linear-gradient(var(--rw-bg-active), var(--rw-bg-active)); }
@media (prefers-reduced-motion: reduce) {
  .ds-topnav > .rw-tab, .ds-topnav > .rw-tab::after { transition: none; }
}

.ds-status { display: flex; align-items: center; gap: var(--rw-space-4x); min-width: 0; margin-inline-end: var(--rw-space-3x); color: var(--rw-text-secondary); font-size: var(--rw-body-sm-size); white-space: nowrap; }
.ds-status > .ds-state { color: var(--rw-text-primary); font-weight: 600; }
.ds-status-age { color: var(--rw-text-secondary); font-weight: 400; }
.ds-status-item strong, .ds-status-item .ds-num { color: var(--rw-text-primary); }
.ds-status-clock { color: var(--rw-text-primary); }
.ds-status-sensors > .rw-btn { padding-inline: var(--rw-space-2x); font-weight: 400; color: var(--rw-text-secondary); }
.ds-status-sensors > .rw-btn .ds-num { color: var(--rw-text-primary); }
.ds-status-sensors > .rw-btn .ds-num.ds-text-warning { color: var(--rw-text-warning); }
.ds-status-sensors > .rw-btn .ds-num.ds-text-danger { color: var(--rw-text-danger); }

.ds-usermenu > .rw-btn { padding: 0 var(--rw-space-1x); }
.ds-usermenu .ds-menu-caret { display: none; }
.ds-usermenu .rw-badge { margin-inline-start: var(--rw-space-1x); }
.ds-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--rw-space-7x);
  height: var(--rw-space-7x);
  border-radius: var(--rw-radius-md);
  background: var(--rw-bg-active);
  color: var(--rw-text-primary);
  font-size: var(--rw-body-xs-size);
  font-weight: 600;
}

/* ── Sign-in and start-up ───────────────────────────────────────────────────
   One frame for both (plate.js). The text sits on the start edge at a fixed top, which
   signin.js decides with the plate, so the name does not move when the sign-in replaces the
   start-up page. Behind it, the plate: the airspace around one site, still, in the base map's
   neutrals and the ink of ordinary traffic at reduced strength (about 1.3:1 for rings, 2:1
   for tracks), so the text keeps its full contrast. The page stays in the dark chrome in every
   theme, like the top bar. */
.ds-splash {
  position: relative;
  display: grid;
  grid-template-rows: var(--ds-splash-top, 30vh) auto minmax(0, 1fr);
  height: 100%;
  overflow: hidden auto;
  background: var(--rw-bg-app);
}
/* The plate fades out under the text: across from the start edge on a wide screen, up from
   the text on a narrow one. */
.ds-splash::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, var(--rw-bg-app) calc(var(--ds-splash-left, 0px) + 20rem), transparent calc(var(--ds-splash-left, 0px) + 42rem));
}
.ds-splash-narrow::after {
  background: linear-gradient(180deg, transparent calc(var(--ds-splash-top, 30vh) - 9rem), var(--rw-bg-app) calc(var(--ds-splash-top, 30vh) - 1rem));
}
.ds-splash-box {
  position: relative;
  z-index: 1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: min(28rem, 100% - 2 * var(--ds-splash-left, var(--rw-space-6x)));
  margin-inline-start: var(--ds-splash-left, var(--rw-space-6x));
  padding-block-end: var(--rw-space-8x);
}
.ds-splash-title { display: flex; align-items: center; gap: var(--rw-space-4x); }
.ds-splash-mark { flex-shrink: 0; width: var(--rw-space-12x); height: var(--rw-space-12x); }
.ds-splash-mark-tile { fill: var(--rw-bg-content); stroke: var(--rw-divider); }
.ds-splash-mark-glyph { fill: var(--rw-text-primary); stroke: var(--rw-text-primary); }
.ds-splash-name { font-size: var(--rw-heading-2xl-size); line-height: var(--rw-heading-2xl-lh); }
@media (max-width: 30rem) { .ds-splash-name { font-size: var(--rw-heading-lg-size); line-height: var(--rw-heading-lg-lh); } }
.ds-splash-lead { max-width: 22em; text-wrap: balance; margin-block-start: var(--rw-space-5x); color: var(--rw-text-secondary); font-size: var(--rw-body-xl-size); line-height: var(--rw-body-xl-lh); }
.ds-splash-box > .ds-skeleton { width: min(22rem, 100%); margin-block-start: var(--rw-space-6x); padding: 0; }
.ds-splash-box > .rw-banner { width: 100%; margin-block-start: var(--rw-space-6x); }
.ds-splash-box > .rw-banner + .ds-link { margin-block-start: var(--rw-space-4x); }
.ds-splash-why { margin-block-start: var(--rw-space-6x); padding: var(--rw-space-3x) var(--rw-space-4x); border-radius: var(--rw-radius-md); background: var(--rw-bg-muted); line-height: var(--rw-body-lg-lh); }
.ds-splash-note { margin-block-start: var(--rw-space-6x); color: var(--rw-text-secondary); }
.ds-splash-action { min-width: 12rem; margin-block-start: var(--rw-space-8x); }
.ds-splash-why + .ds-splash-action, .ds-splash-note + .ds-splash-action { margin-block-start: var(--rw-space-4x); }

.ds-plate { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.ds-plate-water { fill: rgba(0, 0, 0, .42); }
.ds-plate-shore { fill: none; stroke: var(--rw-neutral-170); stroke-width: 1.5; }
.ds-plate-road { fill: none; stroke: var(--rw-neutral-180); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.ds-plate-road-major { stroke: var(--rw-neutral-170); stroke-width: 4; }
.ds-plate-ring { fill: none; stroke: rgba(251, 249, 248, .09); stroke-width: 1; }
.ds-plate-site { fill: rgba(251, 249, 248, .03); stroke: rgba(251, 249, 248, .22); stroke-width: 1; stroke-dasharray: 4 4; }
.ds-plate-notice { fill: none; stroke: rgba(251, 249, 248, .14); stroke-width: 1; }
.ds-plate-notice-band { fill: none; stroke: rgba(251, 249, 248, .035); stroke-width: 9; }
.ds-plate-wedge { fill: rgba(251, 249, 248, .03); }
.ds-plate-trail { stroke: rgba(251, 249, 248, .2); stroke-width: 1.5; stroke-linecap: round; }
.ds-plate-leader { stroke: rgba(251, 249, 248, .24); stroke-width: 1; }
.ds-plate-tie { stroke: rgba(251, 249, 248, .16); stroke-width: 1; stroke-dasharray: 3 3; }
.ds-plate-keyline { fill: none; stroke: var(--rw-bg-app); stroke-linejoin: round; }
.ds-plate-mark { fill: rgba(251, 249, 248, .26); }
.ds-plate-mark-line { fill: none; stroke: rgba(251, 249, 248, .26); stroke-linecap: round; stroke-linejoin: round; }
.ds-plate-scale { fill: none; stroke: rgba(251, 249, 248, .24); stroke-width: 1; }
.ds-plate-label { fill: rgba(251, 249, 248, .3); font-size: var(--rw-body-xs-size); font-variant-numeric: tabular-nums; }

/* ── Pages that are not the map ─────────────────────────────────────────── */
.ds-page { height: 100%; overflow-y: auto; padding: var(--rw-space-6x); }
.ds-page-narrow { display: grid; place-items: center; }

/* ── Weather in the top bar ─────────────────────────────────────────────── */
.ds-weather { gap: var(--rw-space-2x); padding-inline: var(--rw-space-2x); font-weight: 400; color: var(--rw-text-primary); }
.ds-weather > .ds-state { font-weight: 600; }
.ds-weather-age { font-size: var(--rw-body-xs-size); }
/* The bar gives way in this order as its end runs out of room: temperature, the track count,
   the wind (it stays in the tooltip and the drawer), the clock, then the sensor count (it stays
   in Organisation and in the detail of each sensor). Below that the navigation folds into the
   user menu (shell.js). The steps are the measured widths of what is shown, with some air. */
@container (max-width: 64rem) { .ds-weather-temp { display: none; } }
@container (max-width: 61rem) { .ds-status-tracks { display: none; } }
@container (max-width: 54.5rem) { .ds-weather-wind { display: none; } }
@container (max-width: 47.75rem) { .ds-status-clock { display: none; } }
@container (max-width: 41.25rem) { .ds-status-sensors { display: none; } }
