/* MyCommute website styles.
   One file for every page. Colours are set once as tokens below,
   for light mode and for dark mode. If you change a colour, re-check
   its contrast (text needs 4.5:1 against its background). */

:root {
  color-scheme: light dark;

  --bg: #ffffff;
  --surface: #f2f3fc;
  --text: #12123a;
  --muted: #474a6b;
  --link: #00008b;
  --border: #8587ad;
  --button-bg: #00008b;
  --button-text: #ffffff;
  --focus: #00008b;
  --focus-halo: #ffffff;
  --star: #a34a00;

  /* The night-sky hero looks the same in light and dark mode. */
  --sky: #00006f;
  --sky-text: #ffffff;
  --sky-muted: #e4e6ff;
  --sun: #ffd27a;
  --sun-text: #00004d;

  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --page: 68rem;
  --prose: 42rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a26;
    --surface: #15153f;
    --text: #f2f2fc;
    --muted: #c5c7e3;
    --link: #b3c0ff;
    --border: #7d80b8;
    --button-bg: #ffd27a;
    --button-text: #00004d;
    --focus: #ffd27a;
    --focus-halo: #0a0a26;
    --star: #ffd27a;
  }
}

@media (prefers-contrast: more) {
  :root { --muted: var(--text); --border: var(--text); }
}

/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}

h1, h2, h3 {
  font-family: var(--font-head);
  line-height: 1.2;
  margin: 0 0 0.6em;
  text-wrap: balance;
}
h1 { font-size: clamp(2rem, 1.4rem + 3vw, 3.25rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 1.25rem + 1.2vw, 2rem); font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 700; }

p, ul, ol, figure, blockquote { margin: 0 0 1rem; }
ul, ol { padding-left: 1.4rem; }
li + li { margin-top: 0.35rem; }

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

a { color: var(--link); text-decoration: underline; text-underline-offset: 0.15em; text-decoration-thickness: 0.08em; }
a:hover { text-decoration-thickness: 0.16em; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px var(--focus-halo);
  border-radius: 0.25rem;
}
:focus:not(:focus-visible) { outline: none; }

.visually-hidden:not(:focus):not(:active) {
  clip-path: inset(50%);
  height: 1px;
  width: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -10rem;
  z-index: 100;
  padding: 0.75rem 1rem;
  background: var(--bg);
  color: var(--link);
  border: 2px solid currentColor;
  border-radius: 0.5rem;
  font-weight: 700;
}
.skip-link:focus { top: 1rem; }

.wrap {
  max-width: var(--page);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
}

.muted { color: var(--muted); }
.lede { font-size: 1.2rem; }

/* ---------- App Store badge ---------- */

/* Apple's official "Download on the App Store" artwork, used as it is.
   Apple's rules: do not recolour, redraw or stretch it; keep it at least
   40px tall; keep clear space of a quarter of its height on every side.
   The white badge goes on dark backgrounds, the black one on light ones. */
.badge-row { margin-block: 1.25rem 1rem; }
.store-badge {
  display: inline-block;
  line-height: 0;
  border-radius: 0.6rem;
}
.store-badge img { height: 3.25rem; width: auto; max-width: none; }

/* ---------- Header ---------- */

.site-header {
  background: var(--sky);
  color: var(--sky-text);
}
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 0.75rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.75rem;
  color: var(--sky-text);
  font-family: var(--font-head);
  font-size: 1.25rem;
  font-weight: 800;
  text-decoration: none;
}
.brand img { width: 2.25rem; height: 2.25rem; border-radius: 22%; border: 1px solid rgb(255 255 255 / 0.35); }
.brand:hover { text-decoration: underline; }

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav li { margin: 0; }
.site-nav a {
  display: inline-block;
  min-height: 2.75rem;
  padding: 0.6rem 0.75rem;
  color: var(--sky-text);
  font-weight: 600;
  text-decoration: none;
  border-radius: 0.5rem;
}
.site-nav a:hover { text-decoration: underline; }
.site-nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 0.16em; text-underline-offset: 0.3em; }

/* Focus ring colours on the dark sky areas, in both colour modes. */
.site-header :focus-visible,
.hero :focus-visible,
.cta :focus-visible {
  outline-color: #ffffff;
  box-shadow: 0 0 0 6px var(--sky);
}

/* ---------- Hero ---------- */

.hero {
  background: var(--sky);
  color: var(--sky-text);
}
.hero .wrap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  gap: 2rem 3rem;
  align-items: center;
  padding-block: clamp(1.5rem, 5vw, 4rem) clamp(1.5rem, 4vw, 3rem);
}
.hero h1 { margin-bottom: 0.4em; }
.hero .lede { color: var(--sky-muted); max-width: 34rem; }
.hero .badge-row { margin-bottom: 0; }

/* One starred review in the hero, under the example notifications. */
.hero .hero-review { margin: 1.5rem 0 0; padding-inline: 0.25rem; }
.hero .hero-review .stars { color: var(--sun); font-size: 1.5rem; }
.hero .hero-review blockquote { margin-bottom: 0.4rem; }
.hero .hero-review blockquote p {
  font-family: var(--font-head);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.35;
}
.hero .hero-review figcaption { color: var(--sky-muted); }
/* The illustration is cropped, not squashed. On narrow screens it is kept
   tall enough (17rem) for the notification in it to stay readable. */
.hero-art img { width: 100%; height: auto; aspect-ratio: 16 / 5; min-height: 17rem; object-fit: cover; object-position: 50% 45%; }

.page-hero .wrap { display: block; padding-block: clamp(1.5rem, 4vw, 3rem); }
.page-hero h1 { max-width: 22ch; }
.page-hero .lede { margin-bottom: 0; }

/* Example notifications: real text, styled like iPhone notifications. */
.notifs { margin: 0; }
.notifs ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.notifs li { margin: 0; }
.notif {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.8rem;
  align-items: start;
  padding: 0.9rem 1rem;
  background: #f7f7fb;
  color: #1c1c1e;
  border: 1px solid transparent;
  border-radius: 1.25rem;
}
.notif img { width: 2.6rem; height: 2.6rem; border-radius: 22%; }
.notif p { margin: 0; }
.notif .title { font-weight: 700; }

/* ---------- Sections ---------- */

.section { padding-block: clamp(2rem, 6vw, 4rem); }
.section.tint { background: var(--surface); }
.section > .wrap > h2 { max-width: 30ch; }
.section-intro { max-width: var(--prose); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.grid > li { margin: 0; }
.grid + p { margin-top: 1.25rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.25rem;
}
.tint .card { background: var(--bg); }
.card > :last-child { margin-bottom: 0; }
.card h3 { text-wrap: wrap; }

/* How it works */
.steps { counter-reset: step; }
.steps > li { counter-increment: step; }
.steps h3 { display: flex; align-items: center; gap: 0.6rem; }
.steps h3::before {
  content: counter(step);
  display: grid;
  flex: none;
  place-items: center;
  width: 2rem;
  height: 2rem;
  background: var(--button-bg);
  color: var(--button-text);
  border-radius: 50%;
  font-size: 1rem;
}

/* Screenshots */
.shots { grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr)); }
.shots figure { margin: 0; }
.shots img {
  width: 100%;
  max-width: 20rem;
  margin-inline: auto;
  border-radius: 1.5rem;
  border: 1px solid var(--border);
  background: #060606;
}
.shots figcaption { margin-top: 0.75rem; text-align: center; }

/* Reviews: laid out like App Store reviews (title, stars, text) */
.review { margin: 0; }
.review-title { margin: 0 0 0.3rem; font-size: 1.15rem; }
.stars { margin: 0 0 0.6rem; color: var(--star); font-size: 1.25rem; line-height: 1; letter-spacing: 0.12em; }
.review blockquote { margin: 0 0 0.75rem; }
.review blockquote p { margin: 0; }
.review figcaption { color: var(--muted); font-size: 1rem; }

/* Call to action band: night sky, the same in light and dark mode */
.cta { text-align: center; }
.section.cta { background: var(--sky); color: var(--sky-text); }
.cta h2 { margin-inline: auto; }
.cta p { max-width: var(--prose); margin-inline: auto; }
.cta .badge-row { margin-bottom: 0; }

/* ---------- Article pages ---------- */

.prose { max-width: var(--prose); }
.prose h2 { margin-top: 2.2rem; }
.prose h3 { margin-top: 1.6rem; }
.prose blockquote {
  margin-inline: 0;
  padding: 0.25rem 0 0.25rem 1.1rem;
  border-left: 4px solid var(--border);
}

.example {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1rem 1.25rem;
}
.example > :last-child { margin-bottom: 0; }

/* ---------- Press kit page ---------- */

/* Fact sheet: a real table, so each fact is read with its label. */
.facts { width: 100%; border-collapse: collapse; margin: 0 0 1rem; }
.facts th, .facts td {
  padding: 0.7rem 0.75rem 0.7rem 0;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.facts th { width: 9.5rem; font-weight: 700; }
.facts tr:first-child th, .facts tr:first-child td { border-top: 1px solid var(--border); }
.facts td > :last-child { margin-bottom: 0; }
/* A link that stands alone in a table cell gets a touch target at least 24px tall. */
.facts td > a { display: inline-block; padding-block: 0.15rem; }
@media (max-width: 30em) {
  .facts th, .facts td { display: block; width: auto; padding-right: 0; }
  .facts th { border-bottom: 0; padding-bottom: 0; }
  .facts td { padding-top: 0.15rem; }
  .facts tr:first-child td { border-top: 0; }
}

/* Press images: a small preview that links to the full-size file. */
.press-shots {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem 1rem;
}
@media (min-width: 36em) {
  .press-shots { grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: 1.75rem 1.25rem; }
}
.press-shots li { margin: 0; }
.press-shots figure { margin: 0; }
.press-shots img {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 1rem;
}
.press-shots .wide { grid-column: 1 / -1; }
.press-shots figcaption { margin-top: 0.6rem; font-size: 1rem; }
.press-shots.press-icons { grid-template-columns: repeat(auto-fill, minmax(min(100%, 8rem), 10rem)); }
/* Reviews stacked in running text need space between them. */
.prose .review + .review { margin-top: 1.5rem; }
.prose .review:last-of-type { margin-bottom: 1.5rem; }

/* Questions and answers */
details {
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--surface);
  margin-bottom: 0.75rem;
}
summary {
  cursor: pointer;
  padding: 0.9rem 1.1rem;
  min-height: 2.75rem;
  font-weight: 700;
  border-radius: 0.75rem;
}
summary h3 { display: inline; font-size: inherit; font-family: inherit; margin: 0; }
details > :not(summary) { margin-inline: 1.1rem; }
details > :last-child { margin-bottom: 1rem; }

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 2rem;
  font-size: 1rem;
}
.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}
.site-footer li { margin: 0; }
.site-footer a { display: inline-block; padding-block: 0.6rem; min-height: 2.75rem; }
.site-footer p { color: var(--muted); margin: 0; }

/* ---------- Settings people choose ---------- */

@media (forced-colors: active) {
  .card, .notif, details, .example { border: 2px solid CanvasText; }
  .press-shots img { border: 2px solid CanvasText; }
  .steps h3::before { border: 1px solid CanvasText; }
}

/* Nothing on this site moves. If motion is ever added, keep it inside
   @media (prefers-reduced-motion: no-preference) { ... } */
