/**
 * Display screen styling.  Depends on the card partial.
 */

@use "../settings" as *;
@use "../tools" as *;

$display-red: palette("red") !default;
$display-blue-university: palette("blue-university") !default;
$display-blue-bright: palette("blue-bright") !default;
$display-dark: palette("grey-dark") !default;

.card-display {
  --#{$prefix}card-border-color: #{map-get($display-red, "brand-color")};
  --#{$prefix}card-border-width: 0;
  --#{$prefix}card-cap-bg: #{map-get($display-blue-university, "brand-color")};
  --#{$prefix}card-cap-color: #{map-get($display-blue-university, "brand-bg-text")};
  --#{$prefix}card-cap-padding-x: 4vw;
  --#{$prefix}card-spacer-x: 4vw;
  --#{$prefix}card-spacer-y: 2vh;
  --#{$prefix}schedule-row-height: calc(3lh + 1rem);  // stylelint-disable-line function-disallowed-list
  // We need to support Chromium 89 which does not have the lh unit
  @supports not (height: 3lh) {
    --#{$prefix}schedule-row-height: 6rem;
  }

  height: 100vh;
  overflow: hidden;
  background-color: transparent;

  > .card-header {
    --#{$prefix}card-border-width: 8px;
    display: grid;
    grid-template-columns: minmax(16rem, 1fr) auto minmax(16rem, 1fr);
    column-gap: space(6);
    align-items: center;
    justify-content: stretch;
    height: auto;
  }

  > .card-footer {
    @include font-size($h2-font-size);
  }

  > .card-body {
    overflow-y: auto;
  }

  [data-provide="uoe-display"] {
    overflow-y: hidden;
    scroll-behavior: smooth;

    &.fade:not(.show) {
      scroll-behavior: auto;
    }

    > :last-child {
      margin-bottom: 100vh;
    }
  }
}

.card-display-uebs {
  --#{$prefix}card-border-color: #{map-get($display-red, "brand-color")};
  --#{$prefix}card-cap-bg: #{map-get($display-dark, "brand-color")};
  --#{$prefix}card-cap-color: #{map-get($display-dark, "brand-bg-text")};
}

.card-display-ppls {
  --#{$prefix}card-border-color: #{map-get($display-blue-bright, "brand-color")};
  --#{$prefix}card-cap-bg: #{map-get($display-dark, "brand-color")};
  --#{$prefix}card-cap-color: #{map-get($display-dark, "brand-bg-text")};
}

.display-heading,
.display-room,
.display-clock {
  @include font-size($h2-font-size);
  font-weight: $font-weight-bold;
}

.display-heading {
  text-align: center;
}

.display-room {
  margin-top: space(5);
}

.display-page {
  margin-bottom: space(6);
}

.display-clock {
  line-height: 1.2;
}

.display-clock,
.display-right-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
}

.display-right-stack {
  font-size: 80%;
  white-space: nowrap;
}

.display-small {
  font-size: 50%;
  font-weight: $font-weight-normal;
}

.display-booking {
  @include font-size($h3-font-size);
  display: flex;
  column-gap: space(6);
  align-items: center;
  justify-content: space-between;
  font-weight: $font-weight-semibold;

  [class^="bi-"] {
    margin-left: space(2);
  }
}

.display-booking-large {
  @include font-size($h1-font-size);
}

.display-page-break {
  margin-top: 100vh;
}

.display-muted {
  font-weight: $font-weight-light;
  color: $text-muted;
}

.display-schedule,
.display-schedule-times {
  --#{$prefix}schedule-max-minutes: calc((var(--#{$prefix}schedule-end-hour, 18) - var(--#{$prefix}schedule-start-hour, 8)) * 60);  // stylelint-disable-line function-disallowed-list
  display: grid;
  grid-template-columns: [room] 10rem repeat(var(--#{$prefix}schedule-max-minutes), minmax(0, 1fr));
  grid-row-gap: 1rem;
  grid-column-gap: 0;
  font-weight: $font-weight-semibold;
}

.display-schedule {
  grid-auto-rows: calc(var(--#{$prefix}schedule-row-height) + .5rem);  // stylelint-disable-line function-disallowed-list
  padding: 1rem 0;
  background-image: linear-gradient(to bottom, $gray-400 .5rem, transparent .5rem);
  background-size: 100% calc(var(--#{$prefix}schedule-row-height) + 1.5rem);  // stylelint-disable-line function-disallowed-list
}

.display-schedule-event,
.display-schedule-comment {
  grid-row-start: var(--#{$prefix}schedule-row);
  grid-row-end: calc(var(--#{$prefix}schedule-row) + 1);  // stylelint-disable-line function-disallowed-list
  grid-column-start: calc(var(--#{$prefix}start-minutes, 0) + 2);  // stylelint-disable-line function-disallowed-list
  grid-column-end: calc(var(--#{$prefix}end-minutes, var(--#{$prefix}schedule-max-minutes)) + 2);  // stylelint-disable-line function-disallowed-list
  padding: .5rem;
  margin-right: .5rem;
  overflow: hidden;
}

.display-schedule-event {
  padding-top: calc(.5rem - 2px);  // stylelint-disable-line function-disallowed-list
  background: $white;
  border: solid 2px $gray-600;
  @include edgel-shadow();
}

.display-schedule-comment {
  text-align: center;
}

.display-schedule-room {
  grid-row: var(--#{$prefix}schedule-row) / span 1;
  grid-column: room / span 1;
  padding: .5rem .5rem .5rem 0;
}

.display-schedule-row {
  display: contents;
}

.display-schedule-times {
  grid-template-rows: [times] 2rem;
}

.display-schedule-times-item {
  grid-row: times / span 1;
  grid-column: calc((var(--#{$prefix}schedule-hour) - var(--#{$prefix}schedule-start-hour, 8)) * 60 + 2) / span 60;  // stylelint-disable-line function-disallowed-list
  font-weight: $font-weight-bold;
}

.display-highlight {
  color: $light;
  background-color: $dark;
  border-color: transparent;
}

.display-schedule-event .badge {
  text-transform: uppercase;
}
