/* ===================================================
   IBEW Tech Skills Survey — styles.css
   Mobile-first. No external dependencies.
   =================================================== */

/* --- Custom Properties --- */
:root {
  --navy:       #1B2A4A;
  --navy-dark:  #111c33;
  --gold:       #C9A84C;
  --gold-light: #F0D89A;
  --gold-dark:  #a88636;
  --white:      #FFFFFF;
  --bg:         #F4F6FA;
  --surface:    #FFFFFF;
  --text:       #1A1A1A;
  --text-muted: #555F6E;
  --border:     #CBD2DC;
  --error:      #C0392B;
  --error-bg:   #FDEDEB;
  --success:    #1E7E4F;
  --success-bg: #E6F7EE;
  --focus:      #2E5FBF;
  --radius:     6px;
  --shadow:     0 2px 8px rgba(0,0,0,.08);
  --font:       -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
a { color: var(--navy); }
a:hover { color: var(--gold-dark); }
img { max-width: 100%; }

/* --- Skip Link --- */
.skip-link {
  position: absolute;
  top: -999px; left: 0;
  background: var(--navy); color: var(--white);
  padding: .5rem 1rem;
  z-index: 1000;
  border-radius: 0 0 var(--radius) 0;
  text-decoration: none;
}
.skip-link:focus { top: 0; }

/* --- Header --- */
.site-header {
  background: var(--navy);
  color: var(--white);
  padding: .9rem 1rem;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.header-inner {
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  align-items: center;
}
.logo-area {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.ibew-badge {
  background: var(--gold);
  color: var(--navy-dark);
  font-weight: 800;
  font-size: .85rem;
  letter-spacing: .08em;
  padding: .25rem .55rem;
  border-radius: 4px;
  flex-shrink: 0;
}
.header-text { display: flex; flex-direction: column; line-height: 1.25; }
.header-title { font-size: 1.05rem; font-weight: 700; color: var(--white); }
.header-subtitle { font-size: .78rem; color: var(--gold-light); }

/* --- Container --- */
.container {
  max-width: 780px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

/* --- Intro --- */
.survey-intro { margin-bottom: 2rem; }
.survey-intro h1 {
  font-size: clamp(1.4rem, 4vw, 2rem);
  color: var(--navy);
  margin-bottom: .6rem;
  line-height: 1.25;
}
.survey-intro p { color: var(--text-muted); margin-bottom: 1rem; }
.privacy-notice {
  background: #eef2fb;
  border-left: 4px solid var(--navy);
  padding: .75rem 1rem;
  font-size: .85rem;
  color: var(--text-muted);
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* --- Alerts --- */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: .95rem;
}
.alert--success { background: var(--success-bg); color: var(--success); border: 1px solid #a8dfc0; }
.alert--error   { background: var(--error-bg);   color: var(--error);   border: 1px solid #f0b8b2; }
[hidden] { display: none !important; }

/* --- Form Sections --- */
.form-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}
.section-heading {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: 1.1rem;
  color: var(--navy);
  margin-bottom: 1.25rem;
  padding-bottom: .6rem;
  border-bottom: 2px solid var(--gold-light);
}
.section-number {
  background: var(--navy);
  color: var(--gold);
  width: 1.75rem; height: 1.75rem;
  border-radius: 50%;
  font-size: .8rem;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* --- Field Groups --- */
.field-group { margin-bottom: 1.25rem; }
.field-fieldset {
  border: none;
  padding: 0;
  margin-bottom: 1.25rem;
}

.field-label, .field-fieldset > legend {
  display: block;
  font-weight: 600;
  font-size: .95rem;
  margin-bottom: .35rem;
  color: var(--text);
}
.required-mark { color: var(--error); margin-left: .15rem; }
.optional-mark  { font-weight: 400; color: var(--text-muted); font-size: .85rem; }

.field-input, .field-textarea {
  width: 100%;
  padding: .65rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
}
.field-input:focus, .field-textarea:focus {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
  border-color: var(--focus);
}
.field-input.is-invalid, .field-textarea.is-invalid {
  border-color: var(--error);
}
.field-textarea { resize: vertical; min-height: 100px; }

.field-help  { display: block; font-size: .82rem; color: var(--text-muted); margin-top: .25rem; }
.field-error {
  display: block;
  font-size: .82rem;
  color: var(--error);
  margin-top: .3rem;
  min-height: 1.1em;
  font-weight: 500;
}

/* --- Radio Groups --- */
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem .75rem;
  margin-top: .4rem;
}
.radio-group--stacked { flex-direction: column; gap: .4rem; }
.radio-label {
  display: flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  font-size: .95rem;
  padding: .5rem .75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  transition: border-color .15s, background .15s;
  min-height: 44px;
  user-select: none;
}
.radio-label:hover { border-color: var(--navy); background: #f0f4ff; }
.radio-label input[type="radio"]:checked ~ * { /* handled by JS class */ }
.radio-label:has(input:checked) {
  border-color: var(--navy);
  background: #e8eef8;
}
.radio-label input[type="radio"] {
  width: 18px; height: 18px;
  accent-color: var(--navy);
  flex-shrink: 0;
}

/* --- Scale Group (comfort level) --- */
.scale-group {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-top: .4rem;
}
.scale-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  cursor: pointer;
  padding: .5rem .75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  min-width: 70px;
  text-align: center;
  transition: border-color .15s, background .15s;
  min-height: 44px;
  user-select: none;
}
.scale-label:hover { border-color: var(--navy); background: #f0f4ff; }
.scale-label:has(input:checked) {
  border-color: var(--gold-dark);
  background: #fdf6e3;
}
.scale-label input[type="radio"] {
  width: 18px; height: 18px;
  accent-color: var(--navy);
}
.scale-value { font-size: 1.2rem; font-weight: 800; color: var(--navy); }
.scale-desc  { font-size: .72rem; color: var(--text-muted); }

/* --- Checkbox Grid --- */
.check-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: .4rem;
  margin-top: .4rem;
}
@media (min-width: 480px) { .check-grid { grid-template-columns: 1fr 1fr; } }

.check-label {
  display: flex;
  align-items: center;
  gap: .55rem;
  cursor: pointer;
  font-size: .95rem;
  padding: .55rem .75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  transition: border-color .15s, background .15s;
  min-height: 44px;
  user-select: none;
}
.check-label:hover { border-color: var(--navy); background: #f0f4ff; }
.check-label:has(input:checked) {
  border-color: var(--navy);
  background: #e8eef8;
}
.check-label input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--navy);
  flex-shrink: 0;
}

/* Consent checkbox */
.check-label--consent {
  align-items: flex-start;
  border: 1.5px solid var(--border);
  padding: .75rem;
  font-size: .9rem;
}
.check-label--consent input { margin-top: .2rem; }

/* --- Score Preview --- */
.score-preview {
  background: var(--navy);
  color: var(--white);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}
.score-inner {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: .6rem;
}
.score-label { font-size: .9rem; color: var(--gold-light); }
.score-value { font-size: 1.8rem; font-weight: 800; color: var(--white); line-height: 1; }
.score-max   { font-size: .85rem; color: var(--gold-light); }
.score-flag  {
  padding: .2rem .65rem;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.score-flag--low    { background: #C0392B; color: #fff; }
.score-flag--medium { background: #E67E22; color: #fff; }
.score-flag--high   { background: var(--success); color: #fff; }

.score-bar-wrap {
  height: 6px;
  background: rgba(255,255,255,.2);
  border-radius: 999px;
  overflow: hidden;
}
.score-bar {
  height: 100%;
  background: var(--gold);
  border-radius: 999px;
  transition: width .3s ease;
}

/* --- Form Actions --- */
.form-actions { margin-top: .5rem; text-align: center; }
.btn-submit {
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  padding: .85rem 2.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: .03em;
  transition: background .15s, transform .1s;
  min-height: 48px;
  min-width: 160px;
}
.btn-submit:hover  { background: var(--navy-dark); }
.btn-submit:active { transform: scale(.98); }
.btn-submit:focus  { outline: 3px solid var(--focus); outline-offset: 2px; }
.btn-submit:disabled { opacity: .6; cursor: not-allowed; }

.form-note { margin-top: .75rem; font-size: .82rem; color: var(--text-muted); }

/* --- Thank You Card --- */
.thankyou-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  text-align: center;
  box-shadow: var(--shadow);
  max-width: 540px;
  margin: 2rem auto;
}
.thankyou-icon {
  width: 64px; height: 64px;
  background: var(--success-bg);
  color: var(--success);
  border-radius: 50%;
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
}
.thankyou-card h1 { color: var(--navy); margin-bottom: .75rem; }
.thankyou-card p  { color: var(--text-muted); margin-bottom: .5rem; }

/* --- Footer --- */
.site-footer {
  background: var(--navy-dark);
  color: #8899bb;
  padding: 1rem;
  font-size: .82rem;
  text-align: center;
  margin-top: auto;
}
.site-footer a { color: var(--gold-light); }

/* --- Tablet+ --- */
@media (min-width: 600px) {
  .container { padding: 2rem 1.5rem; }
  .form-section { padding: 1.75rem 1.75rem; }
  .radio-group:not(.radio-group--stacked) { flex-wrap: nowrap; }
  .scale-group { flex-wrap: nowrap; }
  .scale-label { flex: 1; }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* --- High Contrast --- */
@media (forced-colors: active) {
  .radio-label, .check-label, .scale-label { forced-color-adjust: none; }
}
