/* Responsibility: Safe loading, slow-network and failure states for script-rendered pages. */

.job-page [data-page-state-region] {
  --page-header-height: 78px;
  min-height: calc(100svh - var(--page-header-height));
}

.page-state {
  display: grid;
  align-content: center;
  min-height: min(620px, 72svh);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--paper);
  box-shadow: var(--shadow-soft);
  padding: clamp(28px, 7vw, 72px);
}

.page-state-kicker {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.page-state h1 {
  max-width: 760px;
  margin: 18px 0 14px;
  font-size: clamp(40px, 6vw, 72px);
  line-height: 1.06;
}

.page-state p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.75;
}

.page-state-progress {
  width: min(360px, 100%);
  height: 6px;
  margin-top: 30px;
  overflow: hidden;
  border-radius: var(--radius-card);
  background: var(--line);
}

.page-state-progress span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  animation: page-state-loading 1.4s ease-in-out infinite alternate;
}

.page-state-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.page-state-actions[hidden],
[data-page-state-view="error"] .page-state-progress {
  display: none;
}

.page-state-noscript {
  margin-top: 18px;
  border: 1px solid var(--warning);
  border-radius: calc(var(--radius) * 2);
  background: var(--paper);
  padding: 18px 20px;
  color: var(--warning);
  line-height: 1.7;
}

.application-form[aria-busy="true"] .fieldset {
  opacity: 0.72;
  cursor: wait;
}

.application-form[aria-busy="true"] .form-actions .btn {
  cursor: wait;
}

@keyframes page-state-loading {
  from { transform: translateX(-8%); }
  to { transform: translateX(146%); }
}

@media (max-width: 640px) {
  .page-state {
    min-height: 62svh;
    border-radius: var(--radius-card);
    padding: 30px 22px;
  }

  .page-state-actions {
    display: grid;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-state-progress span {
    animation: none;
    width: 100%;
  }
}
