@font-face {
  font-family: "Dosis";
  src: url("./dosis-400.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Dosis";
  src: url("./dosis-500.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Dosis";
  src: url("./dosis-600.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Josefin Sans";
  src: url("./josefin-sans-400.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --brown: #856c4e;
  --brown-dark: #5f4934;
  --gold: #d9c291;
  --gold-light: #eadab8;
  --ink: #4a4035;
  --muted: #9d8e7b;
  --line: #dfc891;
  --paper: #ffffff;
  --sand: #f4f0e9;
  --danger: #a64538;
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: "Dosis", sans-serif;
  font-size: 18px;
  font-weight: 400;
}

button, input, textarea { font: inherit; }

.site-header {
  position: relative;
  z-index: 2;
  min-height: 112px;
  background: rgba(255, 255, 255, 0.98);
  border-bottom: 1px solid rgba(133, 108, 78, 0.18);
  box-shadow: 0 4px 14px rgba(64, 46, 29, 0.12);
}

.header-inner {
  width: min(1180px, calc(100% - 48px));
  min-height: 112px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { display: inline-flex; align-items: center; }
.brand img { width: 92px; height: auto; display: block; }

.project-labels {
  display: flex;
  align-items: center;
  gap: 10px;
}

.project-label {
  padding: 9px 14px 8px;
  border: 1px solid var(--gold);
  color: var(--brown);
  font-family: "Josefin Sans", sans-serif;
  font-size: 11px;
  letter-spacing: 0.13em;
  line-height: 1;
  text-transform: uppercase;
}

.registration-main,
.review-main,
.result-main {
  flex: 1 0 auto;
  min-height: calc(100vh - 286px);
  padding: 72px 24px 86px;
}

.form-shell,
.review-shell {
  width: min(1030px, 100%);
  margin: 0 auto;
}

/* Keep the complete registration task visible in a typical desktop viewport. */
@media (min-width: 761px) {
  .registration-page .site-header,
  .registration-page .header-inner {
    min-height: 82px;
  }

  .registration-page .header-inner {
    width: min(1220px, calc(100% - 48px));
  }

  .registration-page .brand img { width: 66px; }

  .registration-page .registration-main {
    min-height: auto;
    padding: 26px 24px 30px;
  }

  .registration-page .form-shell { width: min(860px, 100%); }
  .registration-page .section-kicker { margin-bottom: 8px; }
  .registration-page h1 { font-size: clamp(38px, 4vw, 50px); }

  .registration-page .intro {
    margin: 10px auto 22px;
    font-size: 16px;
    line-height: 1.4;
  }

  .registration-page .form-section {
    margin-bottom: 18px;
    padding-bottom: 18px;
  }

  .registration-page .form-section.no-rule {
    margin-bottom: 12px;
    padding-bottom: 0;
  }

  .registration-page .form-section h2 { margin-bottom: 12px; }
  .registration-page .form-grid { gap: 14px 20px; }

  .registration-page .field > span {
    margin-bottom: 2px;
    font-size: 16px;
    line-height: 1.2;
  }

  .registration-page .field input,
  .registration-page .field textarea {
    font-size: 17px;
    padding: 4px 2px 6px;
  }

  .registration-page .field small {
    margin-top: 3px;
    font-size: 12px;
    line-height: 1.2;
  }

  .registration-page .textarea-field textarea { min-height: 58px; }

  .registration-page .primary-button {
    min-height: 44px;
    border-radius: 8px;
    padding: 9px 24px;
    font-size: 16px;
  }

  .registration-page .footer-inner { min-height: 104px; }
  .registration-page .footer-inner img { width: 62px; }
  .registration-page .footer-inner p { font-size: 11px; }
}

.section-kicker {
  margin-bottom: 18px;
  color: var(--brown);
  font-family: "Josefin Sans", sans-serif;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-align: center;
}

h1 {
  margin: 0;
  color: var(--gold);
  font-family: "Dosis", sans-serif;
  font-size: clamp(38px, 5vw, 58px);
  font-weight: 400;
  letter-spacing: 0.045em;
  line-height: 1.1;
  text-align: center;
}

.intro {
  max-width: 650px;
  margin: 20px auto 52px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.65;
  text-align: center;
}

.form-section {
  margin-bottom: 44px;
  padding-bottom: 40px;
  border-bottom: 1px solid rgba(217, 194, 145, 0.46);
}

.form-section.no-rule { border-bottom: 0; padding-bottom: 0; }

/* Field underlines are sufficient on the registration form; additional full-width
   section rules look like empty inputs and make the form harder to scan. */
.registration-page .form-section { border-bottom: 0; }

.form-section h2,
.details-card h2,
.decision-form legend {
  margin: 0 0 26px;
  color: var(--brown);
  font-family: "Josefin Sans", sans-serif;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.form-grid { display: grid; gap: 34px 36px; }
.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.field { display: block; min-width: 0; }
.field > span {
  display: block;
  margin-bottom: 5px;
  color: #b4a795;
  font-size: 18px;
  line-height: 1.35;
}
.field > span b { color: var(--brown); font-weight: 400; }

.field input,
.field textarea {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 19px;
  padding: 9px 2px 10px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--brown);
  box-shadow: 0 1px 0 var(--brown);
}

.field small {
  display: block;
  margin-top: 8px;
  color: #b0a290;
  font-size: 14px;
  line-height: 1.35;
}

.textarea-field textarea { min-height: 120px; resize: vertical; }
.honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.primary-button,
.secondary-button {
  min-height: 54px;
  border-radius: 10px;
  padding: 13px 30px;
  font-family: "Dosis", sans-serif;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.025em;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.primary-button {
  border: 1px solid var(--gold);
  background: var(--gold);
  color: #fff;
}

.secondary-button {
  border: 1px solid var(--brown);
  background: transparent;
  color: var(--brown);
}

.primary-button:hover,
.secondary-button:hover { transform: translateY(-1px); }
.primary-button:hover { background: #ccb379; border-color: #ccb379; }
.secondary-button:hover { background: var(--sand); }
.primary-button:disabled,
.secondary-button:disabled { opacity: 0.62; cursor: wait; transform: none; }

.form-error {
  margin: 0 0 22px;
  border-left: 2px solid var(--danger);
  padding: 11px 14px;
  background: #fbf3f0;
  color: var(--danger);
  font-size: 16px;
}

.success-panel {
  max-width: 720px;
  margin: 20px auto 0;
  border: 1px solid var(--gold-light);
  padding: 52px 48px;
  background: #fffdf9;
  text-align: center;
}

.success-panel h2,
.decision-recorded h2,
.loading-card h2 {
  margin: 0 0 14px;
  color: var(--brown);
  font-size: 34px;
  font-weight: 400;
}

.success-panel p,
.decision-recorded p,
.loading-card p {
  margin: 0 auto;
  color: var(--muted);
  line-height: 1.6;
}

.success-panel .reference { margin-top: 24px; color: var(--brown); font-size: 15px; }

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(4px);
}
.loading-overlay[hidden] { display: none; }

.loading-card {
  width: min(420px, 100%);
  border: 1px solid var(--gold-light);
  padding: 42px 34px;
  background: #fff;
  box-shadow: 0 22px 65px rgba(95, 73, 52, 0.16);
  text-align: center;
}

.loading-spinner {
  width: 42px;
  height: 42px;
  margin: 0 auto 24px;
  border: 2px solid rgba(217, 194, 145, 0.35);
  border-top-color: var(--brown);
  border-radius: 50%;
  animation: spin 850ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.site-footer { margin-top: auto; background: var(--sand); border-top: 1px solid rgba(217, 194, 145, 0.35); }
.footer-inner {
  width: min(1180px, calc(100% - 48px));
  min-height: 174px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 32px;
}
.footer-inner img { width: 88px; height: auto; }
.footer-inner p {
  margin: 0;
  color: var(--brown);
  font-family: "Josefin Sans", sans-serif;
  font-size: 13px;
  letter-spacing: 0.08em;
}

.footer-contacts {
  display: grid;
  gap: 8px;
  justify-items: start;
}

.footer-contacts a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--brown);
  font-size: 15px;
  line-height: 1.2;
  text-decoration: none;
}

.footer-contacts a:hover { color: var(--brown-dark); }
.footer-contacts img { width: 18px; height: 18px; }

/* Review */
.review-shell { width: min(930px, 100%); }
.details-card,
.decision-form,
.decision-recorded,
.result-card {
  border: 1px solid var(--gold-light);
  background: #fff;
  padding: 34px 38px;
}
.details-card { margin-bottom: 28px; }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.card-heading a,
.candidate-content > a {
  color: var(--brown);
  font-size: 15px;
  text-underline-offset: 4px;
}
.detail-row {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 28px;
  border-top: 1px solid rgba(217, 194, 145, 0.35);
  padding: 14px 0;
}
.detail-row > span {
  color: var(--muted);
  font-family: "Josefin Sans", sans-serif;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.detail-row > strong { font-weight: 500; overflow-wrap: anywhere; }
.detail-row.full > strong { white-space: pre-wrap; line-height: 1.55; }

.decision-form fieldset { min-width: 0; margin: 0; border: 0; padding: 0; }
.candidate-list { display: grid; gap: 16px; }
.candidate-card { position: relative; display: block; cursor: pointer; }
.candidate-card > input { position: absolute; opacity: 0; pointer-events: none; }
.candidate-content {
  display: block;
  border: 1px solid #e4d8c2;
  padding: 24px;
  background: #fffdf9;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.candidate-card:hover .candidate-content { transform: translateY(-1px); border-color: var(--gold); }
.candidate-card > input:checked + .candidate-content {
  border-color: var(--brown);
  box-shadow: inset 4px 0 0 var(--brown), 0 10px 24px rgba(95, 73, 52, 0.08);
}
.candidate-card > input:focus-visible + .candidate-content { outline: 2px solid var(--brown); outline-offset: 3px; }
.candidate-topline { display: flex; justify-content: space-between; gap: 16px; }
.candidate-topline strong {
  color: var(--brown);
  font-family: "Josefin Sans", sans-serif;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.candidate-topline b { color: var(--gold); font-size: 20px; font-weight: 500; }
.candidate-title { display: block; margin: 7px 0 18px; color: var(--ink); font-size: 25px; font-weight: 500; }
.candidate-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 28px; margin-bottom: 18px; }
.candidate-meta > span { display: block; overflow-wrap: anywhere; }
.candidate-meta em { display: block; margin-bottom: 4px; color: var(--muted); font-family: "Josefin Sans", sans-serif; font-size: 10px; font-style: normal; letter-spacing: 0.08em; text-transform: uppercase; }
.match-reasons { display: block; margin: 0 0 16px; color: var(--muted); font-size: 15px; }
.match-reasons ul { margin: 0; padding-left: 18px; }
.decision-actions { display: flex; gap: 16px; margin-top: 28px; }
.decision-actions button { flex: 1; }
.decision-recorded { text-align: center; }

.result-main { display: flex; align-items: center; justify-content: center; }
.result-card { width: min(680px, 100%); text-align: center; }
.result-card h1 { margin-bottom: 20px; }
.result-card > p { margin: 0 auto 30px; color: var(--muted); line-height: 1.6; }
.result-card .detail-row { text-align: left; }
.error-card { border-color: #e5c3bc; }
.error-card .section-kicker, .error-card h1 { color: var(--danger); }

@media (max-width: 760px) {
  body { font-size: 17px; }
  .site-header, .header-inner { min-height: 86px; }
  .header-inner { width: min(100% - 30px, 1180px); }
  .brand img { width: 70px; }
  .project-labels { gap: 5px; }
  .project-label { padding: 7px 7px 6px; font-size: 8px; letter-spacing: 0.05em; }
  .registration-main, .review-main, .result-main { padding: 50px 18px 62px; min-height: calc(100vh - 226px); }
  .intro { margin-bottom: 40px; font-size: 16px; }
  .two-columns { grid-template-columns: 1fr; }
  .form-grid { gap: 28px; }
  .form-section { margin-bottom: 36px; padding-bottom: 34px; }
  .primary-button, .secondary-button { width: 100%; }
  .footer-inner { width: min(100% - 30px, 1180px); min-height: 140px; grid-template-columns: auto 1fr; gap: 18px; }
  .footer-inner img { width: 68px; }
  .footer-inner p { display: none; }
  .footer-contacts { justify-self: end; gap: 7px; }
  .footer-contacts a { gap: 8px; font-size: 13px; }
  .footer-contacts img { width: 17px; height: 17px; }
  .details-card, .decision-form, .decision-recorded, .result-card { padding: 25px 20px; }
  .card-heading { display: block; }
  .card-heading a { display: inline-block; margin: -10px 0 20px; }
  .detail-row { grid-template-columns: 1fr; gap: 5px; }
  .candidate-meta { grid-template-columns: 1fr; gap: 11px; }
  .candidate-content { padding: 20px; }
  .decision-actions { flex-direction: column; }
  .success-panel { padding: 42px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
  .loading-spinner { animation-duration: 1.8s; }
}
