/* The doors: signing in, naming a new company, an invitation, asking to
   join, and a refused sign-in.

   The tokens and the reset come from pipeline.css, which loads first, and
   every class is prefixed lg- so the app's own classes cannot reach these
   pages.

   Every door is a sheet of letterhead. The Letterhead gives the paper, the
   ink and the product's name in spaced small capitals; the Library gives
   the brass rule under the name and a page lit like a sheet under a reading
   lamp. At night the lamp burns on warm ink, never the Library's green.
   One column in the middle of the screen. Fields are a hairline with their
   name above, never boxes. Buttons keep the paper and a light hairline
   edge, as ordinary controls do; brass is kept for the rule and for a field
   in use. */

/* Sizes are in rem so the pages follow the reader's own text size; on an
   iPhone that is Dynamic Type. */
@supports (font: -apple-system-body) {
  .lg-root { font: -apple-system-body; }
}

.lg-root {
  --lamp: #fffefc;
  --shade: #f2e9d9;
  --brass: #a8843a;
  --voice: #4a453d;
  background: radial-gradient(75% 85% at 50% 42%, var(--lamp) 0%, var(--paper) 45%, var(--shade) 100%) fixed;
}
@media (prefers-color-scheme: dark) {
  .lg-root {
    --paper: #17140f;
    --lamp: #241e16;
    --shade: #0d0b08;
    --ink: #f3eee3;
    --t2: rgba(243, 238, 227, .6);
    --brass: #c9a962;
    --voice: rgba(243, 238, 227, .72);
  }
}
.lg-body { min-height: 100%; background: transparent; }

/* The column sits in the middle of the screen, both ways. Taller than the
   screen, it starts at the top and scrolls instead of being cut off. */
.lg {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: max(env(safe-area-inset-top), 2.5rem) 1.5rem
           max(env(safe-area-inset-bottom), 2.5rem);
}
.lg-col { width: 100%; max-width: 25rem; margin: auto; }

/* ── the letterhead ────────────────────────────────────────────────────── */

/* The product's name in spaced small capitals over the brass rule, on every
   door: the title on signing in and naming a company, the head of the sheet
   everywhere else. The indent matches the tracking after the last letter,
   so the name sits on the true centre. */
.lg-mark, .lg-hi {
  display: block;
  width: max-content;
  max-width: 100%;
  margin: 0 auto;
  color: var(--ink);
  font: 400 2rem/1 "Iowan Old Style", var(--serif);
  font-variant-caps: all-small-caps;
  letter-spacing: .2em;
  text-indent: .2em;
  text-align: center;
  text-decoration: none;
  border-radius: .25rem;
}
.lg-mark::after, .lg-hi::after {
  content: "";
  display: block;
  width: 10.5rem;
  height: .625rem;
  margin: 1.375rem auto 0;
  background: var(--brass);
  -webkit-mask: url(rule.svg) center / 100% 100% no-repeat;
  mask: url(rule.svg) center / 100% 100% no-repeat;
}
/* One moment on arrival: the rule draws out from its diamond. */
@media (prefers-reduced-motion: no-preference) {
  .lg-mark::after, .lg-hi::after { animation: lg-rule .9s .15s var(--ease) both; }
}
@keyframes lg-rule {
  from { clip-path: inset(0 45% 0 45%); }
  to   { clip-path: inset(0 0 0 0); }
}
/* `pretty`, so the line never leaves its last word on a row of its own. */
.lg-say {
  max-width: 40ch;
  margin: 1.25rem auto 0;
  color: var(--voice);
  font: italic 400 1.3125rem/1.45 "Iowan Old Style", var(--serif);
  text-align: center;
  text-wrap: pretty;
}
.lg-say + .lg-primary { margin-top: 2.5rem; }

/* ── everywhere else ──────────────────────────────────────────────────── */

.lg-title {
  margin-top: 2.5rem;
  color: var(--ink);
  font: 400 clamp(1.6875rem, 5vw, 1.875rem)/1.2 var(--serif);
  letter-spacing: -.01em;
  text-align: center;
  text-wrap: balance;
}
.lg-note {
  max-width: 34ch;
  margin: 1rem auto 0;
  color: var(--voice);
  font: 400 1.0625rem/1.5 var(--sans);
  text-align: center;
  text-wrap: pretty;
}
/* A note's sentences stay whole, so a line breaks between them. */
.lg-note > span { display: inline-block; }
.lg-reason { margin-top: clamp(2.5rem, 6vh, 3.5rem); color: var(--t1); font-size: 1.125rem; }

/* ── the parts ────────────────────────────────────────────────────────── */

.lg-err[hidden] { display: none; }
.lg-flow { margin-top: 2rem; }

/* ── a field ──────────────────────────────────────────────────────────── */

/* Its name above it and a hairline under it, never a box. The line draws
   in brass from the middle while the field is in use. */
.lg-field { position: relative; }
.lg-field + .lg-field, .lg-err + .lg-field { margin-top: 1.5rem; }
.lg-field::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--brass);
  transform: scaleX(0);
  transition: transform .38s var(--ease);
}
.lg-field:focus-within::after { transform: scaleX(1); }
.lg-label {
  display: block;
  color: var(--t2);
  font: 500 1rem/1.3 var(--sans);
}
.lg-input {
  display: block;
  width: 100%;
  height: 3rem;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: 400 1.125rem/1.2 var(--sans);
  caret-color: var(--brass);
}
.lg-input[readonly] { color: var(--t2); }
/* A browser's own fill keeps the paper rather than painting a box. */
.lg-input:-webkit-autofill {
  -webkit-text-fill-color: var(--ink);
  box-shadow: 0 0 0 100rem var(--paper) inset;
  transition: background-color 600000s 0s;
}

/* ── doing something ──────────────────────────────────────────────────── */

/* A button keeps the paper and a light hairline edge; the second of two,
   a lighter one. Round-ended, as the app's own buttons are, so it is never
   taken for one of the fields above it. */
.lg-primary, .lg-second {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  width: 100%;
  min-height: 3.25rem;
  margin-top: 2rem;
  padding: .75rem 1.25rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: 600 1.0625rem/1.2 var(--sans);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .2s var(--ease), border-color .2s var(--ease), transform .12s var(--ease);
}
.lg-second { border-color: var(--line); font-weight: 500; }
/* A pointer resting on a button darkens its edge; a finger's tap leaves
   nothing. */
@media (hover: hover) {
  .lg-primary:not(:disabled):hover, .lg-second:not(:disabled):hover {
    border-color: var(--t3);
    background: var(--hover);
  }
}
.lg-primary:active, .lg-second:active { transform: scale(.99); }
.lg-primary:disabled, .lg-second:disabled { cursor: default; opacity: .55; }
.lg-note + .lg-primary, .lg-reason + .lg-primary,
.lg-note + form > .lg-primary { margin-top: 2.5rem; }
.lg-asks { margin-top: 2.5rem; }
.lg-asks .lg-primary, .lg-asks .lg-second { margin-top: .75rem; }
.lg-asks > :first-child { margin-top: 0; }

/* Google's mark sits on the paper beside the first word, as on Google's
   own buttons. Each run of words stays whole, so a narrow line breaks only
   between them, and every line is centred on its own. */
.lg-g-run { white-space: nowrap; }
.lg-g-badge { display: inline-block; margin-right: .75rem; vertical-align: -.25em; }
.lg-g { display: block; width: 1.25rem; height: 1.25rem; }

/* A quieter way back. */
.lg-link {
  display: block;
  width: max-content;
  max-width: 100%;
  margin: 1.25rem auto 0;
  padding: .25rem .375rem;
  border-radius: .25rem;
  color: var(--t2);
  font: 400 1rem/1.4 var(--sans);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: .25em;
  transition: color .2s var(--ease), text-decoration-color .2s var(--ease);
}
.lg-link:hover { color: var(--ink); text-decoration-color: currentColor; }

/* A refusal sits under the field it is about. */
.lg-err {
  margin-top: .625rem;
  color: var(--red);
  font: 400 .9375rem/1.45 var(--sans);
  text-wrap: pretty;
}
.lg-asks + .lg-err { margin-top: .875rem; text-align: center; }
.lg-err.lg-said { color: var(--t1); }

/* Keyboard focus: a ring in the ink. A field shows it by its brass line
   instead, so the app's own outline is turned off on them here. */
.lg-input:focus-visible { outline: 0; }
.lg-primary:focus-visible, .lg-second:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 999px;
}
.lg-link:focus-visible, .lg-mark:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: .25rem;
}

@media (max-width: 30rem) {
  .lg { padding-right: 1.25rem; padding-left: 1.25rem; }
  .lg-mark, .lg-hi { font-size: 1.75rem; }
  .lg-say { font-size: 1.1875rem; }
}

@media (prefers-reduced-motion: reduce) {
  .lg-field::after, .lg-primary, .lg-second { transition: none; }
}
