/* ============================================================
   VaultCova - global theme
   Type: Space Grotesk (display) · Manrope (body) · JetBrains Mono (figures)
   ============================================================ */

/* Self-hosted brand fonts (variable weights, latin subset) — the brand renders
   identically offline, on blocked networks, and in PDFs. No CDN dependency. */
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url(/fonts/space-grotesk-latin.woff2) format('woff2');
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url(/fonts/manrope-latin.woff2) format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url(/fonts/jetbrains-mono-latin.woff2) format('woff2');
}

:root {
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Manrope', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Light theme */
  --bg: #f4f5fb;
  --bg-tint: #eceefb;
  --surface: #ffffff;
  --surface-2: #f4f5fb;
  --surface-3: #eceef7;
  --glass: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.9);

  --text: #0f1124;
  --text-muted: #565d7e;
  --text-faint: #8a90af;

  --border: #e7e9f2;
  --border-strong: #d4d8e8;

  --accent: #5b3df5;
  --accent-2: #7a5cff;
  --accent-ink: #3a23c9;
  --accent-soft: #ece8ff;
  --accent-glow: rgba(91, 61, 245, 0.30);
  --on-accent: #ffffff;

  --success: #0f9d58;
  --success-soft: #e1f5ea;
  --warning: #d98605;
  --warning-soft: #fbeed4;
  --danger: #e0392b;
  --danger-soft: #fce4e1;

  --shadow-sm: 0 1px 2px rgba(15, 17, 36, 0.06), 0 1px 3px rgba(15, 17, 36, 0.04);
  --shadow-md: 0 4px 14px rgba(15, 17, 36, 0.08), 0 2px 6px rgba(15, 17, 36, 0.05);
  --shadow-lg: 0 20px 50px rgba(15, 17, 36, 0.14), 0 6px 16px rgba(15, 17, 36, 0.08);
  --shadow-xl: 0 40px 90px rgba(15, 17, 36, 0.22);
  --shadow-glow: 0 18px 50px rgba(91, 61, 245, 0.28);

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-xl: 30px;

  --sidebar-w: 248px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  --hero-grad: radial-gradient(120% 120% at 80% 0%, #efeaff 0%, #f4f5fb 45%, #f4f5fb 100%);
}

[data-theme="dark"] {
  --bg: #07081a;
  --bg-tint: #0c0e26;
  --surface: #12142e;
  --surface-2: #0e1027;
  --surface-3: #1a1d3e;
  --glass: rgba(20, 22, 50, 0.62);
  --glass-border: rgba(120, 110, 220, 0.18);

  --text: #f1f2fb;
  --text-muted: #a3a9cf;
  --text-faint: #6c719a;

  --border: #232746;
  --border-strong: #313663;

  --accent: #7c5cff;
  --accent-2: #9a80ff;
  --accent-ink: #b7a6ff;
  --accent-soft: #1d1b44;
  --accent-glow: rgba(124, 92, 255, 0.40);
  --on-accent: #ffffff;

  --success: #34d399;
  --success-soft: #0e2b22;
  --warning: #fbbf24;
  --warning-soft: #2e2410;
  --danger: #f87171;
  --danger-soft: #2e1518;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 50px 100px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 18px 60px rgba(124, 92, 255, 0.45);

  --hero-grad: radial-gradient(120% 120% at 80% 0%, #1a1450 0%, #0a0c22 48%, #07081a 100%);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  /* Stop iOS rubber-band / the page sliding under the browser chrome. */
  overscroll-behavior: none;
}

/* On iOS, 100vh is the LARGE viewport (behind the address bar), so the app was
   taller than the visible area and its top slid out when the toolbar showed.
   100dvh tracks the *visible* height and resizes cleanly as the chrome hides. */
#root {
  height: 100vh;   /* fallback for browsers without dvh */
  height: 100dvh;
}

h1, h2, h3, h4, .display {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}

.mono { font-family: var(--font-mono); font-feature-settings: "tnum" 1; }

::selection { background: var(--accent); color: #fff; }

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 20px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea { font-family: inherit; }

/* ---- transitions for theme switching ---- */
.theme-anim, .theme-anim * {
  transition: background-color 0.5s var(--ease), border-color 0.5s var(--ease),
              color 0.4s var(--ease), box-shadow 0.4s var(--ease) !important;
}

/* ============ reusable keyframes ============ */
@keyframes vc-fade-up { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes vc-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes vc-scale-in { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: scale(1); } }
@keyframes vc-drop-in {
  0% { opacity: 0; transform: translateY(-40px) scale(0.9) rotate(-2deg); }
  60% { opacity: 1; transform: translateY(6px) scale(1.02) rotate(0.4deg); }
  100% { opacity: 1; transform: none; }
}
/* portfolio card face flip (Now <-> Growth) */
@keyframes vc-face-in { 0% { opacity: 0; transform: translateY(8px); } 100% { opacity: 1; transform: none; } }
@keyframes vc-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes vc-float-slow { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-18px) rotate(1.5deg); } }
@keyframes vc-pulse-ring {
  0% { box-shadow: 0 0 0 0 var(--accent-glow); }
  70% { box-shadow: 0 0 0 14px rgba(91,61,245,0); }
  100% { box-shadow: 0 0 0 0 rgba(91,61,245,0); }
}
@keyframes vc-spin { to { transform: rotate(360deg); } }
@keyframes vc-shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes vc-dot { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-5px); opacity: 1; } }
/* Mobile homepage carousel: elements settle into place each time a screen
   becomes active (first load and on every revisit). mh-card also carries the
   per-card fan angle via --mh-rot so the stacked hero cards drop in AND fan. */
@keyframes mh-rise { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes mh-card {
  from { opacity: 0; transform: translateX(-50%) translateY(-24px) rotate(0deg); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0) rotate(var(--mh-rot, 0deg)); }
}
/* Intro cards: fall in from above and land STACKED on each other (all at top:0
   via --mh-stack), hold a beat, then break apart and push down into their
   fanned resting slots (--mh-rot). --mh-drop is the above-viewport start. */
@keyframes mh-card-stack {
  0%   { opacity: 0; transform: translateX(-50%) translateY(var(--mh-drop, -170px)) rotate(0deg); }
  38%  { opacity: 1; transform: translateX(-50%) translateY(var(--mh-stack, 0px)) rotate(0deg); }
  58%  { opacity: 1; transform: translateX(-50%) translateY(var(--mh-stack, 0px)) rotate(0deg); }
  100% { opacity: 1; transform: translateX(-50%) translateY(0) rotate(var(--mh-rot, 0deg)); }
}
/* Insure screen: the category chips pop up stacked in the centre, then break
   apart and push out to their spots (--mh-x / --mh-r) with a little overshoot. */
@keyframes mh-chip-push {
  0%   { opacity: 0; transform: translateX(0) rotate(0deg) scale(.7); }
  45%  { opacity: 1; transform: translateX(0) rotate(0deg) scale(1); }
  100% { opacity: 1; transform: translateX(var(--mh-x, 0px)) rotate(var(--mh-r, 0deg)) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  /* No entrance motion for users who ask for less — elements just appear. */
  [style*="mh-rise"], [style*="mh-card"], [style*="mh-chip"] { animation: none !important; }
}
/* Asset cover art (category illustration shown until a real photo is added). */
@keyframes vc-cover-float { 0%, 100% { transform: translateY(0) rotate(-1.5deg); } 50% { transform: translateY(-9px) rotate(1.5deg); } }
@keyframes vc-cover-drift { 0%, 100% { transform: translate(0, 0) rotate(0); } 50% { transform: translate(-10px, 8px) rotate(-6deg); } }
.vc-cover-float { animation: vc-cover-float 4.5s ease-in-out infinite; }
.vc-cover-drift { animation: vc-cover-drift 11s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
  .vc-cover-float, .vc-cover-drift { animation: none !important; }
}
@keyframes vc-sheen { 0% { transform: translateX(-120%) skewX(-18deg); } 100% { transform: translateX(220%) skewX(-18deg); } }
@keyframes vc-grad-pan { 0% { background-position: 0% 50%; } 100% { background-position: 200% 50%; } }
@keyframes vc-word-in {
  0% { opacity: 0; transform: translateY(46px) rotate(3deg) scale(0.96); filter: blur(10px); }
  100% { opacity: 1; transform: none; filter: blur(0); }
}
@keyframes vc-draw { from { stroke-dashoffset: 320; } to { stroke-dashoffset: 0; } }
@keyframes vc-caret { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

.vc-word {
  display: inline-block;
  animation: vc-word-in 0.9s var(--ease) both;
}

/* Entrance-animation safety net: in a backgrounded tab the browser freezes the
   animation clock, which would leave hero content stuck at opacity:0. After a grace
   period (or once anims have played) force the resting state so nothing is ever blank. */
html.vc-ready .vc-word { opacity: 1 !important; transform: none !important; filter: none !important; }
html.vc-ready .vc-rise { opacity: 1 !important; transform: none !important; }
html.vc-ready .vc-draw-underline { stroke-dashoffset: 0 !important; }
.vc-grad-text {
  background: linear-gradient(90deg, var(--accent), var(--accent-2), #c4b5ff, var(--accent));
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: vc-grad-pan 5s linear infinite;
}

.animate-up { animation: vc-fade-up 0.6s var(--ease) both; }
.animate-in { animation: vc-fade-in 0.6s var(--ease) both; }
.animate-scale { animation: vc-scale-in 0.45s var(--ease) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; }
}

/* shared focus ring */
.vc-focus:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Wrap at word boundaries by default (break-word), so multi-word phrases like
   "HP Spectre 15 Laptop" wrap between words, never mid-word. A single word that
   is genuinely longer than its line still breaks (that's break-word's job).
   Only the rare pathological unbroken token (a 90-char serial used as a name)
   needs the stronger `anywhere`, applied locally via .vc-break-any where such
   content lives — NOT globally, because `anywhere` shatters normal phrases when
   space is tight (it made status pills read "Un / ins / ur / ed"). */
body { overflow-wrap: break-word; }
.vc-break-any { overflow-wrap: anywhere; word-break: break-word; }
/* Short labels/badges must never wrap. */
.vc-nowrap { white-space: nowrap; }

/* ============ CONTENT-COLUMN QUERIES ============
   The app's main column can be much narrower than the viewport (rail + open
   Cova dock eat ~460px), so page grids respond to the COLUMN's width, not the
   screen's. Same collapses as the mobile block below; !important beats the
   prototype's inline styles. */
.vc-main { container-type: inline-size; }
/* Grid items default to min-width:auto, so a panel's min-content (a fixed-size
   ring + legend, a wide row) silently forces its track wider than the column.
   Letting items shrink is what makes the 1fr collapses above actually fit. */
.vc-grid > *, .vc-grid-2 > * { min-width: 0; }
/* The coverage-gap card carries a full-precision figure that can run to the
   billions. Give it the full row at EVERY width (in the summary's 2-col
   sub-grid the two MiniStats sit below it) so the number always has room and
   never truncates to "₦4..." — on desktop or mobile. */
.vc-gap-wide { grid-column: 1 / -1; }
@container (max-width: 760px) {
  .vc-grid { grid-template-columns: 1fr !important; }
  .vc-grid-2 { grid-template-columns: repeat(2, 1fr) !important; }
  .vc-page { padding: 18px 16px 40px !important; }
}

/* ---- VaultLog table -> card conversion on a narrow column ----
   The dense 5-column table is a desktop density tool; below ~620px it becomes a
   two-row card per asset (name+status on top, figures + coverage below) so
   nothing is crushed. Header row hides; the row grid is re-templated by area. */
@container (max-width: 620px) {
  .vc-table-head { display: none !important; }
  .vc-trow {
    grid-template-columns: 1fr auto !important;
    grid-template-areas: "asset status" "repl ins" "cov cov" !important;
    gap: 9px 12px !important;
    padding: 14px 16px !important;
    align-items: center !important;
  }
  .vc-tc-asset  { grid-area: asset; min-width: 0; }
  .vc-tc-status { grid-area: status; justify-self: end; align-self: start; }
  .vc-tc-repl   { grid-area: repl; justify-self: start; }
  .vc-tc-ins    { grid-area: ins; justify-self: end; }
  .vc-tc-cov    { grid-area: cov; padding-right: 0 !important; }
}

/* ============ MOBILE (≤760px) ============
   Class-based overrides - !important beats inline styles. */
@media (max-width: 760px) {
  .vc-grid { grid-template-columns: 1fr !important; }
  .vc-grid-2 { grid-template-columns: repeat(2, 1fr) !important; }
  .vc-page { padding: 18px 16px 110px !important; }
  /* topbar: tighter gutters and a capped, truncating account badge so a long
     business name can never widen the row past the viewport */
  .vc-topbar { padding-left: 14px !important; padding-right: 14px !important; }
  .vc-topbar-badge { max-width: 34vw; }
  .vc-hero-h1 { font-size: clamp(38px, 10.5vw, 74px) !important; }
  .vc-page-h1 { font-size: clamp(30px, 8.5vw, 52px) !important; }
  .vc-nav { padding: 12px 14px !important; }
  .vc-nav-links { display: none !important; }
  .vc-hide-m { display: none !important; }
  .vc-section { padding-left: 16px !important; padding-right: 16px !important; }
  .vc-auth-grid { grid-template-columns: 1fr !important; }
  .vc-auth-brand { display: none !important; }
  .vc-settings-nav { display: flex !important; position: static !important; overflow-x: auto; gap: 6px !important; padding-bottom: 4px; }
  .vc-settings-nav button { white-space: nowrap; flex-shrink: 0; }
  /* admin console stacks: sidebar becomes a top strip */
  .vc-admin-root { flex-direction: column !important; }
  .vc-admin-aside { width: 100% !important; height: auto !important; flex-direction: row !important; align-items: center !important; overflow-x: auto; padding: 10px 12px !important; gap: 10px; }
  .vc-admin-aside nav { display: flex !important; flex: 1 1 auto; gap: 4px !important; }
  .vc-admin-aside nav button { white-space: nowrap; flex-shrink: 0; }
  /* guest pre-auth chat: drop the side vault, show a compact save bar */
  .vc-guest-body { grid-template-columns: 1fr !important; }
  .vc-guest-aside { display: none !important; }
  .vc-guest-mobilebar { display: flex !important; }
}
