/* ==========================================================================
   ISP RAPP Intake — Brand styles
   Editorial, restrained, type-led. Cream + Navy + Gold.
   ========================================================================== */

:root {
  --navy: #1F2A44;
  --navy-dark: #141C2E;
  --gold: #B6924E;
  --gold-soft: #c8a565;
  --cream: #F5F1E8;
  --cream-dark: #EAE3D2;
  --cream-darker: #ddd4be;
  --text: #2A2A2A;
  --text-muted: #5A5A5A;
  --text-faint: #8a8478;
  --error: #a83232;
  --white: #ffffff;

  --serif: "Playfair Display", "DM Serif Display", Georgia, "Times New Roman", serif;
  --sans: "DM Sans", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

  --max: 720px;
  --max-wide: 1100px;

  --radius-sm: 2px;
  --radius: 4px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;

  --shadow-sm: 0 1px 0 rgba(31,42,68,0.06);
  --shadow: 0 1px 2px rgba(31,42,68,0.06), 0 4px 16px rgba(31,42,68,0.05);

  --transition: 160ms ease;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Subtle paper texture via gradients — keeps cream from feeling flat */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(1200px 600px at 20% 0%, rgba(182,146,78,0.05), transparent 60%),
    radial-gradient(900px 500px at 90% 100%, rgba(31,42,68,0.04), transparent 60%);
  z-index: 0;
}

.container {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* ===== Header ===== */
.site-header {
  border-bottom: 1px solid var(--cream-dark);
  background: var(--cream);
  position: relative;
  z-index: 2;
}
.header-inner {
  max-width: var(--max-wide);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  padding-top: 22px;
  padding-bottom: 22px;
  flex-wrap: wrap;
}
.wordmark {
  text-decoration: none;
  color: var(--gold);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.wordmark-text { white-space: nowrap; }
.tagline {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 16px;
  color: var(--navy);
  letter-spacing: 0.01em;
}

@media (max-width: 640px) {
  .header-inner { flex-direction: column; align-items: flex-start; gap: 6px; padding-top: 18px; padding-bottom: 18px; }
  .wordmark { font-size: 12px; letter-spacing: 0.14em; }
  .tagline { font-size: 14px; }
}

/* ===== Main ===== */
.main { padding: 56px 24px 80px; }
@media (max-width: 640px) { .main { padding: 32px 16px 56px; } }

/* ===== Typography ===== */
.display {
  font-family: var(--serif);
  font-weight: 600;
  color: var(--navy);
  letter-spacing: -0.005em;
  line-height: 1.1;
  margin: 0 0 var(--space-4);
}
h1.display { font-size: clamp(34px, 5vw, 48px); }
h2.display { font-size: clamp(28px, 4vw, 38px); }
h3.display { font-size: clamp(22px, 3vw, 26px); }

.eyebrow {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 var(--space-3);
}

.lede {
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  margin: 0 0 var(--space-6);
  max-width: 64ch;
}

.italic {
  font-family: var(--serif);
  font-style: italic;
  color: var(--navy);
}

/* ===== Intro ===== */
.intro-screen { padding-top: var(--space-5); }
.meta-list {
  list-style: none;
  margin: 0 0 var(--space-7);
  padding: var(--space-5) 0;
  border-top: 1px solid var(--cream-dark);
  border-bottom: 1px solid var(--cream-dark);
}
.meta-list li {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: var(--space-4);
  padding: 10px 0;
  align-items: baseline;
}
.meta-label {
  font-size: 11.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}
.meta-value {
  font-family: var(--serif);
  color: var(--navy);
  font-size: 16px;
  line-height: 1.4;
}
@media (max-width: 640px) {
  .meta-list li { grid-template-columns: 1fr; gap: 2px; }
}

/* ===== Wizard ===== */
.wizard { padding-top: var(--space-3); }

.progress { margin-bottom: var(--space-6); }
.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  align-items: baseline;
  margin-bottom: 10px;
  font-size: 12px;
}
.progress-text {
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-size: 11.5px;
}
.progress-section {
  font-family: var(--serif);
  font-style: italic;
  color: var(--navy);
  font-size: 14px;
  text-align: right;
}
.progress-track {
  height: 4px;
  background: var(--cream-dark);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--gold);
  transition: width 360ms cubic-bezier(.2,.8,.2,1);
}

.step-header { margin-bottom: var(--space-6); }
.step-description {
  font-size: 17px;
  margin: 0;
  max-width: 60ch;
  line-height: 1.5;
}

/* ===== Form fields ===== */
.field {
  margin-bottom: var(--space-6);
}
.field-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 8px;
  letter-spacing: 0.005em;
  line-height: 1.4;
}
.field-label .required {
  color: var(--gold);
  font-weight: 700;
  margin-left: 3px;
}
.field-help {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.45;
}

.input,
.select,
.textarea {
  width: 100%;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--white);
  border: 1px solid var(--cream-darker);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  -webkit-appearance: none;
  appearance: none;
}
.textarea {
  min-height: 110px;
  resize: vertical;
  font-family: var(--sans);
}
.select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M0 0l5 6 5-6z' fill='%231F2A44'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 10px 6px;
  padding-right: 36px;
}

.input:hover, .select:hover, .textarea:hover { border-color: #c8bfa6; }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(31,42,68,0.10);
}

.input[readonly] {
  background: var(--cream-dark);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* Radio / checkbox groups */
.option-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}
.option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--cream-darker);
  border-radius: var(--radius-sm);
  background: var(--white);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  font-size: 15px;
  line-height: 1.4;
}
.option:hover { border-color: #c8bfa6; }
.option input {
  margin-top: 2px;
  accent-color: var(--gold);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.option.checked {
  border-color: var(--navy);
  background: #fbf8ef;
}
.option-text { flex: 1; color: var(--text); }

.option-row-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.option-row-inline .option {
  flex: 0 1 auto;
  min-width: 100px;
}

/* Single checkbox (certifications) */
.field-checkbox-single .option {
  background: var(--cream);
  border: 1px solid var(--cream-dark);
}
.field-checkbox-single .field-label { margin-bottom: 0; }

/* File inputs */
.file-wrap {
  border: 1px dashed var(--cream-darker);
  background: #fbf8ef;
  border-radius: var(--radius);
  padding: 18px;
}
.file-wrap input[type="file"] {
  display: block;
  width: 100%;
  font-size: 13px;
  color: var(--text-muted);
}
.file-list {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: var(--text);
}
.file-list li {
  padding: 4px 0;
  border-top: 1px dotted var(--cream-darker);
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
}
.file-list li:first-child { border-top: 0; }
.file-note {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

/* Inline validation */
.field.has-error .input,
.field.has-error .select,
.field.has-error .textarea,
.field.has-error .file-wrap {
  border-color: var(--error);
}
.field.has-error .option { border-color: var(--error); }
.field-error {
  color: var(--error);
  font-size: 13px;
  margin-top: 6px;
  font-weight: 500;
}

/* Form-level error */
.form-error {
  background: #fbe9e9;
  border-left: 3px solid var(--error);
  color: #6f2222;
  padding: 12px 14px;
  font-size: 14px;
  margin-bottom: var(--space-4);
}

/* ===== Buttons ===== */
.btn {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.04em;
  border-radius: var(--radius-sm);
  padding: 13px 24px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform 80ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  line-height: 1;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid rgba(31,42,68,0.25); outline-offset: 2px; }

.btn-primary {
  background: var(--gold);
  color: #fff;
  border-color: var(--gold);
}
.btn-primary:hover { background: #a98246; border-color: #a98246; }

.btn-ghost {
  background: transparent;
  color: var(--navy);
  border-color: var(--cream-darker);
}
.btn-ghost:hover { background: var(--cream-dark); border-color: #c8bfa6; }

.btn-link {
  background: transparent;
  color: var(--navy);
  border: 0;
  padding: 13px 14px;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: rgba(31,42,68,0.3);
  text-underline-offset: 3px;
}
.btn-link:hover { color: var(--gold); text-decoration-color: var(--gold); }

.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }

/* ===== Step actions bar ===== */
.step-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  padding-top: var(--space-5);
  border-top: 1px solid var(--cream-dark);
  margin-top: var(--space-6);
  flex-wrap: wrap;
}
.step-actions-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
@media (max-width: 480px) {
  .step-actions { gap: var(--space-2); }
  .step-actions-right { width: 100%; justify-content: flex-end; }
  #btn-back { width: 100%; }
}

.actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-top: var(--space-5);
}

/* ===== Confirmation ===== */
.confirmation { text-align: left; padding-top: var(--space-5); }
.confirmation .lede { max-width: 56ch; }
.confirm-block {
  margin: var(--space-7) 0 var(--space-5);
  padding: var(--space-6) 0;
  border-top: 1px solid var(--cream-dark);
  border-bottom: 1px solid var(--cream-dark);
  text-align: center;
}
.confirm-wordmark {
  color: var(--gold);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.18em;
  margin: 0 0 6px;
}
.confirm-tagline {
  margin: 0;
  font-size: 18px;
}

/* ===== Modal ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(20,28,46,0.55);
  backdrop-filter: blur(2px);
}
.modal-card {
  position: relative;
  background: var(--cream);
  border: 1px solid var(--cream-dark);
  max-width: 460px;
  width: 100%;
  padding: 28px;
  border-radius: var(--radius);
  box-shadow: 0 30px 60px rgba(20,28,46,0.25);
}
.modal-card h3 { margin-top: 0; }
.modal-card p { color: var(--text); font-size: 14.5px; margin: 0 0 var(--space-4); }
.modal-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
  margin-top: var(--space-5);
}
.modal-confirm {
  margin-top: var(--space-4);
  padding: 10px 12px;
  background: #ecf3e8;
  border-left: 3px solid #5d8a3a;
  color: #2f4520;
  font-size: 13.5px;
}

/* ===== Footer ribbon ===== */
.site-footer {
  border-top: 1px solid var(--cream-dark);
  background: var(--cream);
  padding: 22px 24px;
  margin-top: var(--space-9);
  position: relative;
  z-index: 2;
}
.ribbon {
  text-align: center;
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.8;
}
@media (max-width: 640px) {
  .site-footer { padding: 18px 16px; margin-top: 56px; }
  .ribbon { font-size: 10px; letter-spacing: 0.18em; }
}

/* Conditional fields fade in */
.field {
  animation: fadeIn 220ms ease both;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(2px); }
  to { opacity: 1; transform: none; }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ===== Print styles ===== */
@media print {
  .site-header, .site-footer, .step-actions, .progress, #wizard, #intro-screen, #save-modal { display: none !important; }
  body { background: #fff; color: #1C2035; }
  .confirmation { display: block !important; }
  .actions { display: none !important; }
  .confirm-wordmark { color: #2D3956 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
