/*
 * App switcher: same paper-and-ink language as the viewer, light and dark from the system setting.
 * No JavaScript: the theme follows prefers-color-scheme.
 */

:root {
  color-scheme: light dark;
  --font-sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f1f0eb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6f6d68;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.1);
  --border-strong: rgba(11, 11, 11, 0.22);
  --accent: #8c1d40;
  --accent-ink: #ffffff;
  --accent-wash: rgba(140, 29, 64, 0.07);
  --shadow: 0 22px 44px -28px rgba(11, 11, 11, 0.4);
  --grain: 0.035;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #242422;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #a3a198;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.2);
    --accent: #ec8fa8;
    --accent-ink: #0d0d0d;
    --accent-wash: rgba(236, 143, 168, 0.1);
    --shadow: 0 22px 44px -24px rgba(0, 0, 0, 0.85);
    --grain: 0.05;
  }
}

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

html {
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

body {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: 32px 16px;
  border-top: 3px solid var(--accent);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: var(--grain);
  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%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.stage {
  width: min(560px, 100%);
  text-align: center;
}

.kicker {
  margin: 0 0 12px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.9rem, 1.2rem + 3vw, 3rem);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

.rule {
  width: 72px;
  margin: 22px auto 32px;
  border: 0;
  border-bottom: 4px double var(--ink-2);
}

.tiles {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tile {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 18px 22px 18px 18px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: inherit;
  text-align: left;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.tile:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent-wash) 60%, var(--surface));
  transform: translateY(-2px);
}

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

.tile__mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.tile__text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.tile__name {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1.15;
}

.tile__desc {
  font-size: 0.875rem;
  color: var(--ink-2);
}

.tile__go {
  font-size: 1.5rem;
  line-height: 1;
  color: var(--accent);
  transition: transform 0.15s ease;
}

.tile:hover .tile__go { transform: translateX(4px); }

.empty {
  margin: 0;
  padding: 28px 16px;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  color: var(--muted);
}

.note {
  margin: 28px 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

@media (max-width: 420px) {
  .tile { grid-template-columns: 48px minmax(0, 1fr) auto; gap: 14px; padding: 14px; }
  .tile__mark { width: 48px; height: 48px; font-size: 1.15rem; }
  .tile__name { font-size: 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  .tile, .tile__go { transition: none; }
  .tile:hover { transform: none; }
}

@media (prefers-reduced-motion: no-preference) {
  .head, .tiles, .note { animation: rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .tiles { animation-delay: 0.08s; }
  .note { animation-delay: 0.16s; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
}
