/* ==========================================================================
   HUM Staffing — styles
   Structure: tokens → reset → base → layout → components → motion → responsive
   ========================================================================== */

@layer tokens, reset, base, layout, components, motion, responsive;

/* ---------- Tokens ---------- */
@layer tokens {
  :root {
    --navy-900: #050f20;
    --navy-800: #0a1b3d;
    --navy-700: #0b2150;
    --blue-600: #0b63f6;
    --blue-700: #0a52cf;
    --blue-400: #5b9bff;
    --ink: #0b1b3a;
    --text: #55627a;
    --bg: #fff;
    --bg-soft: #f3f7fc;
    --card: #f7faff;
    --line: #e3eaf6;

    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --fs-h2: clamp(1.75rem, 1.4rem + 1.2vw, 2.25rem);
    --fs-body: 0.95rem;

    --container: 1180px;
    --gutter: clamp(20px, 4vw, 48px);
    --space-section: clamp(56px, 7vw, 96px);
    --radius: 14px;
    --ease: cubic-bezier(.22, 1, .36, 1);
    --header-h: 68px;
  }
}

/* ---------- Reset ---------- */
@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  * { margin: 0; }
  img, svg { display: block; max-width: 100%; }
  ul { padding: 0; list-style: none; }
  a { color: inherit; text-decoration: none; }
  button { font: inherit; color: inherit; }
}

/* ---------- Base ---------- */
@layer base {
  html { scroll-behavior: smooth; scroll-padding-top: var(--header-h); }
  body {
    font: 400 var(--fs-body)/1.7 var(--font);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }
  h1, h2, h3 { color: var(--ink); line-height: 1.15; text-wrap: balance; }
  p { text-wrap: pretty; }
  :focus-visible { outline: 3px solid var(--blue-400); outline-offset: 3px; border-radius: 6px; }
  ::selection { background: var(--blue-600); color: #fff; }

  .skip-link {
    position: fixed; top: 8px; left: 8px; z-index: 100;
    padding: 10px 16px; border-radius: 8px;
    background: var(--ink); color: #fff;
    transform: translateY(-200%);
  }
  .skip-link:focus { transform: none; }

  .ico { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
  .ico--fill { fill: currentColor; stroke: none; }
}

/* ---------- Layout ---------- */
@layer layout {
  .container { width: min(100% - var(--gutter) * 2, var(--container)); margin-inline: auto; }
  .section { padding-block: var(--space-section); }
  .section--soft { background: var(--bg-soft); }

  .section__head h2 { font-size: var(--fs-h2); }
  .section__head p { margin-top: 14px; max-width: 44ch; }

  .eyebrow {
    display: block; margin-bottom: 10px;
    font-size: .75rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
    color: var(--blue-600);
  }

  .grid { display: grid; gap: 20px; }
  .grid--4 { grid-template-columns: repeat(4, 1fr); margin-top: 40px; }

  .split { display: grid; grid-template-columns: 1fr 1.2fr; gap: clamp(32px, 6vw, 80px); }
  .split--center { align-items: center; }
}

/* ---------- Components ---------- */
@layer components {
  /* Logo */
  .logo { display: inline-flex; align-items: baseline; gap: 10px; color: var(--ink); }
  .logo strong { font-size: 1.75rem; font-weight: 800; letter-spacing: .01em; }
  .logo span { font-size: .75rem; font-weight: 500; letter-spacing: .4em; }

  /* Buttons */
  .btn {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 14px 24px; border: 1px solid transparent; border-radius: 999px;
    font-size: .875rem; font-weight: 500; line-height: 1; cursor: pointer;
    transition: background-color .25s, border-color .25s, box-shadow .25s, transform .25s var(--ease);
  }
  .btn .ico { width: 16px; height: 16px; stroke-width: 2; transition: transform .25s var(--ease); }
  .btn:hover .ico { transform: translateX(4px); }
  .btn--primary { background: var(--blue-600); color: #fff; box-shadow: 0 6px 18px rgba(11, 99, 246, .28); }
  .btn--primary:hover { background: var(--blue-700); box-shadow: 0 10px 26px rgba(11, 99, 246, .38); }
  .btn--ghost { border-color: rgba(255, 255, 255, .45); color: #fff; backdrop-filter: blur(4px); }
  .btn--ghost:hover { background: rgba(255, 255, 255, .12); border-color: #fff; }
  .btn--sm { padding: 12px 18px; border-radius: 10px; font-size: .8125rem; }
  .btn--lg { padding: 19px 28px; }

  /* Scroll progress */
  .progress {
    position: fixed; inset: 0 0 auto; z-index: 70; height: 3px;
    background: linear-gradient(90deg, var(--blue-600), var(--blue-400));
    transform-origin: 0 50%; transform: scaleX(var(--progress, 0));
  }

  /* Header */
  .header {
    position: sticky; top: 0; z-index: 60;
    background: rgba(255, 255, 255, .88);
    backdrop-filter: saturate(1.6) blur(12px);
    border-bottom: 1px solid transparent;
    transition: border-color .3s, box-shadow .3s;
  }
  .header.is-scrolled { border-color: var(--line); box-shadow: 0 6px 24px rgba(11, 27, 58, .06); }
  .header__inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; height: var(--header-h); }

  .nav { display: flex; gap: 38px; }
  .nav a { position: relative; padding-block: 8px; font-size: .8125rem; font-weight: 500; color: var(--ink); transition: color .2s; }
  .nav a::after {
    content: ""; position: absolute; inset: auto 0 -4px; height: 2px; border-radius: 2px;
    background: var(--blue-600); transform: scaleX(0); transition: transform .3s var(--ease);
  }
  .nav a:hover, .nav a.is-active { color: var(--blue-600); }
  .nav a:hover::after, .nav a.is-active::after { transform: scaleX(1); }

  .menu-toggle {
    display: none; width: 44px; height: 44px; place-items: center;
    border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer;
  }
  .menu-toggle span, .menu-toggle span::before, .menu-toggle span::after {
    content: ""; display: block; width: 18px; height: 2px; border-radius: 2px;
    background: var(--ink); position: relative; transition: transform .3s var(--ease), background-color .3s;
  }
  .menu-toggle span::before { position: absolute; top: -6px; }
  .menu-toggle span::after { position: absolute; top: 6px; }
  .menu-toggle[aria-expanded="true"] span { background: transparent; }
  .menu-toggle[aria-expanded="true"] span::before { transform: translateY(6px) rotate(45deg); }
  .menu-toggle[aria-expanded="true"] span::after { transform: translateY(-6px) rotate(-45deg); }

  /* Hero */
  .hero {
    position: relative; isolation: isolate; overflow: hidden;
    display: flex; align-items: center; min-height: clamp(380px, 52vw, 520px);
    padding-block: 64px; color: #fff;
    background: linear-gradient(120deg, var(--navy-900) 0%, var(--navy-700) 55%, #a8683f 140%);
  }
  .hero__img { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; object-position: 70% center; }
  .hero::after {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background: linear-gradient(90deg, rgba(5, 15, 32, .95) 0%, rgba(5, 15, 32, .72) 42%, rgba(5, 15, 32, .1) 100%);
  }
  .hero__content { display: grid; justify-items: start; }
  .hero__kicker { font-size: 1rem; color: var(--blue-400); }
  .hero h1 { margin-top: 10px; font-size: clamp(2.25rem, 1.6rem + 2.6vw, 3.25rem); font-weight: 700; letter-spacing: -.015em; color: #fff; }
  .hero__sub { margin-top: 4px; font-size: clamp(1.4rem, 1.1rem + 1.4vw, 2rem); font-weight: 600; line-height: 1.25; color: #fff; }
  .hero__text { margin-top: 20px; max-width: 46ch; color: #dfe7f5; }
  .hero__actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 32px; }

  /* Cards */
  .card {
    position: relative; overflow: hidden; padding: 28px 26px 32px;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    transition: border-color .3s, box-shadow .3s, transform .4s var(--ease);
  }
  .card::before { /* cursor-following spotlight */
    content: ""; position: absolute; inset: 0; opacity: 0; pointer-events: none;
    background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 50%), rgba(11, 99, 246, .12), transparent 70%);
    transition: opacity .3s;
  }
  .card:hover { border-color: #c7d8f7; box-shadow: 0 18px 40px rgba(11, 99, 246, .12); transform: translateY(-4px); }
  .card:hover::before { opacity: 1; }
  .card h3 { margin-top: 20px; font-size: 1rem; font-weight: 600; }
  .card p { margin-top: 8px; font-size: .8125rem; line-height: 1.7; }

  .icon {
    display: grid; place-items: center; width: 48px; height: 48px;
    border-radius: 12px; background: #e8f0ff; color: var(--blue-600);
    transition: background-color .3s, color .3s;
  }
  .icon .ico { width: 24px; height: 24px; }
  .icon--sm { width: 40px; height: 40px; border-radius: 10px; }
  .icon--sm .ico { width: 20px; height: 20px; }
  .card:hover .icon { background: var(--blue-600); color: #fff; }

  /* About */
  .about__figure { overflow: hidden; border-radius: var(--radius); box-shadow: 0 24px 48px rgba(11, 27, 58, .16); background: linear-gradient(135deg, #1b2a44, #0b1220 60%, #7a4b2b 130%); aspect-ratio: 358 / 254; }
  .about__figure img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
  .about__figure:hover img { transform: scale(1.04); }

  .features { display: flex; margin-top: 40px; }
  .features li { display: grid; gap: 12px; padding-inline: 28px; border-left: 1px solid var(--line); }
  .features li:first-child { padding-left: 0; border-left: 0; }
  .features p { font-size: .8125rem; font-weight: 500; line-height: 1.5; color: var(--ink); }

  /* Stats */
  .stats { display: grid; grid-template-columns: repeat(3, 1fr); }
  .stats > div { display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 6px; padding: 6px 28px; border-left: 1px solid var(--line); }
  .stats dd { font-size: clamp(2rem, 1.5rem + 1.6vw, 2.75rem); font-weight: 700; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
  .stats dt { font-size: .8125rem; line-height: 1.5; }

  /* CTA / contact */
  .cta { position: relative; isolation: isolate; overflow: hidden; padding-block: clamp(56px, 6vw, 80px); color: #fff; background: linear-gradient(120deg, #07163a, #0a1d47); }
  .cta::before { /* dotted world texture */
    content: ""; position: absolute; inset: 0 0 0 40%; z-index: -1; opacity: .6;
    background: radial-gradient(circle, rgba(80, 130, 220, .6) 1.2px, transparent 1.7px) 0 0 / 9px 9px;
    -webkit-mask-image: radial-gradient(ellipse at 70% 40%, #000, transparent 70%);
            mask-image: radial-gradient(ellipse at 70% 40%, #000, transparent 70%);
  }
  .cta .eyebrow { color: var(--blue-400); }
  .cta h2 { font-size: clamp(1.75rem, 1.4rem + 1vw, 2.125rem); color: #fff; }
  .cta p { margin-top: 18px; max-width: 42ch; font-size: .9rem; color: #d6e0f4; }
  .cta .btn { margin-top: 28px; }

  .contact { display: grid; gap: 24px; max-width: 300px; }
  .contact li { display: flex; gap: 16px; align-items: flex-start; }
  .contact li + li { padding-top: 24px; border-top: 1px solid rgba(255, 255, 255, .14); }
  .contact .ico { flex: none; width: 24px; height: 24px; margin-top: 2px; color: var(--blue-400); }
  .contact strong { display: block; font-size: .8125rem; font-weight: 500; }
  .contact a, .contact span { font-size: .75rem; color: #b8c6e2; }
  .contact a:hover { color: #fff; text-decoration: underline; }

  /* Footer */
  .footer { padding-block: 32px; color: #fff; background: var(--navy-900); }
  .footer .logo { color: #fff; }
  .footer .logo strong { font-size: 1.4rem; }
  .footer .logo span { font-size: .625rem; }
  .footer__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px; }
  .footer__nav { display: flex; flex-wrap: wrap; gap: 28px; font-size: .6875rem; }
  .footer__nav a:hover { color: var(--blue-400); }
  .footer__meta { display: flex; align-items: center; gap: 18px; }
  .footer__meta .ico { width: 18px; height: 18px; transition: color .2s; }
  .footer__meta a:hover .ico { color: var(--blue-400); }
  .footer__meta p { margin-left: 6px; font-size: .65rem; color: #8b97b0; }
}

/* ---------- Motion ---------- */
@layer motion {
  /* Hero: one orchestrated entrance */
  @keyframes rise { from { opacity: 0; translate: 0 22px; } to { opacity: 1; translate: 0 0; } }
  @keyframes settle { from { scale: 1.08; } to { scale: 1; } }
  .hero__img { animation: settle 2.4s var(--ease) both; }
  .hero__content > * { animation: rise .9s var(--ease) both; animation-delay: calc(var(--n, 0) * 110ms + 150ms); }
  .hero__content > :nth-child(2) { --n: 1; }
  .hero__content > :nth-child(3) { --n: 2; }
  .hero__content > :nth-child(4) { --n: 3; }
  .hero__content > :nth-child(5) { --n: 4; }

  /* Scroll reveal (only when JS is active) */
  .js [data-reveal] {
    opacity: 0; translate: 0 18px;
    transition: opacity .8s var(--ease), translate .8s var(--ease), transform .4s var(--ease), box-shadow .3s, border-color .3s;
    transition-delay: calc(var(--i, 0) * 90ms), calc(var(--i, 0) * 90ms), 0s, 0s, 0s;
  }
  .js [data-reveal].is-visible { opacity: 1; translate: 0 0; }
}

/* ---------- Responsive ---------- */
@layer responsive {
  @media (max-width: 1024px) {
    .grid--4 { grid-template-columns: repeat(2, 1fr); }
    .split { grid-template-columns: 1fr; }
    .about__figure { max-width: 560px; }
  }

  @media (max-width: 820px) {
    .menu-toggle { display: grid; }
    .header .btn { display: none; }
    .header__inner { justify-content: space-between; }
    .nav {
      position: absolute; inset: var(--header-h) 0 auto; flex-direction: column; gap: 0;
      padding: 8px var(--gutter) 20px; background: #fff; border-bottom: 1px solid var(--line);
      box-shadow: 0 20px 30px rgba(11, 27, 58, .08);
      visibility: hidden; opacity: 0; translate: 0 -8px;
      transition: opacity .25s, translate .25s var(--ease), visibility .25s;
    }
    .nav.is-open { visibility: visible; opacity: 1; translate: 0 0; }
    .nav a { padding-block: 14px; font-size: .95rem; }
    .nav a::after { display: none; }
  }

  @media (max-width: 640px) {
    .grid--4 { grid-template-columns: 1fr; }
    .features, .stats { flex-direction: column; grid-template-columns: 1fr; gap: 24px; }
    .features li, .stats > div { padding: 0; border-left: 0; }
    .features li { grid-template-columns: auto 1fr; align-items: center; }
    .footer__inner, .footer__meta { flex-direction: column; align-items: flex-start; }
    .footer__meta p { margin-left: 0; }
  }

  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
    .js [data-reveal] { opacity: 1; translate: none; }
  }
}
