/* The public pages: one white screen each, under the app's header, on the landing's two frame lines so the site reads as one. */
/* Colours are the ink, teal and white primitives from tokens.css; corners stay square. */

/* The public pages share the app's frame: 75rem, with the same side margin, so the logo and every edge line up with the app (owner, 12 Oct). */
:root.public-page {
  --public-width: min(75rem, calc(100% - 2 * var(--space-5)));
}

/* The header's hairline is 100vw wide, which includes a classic scrollbar, so the root clips it as the landing does. */
html.public-page {
  overflow-x: clip;
}

/* Selected text takes the accent with white letters, never the browser's blue, as on the landing and the try page's install line. */
.public-page ::selection {
  background: var(--teal-700);
  color: var(--white);
}

.public-page body {
  overflow-x: clip;
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  background: var(--white);
  color: var(--ink-900);
}

/* Two full-height frame hairlines behind everything, as on the landing (3 Nov). */
/* The page keeps its four spans, and only the first one draws, so no line runs through the text. */
.public-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: var(--public-width);
  margin-inline: auto;
  pointer-events: none;
}

.public-grid span {
  border-left: 1px solid var(--ink-200);
}

.public-grid span:first-child {
  border-right: 1px solid var(--ink-200);
}

.public-grid span + span {
  display: none;
}

.public-header,
.public-hero {
  position: relative;
  z-index: 1;
  width: var(--public-width);
  margin-inline: auto;
}

/* The logo, login() and the text sit 24px inside the two frame lines, as on the landing, so nothing touches a line and the logo stays still between pages (3 Nov). */
.public-header,
.public-hero {
  padding-inline: var(--space-5);
}

/* The header is the app's: the same padding, and a hairline under it that runs the full width of the window. */
.public-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: var(--space-4);
}

.public-header::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 100vw;
  height: 1px;
  background: var(--ink-200);
  transform: translateX(-50%);
}

.public-wordmark {
  display: inline-flex;
  color: var(--ink-950);
}

.public-wordmark:hover {
  color: var(--ink-950);
}

.public-wordmark__logo {
  width: auto;
  height: 2rem;
}

/* login() takes the landing's code button spec, so it is the same button on all three pages. */
/* The monospace label sits at weight 500, inside a 2.75rem outline. */
.public-login {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 1.25rem;
  border: 1px solid var(--ink-300);
  font: 500 0.9375rem / 1 var(--font-mono);
  background: var(--white);
  color: var(--ink-950);
}

.public-login:hover {
  border-color: var(--ink-950);
  color: var(--ink-950);
}

.public-page .public-login:active {
  background: var(--ink-100);
}

.public-page :focus-visible {
  outline: 2px solid var(--teal-700);
  outline-offset: 3px;
}

.public-hero {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  align-items: center;
  gap: var(--space-8);
  padding-block: var(--space-8);
}

.public-hero__copy {
  display: grid;
  gap: clamp(var(--space-4), 3.2vh, var(--space-6));
  justify-items: start;
}

.public-label {
  margin: 0;
  color: var(--teal-700);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
}

.public-title {
  max-width: 16ch;
  margin: 0;
  color: var(--ink-950);
  font-family: var(--font-display);
  font-size: clamp(2.25rem, min(5.6vw, 9.5vh), 5.5rem);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: -0.035em;
}

/* At 1920 the title is a little wider than the column, so it runs on into the gap and stays on one line. */
/* Where it fits, its box is the column's width rather than its text's, so Poppins arriving late changes no box on the page. */
.public-join .public-title {
  justify-self: stretch;
  max-width: none;
  white-space: nowrap;
}

.public-lead {
  margin: 0;
  color: var(--ink-600);
  font-size: clamp(1rem, 2.4vh, 1.25rem);
  line-height: 1.55;
}

.public-note {
  margin: 0;
  color: var(--ink-600);
}

/* Every inline link on the site is teal-700 and underlined at rest. */
.public-note a,
.public-join__surface a:not(.btn) {
  color: var(--teal-700);
  text-decoration: underline;
  transition: color 200ms var(--ease-out);
}

.public-note a:hover,
.public-join__surface a:not(.btn):hover {
  color: var(--teal-800);
}

/* The join form is a white sheet on the light page, framed by a hairline, so the fields keep the app's own styles. */
.public-join__surface {
  padding: clamp(var(--space-5), 5vh, var(--space-8)) var(--space-7);
  border: 1px solid var(--ink-200);
  background: var(--white);
  color: var(--ink-900);
}

/* The confirmation takes focus after a submit, so its ring stands clear of the heading's letters. */
.public-page .public-join__done:focus-visible {
  outline-offset: var(--space-4);
}

/* The order after the form: the invitation, the account, then the install line. */
.public-join__next {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-3);
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--ink-200);
  color: var(--ink-700);
  font-size: 0.9375rem;
}

.public-join__next p {
  margin: 0;
}

.public-join__next-title {
  margin: 0;
  color: var(--ink-900);
  font: 600 1rem / 1.3 var(--font-display);
}

.public-join__command {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--ink-300);
}

.public-join__command code {
  flex: 1;
  min-width: 0;
  padding: var(--space-3) var(--space-2);
  overflow-x: auto;
  white-space: nowrap;
  font-size: 0.6875rem;
  user-select: all;
}

/* The install line is the landing's close card's command box: the code and Copy in one row, at least 3.5rem tall with its border. */
/* The form column is narrower than the command, so the code wraps inside the box and Copy stays in the row. */
/* It breaks only between its parts, the flags, the address and the script, so every line reads whole and the domain never splits. */
/* Where the box is too narrow for the whole address, the address breaks after its https:// as well, in both browsers alike. */
.public-join .command {
  display: flex;
  align-items: stretch;
  width: 100%;
  border: 1px solid var(--ink-300);
  background: var(--white);
  container-type: inline-size;
}

.public-join .command code {
  display: flex;
  flex: 1;
  align-items: center;
  min-width: 0;
  min-height: calc(3.5rem - 2px);
  padding: 0.5rem 1rem;
  color: var(--ink-950);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.5;
  white-space: normal;
  user-select: all;
}

.public-join .command__part {
  white-space: nowrap;
}

/* The breaks between the address and the script and after https:// are zero-width spaces drawn by CSS, so a copied selection never carries them. */
.public-join .command__host::after {
  content: "\200B";
}

@container (max-width: 20rem) {
  .public-join .command__part {
    white-space: normal;
  }

  .public-join .command__host::before {
    content: "\200B";
  }
}

.public-join .command__copy {
  flex: none;
  min-width: 4.5rem;
  border: 0;
  border-left: 1px solid var(--ink-300);
  border-radius: 0;
  background: var(--white);
  color: var(--ink-600);
  font: 500 0.875rem / 1 var(--font-sans);
  cursor: pointer;
  transition: background-color 200ms var(--ease-out), color 200ms var(--ease-out);
}

.public-join .command__copy:hover {
  background: var(--ink-050);
  color: var(--ink-950);
}

.public-join .command__copy:active {
  background: var(--ink-100);
}

.public-join .command__copy[data-copied] {
  color: var(--teal-700);
}

.public-page .public-join .command__copy:focus-visible {
  outline: 2px solid var(--teal-700);
  outline-offset: -3px;
}

.public-join__fine {
  color: var(--ink-600);
  font-size: 0.8125rem;
}

/* The install note folds under one quiet line, as on the landing, so the form side shows no fine print until a visitor asks (4 Nov). */
.public-join__more {
  margin-top: 0.75rem;
}

.public-join__more summary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ink-600);
  font-size: 0.875rem;
  line-height: 1.6;
  list-style: none;
  cursor: pointer;
}

.public-join__more summary::-webkit-details-marker {
  display: none;
}

.public-join__more summary::before {
  content: "+";
  width: 0.75rem;
  color: var(--ink-500);
}

.public-join__more[open] summary::before {
  content: "\2212";
}

.public-join__more summary:hover {
  color: var(--ink-900);
}

.public-join__more summary:focus-visible {
  outline: 2px solid var(--teal-700);
  outline-offset: 2px;
}

.public-join__more .public-join__fine {
  margin-top: 0.5rem;
}

.public-join__consent {
  display: flex;
  gap: var(--space-3);
  align-items: center;
}

.public-join__submit {
  width: 100%;
}

/* An invalid field's border grows to 2px, so its padding gives back that pixel and neither the box nor its text moves. */
.public-join .field[data-invalid="true"] .field__input {
  padding: calc(var(--space-3) - 1px) calc(var(--space-4) - 1px);
}

/* The 404 page is one narrow column of reading text, the layout the old privacy page had. */
.public-privacy {
  grid-template-columns: minmax(0, 42rem);
  align-items: start;
  padding-block: var(--space-9);
}

.public-privacy .public-hero__copy {
  gap: var(--space-5);
}

.public-privacy .t-h2 {
  margin-top: var(--space-5);
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.public-privacy .public-note {
  color: var(--ink-700);
  font-size: 1.25rem;
  line-height: 1.55;
}

/* The ssh host key sits on its own line in the join page's command box, large enough to check letter by letter. */
.public-privacy .public-join__command {
  justify-self: start;
  margin-top: calc(-1 * var(--space-2));
}

.public-privacy .public-join__command code {
  font-family: var(--font-mono);
  font-size: 0.9375rem;
}

/* On a desktop screen the join page's sizes scale with the screen height, so it fits one screen from 52rem tall. */
/* The page still scrolls when its content is taller than the window, so nothing is ever cut off. */
@media (min-width: 60rem) and (min-height: 52rem) {
  .public-join {
    padding-block: clamp(var(--space-4), 4vh, var(--space-6));
  }
}

/* With the two columns side by side, the free height above and below them is two flexible rows instead of that padding, so they sit in the middle as before. */
/* The row above keeps at least the padding, and the row below gives way first, so the page scrolls only when the columns themselves do not fit. */
/* The body is exactly one window tall, so the rows share the window and not a height grown from their own minimums; taller columns run on below it and scroll. */
/* That holds for any font, since no height is assumed. */
@media (width > 60rem) and (min-height: 52rem) {
  .public-page body:has(.public-join) {
    grid-template-rows: auto minmax(0, 1fr);
    height: 100vh;
    height: 100svh;
  }

  .public-join {
    grid-template-rows: minmax(clamp(var(--space-4), 4vh, var(--space-6)), 1fr) auto minmax(0, 1fr);
    row-gap: 0;
    padding-block: 0;
  }

  .public-join > * {
    grid-row: 2;
  }
}

@media (max-width: 60rem) {
  .public-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-7);
  }

  /* In one column the title never widens it, so a late Poppins does not reflow the text below it either. */
  .public-join .public-title {
    min-width: 0;
  }
}

/* A visitor back from lesson 1 is not offered it again, from the first frame on, as join-early.js marks the page. */
.js[data-from] [data-try-link] {
  display: none;
}

/* /join is one simple column: a modest title, one line, the form, then the links at the form's foot (owner, 4 Nov: "this page should be simple"). */
/* The column starts on the logo's line, as every page's content does (owner, 12 Oct), and runs from the top like the privacy page. */
.public-hero.public-join {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: var(--space-6);
  padding-block: var(--space-9);
}

.public-join > * {
  grid-row: auto;
  width: min(28rem, 100%);
}

/* On a narrow window the column takes the frame's whole width, as the old single column did. */
@media (max-width: 60rem) {
  .public-join > * {
    width: 100%;
  }
}

.public-join .public-hero__copy {
  gap: var(--space-3);
}

.public-join .public-title {
  max-width: none;
  font-size: 2.5rem;
  line-height: 1.05;
  letter-spacing: -0.03em;
  white-space: normal;
}

.public-join__surface {
  padding: 0;
  border: 0;
}


/* The public pages end on the landing's footer: the ssh line with the try page's address above who builds it, centred (owner, 4 Nov). */
/* /join no longer fits itself to one window, so the footer follows the form and never covers it. */
.public-page body,
.public-page body:has(.public-join) {
  grid-template-rows: auto 1fr auto;
  height: auto;
}

.public-footer {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 0.5rem;
  padding: var(--space-7) var(--space-5) var(--space-8);
  color: var(--ink-500);
  font-size: 0.9375rem;
  text-align: center;
}

.public-footer p {
  margin: 0;
}

/* The bracketed ssh is the lighter part, so the line reads as the address with an optional command in front of it. */
.public-footer__ssh {
  font-family: var(--font-mono);
}

.public-footer__ssh a {
  color: var(--ink-950);
  text-decoration: underline;
  text-decoration-color: var(--ink-300);
  text-underline-offset: 0.2em;
  transition: text-decoration-color 200ms var(--ease-out);
}

.public-footer__by a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--ink-400);
  transition: color 200ms var(--ease-out);
}

.public-footer__ssh a:hover {
  text-decoration-color: var(--teal-700);
}

.public-footer__by a:hover {
  color: var(--ink-900);
}
