/*
 * The legal pages (card 33): Imprint, Privacy, Cookies. Figma V12: desktop 3596:17703, mobile
 * 3596:34910. Header (title, date, the switch between the three pages), then the body: the side
 * index and the content. Mobile under 768 px and desktop from 1280 px as drawn; tablet (768 to
 * 1279) composed for this card, each choice noted below. Every value from tokens.css.
 */

.page--legal {
  background: var(--color-white);
}

/* --- Header: 104 px from the top at 390, 200 at 1512 -------------------------------------- */

.legal-header {
  padding-top: var(--space-24);
}

.legal-header__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-24);
}

.legal-header__title {
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
}

.legal-header__title .t-h1 {
  color: var(--color-petrol-900);
}

.legal-header__updated {
  color: var(--color-slate-500);
}

.legal-switch {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-8);
}

/* A pill, 42 px drawn, in a 44 px tall touch area under 1280 px. */
.legal-switch__link {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch-target);
  padding: 0 18px;
  border: 1px solid var(--color-grey-300);
  border-radius: 20px;
  background: var(--color-white);
  background-clip: padding-box;
  color: var(--color-navy-900);
  font-size: var(--text-pill-size);
  line-height: var(--text-pill-line);
  font-weight: var(--weight-semibold);
}

.legal-switch__link[aria-current="page"] {
  border-color: var(--color-navy-900);
  background: var(--color-navy-900);
  color: var(--color-white);
}

/* --- Body ------------------------------------------------------------------------------------ */

.legal-body {
  padding: var(--space-40) 0 var(--space-64);
}

.legal-body__grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-40);
}

.legal-index__title {
  color: var(--color-slate-500);
  font-size: var(--text-label-size);
  line-height: var(--text-label-line);
  font-weight: var(--weight-medium);
}

.legal-index__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-top: var(--space-16);
}

/* A row: a 3 px bar and the heading's name, 44 px tall; the heading in view: teal bar, bold. */
.legal-index__link {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  min-height: var(--touch-target);
  color: var(--color-slate-500);
}

.legal-index__link::before {
  content: "";
  flex: none;
  width: 3px;
  height: 20px;
  border-radius: 2px;
  background: var(--color-grey-200);
}

.legal-index__link[aria-current="true"] {
  color: var(--color-petrol-900);
  font-weight: var(--weight-semibold);
}

.legal-index__link[aria-current="true"]::before {
  background: var(--color-teal-400);
}

.legal-body__content {
  display: flex;
  flex-direction: column;
  gap: 48px;
  min-width: 0;
}

/* Entity tabs: one row, the short names on a phone, the full ones from 768 px. */
/* Card 51 (V13 "entity tabs", desktop 3854:20764, mobile 3854:30546): the three entities as
   teal pills, 46 px tall, fully rounded; no line under the row. Selected: teal-100 fill, a 1 px
   teal-700 edge, the label bold in teal-800; not selected: no fill, a 1 px teal-300 edge, the
   label medium in teal-700. 18/24 labels; 16 px sides and 8 px apart on a phone (short names),
   20 px and 12 px from 768 (long names). */
.legal-tabs {
  display: flex;
  gap: var(--space-8);
  margin-bottom: calc(-1 * var(--space-8)); /* 40 px to the content on a phone, as drawn */
}

.legal-tabs__tab {
  min-height: var(--touch-target);
  padding: 10px var(--space-16);
  border: 1px solid var(--color-teal-300);
  border-radius: var(--radius-round);
  background: none;
  color: var(--color-teal-700);
  font: inherit;
  font-size: var(--text-tab-size);
  line-height: var(--text-tab-line);
  font-weight: var(--weight-medium);
  cursor: pointer;
}

.legal-tabs__tab[aria-selected="true"] {
  border-color: var(--color-teal-700);
  background: var(--color-teal-100);
  color: var(--color-text-accent-pressed);
  font-weight: var(--weight-bold);
}

.legal-tabs__long {
  display: none;
}

.legal-entity {
  display: flex;
  flex-direction: column;
  gap: 48px;
}

.legal-entity:focus {
  outline: none;
}

/* Without JavaScript the three entities show one under the other, each with its name; with the
   tabs, the name is the tab's (legal.js makes it visually-hidden, for assistive technology). */
.legal-entity__name {
  color: var(--color-petrol-900);
  font-size: var(--text-h2-size);
  line-height: var(--text-h2-line);
  font-weight: var(--weight-bold);
}

.legal-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
}

.legal-section__title {
  color: var(--color-petrol-900);
  font-size: var(--text-h3-size);
  line-height: var(--text-h3-line);
  font-weight: var(--weight-semibold);
}

/* Imprint rows: the label above its value on a phone; side by side (220 px label) from 768 px. */
.legal-rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
  margin: 0;
}

.legal-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: 15px 0 14px;
  border-top: 1px solid var(--color-grey-300-80);
}

.legal-row__label {
  color: var(--color-slate-500);
}

.legal-row__value {
  margin: 0;
  color: var(--color-petrol-900);
  overflow-wrap: anywhere;
}

/* Privacy and Cookies: paragraphs and lists. */
.legal-section--text {
  color: var(--color-petrol-900);
}

.legal-section--text > p + p,
.legal-section--text > p + ul,
.legal-section--text > ul + p {
  margin-top: -4px; /* 12 px between the parts of a section, 16 under its title */
}

.legal-list {
  padding-left: 22.5px;
  list-style: disc;
}

/* An address in a text: a 44 px tall tap area under 1280 px, the line unchanged (as the banner's
   Cookies page link). */
.legal-section a[href^="mailto:"] {
  display: inline-block;
  margin-block: -10px;
  padding-block: 10px;
  text-decoration: underline;
}

/* --- Cookie table: stacked on a phone, a real table from 768 px -------------------------------- */

.cookie-table {
  width: 100%;
  border: 1px solid var(--color-grey-300);
  border-radius: var(--space-16);
  border-spacing: 0;
  overflow: hidden;
  color: var(--color-slate-500);
  font-size: var(--text-body-sm-size);
  line-height: var(--text-body-sm-line);
  text-align: left;
}

.cookie-table thead {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.cookie-table tbody,
.cookie-table tr,
.cookie-table td {
  display: block;
}

.cookie-table tr {
  padding-block: var(--space-8);
}

.cookie-table tr + tr {
  border-top: 1px solid var(--color-grey-300-80);
}

.cookie-table td {
  padding: var(--space-8) var(--space-16);
}

.cookie-table td::before {
  content: attr(data-label);
  display: block;
  margin-bottom: var(--space-4);
  font-weight: var(--weight-medium);
}

.cookie-table__note {
  color: var(--color-slate-500);
  font-size: var(--text-body-sm-size);
  line-height: var(--text-body-sm-line);
}

.legal-button {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  justify-content: center;
  height: var(--button-height);
  padding: 0 var(--space-24);
  border: 1px solid var(--color-navy-900);
  border-radius: var(--radius-pill);
  background: var(--color-white);
  color: var(--color-petrol-900);
  font: inherit;
  font-size: var(--text-button-size);
  line-height: var(--text-button-line);
  font-weight: var(--weight-semibold);
  cursor: pointer;
}

/*
 * --- Tablet (768 to 1279): chosen for this card ----------------------------------------------
 * 768: the phone's order (index above the content), with the entity tabs' full names, the
 * imprint rows side by side and the cookie table as a table. 1024: the desktop's two columns,
 * a 240 px index beside the content; the header's switch beside the title.
 */

@media (min-width: 768px) {
  .legal-header {
    padding-top: var(--space-64);
  }

  .legal-body {
    padding: var(--space-64) 0 var(--space-80);
  }

  .legal-tabs {
    gap: var(--space-12);
    margin-bottom: 0;
  }

  .legal-tabs__tab {
    padding-inline: var(--space-20);
  }

  .legal-tabs__long {
    display: inline;
  }

  .legal-tabs__short {
    display: none;
  }

  .legal-row {
    flex-direction: row;
    gap: var(--space-24);
    padding-block: 14px;
  }

  .legal-row__label {
    flex: none;
    width: 220px;
  }

  .legal-row__value {
    flex: 1;
  }

  .cookie-table {
    display: table;
    border-collapse: separate;
  }

  .cookie-table thead {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
    display: table-header-group;
    background: var(--color-grey-100);
  }

  .cookie-table tbody {
    display: table-row-group;
  }

  .cookie-table tr {
    display: table-row;
    padding: 0;
  }

  .cookie-table th,
  .cookie-table td {
    display: table-cell;
    padding: 14px var(--space-16);
    vertical-align: top;
  }

  .cookie-table th {
    font-weight: var(--weight-medium);
  }

  .cookie-table td::before {
    content: none;
  }

  .cookie-table tbody td {
    border-top: 1px solid var(--color-grey-300-80);
  }

  .cookie-table th:nth-child(1) {
    width: 180px;
  }

  .cookie-table th:nth-child(2) {
    width: 160px;
  }

  .cookie-table th:nth-child(3) {
    width: 260px;
  }
}

@media (min-width: 1024px) {
  .legal-header__body {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
  }

  .legal-body__grid {
    flex-direction: row;
    align-items: flex-start;
    gap: var(--space-24);
  }

  .legal-body__index {
    position: sticky;
    top: calc(var(--header-clearance) + var(--space-24));
    flex: none;
    width: 240px;
  }

  .legal-body__content {
    flex: 1;
  }
}

/* --- Desktop: as drawn at 1512 -------------------------------------------------------------- */

@media (min-width: 1280px) {
  .legal-header {
    padding-top: 104px;
  }

  .legal-body {
    padding-block: 120px;
  }

  .legal-body__index {
    width: 384px;
  }

  .legal-body__content {
    flex: none;
    width: 792px;
  }

  .legal-switch__link {
    min-height: 42px;
  }

  .legal-index__link {
    min-height: 0;
    padding-block: var(--space-8);
  }

  .legal-section a[href^="mailto:"] {
    margin-block: 0;
    padding-block: 0;
  }
}
