/* Login page nebel-it.ch/login/ (R1.4 PR 8, ADR 0018); details: docs/design/01-marke.md, 02 section 6. Tokens only. */
@layer page {
  [data-page="login"] {
    /* D10 sizes through the component tokens of the shared building blocks */
    --ff-label-font: var(--ff-font-mono);
    --ff-label-size: 11px;
    --ff-label-tracking: 0.2em;
    --ff-label-transform: uppercase;
    --ff-input-tracking: 0.04em;
    --ff-check-size: 18px;
    --ff-check-label-size: 12px;
    --ff-check-label-tracking: 0.08em;
    --ff-button-font-size: 13px;
    --ff-button-tracking: 0.32em;
    --ff-button-transform: uppercase;
    --ff-wordmark-size: 36px;
    --ff-wordmark-tracking: 0.55em;
    --ff-card-bg: var(--ff-surface-glass);
    --ff-card-blur: 6px;
    --ff-card-width: 560px;
    --ff-card-padding: 52px 56px 56px;
  }

  .ff-login {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
  }

  /* Atmosphere: the photo is decoration only (aria-hidden); mirrored on wide screens so the sun sits on the brand side */
  .ff-login__backdrop {
    position: fixed;
    inset: 0;
    z-index: 0;
    /* the photo is not versioned by a ?v= number: a new photo gets a new file name */
    background: var(--ff-bg) url("img/login-bg.jpg") center / cover no-repeat;
    transform: scaleX(-1);
  }

  .ff-login__backdrop::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--ff-scrim);
    opacity: 0.15;
  }

  .ff-login__signature,
  .ff-login__lang,
  .ff-login__layout,
  .ff-login__footer {
    position: relative;
    z-index: 1;
  }

  .ff-login__signature {
    position: absolute;
    top: 64px;
    left: 64px;
    box-sizing: content-box;
    width: min-content;
    font-family: var(--ff-font-mono);
    font-size: 11px;
    line-height: 1.7;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--ff-text-muted);
    /* the photo's sun glow sits behind it: a soft dark backing keeps it readable */
    margin: -12px;
    padding: 12px 14px;
    background: var(--ff-scrim);
    border-radius: 2px;
  }

  .ff-login__signature::after,
  .ff-login__brand::after,
  .ff-login__built::before {
    content: "";
    display: block;
    width: 28px;
    height: 2px;
    margin-top: 14px;
    background: var(--ff-accent);
  }

  /* the language menu brings its own look (language-menu.css, R1.4c); here only its place, above the card when open */
  .ff-login__lang {
    position: absolute;
    top: 52px;
    right: 64px;
    z-index: 2;
  }

  /* wide screens: the open list lies in a row left of the button, above the card, instead of dropping onto its corner */
  .ff-login__lang .ff-lang__list {
    top: 0;
    right: 100%;
  }

  .ff-login__lang .ff-lang__list > div {
    flex-direction: row;
  }

  .ff-login__footer a {
    display: inline-flex;
    align-items: center;
    min-height: var(--ff-target-min);
    padding: 0 8px;
    color: var(--ff-text-muted);
    text-decoration: none;
  }

  .ff-login__footer a:hover {
    color: var(--ff-text);
    text-decoration: underline;
  }

  .ff-login__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 720px;
    max-width: 1440px; /* wide screens: brand and card stay together near the centre */
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0 auto;
    padding: 112px 0 72px;
  }

  .ff-login__brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 22px;
    padding-bottom: 40px;
  }

  .ff-login__brand .ff-spark {
    --ff-spark-size: 170px;
    margin-bottom: 12px;
  }

  .ff-login__brand .ff-spark path {
    stroke-width: 3;
  }

  .ff-login__brand::after {
    width: 32px;
    margin-top: 0;
  }

  .ff-login .ff-wordmark {
    padding-left: var(--ff-wordmark-tracking, 0.55em); /* letter spacing also follows the last letter: balance it */
    line-height: 1;
    white-space: nowrap;
  }

  .ff-login__tagline {
    padding-left: 0.42em;
    font-family: var(--ff-font-mono);
    font-size: 13px;
    letter-spacing: 0.42em;
    text-transform: uppercase;
    white-space: nowrap;
  }

  .ff-login__card {
    align-self: center;
    justify-self: center;
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-right: 64px;
    border-radius: 2px;
    box-shadow: 0 24px 60px var(--ff-scrim);
  }

  .ff-login__heading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    text-align: center;
  }

  .ff-login__heading .ff-spark {
    --ff-spark-size: 52px;
    margin-bottom: 10px;
  }

  .ff-login__heading .ff-spark path {
    stroke-width: 5;
  }

  .ff-login__heading h1 {
    padding-left: 0.42em;
    font-family: var(--ff-font-display);
    font-size: 18px;
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: 0.42em;
    text-transform: uppercase;
  }

  /* D10: the heading stays on one line; the German words are longer than "Welcome back" */
  html[lang^="de"] .ff-login__heading h1 {
    padding-left: 0.3em;
    font-size: 16px;
    letter-spacing: 0.3em;
  }

  .ff-login__heading h1 {
    white-space: nowrap;
  }

  .ff-login__heading p {
    padding-left: 0.34em;
    font-family: var(--ff-font-mono);
    font-size: 10px;
    letter-spacing: 0.34em;
    text-transform: uppercase;
    color: var(--ff-text-muted);
  }

  .ff-login__card .ff-input,
  .ff-login__card .ff-input-group {
    min-height: 50px;
    border-radius: 3px;
  }

  .ff-login__card .ff-check {
    color: var(--ff-text);
    white-space: nowrap;
  }

  .ff-login__card .ff-button--primary {
    width: 100%;
    min-height: 52px;
    margin-top: 4px;
    padding-left: calc(var(--ff-space-6) + 0.32em);
    border-radius: 3px;
  }

  .ff-login__footer {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 52px;
    padding: 0 64px;
    font-family: var(--ff-font-mono);
    font-size: 11px;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--ff-text-muted);
    /* small text over the photo: a soft dark band from the bottom keeps it readable on every crop of the photo */
    background: linear-gradient(to top, var(--ff-scrim), transparent);
  }

  .ff-login__footer nav {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .ff-login__built {
    display: flex;
    align-items: center;
    gap: 18px;
    letter-spacing: 0.2em;
  }

  .ff-login__built::before {
    width: 24px;
    margin-top: 0;
  }

  /* Smaller desktop windows: the earlier, narrower card; the wordmark shrinks so it is not cut off (R15V-F5) */
  @media (max-width: 1279px) {
    [data-page="login"] {
      --ff-card-width: 480px;
      --ff-card-padding: 44px 48px 48px;
      --ff-wordmark-size: clamp(20px, 2.4vw, 36px);
    }

    .ff-login__layout {
      grid-template-columns: minmax(0, 1fr) 640px;
    }
  }

  /* Phone and narrow windows: logo on top, form right below, only the two legal links in the footer (D10) */
  @media (max-width: 959px) {
    [data-page="login"] {
      --ff-label-size: 10px;
      --ff-wordmark-size: 20px;
      --ff-wordmark-tracking: 0.6em;
      --ff-card-padding: 24px 20px;
      --ff-card-width: 520px;
    }

    /* the sun of the photo would sit behind the wordmark: show the darker left part of the valley instead */
    .ff-login__backdrop {
      background-position: 20% 50%;
      transform: none;
    }

    .ff-login__backdrop::after {
      opacity: 0.45;
    }

    .ff-login__signature,
    .ff-login__built {
      display: none;
    }

    .ff-login__lang {
      top: 8px;
      right: 16px;
    }

    /* narrow screens: no room beside the button, the list drops down as in the apps */
    .ff-login__lang .ff-lang__list {
      top: 100%;
      right: 0;
    }

    .ff-login__lang .ff-lang__list > div {
      flex-direction: column;
    }

    .ff-login__layout {
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: 60px 24px 72px;
    }

    .ff-login__brand {
      gap: 14px;
      padding: 0 0 28px;
    }

    .ff-login__brand .ff-spark {
      --ff-spark-size: 76px;
      margin-bottom: 4px;
    }

    .ff-login__brand .ff-spark path {
      stroke-width: 4.5;
    }

    .ff-login__tagline {
      padding-left: 0.4em;
      font-size: 10px;
      letter-spacing: 0.4em;
    }

    .ff-login__card {
      margin-right: 0;
      gap: 18px;
    }

    .ff-login__heading .ff-spark {
      display: none;
    }

    .ff-login__heading h1 {
      padding-left: 0.32em;
      font-size: 15px;
      letter-spacing: 0.32em;
    }

    html[lang^="de"] .ff-login__heading h1 {
      padding-left: 0.24em;
      font-size: 13px;
      letter-spacing: 0.24em;
    }

    .ff-login__heading p {
      padding-left: 0.32em;
      letter-spacing: 0.32em;
    }

    .ff-login__card .ff-input,
    .ff-login__card .ff-input-group {
      min-height: 48px;
    }

    .ff-login__footer {
      justify-content: center;
      padding: 0 16px;
      font-size: 10px;
    }
  }

  /* Very narrow phones: the wide display font may wrap rather than overflow */
  @media (max-width: 359px) {
    .ff-login__heading h1,
    .ff-login__tagline,
    .ff-login .ff-wordmark {
      white-space: normal;
    }
  }
}
