/* ============================================================
   InvoiceNudge — styles
   Palette: deep ink + electric "paid" green + warm signal amber
   Type: Sora (display) / Inter (body)
   ============================================================ */

:root {
  /* palette */
  --ink: #0f1724;          /* near-black navy */
  --ink-2: #1c2738;
  --slate: #475569;
  --mute: #64748b;
  --line: #e2e8f0;
  --paper: #ffffff;
  --bg: #f6f8fb;
  --bg-tint: #eef2f8;

  --brand: #16a34a;        /* paid green */
  --brand-600: #15803d;
  --brand-50: #ecfdf3;
  --accent: #f59e0b;       /* signal amber for level escalation */
  --accent-50: #fff7ed;

  /* level accents */
  --lv1: #16a34a;
  --lv2: #d97706;
  --lv3: #dc2626;
  --lv1-bg: #ecfdf3;
  --lv2-bg: #fff7ed;
  --lv3-bg: #fef2f2;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15,23,36,.06), 0 8px 24px rgba(15,23,36,.06);
  --shadow-lg: 0 24px 60px rgba(15,23,36,.12);

  --maxw: 1120px;
  --ff-display: "Sora", system-ui, sans-serif;
  --ff-body: "Inter", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

body {
  margin: 0;
  font-family: var(--ff-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 20px; }

h1, h2, h3 { font-family: var(--ff-display); line-height: 1.12; letter-spacing: -.02em; margin: 0; }

a { color: var(--brand-600); }

/* ---------- accessibility helpers ---------- */
.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: -999px; top: 0; z-index: 100;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
  font-weight: 600; text-decoration: none;
}
.skip-link:focus { left: 0; }

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

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--ff-display); font-weight: 600; font-size: .98rem;
  padding: 12px 20px; border-radius: var(--radius-sm); border: 1.5px solid transparent;
  cursor: pointer; text-decoration: none; transition: transform .12s ease, box-shadow .15s ease, background .15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 18px rgba(22,163,74,.28); }
.btn-primary:hover { background: var(--brand-600); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--bg-tint); }
.btn-block { width: 100%; }
.btn-sm { padding: 9px 14px; font-size: .9rem; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(246,248,251,.86); backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  background: var(--ink); color: var(--brand);
}
.brand-name { font-family: var(--ff-display); font-weight: 800; font-size: 1.2rem; letter-spacing: -.02em; }
.brand-accent { color: var(--brand); }
.header-nav { display: flex; align-items: center; gap: 22px; }
.header-nav a { color: var(--slate); text-decoration: none; font-weight: 500; font-size: .95rem; }
.header-nav a:hover { color: var(--ink); }
.header-cta { color: var(--brand-600) !important; font-weight: 600 !important; }
@media (max-width: 680px) {
  .header-nav a:not(.header-cta) { display: none; }
}

/* ---------- hero ---------- */
.hero {
  background:
    radial-gradient(1200px 400px at 80% -10%, rgba(22,163,74,.10), transparent 60%),
    radial-gradient(900px 360px at 0% 0%, rgba(245,158,11,.08), transparent 55%),
    var(--bg);
  padding: 72px 0 56px;
}
.eyebrow {
  display: inline-block; font-family: var(--ff-display); font-weight: 600; font-size: .8rem;
  letter-spacing: .08em; text-transform: uppercase; color: var(--brand-600);
  background: var(--brand-50); padding: 6px 12px; border-radius: 999px; margin: 0 0 18px;
}
.hero h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); font-weight: 800; max-width: 16ch; }
.lede { font-size: clamp(1.05rem, 2vw, 1.22rem); color: var(--slate); max-width: 60ch; margin: 18px 0 28px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-badges {
  list-style: none; display: flex; flex-wrap: wrap; gap: 18px;
  padding: 0; margin: 30px 0 0; color: var(--slate); font-size: .95rem; font-weight: 500;
}

/* ---------- how ---------- */
.how { padding: 64px 0; }
.section-title { font-size: clamp(1.6rem, 3.4vw, 2.2rem); font-weight: 700; text-align: center; margin-bottom: 38px; }
.how-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.how-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px 24px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.how-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; }
.how-card:nth-child(1)::before { background: var(--lv1); }
.how-card:nth-child(2)::before { background: var(--lv2); }
.how-card:nth-child(3)::before { background: var(--lv3); }
.how-num {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  font-family: var(--ff-display); font-weight: 700; font-size: 1.1rem; color: var(--ink);
  background: var(--bg-tint); margin-bottom: 14px;
}
.how-card h3 { font-size: 1.18rem; font-weight: 700; margin-bottom: 8px; }
.how-card p { color: var(--slate); margin: 0; font-size: .98rem; }
@media (max-width: 800px) { .how-grid { grid-template-columns: 1fr; } }

/* ---------- generator layout ---------- */
.generator { padding: 8px 0 72px; }
.gen-grid { display: grid; grid-template-columns: 420px 1fr; gap: 28px; align-items: start; }
@media (max-width: 940px) { .gen-grid { grid-template-columns: 1fr; } }

.card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.form-card { padding: 26px 24px; position: sticky; top: 80px; }
@media (max-width: 940px) { .form-card { position: static; } }

.card-title { font-size: 1.35rem; font-weight: 700; }
.card-sub { color: var(--mute); font-size: .92rem; margin: 6px 0 20px; }

/* ---------- form fields ---------- */
.field { margin-bottom: 16px; }
.field > label, .field legend, .sub-label {
  display: block; font-weight: 600; font-size: .9rem; margin-bottom: 7px; color: var(--ink-2);
}
.field legend { padding: 0; }
.muted { color: var(--mute); font-weight: 400; }
.req { color: var(--lv3); }
.hint { font-size: .82rem; color: var(--mute); margin: 6px 0 0; }

input[type="text"], input[type="email"], input[type="number"], input[type="date"], select {
  width: 100%; padding: 11px 13px; font-family: var(--ff-body); font-size: 1rem; color: var(--ink);
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  transition: border-color .14s ease, box-shadow .14s ease;
}
input:focus, select:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(22,163,74,.16);
}
input::placeholder { color: #9aa6b6; }

.field-row { display: grid; grid-template-columns: 1fr 1.2fr; gap: 14px; }
.amount-group { display: grid; grid-template-columns: 96px 1fr; gap: 8px; }
.amount-group select { padding-inline: 8px; }
@media (max-width: 420px) { .field-row { grid-template-columns: 1fr; } }

/* chips (radio toggles) */
.timing-toggle, .tone-toggle { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chip span {
  display: inline-block; padding: 9px 14px; border: 1.5px solid var(--line); border-radius: 999px;
  font-size: .9rem; font-weight: 600; color: var(--slate); background: #fff; cursor: pointer;
  transition: all .14s ease; user-select: none;
}
.chip input:checked + span { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip input:focus-visible + span { outline: 3px solid var(--brand); outline-offset: 2px; }
.chip span:hover { border-color: var(--mute); }

.timing-field, .tone-field { border: 0; padding: 0; margin-bottom: 16px; }
.timing-pane { margin-top: 12px; }
.sub-label { font-weight: 500; font-size: .85rem; color: var(--slate); }

.form-actions { margin-top: 22px; }
.form-error {
  margin: 12px 0 0; color: var(--lv3); font-size: .9rem; font-weight: 500;
  background: var(--lv3-bg); border: 1px solid #fecaca; padding: 10px 12px; border-radius: var(--radius-sm);
}

/* ---------- output ---------- */
.output-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; }

.empty-state {
  padding: 48px 28px; text-align: center; color: var(--slate);
  border-style: dashed;
}
.empty-illus { font-size: 2.4rem; margin-bottom: 10px; }
.empty-state p { margin: 0 auto; max-width: 40ch; }
.empty-sub { color: var(--mute); font-size: .9rem; margin-top: 12px !important; }

.results { display: grid; gap: 18px; }

.email-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.email-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 0; }
.level-tag {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--ff-display); font-weight: 700; font-size: .82rem;
  padding: 5px 11px; border-radius: 999px; letter-spacing: .01em;
}
.level-1 { color: var(--lv1); background: var(--lv1-bg); }
.level-2 { color: var(--lv2); background: var(--lv2-bg); }
.level-3 { color: var(--lv3); background: var(--lv3-bg); }
.level-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

.send-when { font-size: .82rem; color: var(--mute); font-weight: 500; text-align: right; }

.email-card h3 { font-size: 1.15rem; font-weight: 700; padding: 12px 20px 0; }

.email-meta { padding: 12px 20px 0; }
.subject-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-tint); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.subject-label { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); }
.subject-text { flex: 1; font-weight: 600; color: var(--ink); font-size: .96rem; }

.email-body {
  margin: 14px 20px 0; padding: 16px; background: #fbfdff; border: 1px solid var(--line);
  border-radius: var(--radius-sm); white-space: pre-wrap; font-size: .96rem; color: var(--ink-2);
  line-height: 1.65; font-family: var(--ff-body);
}

.email-actions {
  display: flex; flex-wrap: wrap; gap: 10px; padding: 16px 20px 20px;
}
.copy-btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--ff-display); font-weight: 600; font-size: .88rem;
  padding: 9px 14px; border-radius: var(--radius-sm); border: 1.5px solid var(--line);
  background: #fff; color: var(--ink); cursor: pointer; transition: all .14s ease;
}
.copy-btn:hover { background: var(--bg-tint); border-color: var(--mute); }
.copy-btn.copied { background: var(--brand-50); border-color: var(--brand); color: var(--brand-600); }

/* ---------- capture ---------- */
.capture { background: var(--ink); color: #fff; padding: 56px 0; }
.capture-inner { display: grid; grid-template-columns: 1.1fr 1fr; gap: 36px; align-items: center; }
.capture-text h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700; margin-bottom: 12px; }
.capture-text p { color: #c2cddc; margin: 0; }
.capture-form { display: grid; gap: 12px; }
.capture-form input {
  background: #fff; border-color: transparent; padding: 14px 16px;
}
.capture-note { font-size: .82rem; color: #93a2b8; margin: 2px 0 0; }
.capture-note.success { color: #6ee7a8; font-weight: 600; }
@media (max-width: 820px) { .capture-inner { grid-template-columns: 1fr; } }

/* ---------- PV CTA ---------- */
.pv-cta { padding: 64px 0; text-align: center; background: var(--bg-tint); }
.pv-inner h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700; margin-bottom: 12px; }
.pv-inner p { color: var(--slate); max-width: 60ch; margin: 0 auto 24px; }

/* ---------- footer ---------- */
.site-footer { background: var(--ink); color: #c2cddc; padding: 32px 0; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: center; }
.footer-built { font-family: var(--ff-display); font-weight: 600; color: #fff; margin: 0; }
.footer-built a { color: var(--brand); text-decoration: none; }
.footer-built a:hover { text-decoration: underline; }
.footer-fine { font-size: .85rem; color: #8295ad; margin: 0; max-width: 46ch; }

/* ============================================================
   PRINT — clean PDF of all three emails
   ============================================================ */
@media print {
  .no-print, .site-header, .hero, .how, .form-card, .empty-state,
  .capture, .pv-cta, .site-footer, .skip-link { display: none !important; }

  body { background: #fff; color: #000; font-size: 11pt; }
  .generator { padding: 0; }
  .gen-grid { display: block; }
  .output-col { display: block; }
  #results-title { font-size: 18pt; margin-bottom: 12pt; }

  .email-card {
    box-shadow: none; border: 1px solid #bbb; break-inside: avoid; page-break-inside: avoid;
    margin-bottom: 18pt;
  }
  .email-actions { display: none !important; }
  .email-body { background: #fff; border-color: #ccc; }
  .send-when { color: #444; }
  a[href]::after { content: ""; }
}
