/**
 * CB Nova Tech — Base
 * ----------------------------------------------------------------------------
 * Modern reset, self-hosted fonts, semantic element defaults and the
 * accessibility baseline. No component styling lives here.
 *
 * @package cbnovatech
 */

/* ============================================================================
   1. SELF-HOSTED VARIABLE FONTS
   Two WOFF2 files total. `font-display: swap` keeps text visible during load;
   the `size-adjust` on the fallback minimises layout shift when the real font
   arrives, which protects the CLS score.
   ========================================================================== */

@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-variable.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215;
}

@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("../fonts/plus-jakarta-sans-variable.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2074, U+20AC, U+2122;
}


/* ============================================================================
   2. RESET
   ========================================================================== */

*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Offset anchor targets so the sticky header never covers a heading */
  scroll-padding-top: calc(var(--cbnt-header-h) + var(--cbnt-space-6));
  -moz-tab-size: 4;
  tab-size: 4;
}

body {
  font-family: var(--cbnt-font-body);
  font-size: var(--cbnt-text-base);
  font-weight: var(--cbnt-weight-regular);
  line-height: var(--cbnt-leading-body);
  color: var(--cbnt-text);
  background-color: var(--cbnt-surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-synthesis-weight: none;
  min-height: 100vh;
  /* Belt and braces against the single most common responsive bug */
  overflow-x: clip;
}

/* Media defaults — `max-width` here is what prevents 90% of horizontal
   overflow bugs on mobile. */
img, svg, video, canvas, audio, iframe, embed, object, picture {
  display: block;
  max-width: 100%;
}

img, video {
  height: auto;
}

/* NOTE: do NOT add `img[width][height] { height: auto }` here.
   That selector has specificity (0,1,1), which beats any single-class
   component rule such as `.cbnt-header__logo { height: 40px }` — the logo
   then renders at its full intrinsic size and blows out the header layout.
   The generic `img { height: auto }` above already preserves aspect ratio at
   specificity (0,0,1), low enough for components to override. Browsers also
   derive `aspect-ratio` from the width/height attributes automatically. */

svg { fill: currentColor; }

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

button { background: none; border: none; padding: 0; cursor: pointer; }

/* Prevent long unbroken strings (URLs, emails) from forcing a scrollbar */
p, li, h1, h2, h3, h4, h5, h6, dd, dt, figcaption, blockquote, td, th {
  overflow-wrap: break-word;
}

ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }

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

hr {
  border: 0;
  border-top: 1px solid var(--cbnt-border);
  margin: var(--cbnt-space-12) 0;
}


/* ============================================================================
   3. TYPOGRAPHY
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--cbnt-font-heading);
  font-weight: var(--cbnt-weight-bold);
  line-height: var(--cbnt-leading-heading);
  letter-spacing: var(--cbnt-tracking-heading);
  color: var(--cbnt-text);
  text-wrap: balance;   /* prevents orphaned words in headings */
}

h1 { font-size: var(--cbnt-text-h1); font-weight: var(--cbnt-weight-extrabold); letter-spacing: var(--cbnt-tracking-display); }
h2 { font-size: var(--cbnt-text-h2); font-weight: var(--cbnt-weight-bold); }
h3 { font-size: var(--cbnt-text-h3); font-weight: var(--cbnt-weight-bold); letter-spacing: var(--cbnt-tracking-tight); }
h4 { font-size: var(--cbnt-text-h4); font-weight: var(--cbnt-weight-semibold); letter-spacing: var(--cbnt-tracking-tight); }
h5 { font-size: var(--cbnt-text-base); font-weight: var(--cbnt-weight-semibold); letter-spacing: 0; }
h6 { font-size: var(--cbnt-text-sm);  font-weight: var(--cbnt-weight-semibold); letter-spacing: 0; }

p { text-wrap: pretty; }

/* Vertical rhythm inside prose blocks only — never applied globally, so
   component layouts stay in full control of their own spacing. */
.cbnt-prose > * + * { margin-top: var(--cbnt-space-5); }
.cbnt-prose { max-width: var(--cbnt-measure); }
.cbnt-prose h2 { margin-top: var(--cbnt-space-12); }
.cbnt-prose h3 { margin-top: var(--cbnt-space-10); }
.cbnt-prose h2:first-child,
.cbnt-prose h3:first-child { margin-top: 0; }
.cbnt-prose ul,
.cbnt-prose ol { padding-left: var(--cbnt-space-6); }
.cbnt-prose li + li { margin-top: var(--cbnt-space-2); }
.cbnt-prose img { border-radius: var(--cbnt-radius-md); }

.cbnt-prose blockquote {
  border-left: 3px solid var(--cbnt-color-secondary);
  padding-left: var(--cbnt-space-6);
  font-size: var(--cbnt-text-lead);
  color: var(--cbnt-text-muted);
  font-style: normal;
}

.cbnt-prose code {
  font-family: var(--cbnt-font-mono);
  font-size: 0.9em;
  background: var(--cbnt-grey-100);
  padding: 0.15em 0.4em;
  border-radius: var(--cbnt-radius-sm);
}

.cbnt-prose pre {
  background: var(--cbnt-navy-900);
  color: var(--cbnt-grey-100);
  padding: var(--cbnt-space-5);
  border-radius: var(--cbnt-radius-md);
  overflow-x: auto;   /* code scrolls inside itself, never the page */
}
.cbnt-prose pre code { background: none; padding: 0; }

/* Tables scroll inside their own wrapper rather than breaking the layout */
.cbnt-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.cbnt-prose th,
.cbnt-prose td {
  text-align: left;
  padding: var(--cbnt-space-3) var(--cbnt-space-4);
  border-bottom: 1px solid var(--cbnt-border);
}
.cbnt-prose th { font-weight: var(--cbnt-weight-semibold); }


/* ============================================================================
   4. LINKS
   ========================================================================== */

a {
  color: var(--cbnt-text-link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: var(--cbnt-transition-colors);
}

a:hover { color: var(--cbnt-text-link-hover); }

/* Prose links stay underlined — underlining is the non-colour cue that makes
   them identifiable to users who cannot distinguish the blue. */
.cbnt-prose a { text-decoration: underline; }


/* ============================================================================
   5. ACCESSIBILITY
   ========================================================================== */

/* Focus. Visible, high-contrast, and never removed.
   :focus-visible means mouse users don't see a ring on click, but keyboard
   users always do. */
:focus-visible {
  outline: var(--cbnt-focus-ring-width) solid var(--cbnt-focus-ring);
  outline-offset: var(--cbnt-focus-ring-offset);
  border-radius: var(--cbnt-radius-sm);
}

/* Remove the default ring only where :focus-visible is supported, so older
   browsers keep their fallback ring. */
@supports selector(:focus-visible) {
  :focus:not(:focus-visible) { outline: none; }
}

/* Screen-reader-only text */
.cbnt-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;
}

/* Skip link — first focusable element on every page */
.cbnt-skip-link {
  position: absolute;
  top: 0;
  left: var(--cbnt-space-4);
  z-index: var(--cbnt-z-skip-link);
  transform: translateY(-150%);
  background: var(--cbnt-navy-900);
  color: var(--cbnt-white);
  padding: var(--cbnt-space-3) var(--cbnt-space-5);
  border-radius: 0 0 var(--cbnt-radius) var(--cbnt-radius);
  font-weight: var(--cbnt-weight-semibold);
  font-size: var(--cbnt-text-sm);
  text-decoration: none;
  transition: transform var(--cbnt-duration) var(--cbnt-ease-out);
}
.cbnt-skip-link:focus { transform: translateY(0); color: var(--cbnt-white); }

/* Minimum touch target. WCAG 2.2 AA (2.5.8) requires 24×24 CSS px;
   we hold ourselves to 44px, the practical usability threshold. */
.cbnt-tap-target {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Reduced motion. Honours the OS-level setting rather than assuming everyone
   wants animation. Transitions are shortened rather than removed entirely so
   state changes remain perceivable. */
@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;
  }

  /* Reveal animations must not leave content invisible when disabled */
  .cbnt-reveal {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* Windows High Contrast Mode — restore borders that rely on background colour */
@media (forced-colors: active) {
  .cbnt-btn,
  .cbnt-card,
  .cbnt-service-card { border: 1px solid currentColor; }
  :focus-visible { outline: 3px solid CanvasText; }
}


/* ============================================================================
   6. SELECTION & SCROLLBAR
   ========================================================================== */

::selection {
  background: var(--cbnt-blue-600);
  color: var(--cbnt-white);
}

@supports (scrollbar-color: auto) {
  html {
    scrollbar-color: var(--cbnt-grey-300) transparent;
    scrollbar-width: thin;
  }
}


/* ============================================================================
   7. PRINT
   ========================================================================== */

@media print {
  .cbnt-header, .cbnt-footer, .cbnt-announce,
  .cbnt-mobile-cta, .cbnt-nav, .cbnt-btn { display: none !important; }

  body { color: #000; background: #fff; font-size: 12pt; }

  /* Expose destination URLs, which are otherwise lost on paper */
  .cbnt-prose a::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    word-break: break-all;
  }

  h1, h2, h3 { break-after: avoid; }
  img, figure, table { break-inside: avoid; }
}
