/* ============================================================
   KEVLAR RISK — NAVIGATION SYSTEM  (Section 1)
   Desktop: 7 tabs, hover/focus dropdowns, nested flyouts
   Mobile:  hamburger -> full drawer with tap-to-expand accordions
   Uses existing tokens from styles.css. No overrides of .nav base.
   ============================================================ */

/* ---------- shared ---------- */
.kv-nav-wrap { display: flex; align-items: center; gap: 2px; }

.kv-item { position: relative; }

.kv-tab {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; padding: 8px 13px; border-radius: 999px;
  color: var(--text-dim); background: none; border: 0; cursor: pointer;
  font-family: inherit; letter-spacing: -0.005em; white-space: nowrap;
  transition: color .15s ease, background .15s ease;
}
.kv-tab:hover, .kv-tab:focus-visible { color: var(--text); background: var(--bg-card); outline: none; }
.kv-tab[aria-current="page"] { color: var(--text); background: var(--bg-card); }
.kv-tab .kv-caret { width: 9px; height: 9px; flex: none; transition: transform .18s ease; opacity: .75; }
.kv-item:hover > .kv-tab .kv-caret,
.kv-tab[aria-expanded="true"] .kv-caret { transform: rotate(180deg); }

.kv-ext { font-size: 11px; opacity: .6; margin-left: 2px; }

/* base state: panels are always hidden until explicitly opened */
.kv-panel { opacity: 0; visibility: hidden; }

/* ---------- desktop dropdown ---------- */
@media (min-width: 1025px) {
  .kv-panel {
    position: absolute; top: calc(100% + 10px); left: 0; min-width: 262px;
    background: var(--bg-elev); border: 1px solid var(--line); border-radius: 14px;
    padding: 8px; z-index: 60;
    box-shadow: 0 18px 44px rgba(0,0,0,.5);
    opacity: 0; visibility: hidden; transform: translateY(-6px);
    transition: opacity .16s ease, transform .16s ease, visibility .16s;
  }
  /* hover bridge so the pointer can travel into the panel */
  .kv-item > .kv-panel::before {
    content: ""; position: absolute; top: -12px; left: 0; right: 0; height: 12px;
  }
  .kv-item:hover > .kv-panel,
  .kv-item:focus-within > .kv-panel { opacity: 1; visibility: visible; transform: translateY(0); }
  .kv-item:hover, .kv-item:focus-within { z-index: 61; }
  .kv-panel { background: var(--bg-elev); }

  /* nested flyout (level 3) */
  .kv-sub > .kv-panel { top: -8px; left: calc(100% + 6px); }

  .kv-panel-right { left: auto; right: 0; }

  /* wide mega-panel for Services: 2 columns, fits viewport */
  .kv-panel-mega {
    min-width: 560px; display: grid; grid-template-columns: 1fr 1fr;
    gap: 0 10px; align-content: start;
    max-height: min(72vh, 620px); overflow-y: auto;
  }
  .kv-panel-mega .kv-group-label { grid-column: auto; }
  .kv-panel-mega .kv-sep { display: none; }
  .kv-panel-mega .kv-col { display: flex; flex-direction: column; }
}

.kv-link {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 12px; border-radius: 9px; font-size: 14px;
  color: var(--text-dim); text-decoration: none; transition: color .13s, background .13s;
}
.kv-link:hover, .kv-link:focus-visible { color: var(--text); background: var(--bg-card); outline: none; }
.kv-link .kv-desc { display: block; font-size: 11.5px; color: var(--text-mute); margin-top: 3px; line-height: 1.35; }
.kv-link-label { display: block; }
.kv-group-label {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em;
  color: var(--text-mute); padding: 10px 12px 6px; text-transform: uppercase;
}
.kv-sep { height: 1px; background: var(--line); margin: 6px 8px; border: 0; }

/* ---------- mobile ---------- */
.kv-burger {
  display: none; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 11px;
  background: var(--bg-card); border: 1px solid var(--line);
  cursor: pointer; padding: 0; flex: none;
}
.kv-burger span {
  display: block; width: 17px; height: 1.5px; background: var(--text);
  position: relative; transition: background .18s ease;
}
.kv-burger span::before, .kv-burger span::after {
  content: ""; position: absolute; left: 0; width: 17px; height: 1.5px;
  background: var(--text); transition: transform .22s ease, top .18s ease;
}
.kv-burger span::before { top: -5.5px; }
.kv-burger span::after  { top:  5.5px; }
.kv-burger[aria-expanded="true"] span { background: transparent; }
.kv-burger[aria-expanded="true"] span::before { top: 0; transform: rotate(45deg); }
.kv-burger[aria-expanded="true"] span::after  { top: 0; transform: rotate(-45deg); }

.kv-drawer { display: none; }
.kv-scrim  { display: none; }

@media (max-width: 1024px) {
  .kv-burger { display: inline-flex; }

  .kv-nav-wrap {
    position: fixed; top: 0; right: 0; bottom: 0; width: min(88vw, 380px);
    background: var(--bg-elev); border-left: 1px solid var(--line);
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 84px 16px 32px; overflow-y: auto; z-index: 200;
    transform: translateX(100%); transition: transform .26s cubic-bezier(.4,0,.2,1);
    -webkit-overflow-scrolling: touch;
  }
  .kv-nav-wrap.is-open { transform: translateX(0); }

  .kv-scrim {
    display: block; position: fixed; inset: 0; z-index: 150;
    background: rgba(8,9,11,.66); backdrop-filter: blur(2px);
    opacity: 0; visibility: hidden; transition: opacity .24s ease, visibility .24s;
  }
  .kv-scrim.is-open { opacity: 1; visibility: visible; }

  .kv-tab {
    width: 100%; justify-content: space-between; font-size: 16px;
    padding: 14px 12px; border-radius: 10px; color: var(--text);
  }
  .kv-item { border-bottom: 1px solid var(--line); }
  .kv-item:last-child { border-bottom: 0; }

  /* accordion: closed by default, opened by JS toggling .is-open */
  .kv-panel {
    position: static; opacity: 1; visibility: visible;
    max-height: 0; overflow: hidden; padding: 0 0 0 10px;
    transition: max-height .28s ease;
    border: 0; background: none; box-shadow: none;
    min-width: 0; transform: none;
  }
  .kv-panel.is-open { max-height: 1200px; padding-bottom: 8px; }
  .kv-panel-mega { display: block; max-height: 0; }
  .kv-panel-mega.is-open { max-height: 1600px; }
  .kv-link { font-size: 15px; padding: 12px; }
  .kv-link .kv-desc { display: none; }
  .kv-group-label { padding-top: 12px; }

  /* mobile CTA sits inside the drawer too */
  .kv-drawer-cta { display: block; margin-top: 20px; text-align: center; }
}

/* ---------- CTA banner (bottom of every page) ---------- */
.kv-cta-band {
  max-width: var(--maxw); margin: 72px auto 0; padding: 44px var(--pad-x);
  background: linear-gradient(135deg, rgba(30,123,255,.13), rgba(30,123,255,.04));
  border: 1px solid rgba(30,123,255,.28); border-radius: 18px; text-align: center;
}
.kv-cta-band h2 { font-size: clamp(22px, 3vw, 30px); margin: 0 0 10px; letter-spacing: -0.02em; }
.kv-cta-band p { color: var(--text-dim); margin: 0 auto 22px; max-width: 560px; font-size: 15px; }
.kv-cta-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* hero CTA row */
.kv-hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }

@media (prefers-reduced-motion: reduce) {
  .kv-panel, .kv-nav-wrap, .kv-scrim, .kv-caret, .kv-burger span,
  .kv-burger span::before, .kv-burger span::after { transition: none !important; }
}


/* stacking: .nav (and the drawer it contains) sits above the scrim */
@media (max-width: 1024px) {
  /* backdrop-filter creates a stacking context that traps fixed children.
     Drop it on mobile and use a solid bar instead, so the drawer can escape. */
  .nav, .nav.scrolled {
    backdrop-filter: none; -webkit-backdrop-filter: none;
    background: rgba(20,22,26,0.96);
    overflow: visible;
  }
  .kv-scrim { z-index: 150; }
  .kv-scrim:not(.is-open) { pointer-events: none; }
  .kv-nav-wrap { z-index: 200; }
  .kv-burger { position: relative; z-index: 260; }
  .nav { z-index: 250; }
}

/* ============ CONTENT — matches the original design language ============ */

/* plain prose section, no box. Breaks up the rhythm between panels. */
.kv-prose { margin: 0 0 26px; }
.kv-prose h2 {
  font-size: clamp(21px, 2.7vw, 30px); font-weight: 600; letter-spacing: -0.02em;
  line-height: 1.2; margin: 0 0 16px;
}
.article-body p { color: var(--text-dim); font-size: 16px; line-height: 1.7; margin: 0 0 14px; max-width: 74ch; }
.article-body p:last-child { margin-bottom: 0; }

/* card grid — no label above each card, heading carries it */
.kv-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 0 0 26px; }
.kv-grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .kv-grid, .kv-grid-2 { grid-template-columns: 1fr; } }
.kv-card {
  display: block; text-decoration: none;
  border: 1px solid var(--line); background: var(--bg-elev);
  border-radius: 14px; padding: 24px;
}
a.kv-card { transition: border-color .16s ease; }
a.kv-card:hover { border-color: var(--blue); }
.kv-card h3 {
  margin: 0 0 10px; font-size: 18px; font-weight: 600; letter-spacing: -0.01em;
  color: var(--text); line-height: 1.3;
}
.kv-card p { margin: 0; font-size: 15px; line-height: 1.65; color: var(--text-dim); }

/* closing block */
.kv-close { border-top: 1px solid var(--line); padding-top: 40px; margin-top: 44px; }
.kv-close h2 { font-size: clamp(22px, 3vw, 32px); font-weight: 600; letter-spacing: -0.02em; margin: 0 0 12px; }
.kv-close p { color: var(--text-dim); font-size: 16px; line-height: 1.65; max-width: 62ch; margin: 0 0 24px; }

.kv-hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 26px 0 0; }
.hero-stats { margin-top: 34px; }

/* imagery */
.kv-figure { margin: 0 0 26px; }
.kv-figure img {
  width: 100%; display: block; border-radius: 14px; border: 1px solid var(--line);
  max-height: 460px; object-fit: cover; background: var(--bg);
}
.kv-figure figcaption { font-size: 13px; color: var(--text-mute); margin-top: 10px; line-height: 1.5; }
.kv-figure img[src*="infographic"], .kv-figure img[src*="tr-"],
.kv-figure img[src*="radar-screen"], .kv-figure img[src*="ai-detect"],
.kv-figure img[src*="thermal-fence"], .kv-figure img[src*="dahua-face"] {
  object-fit: contain; max-height: 620px;
}
.kv-figure img[src*="infographic"] { max-height: 900px; }
.kv-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 0 0 26px; }
@media (max-width: 820px) { .kv-photos { grid-template-columns: 1fr; } }
.kv-photos .kv-figure { margin: 0; }
.kv-photos img { max-height: 340px; }

/* team portraits */
.kv-face {
  width: 76px; height: 76px; border-radius: 50%; object-fit: cover; object-position: center top;
  border: 2px solid var(--line); display: block; margin: 0 0 16px;
}

/* product list on partner pages — text-led, image only when one exists */
.kv-prod { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 0 0 26px; }
@media (max-width: 820px) { .kv-prod { grid-template-columns: 1fr; } }
.kv-prod-item { border: 1px solid var(--line); background: var(--bg-elev); border-radius: 14px; overflow: hidden; }
.kv-prod-img { display: none; }
.kv-prod-img:has(img) { display: block; background: var(--bg); border-bottom: 1px solid var(--line); }
.kv-prod-img img { width: 100%; height: 220px; object-fit: contain; padding: 18px; box-sizing: border-box; display: block; }
.kv-prod-body { padding: 24px; }
.kv-prod-body h3 { margin: 0 0 10px; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }
.kv-prod-body p { margin: 0; font-size: 15px; line-height: 1.65; color: var(--text-dim); }

/* styles.css puts clamp(80px,9vw,140px) padding on every <section>; our rhythm is our own */
main.calc-main > section { padding-top: 0; padding-bottom: 0; }

/* The off-canvas drawer sits outside the viewport when closed — clip it so it
   cannot create a horizontal scrollbar. */
@media (max-width: 1024px) {
  html, body { overflow-x: hidden; max-width: 100%; }
  .nav { max-width: 100%; }
}

/* ============================================================
   BRAND TYPOGRAPHY — matches the Kevlar Group Profile
   Headlines: Barlow Condensed   Body: Inter
   ============================================================ */
:root {
  --font-display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --font-body: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-mono: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

body, p, li, td, input, textarea, select, button, .article-body,
.kv-card p, .kv-prod-body p, .hero-sub, figcaption {
  font-family: var(--font-body);
}

h1, h2, h3, h4, .kv-card h3, .kv-prod-body h3, .step-head h3,
.hero-stats b, .kv-big {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.005em;
  text-transform: uppercase;
}

h1 { line-height: 1.02; }
h2 { line-height: 1.06; }
h3, .kv-card h3, .kv-prod-body h3, .step-head h3 {
  line-height: 1.12; text-transform: none; font-weight: 600; letter-spacing: 0;
}

/* small caps labels — Inter, spaced, not monospace */
.eyebrow, .step-no, .hero-stats span, .kv-tag {
  font-family: var(--font-body) !important;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* stat figures: condensed and bold, as in the profile */
.hero-stats b { font-size: clamp(30px, 3.6vw, 46px); letter-spacing: 0; line-height: 1; }
.hero-stats span { font-size: 11px; }

/* body copy needs slightly tighter size in Inter */
.article-body p, .kv-card p, .kv-prod-body p { font-size: 15px; line-height: 1.68; }
.hero-sub { font-size: 17px; line-height: 1.6; }
