/* ═══════════════════════════════════════════════════════════════════
   Service Safe Ltd — Base: tokens, reset, typography, buttons
   Dark theme. Near-black canvas, grey elevated surfaces, a single
   light-blue accent. No gradients, no shadows — 1px borders instead.
   ═══════════════════════════════════════════════════════════════════ */

:root {
  /* ── Canvas & surfaces ── */
  --bg:        #060809;
  --surface-1: #0D1114;
  --surface-2: #151A1F;
  --surface-3: #1E252B;
  --border:    rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  /* ── Text ── */
  --text-1: #F2F5F7;
  --text-2: #A6AFB8;
  --text-3: #6B767F;

  /* ── Accent (the only hue) ── */
  --accent:      #7DC9FF;
  --accent-soft: rgba(125, 201, 255, 0.14);
  --accent-line: rgba(125, 201, 255, 0.32);
  --on-accent:   #041018;

  /* ── Semantic feedback ─────────────────────────────────────────────
     Kept as distinct hues, retuned for the dark canvas. An error state
     that isn't red is an accessibility regression — the data request
     failure notice in particular has to read as a failure. */
  --ok:     #5FD3A8;
  --ok-bg:  rgba(95, 211, 168, 0.12);
  --ok-line:rgba(95, 211, 168, 0.28);
  --err:    #FF8A8A;
  --err-bg: rgba(255, 138, 138, 0.12);
  --err-line: rgba(255, 138, 138, 0.28);

  /* Review stars stay gold — a universal convention; recolouring them
     reads as "unrated". */
  --star: #F5A623;

  /* ── Type ─────────────────────────────────────────────────────────────
     One grotesque for the whole site, GOV.UK style: plain letterforms,
     heavy bold headings, regular body.

     GOV.UK itself sets `"GDS Transport", arial, sans-serif`. GDS
     Transport is licensed only to GOV.UK and crown bodies, so it is not
     an option here; Inter is the closest neutral grotesque on the one
     font host the CSP allows, backed by GOV.UK's own Arial fallback.
     --font-display stays as a separate token so a display face can be
     swapped back in from one place. */
  --font: 'Inter', Arial, Helvetica, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-display: var(--font);
  --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;

  --fs-hero: clamp(2.5rem, 6vw, 3.5rem);
  --fs-2xl:  clamp(1.75rem, 3.6vw, 2.5rem);
  --fs-xl:   clamp(1.375rem, 2.6vw, 1.875rem);
  --fs-lg:   clamp(1.0625rem, 1.7vw, 1.25rem);
  --fs-md:   1rem;
  --fs-sm:   0.9375rem;
  --fs-xs:   0.8125rem;

  /* ── Space (4px grid) ── */
  --sp-05: 4px;
  --sp-1:  8px;
  --sp-2:  16px;
  --sp-3:  24px;
  --sp-4:  32px;
  --sp-6:  48px;
  --sp-8:  64px;
  --sp-12: 96px;
  --sp-16: 128px;

  /* ── Radius scale ── */
  --r-control: 10px;   /* inputs, small controls */
  --r-thumb:   14px;   /* thumbnails, icon tiles */
  --r-card:    20px;   /* cards */
  --r-panel:   24px;   /* large floating panels */
  --r-pill:    9999px;

  /* Legacy aliases kept so every stylesheet resolves to the new scale */
  --r-sm: var(--r-control);
  --r-md: var(--r-thumb);
  --r-lg: var(--r-card);

  /* ── Motion ── */
  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --t-fast: 150ms;
  --t-mid:  200ms;
  --t-slow: 320ms;

  /* ── Layout ── */
  --shell: 1280px;
  --gutter: clamp(20px, 4vw, 56px);
}

/* ── Reset ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  color-scheme: dark;
  scroll-behavior: smooth;
  scroll-padding-top: 16px;   /* the topbar scrolls with the page */
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text-2);
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* `clip` contains the off-screen drawer without turning body into a
     scroll container; `hidden` is the fallback for older browsers. */
  overflow-x: hidden;
  overflow-x: clip;
}

body.is-locked { overflow: hidden; }

img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

::selection { background: var(--accent-soft); color: var(--text-1); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-control);
}

/* ── Scrollbars ────────────────────────────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: var(--r-pill); }
::-webkit-scrollbar-thumb:hover { background: #2A333B; }

/* ── Typography ──────────────────────────────────────────────────────
   GOV.UK-style hierarchy: one family throughout, headings carried by
   weight and size rather than by a second typeface. Headings bold,
   body regular. A grotesque wants slight negative tracking at large
   sizes, unlike the Didone this replaced. */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--text-1);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.h-hero { font-size: var(--fs-hero); letter-spacing: -0.032em; }
.h-2xl  { font-size: var(--fs-2xl); letter-spacing: -0.028em; }
.h-xl   { font-size: var(--fs-xl); letter-spacing: -0.022em; }
.h-lg   { font-size: var(--fs-lg); font-weight: 700; letter-spacing: -0.015em; }

.lede {
  font-size: clamp(0.9375rem, 1.3vw, 1rem);
  color: var(--text-2);
  line-height: 1.7;
  max-width: 62ch;
}

/* Flat accent — no gradient fills anywhere in the system */
.accent { color: var(--accent); }

/* ── Section labels ───────────────────────────────────────────────────
   Rectangular glass chips rather than pills. A set of modifiers gives
   each section its own treatment so the page doesn't read as the same
   badge repeated a dozen times. */
.eyebrow {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 8px 15px;
  border-radius: 5px;
  background:
    linear-gradient(152deg, rgba(255, 255, 255, 0.11) 0%, rgba(255, 255, 255, 0.03) 46%, rgba(255, 255, 255, 0.055) 100%),
    var(--accent-soft);
  border: 1px solid rgba(255, 255, 255, 0.13);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  overflow: hidden;
}
/* the glass highlight running across the top face */
.eyebrow::after {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 52%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent);
  pointer-events: none;
}

/* ① accent bar down the leading edge, squared off on the left */
.eyebrow--bar {
  border-left: none;
  border-radius: 0 5px 5px 0;
  padding-left: 17px;
}
.eyebrow--bar::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
}

/* ② corner brackets, no fill — a technical marker */
.eyebrow--bracket {
  border-radius: 0;
  border-color: transparent;
  background: linear-gradient(152deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  box-shadow: none;
  padding-inline: 18px;
}
.eyebrow--bracket::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px solid var(--accent-line);
  /* keep only the four corners */
  -webkit-mask-image:
    linear-gradient(90deg, #000 9px, transparent 9px, transparent calc(100% - 9px), #000 calc(100% - 9px)),
    linear-gradient(0deg, #000 8px, transparent 8px, transparent calc(100% - 8px), #000 calc(100% - 8px));
          mask-image:
    linear-gradient(90deg, #000 9px, transparent 9px, transparent calc(100% - 9px), #000 calc(100% - 9px)),
    linear-gradient(0deg, #000 8px, transparent 8px, transparent calc(100% - 8px), #000 calc(100% - 8px));
  /* intersect, not union — the union of the two strips is a full frame,
     their intersection is the four corners */
  -webkit-mask-composite: source-in;
          mask-composite: intersect;
  pointer-events: none;
}

/* ③ chip with a rule running out to the right */
.eyebrow--rule { border-radius: 4px; }
.eyebrow--rule::before {
  content: '';
  position: absolute;
  left: 100%;
  top: 50%;
  width: clamp(28px, 7vw, 84px);
  height: 1px;
  background: linear-gradient(90deg, var(--accent-line), transparent);
}
/* the rule sits outside the chip, so this variant can't clip */
.eyebrow--rule { overflow: visible; }
.eyebrow--rule::after { border-radius: 4px 4px 0 0; }

/* ④ cut corner — a notched plate */
.eyebrow--notch {
  border-radius: 0;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
  padding-inline: 17px;
}

/* ⑤ leading square marker */
.eyebrow--dot { border-radius: 3px; padding-left: 13px; }
.eyebrow--dot::before {
  content: '';
  width: 7px;
  height: 7px;
  margin-right: 3px;
  flex-shrink: 0;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

/* ⑥ solid accent plate, for the top of a page */
.eyebrow--solid {
  color: var(--on-accent);
  background: var(--accent);
  border-color: transparent;
  border-radius: 4px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.eyebrow--solid::after { background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent); }

/* ── Shell / sections ──────────────────────────────────────────────── */
.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: clamp(56px, 8vw, 104px); }
.section--soft { background: var(--surface-1); }
.section--tint { background: var(--surface-1); }

.section-head { margin-bottom: var(--sp-6); max-width: 70ch; }
.section-head .eyebrow { margin-bottom: var(--sp-2); }
.section-head .lede { margin-top: var(--sp-2); }

.skip-link {
  position: absolute;
  left: var(--sp-2);
  top: -80px;
  z-index: 999;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  padding: 12px 20px;
  border-radius: var(--r-control);
  transition: top var(--t-fast) var(--ease);
}
.skip-link:focus { top: var(--sp-2); }

/* ── Buttons ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.005em;
  padding: 13px 26px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  transition: transform var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease),
              opacity var(--t-fast) var(--ease);
  white-space: nowrap;
}
.btn svg { width: 17px; height: 17px; flex-shrink: 0; }

.btn--primary {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
}
.btn--primary:hover { transform: translateY(-2px); background: #9AD6FF; }
.btn--primary:active { transform: translateY(0); }
.btn--primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn--ghost {
  background: var(--surface-2);
  color: var(--text-1);
  border-color: var(--border);
}
.btn--ghost:hover {
  transform: translateY(-2px);
  background: var(--surface-3);
  border-color: var(--border-strong);
}

.btn--quiet {
  background: transparent;
  color: var(--text-2);
  border-color: var(--border);
}
.btn--quiet:hover { background: var(--surface-2); color: var(--text-1); }

.btn--sm { padding: 9px 18px; font-size: var(--fs-xs); }

/* ── Scroll reveal ─────────────────────────────────────────────────────
   Variants are chosen per element with data-reveal="…". Only hidden when
   JS is running (html.js is set by js/head.js), so the page stays fully
   readable if scripts fail or are blocked. */
.js [data-reveal] {
  opacity: 0;
  transition: opacity 0.62s var(--ease),
              transform 0.62s var(--ease),
              filter 0.62s var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}

/* bare data-reveal serialises to "" — the default rise */
.js [data-reveal=""],
.js [data-reveal="up"]    { transform: translateY(20px); }
.js [data-reveal="down"]  { transform: translateY(-20px); }
.js [data-reveal="left"]  { transform: translateX(-32px); }
.js [data-reveal="right"] { transform: translateX(32px); }
.js [data-reveal="zoom"]  { transform: scale(0.93); }
.js [data-reveal="blur"]  { filter: blur(10px); transform: translateY(12px); }

/* Flip needs perspective on the element itself, and a hinge to swing on */
.js [data-reveal="flip"] {
  transform: perspective(1000px) rotateX(-38deg) translateY(14px);
  transform-origin: 50% 100%;
}
.js [data-reveal="flip-y"] {
  transform: perspective(1000px) rotateY(22deg) translateX(20px);
  transform-origin: 0% 50%;
}

.js [data-reveal].is-in {
  opacity: 1;
  transform: none;
  filter: none;
  will-change: auto;
}

/* ── Page-exit transition ──────────────────────────────────────────────
   Cross-page clicks fade the document out before navigating, so moving
   between pages reads as a transition rather than a flash. */
.js body { animation: page-in 0.4s var(--ease) both; }
@keyframes page-in { from { opacity: 0; } to { opacity: 1; } }
.js body.is-leaving { opacity: 0; transition: opacity 0.22s var(--ease); }

/* ── Corner artwork ───────────────────────────────────────────────────
   Cards and nav rows carry a faint image bled in from the top-left
   instead of an icon glyph. The image is set per element as --art; the
   mask fades it out toward the bottom-right so text stays readable. */
.art-wash {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.art-wash::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: var(--art, none);
  background-repeat: no-repeat;
  background-position: left top;
  background-size: var(--art-size, 150% auto);
  opacity: var(--art-opacity, 0.18);
  -webkit-mask-image: radial-gradient(118% 108% at 0% 0%, #000 0%, rgba(0, 0, 0, 0.45) 40%, transparent 74%);
          mask-image: radial-gradient(118% 108% at 0% 0%, #000 0%, rgba(0, 0, 0, 0.45) 40%, transparent 74%);
  transition: opacity var(--t-mid) var(--ease), transform var(--t-mid) var(--ease);
}
.art-wash > * { position: relative; z-index: 1; }
.art-wash:hover::before {
  opacity: var(--art-opacity-hover, 0.34);
  transform: scale(1.06);
}

/* Fallback wash for items with no associated photograph */
.art-wash--tint::before {
  background-image: radial-gradient(90% 90% at 0% 0%, var(--accent) 0%, transparent 68%);
  opacity: var(--art-opacity, 0.14);
}

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