:root {
  color-scheme: light dark;
  --bg: #f5f5f7;
  --bg-hero-glow: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(0, 102, 204, 0.08), transparent 70%);
  --surface: #ffffff;
  --surface-hover: #ffffff;
  --bar: rgba(245, 245, 247, 0.82);
  --fg: #1d1d1f;
  --fg-secondary: #515154;
  --fg-muted: #5e5e63;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.14);
  --chip-bg: #f0f0f5;
  --chip-fg: #3a3a3c;
  --chip-border: rgba(0, 0, 0, 0.06);
  --accent: #0066cc;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.03);
  --shadow-card-hover: 0 4px 12px rgba(0, 0, 0, 0.07), 0 16px 32px rgba(0, 0, 0, 0.07);
  --shadow-icon: inset 0 1px 0 rgba(255, 255, 255, 0.28), inset 0 -1px 0 rgba(0, 0, 0, 0.16), 0 2px 6px rgba(0, 0, 0, 0.12);
  --radius-card: 20px;
  --radius-icon: 13px;
  --radius-pill: 980px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-hero-glow: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(77, 163, 255, 0.13), transparent 70%);
    --surface: #161618;
    --surface-hover: #1d1d21;
    --bar: rgba(16, 16, 18, 0.8);
    --fg: #f5f5f7;
    --fg-secondary: #a8a8ae;
    --fg-muted: #98989f;
    --line: rgba(255, 255, 255, 0.1);
    --line-strong: rgba(255, 255, 255, 0.2);
    --chip-bg: rgba(255, 255, 255, 0.08);
    --chip-fg: #d6d6dc;
    --chip-border: rgba(255, 255, 255, 0.08);
    --accent: #4da3ff;
    --shadow-card: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-card-hover: inset 0 1px 0 rgba(255, 255, 255, 0.09), 0 12px 28px rgba(0, 0, 0, 0.55);
    --shadow-icon: inset 0 1px 0 rgba(255, 255, 255, 0.24), inset 0 -1px 0 rgba(0, 0, 0, 0.28), 0 3px 10px rgba(0, 0, 0, 0.35);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image: var(--bg-hero-glow);
  background-repeat: no-repeat;
  background-size: 100% 34rem;
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.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;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0.75rem;
  z-index: 200;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-pill);
  background: var(--fg);
  color: var(--bg);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}

.skip-link:focus {
  left: 1rem;
}

.wrap {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding-inline: clamp(1rem, 3vw, 2.5rem);
}

/* Sticky Navigation */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bar);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  min-height: 3.25rem;
  padding-block: 0.4rem;
}

.brand {
  color: var(--fg);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
  padding: 0.35rem 0;
}

.cat-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.cat-nav::-webkit-scrollbar {
  display: none;
}

.cat-nav a {
  color: var(--fg-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-pill);
  transition: color 160ms var(--ease), background-color 160ms var(--ease);
}

.cat-nav a:hover {
  color: var(--fg);
  background: var(--chip-bg);
}

/* Hero */
.hero {
  padding-top: clamp(2.75rem, 6vw, 4.75rem);
  padding-bottom: clamp(1.75rem, 4vw, 3rem);
}

.eyebrow {
  margin: 0 0 0.55rem;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0 0 0.75rem;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", system-ui, sans-serif;
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: var(--fg);
  max-width: 18ch;
}

.lede {
  margin: 0;
  max-width: 58ch;
  color: var(--fg-secondary);
  font-size: clamp(1.02rem, 1.8vw, 1.2rem);
  line-height: 1.5;
  letter-spacing: -0.005em;
}

/* Directory Sections */
.directory {
  padding-bottom: clamp(3rem, 6vw, 5rem);
}

.group {
  scroll-margin-top: 4.5rem;
}

.group + .group {
  margin-top: clamp(2.5rem, 5vw, 3.75rem);
}

.group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.75rem;
  margin-bottom: 1.15rem;
  border-bottom: 1px solid var(--line);
}

.group h2 {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", system-ui, sans-serif;
  font-size: clamp(1.25rem, 2.2vw, 1.55rem);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--fg);
}

.group-count {
  color: var(--fg-muted);
  font-size: 0.85rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Responsive App Grid */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

@media (min-width: 640px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.125rem;
  }
}

@media (min-width: 980px) {
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
  }
}

.grid > li {
  display: flex;
}

/* App Card */
.card {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 1.2rem 1.25rem 1.15rem;
  border-radius: var(--radius-card);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  color: inherit;
  text-decoration: none;
  transition:
    transform 220ms var(--ease),
    box-shadow 220ms var(--ease),
    border-color 220ms var(--ease),
    background-color 220ms var(--ease);
}

.card:hover {
  transform: translateY(-2px);
  background: var(--surface-hover);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-card-hover);
}

.card:active {
  transform: translateY(0);
}

.card-top {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 0.85rem;
}

.card-title {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: 1.08rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--fg);
  transition: color 180ms var(--ease);
}

.card:hover .card-title {
  color: var(--accent);
}

.card-arrow {
  flex-shrink: 0;
  color: var(--fg-muted);
  font-size: 1.35rem;
  line-height: 1;
  transform: translateX(0);
  transition: transform 200ms var(--ease), color 200ms var(--ease);
}

.card:hover .card-arrow {
  color: var(--accent);
  transform: translateX(3px);
}

.card-desc {
  margin: 0 0 1rem;
  flex: 1;
  color: var(--fg-secondary);
  font-size: 0.92rem;
  line-height: 1.48;
}

/* Platform Chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.6rem;
  border-radius: var(--radius-pill);
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  color: var(--chip-fg);
  font-size: 0.76rem;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: 0.005em;
}

/* App Icon Monogram Tiles (Unique Hue per App, WCAG AA+ with #fff) */
.icon {
  flex-shrink: 0;
  width: 3.125rem;
  height: 3.125rem;
  border-radius: var(--radius-icon);
  display: grid;
  place-items: center;
  color: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Rounded", "SF Pro Display", system-ui, sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
  box-shadow: var(--shadow-icon);
  user-select: none;
}

.icon--voxelis           { background: linear-gradient(145deg, #2b5ce6, #1b349c); }
.icon--thermal-report    { background: linear-gradient(145deg, #d9480f, #9c2408); }
.icon--oct-convert       { background: linear-gradient(145deg, #0c7b88, #084e63); }
.icon--apronlog          { background: linear-gradient(145deg, #2c4b7c, #182a4a); }
.icon--panelboard        { background: linear-gradient(145deg, #c2510a, #8a3106); }
.icon--storeboard        { background: linear-gradient(145deg, #0066cc, #004499); }
.icon--pushcount         { background: linear-gradient(145deg, #cf2648, #8e1430); }
.icon--pushtoll          { background: linear-gradient(145deg, #6d35d8, #471d9e); }
.icon--neckline          { background: linear-gradient(145deg, #167a63, #0d5244); }
.icon--houby             { background: linear-gradient(145deg, #3b6e22, #234712); }
.icon--bitecurve         { background: linear-gradient(145deg, #0b6ea8, #074775); }
.icon--random-walk       { background: linear-gradient(145deg, #1b7d42, #10542b); }
.icon--caravan           { background: linear-gradient(145deg, #b84a27, #7d2c14); }
.icon--towerwatch        { background: linear-gradient(145deg, #3f536b, #233142); }
.icon--berlin-transit    { background: linear-gradient(145deg, #9a6300, #694100); }
.icon--amsterdam-transit { background: linear-gradient(145deg, #1e57b8, #12367c); }
.icon--mystop            { background: linear-gradient(145deg, #a6246d, #6e1447); }
.icon--connection-info   { background: linear-gradient(145deg, #434952, #24282e); }
.icon--tv-speed-test     { background: linear-gradient(145deg, #5242c2, #32248a); }
.icon--coin-flip         { background: linear-gradient(145deg, #87542a, #593418); }

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.75rem 0 3rem;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--fg-muted);
}

.site-footer p {
  margin: 0 0 0.45rem;
}

.site-footer p:last-child {
  margin-bottom: 0;
}

.site-footer a {
  color: var(--fg-secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 160ms var(--ease);
}

.site-footer a:hover {
  color: var(--fg);
}

.site-footer .sep {
  margin-inline: 0.4rem;
}

.site-footer .consent-links {
  margin-top: 0.45rem;
}

/* Focus Visible */
a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.card:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-card);
}

.cat-nav a:focus-visible {
  outline-offset: 2px;
  border-radius: var(--radius-pill);
}

/* Mobile Refinements */
@media (max-width: 639px) {
  .topbar-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    padding-block: 0.45rem 0.5rem;
  }

  .cat-nav {
    width: 100%;
    margin-inline: -0.4rem;
    padding-inline: 0.4rem;
  }

  .cat-nav a {
    padding: 0.45rem 0.65rem;
  }

  .group {
    scroll-margin-top: 6rem;
  }

  .site-footer a {
    display: inline-block;
    padding: 0.35rem 0;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .card:hover,
  .card:active,
  .card:hover .card-arrow {
    transform: none;
  }
}

@media (forced-colors: active) {
  .card,
  .chip,
  .icon {
    border: 1px solid CanvasText;
  }
}

/* App icons, direct App Store links (2026-12-04) */
.icon-img { display: block; object-fit: cover; padding: 0; }
.grid > li { position: relative; }
.grid > li:has(.card-store) .card { padding-bottom: 3.1rem; height: 100%; }
.card-store { position: absolute; right: 1.1rem; bottom: 0.9rem; padding: 0.4rem 0.85rem; min-height: 32px; border-radius: var(--radius-pill); background: var(--accent); color: #fff; font-size: 0.8rem; font-weight: 600; text-decoration: none; }
@media (prefers-color-scheme: dark) { .card-store { color: #000; } }
.card-store:hover { opacity: 0.88; }
.card-store:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.hero-cta { margin: 1rem 0 0; }
.store-all { display: inline-block; padding: 0.55rem 1.1rem; border-radius: var(--radius-pill); background: var(--fg); color: var(--bg); text-decoration: none; font-weight: 600; font-size: 0.95rem; }
.store-all:hover { opacity: 0.88; }
.card-store::after { content: ""; position: absolute; inset: -6px; }
