/*
  Caelion workspace · v5 · signing in, signing up, and the way back in

  Two panes. On the left the form, plainly: who you are, one button, and a way to look round
  without an account. On the right the instrument the product is named for, on its ruled sheet,
  under the product site's sky. The form never competes with it: no card, no tile, no shadow.
*/

:root[data-layout="v5"] {
  .a5 {
    display: grid;
    grid-template-columns: minmax(440px, 34rem) minmax(0, 1fr);
    min-height: 100dvh;
    background: var(--s-base);
    color: var(--t-1);
  }

  /* ---------- The form's pane ---------- */

  .a5-pane {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    min-width: 0;
    padding: 20px clamp(24px, 4.4vw, 60px) 18px;
  }

  /* the name, the form and the small print share one column, so they share one left edge */
  .a5-head,
  .a5-card,
  .a5-foot {
    width: min(23.5rem, 100%);
    margin-inline: auto;
  }

  .a5-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 40px;
  }

  .a5-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--t-1);
    text-decoration: none;
  }

  .a5-mark {
    display: block;
    width: 28px;
    height: 28px;
  }

  /* the name as the site's header sets it */
  .a5-wordmark {
    font-size: .98rem;
    font-weight: 640;
    font-stretch: 118%;
    letter-spacing: .075em;
    line-height: 1;
  }

  .a5-head-actions {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .a5-head-actions .lang-switch {
    margin: 0;
  }

  .a5-body {
    display: grid;
    align-items: center;
    padding: 28px 0;
  }

  .a5-card {
    padding-bottom: 5vh;
  }

  /* a company that has its own branding heads its own sign-in page */
  .a5-company {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin-bottom: 18px;
    overflow: hidden;
    border-radius: 12px;
    background: var(--org, var(--t-1));
    color: #fff;
    font-size: 1rem;
    font-weight: 680;
    letter-spacing: .02em;
  }

  .a5-company:not([style]) {
    color: var(--s-base);
  }

  .a5-company.has-logo {
    background: #fff;
    box-shadow: inset 0 0 0 1px var(--b-1);
  }

  .a5-company img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .a5-lead a {
    color: var(--t-2);
    text-decoration: underline;
    text-decoration-color: var(--b-2);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
  }

  .a5-card h1 {
    font-size: 1.86rem;
    font-weight: 640;
    font-stretch: 110%;
    line-height: 1.1;
    letter-spacing: -.03em;
    text-wrap: balance;
  }

  .a5-lead,
  .a5-notice {
    margin-top: 10px;
    font-size: .96rem;
    line-height: 1.5;
    color: var(--t-3);
    text-wrap: pretty;
  }

  .a5-notice {
    color: var(--t-2);
  }

  /* ---------- Fields ---------- */

  .a5-form {
    display: grid;
    gap: 14px;
    margin-top: 26px;
  }

  .a5-form .field {
    display: grid;
    gap: 6px;
    margin: 0;
  }

  .a5-form .field > label {
    font-size: .84rem;
    font-weight: 600;
    color: var(--t-2);
  }

  .a5-form :is(input:not([type="checkbox"], [type="radio"], [type="hidden"]), select) {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--b-1);
    border-radius: var(--r-ctl);
    background: var(--s-well);
    color: var(--t-1);
    font: inherit;
    font-size: 1rem;
    box-shadow: none;
    transition:
      border-color var(--d-1) ease,
      box-shadow var(--d-1) ease,
      background-color var(--d-1) ease;
  }

  .a5-form :is(input, select):hover {
    border-color: var(--b-2);
  }

  .a5-form :is(input, select):focus {
    border-color: var(--a-ring);
    background: var(--s-1);
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--a-ring) 26%, transparent);
    outline: 0;
  }

  .a5-form .field.invalid :is(input, select) {
    border-color: var(--bad);
  }

  .a5-form .field small {
    font-size: .8rem;
    line-height: 1.4;
    color: var(--t-3);
  }

  .a5-form :is(.errorlist, .form-error) {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: .84rem;
    line-height: 1.4;
    color: var(--bad);
  }

  .a5-form .form-error {
    padding: 10px 12px;
    border-radius: var(--r-ctl);
    background: var(--bad-soft);
  }

  /* a password can be looked at */
  .a5-secret {
    position: relative;
    display: block;
  }

  .a5-secret > input {
    padding-right: 44px !important;
  }

  .a5-peek {
    position: absolute;
    top: 50%;
    right: 5px;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: var(--r-item);
    background: none;
    color: var(--t-3);
    cursor: pointer;
    transform: translateY(-50%);
    transition:
      color var(--d-1) ease,
      background-color var(--d-1) ease;
  }

  .a5-peek:hover {
    background: var(--f-hover);
    color: var(--t-1);
  }

  .a5-peek .icon {
    width: 17px;
    height: 17px;
  }

  .a5-forgot {
    justify-self: end;
    margin-top: -6px;
    font-size: .84rem;
    font-weight: 560;
    color: var(--t-3);
    text-decoration: none;
    transition: color var(--d-1) ease;
  }

  .a5-forgot:hover {
    color: var(--t-1);
  }

  /* ---------- Buttons ---------- */

  .a5-card .btn {
    width: 100%;
    height: 42px;
    justify-content: center;
    border-radius: var(--r-ctl);
    font-size: .96rem;
    font-weight: 620;
  }

  .a5-submit {
    margin-top: 6px;
  }

  /* heard: the label waits with three dots until the next page answers */
  .a5-card .btn[aria-busy="true"] {
    pointer-events: none;
    opacity: .82;
  }

  .a5-card .btn[aria-busy="true"] > span::after {
    content: "";
    display: inline-block;
    width: 1.1em;
    margin-left: .15em;
    text-align: left;
    animation: a5-wait 1.1s steps(1, end) infinite;
  }

  @keyframes a5-wait {
    0% { content: "" }
    25% { content: "." }
    50% { content: ".." }
    75% { content: "..." }
  }

  .a5-or {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    margin: 20px 0 16px;
    font-size: .8rem;
    color: var(--t-4);
  }

  .a5-or::before,
  .a5-or::after {
    content: "";
    height: 1px;
    background: var(--b-1);
  }

  .a5-sample {
    display: grid;
    gap: 9px;
    margin: 0;
  }

  .a5-sample p {
    font-size: .82rem;
    text-align: center;
    color: var(--t-3);
  }

  .a5-alt {
    margin-top: 26px;
    font-size: .92rem;
    color: var(--t-3);
  }

  .a5-alt a {
    font-weight: 620;
    color: var(--t-1);
    text-decoration: underline;
    text-decoration-color: var(--b-2);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: text-decoration-color var(--d-1) ease;
  }

  .a5-alt a:hover {
    text-decoration-color: var(--a-ring);
  }

  .a5-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    font-size: .8rem;
    color: var(--t-4);
  }

  .a5-foot a {
    color: var(--t-3);
    text-decoration: none;
    transition: color var(--d-1) ease;
  }

  .a5-foot a:hover {
    color: var(--t-1);
  }

  /* ---------- The instrument's pane ---------- */

  .a5-art {
    position: relative;
    margin: 10px 10px 10px 0;
    overflow: hidden;
    border-radius: 22px;
    box-shadow: inset 0 0 0 1px oklch(1 0 0 / .06);
    /* the product site's night: cobalt above, an ember low on the right, on near-black */
    background:
      radial-gradient(60% 52% at 96% 104%, rgb(194 74 23 / .34), transparent 70%),
      radial-gradient(58% 60% at 2% -6%, rgb(16 42 124 / .62), transparent 72%),
      radial-gradient(40% 40% at 100% 14%, rgb(10 85 96 / .22), transparent 70%),
      radial-gradient(50% 46% at 50% 46%, rgb(227 154 47 / .07), transparent 70%),
      #070a14;
  }

  &[data-theme="light"] .a5-art {
    box-shadow: inset 0 0 0 1px oklch(.2 .02 262 / .07);
    /* and its day: pale, with the same two lights */
    background:
      radial-gradient(60% 52% at 96% 104%, rgb(255 190 150 / .6), transparent 70%),
      radial-gradient(58% 60% at 2% -6%, rgb(172 190 255 / .68), transparent 72%),
      radial-gradient(40% 40% at 100% 14%, rgb(170 226 220 / .5), transparent 70%),
      #eef0f6;
  }

  .a5-plate {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
  }

  .a5-line {
    position: absolute;
    left: clamp(24px, 3.2vw, 46px);
    bottom: clamp(22px, 3.4vw, 42px);
    margin: 0;
    font-size: clamp(1.2rem, 1.55vw, 1.6rem);
    font-weight: 600;
    font-stretch: 116%;
    line-height: 1.16;
    letter-spacing: -.032em;
    color: #f4efe6;
  }

  .a5-line span {
    display: block;
    color: #f6cf7d;
  }

  &[data-theme="light"] .a5-line {
    color: #171a24;
  }

  &[data-theme="light"] .a5-line span {
    color: #8a5d0f;
  }

  /* ---------- Narrow: the form alone ---------- */

  @media (max-width: 940px) {
    .a5 {
      grid-template-columns: minmax(0, 1fr);
    }

    .a5-art {
      display: none;
    }

    .a5-pane {
      padding-inline: clamp(18px, 6vw, 40px);
    }

    .a5-card {
      padding-bottom: 2vh;
    }
  }

  @media (max-height: 640px) {
    .a5-body {
      padding: 12px 0;
    }

    .a5-card {
      padding-bottom: 0;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .a5-card .btn[aria-busy="true"] > span::after {
      animation: none;
      content: "...";
    }
  }
}
