/* ==========================================================================
   AUTH: the two sign-in pages, one layout
   ==========================================================================
   fahrschulportal.com/anmelden (pick your school) and login.fahrschulportal.com
   (sign in at it) are one gesture, so they are one layout: a split screen.

     left   the task. No card around it: the logo, a large headline, the
            form, the legal line. Generous space, left-aligned.
     right  the app, for Fahrschüler above all: what it does, the real
            screens, both stores. A panel set into the page, lit from the top
            in the slate of the app icon. Grey only, no colour.

   Below 1024px the two stack: the task first, the app under it. A sign-in
   from inside the app has no right half at all.

   Public pages' black and white button (brand.css .brand-theme); one radius
   scale (inputs and buttons 12px, the panel 24px, plates 14px); line icons
   from the project's Lucide set at 1.5 stroke.

   Two identical copies: portal/public/auth.css and login/public/auth.css
   (separate hosts, no shared mount). shared/design-tokens.test.mjs fails if
   they differ. The showcase markup is in portal/public/anmelden.html and in
   login/src/lib/page.js appShowcase, keep them in step.

   Body class `au`. Loaded after styles.css, brand.css and the page's own
   stylesheet, so it overrides what they drew for the old card frame.
   ========================================================================== */

.au {
  --au-ease: cubic-bezier(0.32, 0.72, 0, 1);
  --au-r: 12px;
  --au-r-panel: 24px;
  --au-field-h: 48px;
}

/* The old frame steps aside: no centred column, no glow, no card. */
.au::before {
  display: none;
}
.au .wrap,
.au .panel {
  display: contents;
}
.au .card {
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.au .card::before {
  display: none;
}

/* ── The split ───────────────────────────────────────────────────────── */
.au-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}
.au-page.is-solo {
  grid-template-columns: minmax(0, 1fr);
}

.au-side {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 28px clamp(24px, 5vw, 72px) 24px;
}

.au-side-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.au-logo-link {
  display: inline-flex;
}
.au-logo-link img {
  display: block;
  width: auto;
  height: 30px;
}
.au-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-faint);
  text-decoration: none;
  transition: color 300ms var(--au-ease);
}
.au-back svg {
  width: 15px;
  height: 15px;
  transition: transform 300ms var(--au-ease);
}
@media (hover: hover) and (pointer: fine) {
  .au-back:hover {
    color: var(--ink);
  }
  .au-back:hover svg {
    transform: translateX(-2px);
  }
}

/* The task, centred in the height that is left, never wider than a form. */
.au-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 48px 0;
}

.au .au-title {
  margin: 0;
  font-size: clamp(28px, 3.2vw, 36px);
  font-weight: var(--w-semi);
  line-height: 1.1;
  letter-spacing: -0.035em;
  color: var(--ink);
  text-wrap: balance;
}
.au .au-lede {
  margin-top: 10px;
  max-width: 40ch;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-muted);
  text-wrap: pretty;
}
.au .au-lede strong {
  color: var(--ink);
  font-weight: var(--w-medium);
}

.au-side-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  font-size: 12px;
  color: var(--ink-faint);
}
.au-side-foot nav {
  display: flex;
  gap: 16px;
}
.au-side-foot a {
  color: inherit;
  text-decoration: none;
  transition: color 300ms var(--au-ease);
}
@media (hover: hover) and (pointer: fine) {
  .au-side-foot a:hover {
    color: var(--ink);
  }
}

/* ── Fields and the button ───────────────────────────────────────────── */
.au .field-label {
  font-size: 13px;
  color: var(--ink-muted);
}
.au .input {
  height: var(--au-field-h);
  border-radius: var(--au-r);
  background: var(--surface);
  border-color: var(--line);
  font-size: 15px;
  transition: border-color 300ms var(--au-ease), box-shadow 300ms var(--au-ease), background 300ms var(--au-ease);
}
.au .input:focus {
  background: var(--surface-raised);
  border-color: var(--ink-faint);
  box-shadow: 0 0 0 4px rgb(255 255 255 / 0.06);
}
.au .btn-primary {
  height: var(--au-field-h);
  border-radius: var(--au-r);
  font-size: 15px;
  font-weight: var(--w-semi);
  box-shadow: 0 1px 0 rgb(255 255 255 / 0.5) inset, 0 10px 24px -12px rgb(255 255 255 / 0.35);
  transition: transform 300ms var(--au-ease), background 300ms var(--au-ease), opacity 300ms var(--au-ease);
}
.au .btn-primary:disabled {
  box-shadow: none;
}
.au .btn-primary:active:not(:disabled) {
  transform: scale(0.98);
}

/* ── The login server's form ─────────────────────────────────────────────
   The school's mark and ours, joined by a line, left-aligned over the
   headline; the fields; and where the sign-in leads, as one quiet line. */
.au .au-card {
  text-align: left;
}
.au .au-connect {
  justify-content: flex-start;
  margin-bottom: 28px;
}
.au .au-mark {
  border-radius: 14px;
}
.au .au-title + .au-lede {
  margin-bottom: 32px;
}
.au .field + .field {
  margin-top: 16px;
}
.au .au-error {
  margin-bottom: 20px;
  border-radius: var(--au-r);
}
.au .au-submit {
  margin-top: 28px;
}
.au .au-foot {
  justify-content: flex-start;
  margin: 24px 0 0;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
}

/* The invitation's header: the school's logo or letter, then its name, on
   the left like everything else in the column. */
.au .au-head {
  align-items: flex-start;
  margin: 0 0 28px;
  padding: 0;
  border: 0;
  text-align: left;
}
.au .au-head + h1,
.au .card > h1 {
  font-size: clamp(26px, 3vw, 32px);
  letter-spacing: -0.03em;
}

/* The session ID sits in the legal line. */
.au-side-foot .lg-sid {
  margin-left: auto;
}

/* ── The showcase ────────────────────────────────────────────────────────
   A panel set into the page with a margin all round, lit from its upper
   edge. Inside: what the app does, and two real screens standing at its
   foot, one in front, one behind. */
.au-show {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin: 12px 12px 12px 0;
  padding: clamp(32px, 4.5vw, 64px) clamp(28px, 4vw, 56px) 0;
  overflow: hidden;
  border-radius: var(--au-r-panel);
  background:
    radial-gradient(90% 55% at 72% -8%, rgb(150 162 178 / 0.26) 0%, transparent 62%),
    radial-gradient(60% 40% at 0% 100%, rgb(150 162 178 / 0.08) 0%, transparent 70%),
    linear-gradient(180deg, #161a20 0%, #0e1014 100%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.08), inset 0 0 0 1px rgb(255 255 255 / 0.05);
  isolation: isolate;
}

.au-show-kicker {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 8px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.06);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.08);
  font-size: 12px;
  font-weight: var(--w-medium);
  color: var(--ink-muted);
}
.au-show-kicker svg {
  width: 14px;
  height: 14px;
}

.au-show-title {
  margin-top: 18px;
  max-width: 16ch;
  font-size: clamp(30px, 3.4vw, 44px);
  font-weight: var(--w-semi);
  line-height: 1.05;
  letter-spacing: -0.04em;
  color: #f4f6f8;
  text-wrap: balance;
}
.au-show-lede {
  margin-top: 14px;
  max-width: 42ch;
  font-size: 15px;
  line-height: 1.55;
  color: rgb(232 236 240 / 0.62);
  text-wrap: pretty;
}

.au-show-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 28px;
  max-width: 480px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}
.au-show-list li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 12px;
  align-items: start;
}
.au-show-list svg {
  grid-row: span 2;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  color: rgb(232 236 240 / 0.8);
}
.au-show-list strong {
  font-size: 14px;
  font-weight: var(--w-medium);
  color: #f4f6f8;
}
.au-show-list span {
  font-size: 13px;
  line-height: 1.45;
  color: rgb(232 236 240 / 0.52);
}

.au-show-stores {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
}
.au-show-stores a {
  display: inline-flex;
  border-radius: 9px;
  transition: transform 400ms var(--au-ease), opacity 300ms var(--au-ease);
}
.au-show-stores img {
  display: block;
  width: auto;
  height: 42px;
}
.au-show-stores a:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 3px;
}
@media (hover: hover) and (pointer: fine) {
  .au-show-stores a:hover {
    transform: translateY(-2px);
  }
}
.au-show-more {
  margin-left: 6px;
  font-size: 13px;
  color: rgb(232 236 240 / 0.62);
  text-decoration: underline;
  text-decoration-color: rgb(255 255 255 / 0.2);
  text-underline-offset: 3px;
  transition: color 300ms var(--au-ease);
}
@media (hover: hover) and (pointer: fine) {
  .au-show-more:hover {
    color: #ffffff;
  }
}

/* The two screens. The front one is the start screen, the one behind it
   the training overview, turned a few degrees and dimmed. Both are cut off
   by the panel's lower edge. */
.au-show-phones {
  position: relative;
  flex: 1;
  min-height: 300px;
  margin-top: 44px;
}
.au-phone {
  position: absolute;
  top: 0;
  width: clamp(190px, 17vw, 244px);
  padding: 7px 7px 0;
  border-radius: 38px 38px 0 0;
  background: linear-gradient(180deg, #2a3038, #171b21);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.14),
    0 30px 60px -20px rgb(0 0 0 / 0.8);
}
.au-phone img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 31px 31px 0 0;
}
.au-phone-front {
  left: 50%;
  z-index: 2;
  transform: translateX(-62%);
  animation: au-rise 900ms var(--au-ease) 200ms both;
}
.au-phone-back {
  top: 44px;
  left: 50%;
  z-index: 1;
  transform: translateX(8%) rotate(6deg);
  opacity: 0.55;
  animation: au-rise-back 900ms var(--au-ease) 320ms both;
}
@keyframes au-rise {
  from {
    opacity: 0;
    transform: translateX(-62%) translateY(40px);
  }
}
@keyframes au-rise-back {
  from {
    opacity: 0;
    transform: translateX(8%) translateY(60px) rotate(6deg);
  }
}

/* The panel's content arrives once, top to bottom. */
.au-show > :not(.au-show-phones) {
  animation: au-in 700ms var(--au-ease) both;
}
.au-show > :nth-child(2) {
  animation-delay: 60ms;
}
.au-show > :nth-child(3) {
  animation-delay: 120ms;
}
.au-show > :nth-child(4) {
  animation-delay: 180ms;
}
.au-show > :nth-child(5) {
  animation-delay: 240ms;
}
@keyframes au-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .au-show > *,
  .au-phone {
    animation: none !important;
  }
}

/* ── Narrower than a laptop: one column ──────────────────────────────────
   The left half dissolves into the column so its parts can be ordered: the
   logo, then the app, compact, where it is seen before anything is typed,
   then the task, and the legal line last of all.

   Compact means: the headline and one line beside a small start screen, the
   four things it does as chips, the stores. No kicker, no second phone. */
@media (max-width: 1023px) {
  .au-page {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
  }
  .au-side {
    display: contents;
  }
  .au-side-top {
    order: 1;
    padding: 24px 32px 0;
  }
  .au-show {
    order: 2;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 92px;
    grid-template-rows: auto auto auto auto;
    column-gap: 18px;
    width: calc(100% - 64px);
    max-width: 560px;
    margin: 24px auto 0;
    padding: 22px 22px 20px;
    border-radius: 20px;
  }
  .au-main {
    order: 3;
    max-width: 624px;
    padding: 36px 32px 40px;
  }
  .au-side-foot {
    order: 4;
    padding: 20px 32px 24px;
  }

  /* Our logo is already in the bar at the top, so the pair "school — lock —
     us" would only say it twice: the school's mark stands alone over the
     headline, small, on the same edge as everything else. */
  .au .au-connect {
    margin-bottom: 18px;
  }
  .au .au-link,
  .au .au-mark-fp {
    display: none;
  }
  .au .au-mark {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    font-size: 17px;
  }
  .au .au-mark-img {
    width: auto;
    min-width: 44px;
    max-width: 160px;
    padding: 7px 9px;
  }

  /* Safari on the iPhone zooms into any field under 16px when it takes the
     focus, and leaves the page zoomed. */
  .au .input {
    font-size: 16px;
  }

  .au-show-kicker,
  .au-phone-back,
  .au-show-stores .au-show-more {
    display: none;
  }
  .au-show-title {
    grid-column: 1;
    grid-row: 1;
    margin: 0;
    font-size: 22px;
    letter-spacing: -0.03em;
  }
  .au-show-lede {
    grid-column: 1;
    grid-row: 2;
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.45;
  }
  .au-show-list {
    grid-column: 1 / -1;
    grid-row: 3;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 16px;
  }
  .au-show-list li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px 6px 8px;
    border-radius: 999px;
    background: rgb(255 255 255 / 0.06);
    box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.07);
  }
  .au-show-list svg {
    width: 15px;
    height: 15px;
    margin: 0;
  }
  .au-show-list strong {
    font-size: 12px;
  }
  .au-show-list span {
    display: none;
  }
  .au-show-stores {
    grid-column: 1 / -1;
    grid-row: 4;
    margin-top: 14px;
    gap: 8px;
  }
  .au-show-stores img {
    height: 38px;
  }

  /* The start screen, small, beside the headline and cut off at its foot. */
  .au-show-phones {
    grid-column: 2;
    grid-row: 1 / 3;
    flex: none;
    align-self: start;
    min-height: 0;
    height: 112px;
    margin: 0;
    overflow: hidden;
  }
  .au-phone-front {
    position: static;
    width: 92px;
    padding: 4px 4px 0;
    border-radius: 18px 18px 0 0;
    transform: none;
    animation: au-in 700ms var(--au-ease) 200ms both;
  }
  .au-phone-front img {
    border-radius: 14px 14px 0 0;
  }
}
/* A phone: one gutter for everything (20px), so the logo, the app card, the
   form and the footer start on the same left edge. The card stays above the
   form, but small: headline, one line, the stores — the form still shows
   without scrolling. */
@media (max-width: 520px) {
  .au-side-top {
    gap: 12px;
    padding: 18px 20px 0;
  }
  .au-logo-link img {
    height: 26px;
  }
  .au-back {
    flex: none;
    white-space: nowrap;
  }
  .au-show {
    width: calc(100% - 40px);
    margin-top: 16px;
    padding: 16px;
    grid-template-columns: minmax(0, 1fr) 64px;
    column-gap: 14px;
    border-radius: 18px;
  }
  .au-show-title {
    font-size: 19px;
  }
  .au-show-lede {
    font-size: 12.5px;
  }
  .au-show-list {
    display: none;
  }
  .au-show-stores {
    margin-top: 12px;
  }
  .au-show-stores img {
    height: 34px;
  }
  .au-show-phones {
    height: 84px;
  }
  .au-phone-front {
    width: 64px;
    padding: 3px 3px 0;
    border-radius: 14px 14px 0 0;
  }
  .au-phone-front img {
    border-radius: 11px 11px 0 0;
  }
  .au-main {
    padding: 28px 20px 32px;
  }
  .au .au-title + .au-lede {
    margin-bottom: 26px;
  }
  /* The footer as one left-aligned column: the links, then where you are
     and the session — instead of three pieces scattered over two rows. */
  .au-side-foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  }
  .au-side-foot nav {
    order: -1;
    gap: 20px;
    font-size: 13px;
  }
  .au-side-foot .lg-sid {
    margin-left: 0;
  }
}
/* The smallest phones (320px): the card keeps its headline and the stores,
   the sentence under it would run to four lines. */
@media (max-width: 359px) {
  .au-back {
    font-size: 12px;
  }
  .au-show-lede {
    display: none;
  }
  .au-show-phones {
    height: 64px;
  }
  .au-show-stores img {
    height: 32px;
  }
}
