/* ==========================================================================
   Codego Global — Design tokens
   Palette: Ink Navy / Deep Teal / Brass / Paper / Slate
   Type: Fraunces (display) + IBM Plex Sans (body) + IBM Plex Mono (labels)
   Signature: the "case file" stamp + ledger-rule dividers, echoing the
   government workflow systems that are this company's real specialty.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --ink: #0F2A3D;
  --teal: #145C5C;
  --teal-light: #1C7A7A;
  --brass: #B8863B;
  --brass-light: #D6A84F;
  --paper: #F6F4EE;
  --paper-dim: #EDE9DF;
  --slate: #55606B;
  --line: #D8D2C4;
  --white: #FFFFFF;
  --danger: #A8402F;

  --font-display: 'Fraunces', serif;
  --font-body: 'IBM Plex Sans', -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --radius: 3px;
  --shadow: 0 4px 24px rgba(15, 42, 61, 0.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.5em;
  color: var(--ink);
}

h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); font-weight: 500; }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.5rem); }
h3 { font-size: 1.3rem; }

p { margin: 0 0 1em; color: var(--slate); }

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Eyebrow / ledger labels ---------- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.eyebrow::before {
  content: '';
  width: 18px;
  height: 1px;
  background: var(--brass);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 13px 26px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-primary { background: var(--brass); color: var(--ink); }
.btn-primary:hover { background: var(--brass-light); }
.btn-outline { background: transparent; border-color: rgba(246,244,238,0.4); color: inherit; }
.btn-outline:hover { border-color: var(--brass); color: var(--brass); }
.btn-dark { background: var(--ink); color: var(--paper); }
.btn-dark:hover { background: var(--teal); }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(246, 244, 238, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
}
.logo {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.logo span { color: var(--brass); }
.nav-links { display: flex; gap: 30px; align-items: center; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink);
  position: relative;
  padding-bottom: 4px;
}
.nav-links a::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  width: 0; height: 2px;
  background: var(--brass);
  transition: width 0.2s ease;
}
.nav-links a:hover::after, .nav-links a.active::after { width: 100%; }
.nav-toggle { display: none; background: none; border: none; font-size: 1.6rem; cursor: pointer; color: var(--ink); }

@media (max-width: 860px) {
  .nav-links {
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: var(--paper);
    flex-direction: column;
    align-items: flex-start;
    padding: 20px 24px;
    border-bottom: 1px solid var(--line);
    display: none;
    gap: 16px;
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
}

/* ---------- Hero ---------- */
.hero {
  background: var(--ink);
  color: var(--paper);
  padding: 90px 0 70px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(214,168,79,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(214,168,79,0.06) 1px, transparent 1px);
  background-size: 42px 42px;
  pointer-events: none;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 50px;
  align-items: center;
  position: relative;
}
.hero h1 { color: var(--white); }
.hero .lede { color: rgba(246,244,238,0.75); font-size: 1.1rem; max-width: 46ch; }
.hero-cta { display: flex; gap: 14px; margin-top: 28px; flex-wrap: wrap; }

/* Signature element: workflow "case file" stamp diagram */
.case-flow {
  background: rgba(246,244,238,0.05);
  border: 1px solid rgba(246,244,238,0.15);
  border-radius: var(--radius);
  padding: 28px;
}
.case-flow .flow-title {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brass-light);
  margin-bottom: 18px;
}
.flow-steps { display: flex; flex-direction: column; gap: 0; }
.flow-step {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px dashed rgba(246,244,238,0.15);
  opacity: 0;
  animation: flowIn 0.6s ease forwards;
}
.flow-step:last-child { border-bottom: none; }
.flow-step:nth-child(1) { animation-delay: 0.1s; }
.flow-step:nth-child(2) { animation-delay: 0.5s; }
.flow-step:nth-child(3) { animation-delay: 0.9s; }
.flow-step:nth-child(4) { animation-delay: 1.3s; }
@keyframes flowIn { to { opacity: 1; } }
.flow-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--brass);
  flex-shrink: 0;
}
.flow-step span { font-size: 0.92rem; color: rgba(246,244,238,0.9); }
.flow-step .flow-status {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--teal-light);
  border: 1px solid var(--teal-light);
  padding: 3px 8px;
  border-radius: 2px;
}

/* ---------- Stats bar ---------- */
.stats-bar {
  background: var(--teal);
  color: var(--paper);
  padding: 40px 0;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  text-align: center;
}
.stat-num {
  font-family: var(--font-display);
  font-size: 2.4rem;
  color: var(--brass-light);
}
.stat-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(246,244,238,0.75);
}
@media (max-width: 700px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Sections ---------- */
section { padding: 80px 0; }
.section-head { max-width: 640px; margin-bottom: 48px; }
.ledger-rule {
  border: none;
  border-top: 1px dashed var(--line);
  margin: 0;
}

/* ---------- Services grid ---------- */
.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.service-card {
  background: var(--paper);
  padding: 32px;
  transition: background 0.2s ease;
}
.service-card:hover { background: var(--white); }
.service-num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--brass);
  margin-bottom: 12px;
  display: block;
}
.service-card h3 { margin-bottom: 10px; font-size: 1.15rem; }
.service-card p { font-size: 0.93rem; margin-bottom: 14px; }
.service-card a { font-size: 0.85rem; font-weight: 600; color: var(--teal); }
@media (max-width: 900px) { .services-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .services-grid { grid-template-columns: 1fr; } }

/* ---------- Portfolio grid ---------- */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 26px;
}
.case-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.case-thumb {
  aspect-ratio: 16/10;
  background: linear-gradient(135deg, var(--ink), var(--teal));
  display: flex;
  align-items: flex-end;
  padding: 16px;
  position: relative;
  overflow: hidden;
}
.case-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}
.case-thumb .case-tag {
  position: relative;
  z-index: 1;
}
.case-thumb.has-image::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(15,42,61,0.75), rgba(15,42,61,0) 60%);
  z-index: 0;
}
.case-thumb .case-tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass-light);
  background: rgba(15,42,61,0.5);
  padding: 4px 9px;
  border-radius: 2px;
}
.case-body { padding: 22px; flex: 1; display: flex; flex-direction: column; }
.case-client { font-family: var(--font-mono); font-size: 0.72rem; color: var(--teal); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.case-body h3 { font-size: 1.08rem; margin-bottom: 8px; }
.case-body p { font-size: 0.9rem; flex: 1; }
.case-body a { font-size: 0.85rem; font-weight: 600; color: var(--ink); border-top: 1px dashed var(--line); padding-top: 12px; margin-top: 8px; }
@media (max-width: 900px) { .portfolio-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .portfolio-grid { grid-template-columns: 1fr; } }

/* ---------- Industries / Certifications (stamp motif) ---------- */
.stamp-row { display: flex; flex-wrap: wrap; gap: 18px; }
.stamp {
  border: 1.5px solid var(--brass);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 10px 18px;
  border-radius: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transform: rotate(-1deg);
}
.stamp:nth-child(even) { transform: rotate(1deg); }
.stamp::before { content: '✓'; color: var(--brass); font-weight: 700; }

/* ---------- Two column feature ---------- */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
}
@media (max-width: 860px) { .split { grid-template-columns: 1fr; gap: 30px; } }

.feature-list { list-style: none; padding: 0; margin: 0; }
.feature-list li {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--line);
  color: var(--ink);
  font-weight: 500;
}
.feature-list li:last-child { border-bottom: none; }
.feature-list li::before { content: '—'; color: var(--brass); }

/* ---------- Testimonials ---------- */
.testimonial-card {
  background: var(--white);
  border: 1px solid var(--line);
  padding: 30px;
  border-radius: var(--radius);
}
.testimonial-card p { font-style: italic; color: var(--ink); font-size: 1.02rem; }
.testimonial-who { font-family: var(--font-mono); font-size: 0.78rem; color: var(--teal); text-transform: uppercase; letter-spacing: 0.04em; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-grid .full { grid-column: 1 / -1; }
label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
input, select, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.95rem;
  background: var(--white);
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(20,92,92,0.12);
}
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }

.alert { padding: 14px 18px; border-radius: var(--radius); margin-bottom: 24px; font-size: 0.92rem; }
.alert-success { background: #E4EFE7; border: 1px solid #3F7A52; color: #2C5B3B; }
.alert-error { background: #F5E4E1; border: 1px solid var(--danger); color: var(--danger); }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: rgba(246,244,238,0.7); padding: 60px 0 26px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1.2fr; gap: 40px; margin-bottom: 40px; }
.footer-grid h4 { color: var(--paper); font-family: var(--font-mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 16px; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: 10px; font-size: 0.9rem; }
.footer-grid a:hover { color: var(--brass-light); }
.footer-bottom {
  border-top: 1px solid rgba(246,244,238,0.12);
  padding-top: 22px;
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  flex-wrap: wrap;
  gap: 10px;
}
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } }

/* Page header (interior pages) */
.page-header { background: var(--ink); color: var(--white); padding: 60px 0 50px; }
.page-header p { color: rgba(246,244,238,0.7); max-width: 60ch; }

.breadcrumb { font-family: var(--font-mono); font-size: 0.75rem; color: var(--brass-light); margin-bottom: 14px; letter-spacing: 0.05em; text-transform: uppercase; }

/* ==========================================================================
   Interactive / motion layer
   ========================================================================== */

/* Scroll progress bar */
#scrollProgress {
  position: fixed; top: 0; left: 0;
  height: 3px; width: 0%;
  background: linear-gradient(90deg, var(--brass), var(--teal-light));
  z-index: 999;
  transition: width 0.1s ease-out;
}

/* Nav shrink on scroll */
.site-header.scrolled { box-shadow: 0 2px 18px rgba(15,42,61,0.1); }
.site-header.scrolled .nav-wrap { padding: 10px 0; }

/* Scroll-reveal */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s cubic-bezier(.2,.7,.3,1), transform 0.7s cubic-bezier(.2,.7,.3,1);
  transition-delay: var(--d, 0s);
}
.reveal.in-view { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* Card tilt (JS sets --rx / --ry / --tz via inline transform) */
.tilt {
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  transform-style: preserve-3d;
  will-change: transform;
}
.tilt:hover { box-shadow: 0 18px 40px rgba(15,42,61,0.16); z-index: 2; }

/* Hero spotlight that follows the cursor */
.hero { --mx: 50%; --my: 30%; }
.hero-spotlight {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(560px circle at var(--mx) var(--my), rgba(184,134,59,0.14), transparent 60%);
  transition: background 0.05s linear;
  z-index: 0;
}
.hero-grid { z-index: 1; }

/* Animated stat counters get a subtle pop when they finish */
.stat-num { display: inline-block; }
.stat-num.counted { animation: statPop 0.4s ease; }
@keyframes statPop { 0% { transform: scale(1); } 50% { transform: scale(1.12); } 100% { transform: scale(1); } }

/* Live-looping case flow (restarted periodically by JS) */
.flow-step.replay { animation: flowIn 0.6s ease forwards; }

/* Button micro-interaction */
.btn { position: relative; overflow: hidden; }
.btn::after {
  content: '';
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.25);
  transform: translateX(-100%);
  transition: transform 0.4s ease;
}
.btn:hover::after { transform: translateX(0); }
.btn span, .btn { position: relative; }

/* Service/case card icons number nudge on hover */
.service-card:hover .service-num { color: var(--teal); transform: translateX(2px); transition: all 0.25s ease; }

/* Testimonial fade-cycle dots (if JS enables cycling) */
.testimonial-dots { display: flex; gap: 8px; justify-content: center; margin-top: 20px; }
.testimonial-dots button {
  width: 8px; height: 8px; border-radius: 50%; border: none;
  background: var(--line); cursor: pointer; padding: 0;
  transition: background 0.2s ease, transform 0.2s ease;
}
.testimonial-dots button.active { background: var(--brass); transform: scale(1.3); }
