/* ==========================================================================
   Redix Digital: the legal pages (accessibility.html, privacy.html)
   In the design of the home page (v2.css carries the bar, the menu, the
   footer and the WhatsApp button; tools/build-legal.js copies them in, and
   page.css puts the home page's sky behind them). The title is a home page
   title, a bold half and a light half; the document is read on a pane of the
   same dark glass as the home page's form, about 70 characters wide.
   ========================================================================== */

/* --- The opening: the title of the document ---------------------------------------------- */

.legal {
  padding: 0 var(--pad) clamp(80px, 14vh, 160px);
}

.legal-head {
  padding: calc(76px + clamp(48px, 12vh, 132px)) 0 clamp(36px, 7vh, 72px);
}

/* Two lines, the bold one first: the grammar of the home page's section titles */
.legal-title { font-size: clamp(2.75rem, 6.4vw, 6.25rem); }

.legal-title span { display: block; }

.legal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 28px;
  margin: clamp(18px, 3vh, 28px) 0 0;
  font-size: 1rem;
  color: var(--text-mid);
}

.legal-meta a,
.legal-doc a {
  color: var(--cyan-hi);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

/* A link that stands alone on its line (the other document, a phone number, an address) is a
   whole target for a finger: padding on an inline link widens where it can be pressed without
   moving a single line */
.legal-meta a,
.legal-doc dd > a:only-child {
  padding-block: 12px;
}

/* --- The contents list and the document ---------------------------------------------------- */

/* The document stands on the side the page is read from, under its title, and the contents list
   beside it on the other side (Roei, 2026-10-16: it stood on the right, before the document).
   In the page the list still comes first, so the keyboard and a screen reader meet it before
   the long text. */
.legal-layout {
  display: grid;
  grid-template-columns: minmax(0, 860px) minmax(220px, 300px);
  align-items: start;
  gap: clamp(28px, 4.4vw, 80px);
}

.legal-layout > .legal-toc { grid-area: 1 / 2; }
.legal-layout > .legal-doc { grid-area: 1 / 1; }

/* The glass of the home page's form: the surface everything long is read on */
.legal-toc details,
.legal-doc {
  border-radius: 24px;
  background: linear-gradient(158deg, rgba(28, 40, 82, 0.9) 0%, rgba(13, 20, 44, 0.94) 62%, rgba(9, 14, 33, 0.96) 100%);
  box-shadow: inset 0 0 0 1px rgba(125, 240, 244, 0.13), inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 44px 90px -44px rgba(0, 0, 0, 0.75);
}

/* The list stays beside the document where the screen holds all of it */
@media (min-width: 980px) and (min-height: 760px) {
  .legal-toc {
    position: sticky;
    top: 100px;
    /* the whole list can be reached while reading: it scrolls on its own when taller than the screen */
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

.legal-toc details { padding: 6px 22px 14px; }

.legal-toc__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 52px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  list-style: none;
  cursor: pointer;
}

.legal-toc__title::-webkit-details-marker { display: none; }

/* The arrow of the home page's questions */
.legal-toc__title::after {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  margin: 0 4px 5px;
  border-right: 2px solid var(--cyan-hi);
  border-bottom: 2px solid var(--cyan-hi);
  transform: rotate(45deg);
  transition: transform 300ms var(--ease-out-strong);
}

.legal-toc details[open] .legal-toc__title::after { transform: translate3d(0, 5px, 0) rotate(225deg); }

.legal-toc__list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.legal-toc__list a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 7px 4px 7px 0;
  padding-inline-start: 12px;
  border-inline-start: 2px solid transparent;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-mid);
  text-decoration: none;
  transition: color 160ms ease, border-color 160ms ease;
}

/* The section being read: lit, with a line of light beside it */
.legal-toc__list a[aria-current="location"] {
  border-inline-start-color: var(--cyan-hi);
  color: var(--cyan-hi);
}

@media (hover: hover) and (pointer: fine) {
  .legal-toc__list a:hover { color: var(--text); }
  .legal-meta a:hover,
  .legal-doc a:hover { color: #fff; }
}

.legal-doc {
  padding: clamp(20px, 4.6vw, 64px);
  font-size: 1.0625rem;
  line-height: 1.85;
  color: var(--text-mid);
  text-shadow: none;
  overflow-wrap: break-word;
}

.legal-doc > * { margin: 0; }
.legal-doc > * + * { margin-top: 18px; }

.legal-doc h2 {
  margin-top: clamp(40px, 6vh, 56px);
  padding-top: clamp(28px, 4vh, 40px);
  border-top: 1px solid var(--line);
  font-size: clamp(1.375rem, 2vw, 1.75rem);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--text);
  text-wrap: balance;
  scroll-margin-top: 100px;
}

/* the parts of a long section (the terms) */
.legal-doc h3 {
  margin-top: 28px;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
  scroll-margin-top: 100px;
}

.legal-doc strong {
  font-weight: 700;
  color: var(--text);
}

.legal-doc ul {
  display: grid;
  gap: 10px;
  padding: 0;
  list-style: none;
}

.legal-doc ul li {
  position: relative;
  padding-inline-start: 22px;
}

.legal-doc ul li::before {
  content: "";
  position: absolute;
  inset-inline-start: 2px;
  top: 0.8em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan-hi);
}

/* "Important update" and the like: a line of light at its start */
.legal-note {
  padding: 16px 20px;
  border-inline-start: 3px solid var(--cyan-hi);
  border-radius: 14px;
  border-start-start-radius: 4px;
  border-end-start-radius: 4px;
  background: rgba(0, 196, 204, 0.08);
  color: var(--text);
}

/* Label and value: the owner's details. A row each, divided by lines, as in the footer (the
   line after the last row is the one over the next heading) */
.legal-facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  padding: 0;
}

.legal-facts div { display: contents; }

.legal-facts dt,
.legal-facts dd {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.legal-facts dt {
  padding-inline-end: 24px;
  color: var(--text-low);
}

.legal-facts dd {
  margin: 0;
  font-weight: 600;
  color: var(--text);
}

/* The options of the accessibility menu, and the ways to reach its owner */
.legal-menu {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 28px;
  padding: 0;
}

.legal-menu div {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.legal-menu dt {
  font-weight: 700;
  color: var(--text);
}

.legal-menu dd {
  margin: 2px 0 0;
  font-size: 0.9375rem;
  line-height: 1.6;
}

.legal-action {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* A long label (the English one) may take two lines on a narrow phone rather than run off it */
.legal-action .btn {
  max-width: 100%;
  white-space: normal;
  line-height: 1.25;
  padding-block: 12px;
  text-align: center;
}

.legal-action .btn svg {
  flex: none;
  width: 20px;
  height: 20px;
  margin-inline-end: 10px;
}

.legal-updated {
  font-weight: 700;
  color: var(--text);
}

/* --- Smaller screens --------------------------------------------------------------------- */

@media (max-width: 979px) {
  .legal-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }

  .legal-layout > .legal-toc,
  .legal-layout > .legal-doc { grid-area: auto; }
}

@media (max-width: 767px) {
  .legal-head { padding-top: calc(64px + clamp(36px, 9vh, 72px)); }
  .legal-doc { border-radius: 20px; }
  .legal-toc details { border-radius: 20px; }
}

@media (max-width: 640px) {
  .legal-facts { grid-template-columns: minmax(0, 1fr); }
  .legal-facts dt { padding-bottom: 0; }
  .legal-facts dd {
    padding-top: 2px;
    border-top: 0;
  }
  .legal-menu { grid-template-columns: minmax(0, 1fr); }
}

/* --- Motion stopped ----------------------------------------------------------------------- */

.no-motion .legal-toc__title::after,
.no-motion .legal-toc__list a {
  transition-duration: 1ms;
}

/* --- The colour modes of the accessibility menu, and the system's forced colours ---------------
   What was told apart by its glass is told apart by a line */

html:is(.a11y-contrast, .a11y-negative, .a11y-light) :is(.legal-toc details, .legal-doc) { outline: 1px solid currentColor; }

@media (forced-colors: active) {
  .legal-toc details,
  .legal-doc {
    border: 1px solid CanvasText;
    background-color: Canvas;
  }

  .legal-toc__list a[aria-current="location"] { border-inline-start-color: Highlight; }
  .legal-note { border-inline-start-color: CanvasText; }
}
