/*
Theme Name:        LJB Surveying
Theme URI:         https://ljbsurveying.example/
Description:       Bespoke, hand-coded classic theme for LJB Surveying, specialists in underground & utility surveying. Fast, accessible (WCAG 2.1 AA), no page builders. Content is driven by ACF/SCF field groups registered in PHP.
Author:            LJB Surveying / WebWinton
Version:           0.1.0
Requires at least: 6.4
Tested up to:      6.7
Requires PHP:      8.0
License:           GNU General Public License v2 or later
License URI:       http://www.gnu.org/licenses/gpl-2.0.html
Text Domain:       ljb
Tags:              custom-theme, business, accessibility-ready
*/

/* ==========================================================================
   LJB SURVEYING, DESIGN SYSTEM
   --------------------------------------------------------------------------
   A small, documented token set. Everything downstream references these
   custom properties so the brand stays consistent. Edit tokens here, not in
   component rules.

   Palette direction: clean black & white, blue accent.
     · Near-black ink base ..... structure, authority, "below the surface"
     · Off-white + neutral grey  clean, technical canvas (no colour tint)
     · Blue accent ............. single deliberate accent (links, CTAs, markers)

   Used by: base styles, header, footer (this file) + components (Phase 2).
   ========================================================================== */

:root {
  /* --- Ink / neutral dark ramp (near-black, no colour tint) ---------------*/
  --ljb-ink-900: #0b0c0e;   /* near-black, hero / footer / dark sections  */
  --ljb-ink-800: #141518;
  --ljb-ink-700: #1f2024;
  --ljb-ink-600: #2c2e33;
  --ljb-ink-500: #3b3e44;   /* mid grey                                   */

  --ljb-blue-600: #1d4ed8;  /* accent pressed                             */
  --ljb-blue-500: #2563eb;  /* PRIMARY ACCENT (blue)                      */
  --ljb-blue-400: #3b82f6;  /* accent hover / glow                        */

  --ljb-teal-500:  #1e40af;  /* secondary accent (deep blue)              */

  /* --- Neutrals (true neutrals, no blue tint) ----------------------------*/
  --ljb-white:    #ffffff;
  --ljb-paper:    #f7f7f8;   /* page background (clean off-white)          */
  --ljb-mist:     #eeeef0;   /* alt section / cards                        */
  --ljb-line:     #e2e2e5;   /* hairline borders                          */
  --ljb-grey-500: #6a6a70;   /* muted text on light                       */
  --ljb-grey-700: #34343a;   /* body text on light                        */
  --ljb-ink:      #0c0d10;   /* near-black headings on light              */

  /* --- Semantic roles (reference these in components) ---------------------*/
  --color-bg:            var(--ljb-paper);
  --color-surface:       var(--ljb-white);
  --color-surface-alt:   var(--ljb-mist);
  --color-text:          var(--ljb-grey-700);
  --color-heading:       var(--ljb-ink);
  --color-muted:         var(--ljb-grey-500);
  --color-border:        var(--ljb-line);
  --color-accent:        var(--ljb-blue-500);
  --color-accent-hover:  var(--ljb-blue-400);
  --color-accent-press:  var(--ljb-blue-600);
  --color-on-accent:     var(--ljb-white);
  --color-link:          var(--ljb-blue-600);
  --color-dark-bg:       var(--ljb-ink-900);
  --color-on-dark:       #e7e7ea;
  --color-on-dark-soft:  #9a9aa1;

  /* --- Typography ---------------------------------------------------------*/
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Space Grotesk", var(--font-sans);
  --font-mono: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;

  /* Fluid type scale (min 360px → max ~1280px). Major-third-ish. */
  --step--1: clamp(0.83rem, 0.79rem + 0.18vw, 0.94rem);
  --step-0:  clamp(1rem, 0.95rem + 0.25vw, 1.125rem);    /* body            */
  --step-1:  clamp(1.2rem, 1.1rem + 0.5vw, 1.5rem);
  --step-2:  clamp(1.44rem, 1.28rem + 0.8vw, 2rem);
  --step-3:  clamp(1.73rem, 1.48rem + 1.25vw, 2.66rem);
  --step-4:  clamp(2.07rem, 1.69rem + 1.9vw, 3.55rem);
  --step-5:  clamp(2.49rem, 1.92rem + 2.85vw, 4.74rem);  /* hero display    */

  --leading-tight: 1.1;
  --leading-snug:  1.25;
  --leading-body:  1.65;

  /* --- Spacing scale (fluid, 8pt-ish) ------------------------------------*/
  --space-3xs: clamp(0.25rem, 0.24rem + 0.05vw, 0.31rem);
  --space-2xs: clamp(0.5rem, 0.48rem + 0.1vw, 0.56rem);
  --space-xs:  clamp(0.75rem, 0.71rem + 0.18vw, 0.88rem);
  --space-s:   clamp(1rem, 0.95rem + 0.25vw, 1.13rem);
  --space-m:   clamp(1.5rem, 1.42rem + 0.38vw, 1.69rem);
  --space-l:   clamp(2rem, 1.83rem + 0.85vw, 2.5rem);
  --space-xl:  clamp(3rem, 2.65rem + 1.74vw, 4rem);
  --space-2xl: clamp(4rem, 3.3rem + 3.48vw, 6rem);
  --space-3xl: clamp(6rem, 4.9rem + 5.5vw, 9rem);

  /* --- Layout -------------------------------------------------------------*/
  --container-max: 1200px;
  --container-wide: 1360px;
  --container-narrow: 760px;
  --gutter: clamp(1.25rem, 0.9rem + 1.7vw, 2.5rem);

  /* --- Radius, shadow, borders -------------------------------------------*/
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(12, 14, 18, 0.06), 0 2px 6px rgba(12, 14, 18, 0.05);
  --shadow-md: 0 8px 24px rgba(12, 14, 18, 0.08), 0 2px 6px rgba(12, 14, 18, 0.05);
  --shadow-lg: 0 24px 60px rgba(12, 14, 18, 0.14);
  --ring-accent: 0 0 0 3px rgba(37, 99, 235, 0.45);

  /* --- Motion -------------------------------------------------------------*/
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur-fast: 140ms;
  --dur: 240ms;
  --dur-slow: 420ms;

  /* --- Misc ---------------------------------------------------------------*/
  --header-h: 76px;
  --focus-ring: 0 0 0 3px var(--ljb-white), 0 0 0 6px var(--color-accent);
}

/* ==========================================================================
   RESET / NORMALISE (lean, modern)
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
@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;
  }
}
body { min-height: 100vh; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; }
img, picture, svg, video, canvas { display: block; max-width: 100%; height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
:where(a) { color: inherit; }
:target { scroll-margin-top: calc(var(--header-h) + 1rem); }

/* ==========================================================================
   BASE / ELEMENTS
   ========================================================================== */
body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: var(--leading-body);
  font-feature-settings: "kern", "liga", "cv05", "ss01";
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--color-heading);
  line-height: var(--leading-tight);
  font-weight: 600;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
h1 { font-size: var(--step-5); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }

p { text-wrap: pretty; }
p + p { margin-top: var(--space-s); }

a { color: var(--color-link); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--color-accent-press); }

strong { color: var(--color-heading); font-weight: 600; }
hr { border: 0; border-top: 1px solid var(--color-border); }

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-xs);
}

/* ==========================================================================
   LAYOUT PRIMITIVES
   ========================================================================== */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--wide   { max-width: var(--container-wide); }
.container--narrow { max-width: var(--container-narrow); }

.section { padding-block: var(--space-3xl); }
.section--tight { padding-block: var(--space-2xl); }
.section--dark { background: var(--color-dark-bg); color: var(--color-on-dark); }
.section--dark :is(h1, h2, h3, h4) { color: var(--ljb-white); }
.section--alt  { background: var(--color-surface-alt); }

/* Inline emphasis & links must stay legible on dark backgrounds
   (strong/links otherwise inherit dark colours and vanish). */
:is(.section--dark, .cta-band, .page-hero, .home-hero) strong { color: var(--ljb-white); }
:is(.section--dark, .cta-band, .page-hero, .home-hero) :is(.prose, p, li) a:not(.btn) {
  color: var(--color-on-dark);
  text-decoration: underline;
  text-decoration-color: var(--color-accent-hover);
}
:is(.section--dark, .cta-band, .page-hero, .home-hero) :is(.prose, p, li) a:not(.btn):hover { color: var(--ljb-white); }

.flow > * + * { margin-top: var(--space-s); }
.stack-l > * + * { margin-top: var(--space-l); }

main { flex: 1 0 auto; }

/* Visually-hidden but available to assistive tech */
.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;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: var(--space-s);
  top: -100%;
  z-index: 1000;
  background: var(--color-accent);
  color: var(--color-on-accent);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: top var(--dur) var(--ease);
}
.skip-link:focus { top: var(--space-s); color: var(--color-on-accent); }

/* ==========================================================================
   BUTTONS (base, extended in Phase 2 component pass)
   ========================================================================== */
.btn {
  --_bg: var(--color-accent);
  --_fg: var(--color-on-accent);
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  padding: 0.78em 1.4em;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--step-0);
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--_fg);
  background: var(--_bg);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  text-decoration: none;
  white-space: nowrap;
  transition: transform var(--dur-fast) var(--ease),
              background-color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
}
.btn:hover { background: var(--color-accent-hover); color: var(--color-on-accent); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); background: var(--color-accent-press); }

.btn--ghost {
  --_bg: transparent;
  --_fg: var(--color-heading);
  border-color: var(--color-border);
}
.btn--ghost:hover { --_bg: var(--color-surface); color: var(--color-heading); border-color: var(--color-accent); }

.btn--on-dark {
  --_bg: transparent;
  --_fg: var(--color-on-dark);
  border-color: rgba(255,255,255,0.25);
}
.btn--on-dark:hover { --_bg: rgba(255,255,255,0.08); color: var(--ljb-white); border-color: var(--color-accent); }

/* ==========================================================================
   MOTIFS, blueprint grid / contour texture (subtle, reusable)
   ========================================================================== */
.bg-blueprint {
  background-color: var(--color-dark-bg);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 32px 32px;
}
.rule-accent {
  width: 56px; height: 3px;
  background: var(--color-accent);
  border-radius: var(--radius-pill);
}

/* ==========================================================================
   SITE HEADER
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--ljb-white) 88%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--color-border);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-m);
  min-height: var(--header-h);
}
.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--color-heading);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}
.site-brand__mark {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  color: var(--color-on-accent);
  background: var(--color-accent);
  border-radius: var(--radius-sm);
}
.site-brand__mark svg { width: 22px; height: 22px; }
.site-brand small {
  display: block;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-muted);
}

/* Custom logo (uploaded via Appearance → Customise / Theme Settings) */
.site-brand--logo { gap: 0; flex-shrink: 0; }
.custom-logo-link { display: inline-flex; align-items: center; line-height: 0; }
.custom-logo,
.site-brand--logo img {
  height: clamp(30px, 2.6vw, 40px);
  width: auto;
  max-width: min(230px, 58vw);
}

.primary-nav { display: none; }
@media (min-width: 960px) {
  .primary-nav { display: block; }
}
.primary-nav ul {
  display: flex;
  align-items: center;
  gap: clamp(0.5rem, 1.5vw, 1.6rem);
  list-style: none;
}
.primary-nav a {
  display: inline-block;
  padding: 0.5rem 0.25rem;
  font-weight: 500;
  font-size: var(--step--1);
  letter-spacing: 0.01em;
  color: var(--color-heading);
  text-decoration: none;
  position: relative;
}
.primary-nav a::after {
  content: "";
  position: absolute;
  left: 0.25rem; right: 0.25rem; bottom: 0.15rem;
  height: 2px;
  background: var(--color-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur) var(--ease);
}
.primary-nav a:hover { color: var(--color-accent-press); }
.primary-nav a:hover::after,
.primary-nav .current-menu-item > a::after { transform: scaleX(1); }

.header-actions { display: flex; align-items: center; gap: var(--space-s); }
.header-actions .btn { display: none; }
@media (min-width: 720px) { .header-actions .btn { display: inline-flex; } }

/* Mobile menu toggle */
.nav-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px; height: 44px;
  padding: 10px;
  border-radius: var(--radius-sm);
}
@media (min-width: 960px) { .nav-toggle { display: none; } }
.nav-toggle__bar {
  display: block; height: 2px; width: 100%;
  background: var(--color-heading);
  border-radius: 2px;
  transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile drawer */
.mobile-nav {
  display: none;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}
.mobile-nav.is-open { display: block; }
.mobile-nav ul { list-style: none; padding: var(--space-s) 0; }
.mobile-nav a {
  display: block;
  padding: 0.85rem var(--gutter);
  font-weight: 500;
  color: var(--color-heading);
  text-decoration: none;
  border-bottom: 1px solid var(--color-border);
}
.mobile-nav a:hover { background: var(--color-surface-alt); color: var(--color-accent-press); }
.mobile-nav__cta { padding: var(--space-s) var(--gutter); }
@media (min-width: 960px) { .mobile-nav { display: none !important; } }

/* ==========================================================================
   FRONT-PAGE PLACEHOLDER HERO (scaffold only, real hero in Phase 5)
   ========================================================================== */
.scaffold-hero {
  position: relative;
  color: var(--color-on-dark);
  padding-block: var(--space-3xl);
  overflow: hidden;
}
.scaffold-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 120% at 80% -10%, rgba(37, 99, 235,0.18), transparent 55%);
  pointer-events: none;
}
.scaffold-hero .container { position: relative; z-index: 1; }
.scaffold-hero .eyebrow {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent);
}
.scaffold-hero h1 { color: var(--ljb-white); max-width: 16ch; margin-top: var(--space-s); }
.scaffold-hero p { color: var(--color-on-dark-soft); max-width: 56ch; margin-top: var(--space-m); font-size: var(--step-1); }
.scaffold-hero .hero-actions { display: flex; flex-wrap: wrap; gap: var(--space-s); margin-top: var(--space-l); }

.scaffold-note {
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-l);
  background: var(--color-surface);
  color: var(--color-muted);
}
.scaffold-note code { font-family: var(--font-mono); color: var(--color-link); }

/* ==========================================================================
   SITE FOOTER
   ========================================================================== */
.site-footer {
  background: var(--color-dark-bg);
  color: var(--color-on-dark-soft);
  padding-block: var(--space-2xl) var(--space-l);
  margin-top: auto;
}
.site-footer a { color: var(--color-on-dark); text-decoration: none; }
.site-footer a:hover { color: var(--color-accent); }
.site-footer__grid {
  display: grid;
  gap: var(--space-xl);
  grid-template-columns: 1fr;
}
@media (min-width: 680px) { .site-footer__grid { grid-template-columns: 1.4fr 1fr 1fr; } }
@media (min-width: 1024px) { .site-footer__grid { grid-template-columns: 1.6fr 1fr 1fr 1fr; } }
.site-footer h2, .site-footer h3 { color: var(--ljb-white); font-size: var(--step-0); letter-spacing: 0.04em; text-transform: uppercase; }
.site-footer ul { list-style: none; display: grid; gap: 0.6rem; margin-top: var(--space-s); }
.site-footer__brand p { margin-top: var(--space-s); max-width: 36ch; }
.site-footer__logo { display: inline-block; line-height: 0; }
.site-footer__logo img { height: clamp(52px, 5vw, 64px); width: auto; max-width: 200px; }
.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-s);
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-xl);
  padding-top: var(--space-l);
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: var(--step--1);
}
