/* ==========================================================================
   Food Safety Specialist — base.css
   Design tokens, reset, typography, core components.
   Brand: #002EFF (from the FSS emblem). Motif: hexagon.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
  /* Brand blue — sampled from the FSS emblem */
  --brand:        #002EFF;
  --brand-700:    #0021BF;
  --brand-600:    #0026D6;
  --brand-500:    #1A44FF;
  --brand-400:    #4468FF;
  --brand-300:    #7B94FF;
  --brand-200:    #B6C4FF;
  --brand-100:    #DDE4FF;
  --brand-50:     #F0F3FF;

  /* Ink — deep navy-black, keeps the blue reading as brand not background */
  --ink:          #04081C;
  --ink-900:      #070D26;
  --ink-800:      #0C1436;
  --ink-700:      #141E4C;
  --ink-600:      #1E2A63;

  /* Neutrals */
  --white:        #FFFFFF;
  --paper:        #FBFCFF;
  --mist:         #F4F6FC;
  --line:         #E4E8F3;
  --line-strong:  #CFD6E8;
  --slate-400:    #8A93AD;
  --slate-500:    #6A7392;
  --slate-600:    #4E5675;
  --slate-700:    #363D58;

  /* Signal — pass/finding, used sparingly and always with a text label */
  --pass:         #00A85A;
  --pass-soft:    #E4F8EE;
  --watch:        #C77700;
  --watch-soft:   #FDF3E0;

  /* Typography */
  --font-display: 'Sora', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-body:    'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono:    ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, monospace;

  /* Fluid type scale */
  --t-hero:   clamp(2.6rem, 1.35rem + 4.6vw, 5.1rem);
  --t-h2:     clamp(1.95rem, 1.25rem + 2.5vw, 3.15rem);
  --t-h3:     clamp(1.25rem, 1.08rem + 0.6vw, 1.55rem);
  --t-lead:   clamp(1.05rem, 0.98rem + 0.4vw, 1.25rem);
  --t-body:   1rem;
  --t-sm:     0.9375rem;
  --t-xs:     0.8125rem;
  --t-eyebrow:0.75rem;

  /* Space & shape */
  --gutter:   clamp(1.15rem, 0.6rem + 2.4vw, 2.5rem);
  --shell:    1240px;
  --section-y: clamp(4.5rem, 3rem + 7vw, 8.5rem);
  --r-sm:  8px;
  --r-md:  14px;
  --r-lg:  20px;
  --r-xl:  28px;

  /* Elevation */
  --sh-sm:  0 1px 2px rgba(4, 8, 28, .06), 0 2px 8px rgba(4, 8, 28, .04);
  --sh-md:  0 4px 12px rgba(4, 8, 28, .07), 0 12px 32px rgba(4, 8, 28, .06);
  --sh-lg:  0 12px 28px rgba(4, 8, 28, .10), 0 32px 68px rgba(4, 8, 28, .10);
  --sh-brand: 0 12px 34px rgba(0, 46, 255, .22);

  --ease: cubic-bezier(.22, .61, .36, 1);
  --ease-out-back: cubic-bezier(.34, 1.4, .64, 1);

  --nav-h: 74px;
}

/* The hexagon from the emblem, reused as a clip path across the site */
:root {
  --hex: polygon(25% 2%, 75% 2%, 100% 50%, 75% 98%, 25% 98%, 0% 50%);
}

/* --------------------------------------------------------------------------
   2. Reset
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 18px);
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--t-body);
  line-height: 1.65;
  color: var(--slate-700);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink);
  margin: 0;
  line-height: 1.1;
  letter-spacing: -0.025em;
  font-weight: 700;
  text-wrap: balance;
}

p { margin: 0; text-wrap: pretty; }
img, svg, canvas { display: block; max-width: 100%; }
img { height: auto; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }

a {
  color: var(--brand);
  text-decoration-color: color-mix(in srgb, var(--brand) 35%, transparent);
  text-underline-offset: 3px;
  transition: color .2s var(--ease), text-decoration-color .2s var(--ease);
}
a:hover { text-decoration-color: currentColor; }

:focus-visible {
  outline: 3px solid var(--brand-400);
  outline-offset: 3px;
  border-radius: 4px;
}

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

.skip-link {
  position: absolute;
  left: 12px;
  top: -80px;
  z-index: 200;
  background: var(--ink);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--r-sm);
  font-weight: 600;
  transition: top .2s var(--ease);
}
.skip-link:focus { top: 12px; }

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

/* --------------------------------------------------------------------------
   3. Layout primitives
   -------------------------------------------------------------------------- */
.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: var(--section-y); position: relative; }
.section--tight { padding-block: clamp(3rem, 2rem + 4vw, 5rem); }
.section--mist { background: var(--mist); }
.section--paper { background: var(--paper); }

.section--ink {
  background: var(--ink);
  color: rgba(255, 255, 255, .72);
}
.section--ink h2,
.section--ink h3,
.section--ink h4 { color: #fff; }

/* Hairline separators that echo the brand rather than a plain grey rule */
.section--line-top { border-top: 1px solid var(--line); }

.stack   { display: grid; gap: 1rem; }
.stack-2 { display: grid; gap: 1.5rem; }
.stack-3 { display: grid; gap: 2.25rem; }

/* --------------------------------------------------------------------------
   4. Section headers
   -------------------------------------------------------------------------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  font-family: var(--font-body);
  font-size: var(--t-eyebrow);
  font-weight: 650;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--brand);
  margin: 0 0 1.15rem;
}
.eyebrow::before {
  content: '';
  width: 11px;
  height: 12px;
  background: currentColor;
  clip-path: var(--hex);
  flex: none;
}
.section--ink .eyebrow { color: var(--brand-300); }

.section-head { max-width: 62ch; margin-bottom: clamp(2.5rem, 1.5rem + 3vw, 4rem); }
.section-head--center { margin-inline: auto; text-align: center; }
.section-head h2 { font-size: var(--t-h2); }
.section-head p {
  margin-top: 1.15rem;
  font-size: var(--t-lead);
  color: var(--slate-500);
  line-height: 1.6;
}
.section--ink .section-head p { color: rgba(255, 255, 255, .68); }

/* --------------------------------------------------------------------------
   5. Buttons
   -------------------------------------------------------------------------- */
.btn {
  --btn-bg: var(--brand);
  --btn-fg: #fff;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  padding: 1rem 1.7rem;
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--t-sm);
  letter-spacing: -0.005em;
  text-decoration: none;
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: 1px solid transparent;
  overflow: hidden;
  isolation: isolate;
  transition: transform .22s var(--ease), box-shadow .22s var(--ease),
              background-color .22s var(--ease), color .22s var(--ease),
              border-color .22s var(--ease);
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn--primary { box-shadow: var(--sh-brand); }
.btn--primary:hover { background: var(--brand-600); box-shadow: 0 16px 40px rgba(0, 46, 255, .3); }

/* Sheen sweep on hover — subtle, reads as "scanning" */
.btn--primary::after {
  content: '';
  position: absolute;
  inset: 0 auto 0 -60%;
  width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .32), transparent);
  transform: skewX(-18deg);
  transition: left .55s var(--ease);
  z-index: -1;
}
.btn--primary:hover::after { left: 115%; }

.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  border-color: var(--line-strong);
}
.btn--ghost:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-50); }

.btn--on-ink {
  --btn-bg: rgba(255, 255, 255, .06);
  --btn-fg: #fff;
  border-color: rgba(255, 255, 255, .22);
  backdrop-filter: blur(8px);
}
.btn--on-ink:hover { background: rgba(255, 255, 255, .13); border-color: rgba(255, 255, 255, .4); }

.btn--sm { padding: .7rem 1.25rem; font-size: var(--t-xs); }
.btn--block { width: 100%; }
.btn[disabled], .btn[aria-disabled='true'] {
  opacity: .5;
  pointer-events: none;
  transform: none;
}

.btn__arrow { transition: transform .25s var(--ease); flex: none; }
.btn:hover .btn__arrow { transform: translateX(4px); }

/* Quiet inline link with an arrow */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-weight: 600;
  font-size: var(--t-sm);
  text-decoration: none;
}
.link-arrow svg { transition: transform .25s var(--ease); }
.link-arrow:hover svg { transform: translateX(4px); }

/* --------------------------------------------------------------------------
   6. Hexagon utilities — the recurring brand shape
   -------------------------------------------------------------------------- */
.hex {
  display: grid;
  place-items: center;
  flex: none;
  clip-path: var(--hex);
  background: var(--brand-50);
  color: var(--brand);
  aspect-ratio: 1 / 1.09;
}
.hex--md { width: 58px; }
.hex--sm { width: 40px; }
.hex--solid { background: var(--brand); color: #fff; }
.hex--ink { background: rgba(255, 255, 255, .07); color: var(--brand-300); }

/* --------------------------------------------------------------------------
   7. Cards
   -------------------------------------------------------------------------- */
.card {
  position: relative;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: clamp(1.5rem, 1.2rem + 1vw, 2.1rem);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s var(--ease);
}
.card h3 { font-size: var(--t-h3); margin-bottom: .7rem; }
.card p { font-size: var(--t-sm); color: var(--slate-500); }

.card--lift:hover {
  transform: translateY(-5px);
  border-color: var(--brand-200);
  box-shadow: var(--sh-md);
}

/* Cursor-tracked glow, driven by --mx/--my set in motion.js */
.card--glow::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 0%),
              var(--brand), transparent 65%);
  -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 .3s var(--ease);
  pointer-events: none;
}
.card--glow:hover::before { opacity: 1; }

/* --------------------------------------------------------------------------
   8. Chips / pills
   -------------------------------------------------------------------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  font-size: var(--t-xs);
  font-weight: 550;
  color: var(--slate-600);
  transition: border-color .25s var(--ease), color .25s var(--ease),
              background-color .25s var(--ease), transform .25s var(--ease);
}
.chip:hover {
  border-color: var(--brand-200);
  color: var(--brand);
  background: var(--brand-50);
  transform: translateY(-2px);
}
.chip__dot { width: 7px; height: 8px; background: currentColor; clip-path: var(--hex); flex: none; }

.chip--ink {
  background: rgba(255, 255, 255, .05);
  border-color: rgba(255, 255, 255, .14);
  color: rgba(255, 255, 255, .8);
}
.chip--ink:hover {
  background: rgba(255, 255, 255, .1);
  border-color: var(--brand-400);
  color: #fff;
}

.chip-row { display: flex; flex-wrap: wrap; gap: .6rem; }

/* Mono "spec" tag for standard codes — SANS 10330, ISO 22000 etc. */
.spec {
  font-family: var(--font-mono);
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .02em;
  padding: .28rem .55rem;
  border-radius: 6px;
  background: var(--brand-50);
  color: var(--brand-700);
  border: 1px solid var(--brand-100);
  white-space: nowrap;
}
.section--ink .spec {
  background: rgba(0, 46, 255, .2);
  color: var(--brand-200);
  border-color: rgba(123, 148, 255, .28);
}

/* --------------------------------------------------------------------------
   9. Forms
   -------------------------------------------------------------------------- */
.field { display: grid; gap: .45rem; }

.field > label,
.field-label {
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--slate-700);
  letter-spacing: .01em;
}
.field-label .req { color: var(--brand); margin-left: 2px; }

.input,
.select,
.textarea {
  width: 100%;
  padding: .85rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--white);
  font-size: var(--t-sm);
  color: var(--ink);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background-color .2s var(--ease);
  -webkit-appearance: none;
     -moz-appearance: none;
          appearance: none;
}
.input::placeholder, .textarea::placeholder { color: var(--slate-400); }

.input:hover, .select:hover, .textarea:hover { border-color: var(--slate-400); }

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-100);
}

.textarea { resize: vertical; min-height: 130px; line-height: 1.6; }

.select {
  padding-right: 2.6rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' fill='none'%3E%3Cpath d='M1 1.5 7 7.5l6-6' stroke='%234E5675' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  cursor: pointer;
}

.field--invalid .input,
.field--invalid .select,
.field--invalid .textarea { border-color: #D62B2B; }
.field--invalid .input:focus,
.field--invalid .textarea:focus { box-shadow: 0 0 0 4px rgba(214, 43, 43, .13); }

.field-error {
  font-size: var(--t-xs);
  color: #C42121;
  font-weight: 550;
  min-height: 0;
}
.field-error:empty { display: none; }

/* --------------------------------------------------------------------------
   10. Honeypot — must be reachable by bots parsing the DOM, invisible to people.
       Deliberately NOT display:none, since some bots skip those. It is pushed
       off-screen and removed from the tab order and the a11y tree instead.
   -------------------------------------------------------------------------- */
.hp-field {
  position: absolute !important;
  left: -9999px !important;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   11. Motion — scroll reveal
   -------------------------------------------------------------------------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}
[data-reveal].is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
}
