/*
 * Terms of use (0.30): the page of its own (dlight_admin/terms/layout.html) and the pieces of
 * dlight_admin/terms/includes/, which also work in a project's layout. Colours from the theme (--bs-primary,
 * --bs-primary-rgb); dark mode through .dark-version, like the admin.
 */
.dl-terms-page,
.dl-terms {
  --dl-terms-ink: #344767;
  --dl-terms-muted: #7b809a;
  --dl-terms-line: #e9ecef;
  --dl-terms-soft: #f8f9fa;
  --dl-terms-paper: #fff;
  --dl-terms-tint: rgba(var(--bs-primary-rgb, 26, 204, 141), 0.1);
}

.dark-version.dl-terms-page,
.dark-version .dl-terms {
  --dl-terms-ink: #f0f2f5;
  --dl-terms-muted: #a5a9b8;
  --dl-terms-line: #2f3136;
  --dl-terms-soft: #26282d;
  --dl-terms-paper: #1d1d1d;
}

/* ------------------------------------------------------------ the page of its own */

.dl-terms-page { min-height: 100vh; color: var(--dl-terms-ink); }

.dl-terms-top {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 4rem;
  padding: 0 clamp(1rem, 4vw, 2rem);
  background: var(--dl-terms-paper);
  border-bottom: 1px solid var(--dl-terms-line);
}

.dl-terms-top__brand { display: flex; align-items: center; gap: 0.75rem; min-width: 0; color: var(--dl-terms-ink); font-weight: 700; }
.dl-terms-top__brand:hover { color: var(--dl-terms-ink); }
.dl-terms-top__brand img { height: 30px; width: auto; }
.dl-terms-top__brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-terms-top__user { display: flex; align-items: center; gap: 0.875rem; color: var(--dl-terms-muted); font-size: 0.875rem; }

.dl-terms-top__leave {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4375rem 0.875rem;
  border: 1px solid var(--dl-terms-line);
  border-radius: 0.5rem;
  background: transparent;
  color: var(--dl-terms-ink);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.dl-terms-top__leave:hover { border-color: #dc2626; color: #dc2626; }

.dl-terms-main { max-width: 54rem; margin: 0 auto; padding: 2rem clamp(0.75rem, 3vw, 2rem) 2.5rem; }

/* ------------------------------------------------------------ the card of the text */

.dl-terms-card { --dl-terms-pad: clamp(1.25rem, 4vw, 2.75rem); border: 1px solid var(--dl-terms-line); box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04); }
.dl-terms-card > .card-body { padding: var(--dl-terms-pad); }

.dl-terms { display: flex; flex-direction: column; gap: 2rem; color: var(--dl-terms-ink); }

.dl-terms__heading { display: flex; flex-direction: column; gap: 0.625rem; padding-bottom: 1.75rem; border-bottom: 1px solid var(--dl-terms-line); }
.dl-terms__eyebrow { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; color: var(--dl-terms-muted); font-size: 0.8125rem; }

.dl-terms__badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1875rem 0.625rem;
  border-radius: 999px;
  background: var(--dl-terms-tint);
  color: var(--bs-primary);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.dl-terms__title { margin: 0; color: var(--dl-terms-ink); font-size: clamp(1.5rem, 2.6vw, 2rem); font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
.dl-terms__lead { margin: 0; color: var(--dl-terms-muted); font-size: 1rem; }
.dl-terms__lead .fa-circle-check { color: var(--bs-primary); }
.dl-terms__source { margin: 0; color: var(--dl-terms-muted); font-size: 0.8125rem; word-break: break-word; }
.dl-terms__source a { color: inherit; text-decoration: underline; }

/* The text: reading width and rhythm; the page scrolls, not a box. */
.dl-terms__body { max-width: 44rem; color: var(--dl-terms-ink); font-size: 1rem; line-height: 1.75; }
.dl-terms__body > :first-child { margin-top: 0; }
.dl-terms__body p, .dl-terms__body ul, .dl-terms__body ol { margin: 0 0 1.125rem; }
.dl-terms__body ul, .dl-terms__body ol { padding-left: 1.375rem; }
.dl-terms__body li { margin-bottom: 0.375rem; }
.dl-terms__body a { color: var(--bs-primary); text-underline-offset: 2px; }
.dl-terms__body strong { font-weight: 600; }

.dl-terms__body h2, .dl-terms__body h3, .dl-terms__body h4, .dl-terms__body h5, .dl-terms__body h6 {
  margin: 2.25rem 0 0.75rem;
  color: var(--dl-terms-ink);
  font-weight: 700;
  line-height: 1.3;
  scroll-margin-top: 6rem;
}

.dl-terms__body h2 { font-size: 1.3125rem; letter-spacing: -0.005em; }
.dl-terms__body h3 { font-size: 1.0625rem; }
.dl-terms__body h4, .dl-terms__body h5, .dl-terms__body h6 { font-size: 1rem; }

/* ------------------------------------------------------------ what changed */

.dl-terms-update {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem;
  border: 1px solid rgba(var(--bs-primary-rgb, 26, 204, 141), 0.3);
  border-radius: 0.75rem;
  background: var(--dl-terms-tint);
}

.dl-terms-update__head { display: flex; align-items: flex-start; gap: 0.875rem; }

.dl-terms-update__icon {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.625rem;
  background: var(--bs-primary);
  color: var(--dl-on-primary, #fff);
  font-size: 0.875rem;
}

.dl-terms-update__title { margin: 0; color: var(--dl-terms-ink); font-size: 1rem; font-weight: 700; }
.dl-terms-update__since, .dl-terms-update__note { margin: 0; color: var(--dl-terms-muted); font-size: 0.875rem; }
.dl-terms-update__note { color: var(--dl-terms-ink); font-size: 0.9375rem; }

/* 0.34: one panel; the changes sit on it as marked text, not as boxes inside boxes. */
.dl-terms-changes { margin: 0; }

.dl-terms-changes summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0;
  color: var(--dl-terms-ink);
  font-size: 0.875rem;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}

.dl-terms-changes summary::-webkit-details-marker { display: none; }
.dl-terms-changes summary::before { content: "\f054"; font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: 0.6875rem; transition: transform 0.15s ease; }
.dl-terms-changes[open] summary::before { transform: rotate(90deg); }
.dl-terms-changes[open] summary { margin-bottom: 0.875rem; }

.dl-terms-diff { display: flex; flex-direction: column; gap: 1rem; margin: 0; padding: 0; list-style: none; font-size: 0.9375rem; line-height: 1.6; }
.dl-terms-diff__item { padding: 0.125rem 0 0.125rem 0.875rem; border-left: 3px solid; }
.dl-terms-diff__text p, .dl-terms-diff__text ul, .dl-terms-diff__text ol { margin: 0; }
.dl-terms-diff .dl-terms-diff__text > * + * { margin-top: 0.5rem; }
.dl-terms-diff__text p, .dl-terms-diff__text li { font-size: inherit; line-height: inherit; }
.dl-terms-diff__text ul { padding-left: 1.25rem; list-style: disc; }
.dl-terms-diff__text li + li { margin-top: 0.25rem; }
.dl-terms-diff__text h2, .dl-terms-diff__text h3, .dl-terms-diff__text h4 { margin: 0; color: inherit; font-size: 0.9375rem; font-weight: 700; }
.dl-terms-diff__item--added { border-color: #16a34a; }
.dl-terms-diff__item--removed { border-color: #dc2626; }
.dl-terms-diff__item--removed .dl-terms-diff__text { text-decoration: line-through; opacity: 0.75; }
.dl-terms-diff__item--changed { border-color: #d97706; }
.dl-terms-diff__kind { display: block; margin-bottom: 0.125rem; color: var(--dl-terms-muted); font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.dl-terms-diff__item--added .dl-terms-diff__kind { color: #15803d; }
.dl-terms-diff__item--removed .dl-terms-diff__kind { color: #b91c1c; }
.dl-terms-diff__item--changed .dl-terms-diff__kind { color: #b45309; }
.dl-terms-diff__del { border-radius: 2px; background: rgba(220, 38, 38, 0.15); color: inherit; text-decoration: line-through; }
.dl-terms-diff__ins { border-radius: 2px; background: rgba(22, 163, 74, 0.2); color: inherit; text-decoration: none; }

/* ------------------------------------------------------------ the accept bar */

.dl-terms-accept {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  margin: 0 calc(-1 * var(--dl-terms-pad, 1rem)) calc(-1 * var(--dl-terms-pad, 1rem));
  padding: 1.125rem var(--dl-terms-pad, 1rem);
  border-top: 1px solid var(--dl-terms-line);
  border-radius: 0 0 0.75rem 0.75rem;
  background: var(--dl-terms-paper, #fff);
  box-shadow: 0 -12px 28px -20px rgba(16, 24, 40, 0.35);
}

/* How much of the text was read: a thin line in the colour of the site, on the top edge of the bar. */
.dl-terms-accept__track { position: absolute; top: -1px; left: 0; right: 0; height: 3px; overflow: hidden; }
.dl-terms-accept__track span { display: block; width: 0; height: 100%; background: var(--bs-primary); transition: width 0.15s linear; }

.dl-terms-accept__check { display: flex; align-items: center; gap: 0.75rem; margin: 0; color: var(--dl-terms-ink); font-size: 0.9375rem; font-weight: 500; cursor: pointer; }

.dl-terms-accept__check input {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
  accent-color: var(--bs-primary);
  cursor: pointer;
}

.dl-terms-accept__status { margin-left: auto; color: var(--dl-terms-muted); font-size: 0.8125rem; }
.dl-terms-accept__status:empty { display: none; }
.dl-terms-accept .btn { min-width: 12rem; margin: 0 0 0 auto; white-space: nowrap; }
.dl-terms-accept__status:not(:empty) + .btn { margin-left: 0; }
.dl-terms-accept .btn.is-waiting { opacity: 0.45; box-shadow: none; }
.dl-terms-accept__error { flex-basis: 100%; margin: 0; color: #dc2626; font-size: 0.875rem; }

/* ------------------------------------------------------------ phones */

@media (max-width: 575.98px) {
  .dl-terms-main { padding-top: 1rem; }
  .dl-terms { gap: 1.5rem; }
  .dl-terms-top__name { display: none; }
  .dl-terms-top__leave-label { display: none; }
  .dl-terms-accept { flex-direction: column; align-items: stretch; gap: 0.875rem; }
  .dl-terms-accept .btn { width: 100%; margin: 0; }
  .dl-terms-accept__status { margin: 0; text-align: center; }
}
