/* ============================================================
   Revasser — Dispute Letter Generator
   Option A: warm cream / near-black / burgundy
   System font stack — zero external dependencies
   ============================================================ */

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Tokens ─────────────────────────────────────────────────── */
:root {
  --bg:          #f9f6f1;
  --bg-alt:      #f2ede5;
  --bg-form:     #ffffff;
  --text:        #1a1a1a;
  --text-mid:    #4a4a4a;
  --text-muted:  #767676;
  --accent:      #7c1e3c;
  --accent-dark: #5e1630;
  --accent-pale: #f5eaee;
  --border:      #d8d0c5;
  --border-focus:#7c1e3c;
  --error:       #b91c1c;
  --error-bg:    #fef2f2;
  --success:     #166534;
  --success-bg:  #f0fdf4;
  --radius:      4px;
  --radius-lg:   8px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
}

/* ── Base ───────────────────────────────────────────────────── */
html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
}

img, svg { display: block; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
a:hover { color: var(--accent-dark); }

/* ── Layout primitives ──────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 700px;
  margin-inline: auto;
  padding-inline: 24px;
}

.container--wide {
  max-width: 900px;
}

/* ── Skip link ──────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent);
  color: #fff;
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  z-index: 9999;
  border-radius: 0 0 var(--radius) 0;
  transition: top 0.15s;
}
.skip-link:focus { top: 0; }

/* ── Header ─────────────────────────────────────────────────── */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 18px;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.wordmark__logo {
  flex-shrink: 0;
}

.wordmark__text {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.site-nav a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-mid);
  text-decoration: none;
  letter-spacing: 0.01em;
}
.site-nav a:hover { color: var(--text); }

/* ── Hero ───────────────────────────────────────────────────── */
.hero {
  padding-block: 72px 56px;
  text-align: center;
}

.hero__eyebrow {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 20px;
}

.hero__h1 {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 20px;
  max-width: 560px;
  margin-inline: auto;
}

.hero__h1 em {
  font-style: italic;
  color: var(--accent);
}

.hero__sub {
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text-mid);
  max-width: 480px;
  margin-inline: auto;
  margin-bottom: 36px;
}

.btn-primary {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  padding: 15px 32px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
  letter-spacing: 0.005em;
}
.btn-primary:hover {
  background: var(--accent-dark);
  color: #fff;
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.hero__note {
  margin-top: 14px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* ── Steps strip ────────────────────────────────────────────── */
.steps {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding-block: 44px;
}

.steps__grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: start;
  gap: 16px;
}

.step {
  text-align: center;
}

.step__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.step__title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.3;
}

.step__desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.steps__arrow {
  color: var(--border);
  font-size: 1.25rem;
  align-self: start;
  padding-top: 16px;
}

/* ── Form section ───────────────────────────────────────────── */
.form-section {
  padding-block: 56px 72px;
}

.form-section__heading {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.form-section__sub {
  font-size: 0.9375rem;
  color: var(--text-mid);
  margin-bottom: 32px;
}

/* ── Form card ──────────────────────────────────────────────── */
.form-card {
  background: var(--bg-form);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 40px;
}

/* ── Field ──────────────────────────────────────────────────── */
.field {
  margin-bottom: 24px;
}

.field--half-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: 0.005em;
}

.field__hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
  margin-bottom: 0;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="date"],
.field input[type="number"],
.field textarea,
.charge-row input {
  width: 100%;
  padding: 10px 12px;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  line-height: 1.5;
  transition: border-color 0.12s, box-shadow 0.12s;
  -webkit-appearance: none;
  appearance: none;
}

.field input:focus,
.field textarea:focus,
.charge-row input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(124, 30, 60, 0.12);
  background: #fff;
}

.field input.has-error,
.field textarea.has-error,
.charge-row input.has-error {
  border-color: var(--error);
  background: var(--error-bg);
}

.field__error {
  font-size: 0.75rem;
  color: var(--error);
  margin-top: 5px;
  display: none;
}
.field__error.visible { display: block; }

.field textarea {
  min-height: 120px;
  resize: vertical;
}

.char-counter {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: right;
  margin-top: 4px;
}
.char-counter.near-limit { color: var(--accent); }

/* ── Charge rows ────────────────────────────────────────────── */
.charges-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
  letter-spacing: 0.005em;
}

.charges-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.charge-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: center;
}

.charge-row label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-mid);
  margin-bottom: 4px;
  display: block;
}

.charge-row__cell {
  display: flex;
  flex-direction: column;
}

.btn-remove-charge {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 9px 10px;
  margin-top: 22px;
  transition: border-color 0.12s, color 0.12s;
  flex-shrink: 0;
}
.btn-remove-charge:hover {
  border-color: var(--error);
  color: var(--error);
}
.btn-remove-charge:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn-remove-charge[hidden] { display: none; }

.btn-add-charge {
  background: none;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-mid);
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 8px 14px;
  transition: border-color 0.12s, color 0.12s;
  width: fit-content;
}
.btn-add-charge:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.btn-add-charge:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── File upload ────────────────────────────────────────────── */
.upload-zone {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--bg);
  position: relative;
}
.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-pale);
}
.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.upload-zone:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.upload-zone__icon {
  margin-inline: auto;
  margin-bottom: 10px;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
}

.upload-zone__text {
  font-size: 0.875rem;
  color: var(--text-mid);
  font-weight: 500;
}

.upload-zone__hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.file-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 12px;
  font-size: 0.8125rem;
  color: var(--text-mid);
}

.file-item__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 85%;
}

.file-item__size {
  color: var(--text-muted);
  flex-shrink: 0;
}

.upload-error {
  font-size: 0.75rem;
  color: var(--error);
  margin-top: 6px;
  display: none;
}
.upload-error.visible { display: block; }

/* ── Divider ────────────────────────────────────────────────── */
.form-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin-block: 28px;
}

/* ── Submit row ─────────────────────────────────────────────── */
.submit-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin-top: 8px;
}

.btn-submit {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  padding: 15px 32px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  letter-spacing: 0.005em;
}
.btn-submit:hover:not(:disabled) {
  background: var(--accent-dark);
  transform: translateY(-1px);
}
.btn-submit:active:not(:disabled) { transform: translateY(0); }
.btn-submit:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-submit__spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.btn-submit.is-loading .btn-submit__spinner { display: block; }
.btn-submit.is-loading .btn-submit__label { opacity: 0.8; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

.submit-legal {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 420px;
}

/* ── Confirmation ───────────────────────────────────────────── */
.confirmation {
  display: none;
  background: var(--success-bg);
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-lg);
  padding: 36px 40px;
  text-align: center;
}
.confirmation.visible { display: block; }

.confirmation__icon {
  width: 48px;
  height: 48px;
  margin-inline: auto;
  margin-bottom: 16px;
  color: var(--success);
}

.confirmation__heading {
  font-family: var(--font-serif);
  font-size: 1.375rem;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 10px;
}

.confirmation__body {
  font-size: 0.9375rem;
  color: var(--text-mid);
  line-height: 1.6;
}

.confirmation__email {
  font-weight: 600;
  color: var(--text);
}

/* ── Substrate strip ────────────────────────────────────────── */
.substrate {
  background: var(--text);
  color: #e8e2d8;
  padding-block: 48px;
}

.substrate__inner {
  max-width: 560px;
  margin-inline: auto;
  text-align: center;
}

.substrate__rule {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(232, 226, 216, 0.5);
  margin-bottom: 16px;
}

.substrate__body {
  font-size: 1rem;
  line-height: 1.7;
  color: #c8c0b4;
}

.substrate__body strong {
  color: #e8e2d8;
  font-weight: 600;
}

/* ── Footer ─────────────────────────────────────────────────── */
.site-footer {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  padding-block: 32px;
}

.site-footer__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 24px;
  list-style: none;
}

.footer-links a {
  font-size: 0.8125rem;
  color: var(--text-mid);
  text-decoration: none;
}
.footer-links a:hover { color: var(--accent); text-decoration: underline; }

.footer-legal {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 520px;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  .hero {
    padding-block: 48px 40px;
  }

  .hero__h1 {
    font-size: 2.125rem;
  }

  .field input, .field textarea, .charge-row input {
    padding: 12px 14px;
    font-size: 1rem;
  }

  .steps__grid {
    grid-template-columns: 1fr;
    gap: 28px;
    max-width: 320px;
    margin-inline: auto;
  }

  .steps__arrow {
    display: none;
  }

  .form-card {
    padding: 24px 20px;
  }

  .field--half-pair {
    grid-template-columns: 1fr;
  }

  .charge-row {
    grid-template-columns: 1fr 1fr;
  }

  .charge-row:last-of-type .btn-remove-charge {
    display: none;
  }

  .btn-remove-charge {
    margin-top: 22px;
  }
}

@media (max-width: 400px) {
  .charge-row {
    grid-template-columns: 1fr;
  }

  .btn-remove-charge {
    margin-top: 0;
    align-self: flex-end;
    width: fit-content;
  }
}
