/* =========================================================================
   On Target Security — design system
   Palette/type from research/design-language.md. Light default, dark override.
   Recurring-bug guards from brief §9 / design-language §2 applied throughout.
   ========================================================================= */

/* ---- Tokens: light (default) ---- */
:root {
  /* brand grounds */
  --black:        #14161A;   /* tactical black — header/hero/footer ground */
  --black-deep:   #0E1014;   /* dark-theme ground / hero depth */

  /* brand accent */
  --gold:         #E0A82E;   /* marks, rules, large display, gold button fills */
  --gold-text:    #8A6410;   /* deep-bronze — small gold text/links on LIGHT only */
  --gold-lift:    #F0C25A;   /* lifted gold — small gold text/links in DARK only */

  /* emergency */
  --red:          #C22E28;   /* 24/7 emergency-call action ONLY */
  --red-hover:    #B02821;
  --red-text:     #A82521;   /* rare small red text on light */

  /* page + surfaces */
  --ground:       #F4F5F7;   /* page background (light) */
  --surface:      #FFFFFF;   /* cards/panels (light) -> flips dark */
  --hairline:     #DDE0E4;   /* borders, quiet bands */

  /* text */
  --ink:          #14171B;   /* body text on light */
  --muted:        #5A626C;   /* secondary text */

  /* FIXED-IN-BOTH-THEMES tokens — never remap (guard §5) */
  --on-brand:     #F4F5F7;   /* text/icons on black header/hero/footer + red fills */
  --on-gold:      #14161A;   /* dark label on a gold fill */

  /* chip on always-black surfaces — light-on-dark in BOTH themes (guard §8) */
  --chip-bg:      rgba(224,168,46,0.16);
  --chip-border:  rgba(224,168,46,0.55);
  --chip-text:    #F0C25A;

  /* misc */
  --shadow:       0 2px 6px rgba(20,22,26,0.08), 0 8px 24px rgba(20,22,26,0.06);
  --radius:       10px;
  --maxw:         1200px;
  --header-h:     72px;

  color-scheme: light;
}

/* ---- Tokens: dark override ---- */
[data-theme="dark"] {
  --ground:       #0E1014;
  --surface:      #2A303B;   /* ratio ~1.44 vs #0E1014 ground — verified >=1.35 */
  --hairline:     #3A414D;
  --ink:          #E9EBED;
  --muted:        #98A0A8;
  --gold-text:    var(--gold-lift);  /* small gold text/links use lifted gold in dark */
  --shadow:       0 2px 6px rgba(0,0,0,0.5), 0 10px 30px rgba(0,0,0,0.45);
  /* --on-brand, --on-gold, --black, --gold, --red intentionally NOT remapped */
  color-scheme: dark;
}

/* ---- Reset / base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Source Sans 3", -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--gold-text); }
a:hover { color: var(--gold-text); text-decoration: underline; }

/* ---- Headings (Teko) ---- */
h1, h2, h3, .display {
  font-family: "Teko", "Oswald", "Arial Narrow", sans-serif;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  margin: 0 0 .4em;
  color: var(--ink);
}
h1 { font-size: clamp(2.6rem, 6vw, 4.2rem); font-weight: 700; }
h2 { font-size: clamp(2rem, 4vw, 3rem); }
h3 { font-size: clamp(1.5rem, 2.5vw, 1.9rem); }
p  { margin: 0 0 1rem; }
.eyebrow {
  font-family: "Teko", "Oswald", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--gold-text);
  margin: 0 0 .35rem;
}
/* the hero and .section--dark blocks are brand-black in BOTH themes, so their
   eyebrow must use the lifted gold always — in light mode --gold-text is the
   deep bronze meant for a light ground and drops to ~3.4:1 on black. */
.hero .eyebrow,
.section--dark .eyebrow { color: var(--gold-lift); }
.lead { font-size: 1.2rem; color: var(--muted); max-width: 60ch; }

/* ---- Layout ---- */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.section { padding: 64px 0; }
.section--tight { padding: 40px 0; }
.section--dark { background: var(--black); color: var(--on-brand); }
.section--dark h1, .section--dark h2, .section--dark h3 { color: var(--on-brand); }
.section--band { background: transparent; border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.grid { display: grid; gap: 20px; }
@media (min-width: 640px)  { .grid-2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px)  { .grid-3 { grid-template-columns: repeat(3, 1fr); } .grid-2 { grid-template-columns: repeat(2, 1fr); } }

/* ---- Skip link ---- */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--gold); color: var(--on-gold); padding: 10px 16px; font-weight: 700;
}
.skip-link:focus { left: 8px; top: 8px; }

/* =========================================================================
   Header — brand + nav + toggle + persistent red Call-24/7 (guard §2)
   ========================================================================= */
.site-header {
  background: var(--black);
  color: var(--on-brand);
  position: sticky; top: 0; z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.header-row {
  display: flex; align-items: center; gap: 16px;
  min-height: var(--header-h);
  /* header stays inside container; no overflow-x hack (guard §2) */
}
/* Brand lockup — shrinks but wordmark shows at >=1280 (guard §2) */
.brand {
  display: flex; align-items: center; gap: 10px;
  flex: 0 1 auto; min-width: 0;
  text-decoration: none; color: var(--on-brand);
}
.brand:hover { text-decoration: none; }
.brand-mark { flex: 0 0 auto; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; } /* icon wrapper display:flex (guard §6) */
.brand-mark svg { width: 34px; height: 34px; display: block; }
.brand-word {
  font-family: "Teko", "Oswald", sans-serif;
  text-transform: uppercase; line-height: .95;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-word .t1 { font-weight: 700; font-size: 1.5rem; letter-spacing: 0.02em; }
.brand-word .t2 { font-weight: 500; font-size: 1.5rem; letter-spacing: 0.18em; color: var(--gold); }

.header-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; flex: 0 0 auto; }

/* Primary nav */
.main-nav { flex: 0 1 auto; }
.main-nav ul { list-style: none; display: flex; gap: 22px; margin: 0; padding: 0; }
.main-nav a:not([class]) {
  color: var(--on-brand);           /* light-on-dark in both themes */
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;              /* no mid-phrase wrap (guard §2) */
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
}
.main-nav a:not([class]):hover { color: var(--gold); text-decoration: none; }
.main-nav a[aria-current="page"] { color: var(--gold); border-bottom-color: var(--gold); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: "Source Sans 3", sans-serif; font-weight: 700;
  padding: 12px 20px; border-radius: var(--radius);
  text-decoration: none; border: 2px solid transparent; cursor: pointer;
  line-height: 1.1; font-size: 1rem;
}
.btn:hover { text-decoration: none; }
.btn-gold { background: var(--gold); color: var(--on-gold); }          /* dark label on gold (guard §4) */
.btn-gold:hover { background: #cf981f; color: var(--on-gold); }
.btn-outline { background: transparent; color: var(--ink); border-color: var(--hairline); }
.btn-outline:hover { border-color: var(--gold); color: var(--gold-text); }
/* the hero is brand-black in BOTH themes, so the outline button there must use
   the light-on-dark treatment regardless of theme (in light mode --ink flips
   dark and the label would go dark-on-dark / invisible). */
.section--dark .btn-outline,
.hero .btn-outline { color: var(--on-brand); border-color: rgba(255,255,255,0.35); }
.section--dark .btn-outline:hover,
.hero .btn-outline:hover { border-color: var(--gold); color: var(--gold); }

/* Emergency red — white label in BOTH themes (guard §4/§5) */
.btn-emergency {
  background: var(--red); color: var(--on-brand);
  border-color: var(--red); font-weight: 700;
}
.btn-emergency:hover { background: var(--red-hover); border-color: var(--red-hover); color: var(--on-brand); }
.btn-emergency .num { font-variant-numeric: tabular-nums; }
.btn-emergency--sm { padding: 9px 14px; font-size: .95rem; }

/* Theme toggle + hamburger */
.icon-btn {
  width: 42px; height: 42px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;   /* icon wrapper display:flex (guard §6) */
  background: transparent; border: 1px solid rgba(255,255,255,0.25);
  border-radius: 8px; color: var(--on-brand); cursor: pointer; padding: 0;
}
.icon-btn:hover { border-color: var(--gold); color: var(--gold); }
.icon-btn svg { width: 20px; height: 20px; display: block; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.nav-toggle { display: none; }

/* ---- Off-canvas mobile nav ---- */
@media (max-width: 900px) {
  .nav-toggle { display: flex; }
  .main-nav {
    position: fixed; inset: var(--header-h) 0 auto 0;
    background: var(--black); border-bottom: 1px solid rgba(255,255,255,0.12);
    max-height: 0; overflow: hidden; transition: max-height .25s ease; z-index: 99;
  }
  .main-nav.open { max-height: 70vh; }
  .main-nav ul { flex-direction: column; gap: 0; padding: 8px 20px 16px; }
  .main-nav a:not([class]) { display: block; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.08); }
  .main-nav a[aria-current="page"] { border-bottom-color: var(--gold); }
  /* keep the header tight on mobile: the gold "Request a quote" moves into the
     drawer, and only the HEADER emergency button drops its number (the hero,
     CTA-band and contact buttons keep the full "Call 24/7 — 087 078 2525"). */
  .header-actions .btn-gold { display: none; }
  .header-actions .btn-emergency .num { display: none; }
  /* wordmark: shrink on small screens so "ON TARGET" shows in full
     rather than truncating to "ON TAR…" */
  .brand-word .t1, .brand-word .t2 { font-size: 1.15rem; }
  .nav-cta { padding: 12px 0 4px; border-bottom: 0 !important; }
  .nav-cta .btn { width: 100%; }
}
@media (max-width: 420px) {
  /* drop "SECURITY" on the narrowest screens — "ON TARGET" alone still fits */
  .brand-word .t2 { display: none; }
}
@media (min-width: 901px) { .nav-cta { display: none; } }
@media (min-width: 901px) { .btn-emergency .lbl-full { } }

/* =========================================================================
   Hero
   ========================================================================= */
.hero {
  background:
    linear-gradient(180deg, rgba(14,16,20,0.78), rgba(14,16,20,0.92)),
    radial-gradient(120% 90% at 80% -10%, rgba(224,168,46,0.14), transparent 60%),
    var(--black);
  color: var(--on-brand);
  padding: 72px 0 64px;
}
.hero h1 { color: var(--on-brand); max-width: 16ch; }
.hero .lead { color: #C9CDD3; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 26px; }

/* =========================================================================
   Chips — always light-on-dark on black surfaces (guard §8)
   ========================================================================= */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .82rem; font-weight: 600;
  padding: 4px 10px; border-radius: 999px;
  background: var(--chip-bg); color: var(--chip-text);
  border: 1px solid var(--chip-border);
  white-space: nowrap;
}
.chip--confirm { text-transform: none; letter-spacing: 0; }
/* chip on LIGHT surfaces (services/about body) */
.chip-light {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .78rem; font-weight: 700;
  padding: 3px 9px; border-radius: 999px;
  background: rgba(138,100,16,0.12); color: var(--gold-text);
  border: 1px solid rgba(138,100,16,0.4);
  white-space: nowrap; text-transform: none;
}

/* Trust strip */
.trust-strip { display: flex; flex-wrap: wrap; gap: 10px 14px; margin-top: 28px; }
.trust-strip .chip { font-size: .85rem; }

/* =========================================================================
   Cards / services grid
   ========================================================================= */
.card {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--hairline); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px;
}
.card h3 { margin-bottom: .3em; }
.card p { color: var(--muted); margin-bottom: .8rem; }
.card a.card-link { color: var(--gold-text); font-weight: 700; text-decoration: none; }
.card a.card-link:hover { text-decoration: underline; }
.card-ico {
  width: 46px; height: 46px; margin-bottom: 14px;
  display: flex; align-items: center; justify-content: center;   /* icon wrapper display:flex (guard §6) */
  border-radius: 10px; background: rgba(224,168,46,0.14); color: var(--gold);
}
.card-ico svg { width: 26px; height: 26px; display: block; }

/* Steps ("how we respond") */
.steps { counter-reset: step; display: grid; gap: 18px; }
@media (min-width: 720px) { .steps { grid-template-columns: repeat(4, 1fr); } }
.step { position: relative; padding-top: 8px; }
.step .n {
  font-family: "Teko", sans-serif; font-weight: 700; font-size: 2.4rem; line-height: 1;
  color: var(--gold); display: block;
}
.step h3 { font-size: 1.35rem; margin: .2em 0 .3em; }
.step p { color: inherit; opacity: .85; margin: 0; }

/* Areas list */
.areas { display: flex; flex-wrap: wrap; gap: 8px 10px; margin: 10px 0 0; padding: 0; list-style: none; }
.areas li {
  padding: 6px 12px; border: 1px solid var(--hairline); border-radius: 8px;
  background: var(--surface); font-weight: 600;
}

/* =========================================================================
   Image placeholder blocks (no real photos supplied — brief/steering)
   ========================================================================= */
.img-ph {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 6px;
  background: repeating-linear-gradient(45deg, rgba(224,168,46,0.06), rgba(224,168,46,0.06) 12px, transparent 12px, transparent 24px), var(--surface);
  border: 1px dashed var(--gold); border-radius: var(--radius);
  color: var(--muted); padding: 28px 20px; min-height: 200px;
}
.img-ph .ph-tag { font-family: "Teko", sans-serif; text-transform: uppercase; letter-spacing: .1em; color: var(--gold-text); font-weight: 600; font-size: 1.05rem; }
.img-ph .ph-note { font-size: .85rem; max-width: 40ch; }

/* =========================================================================
   Service sections (services.html)
   ========================================================================= */
.svc { padding: 32px 0; border-bottom: 1px solid var(--hairline); }
.svc:last-child { border-bottom: 0; }
.svc h2 { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* =========================================================================
   Credentials framework (about.html)
   ========================================================================= */
.creds { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
@media (min-width: 640px) { .creds { grid-template-columns: repeat(2,1fr); } }
.creds li {
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius);
  padding: 16px 18px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow);
}
.creds .ci { flex: 0 0 auto; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; color: var(--gold); }
.creds .ci svg { width: 24px; height: 24px; }
.creds strong { display: block; }
.creds small { color: var(--muted); }

/* =========================================================================
   Forms (contact.html)
   ========================================================================= */
.form-note {
  background: rgba(224,168,46,0.10); border: 1px solid var(--chip-border);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 22px; color: var(--ink);
}
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; }
.req { color: var(--gold-text); }
.field input[type="text"],
.field input[type="tel"],
.field input[type="email"],
.field textarea,
.field select {
  width: 100%; padding: 12px 14px; font: inherit;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--hairline); border-radius: 8px;
}
.field textarea { min-height: 130px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: 3px solid rgba(224,168,46,0.5); outline-offset: 1px; border-color: var(--gold);
}
fieldset { border: 1px solid var(--hairline); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 18px; }
legend { font-weight: 700; padding: 0 6px; }
.opt { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-weight: 400; }
.opt input { width: auto; }
.opt-grid { display: grid; gap: 4px 18px; }
@media (min-width: 560px) { .opt-grid { grid-template-columns: repeat(2,1fr); } }

/* =========================================================================
   Footer — re-set nav/footer classless links in dark (guard §1)
   ========================================================================= */
.site-footer { background: var(--black); color: var(--on-brand); padding: 48px 0 28px; }
.site-footer h4 { font-family: "Teko", sans-serif; text-transform: uppercase; color: var(--on-brand); font-size: 1.3rem; letter-spacing: .06em; margin: 0 0 .5em; }
.footer-grid { display: grid; gap: 28px; }
@media (min-width: 720px) { .footer-grid { grid-template-columns: 1.5fr 1fr 1fr; } }
.site-footer a:not([class]) { color: var(--on-brand); text-decoration: none; }
.site-footer a:not([class]):hover { color: var(--gold); text-decoration: underline; }
.site-footer .muted-line { color: #A9AEB5; font-size: .9rem; }
.footer-psira { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); margin-top: 32px; padding-top: 18px; color: #A9AEB5; font-size: .88rem; display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: space-between; }
.footer-nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

/* =========================================================================
   Dark-theme classless-link guard (§1) — scope a:not([class]),
   then explicitly re-set BOTH footer and nav to --on-brand.
   ========================================================================= */
[data-theme="dark"] a:not([class]) { color: var(--gold-lift); }
[data-theme="dark"] .site-footer a:not([class]) { color: var(--on-brand); }
[data-theme="dark"] .site-footer a:not([class]):hover { color: var(--gold); }
[data-theme="dark"] .main-nav a:not([class]) { color: var(--on-brand); }
[data-theme="dark"] .main-nav a:not([class]):hover { color: var(--gold); }
[data-theme="dark"] .main-nav a[aria-current="page"] { color: var(--gold); border-bottom-color: var(--gold); }

/* focus visibility */
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.btn:focus-visible { outline-offset: 3px; }

/* utilities */
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.center { text-align: center; }
.stack > * + * { margin-top: 1rem; }
.cta-row { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 20px; }
.text-muted { color: var(--muted); }
.sr-only { position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0; }
