/* DIALOG BLOCK */

.dialog {
  --dialog-max-w: calc(100vw - var(--gutter) * 2);
  --dialog-max-h: calc(100vh - var(--gutter) * 2);
  --dialog-header-h: 4.5rem;
  --dialog-footer-h: 4.5rem;
  --dialog-comments-w: 22.5rem;
  --dialog-background: var(--color-black);
  width: 100%;
  max-width: var(--dialog-max-w);
  height: 100%;
  max-height: var(--dialog-max-h);
  color: var(--color-grey-800);
  border-radius: var(--rounded-2xl);
  overflow: hidden;
  background: var(--dialog-background);
  margin: auto;
}

.dialog.with-dtl {
  --dialog-max-w: calc(100vw - var(--gutter) * 2 - 27rem);
  margin-right: 29rem;
  margin-left: var(--gutter);
}

/* Header */

.dialog [data-pc-section='header'] {
  height: var(--dialog-header-h);
  padding: 1rem;
  color: var(--color-white);
  background: var(--color-white-10);
  display: flex;
  gap: var(--space-16);
}
@media screen and (max-width: 96rem) {
  .dialog#virtual-sample.with-dtl [data-pc-section='header'] h2 {
    text-align: left;
    left: 27.5rem;
    right: 9.5rem;
  }
}
.dialog:not(#physical-sample) [data-pc-section='header'] h2 {
  font-family: var(--font-serif);
  position: absolute;
  left: 15rem;
  right: 5rem;
  text-align: center;
  line-height: 2.5rem;
  max-height: 1lh;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0 auto;
}
.dialog [data-pc-name='pcclosebutton'] {
  color: var(--color-white);
}
.dialog__tabs {
  display: flex;
  gap: var(--space-4);
  background: var(--color-black);
  border-radius: var(--rounded-lg);
  outline: 4px solid var(--color-black);
  position: relative;
  z-index: 10;
}
.dialog__tabs .btn {
  align-items: center;
  font-size: var(--text-md);
}
.dialog__tabs .btn:hover {
  --btn-background: var(--color-white-10);
}
.dialog__tabs .btn[aria-pressed='true'] {
  --btn-background: var(--color-white);
  --btn-color: var(--color-text);
  --btn-border-color: var(--color-white);
}

/* Content */
.dialog__inner {
  padding: var(--space-16);
  background: var(--dialog-inner-background, #f7f7f7);
  height: 100%;
  overflow-y: auto;
}
#dynamic.dialog__inner {
  overflow-y: hidden;
}
.with-comments .dialog__inner {
  margin-right: var(--dialog-comments-w, 20rem);
}
.dialog__inner .tracks-header {
  height: 3.75rem;
  border-radius: var(--rounded-xl);
  padding-right: var(--space-8);
  flex-wrap: nowrap;
  gap: var(--space-8);
  position: sticky;
  top: 0;
  z-index: 1;
}
.dialog__inner .tracks-header .btn::before {
  content: '';
  display: block;
  position: absolute;
  top: -.75rem;
  left: -3rem;
  bottom: -.75rem;
  width: 2.5rem;
  background: linear-gradient(to right, transparent, var(--dialog-inner-background, #f7f7f7));
}
.dialog__inner .tracks {
  display: flex;
  gap: var(--space-8);
  width: 100%;
  margin-left: calc(-1 * var(--space-16));
  padding: var(--space-12) var(--space-16);
  overflow-x: scroll;
  overflow-y: hidden;
  position: relative;
}
@supports selector(::scroll-button(*)) {
  .dialog__inner .tracks {
    anchor-name: --tracks;
    scroll-behavior: smooth;
    &::scroll-button(*) {
      --scroll-button-position: 8px;
      position-anchor: --tracks;
      position: fixed;
      align-self: anchor-center;
      z-index: 1;
      width: 2.5rem;
      height: 2.5rem;
      border: 1px solid var(--color-grey-500);
      border-radius: var(--rounded-lg);
      color: transparent;
      background-repeat: no-repeat;
      background-position: center;
      background-size: var(--icon-size, 1.25rem);
      background-image: var(--icon, var(--icon-arrow-right));
      background-color: var(--color-white);
      user-select: none;
      cursor: pointer;
      opacity: 1;
      transition: opacity 0.2s ease-out;
    }
    &::scroll-button(*):hover {
      border-color: var(--color-grey-700);
    }
    &::scroll-button(*):disabled {
      opacity: 0;
    }
    &::scroll-button(left) {
      --icon: var(--icon-chevron-single-left);
      content: "←" / "Scroller vers la gauche";
      left: calc(anchor(left) + var(--scroll-button-position));
    }
    &::scroll-button(right) {
      --icon: var(--icon-chevron-single-right);
      content: "→" / "Scroller vers la droite";
      right: calc(anchor(right) + var(--scroll-button-position));
    }
  }
  [data-browser*='edge' i] .tracks::-webkit-scrollbar {
    width: 0px;
    height: 0px;
  }
  [data-browser*='edge' i] .tracks::-webkit-scrollbar-track {
    background: transparent; /* Match background */
  }
  [data-browser*='edge' i] .tracks::-webkit-scrollbar-thumb {
    background: hsla(180, 1%, 51%, .7); /* Customize scrollbar color */
    border-radius: 5px;
  }
  [data-browser*='edge' i] .tracks {
    scrollbar-color: auto;
  }
}
/* Windows fix */
[data-browser*='windows' i] .dialog__inner .tracks {
  transform: translateY(0.46875rem);
}
.dialog__inner .tracks > *:last-child {
  margin-right: var(--space-8);
}
.dialog [data-pc-section='content'] [role='tablist'] {
  height: 3.5rem;
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  margin: 0 auto;
  border-bottom: 1px solid var(--color-grey-700);
  padding-top: 7px;
}
.dialog [data-pc-section='content'] [role='tab'] {
  --tab-h: 3rem;
  --tab-min-w: none;
  --tab-py: var(--space-8);
  --tab-px: var(--space-12);
  --tab-border-w: 1px;
  --tab-color: var(--color-grey-400);
  --tab-background: transparent;
  --tab-border-color: transparent;
  position: relative;
  display: flex;
  align-items: center;
  font-size: var(--text-md);
  text-align: center;
  background-color: transparent;
  color: var(--tab-color);
  padding: var(--tab-py) var(--tab-px);
  margin: 0;
  cursor: pointer;
  gap: var(--space-4);
  min-width: var(--tab-min-w);
  height: var(--tab-h);
  border-bottom: var(--tab-border-w) solid var(--tab-border-color);
}
.dialog [data-pc-section='content'] [role='tab'][aria-selected='true'] {
  --tab-border-color: var(--color-white);
  --tab-color: var(--color-white);
}
.dialog [data-pc-section='content'] [role='tab']:focus-visible {
  z-index: 20;
}
.dialog [data-pc-section='content'] [role='tab'] .label {
  flex-grow: 1;
  font-weight: 500;
  letter-spacing: 0.01em;
  margin-top: -0.1em;
}

/* Footer */
.dialog [data-pc-section='footer'] {
  display: flex;
  gap: var(--space-16);
  height: var(--dialog-footer-h);
  padding: 1rem;
  background: var(--color-black);
  color: var(--color-white);
}

/* Virtual Sample */
.dialog#virtual-sample {
  --dialog-inner-background: #f7f7f7;
}
.dialog#virtual-sample [data-pc-section='header'] h2 {
  left: 1rem;
  right: 1rem;
  margin-inline: 16rem;
  min-width: 14ch;
}
.dialog#virtual-sample #comments-container {
  top: var(--dialog-header-h);
}
.dialog#virtual-sample.dynamic #comments-container {
  top: 4.5rem;
}
.dialog#virtual-sample.static #comments-container {
  top: 8rem;
}
.dialog#virtual-sample.static [data-pc-section='footer'] {
  display: none;
}
.dialog#virtual-sample.static .dialog__inner {
  height: calc(100% - 3.5rem) !important;
}

/* Physical Sample */
.dialog#physical-sample {
  --dialog-header-h: 15rem;
  --dialog-background: var(--color-grey-50);
  padding: var(--space-32) var(--space-32) 0;
  overflow-y: auto;
}
.dialog#physical-sample [data-pc-section='header'] {
  display: flex;
  flex-direction: column;
  text-align: center;
  justify-content: center;
  align-items: center;
  gap: 0;
  padding: var(--space-32);
  color: var(--color-white);
  background: linear-gradient(
      90deg,
      hsla(0, 0%, 10%, 0.5) 0%,
      hsla(0, 0%, 10%, 0.9) 50%,
      hsla(0, 0%, 10%, 0.9) 100%
    ),
    var(--cover), var(--color-black);
  background-repeat: no-repeat;
  background-size: cover;
  border-radius: var(--rounded-xl);
}
.dialog#physical-sample [data-pc-name='pcclosebutton'] {
  top: var(--space-40);
  right: var(--space-40);
}
.dialog#physical-sample .overflow-y {
  border-radius: var(--rounded-xl) var(--rounded-xl) 0 0;
}
.dialog#physical-sample .masonry > :only-child {
  column-span: initial;
}
@media (min-width: 90rem) {
  .dialog#physical-sample .masonry {
    column-count: 3;
  }
}

/* Project Request Dialog */
#project-request-dialog,
#optimization-request-dialog {
  --dialog-max-w: 704px;
  --dialog-max-h: 712px;
  --dialog-header-h: 6rem;
  --dialog-background: var(--color-white);
  color: var(--color-black);
  align-items: stretch;
  overflow: hidden;
}
#optimization-request-dialog {
  --dialog-max-h: 676px;
  --dialog-header-h: 8rem;
}
#optimization-request-dialog [data-pc-section='header'] {
  flex-direction: column;
  align-items: center;
  gap: 0;
}
#project-request-dialog h2,
#optimization-request-dialog h2 {
  position: static !important;
  color: var(--color-black);
  margin-block: var(--space-16) !important;
}
#project-request-dialog [data-pc-name='pcclosebutton'],
#optimization-request-dialog [data-pc-name='pcclosebutton'] {
  display: none;
}
#project-request-dialog #project-dtl {
  position: relative;
  padding-left: var(--space-64);
}
#project-request-dialog #project-dtl.selected {
  border-color: var(--color-primary-20);
  background-color: var(--color-primary-10);
}
#project-request-dialog #project-dtl input[type='checkbox'] {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--rounded-md);
  position: absolute;
  left: var(--space-12);
}
#optimization-request-dialog select {
  background-image: var(--icon-chevron-single-down-grey);
  background-position: center right 1rem;
  background-repeat: no-repeat;
}
#project-request-dialog [data-icon='leaf'],
#optimization-request-dialog [data-icon='leaf'] {
  --column-gap: var(--space-4);
  padding: 0.25rem var(--space-8) 0.375rem;
  background: var(--color-dtl-15);
  color: var(--color-dtl);
  border-radius: var(--rounded-md);
  line-height: 1;
  font-weight: 500;
}
#project-request-dialog [data-icon='leaf']::before,
#optimization-request-dialog [data-icon='leaf']::before {
  transform: translateY(0.125rem);
}
