/* Urban Reads Bookstore: residency application form.
   Loaded after store.css and pages.css; uses their variables. Every class starts with rf-. */

.rf-section { scroll-margin-top: 130px; }
.rf-head { max-width: 68ch; margin-bottom: 14px; }
.rf-head p { margin-bottom: 0.6em; }
.rf-req-mark { color: var(--red-d); font-weight: 700; }

/* ---------- progress ---------- */
.rf-progress {
  margin: 0 0 18px; padding: 12px 16px;
  background: var(--paper); border: 2.5px solid var(--ink); border-radius: 14px; box-shadow: 4px 4px 0 var(--ink);
}
.rf-progress-text { margin: 0 0 8px; font-weight: 700; font-size: 0.95rem; }
.rf-bar { height: 14px; background: var(--cream-2); border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; }
.rf-bar-fill { height: 100%; width: 0; background: var(--green); border-right: 2px solid var(--ink); transition: width 0.25s ease; }
.rf-bar-fill.is-zero { border-right: 0; }

/* ---------- error summary + failure ---------- */
.rf-summary { margin: 0 0 18px; }
.rf-summary ul { margin: 6px 0 0; padding-left: 1.2em; }
.rf-summary li { margin-bottom: 4px; }
.rf-summary a { color: var(--red-d); font-weight: 700; }
.rf-fail { margin: 0 0 14px; }

/* ---------- cards ---------- */
.rf { display: grid; gap: 22px; max-width: 820px; padding: 0 6px 6px 0; }
.rf-card {
  min-width: 0; padding: 22px 18px 20px;
  background: var(--paper); border: 2.5px solid var(--ink); border-radius: 18px; box-shadow: 5px 5px 0 var(--ink);
}
.rf-card:nth-of-type(7n+1) { border-top: 10px solid var(--red); }
.rf-card:nth-of-type(7n+2) { border-top: 10px solid var(--gold); }
.rf-card:nth-of-type(7n+3) { border-top: 10px solid var(--green); }
.rf-card:nth-of-type(7n+4) { border-top: 10px solid var(--teal); }
.rf-card:nth-of-type(7n+5) { border-top: 10px solid var(--red); }
.rf-card:nth-of-type(7n+6) { border-top: 10px solid var(--gold); }
.rf-card:nth-of-type(7n+0) { border-top: 10px solid var(--green); }
.rf-card h3 { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.45rem, 5vw, 1.9rem); margin: 0 0 0.5em; }
.rf-step {
  display: inline-block; margin: 0 0 8px; padding: 2px 10px;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--cream-2); border: 2px solid var(--ink); border-radius: 999px;
}
.rf-help { margin: -0.2em 0 1em; color: var(--muted); }
.rf-sub {
  margin: 18px 0 0; padding: 16px; background: #fff8dc;
  border: 2.5px dashed var(--ink); border-radius: 14px;
}
.rf-sub h4 { font-family: var(--font-body); font-weight: 700; font-size: 1.2rem; margin: 0 0 4px; }

/* ---------- fields ---------- */
.rf-grid { display: grid; gap: 0 18px; }
@media (min-width: 640px) { .rf-grid { grid-template-columns: 1fr 1fr; } .rf-card { padding: 26px 26px 22px; } }
.rf-field { margin: 0 0 16px; min-width: 0; }
.rf-field > label, .rf-label { display: block; font-weight: 700; margin: 0 0 4px; line-height: 1.3; }
.rf-hint { margin: 0 0 6px; color: var(--muted); font-size: 0.92rem; line-height: 1.4; }
.rf input[type="text"], .rf input[type="email"], .rf input[type="tel"], .rf input[type="number"], .rf input[type="date"],
.rf select, .rf textarea {
  display: block; width: 100%; min-height: 50px; padding: 10px 14px;
  font: inherit; font-size: 1rem; color: var(--ink); background: #fff;
  border: 2px solid var(--ink); border-radius: 12px; box-shadow: 2px 2px 0 var(--ink);
}
.rf textarea { min-height: 112px; resize: vertical; line-height: 1.5; }
.rf select { appearance: none; -webkit-appearance: none; padding-right: 44px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%;
  background-size: 6px 6px, 6px 6px; background-repeat: no-repeat;
}
.rf input.rf-short { max-width: 140px; }
.rf input.rf-sign { font-family: var(--font-display); font-size: 1.25rem; }
.rf input.rf-other { margin-top: 10px; }
.rf input:focus-visible, .rf select:focus-visible, .rf textarea:focus-visible { outline: 3px solid var(--teal-d); outline-offset: 2px; border-radius: 12px; }
.rf [aria-invalid="true"] { border-color: var(--red-d); background: #fff3f1; box-shadow: 2px 2px 0 var(--red-d); }
.rf-err {
  display: flex; gap: 6px; align-items: flex-start; margin: 6px 0 0;
  color: var(--red-d); font-weight: 700; font-size: 0.95rem; line-height: 1.35;
}
.rf-err::before {
  content: "!"; flex: none; width: 20px; height: 20px; margin-top: 1px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; background: var(--red-d); border-radius: 50%; font-size: 0.8rem;
}
.rf-err[hidden] { display: none; }

/* checkboxes */
.rf-check {
  display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; cursor: pointer;
  font-weight: 700; line-height: 1.4;
  background: #fff8dc; border: 2.5px solid var(--ink); border-radius: 14px;
}
.rf-field > label.rf-check { display: flex; margin: 0; font-weight: 700; }
.rf-field > label.rf-check-small { font-weight: 400; }
.rf-check input { flex: none; width: 28px; height: 28px; margin: 0; accent-color: var(--teal); cursor: pointer; }
.rf-check:focus-within { outline: 3px solid var(--teal-d); outline-offset: 2px; }
.rf-check-small { font-weight: 400; font-size: 0.9rem; background: transparent; border-width: 2px; border-style: dashed; }
.rf-check-small input { width: 24px; height: 24px; }
.rf-field > .rf-check + .rf-err { margin-top: 8px; }
.rf-check:has(input[aria-invalid="true"]) { border-color: var(--red-d); background: #fff3f1; }

.rf-terms {
  margin: 0 0 14px; padding: 14px 16px; font-weight: 500;
  background: #fff8dc; border: 2px dashed var(--ink); border-radius: 12px;
}

/* ---------- file pickers ---------- */
.rf-file { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.rf-file-input { position: absolute !important; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); }
.rf-file-btn { min-height: 52px; }
.rf-file-input:focus-visible + .rf-file-btn { outline: 3px solid var(--teal-d); outline-offset: 3px; }
.rf-file-btn.is-disabled { background: var(--cream-2); color: var(--muted); border-color: var(--muted); box-shadow: none; cursor: not-allowed; }
.rf-count { font-weight: 700; color: var(--muted); }
.rf-thumbs { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
@media (min-width: 640px) { .rf-thumbs { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); } }
.rf-thumbs:empty { display: none; }
.rf-thumb {
  display: flex; flex-direction: column; gap: 6px; padding: 8px;
  background: #fff; border: 2px solid var(--ink); border-radius: 12px;
}
.rf-thumb img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 8px; background: var(--cream-2); }
.rf-thumb-name { font-size: 0.82rem; color: var(--muted); overflow-wrap: anywhere; line-height: 1.3; }
.rf-thumb button {
  min-height: 44px; padding: 0 10px; font: inherit; font-weight: 700; font-size: 0.95rem;
  color: var(--red-d); background: var(--paper); border: 2px solid var(--ink); border-radius: 999px; cursor: pointer;
}
.rf-thumb button:hover { background: #fff; }

/* ---------- honeypot ---------- */
.rf-hp { position: absolute !important; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* ---------- send ---------- */
.rf-send { padding: 4px 0 8px; }
.rf-status { min-height: 1.5em; margin: 10px 0 0; font-weight: 700; text-align: center; }
.rf-last { text-align: center; margin: 4px 0 0; }
#rf-submit[aria-busy="true"] { cursor: progress; }

/* ---------- success ---------- */
.rf-success {
  max-width: 720px; padding: 28px 22px; text-align: center; background: var(--gold);
  border: 2.5px solid var(--ink); border-radius: 20px; box-shadow: 6px 6px 0 var(--ink);
}
.rf-success { scroll-margin-top: 140px; }
.rf-success:focus { outline: none; }
.rf-success-kick {
  display: inline-block; margin: 0 0 10px; padding: 4px 14px; font-weight: 700; font-size: 0.8rem;
  letter-spacing: 0.08em; text-transform: uppercase; color: #fff; background: var(--teal);
  border: 2px solid var(--ink); border-radius: 999px;
}
.rf-success h3 { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.9rem, 7vw, 2.8rem); margin: 0 0 0.2em; }
.rf-success-big { font-family: var(--font-display); font-size: clamp(1.3rem, 5vw, 1.8rem); color: var(--red-d); margin-bottom: 0.8em; }
.rf-success p { max-width: 52ch; margin-left: auto; margin-right: auto; }
.rf-success-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 18px; }
.rf-success a:not(.btn) { color: var(--ink); font-weight: 700; }

@media (prefers-reduced-motion: reduce) {
  .rf-bar-fill { transition: none; }
}
