/* ============================================================
   klickspiele.de — Design System v1.0
   Shared stylesheet for all subpages
   ============================================================ */

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Design Tokens (CSS Custom Properties) ────────────────── */
:root {
  /* Typography */
  --font-ui:   -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", "Roboto Mono", "Courier New", monospace;

  /* Colors */
  --c-primary:              #F57C00;
  --c-on-primary:           #FFFFFF;
  --c-primary-container:    #FFE0B2;
  --c-on-primary-container: #2A1400;
  --c-secondary:            #4A4A4A;
  --c-on-secondary:         #FFFFFF;
  --c-secondary-container:  #EAEAEA;
  --c-on-secondary-container: #111111;
  --c-bg:                   #FFFFFF;
  --c-surface:              #FFFFFF;
  --c-on-surface:           #111111;
  --c-surf-var:             #F2F2F2;
  --c-on-surf-var:          #333333;
  --c-surf-low:             #FAFAFA;
  --c-surf-mid:             #F2F2F2;
  --c-surf-high:            #E8E8E8;
  --c-surf-highest:         #DCDCDC;
  --c-outline:              #6B6B6B;
  --c-outline-var:          #C8C8C8;
  --c-error:                #B3261E;
  --c-on-error:             #FFFFFF;
  --c-error-container:      #FFDAD6;
  --c-on-error-container:   #410002;

  /* Shape */
  --r-sm:   12px;
  --r-md:   16px;
  --r-lg:   24px;
  --r-xl:   32px;
  --r-full: 9999px;

  /* Motion */
  --dur-fast:   150ms;
  --dur-normal: 220ms;
  --dur-slow:   300ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);

  /* Elevation */
  --elev-1: 0px 2px 6px rgba(0,0,0,.12);
  --elev-2: 0px 4px 12px rgba(0,0,0,.16);

  /* Layout */
  --touch-min:   56px;
  --btn-h:       64px;
  --content-max: 760px;

  /* Focus */
  --focus-ring: 3px solid #F57C00;
}

/* ── Dark Mode ────────────────────────────────────────────── */
body.dark-mode {
  --c-bg:             #1A1A1A;
  --c-on-surface:     #F0F0F0;
  --c-surface:        #1A1A1A;
  --c-surf-var:       #2A2A2A;
  --c-on-surf-var:    #CCCCCC;
  --c-surf-low:       #232323;
  --c-surf-mid:       #2A2A2A;
  --c-surf-high:      #333333;
  --c-surf-highest:   #3A3A3A;
  --c-outline-var:    #444444;
  --c-secondary-container: #2A2A2A;
  --c-on-secondary-container: #F0F0F0;
  color-scheme: dark;
}

/* ── Global ───────────────────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-ui);
  font-size: 18px;
  line-height: 28px;
  font-weight: 400;
  background: var(--c-bg);
  color: var(--c-on-surface);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Skip link */
.skip {
  position: absolute;
  top: -100px;
  left: 16px;
  background: var(--c-primary);
  color: var(--c-on-primary);
  padding: 8px 16px;
  border-radius: var(--r-sm);
  font-weight: 600;
  text-decoration: none;
  z-index: 9999;
  transition: top var(--dur-normal) var(--ease);
}
.skip:focus { top: 16px; }

/* ── Top App Bar ──────────────────────────────────────────── */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  height: 68px;
  padding: 0 16px;
  gap: 12px;
  background: var(--c-primary);
  color: var(--c-on-primary);
  box-shadow: var(--elev-1);
}

.top-bar__title {
  flex: 1;
  font-size: 20px;
  font-weight: 600;
  line-height: 30px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-bar__actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

/* ── Home Button ──────────────────────────────────────────── */
.home-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  border: 2px solid rgba(255,255,255,.35);
  color: var(--c-on-primary);
  text-decoration: none;
  position: relative;
  overflow: hidden;
  transition: background var(--dur-normal) var(--ease),
              border-color var(--dur-normal) var(--ease);
}
.home-btn:hover { background: rgba(255,255,255,.28); }
.home-btn svg { width: 22px; height: 22px; fill: white; }

/* ── Bar Icon Button ──────────────────────────────────────── */
.bar-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-min);
  height: var(--touch-min);
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--c-on-primary);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: background var(--dur-normal) var(--ease);
  flex-shrink: 0;
}
.bar-icon-btn:hover { background: rgba(255,255,255,.15); }
.bar-icon-btn svg { width: 24px; height: 24px; fill: currentColor; pointer-events: none; }

/* ── Ripple ───────────────────────────────────────────────── */
.rpl { position: relative; overflow: hidden; }

.rpl-wave {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.35);
  transform: scale(0);
  animation: rpl-expand 550ms var(--ease) forwards;
  pointer-events: none;
  z-index: 0;
}

@keyframes rpl-expand {
  to { transform: scale(1); opacity: 0; }
}

/* ── Page Content ─────────────────────────────────────────── */
.page-content {
  flex: 1;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 24px 16px 48px;
}

/* ── Card ─────────────────────────────────────────────────── */
.card {
  background: var(--c-surf-low);
  border: 1.5px solid var(--c-outline-var);
  border-radius: var(--r-lg);
  padding: 24px;
}

.card + .card { margin-top: 16px; }

/* ── Collapsible (details/summary) ───────────────────────── */
.collapsible {
  border: 1.5px solid var(--c-outline-var);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--c-surf-low);
}

.collapsible + .collapsible { margin-top: 8px; }

.collapsible > summary {
  list-style: none;
  cursor: pointer;
  padding: 18px 20px;
  font-weight: 600;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  -webkit-user-select: none;
  gap: 12px;
  min-height: var(--touch-min);
  color: var(--c-on-surf-var);
  transition: background var(--dur-normal) var(--ease);
}
.collapsible > summary::-webkit-details-marker { display: none; }
.collapsible > summary::after {
  content: '';
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  background: var(--c-on-surf-var);
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  transition: transform var(--dur-normal) var(--ease);
}
.collapsible[open] > summary::after { transform: rotate(180deg); }
.collapsible > summary:hover { background: var(--c-surf-mid); }

.collapsible__body {
  padding: 0 20px 20px;
  font-size: 16px;
  line-height: 26px;
  color: var(--c-on-surf-var);
  border-top: 1px solid var(--c-outline-var);
  padding-top: 16px;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn-filled {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--btn-h);
  padding: 0 32px;
  border-radius: var(--r-full);
  border: none;
  background: var(--c-primary);
  color: var(--c-on-primary);
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--dur-normal) var(--ease),
              background var(--dur-normal) var(--ease);
  box-shadow: var(--elev-1);
}
.btn-filled:hover { box-shadow: var(--elev-2); }
.btn-filled:active { box-shadow: none; }

.pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 52px;
  padding: 0 24px;
  border-radius: var(--r-full);
  border: none;
  background: var(--c-secondary-container);
  color: var(--c-on-secondary-container);
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: background var(--dur-normal) var(--ease);
  text-decoration: none;
}
.pill-btn:hover { background: var(--c-surf-high); }

.btn-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 52px;
  padding: 0 16px;
  border-radius: var(--r-full);
  border: none;
  background: transparent;
  color: var(--c-primary);
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: background var(--dur-normal) var(--ease);
  text-decoration: none;
}
.btn-text:hover { background: var(--c-primary-container); }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-min);
  height: var(--touch-min);
  border-radius: 50%;
  border: none;
  background: var(--c-secondary-container);
  color: var(--c-on-secondary-container);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: background var(--dur-normal) var(--ease);
}
.btn-icon:hover { background: var(--c-surf-high); }
.btn-icon svg { width: 24px; height: 24px; fill: currentColor; pointer-events: none; }

/* ── Focus Styles ─────────────────────────────────────────── */
:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

/* ── Dialog ───────────────────────────────────────────────── */
.dialog-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-normal) var(--ease);
}
.dialog-scrim.show {
  opacity: 1;
  pointer-events: auto;
}
.dialog {
  background: var(--c-surface);
  border-radius: var(--r-xl);
  padding: 32px;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--elev-2);
  transform: scale(.94) translateY(8px);
  transition: transform var(--dur-slow) var(--ease);
}
.dialog-scrim.show .dialog {
  transform: scale(1) translateY(0);
}

/* ── Footer ───────────────────────────────────────────────── */
.site-footer {
  background: var(--c-surf-mid);
  border-top: 1px solid var(--c-outline-var);
  padding: 24px 16px;
  text-align: center;
}
.site-footer__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: center;
  margin-bottom: 12px;
}
.site-footer__nav a {
  color: var(--c-primary);
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
}
.site-footer__nav a:hover { text-decoration: underline; }
.site-footer__copy {
  font-size: 14px;
  color: var(--c-outline);
}

/* ── Typography helpers ───────────────────────────────────── */
h1, h2, h3, h4 { font-weight: 600; color: var(--c-on-surface); line-height: 1.3; }
h1 { font-size: clamp(22px, 5vw, 32px); }
h2 { font-size: clamp(18px, 4vw, 24px); margin-top: 40px; margin-bottom: 12px; }
h3 { font-size: clamp(16px, 3.5vw, 20px); margin-top: 28px; margin-bottom: 8px; }

p { margin-bottom: 16px; }
p:last-child { margin-bottom: 0; }

a { color: var(--c-primary); }

/* ── Reduced Motion ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Utility ──────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.text-label {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  line-height: 20px;
}

.mono {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 600px) {
  .page-content { padding: 16px 12px 40px; }
  .card { padding: 16px; }
}
