/* ==========================================================================
   JalsaX client intake — brand system per DESIGN.md (jalsax.com)
   Satoshi, warm canvas, single pink accent (#cc0852 / dark #ee6c9b).
   Dark by default; light via .light on <html>, persisted in localStorage.
   ========================================================================== */

/* ---- Fonts (self-hosted) ---- */
@font-face {
  font-family: "Satoshi";
  src: url("fonts/Satoshi-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Satoshi";
  src: url("fonts/Satoshi-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Satoshi";
  src: url("fonts/Satoshi-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---- Tokens ---- */
:root {
  /* dark theme is the default (jalsax.com decision, 2026-07-17) */
  --background: oklch(0.205 0.008 80);
  --foreground: oklch(0.955 0.007 85);
  --muted-foreground: oklch(0.73 0.01 80);
  --card: oklch(0.25 0.009 80);
  --secondary: oklch(0.285 0.009 80);
  --border: rgba(255, 255, 255, 0.13);
  --input-border: rgba(255, 255, 255, 0.22);
  --primary: oklch(0.68 0.19 5);
  --primary-ink: #1a1512;
  --danger: #f2836f;
  --ok: #7fc48a;
  --shadow-color: rgba(0, 0, 0, 0.6);

  --radius-pill: 99px;
  --radius-input: 8px;
  --radius-tile: 14px;

  --gutter: 20px; /* mobile section gutter — documented exception */
  --measure: 44rem;

  --text-body: clamp(1rem, 0.92rem + 0.4vw, 1.125rem);
  --text-h1: clamp(1.75rem, 1.2rem + 2.4vw, 2.75rem);
  --text-h2: clamp(1.375rem, 1.2rem + 1.1vw, 1.75rem);
  --text-small: 0.875rem;
  --text-label: 0.9375rem;
}

html.light {
  --background: oklch(0.993 0.0045 85);
  --foreground: oklch(0.235 0.006 80);
  --muted-foreground: oklch(0.5 0.008 80);
  --card: #ffffff;
  --secondary: oklch(0.972 0.006 85);
  --border: oklch(0.235 0.01 80 / 0.11);
  --input-border: oklch(0.235 0.01 80 / 0.24);
  --primary: oklch(0.54 0.21 5);
  --primary-ink: #ffffff;
  --danger: #c4331d;
  --ok: #1d7a35;
  --shadow-color: rgba(26, 24, 20, 0.28);
}

/* ---- Reset ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  font-family: "Satoshi", ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    sans-serif;
  font-size: var(--text-body);
  line-height: 1.55;
  color: var(--foreground);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
}
h1,
h2,
h3,
p,
fieldset,
figure,
dl {
  margin: 0;
}
fieldset {
  border: 0;
  padding: 0;
  min-inline-size: 0;
}
legend {
  padding: 0;
}
img,
svg,
video {
  display: block;
  max-width: 100%;
}
button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* the hidden attribute always wins over class display values */
[hidden] {
  display: none !important;
}

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

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -56px;
  z-index: 60;
  background: var(--card);
  color: var(--foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 10px 18px;
  text-decoration: none;
  transition: top 150ms ease-out;
}
.skip-link:focus-visible {
  top: 12px;
}

/* ---- Header ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--background);
  border-bottom: 1px solid var(--border);
}
.site-header__row {
  max-width: var(--measure);
  margin-inline: auto;
  padding: 10px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.logo {
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.03em;
  color: var(--foreground);
  text-decoration: none;
}
.logo b {
  font-weight: 700;
  color: var(--primary);
}
.header-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}
.draft-note {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}
@media (max-width: 480px) {
  .draft-note {
    display: none;
  }
}
.theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  color: var(--muted-foreground);
  transition: color 150ms ease-out, background-color 150ms ease-out;
}
.theme-btn:hover {
  color: var(--foreground);
  background: var(--secondary);
}
html:not(.light) .theme-btn .icon-moon {
  display: none;
}
html.light .theme-btn .icon-sun {
  display: none;
}

.progress-track {
  height: 2px;
  background: var(--border);
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  transition: width 240ms ease-out;
}

/* ---- Layout ---- */
.page {
  max-width: var(--measure);
  margin-inline: auto;
  padding: clamp(28px, 5vw, 56px) var(--gutter) clamp(64px, 8vw, 112px);
}

.step-eyebrow {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
}
.step-title {
  font-size: var(--text-h2);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-top: 8px;
}
.step-intro .step-title {
  font-size: var(--text-h1);
}
.step-desc {
  margin-top: 12px;
  color: var(--muted-foreground);
  max-width: 60ch;
}

/* step visibility + entrance */
.step {
  display: none;
}
.step.active {
  display: block;
  animation: step-in 240ms ease-out;
}
@keyframes step-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---- Fields ---- */
.field-stack {
  margin-top: clamp(24px, 4vw, 40px);
  display: grid;
  gap: 24px;
}
.field-row {
  display: grid;
  gap: 24px;
}
@media (min-width: 560px) {
  .field-row {
    grid-template-columns: 1fr 1fr;
  }
}

.field {
  display: grid;
  gap: 8px;
}
.field-label {
  font-size: var(--text-label);
  font-weight: 500;
}
.field-hint {
  font-size: var(--text-small);
  color: var(--muted-foreground);
  font-weight: 400;
}
.req {
  color: var(--primary);
}

.text-input,
.select-input,
.textarea-input {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-input);
  padding: 12px 14px;
  font-size: 16px; /* prevents iOS zoom */
  line-height: 1.4;
  min-height: 48px;
  transition: border-color 150ms ease-out;
}
.textarea-input {
  resize: vertical;
  min-height: 120px;
}
.text-input::placeholder,
.textarea-input::placeholder {
  color: var(--muted-foreground);
  opacity: 0.72;
}
.text-input:focus,
.select-input:focus,
.textarea-input:focus {
  outline: 2px solid var(--primary);
  outline-offset: 0;
  border-color: transparent;
}
.select-input {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23888480' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

.field.has-error .text-input,
.field.has-error .select-input,
.field.has-error .textarea-input {
  border-color: var(--danger);
}
.field-error {
  display: none;
  font-size: var(--text-small);
  color: var(--danger);
}
.field.has-error .field-error {
  display: block;
}

/* ---- Choice chips (radio + checkbox) ---- */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-pill);
  background: var(--card);
  font-size: var(--text-small);
  font-weight: 500;
  cursor: pointer;
  transition: border-color 150ms ease-out, background-color 150ms ease-out,
    color 150ms ease-out;
  -webkit-tap-highlight-color: transparent;
}
.chip input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}
.chip:hover {
  background: var(--secondary);
}
.chip:has(input:checked) {
  border-color: var(--primary);
  color: var(--primary);
}
.chip:has(input:focus-visible) {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ---- Dropzones + file list ---- */
.dropzone {
  position: relative;
  border: 1.5px dashed var(--input-border);
  border-radius: var(--radius-tile);
  background: var(--card);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 150ms ease-out, background-color 150ms ease-out;
}
.dropzone:hover,
.dropzone.dragover {
  border-color: var(--primary);
}
.dropzone.dragover {
  background: var(--secondary);
}
.dropzone-icon {
  display: inline-flex;
  color: var(--muted-foreground);
}
.dropzone-title {
  margin-top: 10px;
  font-weight: 500;
}
.dropzone-title b {
  color: var(--primary);
  font-weight: 500;
}
.dropzone-sub {
  margin-top: 4px;
  font-size: var(--text-small);
  color: var(--muted-foreground);
}
.dropzone input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.file-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.file-card {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  background: var(--card);
  padding: 8px 10px;
}
.file-thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--secondary);
  flex: none;
}
.file-doc {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background: var(--secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-foreground);
  flex: none;
}
.file-meta {
  min-width: 0;
  flex: 1;
}
.file-name {
  font-size: var(--text-small);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-status {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}
.file-status.is-error {
  color: var(--danger);
}
.file-status.is-done {
  color: var(--ok);
}
.file-bar {
  height: 3px;
  border-radius: 2px;
  background: var(--border);
  margin-top: 6px;
  overflow: hidden;
}
.file-bar i {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--primary);
  transition: width 200ms ease-out;
}
.file-remove,
.file-retry {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  color: var(--muted-foreground);
  transition: color 150ms ease-out, background-color 150ms ease-out;
}
.file-remove:hover {
  color: var(--danger);
  background: var(--secondary);
}
.file-retry {
  color: var(--primary);
}
.file-retry:hover {
  background: var(--secondary);
}

/* ---- Step actions ---- */
.step-actions {
  margin-top: clamp(32px, 5vw, 48px);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 26px;
  border-radius: var(--radius-pill);
  font-weight: 500;
  font-size: 1rem;
  text-decoration: none;
  transition: background-color 150ms ease-out, color 150ms ease-out,
    transform 150ms ease-out, border-color 150ms ease-out, filter 150ms ease-out;
  -webkit-tap-highlight-color: transparent;
}
.btn:active {
  transform: translateY(1px);
}
.btn-primary {
  background: var(--primary);
  color: var(--primary-ink);
  font-weight: 700;
}
.btn-primary:hover {
  filter: brightness(1.06);
}
.btn-primary[disabled] {
  opacity: 0.55;
  cursor: default;
}
.btn-ghost {
  border: 1px solid var(--input-border);
  color: var(--foreground);
}
.btn-ghost:hover {
  background: var(--secondary);
}
@media (max-width: 480px) {
  .step-actions .btn-primary {
    flex: 1;
  }
}

/* ---- Review / declaration ---- */
.review-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-tile);
  background: var(--card);
  padding: 20px;
  display: grid;
  gap: 10px;
}
.review-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: var(--text-small);
}
.review-line dt {
  color: var(--muted-foreground);
  flex: none;
}
.review-line dd {
  margin: 0;
  font-weight: 500;
  text-align: right;
  overflow-wrap: anywhere;
}
.declaration {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-tile);
  background: var(--card);
  padding: 16px;
  cursor: pointer;
  transition: border-color 150ms ease-out;
}
.declaration:has(input:checked) {
  border-color: var(--primary);
}
.declaration input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--primary);
  flex: none;
}
.field.has-error .declaration {
  border-color: var(--danger);
}

/* submit progress + result */
.submit-note {
  margin-top: 12px;
  font-size: var(--text-small);
  color: var(--muted-foreground);
}
.submit-note.is-error {
  color: var(--danger);
}

/* ---- Done screen ---- */
.done-mark {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: var(--primary-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.done-list {
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
  color: var(--muted-foreground);
}
.done-list li {
  display: flex;
  gap: 10px;
  align-items: baseline;
}
.done-list li::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  flex: none;
  transform: translateY(-2px);
}

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px var(--gutter);
}
.site-footer p {
  max-width: var(--measure);
  margin-inline: auto;
  font-size: var(--text-small);
  color: var(--muted-foreground);
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
