/* CARDEFI SOLUTIONS — base styles */

:root {
  --bg: #08090C;
  --surface-1: #0D0F14;
  --surface-2: #13151C;
  --surface-3: #1A1D26;
  --surface-warm: #11100D;
  --border: #1F2230;
  --hairline: #292C38;
  --ink: #F5F4EE;
  --ink-warm: #F2EDE0;
  --muted: #8A8F9C;
  --dim: #555863;
  --accent-blue: #3B82F6;
  --accent-violet: #8B5CF6;
  --accent-cyan: #22D3EE;
  --accent-warm: #E9B872;
  --grad: linear-gradient(135deg, #3B82F6 0%, #8B5CF6 60%, #22D3EE 100%);
  --grad-soft: linear-gradient(135deg, rgba(59,130,246,0.18) 0%, rgba(139,92,246,0.18) 60%, rgba(34,211,238,0.12) 100%);
  --grad-warm: linear-gradient(135deg, #E9B872 0%, #C77E5C 100%);
}

html.light {
  --bg: #F5F4EE;
  --surface-1: #FFFFFF;
  --surface-2: #EFEEE6;
  --surface-3: #E7E5DA;
  --surface-warm: #F8F4E9;
  --border: #D9D7CB;
  --hairline: #CECCC0;
  --ink: #0A0B0F;
  --ink-warm: #1A1814;
  --muted: #5C6068;
  --dim: #8B8F9A;
}

* { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  font-feature-settings: 'ss01', 'cv11';
  letter-spacing: -0.005em;
}

.font-display {
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  font-feature-settings: 'ss01', 'cv11';
  letter-spacing: -0.035em;
}

.font-mono {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: -0.005em;
}

.font-serif {
  font-family: 'Instrument Serif', 'Source Serif Pro', Georgia, serif;
  letter-spacing: -0.02em;
}

/* Editorial italic serif accent — used inside headlines */
em.serif, .serif-em {
  font-family: 'Instrument Serif', 'Source Serif Pro', Georgia, serif;
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.01em;
}

/* Noise/grain texture overlay — premium tactile feel */
.grain::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.04;
  z-index: 1;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240' viewBox='0 0 240 240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.6 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
}
.grain-fixed {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.035;
  z-index: 100;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240' viewBox='0 0 240 240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.7 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
}
html.light .grain-fixed { mix-blend-mode: multiply; opacity: 0.04; }

/* Selection */
::selection { background: rgba(139, 92, 246, 0.35); color: var(--ink); }

/* Scrollbar — minimal */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--border); }

/* Reveal on scroll */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 700ms cubic-bezier(0.22, 1, 0.36, 1), transform 700ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}
.reveal.in {
  opacity: 1;
  transform: none;
}

/* Gradient mesh — hero background */
.mesh {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.mesh::before, .mesh::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.48;
  will-change: transform;
}
.mesh::before {
  width: 720px;
  height: 720px;
  background: radial-gradient(circle, rgba(59,130,246,0.5) 0%, rgba(59,130,246,0) 70%);
  top: -220px;
  left: -180px;
  animation: drift1 28s ease-in-out infinite alternate;
}
.mesh::after {
  width: 820px;
  height: 820px;
  background: radial-gradient(circle, rgba(139,92,246,0.46) 0%, rgba(139,92,246,0) 70%);
  bottom: -280px;
  right: -220px;
  animation: drift2 32s ease-in-out infinite alternate;
}
.mesh-3 {
  position: absolute;
  width: 520px; height: 520px;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.32;
  background: radial-gradient(circle, rgba(34,211,238,0.42) 0%, rgba(34,211,238,0) 70%);
  top: 38%; left: 48%;
  animation: drift3 36s ease-in-out infinite alternate;
}
.mesh-warm {
  position: absolute;
  width: 640px; height: 640px;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.38;
  background: radial-gradient(circle, rgba(233,184,114,0.42) 0%, rgba(233,184,114,0) 70%);
  top: 8%; right: 18%;
  animation: drift4 30s ease-in-out infinite alternate;
}
html.light .mesh::before { background: radial-gradient(circle, rgba(59,130,246,0.20) 0%, rgba(59,130,246,0) 70%); }
html.light .mesh::after { background: radial-gradient(circle, rgba(139,92,246,0.18) 0%, rgba(139,92,246,0) 70%); }
html.light .mesh-3 { background: radial-gradient(circle, rgba(34,211,238,0.16) 0%, rgba(34,211,238,0) 70%); }
html.light .mesh-warm { background: radial-gradient(circle, rgba(233,184,114,0.30) 0%, rgba(233,184,114,0) 70%); opacity: 0.5; }

@keyframes drift1 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(80px, 120px) scale(1.15); }
}
@keyframes drift2 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-100px, -80px) scale(1.1); }
}
@keyframes drift3 {
  0% { transform: translate(-50%, -50%) scale(1); }
  100% { transform: translate(-40%, -55%) scale(1.2); }
}
@keyframes drift4 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-60px, 90px) scale(1.18); }
}

/* Aurora wash — subtle conic shimmer over the hero */
.aurora {
  background:
    conic-gradient(from 210deg at 50% 0%,
      rgba(59,130,246,0) 0deg,
      rgba(59,130,246,0.10) 60deg,
      rgba(139,92,246,0.12) 130deg,
      rgba(233,184,114,0.10) 200deg,
      rgba(34,211,238,0.10) 280deg,
      rgba(59,130,246,0) 360deg);
  mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, black 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, black 0%, transparent 75%);
  opacity: 0.55;
  mix-blend-mode: screen;
  animation: aurora-rot 60s linear infinite;
  transform-origin: 50% 0%;
}
html.light .aurora { mix-blend-mode: multiply; opacity: 0.32; }
@keyframes aurora-rot {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Headline glow — soft pool of warmth behind the H1 */
.headline-glow {
  position: absolute;
  inset: -8% -3% -8% -3%;
  pointer-events: none;
  background:
    radial-gradient(ellipse 55% 70% at 15% 50%, rgba(139,92,246,0.16), transparent 70%),
    radial-gradient(ellipse 45% 60% at 82% 60%, rgba(233,184,114,0.12), transparent 70%);
  filter: blur(24px);
  z-index: 0;
}
html.light .headline-glow {
  background:
    radial-gradient(ellipse 50% 60% at 18% 50%, rgba(139,92,246,0.10), transparent 70%),
    radial-gradient(ellipse 40% 50% at 78% 60%, rgba(233,184,114,0.18), transparent 70%);
}

/* Grid background */
.grid-bg {
  background-image:
    linear-gradient(to right, var(--hairline) 1px, transparent 1px),
    linear-gradient(to bottom, var(--hairline) 1px, transparent 1px);
  background-size: 64px 64px;
  background-position: -1px -1px;
  mask-image: radial-gradient(ellipse 60% 70% at 50% 0%, black 0%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 60% 70% at 50% 0%, black 0%, transparent 80%);
  opacity: 0.5;
}

/* Hairline */
.hairline { border-color: var(--hairline); }
.border-soft { border-color: var(--border); }

/* Buttons */
.btn-primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: -0.005em;
  transition: transform 240ms ease, box-shadow 240ms ease;
  box-shadow: 0 10px 30px -10px rgba(139, 92, 246, 0.3);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 36px -8px rgba(139, 92, 246, 0.5);
}
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-weight: 500;
  font-size: 14px;
  border: 1px solid var(--border);
  transition: background 200ms ease, border-color 200ms ease;
}
.btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--hairline);
}
.btn-gradient {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 26px;
  border-radius: 999px;
  background: var(--grad);
  color: white;
  font-weight: 500;
  font-size: 15px;
  transition: transform 240ms ease, box-shadow 240ms ease;
  box-shadow: 0 12px 40px -8px rgba(59, 130, 246, 0.45);
}
.btn-gradient:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 50px -6px rgba(139, 92, 246, 0.55);
}

/* Service card */
.card {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.02) 0%, transparent 40%),
    var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
  transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1), border-color 320ms ease, background 320ms ease;
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    0 1px 2px rgba(0,0,0,0.4);
}
html.light .card {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.8),
    0 1px 2px rgba(10,11,15,0.04);
}
.card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 20px;
  padding: 1px;
  background: var(--grad);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 320ms ease;
  pointer-events: none;
}
.card:hover {
  transform: translateY(-4px);
  border-color: transparent;
}
.card:hover::before {
  opacity: 1;
}
.card-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(600px circle at var(--mx, 50%) var(--my, 0%), rgba(139,92,246,0.10), transparent 40%);
  opacity: 0;
  transition: opacity 320ms ease;
  pointer-events: none;
}
.card:hover .card-glow { opacity: 1; }

/* Glass nav */
.nav-glass {
  background: rgba(10, 11, 15, 0.6);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-color: var(--border);
}
html.light .nav-glass {
  background: rgba(250, 250, 247, 0.7);
}

/* Marquee */
.marquee {
  display: flex;
  overflow: hidden;
  position: relative;
  mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
}
.marquee-track {
  display: flex;
  gap: 64px;
  animation: marquee 40s linear infinite;
  white-space: nowrap;
  flex-shrink: 0;
}
@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* AI Workbench */
.workbench {
  position: relative;
  background:
    radial-gradient(ellipse at top right, rgba(139,92,246,0.12), transparent 60%),
    radial-gradient(ellipse at bottom left, rgba(59,130,246,0.10), transparent 60%),
    var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
}

.token-shimmer {
  background: linear-gradient(90deg, var(--ink) 0%, var(--ink) 50%, transparent 50%, transparent 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: tokenShimmer 1.2s ease-out forwards;
}
@keyframes tokenShimmer {
  from { background-position: 100% 0; }
  to { background-position: 0% 0; }
}

.cursor-blink::after {
  content: '▍';
  margin-left: 2px;
  opacity: 1;
  animation: blink 1s steps(2) infinite;
  color: var(--accent-violet);
}
@keyframes blink { 50% { opacity: 0; } }

/* Neural constellation animations */
@keyframes node-pulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.2); }
}
.node {
  animation: node-pulse 3s ease-in-out infinite;
  transform-origin: center;
  transform-box: fill-box;
}

/* Signal traveling along path */
.signal {
  filter: drop-shadow(0 0 6px rgba(139, 92, 246, 0.8));
}

/* Approach stepper */
.step-line {
  position: absolute;
  left: 0;
  top: 50%;
  height: 1px;
  background: var(--grad);
  width: 0%;
  transition: width 1400ms cubic-bezier(0.22, 1, 0.36, 1);
}
.step-line.run { width: 100%; }

/* Stat number */
.stat-num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
}

/* Industry pill */
.industry-pill {
  border: 1px solid var(--border);
  background: var(--surface-1);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  color: var(--muted);
  transition: color 200ms ease, border-color 200ms ease, background 200ms ease;
}
.industry-pill:hover {
  color: var(--ink);
  border-color: var(--hairline);
  background: var(--surface-2);
}

/* Form */
.input {
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--ink);
  font-size: 14px;
  transition: border-color 200ms ease, background 200ms ease;
}
.input:focus {
  outline: none;
  border-color: var(--accent-violet);
  background: var(--surface-2);
}
.input::placeholder { color: var(--dim); }

textarea.input { resize: vertical; min-height: 130px; font-family: inherit; }

/* Hero text gradient */
.text-grad {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* CTA section bg */
.cta-bg {
  position: relative;
  background:
    radial-gradient(ellipse at 30% 50%, rgba(59,130,246,0.35), transparent 60%),
    radial-gradient(ellipse at 70% 50%, rgba(139,92,246,0.35), transparent 60%),
    var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 28px;
  overflow: hidden;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1 !important; transform: none !important; }
}

/* Focus rings */
:focus-visible {
  outline: 2px solid var(--accent-violet);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Small things */
.eyebrow {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: '';
  width: 22px;
  height: 1px;
  background: var(--accent-violet);
  display: inline-block;
}

.eyebrow.eyebrow-plain::before {
  display: none;
}

/* Section divider — premium horizontal rule */
.section-rule {
  position: relative;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border) 20%, var(--border) 80%, transparent);
}

/* Work card — case study */
.work-card {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.025) 0%, transparent 30%),
    var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
  transition: transform 420ms cubic-bezier(0.22, 1, 0.36, 1), border-color 320ms ease;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    0 4px 24px -8px rgba(0,0,0,0.5);
}
.work-card:hover {
  transform: translateY(-3px);
  border-color: var(--hairline);
}
.work-thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

/* Underline-on-hover for inline links */
.link-hover {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.link-hover::after {
  content: '';
  position: absolute;
  left: 0; right: 18px; bottom: -2px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
}
.link-hover:hover::after { transform: scaleX(1); }

/* Tag chip */
.chip {
  display: inline-flex;
  align-items: center;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
}

/* Vignette for content edges */
.vignette {
  background:
    radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.4) 100%);
}

.divider-dot::before {
  content: '·';
  margin: 0 10px;
  color: var(--dim);
}
