/*
 * FM-SWITCH's page in the app's Standard look: a warm parchment ground, white cards, the system
 * font, purple for firmware and links, and the drawn FM-1. Light or dark, following the device,
 * as the app does. The colours are the app's (App/Standard/Theme/Palette.swift).
 */

:root {
  --ground: #eee8dd;
  --card: #fff;
  --control: #e2dbcd;
  --line: #e8e2d7;
  --ink: #1c1c1e;
  --ink-2: #5e5e63;
  --link: #5b21b6;
  --accent: #c2410c;
  --purple: #6d28d9;
  --blue: #2563eb;
  --good: #1f8a45;
  --good-ink: #17602f;
  --good-bg: #e3f1e7;
  --shadow: rgb(0 0 0 / 8%);
  --rounded: ui-rounded, "SF Pro Rounded", system-ui, sans-serif;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #141413;
    --card: #232321;
    --control: #2c2b29;
    --line: #33322f;
    --ink: #f2f1ee;
    --ink-2: #a8a6a1;
    --link: #ff9259;
    --good: #2e9e57;
    --good-ink: #86d9a2;
    --good-bg: #173322;
    --shadow: rgb(0 0 0 / 30%);
  }
}

html {
  background: var(--ground);
}

body {
  margin: 0;
  padding: 0 20px;
  background: var(--ground);
  color: var(--ink);
  font: 17px/1.45 system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 1.25rem 0 3rem;
}

a {
  color: var(--link);
  text-underline-offset: 0.15em;
}

/* The top bar: back to the projects, and the look. */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.back {
  color: var(--link);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
}

.back:hover,
.back:focus-visible {
  text-decoration: underline;
}

/* A segmented control, as the app's pickers are. */
.look {
  display: flex;
  padding: 2px;
  border-radius: 9px;
  background: var(--control);
  font-size: 0.85rem;
}

.look a {
  padding: 4px 12px;
  border-radius: 7px;
  color: var(--ink-2);
  text-decoration: none;
}

.look a:hover,
.look a:focus-visible {
  color: var(--ink);
}

.look a[aria-current="page"] {
  background: var(--card);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 3px rgb(0 0 0 / 12%);
}

/* The header: the app icon beside the name. */
.head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.head img {
  flex: none;
  display: block;
  width: 64px;
  height: 64px;
  border-radius: 22.4%;
  box-shadow: 0 4px 10px rgb(0 0 0 / 18%);
}

h1 {
  margin: 0;
  font-size: clamp(2.1rem, 9vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.lede {
  margin: 0.6rem 0 1.25rem;
  color: var(--ink-2);
}

.drawing {
  margin: 0 0 1rem;
}

/* The status, as the app's connection pill. */
.status {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  margin: 0 auto 1.25rem;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--good-bg);
  color: var(--good-ink);
  font-size: 0.9rem;
  font-weight: 600;
}

.status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--good);
}

/* The Mac download badge. */
.download {
  margin: 0 0 1.5rem;
  text-align: center;
}

.download a {
  display: inline-block;
  border-radius: 16px;
  transition: transform 0.15s ease;
}

.download a:hover,
.download a:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--shadow);
}

.download img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* The home screen's two big cards. */
.feature {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
  padding: 16px;
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 1px 2px var(--shadow);
}

.feature h2 {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.25;
}

.feature p {
  margin: 0.15rem 0 0;
  color: var(--ink-2);
  font-size: 0.95rem;
}

.feature svg {
  display: block;
  width: 44px;
  height: 44px;
}

.feature--change {
  background: var(--purple);
  color: #fff;
  box-shadow: 0 8px 18px rgb(109 40 217 / 25%);
}

.feature--change p {
  color: rgb(255 255 255 / 88%);
}

/* Section labels. */
.label {
  margin: 2rem 4px 0.6rem;
  color: var(--ink-2);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

.card {
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 1px 2px var(--shadow);
}

.card h3 {
  margin: 0 0 0.2rem;
  font-size: 1rem;
}

.card p {
  margin: 0;
  color: var(--ink-2);
  font-size: 0.95rem;
}

.card p + p {
  margin-top: 0.5rem;
}

/* Sideways scrollers: the install's steps and the app's screens. */
.scroller {
  display: grid;
  grid-auto-flow: column;
  gap: 10px;
  margin: 0 -20px;
  padding: 2px 20px 10px;
  list-style: none;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-padding-inline: 20px;
  scroll-snap-type: x mandatory;
}

.scroller > li {
  scroll-snap-align: start;
}

.scroller:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: -2px;
}

.steps {
  grid-auto-columns: min(78%, 340px);
}

.step {
  display: grid;
  align-content: start;
  gap: 8px;
}

.step .n {
  margin: 0;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
}

@media (prefers-color-scheme: dark) {
  .step .n {
    color: var(--link);
  }
}

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

/* The most starred firmwares, each with the badge the app gives it (scripts/firmware-badges.mjs). */
.starred {
  margin: 4px 0 0;
  color: var(--ink-2);
  font-size: 0.8rem;
  font-weight: 600;
}

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

.badges li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  font-size: 0.95rem;
  font-weight: 600;
}

.badges a {
  color: var(--ink);
  text-decoration: none;
}

.badges a:hover,
.badges a:focus-visible {
  color: var(--link);
  text-decoration: underline;
}

.badges .stars {
  color: var(--ink-2);
  font-size: 0.85rem;
  font-weight: 400;
}

.badge {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 25%;
  background: linear-gradient(var(--badge-first) 50%, var(--badge-second) 50%);
  color: var(--badge-ink);
  font: 700 14px/1 var(--rounded);
}

.badge--diagonal {
  background: linear-gradient(to bottom right, var(--badge-first) 50%, var(--badge-second) 50%);
}

@media (prefers-color-scheme: dark) {
  .badge {
    box-shadow: inset 0 0 0 1px rgb(255 255 255 / 22%);
  }
}

/* The install screen: one bar, and the three stages. */
.bar {
  height: 8px;
  border-radius: 99px;
  background: var(--control);
  overflow: hidden;
}

.bar span {
  display: block;
  width: 82%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.stages {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.95rem;
}

.stages li {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 4px 0;
}

.stages li::before {
  content: "";
  box-sizing: border-box;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--control);
  border-radius: 50%;
}

.stages .stage-done::before {
  content: "\2713";
  display: grid;
  place-items: center;
  border: 0;
  background: var(--good);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.stages .stage-now {
  font-weight: 600;
}

.stages .stage-now::before {
  border: 2px solid var(--accent);
}

.stages .stage-next,
.stages small {
  color: var(--ink-2);
  font-weight: 400;
}

/* The app's screens, light or dark to match. */
.screens {
  grid-auto-columns: min(46%, 220px);
}

.screens figure {
  margin: 0;
}

.screens img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  box-shadow: 0 4px 12px rgb(0 0 0 / 14%);
}

.screens figcaption {
  margin-top: 6px;
  color: var(--ink-2);
  font-size: 0.8rem;
  text-align: center;
}

footer {
  margin-top: 2.5rem;
  color: var(--ink-2);
  font-size: 0.8rem;
}

footer p {
  margin: 0 0 0.4rem;
}

@media (width <= 480px) {
  .head img {
    width: 52px;
    height: 52px;
  }
}
