/* Visitor gate: link check, passcode, denial and closed states. */

.viewer-shell {
  position: relative;
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
  background: transparent;
}

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

.gate-shell {
  align-items: stretch;
  padding: 20px 22px calc(16px + env(safe-area-inset-bottom));
}

.gate-shell > .viewer-brand {
  flex: none;
  align-self: flex-start;
}

.gate-brand .brand-mark,
.visitor-topbar .brand-mark {
  background: var(--brand);
  box-shadow: none;
}

.gate-wrap {
  display: flex;
  width: 100%;
  flex: 1;
  align-items: center;
  justify-content: center;
  padding: 18px 0 8px;
}

.gate-card {
  width: 100%;
  max-width: 468px;
  padding: 30px 30px 26px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 18px 44px rgba(16, 24, 40, 0.08);
}

.gate-card-form {
  overflow-wrap: anywhere;
}

.gate-head {
  display: flex;
  flex-direction: column;
}

.gate-eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.gate-title {
  margin-top: 5px;
  font-size: 27px;
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -0.025em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.gate-sub {
  display: -webkit-box;
  margin-top: 8px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.gate-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.gate-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}

.gate-chip svg {
  color: var(--muted-light);
}

.gate-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 18px;
}

.gate-prompt {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.input-lg {
  height: 46px;
  font-size: 14px;
}

.field-error {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 1px;
  color: var(--red);
  font-size: 12.5px;
  line-height: 1.45;
}

.field-error svg {
  margin-top: 1px;
  flex: none;
}

.gate-error {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 10px 12px;
  border: 1px solid var(--red-line);
  border-radius: 10px;
  background: var(--red-soft);
  color: var(--red-ink);
  font-size: 12.5px;
  line-height: 1.5;
}

.gate-error svg {
  margin-top: 1px;
  flex: none;
}

.denial-panel {
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface-soft);
  animation: gate-rise 190ms var(--ease-out) both;
}

.denial-head {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}

.denial-head svg {
  color: var(--muted);
  flex: none;
}

.denial-email {
  margin-top: 5px;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.denial-copy {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.denial-action {
  margin-top: 11px;
  min-height: 40px;
}

.denial-confirm {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 11px;
  color: var(--green);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.45;
}

.denial-failure {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-top: 8px;
}

.denial-failure .denial-action {
  margin-top: 4px;
}

.gate-submit {
  height: 46px;
  font-size: 14.5px;
}

.gate-submit .spinner {
  width: 15px;
  height: 15px;
}

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

.gate-foot {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted-light);
  font-size: 12px;
  line-height: 1.5;
}

.gate-foot svg {
  margin-top: 1px;
  flex: none;
}

.gate-expiry {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.gate-bottom {
  padding: 10px 0 2px;
  color: var(--muted-light);
  font-size: 12px;
  text-align: center;
}

.gate-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  animation: gate-rise 200ms var(--ease-out) both;
}

.gate-state h1 {
  font-size: 22px;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.gate-state p {
  max-width: 350px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.55;
}

.gate-state-icon {
  display: flex;
  width: 46px;
  height: 46px;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
  border-radius: 13px;
  background: var(--brand-soft);
  color: var(--brand);
}

.gate-state-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

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

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

@media (hover: hover) and (pointer: fine) {
  .gate-submit:hover:not(:disabled) {
    box-shadow: 0 4px 14px var(--brand-ring);
  }
}

@media (max-width: 820px) {
  .gate-shell {
    padding: 18px 16px calc(16px + env(safe-area-inset-bottom));
  }

  .gate-wrap {
    padding: 14px 0 8px;
  }

  .gate-card {
    padding: 26px 24px 22px;
    border-radius: 16px;
  }

  .gate-title {
    font-size: 24px;
  }
}

@media (max-width: 560px) {
  .gate-shell {
    padding: 16px 14px calc(14px + env(safe-area-inset-bottom));
  }

  .gate-wrap {
    align-items: flex-start;
    padding: 12px 0 8px;
  }

  .gate-card {
    padding: 22px 18px 20px;
  }

  .gate-title {
    font-size: 22px;
  }

  .gate-sub {
    font-size: 13px;
  }

  .gate-meta {
    gap: 8px 12px;
    padding-bottom: 16px;
  }

  .input-lg {
    height: 48px;
    font-size: 16px;
  }

  .gate-submit {
    height: 48px;
    font-size: 15px;
  }

  .denial-action {
    min-height: 44px;
  }

  .gate-state-actions .btn {
    min-height: 44px;
  }

  .gate-state {
    padding: 26px 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .denial-panel,
  .gate-state {
    animation: none;
  }

  .gate-submit:hover:not(:disabled) {
    box-shadow: var(--shadow-xs);
  }
}
