/* Front door: one screen, never scrolls.
   The dark side is the wire, the white slab is the workspace, and the edge
   between them is bytes packing into a sealed block. */

.lp {
  --lp-night: #070b14;
  --lp-cell: 20px;
  --lp-glyph: rgba(150, 172, 226, 0.4);
  --lp-input: 44px;
  --lp-label: 16px;
  --lp-field-gap: 4px;
  --lp-gap: 10px;
  --lp-msg: 34px;
  --lp-go: 46px;
  --lp-note: 0px;

  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--lp-night);
  color: #fff;
}

/* Hero */
.lp-hero {
  position: relative;
  isolation: isolate;
  display: flex;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  padding: 16px 20px calc(var(--lp-cell) * 3);
  background:
    radial-gradient(120% 70% at 50% 108%, rgba(47, 107, 255, 0.34), transparent 62%),
    radial-gradient(70% 50% at 0% 0%, rgba(47, 107, 255, 0.1), transparent 70%),
    var(--lp-night);
}

.lp-field {
  position: absolute;
  inset: 0;
  z-index: -1;
  display: flex;
  overflow: hidden;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-position: left bottom;
  background-size: var(--lp-cell) var(--lp-cell);
  -webkit-mask-image: linear-gradient(to top, #000 0, #000 calc(var(--lp-cell) * 2.5), rgba(0, 0, 0, 0.2) calc(var(--lp-cell) * 4), transparent 96%);
  mask-image: linear-gradient(to top, #000 0, #000 calc(var(--lp-cell) * 2.5), rgba(0, 0, 0, 0.2) calc(var(--lp-cell) * 4), transparent 96%);
  pointer-events: none;
  user-select: none;
}

.lp-lane {
  display: flex;
  width: var(--lp-cell);
  flex: none;
  flex-direction: column-reverse;
}

.lp-c {
  display: grid;
  width: var(--lp-cell);
  height: var(--lp-cell);
  flex: none;
  place-items: center;
  color: var(--lp-glyph);
  font-family: var(--font-mono);
  font-size: calc(var(--lp-cell) * 0.36);
  font-style: normal;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0;
}

.lp-c-b {
  color: rgba(196, 211, 247, 0.62);
}

.lp-c-o {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
  color: rgba(214, 225, 252, 0.78);
}

.lp-c-s {
  background: #fff;
}

.lp-c-a {
  background: var(--brand);
}

.lp-c-t {
  color: rgba(170, 196, 255, 0.95);
}

.lp-c-h {
  color: #fff;
  text-shadow: 0 0 10px rgba(110, 156, 255, 0.95);
}

.lp-c-s.lp-c-f {
  animation: lp-seal 760ms var(--ease-out) both;
}

.lp-c-a.lp-c-f {
  animation: lp-seal-accent 760ms var(--ease-out) both;
}

@keyframes lp-seal {
  0% {
    background: #7ea5ff;
  }
  100% {
    background: #fff;
  }
}

@keyframes lp-seal-accent {
  0% {
    background: #cfdcff;
  }
  100% {
    background: var(--brand);
  }
}

.lp-probe {
  position: absolute;
  width: var(--lp-cell);
  height: 2px;
  visibility: hidden;
  pointer-events: none;
}

.lp-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lp-mark {
  display: inline-grid;
  width: 30px;
  height: 30px;
  flex: none;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.lp-word {
  font-size: 15px;
  font-weight: 620;
  letter-spacing: -0.012em;
}

.lp-pitch {
  margin: auto 0;
  padding: 10px 0 6px;
}

.lp-hex {
  display: none;
  overflow: hidden;
  margin-bottom: 14px;
  color: #86a6ff;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  line-height: 1.4;
  white-space: nowrap;
  -webkit-mask-image: linear-gradient(to right, #000 70%, transparent);
  mask-image: linear-gradient(to right, #000 70%, transparent);
}

.lp-title {
  max-width: 8.4em;
  font-size: clamp(32px, 9.4vw, 70px);
  font-weight: 720;
  letter-spacing: -0.052em;
  line-height: 0.94;
}

.lp-dot {
  color: #5b8bff;
}

.lp-sub {
  max-width: 33em;
  margin-top: 10px;
  color: rgba(226, 233, 248, 0.78);
  font-size: 13px;
  line-height: 1.4;
}

.lp-facts {
  display: none;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Slab */
.lp-slab {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 20px max(12px, env(safe-area-inset-bottom));
  background: #fff;
  color: var(--ink);
}

.lp-auth {
  width: 100%;
  min-width: 0;
  max-width: 400px;
  margin: 0 auto;
  align-self: center;
  visibility: hidden;
  opacity: 0;
}

.lp-ready {
  visibility: visible;
  opacity: 1;
  transition: opacity 260ms var(--ease-out);
}

.lp-tabs {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-tint);
}

.lp-closed .lp-tabs {
  display: none;
}

.lp-thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc(50% - 3px);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-slow) var(--ease-out);
}

.lp-tabs[data-mode="create"] .lp-thumb {
  transform: translateX(100%);
}

.lp-tab {
  position: relative;
  z-index: 1;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 560;
  transition: color var(--dur-fast) var(--ease-out);
}

.lp-tab[aria-selected="true"] {
  color: var(--ink);
}

.lp-head {
  margin-top: 12px;
}

.lp-closed .lp-head {
  margin-top: 0;
}

.lp-head h2 {
  display: none;
  font-size: 22px;
  letter-spacing: -0.024em;
  line-height: 1.2;
}

.lp-head p {
  overflow: hidden;
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Tall enough for the three-field step, so the slab and the hero never move
   when the mode changes. */
.lp-flow {
  display: flex;
  min-height: calc(
    3 * (var(--lp-input) + var(--lp-label) + var(--lp-field-gap)) + 3 * var(--lp-gap) + var(--lp-msg) +
      var(--lp-go) + var(--lp-note)
  );
  flex-direction: column;
}

.lp-closed .lp-flow {
  min-height: 0;
}

.lp-form {
  display: flex;
  flex-direction: column;
  gap: var(--lp-gap);
  margin-top: var(--lp-gap);
}

.lp-form .field {
  gap: var(--lp-field-gap);
}

.lp-form .label {
  line-height: var(--lp-label);
}

.lp-form .input {
  height: var(--lp-input);
  font-size: 16px;
}

.lp-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  height: var(--lp-label);
}

.lp-rule {
  color: var(--muted-light);
  font-size: var(--text-xs);
  line-height: var(--lp-label);
  transition: color var(--dur) var(--ease-out);
}

.lp-rule-ok {
  color: var(--green);
}

.lp-pass {
  position: relative;
}

.lp-pass .input {
  padding-right: 62px;
}

.lp-reveal {
  position: absolute;
  top: calc((var(--lp-input) - 32px) / 2);
  right: 6px;
  height: 32px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 560;
}

.lp-form .lp-code {
  height: 60px;
  padding-left: 0.5em;
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 560;
  letter-spacing: 0.5em;
  text-align: center;
}

.lp-code::placeholder {
  color: var(--line-strong);
}

.lp-code-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.lp-link {
  min-height: 28px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--brand-ink);
  font-size: var(--text-xs);
  font-weight: 560;
}

.lp-link:disabled {
  color: var(--muted-light);
}

.lp-msg {
  display: flex;
  min-height: var(--lp-msg);
  align-items: center;
  padding: 4px 0;
  color: var(--red-ink);
  font-size: var(--text-xs);
  line-height: 15px;
}

.lp-msg-note {
  color: var(--muted);
}

.lp-go {
  height: var(--lp-go);
  flex: none;
  font-size: var(--text-md);
}

.lp-note {
  margin-top: auto;
  padding-top: 12px;
  color: var(--muted-light);
  font-size: var(--text-xs);
  line-height: 20px;
}

.lp-flow[data-step="details"] .lp-note {
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  .lp-tab:hover,
  .lp-reveal:hover {
    color: var(--ink);
  }

  .lp-reveal:hover {
    background: var(--surface-tint);
  }

  .lp-link:hover:not(:disabled) {
    text-decoration: underline;
  }

  .lp-form .input {
    font-size: 15px;
  }
}

/* Stacked, with room to breathe */
@media (max-height: 599px) {
  .lp-sub {
    display: none;
  }
}

@media (max-height: 699px) {
  .lp-field {
    -webkit-mask-image: linear-gradient(to top, #000 0, #000 calc(var(--lp-cell) * 2), rgba(0, 0, 0, 0.12) calc(var(--lp-cell) * 3), transparent 90%);
    mask-image: linear-gradient(to top, #000 0, #000 calc(var(--lp-cell) * 2), rgba(0, 0, 0, 0.12) calc(var(--lp-cell) * 3), transparent 90%);
  }

  .lp-pitch {
    margin: 0 0 auto;
  }
}

@media (min-height: 780px) {
  .lp {
    --lp-cell: 22px;
    --lp-note: 32px;
  }

  .lp-hero {
    padding-top: 20px;
  }

  .lp-hex {
    display: block;
  }

  .lp-sub {
    margin-top: 14px;
    font-size: 15px;
    line-height: 1.5;
  }

  .lp-slab {
    padding-top: 20px;
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }

  .lp-head {
    margin-top: 18px;
  }

  .lp-head h2 {
    display: block;
    margin-bottom: 2px;
  }

  .lp-head p {
    min-height: 36px;
    white-space: normal;
  }

  .lp-flow[data-step="details"] .lp-note {
    display: block;
  }
}

@media (min-width: 600px) and (min-height: 900px) {
  .lp {
    --lp-cell: 28px;
  }

  .lp-hero {
    padding: 32px 40px calc(var(--lp-cell) * 4);
  }

  .lp-hex {
    margin-bottom: 18px;
    font-size: 12px;
  }

  .lp-sub {
    margin-top: 20px;
    font-size: 18px;
  }

  .lp-slab {
    padding: 32px 40px 36px;
  }
}

/* Side by side */
@media (min-width: 900px), (orientation: landscape) and (max-height: 560px) {
  .lp {
    --lp-cell: 26px;
    --lp-field-gap: 6px;
    --lp-gap: 12px;
    --lp-msg: 40px;
    --lp-note: 32px;

    grid-template-rows: none;
    grid-template-columns: minmax(0, 1fr) clamp(380px, 37vw, 560px);
  }

  .lp-hero {
    padding: clamp(20px, 4.4vh, 44px) calc(var(--lp-cell) * 10) clamp(20px, 4.4vh, 44px)
      clamp(24px, 4.2vw, 68px);
    background:
      radial-gradient(60% 80% at 104% 50%, rgba(47, 107, 255, 0.36), transparent 66%),
      radial-gradient(50% 50% at 0% 0%, rgba(47, 107, 255, 0.1), transparent 70%),
      var(--lp-night);
  }

  .lp-field {
    flex-direction: column;
    background-position: right top;
    -webkit-mask-image: linear-gradient(
      to left,
      #000 0,
      #000 calc(var(--lp-cell) * 7),
      rgba(0, 0, 0, 0.22) calc(var(--lp-cell) * 12),
      transparent calc(var(--lp-cell) * 24)
    );
    mask-image: linear-gradient(
      to left,
      #000 0,
      #000 calc(var(--lp-cell) * 7),
      rgba(0, 0, 0, 0.22) calc(var(--lp-cell) * 12),
      transparent calc(var(--lp-cell) * 24)
    );
  }

  .lp-lane {
    width: auto;
    height: var(--lp-cell);
    flex-direction: row-reverse;
  }

  .lp-probe {
    height: 1px;
  }

  .lp-pitch {
    padding: 16px 0;
  }

  .lp-hex {
    display: block;
    margin-bottom: clamp(12px, 2.6vh, 26px);
    font-size: 12px;
  }

  .lp-title {
    font-size: clamp(40px, min(6.1vw, 13.5vh), 124px);
  }

  .lp-sub {
    display: block;
    max-width: 29em;
    margin-top: clamp(14px, 3vh, 30px);
    text-wrap: balance;
    font-size: clamp(15px, 1.3vw, 20px);
    line-height: 1.5;
  }

  .lp-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 28px;
    max-width: 560px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
  }

  .lp-facts li {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding-top: 12px;
    color: rgba(226, 233, 248, 0.74);
    font-size: var(--text-xs);
    line-height: 1.4;
  }

  .lp-fact-no {
    flex: none;
    color: #86a6ff;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.08em;
  }

  .lp-slab {
    padding: 32px clamp(24px, 3.4vw, 56px);
  }

  .lp-auth {
    max-width: 372px;
  }

  .lp-tab {
    height: 36px;
  }

  .lp-head {
    margin-top: 26px;
  }

  .lp-head h2 {
    display: block;
    margin-bottom: 4px;
    font-size: 24px;
  }

  .lp-head p {
    min-height: 36px;
    white-space: normal;
  }

  .lp-flow[data-step="details"] .lp-note {
    display: block;
  }
}

@media (min-width: 1500px) and (min-height: 860px) {
  .lp {
    --lp-cell: 32px;
  }

  .lp-facts {
    max-width: 640px;
  }
}

/* Short and wide: a phone on its side */
@media (max-height: 560px) {
  .lp {
    --lp-input: 40px;
    --lp-field-gap: 2px;
    --lp-gap: 8px;
    --lp-msg: 26px;
    --lp-go: 42px;
    --lp-cell: 20px;
  }

  .lp-facts,
  .lp-hex,
  .lp-head,
  .lp-note,
  .lp-flow[data-step="details"] .lp-note {
    display: none;
  }

  .lp-hero {
    padding-right: calc(var(--lp-cell) * 7);
  }

  .lp-slab {
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .lp-sub {
    font-size: 14px;
  }
}

@media (min-width: 900px) and (max-height: 640px) {
  .lp-facts {
    display: none;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .lp-field {
    animation: lp-fade 1100ms var(--ease-out) both;
  }

  .lp-pitch > * {
    animation: lp-rise 720ms var(--ease-out) both;
  }

  .lp-pitch > :nth-child(2) {
    animation-delay: 70ms;
  }

  .lp-pitch > :nth-child(3) {
    animation-delay: 140ms;
  }
}

@keyframes lp-fade {
  from {
    opacity: 0;
  }
}

@keyframes lp-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .lp-thumb,
  .lp-rule,
  .lp-tab,
  .lp-ready {
    transition: none;
  }

  .lp-c-f {
    animation: none;
  }
}
