/* Welcome — ethereal/divine: void, bone, one warm gold accent */

#gate {
  --welcome-void: #05060a;
  --welcome-bone: #f4f1ea;
  --welcome-gold: #ffb24d;
  --welcome-ember: #ff7a18;
  --welcome-mute: #9a9286;
  --welcome-iris: #8a6bff;
  --welcome-shell: min(100%, 380px);

  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(20px + env(safe-area-inset-top))
    calc(20px + env(safe-area-inset-right))
    calc(20px + env(safe-area-inset-bottom))
    calc(20px + env(safe-area-inset-left));
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--welcome-void);
  color: var(--welcome-bone);
}

#gate.is-gone {
  display: none;
}

.welcome-atmosphere {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  overflow: hidden;
  pointer-events: none;
}

.welcome-canvas {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.welcome-vignette {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background:
    radial-gradient(ellipse 72% 58% at 50% 42%, transparent 34%, rgba(5, 6, 10, 0.82) 100%),
    radial-gradient(circle at 50% 36%, rgba(255, 178, 77, 0.16), transparent 52%);
}

.welcome-grain {
  position: absolute;
  top: -50%;
  right: -50%;
  bottom: -50%;
  left: -50%;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain-shift 8s steps(6) infinite;
}

@keyframes grain-shift {
  0% { transform: translate(0, 0); }
  100% { transform: translate(-3%, -2%); }
}

.welcome-shell {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  width: var(--welcome-shell);
  margin: auto;
  transform: translateY(-2vh);
}

.welcome-card {
  position: relative;
  width: 100%;
  margin: 0;
  padding: 30px 26px 24px;
  border-radius: 2px;
  background: var(--welcome-bone);
  color: #1a1208;
  box-shadow:
    0 28px 60px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.65);
  text-align: center;
  animation: card-rise 1s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.welcome-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 26px;
  right: 26px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--welcome-gold), transparent);
}

@keyframes card-rise {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.welcome-tag {
  margin: 0 0 16px;
  color: var(--welcome-mute);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.welcome-card h1 {
  position: relative;
  margin: 0 auto 12px;
  max-width: 16ch;
  color: #1a1208;
  font-family: Fraunces, "Times New Roman", serif;
  font-size: clamp(34px, 9vw, 46px);
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.03em;
  line-height: 1.08;
  text-wrap: balance;
}

.welcome-card h1::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 55%;
  width: 72%;
  height: 42%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255, 178, 77, 0.28), transparent 68%);
  z-index: -1;
  animation: halo-breathe 5s ease-in-out infinite;
}

@keyframes halo-breathe {
  0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(0.94); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.04); }
}

.welcome-lead {
  margin: 0 auto 10px;
  max-width: 24ch;
  font-family: Fraunces, "Times New Roman", serif;
  font-size: clamp(17px, 4.2vw, 19px);
  font-weight: 500;
  font-style: italic;
  line-height: 1.35;
  text-wrap: pretty;
}

.welcome-sub {
  margin: 0 auto 26px;
  max-width: 30ch;
  color: #5c5348;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.55;
  letter-spacing: 0.02em;
  text-wrap: pretty;
}

.welcome-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

#start-button {
  display: block;
  width: 100%;
  min-height: 52px;
  margin: 0;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--welcome-gold);
  color: #1a1208;
  font-family: Fraunces, "Times New Roman", serif;
  font-size: 17px;
  font-weight: 500;
  font-style: italic;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(255, 122, 24, 0.28);
  transition: transform 160ms ease-out, box-shadow 160ms ease-out;
}

#start-button:hover {
  box-shadow: 0 14px 32px rgba(255, 122, 24, 0.36);
}

#start-button:active {
  transform: scale(0.97);
}

#start-button:disabled {
  opacity: 0.7;
}

#start-button:focus-visible,
#birthday-button:focus-visible,
#birthday-close:focus-visible {
  outline: 2px solid var(--welcome-iris);
  outline-offset: 3px;
}

#birthday-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  margin: 0;
  padding: 12px 16px;
  border: 1px solid rgba(26, 18, 8, 0.12);
  border-radius: 2px;
  appearance: none;
  background: rgba(5, 6, 10, 0.04);
  color: #1a1208;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  text-align: left;
  cursor: pointer;
  transition: background-color 160ms ease-out, transform 160ms ease-out;
}

#birthday-button:active {
  transform: scale(0.98);
}

.gift-label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.gift-status {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(5, 6, 10, 0.08);
  color: #5c5348;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}

.welcome-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 22px 0 0;
  padding: 14px 0 0;
  border-top: 1px solid rgba(26, 18, 8, 0.1);
  list-style: none;
  color: var(--welcome-mute);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.welcome-steps li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  line-height: 1.35;
}

.welcome-steps li span {
  color: var(--welcome-gold);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
}

#gate #error {
  width: 100%;
  margin: 12px 0 0;
  padding: 10px 14px;
  border-radius: 2px;
  background: rgba(255, 180, 162, 0.2);
  color: #6b2a2a;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
  text-wrap: pretty;
}

#gate #error.is-status {
  background: rgba(255, 178, 77, 0.14);
  color: #5c5348;
}

#birthday-note {
  width: min(calc(100vw - 32px), 360px);
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--welcome-bone);
}

#birthday-note::backdrop {
  background: rgba(5, 6, 10, 0.78);
  backdrop-filter: blur(6px);
}

.birthday-sheet {
  padding: 28px 22px 22px;
  border-radius: 2px;
  background: var(--welcome-bone);
  color: #1a1208;
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.55);
  text-align: center;
}

.birthday-sheet::before {
  content: "";
  display: block;
  width: 40px;
  height: 2px;
  margin: 0 auto 18px;
  background: var(--welcome-gold);
}

.note-kicker {
  margin: 0 0 8px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--welcome-mute);
}

#birthday-note h2 {
  margin: 0 0 10px;
  font-family: Fraunces, "Times New Roman", serif;
  font-size: 26px;
  font-weight: 500;
  font-style: italic;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.note-copy {
  margin: 0 0 22px;
  color: #5c5348;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 13px;
  line-height: 1.55;
  text-wrap: pretty;
}

#birthday-close {
  min-height: 48px;
  width: 100%;
  border: 0;
  border-radius: 999px;
  background: var(--welcome-gold);
  color: #1a1208;
  font-family: Fraunces, "Times New Roman", serif;
  font-size: 16px;
  font-weight: 500;
  font-style: italic;
  cursor: pointer;
}

#birthday-close:active {
  transform: scale(0.97);
}

@media (prefers-reduced-motion: reduce) {
  .welcome-grain,
  .welcome-card,
  .welcome-card h1::after {
    animation: none;
  }

  .welcome-card,
  .welcome-shell {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 360px) {
  .welcome-steps {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .welcome-steps li {
    flex-direction: row;
    justify-content: center;
  }
}

@media (min-width: 768px) {
  #gate {
    --welcome-shell: 400px;
  }

  .welcome-card {
    padding: 34px 30px 28px;
  }
}
