/* The self-hosting page: frei-mkt "pages / Self-hosting r2" (desktop 4436:1076, phone 4436:1283).
   A white page: the title, the photo, the three steps, and the waitlist. The window of the
   waitlist form is a <dialog> (4436:1502). The shared style sheet of the new pages comes first: it
   has the font, the tokens, the button component, the nav bar and the footer. */
.self-hosting-page {
  background: var(--color-white);
  color: #111214;
}

/* The head: the title, the intro, "Join the waitlist" and the line under it. */
.sh-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  padding: 120px 24px 0;
  text-align: center;
}
.sh-head h1 {
  font-size: 64px;
  font-weight: 400;
  line-height: 1.04;
  letter-spacing: -0.05em;
}
.sh-head > p {
  max-width: 640px;
  font-size: 21px;
  line-height: 30px;
  color: #2b2e35;
  text-wrap: pretty;
}
.sh-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding-top: 12px;
}
.nowrap {
  white-space: nowrap;
}
.sh-invitation {
  font-size: 15px;
  line-height: 20px;
  color: var(--color-text-muted);
}

/* The photo: 1363 px of the 1440 of frei-mkt 4436:1096, so 38 px from each side of the window,
   a radius of 40 px, 16:9. */
.sh-photo {
  padding: 72px 38px 0;
}
.sh-photo img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius-card);
}

/* The steps: a column of 720 px for the text, and a grey box of 1200 px for the picture. */
.steps {
  margin: 0;
  padding: 0;
  list-style: none;
}
.step {
  padding: 160px 15px 0;
}
.step-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  max-width: 720px;
  margin: 0 auto;
}
.step-number {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-surface);
  font-size: 17px;
  font-weight: 500;
}
.step-text h2 {
  font-size: 40px;
  font-weight: 400;
  line-height: 44px;
  letter-spacing: -0.04em;
}
.step-text p:not(.step-number) {
  font-size: 19px;
  line-height: 28px;
  color: #2b2e35;
  text-wrap: pretty;
}

/* SEGMENTS: the switch of step 1 and the choices of the form. Radio buttons in a grey pill; the
   checked one is white. Each segment has a hover and a focus ring. */
.platform-switch,
.choice {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.platform-switch {
  margin-top: 8px;
}
.segments {
  display: inline-flex;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: var(--color-surface);
}
.segments input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.segments span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  color: #2b2e35;
  font-size: 16px;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color var(--hover-duration) var(--hover-ease),
    color var(--hover-duration) var(--hover-ease);
}
@media (hover: hover) and (pointer: fine) {
  .segments label:hover span {
    background: rgba(255, 255, 255, 0.55);
    color: #111214;
  }
}
.segments input:checked + span {
  background: var(--color-white);
  color: #111214;
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.segments input:focus-visible + span {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

/* THE PICTURES. A box (1200 x 680 on a desktop) with a stage of 1200 x 680 design pixels in
   its centre. The box is a wallpaper, as the desktop of a Mac: flowing frosted-glass forms in
   frei blue with one warm orange edge light, and a calm pale blue centre. All three steps show
   the same image. The stage is in `em`: one em is 17 design pixels, so the stage scales with the
   width of the box. On a narrow box the stage keeps a minimum size, and the box shows its centre. */
.art {
  position: relative;
  max-width: 1200px;
  margin: 56px auto 0;
  aspect-ratio: 1200 / 680;
  overflow: hidden;
  border-radius: var(--radius-card);
  background-color: #a9d3fd;
  background-image: url("/new/assets/self-hosting/wallpaper-1200.webp");
  background-image: image-set(
    url("/new/assets/self-hosting/wallpaper-1200.avif") type("image/avif") 1x,
    url("/new/assets/self-hosting/wallpaper-2048.avif") type("image/avif") 2x,
    url("/new/assets/self-hosting/wallpaper-1200.webp") type("image/webp") 1x,
    url("/new/assets/self-hosting/wallpaper-2048.webp") type("image/webp") 2x
  );
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  container-type: inline-size;
}
.stage {
  --stage-min: 9.2px;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 70.588em;
  height: 40em;
  font-size: max(1.4167cqw, var(--stage-min));
  transform: translate(-50%, -50%);
  animation: stage-in 300ms var(--ease-out);
}
@keyframes stage-in {
  from {
    opacity: 0;
  }
}
/* Mac or Linux: the switch of step 1 shows one of the two stages. */
.stage-linux,
.step-install:has(input[value="linux"]:checked) .stage-mac {
  display: none;
}
.step-install:has(input[value="linux"]:checked) .stage-linux {
  display: block;
}

/* A window of macOS: white, a bar with three grey dots and the title. */
.win {
  position: absolute;
  top: 50%;
  left: 50%;
  overflow: hidden;
  border-radius: 0.824em;
  background: var(--color-white);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.06),
    0 1.41em 3.53em rgba(0, 32, 90, 0.24);
  transform: translate(-50%, -50%);
  color: #111214;
}
.win-bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 2.824em;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.win-bar::before {
  content: "";
  position: absolute;
  top: 1.06em;
  left: 1.06em;
  width: 0.706em;
  height: 0.706em;
  border-radius: 50%;
  background: #dcdee3;
  box-shadow:
    1.176em 0 #dcdee3,
    2.353em 0 #dcdee3;
}
.win-bar span {
  font-size: 0.765em;
  font-weight: 500;
  color: var(--color-text-muted);
}

/* Step 1, Mac: the installer window. */
.win-mac {
  width: 37.647em;
  height: 23.53em;
}
.win-mac .win-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 3.65em;
}
.mac-row {
  display: flex;
  align-items: flex-start;
  gap: 1.9em;
}
.mac-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1em;
  width: 9.4em;
}
.mac-item span {
  font-size: 0.882em;
  font-weight: 500;
}
.app-icon,
.folder {
  width: 7.53em;
  height: 7.53em;
}
.app-icon {
  border-radius: 1.65em;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}
.drag {
  width: 5.65em;
  height: 1.41em;
  margin-top: 3.06em;
}
.mac-hint {
  margin-top: 3.3em;
  font-size: 0.765em;
  color: var(--color-text-muted);
}

/* Step 1, Linux: the terminal. */
.win-terminal {
  width: 42.35em;
}
.win-terminal .win-body {
  display: flex;
  flex-direction: column;
  gap: 0.7em;
  padding: 2.12em 2.35em 2.6em;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  line-height: 1.647;
  white-space: nowrap;
}
.win-terminal .prompt,
.win-terminal .dim {
  color: var(--color-text-muted);
}
.win-terminal .ok {
  color: var(--color-blue);
}

/* Step 2: the settings of the server. */
.win-settings {
  width: 37.647em;
}
.win-settings .win-body {
  display: flex;
  flex-direction: column;
  gap: 1.65em;
  padding: 1.88em 2.35em 2.35em;
}
.group-label {
  margin-bottom: 0.62em;
  font-size: 0.765em;
  font-weight: 500;
  color: var(--color-text-muted);
}
.options {
  overflow: hidden;
  border-radius: 0.824em;
  background: var(--color-surface);
}
.option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.82em 1.18em;
}
/* The line between two choices starts at the text, as in iOS. */
.option + .option {
  background: linear-gradient(rgba(0, 0, 0, 0.07), rgba(0, 0, 0, 0.07)) 1.18em 0 / calc(100% - 1.18em) 1px no-repeat;
}
.option-title {
  font-weight: 500;
  line-height: 1.4;
}
.option-sub {
  font-size: 0.824em;
  line-height: 1.4;
  color: var(--color-text-muted);
}
.mark {
  flex: none;
  width: 1.41em;
  height: 1.41em;
}

/* Step 3: the QR code of the server and the phone that is connected. */
.art-connect .stage {
  --stage-min: 8.3px;
}
.win-qr {
  left: 13.53em;
  width: 32.94em;
  height: 25.88em;
  transform: translateY(-50%);
}
.win-qr .win-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 2.1em;
}
.qr-title {
  font-size: 1.294em;
  font-weight: 600;
}
.qr {
  width: 11.76em;
  height: 11.76em;
  margin-top: 1.2em;
}
.qr-note {
  margin-top: 1.4em;
  font-size: 0.882em;
  color: var(--color-text-muted);
}
.phone {
  position: absolute;
  top: 50%;
  left: 42.35em;
  width: 14.7em;
  height: 30.6em;
  padding: 0.47em;
  border-radius: 2.59em;
  background: #1b1d20;
  box-shadow: 0 1.41em 3.53em rgba(0, 32, 90, 0.28);
  transform: translateY(-50%);
}
.phone-screen {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  padding-top: 9.53em;
  border-radius: 2.18em;
  background: var(--color-white);
}
.island {
  position: absolute;
  top: 0.7em;
  left: 50%;
  width: 4.24em;
  height: 1.29em;
  border-radius: var(--radius-pill);
  background: #1b1d20;
  transform: translateX(-50%);
}
.phone-check {
  width: 4.24em;
  height: 4.24em;
}
.phone-title {
  margin-top: 1.2em;
  font-size: 1.176em;
  font-weight: 600;
}
.phone-sub {
  margin-top: 0.2em;
  font-size: 0.882em;
  color: var(--color-text-muted);
}
.phone-done {
  position: absolute;
  right: 1.18em;
  bottom: 1.18em;
  left: 1.18em;
  display: grid;
  place-items: center;
  height: 2.59em;
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  font-size: 0.94em;
  font-weight: 500;
}

/* THE END OF THE STEPS (frei-mkt 4436:1204): a centred title, one line of text, "Join the
   waitlist" and the line under it, then the waitlist photo across the full width, down to the
   footer. The background of the section is the wall of the photo: from white at the top to the
   grey of the wall at 86 %. Two layers make the photo. Under: the full photo, but only the band of
   the shelf, from 72.14 % of its height. Over: the objects of the photo, cut out. The section cuts
   the photo at 88.24 % of its height (715 of 810 px), at the front edge of the shelf. */
.sh-end {
  display: flex;
  flex-direction: column;
  align-items: center;
  /* 268 + 4: the title of 52 px sits as the 44 px line of frei-mkt, 272 px from the top. */
  padding: 268px 24px 0;
  background: linear-gradient(rgba(236, 234, 239, 0), #eceaef 85.846%);
  text-align: center;
}
.sh-end h2 {
  max-width: 720px;
  font-size: 50px;
  font-weight: 400;
  line-height: 52px;
  letter-spacing: -0.04em;
}
.sh-end > p {
  max-width: 720px;
  margin-top: 12px;
  font-size: 19px;
  line-height: 28px;
  color: #2b2e35;
  text-wrap: pretty;
}
.sh-end .sh-cta {
  margin-top: 23px;
}
.sh-invite {
  position: relative;
  width: calc(100% + 48px);
  margin-top: 35px;
  overflow: hidden;
  aspect-ratio: 1440 / 714.72;
}
.sh-invite picture {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
}
.sh-invite img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.sh-invite-photo img {
  clip-path: inset(72.14% 0 0 0);
}

/* THE WINDOW OF THE FORM: a <dialog>. js/self-hosting.js opens it with showModal(). On a desktop a
   white card of 480 px in the centre; on a phone a sheet at the bottom, 8 px from the edges. */
.join {
  width: min(480px, calc(100vw - 16px));
  max-height: calc(100dvh - 16px);
  padding: 40px;
  overflow: auto;
  border: 0;
  border-radius: var(--radius-card);
  background: var(--color-white);
  color: #111214;
}
.join::backdrop {
  background: rgba(11, 11, 15, 0.32);
}
.join[open] {
  animation: join-in 250ms var(--ease-out);
}
.join[open]::backdrop {
  animation: join-fade 250ms var(--ease-out);
}
@keyframes join-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}
@keyframes join-fade {
  from {
    opacity: 0;
  }
}
.join-close {
  position: absolute;
  top: 24px;
  right: 24px;
}
.join h2 {
  margin-right: 56px;
  font-size: 28px;
  font-weight: 400;
  line-height: 32px;
  letter-spacing: -0.03em;
}
.join-intro {
  margin: 8px 56px 0 0;
  font-size: 17px;
  line-height: 25px;
  color: #2b2e35;
}
.join-fields {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 24px;
}
.join-email {
  width: 100%;
  height: 48px;
  padding: 0 24px;
  border: 0;
  border-radius: var(--radius-pill);
  outline: none;
  background: var(--color-surface);
  color: #1b1d20;
  caret-color: var(--color-blue);
  font: inherit;
  font-size: 17px;
}
.join-email::placeholder {
  color: var(--color-text-subtle);
  opacity: 1;
}
.join-email:focus {
  box-shadow: inset 0 0 0 2px rgba(10, 122, 255, 0.5);
}
.choice legend {
  margin-bottom: 10px;
  padding: 0;
  font-size: 15px;
  font-weight: 500;
}
.choice .segments {
  display: flex;
}
.choice label {
  flex: 1 1 0;
  min-width: 0;
}
.choice .segments span {
  padding: 0 8px;
}
.join-submit {
  justify-content: space-between;
  width: 100%;
  margin-top: 8px;
}
.join-form.is-busy .join-submit {
  opacity: 0.6;
  cursor: progress;
}
.join .note,
.join .thanks {
  margin-top: 16px;
  padding: 8px 16px;
  border-radius: 18px;
  background: var(--color-surface);
  color: #032047;
  font-size: 15px;
  line-height: 1.4;
  text-wrap: pretty;
}
.join .note[hidden] {
  display: none;
}
.join .thanks {
  display: none;
  outline: none;
}
.join-form.is-done .join-fields {
  display: none;
}
.join-form.is-done .thanks {
  display: block;
  margin-top: 24px;
  padding: 0;
  background: none;
  font-size: 17px;
  line-height: 25px;
}
/* With no script, each "Join the waitlist" goes to #join, and the window shows as its target. */
@media (scripting: none) {
  .join:target {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: block;
    height: fit-content;
    margin: auto;
    box-shadow: 0 0 0 100vmax rgba(11, 11, 15, 0.32);
  }
}

/* A phone: the desktop design stacked, with the sizes of frei-mkt 4436:1283. */
@media (max-width: 760px) {
  .sh-head {
    gap: 20px;
    padding-top: 56px;
  }
  .sh-head h1 {
    font-size: 44px;
  }
  .sh-head > p {
    font-size: 18px;
    line-height: 27px;
  }
  .sh-photo {
    padding: 40px 8px 0;
  }
  .sh-photo img {
    aspect-ratio: 374 / 460;
    border-radius: var(--radius-card-phone);
  }
  .step {
    padding: 96px 8px 0;
  }
  .step-text {
    padding: 0 16px;
  }
  .step-text h2 {
    font-size: 30px;
    line-height: 34px;
  }
  .step-text p:not(.step-number) {
    font-size: 17px;
    line-height: 26px;
  }
  .art {
    margin-top: 32px;
    aspect-ratio: 374 / 360;
    border-radius: var(--radius-card-phone);
  }
  .sh-end {
    padding: 136px 24px 0;
  }
  .sh-end h2 {
    font-size: 34px;
    line-height: 38px;
  }
  .sh-end > p {
    font-size: 17px;
    line-height: 26px;
  }
  .sh-end .sh-cta {
    margin-top: 20px;
  }
  /* The photo of the desktop, cut on the sides: 5 : 4, so the computer and the phone stay large. */
  .sh-invite {
    margin-top: 32px;
    aspect-ratio: 5 / 3.53;
  }
  .sh-invite img {
    aspect-ratio: 5 / 4;
  }
  .join {
    margin-bottom: 8px;
    padding: 32px 24px 24px;
    border-radius: var(--radius-card-phone);
  }
  .join-close {
    top: 16px;
    right: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stage,
  .join[open],
  .join[open]::backdrop {
    animation: none;
  }
  .segments span {
    transition: none;
  }
}
