/* =====================================================================
   STARTSEITE – gleiche Gestaltung wie qubit.html:
   Karopapier, weiße Flächen, königsblaue Tinte.
   ===================================================================== */

:root {
  --paper: #f2f5f8;
  --paper-grid: #dde5ed;
  --sheet: #ffffff;
  --ink: #1b2233;
  --ink-soft: #566176;
  --line: #d3dbe5;
  --blue: #1f45b5;
  --blue-soft: #e9eefb;

  --font-text: "Avenir Next", Avenir, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-math: "STIX Two Text", Cambria, Charter, "Times New Roman", "Songti SC", "SimSun", "Noto Serif CJK SC", "Noto Serif", "DejaVu Serif", serif;

  --kachel-breite: 300px;
  --kachel-abstand: 24px;
}

* {
  box-sizing: border-box;
}

html {
  overflow-y: scroll;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 1.5;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--paper-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--paper-grid) 1px, transparent 1px);
  background-size: 20px 20px;
}

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

/* ---------- Sprachauswahl oben rechts (wie auf den Lernseiten) ---------- */
.lang {
  position: absolute;
  top: 14px;
  right: 24px;
  z-index: 10;
}

.lang summary {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 10px 0 9px;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: var(--sheet);
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.lang summary::-webkit-details-marker {
  display: none;
}

.lang summary:hover,
.lang[open] summary {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}

.lang summary:focus-visible {
  outline: 3px solid #7fa0ff;
  outline-offset: 2px;
}

.lang svg {
  flex: none;
  width: 18px;
  height: 18px;
}

.lang .chev {
  width: 10px;
  height: 10px;
  transition: transform 0.15s ease;
}

.lang[open] .chev {
  transform: rotate(180deg);
}

.lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 150px;
  margin: 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--sheet);
  box-shadow: 0 10px 28px rgba(27, 34, 51, 0.16);
  list-style: none;
}

.lang-menu a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 10px;
  border-radius: 7px;
  color: var(--ink);
  font-size: 0.95rem;
  text-decoration: none;
}

.lang-menu a:hover,
.lang-menu a:focus-visible {
  background: var(--blue-soft);
  color: var(--blue);
  outline: none;
}

.lang-menu a[aria-current] {
  font-weight: 700;
  color: var(--blue);
}

.lang-menu small {
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 600;
}

/* ---------- Kachel-Raster ----------
   Nicht mittig, sondern leicht nach links oben versetzt.
   Bis zu drei Kacheln nebeneinander, darunter geht es in weiteren Reihen weiter. */
.kacheln {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), var(--kachel-breite)));
  gap: var(--kachel-abstand);
  max-width: calc(3 * var(--kachel-breite) + 2 * var(--kachel-abstand));
  margin: clamp(28px, 9vh, 110px) 24px 48px clamp(16px, 8vw, 140px);
}

.kachel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  aspect-ratio: 4 / 3;
  padding: 22px 24px 20px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--sheet);
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 1px 0 rgba(27, 34, 51, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

a.kachel:hover {
  border-color: var(--blue);
  box-shadow: 0 12px 28px rgba(31, 69, 181, 0.14);
  transform: translateY(-3px);
}

a.kachel:active {
  transform: translateY(-1px);
}

a.kachel:focus-visible {
  outline: 3px solid #7fa0ff;
  outline-offset: 3px;
}

.kachel-symbol svg {
  display: block;
  width: 80px;
  height: 80px;
}

.kachel-titel {
  font-family: var(--font-math);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}

a.kachel:hover .kachel-titel {
  color: var(--blue);
}

/* Freier Platz für eine spätere Kachel */
.kachel-frei {
  border: 1.5px dashed #cbd4df;
  background: rgba(255, 255, 255, 0.4);
  box-shadow: none;
}

/* ---------- Handy: eine Spalte, freie Plätze ausblenden ---------- */
@media (max-width: 640px) {
  .lang {
    top: 10px;
    right: 14px;
  }

  .kacheln {
    grid-template-columns: minmax(0, 1fr);
    margin: 60px 16px 32px;
  }

  .kachel-frei {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
