/* CreditPlum — design tokens
   Signature: a plum "ripeness" approval meter. Brand color is literally plum.
   Trustworthy but warm; deliberately not the cream-serif fintech default. */

:root {
  --ink: #1d1a26;          /* near-black with a plum undertone */
  --ink-soft: #4a4553;
  --paper: #faf8f6;        /* soft warm white, slightly cool of cream */
  --card: #ffffff;
  --line: #ece7ef;

  --plum: #7a2e63;         /* primary brand */
  --plum-deep: #5c1f4a;
  --plum-tint: #f4e9f1;
  --plum-ring: #b56aa0;

  --ripe: #2e9e6b;         /* likely approved */
  --ripening: #d6952b;     /* maybe */
  --unripe: #b6604a;       /* long shot */

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(29, 26, 38, 0.05), 0 8px 24px rgba(29, 26, 38, 0.06);
  --maxw: 1080px;

  --display: 'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif;
  --body: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.1; margin: 0 0 .4em; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 5vw, 3.1rem); }
h2 { font-size: clamp(1.5rem, 3.4vw, 2.1rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1rem; }
a { color: var(--plum); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* --- Header --- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(250, 248, 246, 0.88);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { font-family: var(--display); font-weight: 800; font-size: 1.35rem; color: var(--ink); letter-spacing: -0.02em; }
.brand span { color: var(--plum); }
.nav { display: flex; gap: 20px; margin-left: auto; align-items: center; }
.nav a { color: var(--ink-soft); font-weight: 500; font-size: .95rem; }
.nav a:hover { color: var(--plum); text-decoration: none; }
.btn {
  font-family: var(--body); font-weight: 600; font-size: .95rem;
  border: 0; border-radius: 999px; padding: .6rem 1.2rem; cursor: pointer;
  background: var(--plum); color: #fff; transition: transform .12s ease, background .12s ease;
}
.btn:hover { background: var(--plum-deep); transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--plum); border: 1px solid var(--plum-ring); }
.btn.ghost:hover { background: var(--plum-tint); color: var(--plum-deep); }
.btn.small { padding: .4rem .85rem; font-size: .85rem; }

/* --- Hero --- */
.hero { padding: 64px 0 32px; }
.hero .eyebrow {
  display: inline-block; font-weight: 600; font-size: .8rem; letter-spacing: .08em;
  text-transform: uppercase; color: var(--plum); background: var(--plum-tint);
  padding: .35rem .8rem; border-radius: 999px; margin-bottom: 1rem;
}
.hero p.lede { font-size: 1.2rem; color: var(--ink-soft); max-width: 40ch; }

/* --- Score picker --- */
.score-panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px; margin: 28px 0 8px;
}
.score-panel label { font-weight: 600; display: block; margin-bottom: .5rem; }
.score-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
input[type="range"] { flex: 1; min-width: 180px; accent-color: var(--plum); height: 6px; }
.score-readout { font-family: var(--display); font-weight: 800; font-size: 2rem; min-width: 3ch; color: var(--plum-deep); }
.band-label { font-size: .9rem; color: var(--ink-soft); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.filters select {
  font-family: var(--body); font-size: .9rem; padding: .5rem .7rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; color: var(--ink);
}

/* --- Product cards / comparison --- */
.results-head { display: flex; align-items: baseline; justify-content: space-between; margin: 36px 0 14px; gap: 12px; flex-wrap: wrap; }
.results-head .count { color: var(--ink-soft); font-size: .95rem; }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.product-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px;
}
.product-card .tag {
  font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  color: var(--plum); background: var(--plum-tint); padding: .25rem .6rem; border-radius: 999px; align-self: flex-start;
}
.product-card h3 { margin: 0; }
.product-card .issuer { color: var(--ink-soft); font-size: .9rem; margin-top: -6px; }
.facts { display: flex; gap: 18px; flex-wrap: wrap; font-size: .9rem; }
.facts b { display: block; font-family: var(--display); font-size: 1.05rem; }
.facts span { color: var(--ink-soft); font-size: .78rem; }
.card-list { margin: 0; padding-left: 18px; font-size: .9rem; color: var(--ink-soft); }
.card-actions { display: flex; gap: 10px; margin-top: auto; }
.card-actions .btn { flex: 1; text-align: center; }
.fav-btn { background: #fff; border: 1px solid var(--line); border-radius: 999px; width: 40px; cursor: pointer; font-size: 1.1rem; color: var(--plum); }
.fav-btn.on { background: var(--plum-tint); }

/* --- Signature: ripeness approval meter --- */
.ripeness { display: flex; align-items: center; gap: 10px; }
.ripeness .track { flex: 1; height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.ripeness .fill { height: 100%; border-radius: 999px; transition: width .5s ease; }
.ripeness .pct { font-family: var(--display); font-weight: 700; font-size: .95rem; min-width: 3.2ch; text-align: right; }
.ripe-hint { font-size: .8rem; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* --- Sections --- */
section.block { padding: 48px 0; }
.edu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.edu-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.edu-card .cat { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--plum); font-weight: 600; }
.edu-card h3 { margin: .4rem 0; }
.edu-card p { color: var(--ink-soft); font-size: .95rem; margin: 0; }
.edu-card .read { font-size: .82rem; color: var(--ink-soft); margin-top: 10px; }

.disclaimer { font-size: .82rem; color: var(--ink-soft); background: var(--plum-tint); border-radius: var(--radius-sm); padding: 14px 16px; }

/* --- Footer --- */
.site-footer { border-top: 1px solid var(--line); padding: 32px 0; color: var(--ink-soft); font-size: .88rem; margin-top: 40px; }
.site-footer a { color: var(--ink-soft); }

/* --- Chatbot widget --- */
.chat-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 60;
  width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--plum); color: #fff; font-size: 1.5rem; box-shadow: var(--shadow);
  transition: transform .15s ease;
}
.chat-fab:hover { transform: scale(1.06); background: var(--plum-deep); }

.chat-panel {
  position: fixed; right: 20px; bottom: 88px; z-index: 60;
  width: min(380px, calc(100vw - 40px)); height: min(560px, calc(100vh - 130px));
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(29,26,38,.18); display: none; flex-direction: column; overflow: hidden;
}
.chat-panel.open { display: flex; }
.chat-head { background: var(--plum); color: #fff; padding: 14px 16px; font-family: var(--display); font-weight: 700; display: flex; align-items: center; justify-content: space-between; }
.chat-head small { display: block; font-family: var(--body); font-weight: 400; opacity: .85; font-size: .78rem; }
.chat-head button { background: transparent; border: 0; color: #fff; font-size: 1.2rem; cursor: pointer; }
.chat-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { padding: 10px 13px; border-radius: 13px; font-size: .92rem; max-width: 85%; white-space: pre-wrap; }
.msg.bot { background: var(--plum-tint); color: var(--ink); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.user { background: var(--plum); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.msg.typing { color: var(--ink-soft); font-style: italic; }
.chat-suggests { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 14px 8px; }
.chat-suggests button { font-size: .78rem; border: 1px solid var(--line); background: #fff; color: var(--plum); border-radius: 999px; padding: .35rem .7rem; cursor: pointer; }
.chat-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.chat-input input { flex: 1; border: 1px solid var(--line); border-radius: 999px; padding: .6rem .9rem; font-family: var(--body); font-size: .92rem; }
.chat-input button { border: 0; background: var(--plum); color: #fff; border-radius: 999px; width: 42px; cursor: pointer; font-size: 1.1rem; }
.chat-disclaimer { font-size: .68rem; color: var(--ink-soft); text-align: center; padding: 0 12px 8px; }

/* --- Modal (auth) --- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(29,26,38,.45); z-index: 80; display: none; align-items: center; justify-content: center; }
.modal-backdrop.open { display: flex; }
.modal { background: #fff; border-radius: var(--radius); padding: 26px; width: min(400px, calc(100vw - 40px)); box-shadow: var(--shadow); }
.modal h3 { margin-top: 0; }
.modal input { width: 100%; padding: .65rem .8rem; margin-bottom: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-family: var(--body); }
.modal .btn { width: 100%; }
.modal .switch { text-align: center; margin-top: 12px; font-size: .9rem; color: var(--ink-soft); }
.modal .err { color: var(--unripe); font-size: .85rem; margin-bottom: 10px; min-height: 1.2em; }

@media (max-width: 620px) {
  .nav a:not(.btn) { display: none; }
  .hero { padding: 40px 0 20px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
