/* ==========================================================================
   TFD SITES — CORE DESIGN SYSTEM
   Premium responsive architecture
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ==========================================================================
   DESIGN TOKENS
   ========================================================================== */

:root {
  --bg-dark: #05060a;
  --bg-deep: #030408;

  --surface: rgba(13, 16, 27, 0.72);
  --surface-hover: rgba(18, 23, 37, 0.88);
  --surface-solid: #0b0e17;

  --text-main: #f8fafc;
  --text-soft: #cbd5e1;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --border: rgba(255, 255, 255, 0.075);
  --border-hover: rgba(129, 140, 248, 0.38);

  --indigo: #6366f1;
  --indigo-light: #818cf8;
  --indigo-dark: #4f46e5;

  --cyan: #38bdf8;
  --emerald: #34d399;
  --rose: #fb7185;
  --amber: #fbbf24;

  --indigo-soft: rgba(99, 102, 241, 0.14);
  --indigo-glow: rgba(99, 102, 241, 0.24);

  --radius-sm: 0.625rem;
  --radius-md: 0.875rem;
  --radius-lg: 1rem;
  --radius-xl: 1.25rem;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);

  --shadow-card:
    0 12px 35px rgba(0, 0, 0, 0.18);

  --shadow-card-hover:
    0 24px 55px rgba(0, 0, 0, 0.28),
    0 0 35px rgba(99, 102, 241, 0.09);
}

/* ==========================================================================
   RESET
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  color-scheme: dark;
  overflow-x: hidden;
  width: 100%;
  background: var(--bg-dark);
}

body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100vh;

  font-family:
    'Inter',
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;

  color: var(--text-main);
  background-color: var(--bg-dark);

  overflow-x: hidden;

  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  text-rendering: optimizeLegibility;
}

/* Prevent images from causing horizontal overflow */

img,
svg,
video,
canvas {
  max-width: 100%;
}

/* ==========================================================================
   TYPOGRAPHY
   ========================================================================== */

.font-display {
  font-family:
    'Plus Jakarta Sans',
    'Inter',
    sans-serif;
}

.font-mono {
  font-family:
    'JetBrains Mono',
    monospace;
}

/* Better text selection */

::selection {
  background: rgba(99, 102, 241, 0.32);
  color: #ffffff;
}

/* ==========================================================================
   BACKGROUND — SUBTLE TECHNICAL GRID
   ========================================================================== */

.bg-mesh-grid {
  position: relative;

  background-color: var(--bg-dark);

  background-image:
    linear-gradient(
      to right,
      rgba(255, 255, 255, 0.018) 1px,
      transparent 1px
    ),
    linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.018) 1px,
      transparent 1px
    );
  
  background-size: 32px 32px;
}

/*
 * Very subtle radial lighting.
 * This keeps the site from looking like a flat black page.
 */

.bg-mesh-grid::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;

  background:
    radial-gradient(
      circle at 50% -20%,
      rgba(99, 102, 241, 0.08),
      transparent 42%
    );

  z-index: 0;
}

@media (min-width: 768px) {
  .bg-mesh-grid {
    background-size: 40px 40px;
  }
}

/* ==========================================================================
   AMBIENT LIGHT
   ========================================================================== */

.glow-orb-indigo,
.glow-orb-cyan {
  position: absolute;
  pointer-events: none;
  z-index: 0;

  border-radius: 50%;

  will-change: transform;
}

.glow-orb-indigo {
  width: 340px;
  height: 340px;

  background:
    radial-gradient(
      circle,
      rgba(99, 102, 241, 0.16) 0%,
      rgba(99, 102, 241, 0.06) 32%,
      transparent 70%
    );

  filter: blur(45px);
}

.glow-orb-cyan {
  width: 300px;
  height: 300px;

  background:
    radial-gradient(
      circle,
      rgba(56, 189, 248, 0.12) 0%,
      rgba(56, 189, 248, 0.04) 35%,
      transparent 70%
    );

  filter: blur(45px);
}

@media (min-width: 1024px) {
  .glow-orb-indigo {
    width: 600px;
    height: 600px;
    filter: blur(85px);
  }

  .glow-orb-cyan {
    width: 500px;
    height: 500px;
    filter: blur(75px);
  }
}

/* ==========================================================================
   GLASS CARDS
   ========================================================================== */

.tfd-card {
  position: relative;

  background:
    linear-gradient(
      145deg,
      rgba(18, 22, 35, 0.78),
      rgba(8, 10, 18, 0.72)
    );

  border: 1px solid var(--border);
  border-radius: var(--radius-lg);

  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);

  box-shadow: var(--shadow-card);

  overflow: hidden;

  isolation: isolate;

  transition:
    transform 320ms var(--ease-out),
    border-color 320ms var(--ease-standard),
    background 320ms var(--ease-standard),
    box-shadow 320ms var(--ease-standard);
}

/*
 * Very subtle top highlight.
 * Makes cards feel physical rather than like generic glassmorphism.
 */

.tfd-card::after {
  content: '';

  position: absolute;
  left: 12%;
  right: 12%;
  top: 0;

  height: 1px;

  background:
    linear-gradient(
      90deg,
      transparent,
      rgba(255, 255, 255, 0.10),
      transparent
    );

  pointer-events: none;
}

/* Mouse-follow lighting */

@media (hover: hover) and (pointer: fine) {

  .tfd-card::before {
    content: '';

    position: absolute;
    inset: 0;

    background:
      radial-gradient(
        500px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(255, 255, 255, 0.055),
        transparent 42%
      );

    opacity: 0;

    transition: opacity 280ms ease;

    pointer-events: none;
    z-index: -1;
  }

  .tfd-card:hover::before {
    opacity: 1;
  }

  .tfd-card:hover {
    background:
      linear-gradient(
        145deg,
        rgba(22, 27, 43, 0.88),
        rgba(10, 13, 22, 0.82)
      );

    border-color: var(--border-hover);

    box-shadow: var(--shadow-card-hover);

    transform: translateY(-4px);
  }
}

/* Don't make cards jump around on touch */

@media (hover: none) {
  .tfd-card:active {
    border-color: rgba(129, 140, 248, 0.32);
  }
}

/* ==========================================================================
   PRIMARY BUTTON
   ========================================================================== */

.btn-primary {
  position: relative;

  background:
    linear-gradient(
      135deg,
      var(--indigo) 0%,
      var(--indigo-dark) 100%
    );

  box-shadow:
    0 5px 20px rgba(79, 70, 229, 0.28);

  transition:
    transform 180ms var(--ease-out),
    box-shadow 180ms var(--ease-out),
    filter 180ms ease;

  touch-action: manipulation;

  overflow: hidden;
}

/*
 * Subtle shine.
 */

.btn-primary::before {
  content: '';

  position: absolute;
  inset: 0;

  background:
    linear-gradient(
      110deg,
      transparent 30%,
      rgba(255, 255, 255, 0.12) 50%,
      transparent 70%
    );

  transform: translateX(-120%);

  transition: transform 650ms var(--ease-out);

  pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {

  .btn-primary:hover {
    transform: translateY(-2px);

    box-shadow:
      0 10px 30px rgba(79, 70, 229, 0.40);

    filter: brightness(1.05);
  }

  .btn-primary:hover::before {
    transform: translateX(120%);
  }
}

.btn-primary:active {
  transform: scale(0.985);
}

/* ==========================================================================
   LINKS & FOCUS
   ========================================================================== */

a {
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--indigo-light);
  outline-offset: 3px;
}

/* ==========================================================================
   FORM CONTROLS
   ========================================================================== */

input,
select,
textarea,
button {
  font-family: inherit;
}

/*
 * 16px prevents iOS Safari from zooming when interacting with forms.
 */

input,
select,
textarea,
button {
  font-size: 16px;
}

input,
select,
textarea {
  color: var(--text-main);
  caret-color: var(--indigo-light);
}

input::placeholder,
textarea::placeholder {
  color: #475569;
}

/* Cleaner browser autofill */

input:-webkit-autofill,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: var(--text-main);
  transition:
    background-color 9999s ease-in-out 0s;
}

/* ==========================================================================
   RANGE INPUT
   ========================================================================== */

input[type='range'] {
  appearance: none;
  -webkit-appearance: none;

  width: 100%;
  height: 5px;

  background: #111522;

  border-radius: 999px;

  cursor: pointer;
}

input[type='range']::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;

  width: 18px;
  height: 18px;

  border-radius: 50%;
  border: 3px solid #0b0e17;

  background: var(--indigo-light);

  box-shadow:
    0 0 0 1px rgba(129, 140, 248, 0.55),
    0 3px 12px rgba(99, 102, 241, 0.45);

  cursor: pointer;

  transition:
    transform 160ms ease,
    box-shadow 160ms ease;
}

input[type='range']::-moz-range-thumb {
  width: 18px;
  height: 18px;

  border-radius: 50%;
  border: 3px solid #0b0e17;

  background: var(--indigo-light);

  box-shadow:
    0 0 0 1px rgba(129, 140, 248, 0.55),
    0 3px 12px rgba(99, 102, 241, 0.45);

  cursor: pointer;
}

input[type='range']:focus-visible {
  outline: none;
}

input[type='range']:focus-visible::-webkit-slider-thumb {
  box-shadow:
    0 0 0 4px rgba(99, 102, 241, 0.22),
    0 3px 14px rgba(99, 102, 241, 0.45);
}

/* ==========================================================================
   CHECKBOXES
   ========================================================================== */

input[type='checkbox'] {
  accent-color: var(--indigo);

  cursor: pointer;

  flex-shrink: 0;
}

/* ==========================================================================
   FLOATING COMPUTER
   ========================================================================== */

.floating-computer-wrapper {
  width: 100%;

  perspective: 1200px;
  transform-style: preserve-3d;
}

.floating-computer {
  transform-style: preserve-3d;

  animation:
    floatSlow 7s ease-in-out infinite,
    pulseGlow 6s ease-in-out infinite;
}

/*
 * Slightly calmer movement feels more premium.
 */

@keyframes floatSlow {

  0%,
  100% {
    transform:
      translate3d(0, 0, 0)
      rotateX(4deg)
      rotateY(-6deg);
  }

  50% {
    transform:
      translate3d(0, -10px, 0)
      rotateX(7deg)
      rotateY(-3deg);
  }
}

@keyframes pulseGlow {

  0%,
  100% {
    filter:
      drop-shadow(
        0 0 20px
        rgba(99, 102, 241, 0.18)
      );
  }

  50% {
    filter:
      drop-shadow(
        0 0 30px
        rgba(56, 189, 248, 0.25)
      );
  }
}

/* ==========================================================================
   MOBILE BEHAVIOUR
   ========================================================================== */

@media (max-width: 767px) {

  .tfd-card {
    border-radius: var(--radius-md);
  }

  /*
   * Don't overdo blur on mobile.
   * This saves GPU resources on weaker phones.
   */

  .tfd-card {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .glow-orb-indigo,
  .glow-orb-cyan {
    opacity: 0.7;
  }

  .floating-computer {
    animation:
      floatSlow 8s ease-in-out infinite;
  }
}

/* ==========================================================================
   SCROLLBAR
   ========================================================================== */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-deep);
}

::-webkit-scrollbar-thumb {
  background: #1b2030;
  border-radius: 999px;

  border: 2px solid var(--bg-deep);
}

::-webkit-scrollbar-thumb:hover {
  background: #303852;
}

/* Firefox */

* {
  scrollbar-width: thin;
  scrollbar-color: #1b2030 var(--bg-deep);
}

/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {

  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .floating-computer {
    transform: none !important;
  }
}

/* ==========================================================================
   LOW POWER / TOUCH DEVICES
   ========================================================================== */

@media (hover: none) and (pointer: coarse) {

  .tfd-card {
    box-shadow:
      0 10px 30px rgba(0, 0, 0, 0.18);
  }

  .tfd-card::before {
    display: none;
  }
}

/* ==========================================================================
   PRINT
   ========================================================================== */

@media print {

  .glow-orb-indigo,
  .glow-orb-cyan,
  .floating-computer {
    display: none !important;
  }

  body {
    background: #ffffff;
    color: #000000;
  }

  .tfd-card {
    background: #ffffff;
    color: #000000;
    border: 1px solid #ddd;
    box-shadow: none;
  }
}