/*
 * The frame of the shell's pages that stand alone, without the sidebar: sign-in, the password and setup pages, a
 * page that could not be shown, "Can't reach the site's records" (proxy.ts) and "isn't answering"
 * (app/shell/not-answering): one file for all of them, so the pages the shell writes as plain HTML wear exactly what
 * its React pages wear. Linked after /shell/theme.css; the shell's own, not a part for tools (tools use the kit's
 * sh- parts). Every value is a theme variable.
 *
 * The optional look parts (milestone 4f) are read with a fallback that is the page as it was before them; a rule
 * that changes what the built-in looks draw reads a private variable made from one of them (`0 * var(--weight-body)`),
 * which is nothing when the look does not give it, so it falls back to the value written before 4f.
 */

/* The company's logo, or its initials. */
.logo {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: var(--radius-sm);
  object-fit: contain;
}
.logo-initials {
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-text);
  font-size: var(--type-xs);
  /* In the title weight (4f looks); 700 before. */
  --sh-initials: calc(var(--weight-heading) + 0 * var(--weight-body));
  font-weight: var(--sh-initials, 700);
}

/*
 * The page: one column, centred. A look's own sign-in background (4f) is painted over the page; without one the page
 * shows through as every other page wears it, its colour and any backdrop the look gives.
 */
.gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
  min-height: 100vh;
  min-height: 100dvh;
  padding: var(--space-6) var(--space-4);
  background: var(--gate-bg, transparent);
}
.gate-card {
  width: min(400px, 100%);
}
.gate-wide {
  width: min(560px, 100%);
}
/* The company's name above the card, in the look's title font and colour. */
.gate-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  max-width: 100%;
  font-family: var(--font-heading, inherit);
  font-size: var(--type-lg);
  font-weight: var(--weight-heading, var(--weight-strong));
  color: var(--title-color, inherit);
  margin-top: var(--space-6);
}

/*
 * The sign-in stage (components/GateStage.tsx): sign-in, "Forgot your password?" and choosing a password. The night
 * is the sidebar's colour (dark in every look and mode), lit by the company's accent and the in-progress blue, with a
 * city drawn over it (components/GateCity.tsx, a canvas reading the same colours). The company stands on it in the
 * sidebar's text colours; the form sits on a glass panel in the page's own panel colours. Still for anyone who asks
 * for less motion.
 */
.gate-stage {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  justify-content: center;
  gap: var(--space-6);
  padding: clamp(24px, 6vh, 72px) var(--space-5);
  background: var(--nav-bg);
  color: var(--nav-text);
}
/*
 * Pinned to the screen at the largest the screen gets (lvh: a phone's address bar sliding in and out never resizes
 * it), so the city never changes size as the page loads, grows or scrolls.
 */
.gate-sky {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 100vh;
  height: 100lvh;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 0% 0%, color-mix(in oklab, var(--accent) 30%, transparent), transparent 60%),
    radial-gradient(90% 80% at 100% 100%, color-mix(in oklab, var(--info) 18%, transparent), transparent 65%),
    var(--nav-bg);
}
/* The top corners fall back into the night (under the floor, which lies at the bottom). */
.gate-sky::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 90% 70% at 50% 45%, transparent 45%, color-mix(in oklab, var(--nav-bg) 70%, transparent) 100%);
}
.gate-city {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
/* The flat city fades in over the sky; the 3D one too, once it has readied itself. Neither switches afterwards. */
.gate-city:not(.gate-city-3d) {
  animation: gate-fade 1.2s var(--motion-ease, ease) both;
}
@keyframes gate-fade {
  from {
    opacity: 0;
  }
}
.gate-city-3d {
  opacity: 0;
  transition: opacity 1.8s var(--motion-ease, ease);
}
.gate-city-3d[data-shown] {
  opacity: 1;
}
/* The words stand on a shade of the night, so the city behind them never takes them. */
.gate-stage::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(90deg, color-mix(in oklab, var(--nav-bg) 78%, transparent), color-mix(in oklab, var(--nav-bg) 35%, transparent) 38%, transparent 58%);
}
@keyframes gate-glint {
  0% {
    background-position: 120% 0, 0 0;
  }
  22%,
  100% {
    background-position: -20% 0, 0 0;
  }
}

.gate-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 420px);
  align-items: center;
  gap: clamp(32px, 7vw, 112px);
  width: min(1100px, 100%);
}
.gate-intro {
  filter: drop-shadow(0 4px 22px color-mix(in oklab, var(--nav-bg) 90%, transparent));
}
/* The logo on a tile of the page's panel colour, so any logo reads on the night. */
.gate-mark {
  display: inline-grid;
  place-items: center;
  padding: var(--space-3);
  border-radius: calc(var(--radius-lg) + 4px);
  background: var(--surface-panel);
  box-shadow:
    0 0 0 1px color-mix(in oklab, var(--nav-text) 16%, transparent),
    0 18px 48px -12px color-mix(in oklab, var(--accent) 60%, transparent);
}
.gate-mark .logo {
  border-radius: var(--radius-md);
}
.gate-name {
  margin: var(--space-5) 0 var(--space-3);
  font-family: var(--font-heading, inherit);
  font-size: clamp(30px, 4.4vw, 52px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  font-weight: var(--weight-heading, var(--weight-strong));
  color: var(--nav-text);
  background: linear-gradient(
      100deg,
      transparent 42%,
      color-mix(in oklab, var(--nav-text) 60%, var(--accent)) 49%,
      var(--nav-text) 50%,
      color-mix(in oklab, var(--nav-text) 60%, var(--accent)) 51%,
      transparent 58%
    )
    no-repeat,
    linear-gradient(100deg, var(--nav-text) 30%, color-mix(in oklab, var(--nav-text) 55%, var(--accent)));
  background-size: 300% 100%, 100% 100%;
  background-position: 120% 0, 0 0;
  animation: gate-glint 7s var(--motion-ease, ease) 1.2s infinite;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  overflow-wrap: anywhere;
}
.gate-lead {
  max-width: 34ch;
  margin: 0;
  font-size: clamp(15px, 1.5vw, 18px);
  line-height: 1.5;
  color: var(--nav-muted);
}

/* The panel: a notice or two, then the form's card in glass. A soft light of the accent sits behind it. */
.gate-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.gate-panel::before {
  content: "";
  position: absolute;
  inset: 10% 5%;
  z-index: -1;
  border-radius: 50%;
  background: color-mix(in oklab, var(--accent) 45%, transparent);
  filter: blur(70px);
  opacity: 0.55;
}
.gate-panel > .sh-card {
  position: relative;
  overflow: hidden;
  border: 1px solid color-mix(in oklab, var(--nav-text) 18%, transparent);
  border-radius: calc(var(--radius-lg) + 6px);
  background: color-mix(in oklab, var(--surface-panel) 96%, transparent);
  box-shadow: 0 40px 90px -30px color-mix(in oklab, var(--nav-bg) 90%, transparent);
  color: var(--text-main);
}
/* A line of light along its top, the accent fading into the in-progress blue. */
.gate-panel > .sh-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), color-mix(in oklab, var(--info) 70%, var(--accent)), transparent);
}
.gate-panel > .sh-card > .sh-card-head {
  display: block;
  padding: var(--space-6) var(--space-6) 0;
  border-bottom: 0;
}
.gate-panel > .sh-card > .sh-card-head h2 {
  font-size: var(--type-2xl);
}
.gate-panel > .sh-card > .sh-card-body {
  padding: var(--space-5) var(--space-6) var(--space-6);
}
.gate-form-lede {
  margin: var(--space-2) 0 0;
  color: var(--text-secondary);
}

/* A field with an icon at its start, and the password's show button at its end. */
.gate-input {
  position: relative;
  display: block;
}
.gate-input > .sh-input {
  width: 100%;
  min-height: 44px;
  padding-left: 40px;
}
.gate-input > .gate-input-with-end {
  padding-right: 44px;
}
.gate-input-icon {
  position: absolute;
  top: 50%;
  left: 13px;
  display: grid;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}
.gate-input-icon svg,
.gate-input-end svg,
.gate-submit-go svg {
  width: 16px;
  height: 16px;
}
.gate-input:focus-within .gate-input-icon {
  color: var(--accent);
}
.gate-input-end {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
}
.gate-submit {
  width: 100%;
  min-height: 46px;
  justify-content: center;
  gap: var(--space-3);
  font-size: var(--type-lg);
}
.gate-submit-go {
  display: grid;
  transition: transform var(--motion-base, 160ms) var(--motion-ease, ease);
}
.gate-submit:hover .gate-submit-go {
  transform: translateX(3px);
}
.gate-form-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: var(--type-sm);
}

.gate-foot {
  margin: 0;
  max-width: 100%;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-pill);
  background: color-mix(in oklab, var(--nav-bg) 72%, transparent);
  font-size: var(--type-sm);
  color: var(--nav-muted);
  text-align: center;
}
.gate-foot svg {
  width: 14px;
  height: 14px;
  margin-right: var(--space-2);
  vertical-align: -2px;
}
/* The Demo strip (demo mode only) keeps the page's text colour on the night. */
.gate-stage > .demo-strip {
  color: var(--text-main);
}

/* Phone and narrow windows: one column, the company over the form, centred. */
@media (max-width: 860px) {
  /* One column: the shade sits behind the company's name, at the top. */
  .gate-stage::before {
    background: radial-gradient(ellipse 90% 34% at 50% 24%, color-mix(in oklab, var(--nav-bg) 62%, transparent), transparent);
  }
  .gate-split {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    gap: var(--space-6);
  }
  .gate-intro {
    text-align: center;
  }
  .gate-lead {
    margin-inline: auto;
  }
  .gate-panel {
    width: min(440px, 100%);
  }
}
@media (max-width: 520px) {
  .gate-foot-more {
    display: none;
  }
  .gate-stage {
    padding-top: var(--space-6);
  }
  .gate-mark .logo {
    width: 40px !important;
    height: 40px !important;
  }
  .gate-name {
    margin-top: var(--space-4);
  }
  .gate-panel > .sh-card > .sh-card-head {
    padding: var(--space-5) var(--space-5) 0;
  }
  .gate-panel > .sh-card > .sh-card-body {
    padding: var(--space-4) var(--space-5) var(--space-5);
  }
}
@media (prefers-reduced-motion: reduce) {
  .gate-name,
  .gate-city,
  .gate-panel,
  .gate-submit-go {
    animation: none;
    transition: none;
  }
}

/* A page that could not be shown: what happened and Try again. */
.oops-card {
  width: min(480px, 100%);
}
.gate > .oops-card:first-child {
  margin-top: var(--space-6);
}
.oops-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
/* Its title is a card's title (4f looks: --type-card-title); a page title's size before. */
.oops-head h1 {
  font-size: var(--type-card-title, var(--type-h1, var(--type-xl)));
}
/* Its icon, on a tile three quarters of a tool's (4f looks); 36px before. */
.oops-icon {
  --sh-oops-tile: calc(var(--tile-size) * 0.75);
  display: grid;
  place-items: center;
  width: var(--sh-oops-tile, 36px);
  height: var(--sh-oops-tile, 36px);
  flex: none;
  border-radius: var(--radius-tile, var(--radius-md));
  background: var(--surface-subtle);
  color: var(--text-secondary);
}
.oops-icon svg {
  --sh-oops-glyph: calc(var(--tile-size) * 0.42);
  width: var(--sh-oops-glyph, 20px);
  height: var(--sh-oops-glyph, 20px);
}
