/* Typeform-style apply flow. Relies on the shared token set in styles.css. */

button, input, textarea, select { font: inherit; color: inherit; }

.apply-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.apply-page .site-header {
  position: sticky;
  top: 0;
}

.apply-progress {
  height: 3px;
  background: var(--line);
  width: 100%;
  display: block;
  position: relative;
  overflow: hidden;
}

.apply-progress-bar {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.45s var(--ease);
}

.apply-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--header-h) - 3px);
}

.apply-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 0 6.5rem;
  width: min(44rem, calc(100% - 2.5rem));
  margin-inline: auto;
  position: relative;
}

@media (min-width: 720px) {
  .apply-stage { width: min(44rem, calc(100% - 4rem)); padding: 3rem 0 7rem; }
}

.apply-step {
  width: 100%;
  outline: none;
}

.apply-step.is-leave {
  animation: apply-out 0.28s var(--ease) forwards;
}

.apply-step.is-enter {
  animation: apply-in 0.45s var(--ease) both;
}

.apply-step.is-leave-back {
  animation: apply-out-back 0.28s var(--ease) forwards;
}

.apply-step.is-enter-back {
  animation: apply-in-back 0.45s var(--ease) both;
}

@keyframes apply-out {
  to { opacity: 0; transform: translateY(-16px); }
}
@keyframes apply-in {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes apply-out-back {
  to { opacity: 0; transform: translateY(16px); }
}
@keyframes apply-in-back {
  from { opacity: 0; transform: translateY(-22px); }
  to { opacity: 1; transform: translateY(0); }
}

.apply-kicker {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--accent);
  margin: 0 0 1rem;
  letter-spacing: 0.01em;
}

.apply-kicker .idx {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.15rem;
}

.apply-question {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(1.85rem, 4.6vw, 3.15rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 0.55rem;
}

.apply-help {
  margin: 0 0 1.6rem;
  color: var(--muted);
  font-size: 1.02rem;
}

.apply-field {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-width: 34rem;
}

.apply-input,
.apply-textarea {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 2px solid var(--line-strong);
  border-radius: 0;
  padding: 0.55rem 0 0.7rem;
  font-size: 1.35rem;
  line-height: 1.4;
  outline: none;
  caret-color: var(--accent);
  transition: border-color 0.2s var(--ease);
}

.apply-textarea {
  resize: vertical;
  min-height: 3.2rem;
  font-size: 1.2rem;
}

.apply-input:focus,
.apply-textarea:focus {
  border-bottom-color: var(--accent);
}

.apply-input::placeholder,
.apply-textarea::placeholder {
  color: var(--faint);
  opacity: 0.8;
}

.apply-error {
  min-height: 1.25rem;
  margin: 0.55rem 0 0;
  color: #e8b4a4;
  font-size: 0.9rem;
}

html[data-theme="light"] .apply-error { color: #8a3a2a; }

.apply-options {
  display: grid;
  gap: 0.65rem;
  max-width: 34rem;
}

.apply-option {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  cursor: pointer;
  color: var(--text);
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), transform 0.2s var(--ease);
}

.apply-option:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.apply-option.is-selected,
.apply-option[aria-pressed="true"] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}

.apply-key {
  flex: none;
  width: 1.7rem;
  height: 1.7rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--bg);
}

.apply-option.is-selected .apply-key,
.apply-option[aria-pressed="true"] .apply-key {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.apply-option-label {
  flex: 1;
  font-size: 1.02rem;
  font-weight: 500;
}

.apply-option-hint {
  display: block;
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--muted);
  margin-top: 0.15rem;
}

.apply-split {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 640px) {
  .apply-split.is-city {
    grid-template-columns: 1fr;
  }
}

.apply-footer-bar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  border-top: 1px solid var(--line);
  padding: 0.85rem 0 calc(0.85rem + env(safe-area-inset-bottom));
}

.apply-footer-inner {
  width: min(44rem, calc(100% - 2.5rem));
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

@media (min-width: 720px) {
  .apply-footer-inner { width: min(44rem, calc(100% - 4rem)); }
}

.apply-nav-btns {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.apply-ok {
  min-width: 5.5rem;
}

.apply-enter-hint {
  color: var(--faint);
  font-size: 0.82rem;
}

@media (max-width: 599px) {
  .apply-enter-hint { display: none; }
  .apply-option { padding: 0.95rem 1rem; }
  .apply-input { font-size: 1.15rem; }
}

.apply-end {
  text-align: left;
  max-width: 36rem;
}

.apply-end .apply-question { margin-bottom: 0.85rem; }

.apply-end-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin: 1.6rem 0 0.9rem;
}

.apply-status {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
  margin: 0 0 0.85rem;
}

.apply-submitting {
  color: var(--muted);
}

.apply-page .nav a[aria-current="page"] { color: var(--text); }

.apply-option:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .apply-step.is-leave,
  .apply-step.is-enter,
  .apply-step.is-leave-back,
  .apply-step.is-enter-back,
  .apply-progress-bar {
    animation: none;
    transition: none;
  }
}

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