/*
 * Login and consent page for the remote connectors of Chapuis Advisory.
 * Brand Werkplan (03_references/brand/brand-guidelines.md), web values of website v8.
 * Composition after the best sign-in pages (Apple Account, Stripe; seen 5.11.2026): one large
 * sheet in the middle of a full-bleed picture, big type, big fields with the label inside,
 * plan hairlines framing the page. The picture is the living engraving of the website head
 * (Rhine in Basel), veiled in paper at top and bottom. One brass spot per view: the main button.
 * Errors in ink with a 2 px border; no red, no blue, no gradients except the paper veil.
 */
@font-face {
  font-family: "Titelschrift";
  src: url("/schriften/IBMPlexSans_wdth_wght.woff2") format("woff2");
  font-weight: 100 700;
  font-display: swap;
}
@font-face {
  font-family: "Textschrift";
  src: url("/schriften/SourceSerif4_opsz_wght.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
}

:root {
  --grund: #f0ede5;
  --flaeche: #e4dfd4;
  --linie: #cac2b1;
  --tinte: #22252a;
  --leise: #59554d;
  --messing: #b8913a;
  --weiss: #ffffff;
  --sans: "Titelschrift", "IBM Plex Sans", Arial, sans-serif;
  --serif: "Textschrift", "Source Serif 4", Georgia, serif;
  --rahmen: 1200px;
  --snap: 140ms cubic-bezier(0.2, 0, 0, 1);
  --glatt: 320ms cubic-bezier(0.2, 0, 0, 1);
  --langsam: 900ms cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  background: var(--grund);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--tinte);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
}

/* ---------- the picture behind everything ---------- */

.stich {
  position: fixed;
  inset: 0;
  margin: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.stich img,
.stich canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 55%;
}

.stich canvas {
  opacity: 0;
  transition: opacity 1200ms ease;
}

.stich.lebt canvas {
  opacity: 1;
}

/* Paper veil: the picture runs out into paper at the top (behind the header) and bottom. */
.stich::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, var(--grund) 0, rgba(240, 237, 229, 0.86) 96px, rgba(240, 237, 229, 0.12) 34%, rgba(240, 237, 229, 0.12) 72%, var(--grund) 100%);
}

/* Plan hairlines: two verticals at the frame edge and one under the header, like a drawing sheet. */
.rahmen {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.rahmen::before,
.rahmen::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--linie);
  left: max(16px, calc(50% - var(--rahmen) / 2));
}

.rahmen::after {
  left: auto;
  right: max(16px, calc(50% - var(--rahmen) / 2));
}

/* ---------- header and footer ---------- */

.kopf,
.fuss {
  position: relative;
  z-index: 2;
  width: min(var(--rahmen), 100% - 32px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--sans);
  font-size: 15px;
}

.kopf {
  height: 76px;
  padding: 0 28px;
  border-bottom: 1px solid var(--linie);
}

.kopf img {
  display: block;
  width: 176px;
  height: auto;
}

.kopf a,
.fuss a {
  color: var(--tinte);
  text-decoration: none;
  border-bottom: 1px solid var(--linie);
  padding-bottom: 2px;
  transition: border-color var(--snap);
}

.kopf a:hover,
.fuss a:hover {
  border-bottom-color: var(--tinte);
}

.fuss {
  padding: 20px 28px 28px;
  color: var(--leise);
  font-size: 14px;
}

/* Start page: second language below a hairline. */
.zweitsprache {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--linie);
}

.zweitsprache h2 {
  margin: 0 0 10px;
  font: 400 1.5rem/1.25 var(--serif);
  color: var(--tinte);
}

.kopf-rechts {
  display: flex;
  align-items: center;
  gap: 22px;
}

/* Language switch: segmented control, the active language sits on a white segment. */
.sprachwahl {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--linie);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
}

.sprachwahl button {
  min-width: 40px;
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--leise);
  font: 500 13px/1 var(--sans);
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background var(--snap), color var(--snap), box-shadow var(--snap);
}

.sprachwahl button:hover {
  color: var(--tinte);
}

.sprachwahl button[aria-pressed="true"] {
  background: var(--weiss);
  color: var(--tinte);
  box-shadow: 0 0 0 1px var(--linie), 0 1px 2px rgba(34, 37, 42, 0.08);
}

.sprachwahl button:focus-visible {
  outline: 2px solid var(--tinte);
  outline-offset: 2px;
}

/* ---------- the sheet ---------- */

.buehne {
  position: relative;
  z-index: 2;
  flex: 1;
  display: grid;
  place-items: center;
  padding: 48px 16px;
}

.blatt {
  width: min(540px, 100%);
  background: var(--weiss);
  border: 1px solid var(--linie);
  border-radius: 20px;
  padding: 52px 56px 44px;
}

.zeichen {
  display: block;
  width: 64px;
  height: auto;
  margin: 0 0 28px;
}

.dach {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 14px;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--leise);
}

/* Progress: three segments, the done and current ones in ink. */
.fortschritt {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 0 0 36px;
}

.fortschritt span {
  height: 3px;
  border-radius: 2px;
  background: var(--flaeche);
  transition: background-color var(--glatt);
}

.fortschritt span.an {
  background: var(--tinte);
}

.ansicht h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.1rem, 4.4vw, 2.75rem);
  line-height: 1.08;
  letter-spacing: -0.018em;
  margin: 0 0 16px;
  text-wrap: balance;
}

.ansicht h1:focus {
  outline: none;
}

.ansicht p {
  margin: 0 0 28px;
  text-wrap: pretty;
}

.leise {
  color: var(--leise);
}

/* ---------- fields: label inside, rises on focus ---------- */

.feld {
  position: relative;
  margin: 0 0 16px;
}

.feld input {
  width: 100%;
  height: 60px;
  padding: 26px 18px 8px;
  font-family: var(--serif);
  font-size: 18px;
  color: var(--tinte);
  background: var(--weiss);
  border: 1px solid var(--leise);
  border-radius: 12px;
  transition: border-color var(--snap), box-shadow var(--snap);
}

.feld label {
  position: absolute;
  left: 19px;
  top: 19px;
  font-family: var(--sans);
  font-size: 17px;
  color: var(--leise);
  pointer-events: none;
  transform-origin: 0 0;
  transition: transform var(--glatt), color var(--glatt);
}

.feld input:focus + label,
.feld input:not(:placeholder-shown) + label {
  transform: translateY(-11px) scale(0.76);
}

.feld input:focus,
.code input:focus {
  outline: none;
  border-color: var(--tinte);
  box-shadow: 0 0 0 1px var(--tinte);
}

/* ---------- code ---------- */

.code {
  display: grid;
  grid-template-columns: repeat(var(--code-laenge, 8), 1fr);
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
  min-inline-size: 0;
}

.code input {
  width: 100%;
  height: 64px;
  padding: 0;
  text-align: center;
  font-family: var(--sans);
  font-size: 28px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--tinte);
  background: var(--weiss);
  border: 1px solid var(--leise);
  border-radius: 12px;
  caret-color: var(--tinte);
  transition: border-color var(--snap), box-shadow var(--snap), transform var(--snap);
}

.code input:not(:placeholder-shown) {
  border-color: var(--tinte);
}

.code.falsch input {
  box-shadow: 0 0 0 2px var(--tinte);
  animation: ruetteln 360ms ease;
}

.unter-code {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0 0;
  font-family: var(--sans);
  font-size: 15px;
}

/* ---------- buttons ---------- */

.knopf {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 56px;
  margin-top: 24px;
  padding: 0 24px;
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
  transition: box-shadow var(--snap), background-color var(--snap), transform var(--snap);
}

.knopf:active {
  transform: scale(0.99);
}

.knopf:focus-visible,
.verweis:focus-visible,
.kopf a:focus-visible {
  outline: 2px solid var(--tinte);
  outline-offset: 3px;
}

.knopf.haupt {
  background: var(--messing);
  color: var(--tinte);
  border: 0;
}

.knopf.haupt:hover {
  box-shadow: inset 0 0 0 2px var(--tinte);
}

.knopf.neben {
  background: var(--weiss);
  color: var(--tinte);
  border: 2px solid var(--tinte);
}

.knopf.neben:hover {
  background: var(--grund);
}

.knopf[disabled],
.knopf[aria-busy="true"] {
  cursor: wait;
  opacity: 0.75;
}

.knopf[aria-busy="true"]::after {
  content: "";
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: drehen 700ms linear infinite;
}

.reihe {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 12px;
  margin-top: 28px;
}

.reihe .knopf {
  margin-top: 0;
}

.verweis {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--tinte);
  text-decoration: underline;
  text-decoration-color: var(--linie);
  text-underline-offset: 4px;
  cursor: pointer;
  transition: text-decoration-color var(--snap);
}

.verweis:hover {
  text-decoration-color: var(--tinte);
}

.verweis[disabled] {
  color: var(--leise);
  text-decoration: none;
  cursor: default;
}

.ansicht .neben-zeile {
  margin: 20px 0 0;
  text-align: center;
  font-family: var(--sans);
  font-size: 15px;
}

/* ---------- consent ---------- */

.person {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  margin: 0 0 12px;
  background: var(--grund);
  border-radius: 12px;
}

.person .anfang {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--tinte);
  color: var(--grund);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 16px;
  text-transform: uppercase;
}

.person .wer {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--leise);
  line-height: 1.3;
}

.person .adresse {
  font-size: 17px;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.punkte {
  list-style: none;
  margin: 24px 0 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.punkte li {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 12px;
  font-size: 17px;
  line-height: 1.5;
}

/* A small ink check mark, drawn in CSS. */
.punkte li::before {
  content: "";
  width: 12px;
  height: 7px;
  margin: 8px 0 0 4px;
  border-left: 2px solid var(--tinte);
  border-bottom: 2px solid var(--tinte);
  transform: rotate(-45deg);
}

/* ---------- notices: ink with a 2 px border ---------- */

.hinweis {
  margin: 0 0 8px;
  padding: 16px 18px;
  border: 2px solid var(--tinte);
  border-radius: 12px;
  font-size: 17px;
  line-height: 1.5;
}

.hinweis strong {
  display: block;
  font-family: var(--sans);
  font-weight: 600;
  margin-bottom: 4px;
}

.meldung {
  min-height: 0;
  margin: 0;
  font-size: 16px;
}

.meldung:not(:empty) {
  margin-top: 20px;
  padding: 14px 16px;
  border: 2px solid var(--tinte);
  border-radius: 12px;
}

.warten {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--leise);
}

.warten::before {
  content: "";
  width: 22px;
  height: 22px;
  border: 2px solid var(--tinte);
  border-right-color: transparent;
  border-radius: 50%;
  animation: drehen 800ms linear infinite;
}

/* ---------- motion ---------- */

@keyframes drehen {
  to {
    transform: rotate(360deg);
  }
}

@keyframes ruetteln {
  20%, 60% {
    transform: translateX(-4px);
  }
  40%, 80% {
    transform: translateX(4px);
  }
}

@keyframes aufsteigen {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes einblenden {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .blatt {
    animation: aufsteigen var(--langsam) both;
  }
  .ansicht:not([hidden]) > * {
    animation: einblenden 520ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }
  .ansicht:not([hidden]) > *:nth-child(2) {
    animation-delay: 50ms;
  }
  .ansicht:not([hidden]) > *:nth-child(3) {
    animation-delay: 100ms;
  }
  .ansicht:not([hidden]) > *:nth-child(n + 4) {
    animation-delay: 150ms;
  }
}

@media (prefers-reduced-motion: reduce) {
  .code.falsch input {
    animation: none;
  }
}

[hidden] {
  display: none !important;
}

.unsichtbar {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- phone ---------- */

@media (max-width: 640px) {
  body {
    font-size: 17px;
  }
  .kopf {
    height: 64px;
    padding: 0 4px;
  }
  .kopf img {
    width: 148px;
  }
  .kopf-rechts {
    gap: 14px;
  }
  .rahmen {
    display: none;
  }
  .buehne {
    place-items: start center;
    padding: 20px 12px 32px;
  }
  .blatt {
    padding: 32px 22px 28px;
    border-radius: 18px;
  }
  .zeichen {
    width: 52px;
    margin-bottom: 22px;
  }
  .fortschritt {
    margin-bottom: 28px;
  }
  .code {
    gap: 5px;
  }
  .code input {
    height: 52px;
    font-size: 22px;
    border-radius: 10px;
  }
  .reihe {
    grid-template-columns: 1fr;
  }
  .reihe .knopf.neben {
    order: 2;
  }
  .fuss {
    padding: 16px 4px 24px;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}
