/* ==========================================================================
   Michael Herbst - CV site stylesheet
   Aligned to the live Kouga Digital design system (kougadigital.co.za),
   2026-07 revision: tokens, IBM Plex Mono + Sans, web type scale, header
   wordmark + nav, ink hero, kicker, numbered sections, card / callout /
   badge / item-row components, CTA band, ink footer, a11y patterns.

   2026-08 revision: the raw brand palette is now mapped through a semantic
   token layer (--bg / --surface / --text / --rule / --link ...) so the whole
   site can honour prefers-color-scheme without duplicating component rules.
   CV-specific extensions are marked in their own blocks.
   ========================================================================== */

/* IBM Plex fonts are loaded via <link rel="preconnect"> + <link rel="stylesheet">
   in each page head (faster than an @import here, which blocks CSS parsing). */

:root {
  /* ---- Raw brand palette (Kouga Digital) --------------------------------- */
  --ink:         #14181c;            /* near-black; primary text and heavy rules */
  --graphite:    #2b333c;            /* secondary text, slightly softer */
  --slate:       #5a6571;            /* muted/tertiary text, metadata, footers */
  --mist:        #f4f6f7;            /* subtle surface tint; card backgrounds, tag fills */
  --ui-bg:       #eef1f3;            /* overall page/app background */
  --accent:      #0fb5a6;            /* bright teal; hover fills, accents on dark grounds */
  --accent-deep: #0a7a70;            /* deep teal; text-safe on light. WCAG AA on white/mist/ui-bg */

  /* ---- Semantic layer: light (default) ----------------------------------- */
  --bg:           var(--ui-bg);       /* page ground */
  --surface:      #fff;               /* raised surface: header, .section.alt, stat cells */
  --surface-2:    var(--mist);        /* subtle fill: cards, nav buttons, tags */
  --text:         var(--graphite);    /* body copy */
  --text-strong:  var(--ink);         /* headings */
  --text-muted:   var(--slate);       /* metadata, fine print */
  --rule:         rgba(20,24,28,.12); /* borders and dividers */
  --link:         var(--accent-deep); /* text-safe accent on light grounds */
  --label:        var(--accent-deep); /* item labels, section numbers, card meta */

  /* Inverted grounds (hero, CTA band, footer) stay dark in both schemes. */
  --invert-bg:      var(--ink);
  --invert-bg-2:    var(--graphite);
  --invert-text:    #fff;
  --invert-text-70: rgba(255,255,255,.85);
  --invert-text-50: rgba(255,255,255,.55);
  --invert-rule:    rgba(255,255,255,.35);

  --shadow: none;

  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
}

/* ---- Semantic layer: dark ------------------------------------------------
   Only the semantic tokens are redefined; every component rule below is
   written against them, so nothing else needs a dark variant. Guarded so an
   explicit data-theme="light" always wins.
   ------------------------------------------------------------------------ */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          #0f1418;
    --surface:     #171d23;
    --surface-2:   #1c242b;
    --text:        #c6d0d8;
    --text-strong: #f2f5f7;
    --text-muted:  #919da9;
    --rule:        rgba(255,255,255,.14);
    --link:        #35d6c5;
    --label:       #35d6c5;
    --invert-bg:   #090d10;
    --invert-bg-2: #131a20;
    --shadow:      0 1px 2px rgba(0,0,0,.35);
  }
}

/* Explicit opt-in, so a theme switch can be added later without a rewrite. */
:root[data-theme="dark"] {
  --bg:          #0f1418;
  --surface:     #171d23;
  --surface-2:   #1c242b;
  --text:        #c6d0d8;
  --text-strong: #f2f5f7;
  --text-muted:  #919da9;
  --rule:        rgba(255,255,255,.14);
  --link:        #35d6c5;
  --label:       #35d6c5;
  --invert-bg:   #090d10;
  --invert-bg-2: #131a20;
  --shadow:      0 1px 2px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent-deep);
  color: #fff;
  padding: 8px 14px;
  font-family: var(--mono);
  font-size: 13px;
  z-index: 100;
}
.skip-link:focus { left: 0; }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ==========================================================================
   Header, wordmark, nav
   ========================================================================== */

.site-header { background: var(--surface); }

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding: 18px 0 14px;
}

.brand { display: flex; align-items: center; gap: 12px; }

.wordmark {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.05em;
  color: var(--text-strong);
  line-height: 1.2;
}

.descriptor {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 9.5px;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 3px;
}

.nav-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nav-btn {
  display: inline-block;
  background: var(--surface-2);
  color: var(--link);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 9px 14px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-decoration: none;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}

.nav-btn:hover { background: var(--accent); color: var(--ink); border-color: var(--accent); text-decoration: none; }
.nav-btn.active { background: var(--accent-deep); color: #fff; border-color: var(--accent-deep); }

/* Brand stripe: 3px ink bar with 90px teal left segment */
.brand-stripe { height: 3px; width: 100%; background: var(--invert-bg); position: relative; }
.brand-stripe::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 90px;
  background: var(--accent);
}

/* ==========================================================================
   Sections and typography
   ========================================================================== */

.section { padding: 44px 0; }
.section.alt { background: var(--surface); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }

h1 {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(28px, 4.6vw, 40px);
  line-height: 1.2;
  color: var(--text-strong);
  margin: 0 0 14px;
  letter-spacing: -0.01em;
}

h2 {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-strong);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 9px;
  margin: 0 0 20px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.section-number { color: var(--label); }

h3 {
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 600;
  color: var(--text-strong);
  margin: 0 0 6px;
}

h4 {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--label);
  margin: 24px 0 12px;
}

p { margin: 0 0 14px; }
.lede { font-size: 18.5px; color: var(--text); max-width: 62ch; }
.fine { font-size: 13px; color: var(--text-muted); }

/* Short explanatory line under a section heading */
.section-intro { max-width: 70ch; color: var(--text-muted); font-size: 15px; margin: -6px 0 20px; }

ul { margin: 6px 0 14px; padding-left: 20px; }
li { margin-bottom: 7px; }

.mono { font-family: var(--mono); }

/* ==========================================================================
   Hero
   ========================================================================== */

/* Dark ink hero: brings the ink/graphite/slate neutrals forward on every page */
.hero { background: var(--invert-bg); padding: 56px 0 52px; }
.hero h1 { color: var(--invert-text); }
.hero .lede { color: var(--invert-text-70); }
.hero a:not(.btn) { color: var(--accent); }
.hero .btn-ghost { color: var(--invert-text); border-color: var(--invert-rule); }
.hero .btn-ghost:hover { background: var(--invert-bg-2); color: var(--invert-text); border-color: var(--accent); }
.hero .kicker { color: var(--accent); }

.kicker {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--label);
  margin: 0 0 12px;
}

/* Mono strap directly under the hero h1: the headline credential in one line */
.hero-strap {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
  margin: -4px 0 16px;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.hero-actions--center { justify-content: center; }
.not-found-lede { margin: 0 auto; }

.btn {
  display: inline-block;
  background: var(--accent-deep);
  color: #fff;
  border: 1px solid var(--accent-deep);
  border-radius: 8px;
  padding: 12px 22px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: background .2s ease, border-color .2s ease;
}
.btn:hover { background: var(--accent); color: var(--ink); border-color: var(--accent); text-decoration: none; }

.btn-ghost { background: transparent; color: var(--link); border-color: var(--rule); }
.btn-ghost:hover { background: var(--surface-2); color: var(--link); border-color: var(--accent); }

/* Prominent contact line under hero and CTA-band action rows */
.cta-note { margin-top: 18px; font-family: var(--mono); font-size: 13px; color: var(--invert-text-70); line-height: 2; }
.cta-note a { color: var(--accent); font-weight: 600; }

/* ==========================================================================
   Stat strip (CV extension): headline facts, scannable in one pass
   ========================================================================== */

.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: 8px;
  overflow: hidden;
  margin: 0;
}

.stat { background: var(--surface); padding: 18px 20px; }

.stat-value {
  display: block;
  font-family: var(--mono);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-strong);
}

.stat-label {
  display: block;
  margin-top: 6px;
  font-size: 13.5px;
  color: var(--text-muted);
}

/* ==========================================================================
   Components carried forward from the document system
   ========================================================================== */

/* Callout / note block */
.callout {
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  padding: 13px 16px;
  margin: 0 0 18px;
  color: var(--text);
}
.callout p:last-child { margin-bottom: 0; }

.callout-title {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--label);
  margin-bottom: 6px;
}

/* Cards (party-card pattern) */
.card {
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 16px 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card p:last-child, .card ul:last-child { margin-bottom: 0; }

.card-meta {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--label);
  margin-bottom: 6px;
}

/* Card grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.grid .card { margin-bottom: 0; }

/* Status badges */
.badge {
  background: var(--accent-deep);
  color: #fff;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: 4px;
  padding: 2.5px 8px;
  display: inline-block;
  vertical-align: middle;
}
.badge.next { background: var(--slate); }

/* Item rows (skill / info rows) */
.item-row { margin-bottom: 18px; }
.item-row p { margin: 4px 0 0; }

.item-label {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--label);
  font-size: 14px;
}

/* Tag chips (CV extension): quick-scan stack summary */
.tag-list { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 6px; padding: 0; list-style: none; }
.tag-list li { margin: 0; }

.tag {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 4px 12px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text);
}

/* ==========================================================================
   CTA band
   ========================================================================== */

.cta-band {
  background: var(--invert-bg-2);
  color: var(--invert-text);
  padding: 40px 0;
}
.cta-band h2 { color: var(--invert-text); border-bottom-color: rgba(255,255,255,.2); }
.cta-band .section-number { color: var(--accent); }
.cta-band p { color: var(--invert-text-70); }
.cta-band a:not(.btn) { color: var(--accent); }
.cta-band .btn { background: var(--accent); color: var(--ink); border-color: var(--accent); }
.cta-band .btn:hover { background: var(--accent-deep); color: #fff; border-color: var(--accent-deep); }
.cta-band .btn-ghost { background: transparent; color: var(--invert-text); border-color: var(--invert-rule); }
.cta-band .btn-ghost:hover { background: var(--invert-bg); color: var(--invert-text); border-color: var(--accent); }
.cta-band .hero-actions { margin-top: 18px; }

/* ==========================================================================
   Footer bar
   ========================================================================== */

.site-footer {
  border-top: 3px solid var(--accent);
  background: var(--invert-bg);
  padding: 24px 0 32px;
}

.footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 20px;
}

.footer-brand {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  color: var(--invert-text);
}

.footer-contact { font-size: 13px; color: var(--invert-text-70); }
.footer-contact a { color: var(--accent); }

.footer-nav {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-family: var(--mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.footer-nav a { color: var(--invert-text-70); }
.footer-nav a:hover { color: var(--accent); }

.footer-note {
  margin-top: 14px;
  font-size: 12px;
  color: var(--invert-text-50);
}

/* ==========================================================================
   CV-specific extensions (this site only)
   ========================================================================== */

/* Job cards: employer name after the title, badge alignment */
.job-employer { color: var(--label); font-style: italic; font-weight: 400; }
.card h3 .badge { margin-left: 8px; position: relative; top: -1px; }

/* Founder descriptor line inside the entity card */
.entity-line { font-size: 14px; color: var(--text-muted); margin: 0 0 8px; }

/* 404 */
.error-page { padding: 72px 0; text-align: center; }
.error-code { font-family: var(--mono); font-size: 64px; font-weight: 700; color: var(--label); line-height: 1; margin: 0 0 10px; }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 720px) {
  .header-inner { justify-content: center; text-align: center; }
  .brand { flex-direction: column; gap: 8px; }
  .nav-row { justify-content: center; }
  .hero { padding: 40px 0; }
  .cta-note { line-height: 2.2; }
  .footer-row { justify-content: flex-start; }
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

/* ==========================================================================
   Print (CV extension: recruiters print these pages)
   Tokens are forced back to the light palette so a dark-mode visitor still
   prints ink on white.
   ========================================================================== */

@media print {
  /* :root is repeated deliberately. `prefers-color-scheme: dark` still matches
     while printing in most browsers, and that block's selector
     `:root:not([data-theme="light"])` has specificity (0,2,0). Repeating :root
     three times gives (0,3,0) so the light print palette always wins, whatever
     scheme the visitor is browsing in. */
  :root:root:root {
    --bg: #fff;
    --surface: #fff;
    --surface-2: #fff;
    --text: #2b333c;
    --text-strong: #14181c;
    --text-muted: #5a6571;
    --rule: rgba(20,24,28,.25);
    --link: #0a7a70;
    --label: #0a7a70;
    --shadow: none;
  }
  body { background: #fff; }
  .skip-link, .nav-row, .hero-actions, .cta-band, .site-footer, .tag-list { display: none; }
  .hero { background: #fff; padding: 10px 0; }
  .hero h1 { color: var(--text-strong); }
  .hero .lede { color: var(--text); }
  .hero .kicker, .hero-strap { color: var(--label); }
  .cta-note { color: var(--text); line-height: 1.6; }
  .cta-note a { color: var(--link); }
  .section { padding: 14px 0; }
  .section.alt { border: none; }
  .stat-strip { background: none; gap: 0; border-color: var(--rule); }
  .stat { border-right: 1px solid var(--rule); }
  h2 { page-break-after: avoid; }
  h3 { page-break-after: avoid; }
  .card { page-break-inside: avoid; border-left-color: #0a7a70; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 10px; color: var(--text-muted); }
  a[href^="#"]::after, a[href^="mailto"]::after, a[href^="tel"]::after { content: ""; }
}
