/*
 * What only the legal pages need, on top of /site.css (fonts, colors, the document layout): the DE/EN switch (the
 * support pages load this file for it too), tables, boxes, the withdrawal and cancellation forms, and print. Layout
 * only: the wording is in the pages (and docs/LEGAL_OPEN_QUESTIONS.md).
 */

/* Long German words ("Widerrufsbelehrung", "Datenschutzerklärung") never push the page sideways on a phone. */
main {
  overflow-wrap: break-word;
}

h1,
h2,
th,
td {
  hyphens: auto;
}

/* The DE/EN switch in the header (legal.js picks the language; the switch always works without it). */
.lang-switch {
  display: inline-flex;
  flex-shrink: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--pill);
  padding: 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
}

main > header .lang-switch a {
  display: inline-flex;
  min-width: 2.75rem;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  border-radius: var(--pill);
  padding: 0 0.75rem;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: inherit;
  text-decoration: none;
}

main > header .lang-switch a[aria-current="page"] {
  background: var(--ink);
  color: var(--bg);
}

/* Tables: hairlines, data in the body font; on a phone they scroll sideways inside themselves, so a column of three or
   four never shrinks to a few letters. */
table {
  width: 100%;
  margin: 1rem 0 1.5rem;
  border-collapse: collapse;
  font-size: 0.875rem;
  line-height: 1.5;
}

th,
td {
  min-width: 9rem;
  border-bottom: 1px solid var(--line);
  padding: 0.75rem 1rem 0.75rem 0;
  text-align: left;
  vertical-align: top;
  overflow-wrap: break-word;
}

th {
  border-bottom-color: var(--line-strong);
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (max-width: 52rem) {
  table {
    display: block;
    overflow-x: auto;
  }
}

.box {
  margin: 1.25rem 0;
  border: 1px solid var(--line-strong);
  border-radius: 1rem;
  padding: 1.25rem;
}

.box h3 {
  margin-top: 0;
}

.box pre {
  margin: 0.75rem 0;
  font: inherit;
  font-size: 0.875rem;
  white-space: pre-wrap;
}

/* Withdrawal and cancellation forms: fields with a 3:1 outline, the plasma pill to send. */
form.legal-form {
  display: grid;
  gap: 1rem;
}

form.legal-form label,
form.legal-form fieldset {
  display: grid;
  gap: 0.375rem;
  font-weight: 600;
}

form.legal-form fieldset {
  margin: 0;
  border: 1px solid var(--line-strong);
  border-radius: 1rem;
  padding: 0.75rem 1rem;
}

form.legal-form fieldset label {
  display: flex;
  min-height: 2.75rem;
  align-items: center;
  gap: 0.625rem;
  font-weight: 500;
}

form.legal-form input[type="radio"] {
  width: 1.125rem;
  height: 1.125rem;
  margin: 0;
  accent-color: var(--accent);
}

form.legal-form input[type="text"],
form.legal-form input[type="email"],
form.legal-form input[type="date"],
form.legal-form select,
form.legal-form textarea {
  width: 100%;
  min-height: 2.75rem;
  border: 1px solid var(--field-line);
  border-radius: 0.75rem;
  background: transparent;
  color: var(--ink);
  padding: 0.625rem 0.75rem;
  font: inherit;
  font-weight: 500;
}

form.legal-form :is(input, select, textarea):focus {
  border-color: var(--accent-text);
  outline: 1px solid var(--accent-text);
  outline-offset: 0;
}

form.legal-form ::placeholder {
  color: var(--ink-soft);
  opacity: 1;
}

.legal-button,
.box button {
  display: inline-flex;
  min-height: 3rem;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--accent);
  border-radius: var(--pill);
  background: var(--accent);
  color: var(--on-accent);
  padding: 0.5rem 1.5rem;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

body > main a.legal-button {
  color: var(--on-accent);
  text-decoration: none;
}

.box button {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--ink);
}

/* The field only bots fill in (contract-requests refuses a form with it). Off screen, not display:none. */
form.legal-form .legal-trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

form.legal-form[aria-busy="true"] button[type="submit"] {
  opacity: 0.6;
  cursor: progress;
}

@media print {
  main > header,
  main > footer,
  .legal-button,
  form.legal-form {
    display: none;
  }
}
