/* TrustUs — the electronic-services panel -------------------------------------
   Opened by the button in the header, on every page. A <dialog>, so the top
   layer, the backdrop, the focus trap and Escape are the browser's job and the
   script only opens and closes it. Pairs with inc/section-online-modal.php. */

/* The border-box reset in tu-system.css is `.hp *`, and this panel is outside
   .hp — so a button set to width:100% came out its own padding wider than the
   row it was in and hung 42px off the edge of the phone. */
.tu-osv,
.tu-osv *,
.tu-osv *::before,
.tu-osv *::after { box-sizing: border-box; }

.tu-osv {
  /* The element's own defaults are a bordered box glued to the top of the
     viewport; everything here is undoing that before it is styled. */
  /* A literal gutter, not --frame-gutter: that token is 0 on a phone, which is
     right for a page's own edge and wrong for a panel floating over it. */
  width: min(720px, calc(100vw - 32px));
  max-width: none;
  max-height: min(86vh, 780px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--r-surface);
  background: #fff;
  color: var(--ink);
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(20, 18, 26, .28);
}
.tu-osv::backdrop { background: rgba(20, 18, 26, .55); }

/* The panel is outside .hp, and the reset that clears link underlines is
   `.hp a` — the same trap the header's own button fell into. */
.tu-osv a { text-decoration: none; }

/* <dialog> puts focus on the first thing it can when it opens, which is the
   close button, so that ring is seen every single time it is used: it is ours
   rather than the browser's blue. */
.tu-osv :focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

/* Closed is display:none, so a transition needs the element to still be there:
   `allow-discrete` keeps it for the length of the fade. Browsers without it
   simply open and close. */
@media (prefers-reduced-motion: no-preference) {
  .tu-osv,
  .tu-osv::backdrop {
    opacity: 0;
    transition: opacity .22s ease, overlay .22s allow-discrete, display .22s allow-discrete;
  }
  .tu-osv[open],
  .tu-osv[open]::backdrop { opacity: 1; }
  @starting-style {
    .tu-osv[open],
    .tu-osv[open]::backdrop { opacity: 0; }
  }
}

.tu-osv__in {
  position: relative;
  max-height: inherit;
  overflow-y: auto;
  padding: clamp(24px, 3.4vw, 40px);
  text-align: right;
}

/* Start edge in RTL is the right, and the close button belongs at the far
   corner from the reading edge — logical properties put it there in both. */
.tu-osv__x {
  position: absolute;
  inset-block-start: 14px;
  inset-inline-end: 14px;
  display: grid; place-items: center;
  width: 38px; height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--wash);
  color: var(--muted);
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease;
}
.tu-osv__x:hover { background: var(--red); color: #fff; }

.tu-osv__head { margin-bottom: clamp(20px, 2.6vw, 30px); padding-inline-end: 48px; }
.tu-osv__head h2 {
  margin: 0 0 6px;
  color: var(--red);
  font-size: clamp(22px, 2.2vw, 28px);
  font-weight: 800;
  line-height: 1.3;
}
.tu-osv__head p { margin: 0; color: var(--muted); font-size: var(--fs-small); }

.tu-osv__list { list-style: none; margin: 0; padding: 0; }
.tu-osv__item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(14px, 1.8vw, 22px);
  padding-block: clamp(18px, 2.2vw, 24px);
  border-block-start: 1px solid var(--line);
}
.tu-osv__item:first-child { border-block-start: 0; padding-block-start: 0; }

.tu-osv__n {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--red-tint);
  color: var(--red);
  font-size: 15px;
  font-weight: 800;
}
.tu-osv__body h3 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: clamp(16px, 1.5vw, 18px);
  font-weight: 800;
  line-height: 1.45;
}
.tu-osv__body p {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-caption);
  line-height: 1.75;
}
.tu-osv__go { white-space: nowrap; }

.tu-osv__foot {
  margin-block-start: clamp(20px, 2.6vw, 28px);
  padding-block-start: clamp(16px, 2vw, 22px);
  border-block-start: 1px solid var(--line);
  text-align: center;
}
.tu-osv__foot a {
  color: var(--red);
  font-size: var(--fs-small);
  font-weight: 700;
  border-bottom: 1px solid var(--red-edge);
}

@media (max-width: 620px) {
  /* The number and the button leave the row: at this width a three-track row
     put the button on 90px and broke its label over two lines. */
  .tu-osv__item { grid-template-columns: 40px minmax(0, 1fr); }
  .tu-osv__go { grid-column: 1 / -1; display: flex; width: 100%; }
}
