/*
 * Convert site additions. Tokens are defined here (not in saas/tokens.css) so the
 * repo carries them; every rule below uses only tokens.
 */
:root {
  /* the app icon beside the wordmark */
  --sa-mark: 1.4em;
  --sa-mark-gap: 0.3em;

  /* card illustrations: two files, the original behind and the converted one in front,
     the same motif as the app icon */
  --cv-stage-w: 208px;
  --cv-stage-h: 148px;
  --cv-file-w: 96px;
  --cv-file-h: 120px;
  --cv-file-r: 20px;
  --cv-back-x: 20px;
  --cv-back-y: 18px;
  --cv-front-x: 92px;
  --cv-front-y: 6px;
  --cv-tilt-back: -9deg;
  --cv-tilt-front: 5deg;
  --cv-glyph-h: 40px;
  --cv-bar-w: 6px;
  --cv-bar-gap: 4px;
  --cv-line-h: 6px;
  --cv-head-h: 9px;
  --cv-type-size: 34px;
  --cv-photo-r: 10px;
  --cv-photo-a: #ffb36b;
  --cv-photo-b: #ff6f61;
  --cv-photo-c: #1d4f9e;
}

.mark {
  display: inline-flex;
  align-items: center;
  gap: var(--sa-mark-gap);
}

.mark img {
  inline-size: var(--sa-mark);
  block-size: var(--sa-mark);
}

/* ---------- Card illustration ---------- */
.cv {
  position: relative;
  inline-size: var(--cv-stage-w);
  block-size: var(--cv-stage-h);
  margin-inline: auto;
}

.cv__file {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  inline-size: var(--cv-file-w);
  block-size: var(--cv-file-h);
  padding: var(--sa-space-5) var(--sa-space-3) var(--sa-space-3);
  border-radius: var(--cv-file-r);
}

.cv__file--from {
  inset-inline-start: var(--cv-back-x);
  inset-block-start: var(--cv-back-y);
  background: var(--sa-chip);
  transform: rotate(var(--cv-tilt-back));
}

.cv__file--to {
  inset-inline-start: var(--cv-front-x);
  inset-block-start: var(--cv-front-y);
  background: var(--sa-surface);
  transform: rotate(var(--cv-tilt-front));
}

/* the glyph area: a waveform, a photo, the lines of a page or two letters */
.cv__glyph {
  display: flex;
  align-items: center;
  justify-content: center;
  inline-size: 100%;
  block-size: var(--cv-glyph-h);
}

.cv__wave {
  gap: var(--cv-bar-gap);
}

.cv__wave i {
  inline-size: var(--cv-bar-w);
  block-size: var(--h);
  border-radius: var(--sa-radius-round);
  background: var(--sa-faint);
}

.cv__file--to .cv__wave i {
  background: var(--sa-sky);
}

.cv__photo {
  border-radius: var(--cv-photo-r);
  background: linear-gradient(135deg, var(--cv-photo-a), var(--cv-photo-b) 45%, var(--cv-photo-c));
}

.cv__file--from .cv__photo {
  opacity: 0.55;
}

.cv__lines {
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: var(--cv-bar-gap);
}

.cv__lines i {
  inline-size: var(--h);
  block-size: var(--cv-line-h);
  border-radius: var(--sa-radius-round);
  background: var(--sa-faint);
}

/* the converted page: a real heading, formatted text */
.cv__file--to .cv__lines i {
  background: var(--sa-chip);
}

.cv__file--to .cv__lines i:first-child {
  block-size: var(--cv-head-h);
  background: var(--sa-sky);
}

/* a font: two letters set in the display face, the converted one in the accent colour */
.cv__type {
  font-family: var(--sa-font-display);
  font-size: var(--cv-type-size);
  line-height: 1;
  color: var(--sa-faint);
}

.cv__file--to .cv__type {
  color: var(--sa-sky);
}

/* the chips under an illustration don't need the space they keep for a card without one */
.sa-card .cv {
  margin-block-end: var(--sa-space-4);
}

.sa-card .cv + .sa-chips {
  min-block-size: 0;
  margin-block-end: var(--sa-space-6);
}

/* ---------- Pages with a short hero (install, support) ----------
   The hero's sky, its title and its line, then the page's one thing rising out of the glow
   where the landing page has the app window. */
.page-hero {
  padding-block-end: var(--sa-space-20);
}

/* Mac or Windows: the landing page carries both versions of every button and sentence that
   differs, and a script in its <head> stamps data-os="windows" on <html> for Windows visitors.
   Hiding (rather than showing) keeps each element's own display value. */
html:not([data-os='windows']) .for-windows {
  display: none;
}

[data-os='windows'] .for-mac {
  display: none;
}

.other-os {
  margin-block-start: var(--sa-space-5);
}

/* The install title says "on its way" only when a Download button sent the visitor here;
   the install page's own script stamps data-downloading on <html>. */
.when-downloading {
  display: none;
}

[data-downloading] .when-downloading {
  display: inline;
}

[data-downloading] .when-reading {
  display: none;
}

.install-again {
  margin-block-start: var(--sa-space-6);
}

/* an inline link in running text: underlined, so it reads as a link on the centred page */
.give__link {
  color: var(--sa-ink);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--sa-ink) 30%, transparent);
  text-underline-offset: 0.2em;
  transition: text-decoration-color var(--sa-dur-press) var(--sa-ease);
}

.give__link:hover {
  text-decoration-color: currentColor;
}

/* ---------- Support: the form ---------- */
.give {
  --give-max: 480px;
  max-inline-size: var(--give-max);
  margin-inline: auto;
}

.give__panel {
  padding: var(--sa-card-pad);
  border: var(--sa-hairline) solid var(--sa-line);
  border-radius: var(--sa-radius-window);
  background: var(--sa-surface);
  box-shadow: var(--sa-window-shadow);
  text-align: start;
}

#give-panel {
  display: grid;
  gap: var(--sa-space-6);
}

.give__amounts {
  display: grid;
  gap: var(--sa-space-2);
  min-inline-size: 0;
  padding: 0;
  border: 0;
}

.give__amounts > legend {
  margin-block-end: var(--sa-space-2);
  padding: 0;
}

.give__choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: var(--sa-space-2);
}

.give__choice {
  position: relative;
}

.give__choice > input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.give__choice > span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-block-size: var(--sa-control-h-md);
  padding-inline: var(--sa-space-3);
  border-radius: var(--sa-radius-control);
  background: var(--sa-chip);
  color: var(--sa-ink);
  font-size: var(--sa-text-small);
  font-weight: var(--sa-weight-control);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition:
    background-color var(--sa-dur-press) var(--sa-ease),
    color var(--sa-dur-press) var(--sa-ease),
    scale var(--sa-dur-press) var(--sa-ease);
}

.give__choice:hover > span {
  background: var(--sa-chip-hover);
}

.give__choice:active > span {
  scale: var(--sa-press);
}

.give__choice > input:checked + span {
  background: var(--sa-primary);
  color: var(--sa-on-primary);
}

.give__choice > input:focus-visible + span {
  outline: 2px solid var(--sa-focus);
  outline-offset: 2px;
}

/* .sa-field sets display, which would beat the hidden attribute */
.give [hidden] {
  display: none;
}

.give__optional {
  color: var(--sa-quiet);
}

/* Stripe's fields draw into this; it keeps their height while they load */
.give__pay {
  min-block-size: 220px;
}

.give__pay[aria-busy='true'] {
  border-radius: var(--sa-radius-cell);
  background: var(--sa-chip);
  animation: give-wait 1.4s var(--sa-ease) infinite alternate;
}

@keyframes give-wait {
  to {
    opacity: 0.5;
  }
}

@media (prefers-reduced-motion: reduce) {
  .give__pay[aria-busy='true'] {
    animation: none;
  }
}

.give__error {
  margin-block-start: calc(var(--sa-space-2) * -1);
}

.give__submit {
  inline-size: 100%;
}

.give__submit[aria-busy='true'] {
  cursor: progress;
}

.give__stripe {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sa-space-2);
  margin-block-start: calc(var(--sa-space-2) * -1);
  color: var(--sa-quiet);
  font-size: var(--sa-text-meta);
}

.give__stripe svg {
  inline-size: 12px;
  block-size: 12px;
  fill: currentColor;
}

.give__stripe a:hover {
  color: var(--sa-ink);
}

.give__done {
  display: grid;
  justify-items: center;
  gap: var(--sa-space-4);
  padding-block: var(--sa-space-8);
  text-align: center;
}

.give__done:focus {
  outline: none;
}

.give__done > .sa-button {
  margin-block-start: var(--sa-space-4);
}

.give__cup {
  font-size: var(--sa-text-stat);
}

.give__note {
  margin-block-start: var(--sa-space-5);
  text-align: center;
}

/* ---------- Install: the steps ----------
   One column of white panels on the sky, like the app window: a number, a title, the
   instructions read from the left, and the path through macOS as chips. */
.steps {
  display: grid;
  gap: var(--sa-gap);
  max-inline-size: 720px;
  margin-inline: auto;
  padding: 0;
  list-style: none;
}

.step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--sa-space-5);
  padding: var(--sa-card-pad);
  border: var(--sa-hairline) solid var(--sa-line);
  border-radius: var(--sa-radius-window);
  background: var(--sa-surface);
  box-shadow: var(--sa-window-shadow);
  text-align: start;
}

@media (width < 640px) {
  .step {
    grid-template-columns: 1fr;
    gap: var(--sa-space-3);
    padding: var(--sa-space-6);
  }
}

.step__n {
  display: grid;
  place-items: center;
  inline-size: var(--sa-control-h-md);
  block-size: var(--sa-control-h-md);
  border-radius: var(--sa-radius-round);
  background: var(--sa-sky);
  color: var(--sa-on-sky);
  font-weight: var(--sa-weight-control);
  font-variant-numeric: tabular-nums;
}

.step__body {
  display: grid;
  gap: var(--sa-space-4);
  min-inline-size: 0;
}

.step__body > .sa-title {
  margin-block-start: var(--sa-space-2);
}

.step__body strong {
  color: var(--sa-ink);
  font-weight: var(--sa-weight-control);
}

.step__path {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sa-space-2);
}

.step__to {
  color: var(--sa-quiet);
}

.step__os {
  display: grid;
  gap: var(--sa-space-3);
  padding: var(--sa-space-5);
  border-radius: var(--sa-radius-cell);
  background: var(--sa-well);
}

.step__os-name {
  color: var(--sa-ink);
  font-weight: var(--sa-weight-control);
}

.step__list {
  display: grid;
  gap: var(--sa-space-2);
  padding-inline-start: var(--sa-space-5);
  color: var(--sa-sub);
  list-style: decimal; /* base.css strips list markers; these steps are an order */
}

.step__list li::marker {
  color: var(--sa-quiet);
  font-variant-numeric: tabular-nums;
}

.step__more > summary {
  color: var(--sa-ink);
  font-size: var(--sa-text-small);
  font-weight: var(--sa-weight-control);
  cursor: pointer;
}

.step__more > p {
  margin-block-start: var(--sa-space-3);
}

.step__code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sa-space-3);
  padding: var(--sa-space-2) var(--sa-space-2) var(--sa-space-2) var(--sa-space-5);
  border-radius: var(--sa-radius-control);
  background: var(--sa-primary);
  color: var(--sa-on-primary);
}

.step__code code {
  overflow-x: auto;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: var(--sa-text-small);
  white-space: nowrap;
}

/* ---------- The studio's line, last in every footer ---------- */
.made-by {
  margin-block-start: var(--sa-space-6);
}

.made-by a {
  color: var(--sa-ink);
}

.made-by a:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* The heart is the one red thing on the page; it sits on the text's x-height
   rather than the baseline so it reads as a word, not an icon. */
.made-by__heart {
  display: inline-block;
  vertical-align: -0.12em;
  fill: var(--sa-danger);
}
