/* Home page only; support pages and privacy policies use style.css. Layout after Bootstrap 5
   (a 1140px container, responsive card grid), surfaces after Material Design (elevated cards,
   tonal buttons, chips). A card sets its app's accent like a page does:
   style="--accent-light: #1e66f5; --accent-dark: #89b4fa"; without one it uses --primary. */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eceff3;
  --fg: #1b1c1f;
  --muted: #5f6368;
  --outline: #dadce0;
  --primary: #0b57d0;
  --shadow-1: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
  --shadow-3: 0 1px 3px rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317;
    --surface: #1c1f24;
    --surface-2: #252930;
    --fg: #e4e5e8;
    --muted: #a9adb4;
    --outline: #3a3e46;
    --primary: #a8c7fa;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.6), 0 1px 3px 1px rgba(0, 0, 0, 0.3);
    --shadow-3: 0 1px 3px rgba(0, 0, 0, 0.6), 0 4px 8px 3px rgba(0, 0, 0, 0.3);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  -webkit-text-size-adjust: 100%;
}

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

.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Top app bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--outline);
}

.topbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--fg);
  font-size: 1.05rem;
  font-weight: 700;
  text-decoration: none;
}

.brand img {
  width: 28px;
  height: 28px;
}

.topbar-link {
  padding: 6px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
}

.topbar-link:hover {
  background: var(--surface-2);
  color: var(--fg);
}

/* Hero */
.hero {
  padding: 72px 0 32px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 1.2rem + 3vw, 3.25rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.hero .tagline {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: clamp(1.25rem, 1rem + 1vw, 1.6rem);
  font-weight: 500;
}

.hero .lead {
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 28px;
}

.chip {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 16px;
  border: 1px solid var(--outline);
  border-radius: 8px;
  background: var(--surface);
  color: var(--fg);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
}

.chip:hover {
  background: var(--surface-2);
}

/* Sections */
.section {
  padding: 32px 0;
  scroll-margin-top: 56px;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  margin-bottom: 20px;
}

.section-head h2 {
  margin: 0;
  font-size: 1.6rem;
  letter-spacing: -0.01em;
}

.section-head p {
  margin: 0;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 20px;
}

/* Cards */
.card {
  --accent: var(--accent-light, var(--primary));
  display: flex;
  flex-direction: column;
  padding: 20px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-1);
  transition: box-shadow 0.2s, transform 0.2s;
}

@media (prefers-color-scheme: dark) {
  .card {
    --accent: var(--accent-dark, var(--primary));
  }
}

.card:hover {
  box-shadow: var(--shadow-3);
  transform: translateY(-2px);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.card-head img {
  display: block;
  width: 56px;
  height: 56px;
  flex: none;
  border-radius: var(--icon-radius, 0);
}

.overline {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.card h3 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.3;
}

.card h3 a {
  color: var(--fg);
  text-decoration: none;
}

.card p {
  margin: 0 0 8px;
}

.card .zh {
  color: var(--muted);
  font-size: 0.95rem;
}

.card .zh a {
  color: inherit;
  text-decoration: none;
}

.card h3 a:hover,
.card .zh a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
}

/* Buttons of one language stay on one row together. */
.btn-group {
  display: flex;
  gap: 8px;
}

/* Tonal button */
.btn {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}

/* Filled button: where to get the app */
.btn-filled,
.btn-filled:hover {
  background: var(--accent);
  color: var(--surface);
}

.btn-filled:hover {
  box-shadow: var(--shadow-1);
}

/* Terminal apps: what the family shares, and how to build one */
.callout {
  margin-bottom: 20px;
  padding: 20px 24px;
  border-radius: 16px;
  background: var(--surface-2);
}

.callout p {
  margin: 0;
}

.callout p + p {
  margin-top: 8px;
}

kbd {
  padding: 1px 7px;
  border: 1px solid var(--outline);
  border-radius: 6px;
  background: var(--surface);
  font: 0.85em ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: nowrap;
}

.build {
  margin-top: 20px;
  padding: 20px 24px;
  border: 1px solid var(--outline);
  border-radius: 16px;
}

.build h3 {
  margin: 0;
  font-size: 1.1rem;
}

.build > p {
  margin: 2px 0 0;
  color: var(--muted);
}

.build .tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 16px;
  margin-top: 16px;
}

/* Not apps, so no icon: a smaller card set in type instead, the name in a terminal
   font on a tonal button of the terminu icon blue, like GitHub's but with square
   corners, its text in the family's blue (amber in the dark). */
.tile {
  padding: 16px;
  font-size: 0.95rem;
}

.tile h4 {
  margin: 8px 0 12px;
  font: 600 1.05rem/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.tile h4 a {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 8px;
  background: color-mix(in srgb, #205090 14%, transparent);
  color: var(--accent);
  text-decoration: none;
}

.tile h4 a:hover {
  background: color-mix(in srgb, #205090 24%, transparent);
}

/* On a dark card the blue needs more of itself to show. */
@media (prefers-color-scheme: dark) {
  .tile h4 a {
    background: color-mix(in srgb, #205090 45%, transparent);
  }

  .tile h4 a:hover {
    background: color-mix(in srgb, #205090 60%, transparent);
  }
}

.tile .zh {
  font-size: 0.9rem;
}

/* Footer */
.footer {
  margin-top: 32px;
  border-top: 1px solid var(--outline);
  color: var(--muted);
  font-size: 0.9rem;
}

.footer .container {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 24px;
  padding-bottom: 40px;
}

.footer a {
  color: inherit;
}

@media (max-width: 575.98px) {
  .container {
    padding: 0 16px;
  }

  .hero {
    padding-top: 48px;
  }
}

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

  .card {
    transition: none;
  }

  .card:hover {
    transform: none;
  }
}
