﻿/* Template base styles shared by built-in and custom templates. */

.schedule {
  font-family: var(--design-font);
  position: relative;
  box-sizing: border-box;
  overflow: hidden;
  flex-shrink: 0;
  background: #ffffff;
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "clig" 0;
}

.background-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
  pointer-events: none;
}

.illustration {
  position: absolute;
  background: transparent;
  display: flex;
  justify-content: center;
  align-items: center;
  color: rgba(255, 255, 255, 0.75);
  font-size: 24px;
  text-align: center;
  overflow: hidden;
  cursor: grab;
  user-select: none;
  z-index: 1;
}

.illustration:active { cursor: grabbing; }

.illustration-image {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  transform-origin: center center;
  pointer-events: none;
  user-select: none;
}

.illustration-image img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.left-list {
  position: relative;
  z-index: 3;
  box-sizing: border-box;
}

.stream-row { position: relative; }

.stream-row.two-stream {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 12px;
}

.stream-card {
  position: relative;
  color: white;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  background-color: transparent;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
}

.date-box {
  position: absolute;
  text-align: center;
  font-weight: bold;
  background-color: transparent;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0;
  letter-spacing: normal;
}

.date-box .day {
  display: block;
  font-size: 29px;
  line-height: 26px;
  color: white;
  letter-spacing: normal;
}

.date-box .mon {
  display: block;
  font-size: 17px;
  line-height: 17px;
  color: var(--fallback-red);
  letter-spacing: normal;
}

.title {
  line-height: 1.25;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.subtitle {
  line-height: 1;
  margin-top: 2px;
  white-space: nowrap;
  overflow: visible;
}

.time {
  position: absolute;
  color: white;
  font-weight: bold;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: transparent;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
}

.time-zone,
.time-value {
  display: inline-block;
  line-height: 1;
}

.offline {
  justify-content: center;
  padding-left: 0 !important;
  font-size: 50px;
  line-height: 0.9;
  font-weight: 700;
  letter-spacing: 2px;
  text-align: center;
}

.offline-text {
  display: grid;
  justify-items: center;
  gap: var(--custom-offline-line-gap, 0);
  max-width: 86%;
  overflow: visible;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: calc(1em * var(--offline-scale, 1));
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "clig" 0;
}

.offline-text span {
  display: block;
  width: fit-content;
  max-width: 100%;
  overflow: visible;
  text-overflow: ellipsis;
  text-align: center;
}

.offline .date-box { letter-spacing: normal; }

.week {
  position: absolute;
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 700;
  z-index: 3;
}

.week .label,
.week .date-range {
  box-sizing: border-box;
  color: white;
  background-color: transparent;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
}

.week .arrow { color: var(--fallback-card); }

.week-date-group {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.week-date-group .week-day { order: 1; }
.week-date-group .week-month { order: 2; }

.credit {
  position: absolute;
  color: white;
  font-weight: 900;
  box-sizing: border-box;
  display: flex;
  gap: 16px;
  align-items: center;
  z-index: 3;
  background-color: transparent;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
}

.credit span { color: var(--fallback-red); }

.credit div {
  min-width: 0;
  max-width: 100%;
  font-size: calc(1em * var(--credit-scale, 1));
  line-height: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.socials {
  position: absolute;
  display: flex;
  gap: 12px;
  z-index: 3;
}

.social-item {
  color: white;
  font-weight: 800;
  box-sizing: border-box;
  background-color: transparent;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
}

.social-item span {
  color: var(--fallback-red);
  margin-right: 8px;
}

.schedule.custom-template-active .background-layer { background-image: var(--template-bg); }
.schedule.custom-template-active.ratio-1-1 .stream-card { background-image: var(--template-stream-card-bg); }
.schedule.custom-template-active.ratio-16-9 .stream-row.single .stream-card { background-image: var(--template-stream-wide-bg); }
.schedule.custom-template-active.ratio-16-9 .stream-row.two-stream .stream-card { background-image: var(--template-stream-half-bg); }
.schedule.custom-template-active .stream-card.offline { background-image: var(--template-offline-bg); }
.schedule.custom-template-active .date-box { background-image: var(--template-date-box-bg); }
.schedule.custom-template-active .time { background-image: var(--template-time-bg); }
.schedule.custom-template-active .credit { background-image: var(--template-credit-bg); }

.schedule.custom-template-active {
  width: var(--custom-canvas-width);
  height: var(--custom-canvas-height);
  font-family: var(--custom-font-main, var(--design-font));
}

.schedule.custom-template-active .title { font-family: var(--custom-title-font, var(--custom-font-main, var(--design-font))); }
.schedule.custom-template-active .subtitle { font-family: var(--custom-subtitle-font, var(--custom-font-main, var(--design-font))); }
.schedule.custom-template-active .date-box .day { font-family: var(--custom-date-day-font, var(--custom-font-display, var(--custom-font-main, var(--design-font)))); }
.schedule.custom-template-active .date-box .mon { font-family: var(--custom-date-name-font, var(--custom-font-display, var(--custom-font-main, var(--design-font)))); }
.schedule.custom-template-active .time { font-family: var(--custom-time-font, var(--custom-font-main, var(--design-font))); }
.schedule.custom-template-active .offline { font-family: var(--custom-offline-font, var(--custom-font-main, var(--design-font))); }
.schedule.custom-template-active .week-month { font-family: var(--custom-week-month-font, var(--custom-font-main, var(--design-font))); }
.schedule.custom-template-active .week-day { font-family: var(--custom-week-day-font, var(--custom-font-display, var(--custom-font-main, var(--design-font)))); }
.schedule.custom-template-active .week .arrow { font-family: var(--custom-week-arrow-font, var(--custom-font-main, var(--design-font))); }
.schedule.custom-template-active .social-item { font-family: var(--custom-social-font, var(--custom-font-main, var(--design-font))); }
.schedule.custom-template-active .credit { font-family: var(--custom-credit-font, var(--custom-font-main, var(--design-font))); }

.schedule.custom-template-active .offline { color: var(--custom-offline-color, var(--template-light-text)); }
.schedule.custom-template-active .week-month { color: var(--custom-week-month-color, var(--template-light-text)); }
.schedule.custom-template-active .week-day { color: var(--custom-week-day-color, var(--template-date-text)); }

.schedule.custom-template-active .title {
  box-sizing: content-box;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 0.25em;
  padding-bottom: 0.18em;
  margin-right: -0.25em;
  margin-bottom: -0.18em;
  transform: translate(var(--custom-title-x, 0), var(--custom-title-y, 0)) rotate(var(--custom-title-rotate, 0deg));
  transform-origin: center center;
}

.schedule.custom-template-active .subtitle {
  box-sizing: content-box;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 0.25em;
  padding-bottom: 0.18em;
  margin-right: -0.25em;
  margin-bottom: -0.18em;
  transform: translate(var(--custom-subtitle-x, 0), var(--custom-subtitle-y, 0)) rotate(var(--custom-subtitle-rotate, 0deg));
  transform-origin: center center;
}

.schedule.custom-template-active .date-box .day {
  transform: translate(var(--custom-date-day-x, 0), var(--custom-date-day-y, 0)) rotate(var(--custom-date-day-rotate, 0deg));
  transform-origin: center center;
}

.schedule.custom-template-active .date-box .mon {
  transform: translate(var(--custom-date-name-x, 0), var(--custom-date-name-y, 0)) rotate(var(--custom-date-name-rotate, 0deg));
  transform-origin: center center;
}

.schedule.custom-template-active .time-zone {
  transform: rotate(var(--custom-timezone-rotate, 0deg));
  transform-origin: center center;
}

.schedule.custom-template-active .time-value {
  transform: rotate(var(--custom-time-value-rotate, 0deg));
  transform-origin: center center;
}

.schedule.custom-template-active .offline-text {
  transform: translate(var(--custom-offline-text-x, 0), var(--custom-offline-text-y, 0)) rotate(var(--custom-offline-text-rotate, 0deg));
  transform-origin: center center;
}

.schedule.custom-template-active .week-month .week-text {
  transform: rotate(var(--custom-week-month-text-rotate, 0deg));
  transform-origin: center center;
}

.schedule.custom-template-active .week-day .week-text {
  transform: rotate(var(--custom-week-day-text-rotate, 0deg));
  transform-origin: center center;
}

.schedule.custom-template-active .week .arrow {
  color: var(--custom-week-arrow-color, var(--template-week-arrow));
  -webkit-text-stroke: var(--custom-week-arrow-stroke-width, 0) var(--custom-week-arrow-stroke-color, transparent);
  paint-order: stroke fill;
  transform: rotate(var(--custom-week-arrow-text-rotate, 0deg));
  transform-origin: center center;
}

.schedule.custom-template-active .social-item strong {
  transform: rotate(var(--custom-social-text-rotate, 0deg));
  transform-origin: center center;
}

.schedule.custom-template-active .credit div {
  transform:
    translate(var(--custom-credit-text-x, 0), var(--custom-credit-text-y, 0))
    rotate(var(--custom-credit-text-rotate, 0deg));
  transform-origin: center center;
}

.schedule.custom-template-active .illustration {
  left: var(--custom-illustration-x);
  top: var(--custom-illustration-y);
  right: auto;
  bottom: auto;
  width: var(--custom-illustration-width);
  height: var(--custom-illustration-height);
  transform: rotate(var(--custom-illustration-rotate, 0deg));
  transform-origin: center center;
}

.schedule.custom-template-active .left-list {
  position: absolute;
  left: var(--custom-stream-list-x);
  top: var(--custom-stream-list-y);
  width: var(--custom-stream-list-width);
  padding: 0;
}
