/* ==========================================================
   Wefix — design system
   Tokens, typography, layout, buttons, forms, shared components.
   Section-specific layouts: pages.css · motion: animations.css
   Breakpoints: responsive.css
   ========================================================== */

:root {
  /* Brand */
  --brand: #2596d0;
  --brand-hover: #1f8cc4;
  --brand-deep: #1a7aae;          /* text-safe blue on light backgrounds */
  --brand-soft: #e6f3fb;
  --brand-glow: rgba(37, 150, 208, 0.35);

  /* Navy / charcoal (contrast sections) */
  --navy: #0d1b2a;
  --navy-2: #13263a;
  --navy-line: rgba(255, 255, 255, 0.12);

  /* Neutrals */
  --bg: #f4f6f8;                  /* soft grey page background */
  --surface: #ffffff;
  --surface-2: #eef2f6;
  --ink: #13202c;                 /* primary text */
  --muted: #5a6672;               /* secondary text */
  --line: rgba(13, 27, 42, 0.1);
  --line-strong: rgba(13, 27, 42, 0.18);
  --on-brand: #0b1620;            /* text on blue buttons (AA) */

  /* Status */
  --danger: #b42318;
  --danger-soft: #fdecea;
  --success: #0f7b4b;
  --success-soft: #e7f6ee;
  --notice-soft: #fff4d6;
  --notice-ink: #6b4e00;

  /* Type scale */
  --fs-xs: 0.8rem;
  --fs-sm: 0.9rem;
  --fs-base: 1.0625rem;
  --fs-md: 1.2rem;
  --fs-lg: clamp(1.25rem, 2vw, 1.5rem);
  --fs-h3: clamp(1.25rem, 2vw, 1.5rem);
  --fs-h2: clamp(2rem, 4vw, 3.1rem);
  --fs-h1: clamp(2.6rem, 6.4vw, 5.25rem);
  --lh-tight: 1.05;
  --lh-body: 1.65;

  /* Spacing & shape */
  --space-section: clamp(4.5rem, 9vw, 7.5rem);
  --container: 1240px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 28px;
  --r-pill: 999px;

  /* Depth */
  --shadow-1: 0 1px 2px rgba(13, 27, 42, 0.06), 0 2px 8px rgba(13, 27, 42, 0.04);
  --shadow-2: 0 14px 40px rgba(13, 27, 42, 0.1);
  --shadow-3: 0 30px 70px rgba(13, 27, 42, 0.18);

  /* Motion */
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast: 0.2s;
  --dur: 0.55s;
  --dur-slow: 0.9s;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: var(--font);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 96px; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img, svg, video { display: block; max-width: 100%; height: auto; }
img { background: transparent; }
h1, h2, h3, h4 { margin: 0 0 0.5em; color: var(--ink); font-family: var(--font-display); line-height: 1.12; font-weight: 800; }
h1 { font-size: var(--fs-h1); line-height: var(--lh-tight); letter-spacing: -0.035em; }
h2 { font-size: var(--fs-h2); letter-spacing: -0.025em; }
h3 { font-size: var(--fs-h3); letter-spacing: -0.015em; }
h4 { font-size: var(--fs-md); }
p { margin: 0 0 1em; max-width: 66ch; }
ul, ol { margin: 0; padding: 0; }
a { color: var(--brand-deep); text-decoration-thickness: 1px; text-underline-offset: 4px; }
a:hover { color: var(--ink); }
strong { font-weight: 700; }
::selection { background: var(--brand); color: var(--on-brand); }

:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; border-radius: 6px; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- Layout ---------- */
.container { width: min(100% - var(--gutter) * 2, var(--container)); margin-inline: auto; }
.container--narrow { width: min(100% - var(--gutter) * 2, 880px); margin-inline: auto; }
.section { position: relative; padding-block: var(--space-section); }
.section--tight { padding-block: clamp(3rem, 6vw, 5rem); }
.section--white { background: var(--surface); }
.section--navy { background: var(--navy); color: #e8eef4; }
.section--navy h1, .section--navy h2, .section--navy h3, .section--navy h4 { color: #ffffff; }
.section--navy p { color: #b8c4d0; }
.section--tint { background: var(--brand-soft); }

.head { max-width: 760px; margin-bottom: clamp(2.5rem, 5vw, 3.75rem); }
.head--center { margin-inline: auto; text-align: center; }
.head--center p { margin-inline: auto; }
.head p { color: var(--muted); font-size: 1.05rem; }
.section--navy .head p { color: #b8c4d0; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 0.6rem;
  margin-bottom: 1rem;
  font-size: var(--fs-xs); font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--brand-deep);
}
.eyebrow::before { content: ""; width: 26px; height: 2px; background: var(--brand); border-radius: 2px; }
.section--navy .eyebrow { color: #7cc6ef; }
.lead { font-size: clamp(1.05rem, 1.6vw, 1.25rem); line-height: 1.6; color: var(--muted); }
.muted { color: var(--muted); }
.accent { color: var(--brand); }
.text-center { text-align: center; }
.stack > * + * { margin-top: 1rem; }

.grid { display: grid; gap: clamp(1rem, 2.4vw, 1.75rem); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ---------- Buttons ---------- */
.btn {
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
  min-height: 52px; padding: 0.85rem 1.6rem;
  border: 2px solid transparent; border-radius: var(--r-pill);
  font: inherit; font-weight: 700; font-size: 1rem; line-height: 1.1; text-decoration: none;
  cursor: pointer; white-space: nowrap;
  transition: color var(--dur-fast) var(--ease-soft), border-color var(--dur-fast) var(--ease-soft), transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-soft);
}
/* Fill-sweep hover (decorative layer, does not affect text colour fallback) */
.btn::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  transform: scaleX(0); transform-origin: left;
  transition: transform var(--dur) var(--ease-out);
  border-radius: inherit;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn[disabled] { opacity: 0.65; cursor: progress; transform: none; }

.btn--primary { background: var(--brand); color: var(--on-brand); box-shadow: 0 10px 30px -10px var(--brand-glow); }
.btn--primary::before { background: #ffffff; }
.btn--primary:hover { color: var(--navy); box-shadow: 0 16px 36px -10px var(--brand-glow); }
.btn--primary:hover::before { transform: scaleX(1); }

.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn--ghost::before { background: var(--ink); }
.btn--ghost:hover { color: #ffffff; border-color: var(--ink); }
.btn--ghost:hover::before { transform: scaleX(1); }

.btn--light { background: #ffffff; color: var(--navy); }
.btn--light::before { background: var(--brand-soft); }
.btn--light:hover { color: var(--navy); }
.btn--light:hover::before { transform: scaleX(1); }

.btn--on-navy { background: transparent; color: #ffffff; border-color: rgba(255,255,255,0.35); }
.btn--on-navy::before { background: #ffffff; }
.btn--on-navy:hover { color: var(--navy); border-color: #ffffff; }
.btn--on-navy:hover::before { transform: scaleX(1); }

.btn--small { min-height: 42px; padding: 0.55rem 1.15rem; font-size: 0.92rem; }
.btn--block { width: 100%; }

.btn__arrow { display: inline-block; transition: transform var(--dur-fast) var(--ease-out); }
.btn:hover .btn__arrow, .link-arrow:hover .btn__arrow { transform: translateX(4px); }

.link-arrow {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-weight: 700; text-decoration: none; color: var(--brand-deep);
}
.link-arrow .btn__arrow { font-size: 1.1em; }
.link-arrow:hover { color: var(--ink); }

/* ---------- Badges & chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.38rem 0.85rem; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--line);
  font-size: var(--fs-sm); font-weight: 600; color: var(--ink);
  box-shadow: var(--shadow-1);
}
.badge__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.tag {
  display: inline-block; padding: 0.3rem 0.7rem; border-radius: var(--r-xs);
  background: var(--brand-soft); color: var(--brand-deep);
  font-size: var(--fs-xs); font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
}
.tag--navy { background: var(--navy); color: #ffffff; }
.tag--notice { background: var(--notice-soft); color: var(--notice-ink); letter-spacing: 0.02em; text-transform: none; font-weight: 700; }

.chip-list { display: flex; flex-wrap: wrap; gap: 0.6rem; list-style: none; }
.chip-list li {
  padding: 0.5rem 0.95rem; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--line);
  font-size: 0.95rem; font-weight: 500;
  transition: border-color var(--dur-fast), color var(--dur-fast), background var(--dur-fast);
}
.chip-list li:hover { border-color: var(--brand); color: var(--brand-deep); background: var(--brand-soft); }
.section--navy .chip-list li { background: rgba(255,255,255,0.05); border-color: var(--navy-line); color: #e8eef4; }

.check-list { list-style: none; display: grid; gap: 0.75rem; }
.check-list li { position: relative; padding-left: 2rem; }
.check-list li::before {
  content: ""; position: absolute; left: 0.25rem; top: 0.5rem;
  width: 0.9rem; height: 0.9rem; border-radius: 50%;
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 2px var(--brand);
}
.check-list li::after {
  content: ""; position: absolute; left: 0.6rem; top: 0.72rem;
  width: 0.3rem; height: 0.15rem;
  border-left: 2px solid var(--brand-deep); border-bottom: 2px solid var(--brand-deep);
  transform: rotate(-45deg);
}

/* ---------- Icons (inline SVG, stroke-based) ---------- */
.icon { width: 26px; height: 26px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-tile {
  display: grid; place-items: center; flex: none;
  width: 52px; height: 52px; border-radius: 16px;
  background: var(--brand-soft); color: var(--brand-deep);
  transition: transform var(--dur) var(--ease-out), background var(--dur-fast), color var(--dur-fast);
}
.icon-tile--navy { background: var(--navy); color: #7cc6ef; }
.icon-tile--ghost { background: rgba(255,255,255,0.08); color: #7cc6ef; }

/* ---------- Surfaces ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-1); padding: clamp(1.4rem, 2.6vw, 2rem);
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out), border-color var(--dur-fast);
}
.panel:hover { transform: translateY(-4px); box-shadow: var(--shadow-2); border-color: rgba(37,150,208,0.35); }
.panel h3 { font-size: 1.2rem; margin-bottom: 0.45rem; }
.panel p { color: var(--muted); margin: 0; font-size: 0.98rem; }

.media { position: relative; overflow: hidden; border-radius: var(--r-md); background: var(--surface-2); }
.media img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 0.45rem; margin-bottom: 1.15rem; }
.field > label, .label { font-weight: 700; font-size: 0.95rem; color: var(--ink); }
.field .hint { font-size: var(--fs-sm); color: var(--muted); }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.field-row > .field { margin-bottom: 0; }

input, select, textarea {
  width: 100%; min-height: 52px; padding: 0.8rem 1rem;
  font: inherit; font-size: 1rem; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: var(--r-sm);
  transition: border-color var(--dur-fast) var(--ease-soft), box-shadow var(--dur-fast) var(--ease-soft), background var(--dur-fast);
}
input:hover, select:hover, textarea:hover { border-color: rgba(13,27,42,0.35); }
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(37,150,208,0.2); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); background: #fffafa; }
input[aria-invalid="false"], select[aria-invalid="false"] { border-color: var(--success); }
.field-error { min-height: 0; font-size: var(--fs-sm); color: var(--danger); display: flex; gap: 0.4rem; }
.field-error:empty { display: none; }
.field-error::before { content: "!"; display: inline-grid; place-items: center; flex: none; width: 17px; height: 17px; border-radius: 50%; background: var(--danger); color: #fff; font-size: 11px; font-weight: 800; margin-top: 0.1rem; }

.checkbox { flex-direction: row; align-items: flex-start; gap: 0.7rem; }
.checkbox input { width: 20px; min-height: 20px; margin-top: 0.2rem; accent-color: var(--brand); flex: none; }
.checkbox label { font-weight: 500; font-size: var(--fs-sm); color: var(--muted); }

.form-status { margin-top: 1.1rem; padding: 0.95rem 1.1rem; border-radius: var(--r-sm); font-size: 0.97rem; display: flex; gap: 0.7rem; align-items: flex-start; }
.form-status[hidden] { display: none; }
.form-status--error { background: var(--danger-soft); color: #7a1a12; }
.form-status--notice { background: var(--notice-soft); color: var(--notice-ink); }
.form-status--ok { background: var(--success-soft); color: #0a5c38; }

/* Icons inside buttons and footers */
.btn .icon { width: 18px; height: 18px; stroke-width: 2.2; }
.icon-tile .icon { width: 24px; height: 24px; }
.step .icon, .info-card .icon { color: var(--brand-deep); }

[hidden] { display: none !important; }
