/* Classtime Compass – Startseite (Anmeldung).
   Aufbau wie der Login der Toolbox (02-DESIGN-STANDARDS §3.23): Markenverlauf,
   weisse Wortmarke, weisse Anmeldekarte, hier in der Mitte. Statt des
   Werkzeug-Karussells liegt dahinter ein Kompass, 50° nach hinten geneigt:
   Gehäuse, Krone und Strichring stehen, nur das Blatt dreht sich langsam im
   Uhrzeigersinn.
   Farben aus tokens.css; der Kompass ist durchscheinendes Weiss wie das
   Karussell der Toolbox. */

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }

body.login {
  /* Gemeinsame Masse für Kompass und Anmeldespalte (ab 901px Breite): Der
     Kompass füllt die Höhe zwischen Wortmarke und Fusszeile, von der Spitze
     der Krone (0,391 · --size über der Mitte) bis zur Unterkante des Gehäuses
     (0,370 · --size darunter), zusammen 0,761 · --size. --yc ist seine Mitte,
     auf ihr liegt die Mitte der Anmeldekarte. */
  --pad-top: 56px;                /* Abstand der Wortmarke vom oberen Rand */
  --brand-h: 38px;                /* Höhe der Wortmarke: ganze Pixel, sonst liegt sie auf halben */
  --brand-gap: 24px;              /* Wortmarke bis Karte */
  --t: calc(var(--pad-top) + var(--brand-h) + 16px);   /* Spitze der Krone */
  /* frei unter dem Gehäuse: Rand 20 + Fusszeile 29 + Abstand 8 + Sprache 38
     + Luft 6, damit der Sprachschalter nicht auf dem Kompass liegt */
  --b: 101px;
  --avail: calc(100dvh - var(--t) - var(--b));
  --size: clamp(640px, min(92vw, var(--avail) / .761), 1760px);
  --yc: calc(var(--t) + var(--avail) / 2 + var(--size) * .0105);
  min-height: 100dvh;
  font-family: var(--ct-font);
  font-size: var(--ct-fs-body);
  line-height: var(--ct-lh-body);
  color: var(--ct-on-dark);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  /* Markenverlauf, dazu Licht hinter dem Kompass und eine dunklere Ecke
     unten links, damit die Fläche Tiefe bekommt. */
  background:
    radial-gradient(70vmax 50vmax at 50% 55%, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0) 60%),
    radial-gradient(70vmax 50vmax at 0% 100%, rgba(13, 61, 99, .55), rgba(13, 61, 99, 0) 70%),
    radial-gradient(40vmax 30vmax at 100% 0%, rgba(144, 202, 249, .35), rgba(144, 202, 249, 0) 70%),
    var(--ct-brand-gradient);
  background-attachment: fixed;
}

/* ------------------------------------------------------------- Kompass ---- */
/* Ein Kompass mit Körper, ohne CSS-3D. Gehäusekante, Krone, Rand und Glas sind
   zwei flache SVGs, in die die Neigung von 50° schon eingerechnet ist (Kreise
   als Ellipsen mit cos 50° = .643 der Höhe, die Kante als Band darunter). Sie
   stehen still, ebenso der Ring mit den Strichen (compass-scale.svg); ein
   echter Kompass dreht ja auch nur seine Rose. Gedreht wird nur das Blatt, ein
   <img> in der gestauchten Ebene: eine Bitmap, die der Compositor in jedem
   Browser ruckelfrei dreht. Die Fassung davor drehte das ganze SVG, und das
   lief je nach Browser stockend. Bis 2026-10-11 drehte der Strichring mit dem
   Blatt und sah aus wie ein drehendes Gehäuse. */
.stage {
  position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
}
/* --size ist der Durchmesser, --yc die Mitte (beide an body.login). Alle
   Teile liegen im selben Quadrat. Der ganze Kompass bleibt sichtbar: Die Krone
   endet unter der Wortmarke, das Gehäuse über der Fusszeile. Bis 2026-10-11
   hing die Grösse an 135vh und das Gehäuse lief unten aus dem Bild. */
.compass {
  position: absolute; left: 50%; top: var(--yc);
  width: var(--size); height: var(--size);
  margin: calc(var(--size) / -2) 0 0 calc(var(--size) / -2);
}
.compass > .case, .compass > .plane { position: absolute; inset: 0; width: 100%; height: 100%; }
.compass > .case { overflow: visible; }
.plane { transform: scaleY(.643); }
.plane > img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.dial {
  animation: compass-spin 180s linear infinite;
  /* Startet bei 240°: Nord steht beim Laden links unten neben der Karte und
     wandert von dort langsam nach oben. */
  animation-delay: -120s;
  will-change: transform;
  backface-visibility: hidden;
}
@keyframes compass-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* Beim Laden blendet der Kompass auf, die Karte gleitet kurz nach oben. */
.stage { animation: fade-in 1.6s var(--ct-ease) both; }
.login-card { animation: card-in .7s var(--ct-ease) .15s both; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes card-in { from { opacity: 0; transform: translateY(14px); } }

@media (prefers-reduced-motion: reduce) {
  .dial { animation: none; transform: rotate(240deg); }
  .stage, .login-card { animation: none; }
}

/* -------------------------------------------------------- Anmeldespalte ---- */
.login-col {
  position: relative; z-index: 1;
  min-height: 100dvh;
  width: min(472px, 100%);
  margin: 0 auto;
  padding: 56px 16px 28px;
  display: flex; flex-direction: column; align-items: center; gap: 32px;
}
.login-brand { display: flex; align-items: center; gap: 16px; color: var(--ct-on-dark); }
/* Ganzzahlige Höhe und gleich hoch wie .login-brand: Die Wortmarke liegt auf vollen
   Pixeln. Mit 36,88 px in einer 36 px hohen Zeile sass sie auf y = ,56 und wirkte
   weich, die Unterkante der Buchstaben fiel halb weg. */
.login-brand .wordmark { width: 212px; height: 38px; flex: none; color: #fff; display: block; overflow: visible; }
.login-brand .sep { width: 1px; height: 30px; background: rgba(255, 255, 255, .45); }
.login-brand .app { font-size: 30px; line-height: 36px; font-weight: 400; letter-spacing: -.01em; }

.login-card {
  width: 100%; max-width: 440px;
  background: var(--ct-surface); color: var(--ct-text);
  border-radius: var(--ct-radius-lg);
  box-shadow: var(--ct-e16), 0 30px 80px -20px rgba(10, 47, 76, .45);
  overflow: hidden;
  /* Karte und Sprachschalter bilden zusammen die Mitte der Spalte. */
  margin: auto 0 0;
}
/* Kopf der Karte zentriert: Zeichen, Titel und Satz in einer Achse mit dem
   Google-Knopf darunter. Nur „Intern“ bleibt oben rechts in der Ecke. */
.card-body { position: relative; padding: 32px 32px 24px; text-align: center; }
.card-body > .tag { position: absolute; top: 20px; right: 20px; }
.app-tile {
  width: 52px; height: 52px; border-radius: 10px; margin: 0 auto 20px;
  background: var(--ct-primary-tint); color: var(--ct-primary-strong);
  display: grid; place-items: center;
}
.app-tile svg { width: 28px; height: 28px; }
.tag {
  font-size: var(--ct-fs-overline); font-weight: 500; line-height: 1;
  padding: 5px 7px; border-radius: var(--ct-radius-sm);
  border: 1px solid var(--ct-border); color: var(--ct-text-2);
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 24px; line-height: 32px; font-weight: 500; color: var(--ct-text);
}
.login-card .lead {
  margin: 0 0 24px; color: var(--ct-text-2);
  font-size: var(--ct-fs-body-lg); line-height: var(--ct-lh-body-lg);
}

/* „Mit Google anmelden“ nach Google-Branding (E-06): weiss, Rand #747775,
   Text #1F1F1F, Roboto Medium 14/20, Höhe 40, offizielles G. */
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  height: 44px; width: 100%;
  background: var(--ct-surface); color: var(--ct-google-text);
  border: 1px solid var(--ct-google-border); border-radius: var(--ct-radius-sm);
  font-size: 14px; line-height: 20px; font-weight: 500; letter-spacing: .01em;
  text-decoration: none;
  transition: background var(--ct-dur-fast) var(--ct-ease), box-shadow var(--ct-dur-fast) var(--ct-ease);
}
.btn-google:hover { background: #F8FAFF; box-shadow: var(--ct-e1); }
.btn-google:focus-visible { outline: 2px solid var(--ct-primary); outline-offset: 2px; }
.btn-google .g { width: 20px; height: 20px; flex: none; }

.note {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin: 14px 0 0; font-size: var(--ct-fs-caption); line-height: var(--ct-lh-caption);
  color: var(--ct-text-3);
}
.note svg { width: 14px; height: 14px; color: var(--ct-success); flex: none; }

.features {
  list-style: none; margin: 0; padding: 18px 32px 20px;
  border-top: 1px solid var(--ct-border);
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px;
}
.features li { display: grid; grid-template-columns: 20px 1fr; column-gap: 9px; align-items: start; }
.features svg { width: 20px; height: 20px; color: var(--ct-primary); grid-row: span 2; margin-top: 1px; }
.features b { font-size: var(--ct-fs-small); line-height: var(--ct-lh-small); font-weight: 500; color: var(--ct-text); }
.features span { font-size: var(--ct-fs-caption); line-height: var(--ct-lh-caption); color: var(--ct-text-3); }

.card-foot {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 32px; background: var(--ct-surface-2);
  border-top: 1px solid var(--ct-border);
  font-size: var(--ct-fs-caption); line-height: var(--ct-lh-caption); color: var(--ct-text-2);
}
.card-foot svg { width: 16px; height: 16px; flex: none; color: var(--ct-text-3); }

/* Sprache direkt unter der Karte, hell auf dem Verlauf. */
.login-lang {
  margin: -14px 0 auto;
  display: inline-flex; gap: 2px; padding: 3px;
  border-radius: var(--ct-radius-full);
  background: rgba(13, 61, 99, .35); border: 1px solid rgba(255, 255, 255, .28);
}
.login-lang button {
  min-width: 44px; height: 30px; padding: 0 12px; border: 0; cursor: pointer;
  border-radius: var(--ct-radius-full); background: transparent;
  font: 500 var(--ct-fs-small)/1 var(--ct-font); letter-spacing: .04em; color: rgba(255, 255, 255, .85);
  transition: background var(--ct-dur-fast) var(--ct-ease), color var(--ct-dur-fast) var(--ct-ease);
}
.login-lang button:hover { color: #fff; background: rgba(255, 255, 255, .12); }
.login-lang button.on { background: #fff; color: var(--ct-primary-strong); }
.login-lang button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.login-foot {
  font-size: var(--ct-fs-caption); color: rgba(255, 255, 255, .85);
  padding: 4px 12px; border-radius: var(--ct-radius-full);
  background: rgba(13, 61, 99, .45);
}

/* ------------------------------------------------- Karte in der Kompassmitte */
/* Schmal nimmt .login-center nicht am Layout teil, Karte und Sprache stehen
   wie bisher direkt in der Spalte. Ab 901px liegt die Mitte der Karte auf der
   Mitte des Kompasses (--yc): Der Rahmen um die Karte steht mit seiner Mitte
   auf --yc. Wäre sie dafür zu hoch, hält max() ihre Oberkante unter der
   Wortmarke. Die Sprache sitzt unten direkt über der Fusszeile, unter dem
   Kompass. */
.login-center { display: contents; }
@media (min-width: 901px) {
  .login-col { padding: var(--pad-top) 16px 20px; gap: 8px; }
  .login-brand { height: var(--brand-h); }
  .login-center {
    position: absolute; left: 16px; right: 16px; top: var(--yc);
    display: flex; flex-direction: column; align-items: center;
    translate: 0 max(-50%, calc(var(--pad-top) + var(--brand-h) + var(--brand-gap) - var(--yc)));
  }
  .login-card { margin: 0; }
  .login-lang { margin: auto 0 0; }
}

/* ------------------------------------------------------------ schmaler ---- */
/* Schmal: der Kompass bleibt grösser als das Fenster und liegt unter der
   Karte, damit sein oberer Rand hinter ihr hervorschaut. */
@media (max-width: 900px) {
  .login-col { padding-top: 40px; gap: 24px; }
  .compass { --size: max(760px, 170vw); top: 58%; }
}
@media (max-width: 599px) {
  .login-col { padding: 28px 16px 20px; }
  .login-brand .wordmark { width: 168px; height: 30px; }
  .login-brand .app { font-size: 24px; }
  .login-brand .sep { height: 24px; }
  .card-body { padding: 24px 20px 20px; }
  .features { padding: 16px 20px 18px; grid-template-columns: 1fr; }
  .card-foot { padding: 12px 20px; }
}
/* Mit der Liste ist die Karte 560px hoch. Steht ihre Mitte auf der des
   Kompasses, passt sie erst ab etwa 800px Höhe über den Sprachschalter;
   darunter fällt die Liste weg. */
@media (max-height: 799px) and (min-width: 901px) {
  .features { display: none; }
}
@media (max-height: 760px) and (min-width: 901px) {
  body.login { --pad-top: 32px; --brand-gap: 20px; }
}
