/* DebtQuity v2 — Custom CSS Foundation */

/* ---- Font Faces ---- */
@font-face {
  font-family: 'HK Grotesk';
  src: url('/assets/fonts/HKGrotesk-Regular.woff2') format('woff2'),
       url('/assets/fonts/HKGrotesk-Regular.woff') format('woff');
  font-weight: 400; font-style: normal;
}
@font-face {
  font-family: 'HK Grotesk';
  src: url('/assets/fonts/HKGrotesk-Medium.woff2') format('woff2'),
       url('/assets/fonts/HKGrotesk-Medium.woff') format('woff');
  font-weight: 500; font-style: normal;
}
@font-face {
  font-family: 'HK Grotesk';
  src: url('/assets/fonts/HKGrotesk-SemiBold.woff2') format('woff2'),
       url('/assets/fonts/HKGrotesk-SemiBold.woff') format('woff');
  font-weight: 600; font-style: normal;
}
@font-face {
  font-family: 'HK Grotesk';
  src: url('/assets/fonts/HKGrotesk-Bold.woff2') format('woff2'),
       url('/assets/fonts/HKGrotesk-Bold.woff') format('woff');
  font-weight: 700; font-style: normal;
}
@font-face {
  font-family: 'Lucidity Expand';
  src: url('/assets/fonts/Lucidity-Expand.ttf') format('truetype');
  font-weight: 400; font-style: normal;
}

/* ---- CSS Custom Properties ---- */
:root {
  --color-ink: #0e1114;
  --color-paper: #f1f1f1;
  --color-gold: #e6c40e;
  --color-white: #ffffff;
  --shadow-card: 0 2px 8px rgba(14,17,20,0.08), 0 1px 2px rgba(14,17,20,0.04);
  --shadow-card-hover: 0 4px 16px rgba(14,17,20,0.12), 0 2px 4px rgba(14,17,20,0.06);
  --radius-card: 10px;
}

/* ---- Base ---- */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'HK Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--color-paper);
  color: var(--color-ink);
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

/* ---- Typography ---- */
.font-display { font-family: 'Lucidity Expand', sans-serif; }

/* ---- Sidebar Nav ---- */
.sidebar-nav {
  background-color: var(--color-ink);
  width: 220px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  cursor: pointer;
}

.sidebar-nav a:hover {
  color: var(--color-white);
  background: rgba(255,255,255,0.06);
}

.sidebar-nav a.active {
  color: var(--color-white);
  border-left-color: var(--color-gold);
  background: rgba(255,255,255,0.08);
}

/* ---- Cards ---- */
.card {
  background: var(--color-white);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 24px;
}

.card:hover {
  box-shadow: var(--shadow-card-hover);
  transition: box-shadow 0.2s;
}

/* ---- Buttons ---- */
.btn-primary {
  background: var(--color-gold);
  color: var(--color-ink);
  font-family: 'HK Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 10px 22px;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: opacity 0.15s, transform 0.1s;
}
.btn-primary:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--color-ink);
  color: var(--color-white);
  font-family: 'HK Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 10px 22px;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: opacity 0.15s, transform 0.1s;
}
.btn-secondary:hover { opacity: 0.85; transform: translateY(-1px); }

.btn-outline {
  background: transparent;
  color: var(--color-ink);
  font-family: 'HK Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 9px 22px;
  border: 2px solid var(--color-ink);
  border-radius: 7px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background 0.15s, color 0.15s;
}
.btn-outline:hover {
  background: var(--color-ink);
  color: var(--color-white);
}

.btn-outline-white {
  background: transparent;
  color: var(--color-white);
  font-family: 'HK Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 9px 22px;
  border: 2px solid rgba(255,255,255,0.5);
  border-radius: 7px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background 0.15s, border-color 0.15s;
}
.btn-outline-white:hover {
  background: rgba(255,255,255,0.1);
  border-color: var(--color-white);
}

/* ---- Badges ---- */
.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 100px;
  white-space: nowrap;
}
.badge-new { background: #e8f4fd; color: #1a6ca8; }
.badge-docs { background: #fff8e1; color: #b8860b; }
.badge-verify { background: #fef3cd; color: #966a00; }
.badge-assess { background: #e8f0fe; color: #2952a3; }
.badge-sign { background: #e6f4ea; color: #1e7e34; }
.badge-approved { background: #d4edda; color: #155724; }
.badge-disbursed { background: #cce5ff; color: #004085; }
.badge-rejected { background: #f8d7da; color: #721c24; }
.badge-debt { background: rgba(14,17,20,0.08); color: var(--color-ink); }
.badge-equity { background: #fff8d6; color: #7a6000; }
.badge-both { background: #e6f4ea; color: #1e7e34; }
.badge-gold { background: var(--color-gold); color: var(--color-ink); }

/* ---- Dex float ---- */
.dex-float {
  position: absolute;
  bottom: 0;
  right: 0;
  pointer-events: none;
  user-select: none;
}

/* ---- Form styles ---- */
.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid rgba(14,17,20,0.18);
  border-radius: 7px;
  font-family: 'HK Grotesk', sans-serif;
  font-size: 0.9rem;
  color: var(--color-ink);
  background: var(--color-white);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus {
  border-color: var(--color-gold);
  box-shadow: 0 0 0 3px rgba(230,196,14,0.18);
}
.form-input.error {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220,38,38,0.1);
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-ink);
  margin-bottom: 5px;
}

.form-error {
  font-size: 0.78rem;
  color: #dc2626;
  margin-top: 4px;
}

.form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid rgba(14,17,20,0.18);
  border-radius: 7px;
  font-family: 'HK Grotesk', sans-serif;
  font-size: 0.9rem;
  color: var(--color-ink);
  background: var(--color-white);
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%230e1114' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: pointer;
}
.form-select:focus {
  border-color: var(--color-gold);
  box-shadow: 0 0 0 3px rgba(230,196,14,0.18);
}

.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid rgba(14,17,20,0.18);
  border-radius: 7px;
  font-family: 'HK Grotesk', sans-serif;
  font-size: 0.9rem;
  color: var(--color-ink);
  background: var(--color-white);
  outline: none;
  resize: vertical;
  min-height: 90px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-textarea:focus {
  border-color: var(--color-gold);
  box-shadow: 0 0 0 3px rgba(230,196,14,0.18);
}

/* ---- Warning banner ---- */
.warning-banner {
  background: #fff8e1;
  border: 1.5px solid #f0c040;
  border-radius: 7px;
  padding: 10px 14px;
  font-size: 0.84rem;
  color: #7a5c00;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.error-banner {
  background: #fef2f2;
  border: 1.5px solid #fca5a5;
  border-radius: 7px;
  padding: 10px 14px;
  font-size: 0.84rem;
  color: #991b1b;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

/* ---- Step indicator ---- */
.step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}
.step-dot.active { background: var(--color-gold); color: var(--color-ink); }
.step-dot.done { background: var(--color-ink); color: var(--color-white); }
.step-dot.pending { background: rgba(14,17,20,0.1); color: rgba(14,17,20,0.4); }

/* ---- Progress tracker ---- */
.progress-bar {
  height: 6px;
  border-radius: 100px;
  background: rgba(14,17,20,0.1);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 100px;
  background: var(--color-gold);
  transition: width 0.4s ease;
}

/* ---- Chat widget ---- */
.chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
}

.chat-bubble {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-ink);
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(14,17,20,0.25);
  transition: transform 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chat-bubble:hover { transform: scale(1.07); }

.chat-window {
  position: absolute;
  bottom: 68px;
  right: 0;
  width: 320px;
  background: var(--color-white);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(14,17,20,0.18);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chat-header {
  background: var(--color-ink);
  color: var(--color-white);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 300px;
}

.chat-msg-dex {
  background: var(--color-paper);
  border-radius: 0 10px 10px 10px;
  padding: 9px 12px;
  font-size: 0.84rem;
  max-width: 85%;
  align-self: flex-start;
}

.chat-msg-user {
  background: var(--color-gold);
  border-radius: 10px 10px 0 10px;
  padding: 9px 12px;
  font-size: 0.84rem;
  max-width: 85%;
  align-self: flex-end;
  color: var(--color-ink);
}

.chat-input-row {
  padding: 10px 12px;
  border-top: 1px solid rgba(14,17,20,0.08);
  display: flex;
  gap: 8px;
}

.chat-input {
  flex: 1;
  padding: 8px 12px;
  border: 1.5px solid rgba(14,17,20,0.15);
  border-radius: 6px;
  font-family: 'HK Grotesk', sans-serif;
  font-size: 0.84rem;
  outline: none;
}
.chat-input:focus { border-color: var(--color-gold); }

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--color-ink);
  color: var(--color-white);
  padding: 12px 22px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 2000;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  transition: transform 0.3s ease;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ---- Nav ---- */
.topnav {
  background: var(--color-white);
  border-bottom: 3px solid var(--color-gold);
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(14,17,20,0.07);
}

.topnav a:not(.btn-primary):not(.btn-secondary) {
  position: relative;
  text-decoration: none;
}

.topnav a:not(.btn-primary):not(.btn-secondary)::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-gold);
  transition: width 0.2s ease;
}

.topnav a:not(.btn-primary):not(.btn-secondary):hover::after {
  width: 100%;
}

/* ---- Pipeline kanban ---- */
.kanban-col {
  min-width: 200px;
  max-width: 220px;
  background: rgba(14,17,20,0.04);
  border-radius: 10px;
  padding: 12px;
  flex-shrink: 0;
}

.deal-card {
  background: var(--color-white);
  border-radius: 8px;
  padding: 12px;
  box-shadow: var(--shadow-card);
  cursor: grab;
  margin-bottom: 10px;
  transition: box-shadow 0.15s, transform 0.15s;
}
.deal-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-1px);
}
.deal-card.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

/* ---- Animations ---- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.25s ease forwards; }

@keyframes spin {
  to { transform: rotate(360deg); }
}
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(14,17,20,0.15);
  border-top-color: var(--color-ink);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(14,17,20,0.5);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-box {
  background: var(--color-white);
  border-radius: 12px;
  padding: 28px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 16px 48px rgba(14,17,20,0.2);
}

/* ---- Utility ---- */
.text-gold { color: var(--color-gold); }
.text-ink { color: var(--color-ink); }
.bg-ink { background: var(--color-ink); }
.bg-gold { background: var(--color-gold); }
.bg-paper { background: var(--color-paper); }

[x-cloak] { display: none !important; }

/* ============================================================
   UPGRADE 1 — Lucidity Expand hero headlines
   ============================================================ */
.hero-headline {
  font-family: 'Lucidity Expand', sans-serif;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.05;
  text-transform: uppercase;
}

/* ============================================================
   UPGRADE 2 — Grain / noise texture on ink sections
   ============================================================ */
section.bg-ink,
.ink-grain {
  position: relative;
  isolation: isolate;
}

section.bg-ink::after,
.ink-grain::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.72' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 220px 220px;
  opacity: 0.035;
  mix-blend-mode: overlay;
  pointer-events: none;
  z-index: 0;
}

/* Ensure direct children of grain sections sit above the texture */
section.bg-ink > *,
.ink-grain > * {
  position: relative;
  z-index: 1;
}

/* ============================================================
   UPGRADE 3 — Mandate card differentiation
   ============================================================ */
.card-mandate {
  border-top: 4px solid transparent;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s, border-left-color 0.2s;
  border-left: 3px solid transparent;
}

.card-mandate-sanlam  { border-top-color: var(--color-gold); }
.card-mandate-commercial { border-top-color: #4a90d9; }
.card-mandate-express { border-top-color: #3dbd7d; }
.card-mandate-specialized { border-top-color: #9b7fe8; }

.card-mandate:hover {
  border-left-color: var(--color-gold);
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(14,17,20,0.13), 0 2px 6px rgba(14,17,20,0.07);
}

/* ============================================================
   UPGRADE 4 — Staggered page-load animation
   ============================================================ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}

.anim-1, .anim-2, .anim-3, .anim-4, .anim-5 {
  opacity: 0;
  animation: fadeUp 0.55s ease forwards;
}
.anim-1 { animation-delay: 0s; }
.anim-2 { animation-delay: 0.12s; }
.anim-3 { animation-delay: 0.24s; }
.anim-4 { animation-delay: 0.36s; }
.anim-5 { animation-delay: 0.5s; }

/* ============================================================
   UPGRADE 5 — Video section
   ============================================================ */
.video-card {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.video-card:hover {
  border-color: var(--color-gold);
  box-shadow: 0 0 0 1px var(--color-gold), 0 8px 32px rgba(230,196,14,0.15);
}
.video-card video {
  width: 100%;
  display: block;
  border-radius: 14px;
}
.video-label {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 14px 16px;
  background: linear-gradient(to top, rgba(14,17,20,0.85) 0%, transparent 100%);
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  pointer-events: none;
}
