@font-face {
  font-family: "Permanent Marker";
  src: url("/assets/fonts/permanent-marker.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-wrap: break-word;
}

/* Filmkorn wie im Styleguide, sehr dezent und ohne Einfluss auf die Bedienung. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .9 0 0 0 0 .88 0 0 0 0 .86 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-appearance: none; appearance: none; }
svg { flex: none; }
[hidden] { display: none !important; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

::selection { background: var(--accent); color: var(--accent-ink); }

.noscript { padding: 24px; text-align: center; }

/* ---- Grundgerüst ------------------------------------------------------ */

.app { position: relative; z-index: 1; min-height: 100dvh; }

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 100dvh;
}

.sidebar { display: none; }

.main { min-width: 0; }

.page {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 12px 16px calc(48px + env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

.page--home { padding-top: calc(20px + env(safe-area-inset-top)); }

@media (min-width: 1020px) {
  .shell { grid-template-columns: 276px minmax(0, 1fr); }
  .sidebar {
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: sticky;
    top: 0;
    height: 100dvh;
    overflow-y: auto;
    padding: 22px 12px 14px;
    border-right: 1px solid var(--line);
    background: var(--bg-raise);
    scrollbar-width: thin;
  }
  .page { padding-top: 20px; padding-left: 28px; padding-right: 28px; }
  .page--home { max-width: 980px; padding-top: 36px; }
  .only-mobile { display: none !important; }
}

@media (max-width: 1019.98px) {
  .only-desktop { display: none !important; }
}

/* ---- Kopfzeile eines Moduls ------------------------------------------ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: var(--tap) minmax(0, 1fr) var(--tap);
  align-items: center;
  gap: 4px;
  padding: calc(6px + env(safe-area-inset-top)) 6px 6px;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  -webkit-backdrop-filter: saturate(1.3) blur(14px);
  backdrop-filter: saturate(1.3) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.topbar__title {
  font-size: 17px;
  font-weight: 650;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 1020px) {
  .topbar { padding-left: 20px; padding-right: 20px; grid-template-columns: minmax(0, 1fr) var(--tap); }
  .topbar__back { display: none; }
  .topbar__title { text-align: left; font-size: 20px; padding-left: 8px; }
}

/* ---- Wortmarke -------------------------------------------------------- */

.wordmark {
  position: relative;
  display: inline-block;
  font-family: var(--font-mark);
  font-weight: 400;
  font-size: 34px;
  line-height: 1;
  letter-spacing: .01em;
  transform: rotate(-2deg);
  transform-origin: left center;
  text-decoration: none;
  white-space: nowrap;
}

.wordmark__stroke {
  position: absolute;
  left: -3%;
  bottom: -.36em;
  width: 106%;
  height: .4em;
  color: var(--accent);
  pointer-events: none;
}

.wordmark--small { font-size: 25px; }

/* ---- Bewegung ---------------------------------------------------------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.rise { animation: rise .22s var(--ease) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

@media print {
  body::before, .sidebar, .topbar, .toasts, .no-print { display: none !important; }
  body { background: #fff; color: #111; }
  .shell { display: block; }
  .page { max-width: none; padding: 0; }
}
