/* ============================================================
   CHRIST APPS — Design Tokens & Base
   ============================================================ */

@layer reset, base, theme, utilities;

@layer reset {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }

  html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: 96px;
  }

  body,
  h1, h2, h3, h4,
  p, blockquote, figure,
  ul, ol, dl, dd,
  pre, hr {
    margin: 0;
  }

  ul[role="list"],
  ol[role="list"] {
    list-style: none;
  }

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

  img {
    height: auto;
  }

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

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

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

@layer theme {
  :root {
    color-scheme: dark;

    /* Surfaces */
    --bg: #050507;
    --bg-2: #0a0a0f;
    --card: #101016;
    --card-hi: #15151d;
    --card-hi-2: #1a1a24;

    /* Lines */
    --line: rgba(255, 255, 255, 0.08);
    --line-soft: rgba(255, 255, 255, 0.05);
    --line-strong: rgba(255, 255, 255, 0.16);

    /* Accent */
    --accent: #8b5cf6;
    --accent-600: #7c3aed;
    --accent-soft: #a78bfa;
    --accent-dim: rgba(139, 92, 246, 0.14);
    --accent-glow: rgba(139, 92, 246, 0.55);

    /* Text */
    --text: #ffffff;
    --text-2: #a1a1aa;
    --muted: #7e7e89;

    /* Status */
    --green: #34d399;
    --green-dim: rgba(52, 211, 153, 0.12);
    --amber: #fbbf24;
    --amber-dim: rgba(251, 191, 36, 0.12);
    --red: #f87171;
    --red-dim: rgba(248, 113, 113, 0.12);
    --violet: #a78bfa;
    --violet-dim: rgba(167, 139, 250, 0.14);
    --blue: #7dd3fc;
    --blue-dim: rgba(125, 211, 252, 0.12);

    /* Radius */
    --r-lg: 28px;
    --r-md: 20px;
    --r-sm: 14px;
    --r-btn: 13px;
    --r-pill: 999px;

    /* Typography */
    --font-sans: "Inter", "Plus Jakarta Sans", "Manrope", system-ui,
      -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: "Inter", "Plus Jakarta Sans", "Manrope", system-ui,
      -apple-system, "Segoe UI", Roboto, sans-serif;

    --tracking-tight: -0.035em;
    --tracking-snug: -0.015em;

    /* Layout */
    --container: 1200px;
    --container-wide: 1240px;
    --pad-mobile: clamp(16px, 5vw, 24px);

    /* Shadows */
    --shadow-card: 0 1px 0 0 rgba(255, 255, 255, 0.04) inset,
      0 24px 48px -24px rgba(0, 0, 0, 0.7);
    --shadow-phone: 0 40px 80px -24px rgba(0, 0, 0, 0.8),
      0 0 0 1px rgba(255, 255, 255, 0.06),
      0 0 80px -20px rgba(139, 92, 246, 0.25);
  }
}

@layer base {
  html {
    background: var(--bg);
  }

  body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: clip;
  }

  ::selection {
    background: rgba(139, 92, 246, 0.35);
    color: #fff;
  }

  h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: var(--tracking-tight);
    line-height: 1.08;
    text-wrap: balance;
  }

  p {
    max-width: 64ch;
    text-wrap: pretty;
  }

  :where(a, button, input, summary, [tabindex]):focus-visible {
    outline: 2px solid var(--accent-soft);
    outline-offset: 3px;
    border-radius: 6px;
  }

  @media (prefers-reduced-motion: reduce) {
    html {
      scroll-behavior: auto;
    }
  }
}

@layer utilities {
  .container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--pad-mobile);
  }

  .visually-hidden {
    position: absolute !important;
    clip-path: inset(50%) !important;
    overflow: hidden !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    border: 0 !important;
    white-space: nowrap !important;
  }

  .skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 200;
    padding: 12px 20px;
    border-radius: var(--r-btn);
    background: var(--card-hi);
    color: var(--text);
    border: 1px solid var(--line-strong);
    transform: translateY(-200%);
    transition: transform 0.2s ease;
  }

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

  .gradient-text {
    background: linear-gradient(100deg, #fff 0%, var(--accent-soft) 120%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }

  .gradient-text-accent {
    background: linear-gradient(110deg, #ffffff 0%, var(--accent-soft) 55%, var(--accent) 110%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }

  /* ---------- Buttons ---------- */
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 44px;
    padding: 13px 24px;
    border-radius: var(--r-btn);
    font-weight: 600;
    font-size: 15px;
    letter-spacing: -0.01em;
    line-height: 1;
    white-space: nowrap;
    transition:
      transform 0.25s cubic-bezier(0.2, 0.8, 0.4, 1),
      box-shadow 0.25s ease,
      background-color 0.25s ease,
      border-color 0.25s ease,
      color 0.25s ease;
    will-change: transform;
  }

  .btn svg {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    transition: transform 0.25s ease;
  }

  .btn-primary {
    background: linear-gradient(160deg, #8b5cf6 0%, #7c3aed 100%);
    color: #fff;
    box-shadow:
      0 1px 0 0 rgba(255, 255, 255, 0.18) inset,
      0 12px 24px -12px rgba(124, 58, 237, 0.55);
    border: 1px solid rgba(167, 139, 250, 0.4);
  }

  .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow:
      0 1px 0 0 rgba(255, 255, 255, 0.22) inset,
      0 20px 40px -16px rgba(124, 58, 237, 0.65),
      0 0 24px rgba(139, 92, 246, 0.18);
  }

  .btn-primary:active {
    transform: translateY(0);
    box-shadow:
      0 1px 0 0 rgba(255, 255, 255, 0.14) inset,
      0 8px 16px -8px rgba(124, 58, 237, 0.4);
  }

  .btn-secondary {
    background: var(--card-hi);
    color: var(--text);
    border: 1px solid var(--line-strong);
    box-shadow: 0 1px 0 0 rgba(255, 255, 255, 0.05) inset;
    backdrop-filter: blur(8px);
  }

  .btn-secondary:hover {
    transform: translateY(-2px);
    background: var(--card-hi-2);
    border-color: rgba(167, 139, 250, 0.4);
    box-shadow:
      0 1px 0 0 rgba(255, 255, 255, 0.08) inset,
      0 8px 24px -8px rgba(139, 92, 246, 0.2);
  }

  .btn-secondary:active {
    transform: translateY(0);
  }

  .btn-ghost {
    color: var(--text-2);
    border: 1px solid transparent;
  }

  .btn-ghost:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.08);
  }

  .btn-lg {
    padding: 17px 32px;
    font-size: 16px;
  }

  .btn-sm {
    min-height: 40px;
    padding: 10px 18px;
    font-size: 14px;
  }

  .btn:hover svg.arrow {
    transform: translateX(3px);
  }

  /* ---------- Status badge ---------- */
  .badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    border-radius: var(--r-pill);
    font-size: 11.5px;
    font-weight: 650;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-2);
  }

  .badge .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
    flex-shrink: 0;
  }

  .badge--green {
    color: var(--green);
    background: var(--green-dim);
    border-color: rgba(52, 211, 153, 0.25);
  }

  .badge--green .dot {
    animation: dot-breathe 3s ease-in-out infinite alternate;
  }

  @keyframes dot-breathe {
    0% { box-shadow: 0 0 6px currentColor; }
    100% { box-shadow: 0 0 14px currentColor; }
  }

  .badge--violet {
    color: var(--violet);
    background: var(--violet-dim);
    border-color: rgba(167, 139, 250, 0.28);
  }

  .badge--amber {
    color: var(--amber);
    background: var(--amber-dim);
    border-color: rgba(251, 191, 36, 0.25);
  }

  .badge--red {
    color: var(--red);
    background: var(--red-dim);
    border-color: rgba(248, 113, 113, 0.25);
  }

  .badge--blue {
    color: var(--blue);
    background: var(--blue-dim);
    border-color: rgba(125, 211, 252, 0.25);
  }

  .badge--muted {
    color: var(--text-2);
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--line);
  }

  /* ---------- Section heading ---------- */
  .section {
    position: relative;
    padding-block: clamp(80px, 12vw, 140px);
  }

  .section:not(.hero):not(:first-child)::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: min(480px, 60%);
    height: 1px;
    background: linear-gradient(
      90deg,
      transparent 0%,
      rgba(139, 92, 246, 0.12) 30%,
      rgba(139, 92, 246, 0.25) 50%,
      rgba(139, 92, 246, 0.12) 70%,
      transparent 100%
    );
  }

  .section-head {
    display: grid;
    gap: 18px;
    margin-bottom: clamp(48px, 7vw, 72px);
  }

  .section-head--center {
    text-align: center;
    justify-items: center;
  }

  .section-head--center p {
    margin-inline: auto;
  }

  .eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent-soft);
  }

  .eyebrow::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 3px;
    background: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
  }

  .section-head--center .eyebrow {
    justify-content: center;
  }

  .section-title {
    font-size: clamp(30px, 5.4vw, 52px);
    letter-spacing: var(--tracking-tight);
    line-height: 1.06;
    text-wrap: balance;
  }

  .section-sub {
    color: var(--text-2);
    font-size: 17px;
    line-height: 1.65;
    text-wrap: pretty;
  }

  /* ---------- Card primitives ---------- */
  .card {
    position: relative;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    transition:
      transform 0.4s cubic-bezier(0.2, 0.8, 0.4, 1),
      border-color 0.4s ease,
      box-shadow 0.4s ease,
      background-color 0.3s ease;
  }

  .card:hover {
    transform: translateY(-4px);
    border-color: rgba(167, 139, 250, 0.35);
    box-shadow: 0 20px 48px -20px rgba(139, 92, 246, 0.3);
  }

  .card-hover-lift {
    transition:
      transform 0.4s cubic-bezier(0.2, 0.8, 0.4, 1),
      border-color 0.4s ease,
      box-shadow 0.4s ease;
  }

  .card-hover-lift:hover {
    transform: translateY(-4px);
    border-color: rgba(167, 139, 250, 0.35);
    box-shadow: 0 20px 48px -20px rgba(139, 92, 246, 0.3);
  }

  /* ---------- Background texture helpers ---------- */
  .bg-grid {
    background-image:
      linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
      linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 72px 72px;
    position: absolute;
    inset: 0;
    pointer-events: none;
    -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 0%, transparent 75%);
    mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 0%, transparent 75%);
  }

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