/* Shared information dialogs. Content stays in its original node between opens. */
.floating_box_container { display: contents; }
/* A box gives its content room to breathe. It has a wide margin inside its
   edge and wide gaps between sections side by side. A phone keeps the small
   screen's surface padding. */
.floating_box {
  --floating-box-heading-line: 20px;
  --floating-box-padding: var(--ui-space-8);

  display: none;
}

@media (width <= 600px) {
  .floating_box {
    --floating-box-padding: var(--ui-space-4);
  }
}

dialog.floating_box_modal {
  position: fixed;
  inset: 0;
  width: min(1040px, calc(100vw - 32px));
  min-width: 0;
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  color: var(--color-floating-box-text-muted);
  background: var(--color-floating-box-background);
  border: 1px solid var(--color-floating-box-border);
  border-radius: var(--ui-radius-surface);
}

dialog.floating_box_modal:not([open]) { display: none; }

/* The overlay is its own dark surface in both themes. Some blocks draw
   straight on it, with no surface of their own (an empty state, a status).
   They take the overlay's text colours for the shared text tokens: its text,
   and its muted text for secondary and muted words. A block with its own
   tinted surface (a notice) keeps the page's tokens, which read on its tint. */
dialog.floating_box_modal :is(.block_empty_state, .block_status_list, .block_status) {
  --color-text: var(--color-floating-box-text);
  --color-text-secondary: var(--color-floating-box-text-muted);
  --color-text-muted: var(--color-floating-box-text-muted);
}

/* Sections, tables, lists of facts, disclosures and titles on the overlay
   also take its heading colour, row rule and row hover. A section title steps
   down to label size under the box's title. Its weight keeps its rank, as in
   the inspector. */
dialog.floating_box_modal :is(.block_surface, .block_collection, .block_detail_list, .block_disclosure, .block_surface_title) {
  --color-text: var(--color-floating-box-text);
  --color-text-secondary: var(--color-floating-box-text-muted);
  --color-text-muted: var(--color-floating-box-text-muted);
  --color-heading: var(--color-floating-box-heading);
  --color-border-subtle: var(--color-floating-box-rule);
  --color-toolbar-hover: var(--color-floating-box-row-hover-bg);
}

/* The chart block on the overlay (the image review's Statistics). Its text,
   rules, tiles and wells take the overlay's colours. Its lines take the
   overlay's checked chart pair. */
dialog.floating_box_modal :is(.block_stat_tiles, .block_chart, .block_bar_list, .block_chart_periods, .block_chart_note) {
  --color-text: var(--color-floating-box-text);
  --color-text-secondary: var(--color-floating-box-text-muted);
  --color-heading: var(--color-floating-box-heading);
  --color-border-subtle: var(--color-floating-box-rule);
  --color-card-background: transparent;
  --color-canvas: transparent;
  --color-surface-muted: var(--color-floating-box-row-hover-bg);
  --color-list-highlight: var(--color-floating-box-row-hover-bg);
  --color-chart-current: var(--color-floating-box-chart-current);
  --color-chart-previous: var(--color-floating-box-chart-previous);
}

dialog.floating_box_modal .block_surface_title {
  --ui-font-size-heading: var(--ui-font-size-label);
}

/* On the overlay, a chart's or list's title reads below its section's title.
   It takes the label size and the text colour, at normal weight. */
dialog.floating_box_modal :is(.block_chart_title, .block_bar_list_title) {
  color: var(--color-floating-box-text);
  font-size: var(--ui-font-size-label);
  font-weight: normal;
}

/* A quiet action on the overlay (a box's way back) takes the overlay's
   heading colour and row hover, as the close button does. */
dialog.floating_box_modal .block_action {
  --color-button-flat-text: var(--color-floating-box-heading);
  --color-button-neutral-quiet-text: var(--color-floating-box-heading);
  --color-button-hover: var(--color-floating-box-row-hover-bg);
  --color-surface-muted: var(--color-floating-box-row-hover-bg);
}

dialog.floating_box_modal .block_action:is(:hover, :focus, :active) {
  color: var(--color-floating-box-heading);
}

dialog.floating_box_modal .block_surfaces {
  --block-surfaces-gap: var(--ui-space-8);
}

/* A copy box on the overlay (Image information's checksum and UUID): its
   well and value take the overlay's colours, as its rows do. */
dialog.floating_box_modal .block_copy_field {
  --block-copy-field-well: var(--color-floating-box-row-hover-bg);
}

dialog.floating_box_modal .block_copy_field_value {
  color: var(--color-floating-box-text);
}

/* The box is dark in both themes. A chart on it, and a table's series swatch,
   take the box's chart colours, surface, text and rules. The --highcharts-*
   properties read these (screens_shared.css). */
dialog.floating_box_modal {
  --color-chart-1: var(--color-floating-box-chart-1);
  --color-chart-2: var(--color-floating-box-chart-2);
  --color-chart-3: var(--color-floating-box-chart-3);
  --color-chart-4: var(--color-floating-box-chart-4);
  --color-chart-5: var(--color-floating-box-chart-5);
  --color-chart-6: var(--color-floating-box-chart-6);
  --color-chart-7: var(--color-floating-box-chart-7);
  --color-chart-8: var(--color-floating-box-chart-8);
  --color-chart-other: var(--color-floating-box-chart-other);
}

dialog.floating_box_modal [data-highcharts] {
  --highcharts-background-color: var(--color-floating-box-background);
  --highcharts-neutral-color-100: var(--color-floating-box-heading);
  --highcharts-neutral-color-80: var(--color-floating-box-text);
  --highcharts-neutral-color-60: var(--color-floating-box-text-muted);
  --highcharts-neutral-color-40: var(--color-floating-box-text-muted);
  --highcharts-neutral-color-20: var(--color-floating-box-rule);
  --highcharts-neutral-color-10: var(--color-floating-box-rule);
  --highcharts-neutral-color-5: var(--color-floating-box-row-hover-bg);
  --highcharts-neutral-color-3: var(--color-floating-box-row-hover-bg);
}

/* A notice on the overlay (a box's failed load and its Retry) takes the dark
   theme's notice colours in both themes and the overlay's text. Its quiet
   button takes the overlay's heading colour, as the close button does. */
dialog.floating_box_modal .block_notice {
  --color-text: var(--color-floating-box-text);
  --color-notice-info-background: var(--color-floating-box-notice-info);
  --color-notice-warning-background: var(--color-floating-box-notice-warning);
  --color-notice-negative-background: var(--color-floating-box-notice-negative);
  --color-notice-positive-background: var(--color-floating-box-notice-positive);
  --color-status-neutral: var(--color-floating-box-status-neutral);
  --color-status-warning: var(--color-floating-box-status-warning);
  --color-status-negative: var(--color-floating-box-status-negative);
  --color-status-positive: var(--color-floating-box-status-positive);
  --color-button-neutral-quiet-text: var(--color-floating-box-heading);
}

/* A notice that opens a box without its title (a failed load) keeps clear of
   the close button, as the title does. */
.floating_box .content > .block_notice:first-child {
  margin-inline-end: calc(var(--ui-toolbar-control) + var(--ui-space-2));
}

/* A failed box is as tall as its notice: the overlay's minimum height is for
   the spinner while a box loads. */
dialog.floating_box_modal > .floating_box.load_failed {
  min-height: 0;
}

dialog.floating_box_modal .content > .block_notice:only-child {
  margin-block-end: 0;
}

/* The overlay floats over the photograph without dimming the page; clicking
   outside it closes it. */
dialog.floating_box_modal::backdrop {
  background: transparent;
}
dialog.floating_box_modal:has(#user_details) { width: min(380px, calc(100vw - 32px)); }
/* Image information: three columns. In a wide window each has room for a
   label and a whole UUID in its copy box. Debug information stays narrow. */
dialog.floating_box_modal:has(#image_information) { width: min(1600px, calc(100vw - 32px)); }
dialog.floating_box_modal:has(#image_debug_information) { width: min(480px, calc(100vw - 32px)); }
/* A tag's name and its value side by side, long values wrapping. */
dialog.floating_box_modal:has(#all_metadata) { width: min(720px, calc(100vw - 32px)); }

dialog.floating_box_modal > .floating_box {
  position: relative;
  inset-block-start: auto;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  max-width: none;
  height: auto;
  min-height: 160px;
  max-height: calc(100dvh - 32px);
  margin: 0;
  padding: 0;
}

/* DPG's overlay: only the close symbol, in the content's corner, on its right
   edge and level with the heading's first line. The title stays the dialog's
   accessible name; the content shows its own heading. */
.floating_box .top_bar {
  position: absolute;
  inset-block-start: calc(var(--floating-box-padding) + (var(--floating-box-heading-line) - var(--ui-toolbar-control)) / 2);
  inset-inline-end: var(--floating-box-padding);
  z-index: 1;
  display: flex;
  padding: 0;
}
/* The box's h2, for assistive technology; the content shows its own title. */
.floating_box .top_bar .floating_box_heading {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  overflow: hidden;
  white-space: nowrap;
  clip-path: inset(50%);
}
.floating_box .top_bar .close {
  display: grid;
  flex: 0 0 auto;
  width: var(--ui-toolbar-control);
  height: var(--ui-toolbar-control);
  padding: 0;
  place-items: center;
  color: var(--color-floating-box-heading);
  /* The content scrolls under the button. The box's ground fills the button
     and a band round it, so no text shows through. */
  background: var(--color-floating-box-background);
  border: 1px solid var(--color-floating-box-border);
  border-radius: var(--ui-radius-control);
  box-shadow: 0 0 0 var(--ui-space-2) var(--color-floating-box-background);
  cursor: pointer;
}
.floating_box .top_bar .close::before {
  font: var(--ui-icon-weight) var(--ui-toolbar-icon-size)/1 var(--ui-icon-font-family);
  content: var(--ui-icon-xmark) var(--ui-icon-alt,);
}
.floating_box .top_bar .close:hover {
  color: var(--color-floating-box-background);
  background: var(--color-floating-box-heading);
}
.floating_box .top_bar .close:focus-visible,
.floating_box a:focus-visible,
.floating_box .button:focus-visible {
  outline: 2px solid var(--color-floating-box-heading);
  outline-offset: 2px;
}
.floating_box .content {
  min-height: 0;
  padding: var(--floating-box-padding);
  overflow: auto;
  overscroll-behavior: contain;
  overflow-wrap: anywhere;
}
/* While a box loads another view of itself (data-box-view) the view it
   shows stays, dimmed, so the press is answered at once. */
.floating_box[aria-busy='true'] > .content:has(> *) {
  opacity: 0.5;
  cursor: progress;
}

/* The content takes focus so the keyboard scrolls it: its ring sits inside
   the box's edge. */
.floating_box .content:focus-visible {
  outline: 2px solid var(--color-floating-box-heading);
  outline-offset: -2px;
}
.floating_box_loading {
  position: absolute;
  inset: 60px 0 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

/* The title a floating box shows (h3.floating_box_title, under the box's
   h2 for assistive technology). */
.floating_box .floating_box_title {
  padding-inline-end: calc(var(--ui-toolbar-control) + var(--ui-space-2));
  padding-block-end: var(--ui-space-6);
  color: var(--color-floating-box-heading);
  font-size: var(--ui-font-size-control);
  font-weight: normal;
  font-style: normal;
  line-height: var(--floating-box-heading-line);
}

/* A count beside the title (a map's number of images). */
.floating_box .floating_box_title_count {
  color: var(--color-floating-box-text-muted);
  font-size: var(--ui-font-size-caption);
}

.floating_box a {
  color: var(--color-floating-box-link);
}

.floating_box a:hover {
  color: var(--color-floating-box-link-hover);
  text-decoration: underline;
}

/* A section title that opens its chart's values, and a key's other values,
   keep the text's colour: the angle and the underline say they open. */
.floating_box a:is(.block_surface_title_link, .block_chart_key_link, .block_chart_key_value, .block_collection_link),
.floating_box a:is(.block_surface_title_link, .block_chart_key_link, .block_chart_key_value, .block_collection_link):hover {
  color: inherit;
}

/* A period choice is a segment, not a link: it keeps the chart block's
   colours (the overlay's, restated above) and no underline. */
.floating_box a.block_chart_period {
  color: var(--color-text-secondary);
  text-decoration: none;
}

.floating_box a.block_chart_period:is(:hover, [aria-current='page']) {
  color: var(--color-text);
  text-decoration: none;
}

.floating_box select {
  color: var(--color-floating-box-select-text);
  background-color: transparent;
  background-image: var(--floating-box-select-icon);
  background-position: right 7px center;
  background-repeat: no-repeat;
  background-size: 9px 9px;
}

/* @end */

/* @group Floating Boxes */

/* @group User Details */

#user_details .user .icon img {
  display: block;
  box-sizing: border-box;
  width: 112px;
  height: 112px;
  margin-inline-end: auto;
  margin-inline-start: auto;
  border: 1px solid var(--color-floating-box-border);
  border-radius: var(--ui-radius-panel);
}

#user_details .content {
  text-align: center;
}

#user_details .content a {
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  min-height: var(--ui-touch-target);
  padding: var(--ui-space-2);
  color: var(--color-floating-box-heading);
  line-height: var(--ui-line-height-control);
  border: 1px solid currentcolor;
  border-radius: var(--ui-radius-control);
}

#user_details .content a:hover {
  color: var(--color-text-inactive);
  text-decoration: none;
  border: 1px solid currentcolor;
}

/* The box is dark in both themes: its headings and the theme field's label
   use the box's muted text colour (tested against the box). */
#user_details .content .ui_heading_group,
#user_details .content .ui_field > label {
  color: var(--color-floating-box-text-muted);
}

#user_details .content .ui_heading_group {
  width: 100%;
  margin-block-start: var(--ui-space-4);
  margin-block-end: var(--ui-space-1);
  padding-block-end: var(--ui-space-1);
}

/* The theme field sits centred like the account switcher, at its natural width. */
#user_details .content .ui_field {
  justify-items: center;
  margin-block-start: var(--ui-space-4);
}

#user_details .content .ui_field select {
  inline-size: auto;
  margin-inline: auto;
}

#user_details .content .user .icon,
#user_details .content .user .username,
#user_details .content .user .email {
  margin-block-end: var(--ui-space-2);
}

/* @end */

/* @group Image Debug Information */

#image_debug_information .item {
  display: flex;
  flex-flow: row nowrap;
  place-content: stretch flex-start;
  margin: 0;
  padding-block-start: var(--ui-space-1);
  padding-block-end: var(--ui-space-1);
  border-block-start: 1px solid var(--color-border-dark);
}

#image_debug_information .item:hover {
  color: var(--color-floating-box-heading);
  background-color: var(--color-floating-box-row-hover-bg);
  border-block-start: 1px solid var(--color-border-dark);
}

#image_debug_information .item label {
  flex: 0 0 auto;
  align-self: auto;
  order: 0;
  width: 116px;
  color: var(--color-text-subtle);
}

#image_debug_information .item .data {
  flex: 1 1 auto;
  align-self: auto;
  order: 0;
}

/* @end */

/* @group Image Information */

/* The photo's own average colour (a custom property the view sets), as a
   swatch before its hex value. */
#image_information .average_colour_box {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-inline-end: var(--ui-space-1);
  background-color: var(--average-colour);
  border: 1px solid var(--color-text-inactive);
}

/* @end */

/* @end */
