/* ==========================================================================
   RPS Security — main.css (C)
   Design tokens · reset · base typography · layout & utility classes
   Component styles live in components.css (loaded after this file).

   NAMING CONVENTION (used across both stylesheets)
     .block              component root          e.g. .service-card
     .block__element     child of a component    e.g. .service-card__title
     .block--modifier    variant of a component  e.g. .btn--primary
     .is-* / .has-*      runtime state, JS-set   e.g. .is-scrolled
     .u-*                single-purpose utility  e.g. .u-text-center

   Mobile-first: base rules target small screens, media queries scale UP.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. DESIGN TOKENS
   Brand colours are fixed by the client design spec (see CLAUDE.md).
   Surface/ink shades are derived from those brand values for depth.
   -------------------------------------------------------------------------- */
:root {
  /* --- Brand palette (spec values — do not change without client sign-off) */
  --c-navy:            #0A0E1A;
  --c-red:             #D62828;
  --c-white:           #FFFFFF;
  --c-grey-light:      #F5F5F5;

  /* --- Derived surfaces (tints of the navy, for layering dark sections) */
  --c-navy-900:        #060911;
  --c-navy-800:        #0A0E1A;
  --c-navy-700:        #111726;
  --c-navy-600:        #1A2233;
  --c-navy-500:        #253046;

  /* --- Derived accents */
  --c-red-dark:        #A81E1E;
  --c-red-light:       #E84A4A;
  --c-red-wash:        rgba(214, 40, 40, 0.12);

  /* --- Neutrals */
  --c-grey-200:        #E4E6EB;
  --c-grey-400:        #A9AFBC;
  --c-grey-600:        #6B7280;
  --c-grey-800:        #2C3242;

  /* --- Semantic ink (text) */
  --ink-strong:        var(--c-navy);
  --ink-body:          #3A4152;
  --ink-muted:         var(--c-grey-600);
  --ink-on-dark:       var(--c-white);
  --ink-on-dark-muted: #A9B2C4;

  /* --- Semantic surfaces */
  --surface-page:      var(--c-white);
  --surface-alt:       var(--c-grey-light);
  --surface-dark:      var(--c-navy);
  --surface-dark-alt:  var(--c-navy-700);
  --surface-card:      var(--c-white);

  /* --- Borders */
  --border-hairline:   rgba(10, 14, 26, 0.10);
  --border-on-dark:    rgba(255, 255, 255, 0.10);

  /* --- Third-party brand colours */
  --c-whatsapp:        #25D366;
  --c-whatsapp-dark:   #1DA851;

  /* --- Typography */
  --font-sans: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, Helvetica, Arial, sans-serif;

  --fw-regular:  400;
  --fw-medium:   500;
  --fw-semibold: 600;
  --fw-bold:     700;
  --fw-black:    800;

  /* Fluid type scale — min at 360px, max at 1200px viewport */
  --fs-xs:   0.75rem;                                   /* 12px  eyebrows   */
  --fs-sm:   0.875rem;                                  /* 14px  meta       */
  --fs-base: 1rem;                                      /* 16px  body       */
  --fs-md:   clamp(1.0625rem, 0.30vw + 1rem,  1.125rem);/* lead paragraph   */
  --fs-lg:   clamp(1.25rem,  0.60vw + 1.1rem, 1.5rem);  /* h4 / card title  */
  --fs-xl:   clamp(1.5rem,   1.10vw + 1.2rem, 2rem);    /* h3               */
  --fs-2xl:  clamp(1.875rem, 1.80vw + 1.4rem, 2.75rem); /* h2 section head  */
  --fs-3xl:  clamp(2.25rem,  3.20vw + 1.5rem, 4rem);    /* h1 hero          */

  --lh-tight:  1.15;
  --lh-snug:   1.3;
  --lh-normal: 1.65;

  --ls-tight:  -0.02em;
  --ls-wide:    0.06em;
  --ls-wider:   0.14em;   /* eyebrow / all-caps labels */

  /* --- Spacing scale (4px base) */
  --sp-1:  0.25rem;
  --sp-2:  0.5rem;
  --sp-3:  0.75rem;
  --sp-4:  1rem;
  --sp-5:  1.5rem;
  --sp-6:  2rem;
  --sp-7:  2.5rem;
  --sp-8:  3rem;
  --sp-9:  4rem;
  --sp-10: 5rem;
  --sp-11: 6rem;

  /* Vertical rhythm for page sections — grows on larger screens */
  --section-y:       clamp(3.5rem, 7vw, 6.5rem);
  --section-y-tight: clamp(2.5rem, 4vw, 4rem);

  /* --- Layout */
  --container-max:    1200px;
  --container-narrow: 780px;
  --container-pad:    1.25rem;

  /* --- Radii */
  --r-sm:   4px;
  --r-md:   8px;
  --r-lg:   14px;
  --r-xl:   22px;
  --r-full: 999px;

  /* --- Elevation */
  --shadow-sm: 0 1px 2px rgba(10, 14, 26, 0.06),
               0 2px 6px rgba(10, 14, 26, 0.05);
  --shadow-md: 0 4px 12px rgba(10, 14, 26, 0.08),
               0 12px 28px rgba(10, 14, 26, 0.07);
  --shadow-lg: 0 10px 24px rgba(10, 14, 26, 0.12),
               0 28px 60px rgba(10, 14, 26, 0.14);
  --shadow-red: 0 8px 22px rgba(214, 40, 40, 0.32);

  /* --- Motion */
  --ease:        cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast:    150ms;
  --dur:         250ms;
  --dur-slow:    400ms;

  /* --- Component metrics */
  --nav-h:         76px;   /* resting sticky nav height (desktop)  */
  --nav-h-shrunk:  60px;   /* after .is-scrolled                   */
  --nav-h-mobile:  64px;

  /* --- Z-index scale (single source of truth for stacking) */
  --z-base:    1;
  --z-raised:  10;
  --z-nav:    100;
  --z-drawer: 200;
  --z-fab:    300;
  --z-skip:   400;

  /* --- Focus ring */
  --focus-ring: 3px solid var(--c-red);
  --focus-offset: 2px;
}

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Keeps in-page anchor targets clear of the sticky nav. */
  scroll-padding-top: calc(var(--nav-h) + var(--sp-4));
}

body {
  min-height: 100vh;
  background: var(--surface-page);
  color: var(--ink-body);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  font-weight: var(--fw-regular);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Locked while the mobile nav drawer is open (toggled from main.js). */
body.has-nav-open { overflow: hidden; }

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

img,
video { height: auto; }

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

button { cursor: pointer; }

ul[class],
ol[class] {
  list-style: none;
  padding: 0;
}

a { color: inherit; }

table {
  border-collapse: collapse;
  width: 100%;
}

/* --------------------------------------------------------------------------
   3. BASE TYPOGRAPHY
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  color: var(--ink-strong);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  text-wrap: balance;
}

h1 { font-size: var(--fs-3xl); font-weight: var(--fw-black); }
h2 { font-size: var(--fs-2xl); font-weight: var(--fw-black); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }
h5 { font-size: var(--fs-md); }
h6 {
  font-size: var(--fs-sm);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
}

p { text-wrap: pretty; }

p + p { margin-top: var(--sp-4); }

strong, b { font-weight: var(--fw-bold); color: var(--ink-strong); }

a {
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--dur-fast) var(--ease);
}

a:hover { color: var(--c-red); }

:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
  border-radius: var(--r-sm);
}

/* Dark sections invert the ink tokens for everything nested inside. */
.on-dark,
.section--dark {
  --ink-strong: var(--ink-on-dark);
  --ink-body: var(--ink-on-dark-muted);
  --ink-muted: var(--ink-on-dark-muted);
  --border-hairline: var(--border-on-dark);
  color: var(--ink-on-dark-muted);
}

/* --------------------------------------------------------------------------
   4. LAYOUT UTILITIES
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

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

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

.section--dark {
  background: var(--surface-dark);
  color: var(--ink-on-dark-muted);
}

.section--darker { background: var(--c-navy-900); }
.section--alt { background: var(--surface-alt); }

/* Section heading block: eyebrow + title + optional standfirst */
.section-head {
  max-width: 44rem;
  margin-bottom: var(--sp-7);
}

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

.section-head__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
  color: var(--c-red);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
}

.section-head__eyebrow::before {
  content: "";
  width: 28px;
  height: 2px;
  background: var(--c-red);
}

.section-head--center .section-head__eyebrow::after {
  content: "";
  width: 28px;
  height: 2px;
  background: var(--c-red);
}

.section-head__title { margin-bottom: var(--sp-4); }

.section-head__text {
  color: var(--ink-muted);
  font-size: var(--fs-md);
}

/* Auto-fitting grid — the workhorse for cards across every page. */
.grid {
  display: grid;
  gap: var(--sp-5);
}

.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); }

/* Two-column split that stacks on mobile. */
.split {
  display: grid;
  gap: var(--sp-7);
  align-items: center;
}

@media (min-width: 900px) {
  .split { grid-template-columns: 1fr 1fr; gap: var(--sp-9); }
  .split--wide-left { grid-template-columns: 1.25fr 1fr; }
  .split--wide-right { grid-template-columns: 1fr 1.25fr; }
}

/* --------------------------------------------------------------------------
   5. BUTTONS
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 0.85em 1.6em;
  border: 2px solid transparent;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--ink-strong);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-wide);
  line-height: 1.2;
  text-transform: uppercase;
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
  transition: background-color var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              color var(--dur) var(--ease),
              transform var(--dur-fast) var(--ease),
              box-shadow var(--dur) var(--ease);
}

.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn__icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Primary — the red call-to-action. */
.btn--primary {
  background: var(--c-red);
  border-color: var(--c-red);
  color: var(--c-white);
}

.btn--primary:hover {
  background: var(--c-red-dark);
  border-color: var(--c-red-dark);
  color: var(--c-white);
  box-shadow: var(--shadow-red);
}

/* Ghost — outlined, for use on dark backgrounds. */
.btn--ghost {
  border-color: rgba(255, 255, 255, 0.45);
  color: var(--c-white);
}

.btn--ghost:hover {
  background: var(--c-white);
  border-color: var(--c-white);
  color: var(--c-navy);
}

/* Outline — outlined, for use on light backgrounds. */
.btn--outline {
  border-color: var(--c-navy);
  color: var(--c-navy);
}

.btn--outline:hover {
  background: var(--c-navy);
  color: var(--c-white);
}

/* Solid light — for maximum contrast on dark sections. */
.btn--light {
  background: var(--c-white);
  border-color: var(--c-white);
  color: var(--c-navy);
}

.btn--light:hover {
  background: var(--c-grey-light);
  border-color: var(--c-grey-light);
  color: var(--c-navy);
}

.btn--lg {
  padding: 1.05em 2em;
  font-size: var(--fs-base);
}

.btn--block {
  display: flex;
  width: 100%;
}

.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.55;
  pointer-events: none;
}

/* Button rows */
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
}

.btn-row--center { justify-content: center; }

/* --------------------------------------------------------------------------
   6. SMALL UTILITIES
   -------------------------------------------------------------------------- */
.u-text-center { text-align: center; }
.u-text-muted  { color: var(--ink-muted); }
.u-text-red    { color: var(--c-red); }
.u-lead        { font-size: var(--fs-md); }
.u-mt-0        { margin-top: 0; }
.u-mt-4        { margin-top: var(--sp-4); }
.u-mt-6        { margin-top: var(--sp-6); }
.u-mb-0        { margin-bottom: 0; }
.u-mb-5        { margin-bottom: var(--sp-5); }
.u-nowrap      { white-space: nowrap; }

/* Accessible-but-invisible: for labels and headings screen readers need. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Keyboard escape hatch past the nav. */
.skip-link {
  position: absolute;
  top: var(--sp-2);
  left: var(--sp-2);
  z-index: var(--z-skip);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  background: var(--c-red);
  color: var(--c-white);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  text-decoration: none;
  transform: translateY(-150%);
  transition: transform var(--dur) var(--ease);
}

.skip-link:focus-visible {
  color: var(--c-white);
  transform: translateY(0);
}

/* Content flow spacing inside prose blocks. */
.prose > * + * { margin-top: var(--sp-4); }
.prose h2,
.prose h3 { margin-top: var(--sp-7); }

/* --------------------------------------------------------------------------
   7. MOTION PREFERENCES
   Everything animated elsewhere must degrade here.
   -------------------------------------------------------------------------- */
@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;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   8. PRINT
   -------------------------------------------------------------------------- */
@media print {
  .site-header,
  .wa-fab,
  .nav-toggle,
  .map-embed { display: none !important; }

  body { color: #000; background: #fff; }

  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.8em; }
}
