/* Welcome and loading flow */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-footer {
  position: relative;
  z-index: 3;
  margin: 34px 0 8px;
  text-align: center;
}

.site-footer a {
  color: #9aa7ba;
  font-size: 11px;
  line-height: 1.5;
  text-decoration: none;
  transition: color 0.2s ease;
}

.site-footer a:hover {
  color: var(--blue);
}

.site-footer-welcome {
  position: absolute;
  right: 20px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  left: 20px;
  z-index: 8;
  margin: 0;
}

.site-footer-welcome a {
  color: #a4afbf;
}

.dark-theme .site-footer a {
  color: #758198;
}

.app-shell.immersive-shell {
  width: 100%;
  max-width: none;
  min-height: 100svh;
  padding: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 17% 8%, rgba(99, 157, 255, 0.2), transparent 27%),
    radial-gradient(circle at 88% 75%, rgba(130, 183, 255, 0.16), transparent 28%),
    linear-gradient(145deg, #fafdff 0%, #f3f7ff 47%, #edf4ff 100%);
  box-shadow: none;
}

.dark-theme .app-shell.immersive-shell {
  background:
    radial-gradient(circle at 17% 8%, rgba(99, 157, 255, 0.2), transparent 27%),
    radial-gradient(circle at 88% 75%, rgba(130, 183, 255, 0.16), transparent 28%),
    linear-gradient(145deg, #fafdff 0%, #f3f7ff 47%, #edf4ff 100%);
}

.welcome-page {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  color: #071a3b;
}

.welcome-page::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(86, 135, 211, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(86, 135, 211, 0.035) 1px, transparent 1px);
  background-size: 52px 52px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 34%, #000 66%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 34%, #000 66%, transparent);
}

.welcome-orb {
  position: absolute;
  border: 1px solid rgba(102, 156, 241, 0.18);
  border-radius: 42%;
  pointer-events: none;
  transform: rotate(28deg);
}

.welcome-orb-two {
  bottom: -130px;
  left: -96px;
  width: 230px;
  height: 230px;
  background: rgba(208, 227, 255, 0.2);
}

.welcome-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-areas:
    'visual'
    'content';
  width: min(100%, 1180px);
  min-height: 100svh;
  margin: 0 auto;
  align-content: center;
}

.welcome-visual {
  position: relative;
  grid-area: visual;
  width: min(100%, 480px);
  height: clamp(290px, 38svh, 350px);
  margin: 0 auto;
}

.welcome-avatar {
  position: absolute;
  top: -10px;
  left: 50%;
  z-index: 2;
  width: min(60vw, 258px);
  height: calc(100% - 12px);
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 23px 26px rgba(31, 77, 153, 0.16));
  transform: translateX(-50%);
  animation: welcome-avatar-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.welcome-dot-grid {
  position: absolute;
  top: 76px;
  left: 16px;
  width: 100px;
  height: 84px;
  opacity: 0.5;
  background-image: radial-gradient(circle, #aacbff 2px, transparent 2.5px);
  background-size: 18px 18px;
}

.welcome-spark {
  position: absolute;
  z-index: 4;
  color: #77a9ff;
  line-height: 1;
  animation: welcome-sparkle 2.8s ease-in-out infinite;
}

.welcome-spark-one {
  top: 92px;
  right: 32px;
  font-size: 34px;
}

.welcome-spark-two {
  right: 62px;
  bottom: 28px;
  font-size: 18px;
  animation-delay: 0.8s;
}

.welcome-content {
  position: relative;
  z-index: 5;
  grid-area: content;
  align-self: start;
  width: min(100%, 580px);
  margin: -34px auto 0;
  padding: 0 24px calc(34px + env(safe-area-inset-bottom));
  text-align: center;
  animation: welcome-content-in 0.62s ease 0.12s both;
}

.welcome-heading {
  position: relative;
}

.welcome-heading p {
  position: absolute;
  top: -32px;
  left: 50%;
  margin: 0;
  color: rgba(88, 137, 215, 0.12);
  font-family:
    Baskerville,
    'Iowan Old Style',
    'Palatino Linotype',
    'Times New Roman',
    serif;
  font-size: clamp(62px, 18vw, 86px);
  font-weight: 500;
  font-style: italic;
  line-height: 1;
  letter-spacing: -0.04em;
  transform: translateX(-50%);
}

.welcome-heading h1 {
  position: relative;
  z-index: 1;
  margin: 0;
  color: #102c56;
  font-family:
    'SignPainter Web',
    SignPainter,
    'SignPainter-HouseScript',
    'SignPainter-HouseScript Semibold',
    'Apple Chancery',
    cursive;
  font-size: clamp(34px, 9vw, 46px);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0;
}

.welcome-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 7px;
  margin: 20px 0 23px;
}

.welcome-divider span {
  width: 42px;
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, #347ef1, #80aeff);
}

.welcome-divider i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #96bcff;
}

.welcome-intro {
  margin: 0;
  color: #8997ad;
  font-size: 14px;
  line-height: 1.85;
}

.invite-form {
  width: min(100%, 520px);
  margin: 26px auto 0;
}

.invite-field {
  display: grid;
  grid-template-columns: 30px 1fr 40px;
  gap: 12px;
  align-items: center;
  height: 64px;
  padding: 0 12px 0 20px;
  border: 1px solid #d6e0ef;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 12px 28px rgba(48, 99, 180, 0.06);
  backdrop-filter: blur(14px);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.invite-field:focus-within {
  border-color: #5b99fa;
  box-shadow:
    0 0 0 4px rgba(52, 126, 241, 0.1),
    0 16px 34px rgba(48, 99, 180, 0.1);
  transform: translateY(-1px);
}

.invite-field.invalid {
  border-color: #e98989;
  box-shadow: 0 0 0 4px rgba(221, 82, 82, 0.08);
}

.access-lock-icon {
  display: block;
  width: 26px;
  height: 26px;
  object-fit: contain;
  opacity: 0.92;
}

.invite-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: #18345d;
  font: inherit;
  font-size: 16px;
  font-weight: 650;
  background: transparent;
}

.invite-field input::placeholder {
  color: #a5b1c5;
  font-weight: 500;
}

.invite-visibility {
  display: grid;
  width: 40px;
  height: 40px;
  padding: 0;
  place-items: center;
  border-radius: 12px;
  color: #7b8fac;
  cursor: pointer;
  transition:
    color 0.2s ease,
    background 0.2s ease,
    transform 0.2s ease;
}

.invite-visibility .base-icon {
  width: 20px;
  height: 20px;
}

.invite-visibility:active {
  transform: scale(0.9);
}

.invite-visibility:focus-visible {
  outline: 3px solid rgba(52, 126, 241, 0.18);
  outline-offset: 1px;
}

.dark-theme .invite-visibility {
  color: #a9bad1;
}

.invite-error {
  margin: 8px 4px 0;
  color: #d84d4d;
  font-size: 12px;
  text-align: left;
}

.enter-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  height: 66px;
  margin-top: 14px;
  border-radius: 20px;
  color: #ffffff;
  font-size: 19px;
  font-weight: 850;
  background:
    linear-gradient(105deg, #5b94f6 0%, #347ef1 54%, #1465e9 100%);
  box-shadow:
    0 18px 36px rgba(28, 104, 229, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.26);
  cursor: pointer;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    filter 0.2s ease;
}

.enter-button:active {
  transform: translateY(2px) scale(0.99);
  box-shadow: 0 10px 22px rgba(28, 104, 229, 0.22);
}

.enter-arrow {
  font-size: 27px;
  font-weight: 400;
  line-height: 1;
  transition: transform 0.2s ease;
}

.enter-button:hover .enter-arrow {
  transform: translateX(5px);
}

.welcome-project-link {
  display: inline-block;
  margin: 30px 0 0;
  color: #5879a8;
  font-size: 14px;
  font-weight: 400;
  text-decoration: none;
  transition:
    color 0.2s ease,
    transform 0.2s ease;
}

.welcome-project-link:hover {
  color: #347ef1;
  transform: translateY(-1px);
}

.loading-page {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  align-content: center;
  padding: 24px;
  color: #071a3b;
  text-align: center;
  background:
    radial-gradient(circle at 28% 18%, rgba(15, 107, 255, 0.16), transparent 30%),
    radial-gradient(circle at 78% 72%, rgba(15, 107, 255, 0.1), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%);
}

.loading-avatar {
  position: relative;
  isolation: isolate;
  width: 210px;
  height: 210px;
  animation: loading-avatar-in 0.58s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.loading-avatar::before {
  content: '';
  position: absolute;
  inset: -24px -42px -18px;
  z-index: -1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 68% 28%, rgba(255, 218, 88, 0.28), transparent 24%),
    radial-gradient(ellipse at center, rgba(57, 132, 255, 0.24), transparent 66%);
  filter: blur(12px);
}

.loading-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 22px 24px rgba(25, 70, 145, 0.18));
}

.loading-page h1 {
  margin: 34px 0 9px;
  font-size: 27px;
  letter-spacing: -0.5px;
  animation: welcome-content-in 0.5s ease 0.08s both;
}

.loading-page > p {
  margin: 0;
  color: #7a8499;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 2px;
  animation: welcome-content-in 0.5s ease 0.14s both;
}

.loading-progress {
  width: min(220px, 62vw);
  height: 9px;
  margin-top: 36px;
  padding: 2px;
  border: 1px solid rgba(15, 107, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: 0 10px 28px rgba(15, 107, 255, 0.12);
}

.loading-progress span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1557bb 0%, #0f6bff 62%, #69adff 100%);
  box-shadow: 0 0 18px rgba(15, 107, 255, 0.42);
  transform-origin: left;
  animation: loading-progress-fill 1.15s ease both;
}

@keyframes welcome-avatar-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(18px) scale(0.94);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

@keyframes welcome-content-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes loading-avatar-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.94);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes welcome-sparkle {
  0%,
  100% {
    opacity: 0.45;
    transform: scale(0.86) rotate(0);
  }

  50% {
    opacity: 1;
    transform: scale(1.12) rotate(10deg);
  }
}

@keyframes loading-progress-fill {
  from {
    transform: scaleX(0);
  }

  to {
    transform: scaleX(1);
  }
}

@media (min-width: 960px) {
  .welcome-layout {
    grid-template-areas: 'content visual';
    grid-template-columns: minmax(380px, 0.94fr) minmax(360px, 1.06fr);
    gap: clamp(18px, 3vw, 44px);
    align-items: center;
    padding: 48px clamp(34px, 6vw, 76px);
  }

  .welcome-visual {
    width: 100%;
    height: min(72svh, 700px);
    min-height: 540px;
  }

  .welcome-avatar {
    top: calc(40% - 52px);
    left: 46%;
    width: min(30vw, 350px);
    height: min(55svh, 500px);
    transform: translate(-50%, -50%);
    animation-name: welcome-avatar-in-desktop;
  }

  .welcome-dot-grid {
    top: 12%;
    left: -2%;
    width: 136px;
    height: 118px;
  }

  .welcome-spark-one {
    top: 20%;
    right: 2%;
    font-size: 44px;
  }

  .welcome-spark-two {
    right: 10%;
    bottom: 17%;
    font-size: 24px;
  }

  .welcome-content {
    align-self: center;
    width: 100%;
    margin: 0;
    padding: 0;
    text-align: left;
  }

  .welcome-heading p {
    top: -50px;
    left: -8px;
    font-size: clamp(74px, 8vw, 108px);
    transform: none;
  }

  .welcome-heading h1 {
    font-size: clamp(46px, 5vw, 62px);
    letter-spacing: 0.02em;
  }

  .welcome-divider {
    justify-content: flex-start;
    margin: 26px 0 28px;
  }

  .welcome-intro {
    max-width: 520px;
    font-size: 15px;
  }

  .invite-form {
    margin: 32px 0 0;
  }

  .invite-field,
  .enter-button {
    height: 68px;
    border-radius: 22px;
  }

  .welcome-project-link {
    display: block;
    width: min(100%, 520px);
    margin-top: 32px;
    font-size: 15px;
    text-align: center;
  }
}

@keyframes welcome-avatar-in-desktop {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 18px)) scale(0.94);
  }

  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@media (max-width: 380px) {
  .welcome-visual {
    height: clamp(250px, 34svh, 276px);
  }

  .welcome-avatar {
    top: -12px;
  }

  .welcome-content {
    margin-top: -28px;
    padding-right: 18px;
    padding-left: 18px;
  }

  .welcome-divider {
    margin: 15px 0 17px;
  }

  .invite-form {
    margin-top: 20px;
  }

  .invite-field,
  .enter-button {
    height: 58px;
    border-radius: 18px;
  }

  .welcome-project-link {
    margin-top: 25px;
  }
}

@media (hover: hover) and (pointer: fine) {
  .enter-button:hover {
    filter: saturate(1.08) brightness(1.03);
    box-shadow:
      0 22px 44px rgba(28, 104, 229, 0.3),
      inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
  }
}

