/*
 * mobyapp.org: styles shared by every page.
 *
 * Colours follow the Moby apps: the icon's blue, the apps' accent blues, and
 * near-black backgrounds with raised cards in dark mode.
 */

:root {
  --brand: #1565c0;
  --brand-deep: #0d47a1;
  --accent: #1e5aa8;
  --on-accent: #ffffff;
  --bg: #f2f2f7;
  --surface: #ffffff;
  --surface-border: #e5e5ea;
  --text: #1c1c1e;
  --text-muted: #6c6c70;
  --link: #1e5aa8;
  --radius: 18px;
  --max: 1080px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #a8c8ff;
    --on-accent: #0a2a55;
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-border: #2c2c2e;
    --text: #f2f2f7;
    --text-muted: #aeaeb2;
    --link: #a8c8ff;
  }
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.55;
}

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

img {
  max-width: 100%;
  height: auto;
}

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 20px;
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: 16px;
  top: 16px;
  z-index: 10;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--surface);
}

/* Header */

.site-header {
  background: var(--brand);
  color: #fff;
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  text-decoration: none;
}

.brand img {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: inline-block;
  padding: 10px 0;
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  opacity: 0.85;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 6px;
}

/* Hero */

.hero {
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-deep) 100%);
  color: #fff;
  padding: 56px 0 72px;
}

.hero .wrap {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  align-items: center;
  gap: 40px;
}

.hero h1 {
  margin: 0 0 16px;
  font-size: clamp(34px, 5vw, 54px);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.hero .lead {
  margin: 0 0 28px;
  font-size: 20px;
  opacity: 0.92;
}

.hero-icon {
  justify-self: center;
  width: min(300px, 70vw);
  border-radius: 22%;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.stores {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.store {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  min-width: 190px;
  min-height: 56px;
  padding: 8px 20px;
  border-radius: 14px;
  background: #000;
  color: #fff;
  text-decoration: none;
  line-height: 1.2;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.store small {
  font-size: 12px;
  opacity: 0.8;
}

.store strong {
  font-size: 19px;
}

.store:hover {
  background: #1c1c1e;
}

.hero .note {
  margin: 14px 0 0;
  font-size: 14px;
  opacity: 0.8;
}

/* Sections */

main section {
  padding: 64px 0;
}

main section + section {
  border-top: 1px solid var(--surface-border);
}

h2 {
  margin: 0 0 12px;
  font-size: clamp(26px, 3.5vw, 34px);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h3 {
  margin: 0 0 8px;
  font-size: 19px;
  line-height: 1.3;
}

.section-intro {
  max-width: 680px;
  margin: 0 0 32px;
  color: var(--text-muted);
  font-size: 19px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Four across on wide screens: 8 features and 4 modules divide evenly. */
.grid.four {
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}

.card {
  padding: 24px;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  background: var(--surface);
}

.card p {
  margin: 0;
  color: var(--text-muted);
}

.card .icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 14px;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
}

.card .icon svg {
  width: 24px;
  height: 24px;
}

.steps {
  counter-reset: step;
}

.steps .card {
  position: relative;
}

.steps .card::before {
  counter-increment: step;
  content: counter(step);
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-bottom: 12px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
}

.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 13px;
  font-weight: 700;
  vertical-align: middle;
}

.badge.muted {
  background: var(--surface-border);
  color: var(--text-muted);
}

.card .links {
  margin-top: 14px;
}

.button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 22px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  text-decoration: none;
}

.button.secondary {
  background: transparent;
  color: var(--link);
  box-shadow: inset 0 0 0 2px var(--link);
}

/* Text pages */

.page-title {
  background: var(--brand);
  color: #fff;
  padding: 40px 0 44px;
}

.page-title h1 {
  margin: 0;
  font-size: clamp(30px, 4.5vw, 44px);
  line-height: 1.15;
}

.page-title p {
  margin: 10px 0 0;
  opacity: 0.88;
}

.prose {
  max-width: 760px;
  padding: 48px 20px 64px;
}

.prose h2 {
  margin-top: 40px;
  font-size: 26px;
}

.prose h2:first-child {
  margin-top: 0;
}

.prose li + li {
  margin-top: 6px;
}

.repo-list {
  margin: 20px 0;
  padding: 0;
  list-style: none;
}

.repo-list li {
  margin: 0 0 12px;
}

.repo-list .card {
  display: block;
  color: var(--text);
  text-decoration: none;
}

.repo-list .card h3 {
  color: var(--link);
}

.repo-list .card:hover,
.repo-list .card:focus-visible {
  border-color: var(--link);
}

.repo-list code {
  font-size: 15px;
}

code {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--surface-border);
  font-size: 0.9em;
}

/* Footer */

.site-footer {
  padding: 36px 0 48px;
  border-top: 1px solid var(--surface-border);
  color: var(--text-muted);
  font-size: 15px;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 24px;
}

.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-footer p {
  margin: 0;
}

@media (max-width: 760px) {
  .hero {
    padding: 40px 0 56px;
  }

  .hero .wrap {
    grid-template-columns: 1fr;
  }

  .hero-icon {
    grid-row: 1;
    width: 140px;
  }

  main section {
    padding: 48px 0;
  }
}
