/* =========================================================
   Southern IT Networks — Client Onboarding
   ========================================================= */

/* ---------- 1. Design tokens ---------- */
:root {
  /* Brand */
  --brand-blue: #159cd3;
  --brand-blue-dark: #0f7aa8;   /* accessible text/hover shade of brand blue */
  --brand-orange: #f16624;
  --brand-red: #ec1f27;
  --brand-green: #3aa649;
  --brand-grey-dark: #59595c;
  --brand-grey-light: #878888;

  /* Neutrals */
  --white: #fff;
  --page-bg: #f5f6f7;
  --surface-muted: #f8f9fa;
  --text: #333336;
  --text-muted: #5f6063;
  --border: #dfe1e4;
  --border-strong: #c4c7cb;
  --error-text: #b3161c;
  --error-bg: #fdf0f0;
  --footer-bg: #3f3f42;

  /* Layout */
  --content-width: 900px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  /* Shape */
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --border-width: 1px;
  --shadow-sm: 0 1px 2px rgba(40, 42, 46, 0.06);
  --shadow-md: 0 1px 3px rgba(40, 42, 46, 0.06), 0 6px 20px rgba(40, 42, 46, 0.05);
  --focus-ring: 0 0 0 3px rgba(21, 156, 211, 0.35);

  --font: "Segoe UI", Arial, sans-serif;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--page-bg);
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--brand-blue-dark); }
a:hover { color: var(--text); }

:focus-visible {
  outline: 3px solid var(--brand-blue);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100px;
  z-index: 10;
  padding: var(--space-2) var(--space-4);
  background: var(--white);
  color: var(--brand-blue-dark);
  border: var(--border-width) solid var(--brand-blue);
  border-radius: var(--radius-sm);
  font-weight: 600;
}
.skip-link:focus { top: var(--space-3); }

/* ---------- 3. Header ---------- */
.site-header {
  background: var(--white);
  border-bottom: var(--border-width) solid var(--border);
}

.site-header__inner {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-2) var(--space-4);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
}

/* Logo PNG has generous transparent padding; crop visually via negative margin */
.site-header__logo {
  width: 190px;
  margin: -14px -12px;
}

.site-header__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-4);
}

.site-header__label {
  font-weight: 600;
  color: var(--brand-grey-dark);
}

.site-header__secure {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.lock-icon {
  width: 14px;
  height: 14px;
  fill: var(--brand-green);
}

/* ---------- 4. Page + intro ---------- */
/* Full-width blue intro; content stays constrained via inline padding */
.page {
  flex: 1;
  width: 100%;
  margin: 0;
  padding: 0 0 var(--space-7);
  --gutter: max(var(--space-4), calc((100% - var(--content-width)) / 2));
}

.intro {
  background: var(--brand-blue);
  color: var(--white);
  padding: 56px var(--gutter) 104px;
}

.intro h1 {
  margin: 0 0 var(--space-3);
  font-size: clamp(28px, 4.4vw, 38px);
  line-height: 1.15;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.01em;
}
.intro h1::after {
  content: "";
  display: block;
  width: 56px;
  height: 4px;
  margin-top: var(--space-4);
  background: var(--brand-orange);
  border-radius: 2px;
}

/* White on #159cd3 is ~3.1:1 — supporting text kept large + bold (AA large text) */
.intro__lead {
  margin: 0 0 var(--space-3);
  max-width: 720px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--white);
}

.intro__note {
  margin: 0;
  max-width: 720px;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.45;
  color: var(--white);
}

/* ---------- 5. Form area + loading ---------- */
.form-area {
  outline: none;
  position: relative;
  max-width: calc(var(--content-width) + 2 * var(--space-4));
  margin: -64px auto 0;
  padding: 0 var(--space-4);
}

.form-status {
  margin: 0 0 var(--space-4);
  padding: var(--space-5);
  background: var(--white);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  color: var(--text-muted);
}

.form-status--delay {
  border-left: 4px solid var(--brand-orange);
  color: var(--text);
}

.table-hint {
  margin: 0 0 var(--space-2);
  font-size: 13px;
  color: var(--text-muted);
}
@media (min-width: 769px) { .table-hint { display: none; } }

/* ---------- 6. Cognito Form 15 (Chameleon) ---------- */
/* Scoped presentation tokens and targeted overrides.
   No undocumented Cognito theme variables are assumed. */
:root .cog-15 {
  font-family: var(--font);
  font-size: 15px;
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-6);
  background: var(--white);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 4px rgba(40, 42, 46, 0.05), 0 14px 36px rgba(21, 80, 110, 0.12);
  color: var(--text);
  overflow-wrap: anywhere;
}

/* Form header: logo, title, description */
:root .cog-15 .cog-header {
  padding-bottom: var(--space-5);
  margin-bottom: var(--space-5);
  border-bottom: 2px solid #e3f2f9;
}
:root .cog-15 .cog-header img { max-width: 100%; height: auto; max-height: 72px; width: auto; }
:root .cog-15 .cog-header h1,
:root .cog-15 .cog-header .cog-heading {
  margin: 0 0 var(--space-2);
  font-size: 26px;
  line-height: 1.25;
  font-weight: 700;
  color: var(--brand-blue);
}
:root .cog-15 .cog-section .cog-heading,
:root .cog-15 .cog-section h2,
:root .cog-15 .cog-page h2,
:root .cog-15 .cog-content h2 {
  padding: 0;
  border: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.4;
}
:root .cog-15 .cog-repeating-section > .cog-section__inner > .cog-section__heading {
  font-weight: 700;
}
:root .cog-15 .cog-header .cog-form__description,
:root .cog-15 .cog-header p { color: var(--brand-grey-dark); font-size: 15px; line-height: 1.6; margin: 0; }

/* Labels + help */
:root .cog-15 .cog-label {
  color: var(--brand-grey-dark);
  font-weight: 600;
  white-space: normal;
}
:root .cog-15 .cog-asterisk { color: var(--error-text); }
:root .cog-15 .cog-helptext {
  font-size: 13px;
  font-style: normal;
  color: var(--text-muted);
  margin-top: var(--space-1);
}

/* Keep the contact-authorisation explanations compact. */
:root .cog-15 .cog-field--20.cog-choice--multiselectcards .cog-helptext.cog-html p {
  margin: 0;
}
:root .cog-15 .cog-field--20.cog-choice--multiselectcards .cog-helptext.cog-html p + p {
  margin-top: 4px;
}

/* Inputs */
:root .cog-15 .cog-input input:not([type="checkbox"]):not([type="radio"]),
:root .cog-15 .cog-input select,
:root .cog-15 .el-input__inner {
  min-height: 48px;
  padding: 0 var(--space-3);
  background: #f4f8fb;
  border: var(--border-width) solid #d3dde4;
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
}
:root .cog-15 .cog-input textarea {
  padding: var(--space-3);
  background: #f4f8fb;
  border: var(--border-width) solid #d3dde4;
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  resize: vertical;
}
:root .cog-15 .cog-input input:not([type="checkbox"]):not([type="radio"]):hover,
:root .cog-15 .cog-input select:hover,
:root .cog-15 .cog-input textarea:hover { border-color: var(--brand-grey-light); }
:root .cog-15 .cog-input input:not([type="checkbox"]):not([type="radio"]):focus,
:root .cog-15 .cog-input select:focus,
:root .cog-15 .cog-input textarea:focus {
  border-color: var(--brand-blue);
  box-shadow: var(--focus-ring);
  outline: 2px solid transparent;
  background: var(--white);
}
:root .cog-15 ::placeholder { color: #707174; opacity: 1; }

/* Standard checkbox + radio layout; card-only visual overrides follow. */
:root .cog-15 .el-checkbox,
:root .cog-15 .el-radio {
  display: inline-flex;
  align-items: flex-start;
  gap: var(--space-2);
  white-space: normal;
}
:root .cog-15 .el-checkbox__label,
:root .cog-15 .el-radio__label {
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
}
/* Selected Cognito cards use blue without replacing their native controls. */
:root .cog-15 .cog-checkable.cog-checkable--card .cog-choice-option.el-checkbox > .el-checkbox__input,
:root .cog-15 .cog-checkable.cog-checkable--card .cog-choice-option.el-radio > .el-radio__input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  opacity: 0;
}
:root .cog-15 .cog-checkable--card .cog-choice__card-checkmark {
  visibility: hidden;
}
:root .cog-15 .cog-checkable.cog-checkable--card .cog-choice-option.is-checked {
  --highlight: var(--brand-blue-dark);
  background-color: var(--brand-blue-dark);
  border-color: var(--brand-blue-dark);
  outline-color: var(--brand-blue-dark);
}
:root .cog-15 .cog-checkable--card .cog-choice-option.is-checked .el-checkbox__label,
:root .cog-15 .cog-checkable--card .cog-choice-option.is-checked .el-radio__label {
  color: var(--white);
}
:root .cog-15 .cog-checkable--card .cog-choice-option:has(input:focus-visible) {
  outline: 2px solid var(--brand-blue);
  outline-offset: 3px;
}
/* Long answers (e.g. "What best describes how your company works?") stack */
:root .cog-15 .cog-choice--radiobuttons .el-radio-group,
:root .cog-15 .cog-choice--checkboxes .el-checkbox-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 11px;
}
/* Short sets — Yes/No and the two invoice dates — sit in a row */
:root .cog-15 .cog-yesno .el-radio-group,
:root .cog-15 .cog-yesno .el-checkbox-group,
:root .cog-15 .cog-choice--checkboxes .el-checkbox-group:has(> :nth-child(2):last-child) {
  flex-direction: row;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-6);
}

/* Rating scale table: scrolls inside its own container */
:root .cog-15 .cog-rating-scale,
:root .cog-15 .cog-field:has(> .cog-input table) .cog-input {
  max-width: 100%;
  overflow-x: auto;
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(to right, var(--white) 30%, rgba(255, 255, 255, 0)) left / 24px 100% no-repeat local,
    linear-gradient(to left, var(--white) 30%, rgba(255, 255, 255, 0)) right / 24px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, 0.12), transparent) left / 10px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, 0.12), transparent) right / 10px 100% no-repeat scroll;
}
:root .cog-15 .cog-rating-scale > .cog-section__inner {
  padding-bottom: 0;
}
:root .cog-15 .cog-rating-scale .cog-section__heading {
  margin: 0 0 var(--space-2);
  padding: 0;
  border: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.4;
}
:root .cog-15 table {
  border-collapse: collapse;
  width: 100%;
  min-width: 520px;
  font-size: 14px;
}
:root .cog-15 table th {
  /* A deeper brand-blue shade keeps compact white header text readable. */
  background: var(--brand-blue-dark);
  color: var(--white);
  font-weight: 600;
  font-size: 14px;
  line-height: 1.3;
  padding: 10px var(--space-2);
  border-right: var(--border-width) solid rgba(255, 255, 255, 0.25);
}
:root .cog-15 table th:last-child { border-right: 0; }
/* Row labels are headings too, but only the column header band is blue. */
:root .cog-15 table th.cog-rating-scale__question {
  background: var(--white);
  color: var(--text);
  font-size: 14px;
  font-weight: 400;
  border-right: var(--border-width) solid var(--border);
  border-top: var(--border-width) solid var(--border);
}
:root .cog-15 table td {
  padding: 10px var(--space-2);
  border-top: var(--border-width) solid var(--border);
  text-align: center;
}
:root .cog-15 table td:first-child,
:root .cog-15 table th:first-child { text-align: left; }
:root .cog-15 table tbody tr:nth-child(even) td { background: #f2f8fc; }
:root .cog-15 table tbody tr:nth-child(even) th.cog-rating-scale__question { background: #f2f8fc; }
:root .cog-15 table tbody tr:hover td { background: #e8f4fa; }

/* Validation */
:root .cog-15 .cog-error-message {
  margin-top: var(--space-1);
  padding: 6px var(--space-3);
  background: var(--error-bg);
  color: var(--error-text);
  border-left: 3px solid var(--error-text);
  border-radius: 6px;
  font-size: 14px;
  white-space: normal;
}

/* Buttons */
:root .cog-15 .cog-button {
  min-height: 50px;
  padding: var(--space-2) var(--space-6);
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  white-space: normal;
  transition: background-color 0.15s ease, transform 0.1s ease;
}
:root .cog-15 .cog-button--primary,
:root .cog-15 .cog-button--submit,
:root .cog-15 .cog-button--next {
  background: var(--brand-blue);
  border: var(--border-width) solid var(--brand-blue);
  color: var(--white);
  box-shadow: var(--shadow-sm);
  /* #159cd3 with white is ~3.1:1, so action text is large bold (19px/700) to meet AA large-text 3:1 */
  font-size: 19px;
  font-weight: 700;
}
:root .cog-15 .cog-button--primary:hover,
:root .cog-15 .cog-button--submit:hover,
:root .cog-15 .cog-button--next:hover { background: var(--brand-blue-dark); border-color: var(--brand-blue-dark); }
:root .cog-15 .cog-button--secondary,
:root .cog-15 .cog-button--back {
  background: var(--white);
  border: var(--border-width) solid var(--border-strong);
  color: var(--brand-grey-dark);
}
:root .cog-15 .cog-button--secondary:hover,
:root .cog-15 .cog-button--back:hover { background: var(--surface-muted); }
:root .cog-15 .cog-button:focus-visible {
  outline: 3px solid var(--brand-blue);
  outline-offset: 2px;
}
:root .cog-15 .cog-button:active { transform: translateY(1px); }
:root .cog-15 .cog-page__navigation { gap: var(--space-3); flex-wrap: wrap; }

/* ---------- 7. Support panel ---------- */
.support {
  max-width: var(--content-width);
  margin: var(--space-7) auto 0;
  padding: var(--space-5) var(--space-6);
  background: #e6f4fb;
  border: var(--border-width) solid #c5e5f3;
  border-left: 4px solid var(--brand-blue);
  border-radius: var(--radius-md);
  font-size: 15px;
}
@media (max-width: calc(900px + 32px)) { .support { margin-left: var(--space-4); margin-right: var(--space-4); } }
.support h2 { margin: 0 0 var(--space-2); font-size: 18px; font-weight: 700; color: var(--text); }
.support p { margin: 0 0 var(--space-4); color: var(--brand-grey-dark); }
.support__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-6);
  margin: 0;
  padding: 0;
  list-style: none;
}
.support__term { color: var(--brand-grey-dark); font-weight: 600; margin-right: var(--space-1); }
.support a { font-weight: 600; overflow-wrap: anywhere; }

/* ---------- 8. Footer ---------- */
.site-footer {
  background: var(--footer-bg);
  color: #e4e5e6;
  /* Single brand detail: thin four-colour line above footer */
  border-top: 4px solid transparent;
  border-image: linear-gradient(to right, var(--brand-blue) 0 25%, var(--brand-orange) 25% 50%, var(--brand-red) 50% 75%, var(--brand-green) 75% 100%) 1;
  font-size: 14px;
}
.site-footer__inner {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 40px var(--space-4) 44px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--space-6);
  align-items: center;
}
.site-footer__logo { width: 150px; margin: -12px -10px; }
.site-footer p { margin: 0 0 var(--space-1); }
.site-footer__company { font-weight: 600; color: var(--white); }
.site-footer p + p { color: #d3d4d6; }
.site-footer a { color: var(--white); overflow-wrap: anywhere; text-underline-offset: 3px; transition: color 0.15s ease; }
.site-footer a:hover { color: #5cc3ec; }
.site-footer__legal { display: flex; flex-direction: column; gap: var(--space-1); text-align: right; }
.legal-pending { color: #c9cacb; font-style: normal; }

/* ---------- 9. Responsive ---------- */
@media (max-width: 768px) {
  .intro { padding: 40px var(--gutter) 48px; }
  .form-area { margin-top: var(--space-5); padding: 0 var(--space-3); }
  .support { padding: var(--space-4) var(--space-5); }
  :root .cog-15 { padding: var(--space-5) var(--space-4); border-radius: 14px; }
  .site-footer__inner { grid-template-columns: 1fr; gap: var(--space-4); }
  .site-footer__legal { text-align: left; }
}

@media (max-width: 480px) {
  .site-header__logo { width: 150px; }
  :root .cog-15 { padding: var(--space-4) var(--space-3); border-radius: 12px; }
  :root .cog-15 .cog-input input:not([type="checkbox"]):not([type="radio"]),
  :root .cog-15 .cog-input select,
  :root .cog-15 .cog-input textarea,
  :root .cog-15 .el-input__inner { font-size: 16px; }
  :root .cog-15 .cog-choice--checkboxes .el-checkbox-group:has(> :nth-child(2):last-child) { flex-direction: column; }
  :root .cog-15 .cog-button { width: 100%; }
  .support { padding: var(--space-4); }
}

/* ---------- 10. Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none; animation: none; scroll-behavior: auto; }
}
