/* ==========================================================================
   Ticimarket — Design System
   Tokens, reset, typography, layout primitives
   ========================================================================== */

:root {
  /* Color — surfaces */
  --bg: #ffffff;
  --bg-subtle: #f5f8fe;
  --bg-muted: #edf2fb;
  --bg-hover: #eaf0fb;

  /* Color — text */
  --fg: #02102d;
  --fg-2: #0b1a3a;
  --fg-3: #34405a;
  --muted: #5b6478;
  --muted-2: #6b7489;

  /* Color — lines */
  --border: #e1e7f0;
  --border-strong: #cdd6e4;
  --border-soft: #edf1f7;

  /* Color — brand */
  --primary: #0063fb;
  --primary-hover: #0052d9;
  --primary-ink: #0047c2;
  --primary-soft: #e8f1ff;
  --primary-ring: rgba(0, 99, 251, 0.18);
  --accent: #00b8ff;
  --accent-soft: #e2f7ff;
  --navy: #02102d;
  --grad-brand: linear-gradient(135deg, #00c2ff 0%, #0063fb 52%, #0b3fbf 100%);
  --grad-brand-soft: linear-gradient(135deg, #e3f7ff 0%, #e8f0ff 55%, #eef0ff 100%);

  /* Color — dark surfaces */
  --dark: #030b22;
  --dark-2: #06122e;
  --dark-3: #0a1838;
  --dark-4: #102046;
  --dark-border: rgba(160, 190, 255, 0.12);
  --dark-border-strong: rgba(160, 190, 255, 0.2);
  --dark-fg: #f3f6ff;
  --dark-muted: #9aa6c4;

  /* Color — feedback */
  --success: #12a150;
  --success-soft: #e9f8ef;
  --warning: #b7791f;
  --warning-soft: #fdf5e6;
  --danger: #dc3a3f;
  --danger-soft: #fdeced;

  /* Spacing scale */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --s-9: 80px;
  --s-10: 120px;

  /* Radius */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-2xl: 24px;

  /* Layout */
  --container: 1320px;
  --container-narrow: 880px;
  --gutter: clamp(20px, 4vw, 40px);
  --section-y: clamp(72px, 9vw, 120px);
  --header-h: 72px;
  --header-h-compact: 60px;

  /* Typography */
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs-h1: clamp(2.25rem, 1.35rem + 3.9vw, 4.5rem);
  --fs-h2: clamp(1.875rem, 1.3rem + 2.3vw, 3.25rem);
  --fs-h3: clamp(1.375rem, 1.15rem + 0.8vw, 1.875rem);
  --fs-h4: 1.125rem;
  --fs-lead: clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem);
  --fs-body: 1rem;
  --fs-sm: 0.875rem;
  --fs-xs: 0.8125rem;
  --fs-2xs: 0.75rem;
  --measure: 64ch;

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04), 0 2px 6px -2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 1px 2px rgba(16, 24, 40, 0.04), 0 12px 24px -12px rgba(16, 24, 40, 0.14);
  --shadow-lg: 0 1px 3px rgba(16, 24, 40, 0.05), 0 24px 48px -20px rgba(16, 24, 40, 0.22);
  --shadow-frame: 0 1px 2px rgba(16, 24, 40, 0.05), 0 18px 40px -18px rgba(16, 24, 40, 0.28);

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 180ms;
  --dur: 240ms;
  --dur-slow: 420ms;
  --dur-reveal: 700ms;

  /* Layering */
  --z-header: 50;
  --z-overlay: 70;
  --z-toast: 90;
}

/* --------------------------------------------------------------------------
   Reset
   -------------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-gutter: stable;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd {
  margin: 0;
}

:where(ul[role="list"], ol[role="list"]), .list-reset {
  list-style: none;
  margin: 0;
  padding: 0;
}

img, svg, video, canvas {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

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

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--r-sm);
  background: var(--fg);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 500;
  transform: translateY(-160%);
  transition: transform var(--dur) var(--ease-out);
}

.skip-link:focus {
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */

.h1, .h2, .h3, .h4 {
  font-weight: 600;
  color: var(--fg);
  text-wrap: balance;
}

.h1 {
  font-size: var(--fs-h1);
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.h2 {
  font-size: var(--fs-h2);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.h3 {
  font-size: var(--fs-h3);
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.h4 {
  font-size: var(--fs-h4);
  line-height: 1.35;
  letter-spacing: -0.015em;
}

.lead {
  font-size: var(--fs-lead);
  line-height: 1.6;
  color: var(--muted);
  max-width: var(--measure);
  text-wrap: pretty;
}

.text-muted { color: var(--muted); }
.text-sm { font-size: var(--fs-sm); }
.text-xs { font-size: var(--fs-xs); }
.text-center { text-align: center; }
.link { color: var(--fg); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; transition: text-decoration-color var(--dur-fast); }
.link:hover { text-decoration-color: currentColor; }
.mono { font-family: var(--font-mono); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary-ink);
}

.eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: var(--grad-brand);
}

.section--dark .eyebrow { color: #7cc8ff; }

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

.text-accent { color: var(--primary); }

.text-gradient {
  background: linear-gradient(100deg, #00b4ff 0%, #0063fb 55%, #0b3fbf 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.prose {
  max-width: 72ch;
  color: var(--fg-3);
  font-size: 1rem;
  line-height: 1.75;
}

.prose > * + * { margin-top: 1em; }
.prose h2 { font-size: 1.375rem; line-height: 1.3; letter-spacing: -0.02em; color: var(--fg); font-weight: 600; margin-top: 2.2em; scroll-margin-top: 100px; }
.prose h3 { font-size: 1.0625rem; color: var(--fg); font-weight: 600; margin-top: 1.6em; }
.prose ul, .prose ol { padding-left: 1.2em; }
.prose li + li { margin-top: 0.4em; }
.prose a { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }
.prose strong { color: var(--fg); font-weight: 600; }

/* --------------------------------------------------------------------------
   Layout primitives
   -------------------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container--narrow { max-width: var(--container-narrow); }

main {
  display: block;
  padding-top: var(--header-h);
}

.section {
  position: relative;
  padding-block: var(--section-y);
}

.section--tight { padding-block: clamp(48px, 6vw, 80px); }
.section--subtle { background: var(--bg-subtle); }
.section--muted { background: var(--bg-muted); }
.section--flush-top { padding-top: 0; }
.section--tight-top { padding-top: clamp(16px, 3vw, 40px); }
.section--anchor { scroll-margin-top: calc(var(--header-h-compact) + 56px); }
.section__inner { position: relative; }
.section-foot { display: flex; justify-content: center; margin-top: var(--s-7); }

.section--dark {
  background:
    radial-gradient(55% 45% at 88% 0%, rgba(0, 184, 255, 0.16), transparent 70%),
    radial-gradient(50% 50% at 0% 100%, rgba(0, 99, 251, 0.2), transparent 70%),
    var(--dark);
  color: var(--dark-fg);
  --border: var(--dark-border);
  --border-strong: var(--dark-border-strong);
  --muted: var(--dark-muted);
  --muted-2: var(--dark-muted);
  --fg: var(--dark-fg);
  --fg-3: #c9cad0;
}

.section--dark .h1,
.section--dark .h2,
.section--dark .h3,
.section--dark .h4 { color: var(--dark-fg); }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-5);
  margin-bottom: clamp(32px, 4vw, 56px);
}

.section-head__text {
  display: grid;
  gap: var(--s-4);
  max-width: 680px;
}

.section-head--center {
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.section-head--center .section-head__text { justify-items: center; }
.section-head--center .lead { margin-inline: auto; }

@media (max-width: 767px) {
  .section-head { flex-direction: column; align-items: flex-start; }
  .section-head--center { align-items: center; }
}

.stack { display: grid; gap: var(--stack-gap, var(--s-4)); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cluster-gap, var(--s-3)); }
.cluster--center { justify-content: center; }

.divider {
  height: 1px;
  background: var(--border);
  border: 0;
  margin: 0;
}

/* Decorative backgrounds */
.bg-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(0, 70, 200, 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 70, 200, 0.06) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 30%, transparent 75%);
}

.section--dark .bg-grid,
.bg-grid--dark {
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
}

.bg-glow {
  position: absolute;
  pointer-events: none;
  width: 900px;
  height: 600px;
  left: 50%;
  top: -260px;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(0, 99, 251, 0.22), transparent);
  filter: blur(10px);
}

.bg-noise {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* --------------------------------------------------------------------------
   Scroll reveal
   -------------------------------------------------------------------------- */

.js [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 24px, 0);
  transition:
    opacity var(--dur-reveal) var(--ease-out),
    transform var(--dur-reveal) var(--ease-out);
  transition-delay: var(--delay, 0ms);
}

.js [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

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

  .js [data-reveal] {
    opacity: 1;
    transform: none;
  }
}
