/* ===============================================
   CRISPeR — design system
   Blue palette · Inter type · modern professional
   =============================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* Blue palette — sky → mid → deep */
  --sky-50:  #f0f9ff;
  --sky-100: #e0f2fe;
  --sky-200: #bae6fd;
  --sky-400: #38bdf8;
  --sky-500: #0ea5e9;
  --sky-600: #0284c7;

  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-800: #1e40af;
  --blue-900: #1e3a8a;

  /* Neutrals with subtle cool tint */
  --slate-50:  #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  /* Semantic */
  --brand:         var(--blue-600);
  --brand-hover:   var(--blue-700);
  --brand-strong:  var(--blue-800);
  --accent:        var(--sky-500);
  --text:          var(--slate-900);
  --text-dim:      var(--slate-500);
  --border:        var(--slate-200);
  --bg:            var(--slate-50);
  --bg-elevated:   #ffffff;
  --danger:        #dc2626;
  --danger-bg:     #fef2f2;
  --danger-border: #fecaca;
  --success:       #059669;
  --success-bg:    #ecfdf5;
  --success-border:#a7f3d0;
  --info-bg:       var(--sky-50);
  --info-border:   var(--sky-200);
  --info-text:     var(--blue-800);

  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 40px -12px rgba(30, 64, 175, 0.12), 0 8px 16px -8px rgba(15, 23, 42, 0.05);
  --shadow-focus: 0 0 0 4px rgba(59, 130, 246, 0.15);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--text);
  background:
    radial-gradient(ellipse at top, var(--sky-50) 0%, transparent 60%),
    linear-gradient(180deg, #ffffff 0%, var(--slate-50) 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  letter-spacing: -0.005em;
}

/* Typography */
h1, h2, h3 {
  margin: 0;
  letter-spacing: -0.02em;
  font-weight: 700;
  color: var(--slate-900);
}
h1 { font-size: 1.4rem; line-height: 1.2; }
h2 { font-size: 0.95rem; line-height: 1.4; color: var(--slate-700); font-weight: 600; }
p { margin: 0.25rem 0; line-height: 1.5; }
.dim { color: var(--text-dim); }
.small { font-size: 0.85rem; }
a { color: var(--brand); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--brand-hover); }

/* Wordmark — CRISPeR with subtle accent on the lowercase 'e' */
.wordmark {
  /* inline-block (not flex) — text nodes inside flex become separate items
     which caused a visible gap between "Crisp" and the .er span */
  display: inline-block;
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.035em;
  color: var(--slate-900);
  margin: 0;
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
}
.wordmark .mark {
  display: inline-block;
  width: 20px; height: 20px;
  background: linear-gradient(135deg, var(--sky-500) 0%, var(--blue-600) 100%);
  border-radius: 6px;
  position: relative;
  vertical-align: -0.2em;
  margin-right: 0.4rem;
  box-shadow: 0 3px 10px -3px rgba(37, 99, 235, 0.4);
}
.wordmark .mark::before {
  content: '';
  position: absolute;
  inset: 4px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 2px;
  border-right-color: transparent;
  border-bottom-color: transparent;
  transform: rotate(45deg);
}
.wordmark .e {
  color: var(--brand);
  font-weight: 800;
}
.wordmark .er {
  color: #22c55e;
  font-weight: 800;
}

/* Cards */
.landing, .card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.4rem;
  max-width: 380px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}
.landing { text-align: center; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: -0.005em;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.05s, box-shadow 0.15s, background 0.15s, border-color 0.15s;
  flex: 1;
  min-height: 38px;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(180deg, var(--blue-600) 0%, var(--blue-700) 100%);
  color: white;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 4px 10px -2px rgba(37, 99, 235, 0.35);
}
.btn-primary:hover {
  background: linear-gradient(180deg, var(--blue-700) 0%, var(--blue-800) 100%);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 6px 14px -2px rgba(37, 99, 235, 0.45);
}
.btn-outline {
  background: var(--bg-elevated);
  color: var(--brand);
  border-color: var(--border);
}
.btn-outline:hover {
  border-color: var(--brand);
  background: var(--sky-50);
}
.btn-block { width: 100%; margin-top: 0.25rem; }

/* Button row */
.btn-row { display: flex; gap: 0.5rem; margin: 1.1rem 0 0.9rem; flex-wrap: wrap; }

/* Landing tagline */
.landing .tagline {
  color: var(--text-dim);
  margin: 0.35rem 0 0;
  font-size: 0.875rem;
}
.landing .wordmark { justify-content: center; margin-bottom: 0.5rem; }
.landing .footnote {
  margin-top: 0.5rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.75rem;
  line-height: 1.5;
}

/* Card header (login pages) */
.card-header { margin-bottom: 1.15rem; }
.card-header .wordmark { margin-bottom: 0.35rem; }
.card-header h2 {
  color: var(--slate-600);
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Forms */
form { display: flex; flex-direction: column; gap: 0.75rem; }
.field { display: flex; flex-direction: column; gap: 0.3rem; }

/* Title Case for every form label + fieldset legend across the whole app.
   CSS `capitalize` only touches the FIRST letter of each word — existing
   ALL-CAPS words (ABN, FMD, KFC, etc.) stay intact because their remaining
   letters are already uppercase. Nested helper text (.dim / .small /
   .subtle) opts back out so hints like "(required)" don't get capitalized. */
.field > label,
label[for],
fieldset > legend,
.contact-row-fields .field label,
.review-section-title,
.contacts-heading,
.acct-type,
.acct-type-static,
.acct-type-btn {
  text-transform: capitalize;
}
.field > label .dim,
.field > label .small,
.field > label .subtle,
label[for] .dim,
label[for] .small,
fieldset > legend .dim,
fieldset > legend .small,
fieldset > legend .subtle,
.review-section-title .subtle {
  text-transform: none;
}
label {
  font-weight: 500;
  font-size: 0.8rem;
  color: var(--slate-700);
  letter-spacing: -0.005em;
}
input[type="email"], input[type="password"], input[type="text"],
input[type="tel"], input[type="number"], input[type="search"], input[type="url"],
input[type="date"], input[type="time"], input[type="datetime-local"],
select, textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-elevated);
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
}
/* Kill the browser default inline-baseline gap that appears below textareas
   when they render as inline-block. This is the "invisible div" — a few px
   of phantom space that stacks below the textarea's rendered box. */
textarea { display: block; vertical-align: top; }
select {
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath fill='%2364748b' d='M6 7L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  padding-right: 2rem;
  cursor: pointer;
}
textarea { resize: none; min-height: 4rem; }
input::placeholder { color: var(--slate-400); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: var(--shadow-focus);
}
input:disabled, select:disabled, textarea:disabled { background: var(--slate-100); color: var(--text-dim); cursor: not-allowed; }

/* Messages */
.msg {
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  line-height: 1.45;
  margin-bottom: 0.9rem;
  border: 1px solid;
}
.msg-error   { background: var(--danger-bg);  color: var(--danger);   border-color: var(--danger-border); }
.msg-success { background: var(--success-bg); color: var(--success);  border-color: var(--success-border); }
.msg-info    { background: var(--info-bg);    color: var(--info-text); border-color: var(--info-border); }
.hidden { display: none; }

/* Footer link */
.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.85rem;
  color: var(--text-dim);
  font-size: 0.8rem;
  font-weight: 500;
}
.footer-link:hover { color: var(--brand); }

/* Focus visibility for accessibility */
button:focus-visible, a:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* Responsive tweaks */
@media (max-width: 480px) {
  .landing, .card { padding: 1.25rem 1.15rem; }
  h1 { font-size: 1.25rem; }
  .btn-row { flex-direction: column; }
}
