/* =========================================================
   PetroGas Systems Engineering — Design System v1.0
   Direction: Modern Industrial
   ========================================================= */

/* ---------- Design tokens ---------- */
:root {
  /* Brand — modernized from #B71313 */
  --brand-600: #B23030;     /* Primary red — refined, slightly less saturated */
  --brand-700: #8A2424;     /* Darker red for hover, deep accents */
  --brand-800: #631A1A;     /* Deepest red for pressed states */
  --brand-100: #F7E5E5;     /* Faint red wash for tints */

  /* Ink / neutrals — industrial slate palette */
  --ink-900: #0B1220;       /* Deepest text / headlines */
  --ink-800: #111827;
  --ink-700: #1F2937;
  --ink-600: #374151;
  --ink-500: #4B5563;
  --ink-400: #6B7280;
  --ink-300: #9CA3AF;
  --ink-200: #D1D5DB;
  --ink-100: #E5E7EB;
  --ink-50:  #F3F4F6;
  --paper:   #FFFFFF;
  --bg-soft: #F8FAFC;

  /* Accents */
  --steel-700: #1E3A5F;     /* Trust navy — used sparingly for credentials/labels */
  --amber-500: #D97706;     /* Caution color for status badges */
  --emerald-600: #047857;   /* Live / active badges */

  /* Type */
  --font-display: "Archivo", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-body:    "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono:    "IBM Plex Mono", "SF Mono", Menlo, Consolas, monospace;

  /* Type scale (modular, 1.25 ratio at the top end) */
  --t-xs: 0.75rem;     /* 12 */
  --t-sm: 0.875rem;    /* 14 */
  --t-base: 1rem;      /* 16 */
  --t-lg: 1.125rem;    /* 18 */
  --t-xl: 1.25rem;     /* 20 */
  --t-2xl: 1.5rem;     /* 24 */
  --t-3xl: 1.875rem;   /* 30 */
  --t-4xl: 2.25rem;    /* 36 */
  --t-5xl: 3rem;       /* 48 */
  --t-6xl: 3.75rem;    /* 60 */
  --t-7xl: 4.5rem;     /* 72 */

  /* Spacing (4-pt) */
  --s-1: 0.25rem; --s-2: 0.5rem; --s-3: 0.75rem; --s-4: 1rem;
  --s-5: 1.25rem; --s-6: 1.5rem; --s-8: 2rem; --s-10: 2.5rem;
  --s-12: 3rem; --s-16: 4rem; --s-20: 5rem; --s-24: 6rem; --s-32: 8rem;

  /* Layout */
  --container: 1200px;
  --container-wide: 1400px;
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 16px;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(11,18,32,0.06);
  --shadow:    0 4px 12px rgba(11,18,32,0.08);
  --shadow-lg: 0 12px 32px rgba(11,18,32,0.12);
}

/* ---------- Reset / base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  font-size: var(--t-base);
  line-height: 1.6;
  color: var(--ink-800);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-700); }

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--ink-900);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 var(--s-4);
  font-weight: 700;
}
h1 { font-size: clamp(2.25rem, 4vw + 1rem, 4rem); letter-spacing: -0.03em; }
h2 { font-size: clamp(1.875rem, 2.5vw + 0.75rem, 2.75rem); }
h3 { font-size: var(--t-2xl); font-weight: 600; }
h4 { font-size: var(--t-xl);  font-weight: 600; }
p  { margin: 0 0 var(--s-4); color: var(--ink-700); }
.lead { font-size: var(--t-xl); color: var(--ink-600); line-height: 1.55; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand-600);
  margin-bottom: var(--s-3);
  display: inline-block;
}
.eyebrow--muted { color: var(--ink-500); }

/* ---------- Layout primitives ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--s-6);
}
.container--wide { max-width: var(--container-wide); }
.section { padding: var(--s-24) 0; }
.section--sm { padding: var(--s-16) 0; }
.section--lg { padding: var(--s-32) 0; }
.section--dark { background: var(--ink-900); color: var(--ink-100); }
.section--dark h1, .section--dark h2, .section--dark h3 { color: var(--paper); }
.section--dark p { color: var(--ink-300); }
.section--soft { background: var(--bg-soft); }

.grid { display: grid; gap: var(--s-8); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid--tight { gap: var(--s-4); }

@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,0.92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--ink-100);
}
.site-header__inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-4) 0;
}
.brand-mark {
  display: flex; align-items: center; gap: var(--s-3);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--t-lg);
  color: var(--ink-900);
  letter-spacing: -0.02em;
}
.brand-mark__bug {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: var(--brand-600); color: white;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--t-base);
  letter-spacing: -0.04em;
}
.nav-list {
  display: flex; gap: var(--s-8); list-style: none;
  margin: 0; padding: 0;
}
.nav-list a {
  color: var(--ink-700); font-weight: 500;
  font-size: var(--t-sm);
  letter-spacing: 0.01em;
  position: relative;
  padding: var(--s-2) 0;
}
.nav-list a:hover { color: var(--ink-900); }
.nav-list a.is-active { color: var(--brand-600); }
.nav-list a.is-active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px;
  height: 2px; background: var(--brand-600);
}

/* Mobile nav */
.nav-toggle {
  display: none;
  flex-direction: column; justify-content: center; gap: 5px;
  width: 36px; height: 36px;
  background: none; border: none; cursor: pointer; padding: 4px;
}
.nav-toggle span {
  display: block; height: 2px; width: 100%;
  background: var(--ink-900); border-radius: 2px;
  transition: all 0.25s ease;
}
.nav-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.nav-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 900px) {
  .nav-toggle { display: flex; }
  .site-header__nav {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    background: white;
    border-bottom: 1px solid var(--ink-100);
    box-shadow: var(--shadow);
    z-index: 49;
  }
  .site-header__nav.is-open { display: block; }
  .nav-list {
    flex-direction: column; gap: 0;
    padding: var(--s-4) var(--s-6);
  }
  .nav-list li { border-bottom: 1px solid var(--ink-100); }
  .nav-list li:last-child { border-bottom: none; }
  .nav-list a { display: block; padding: var(--s-4) 0; font-size: var(--t-base); }
  .nav-list a.is-active::after { display: none; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: var(--s-3) var(--s-6);
  font-family: var(--font-display);
  font-size: var(--t-sm);
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  line-height: 1;
}
.btn--primary { background: var(--brand-600); color: white; }
.btn--primary:hover { background: var(--brand-700); color: white; }
.btn--secondary { background: var(--ink-900); color: white; }
.btn--secondary:hover { background: var(--ink-800); color: white; }
.btn--ghost {
  background: transparent; color: var(--ink-900);
  border-color: var(--ink-200);
}
.btn--ghost:hover { border-color: var(--ink-400); }
.btn--lg { padding: var(--s-4) var(--s-8); font-size: var(--t-base); }
.btn .arrow { transition: transform 0.2s ease; }
.btn:hover .arrow { transform: translateX(2px); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 580px;
  display: grid; align-items: center;
  background: var(--ink-900);
  color: white;
  overflow: hidden;
}
.hero__bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  filter: brightness(0.42) saturate(0.85);
}
.hero__bg--overlay::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(120deg, rgba(11,18,32,0.85) 0%, rgba(11,18,32,0.45) 60%, rgba(178,48,48,0.25) 100%);
}
.hero__content { position: relative; z-index: 1; padding: var(--s-24) 0; max-width: 760px; }
.hero h1 { color: white; margin-bottom: var(--s-5); }
.hero p { color: rgba(255,255,255,0.85); font-size: var(--t-xl); max-width: 600px; }
.hero__cta { margin-top: var(--s-8); display: flex; gap: var(--s-3); }

/* Page hero (smaller, for inner pages) */
.page-hero {
  padding: var(--s-20) 0 var(--s-16);
  border-bottom: 1px solid var(--ink-100);
  background: var(--bg-soft);
}
.page-hero h1 { font-size: clamp(2rem, 3vw + 1rem, 3.25rem); margin-bottom: var(--s-4); }
.page-hero .lead { max-width: 720px; }

/* ---------- Cards ---------- */
.card {
  background: white;
  border: 1px solid var(--ink-100);
  border-radius: var(--radius);
  padding: var(--s-6);
  transition: all 0.25s ease;
}
.card:hover {
  border-color: var(--ink-200);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.card__icon {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: var(--brand-100); color: var(--brand-600);
  border-radius: var(--radius-sm);
  margin-bottom: var(--s-4);
}
.card__title { font-size: var(--t-xl); font-weight: 600; color: var(--ink-900); margin-bottom: var(--s-2); }
.card__body { color: var(--ink-600); font-size: var(--t-sm); line-height: 1.6; }

/* Service card variant */
.service-card {
  background: white;
  border: 1px solid var(--ink-100);
  border-radius: var(--radius);
  padding: var(--s-8);
  position: relative;
  overflow: hidden;
}
.service-card__num {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  color: var(--brand-600);
  letter-spacing: 0.15em;
  margin-bottom: var(--s-4);
  display: block;
}
.service-card h3 { margin-bottom: var(--s-3); }
.service-card ul { list-style: none; padding: 0; margin: var(--s-4) 0 0; }
.service-card li {
  font-size: var(--t-sm);
  color: var(--ink-600);
  padding: var(--s-2) 0;
  border-bottom: 1px solid var(--ink-100);
  display: flex; gap: var(--s-3); align-items: flex-start;
}
.service-card li:last-child { border-bottom: 0; }
.service-card li::before {
  content: ""; flex-shrink: 0;
  width: 6px; height: 6px; margin-top: 8px;
  background: var(--brand-600);
}

/* Stats */
.stat { padding: var(--s-6) 0; }
.stat__value {
  font-family: var(--font-display);
  font-size: var(--t-5xl);
  font-weight: 700;
  color: var(--brand-600);
  line-height: 1; letter-spacing: -0.03em;
  margin-bottom: var(--s-2);
}
.stat__label {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-500);
}

/* ---------- Logo wall ---------- */
.logo-wall {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  border-radius: var(--radius);
  overflow: hidden;
  outline: 1px solid var(--ink-100);
}
.logo-wall__item {
  background: white;
  aspect-ratio: 3 / 2;
  width: calc(100% / 6);
  display: grid; place-items: center;
  padding: var(--s-6);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--t-sm);
  color: var(--ink-500);
  letter-spacing: 0.02em;
  transition: all 0.2s ease;
  text-align: center;
  flex-shrink: 0;
  outline: 1px solid var(--ink-100);
}
.logo-wall__item:hover { background: var(--bg-soft); color: var(--ink-900); }
.logo-wall__item:hover img { filter: grayscale(0%) opacity(1); }
@media (max-width: 900px) {
  .logo-wall__item { width: calc(100% / 3); }
}

/* ---------- Project cards (case studies) ---------- */
.project-card {
  display: block; color: inherit;
  background: white;
  border: 1px solid var(--ink-100);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.25s ease;
}
.project-card:hover {
  border-color: var(--ink-200);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.project-card__media {
  aspect-ratio: 16 / 10;
  background: var(--ink-100) center/cover no-repeat;
  position: relative;
}
.project-card__tag {
  position: absolute; top: var(--s-4); left: var(--s-4);
  background: rgba(11,18,32,0.85); color: white;
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--radius-sm);
}
.project-card__body { padding: var(--s-5) var(--s-6) var(--s-6); }
.project-card__client {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-500);
  margin-bottom: var(--s-2);
}
.project-card__title { font-size: var(--t-lg); font-weight: 600; color: var(--ink-900); margin-bottom: var(--s-2); }
.project-card__meta {
  display: flex; gap: var(--s-4);
  font-size: var(--t-xs);
  color: var(--ink-500);
  margin-top: var(--s-3);
  padding-top: var(--s-3);
  border-top: 1px solid var(--ink-100);
}

/* ---------- Jobs list ---------- */
.job {
  display: grid;
  grid-template-columns: 1fr 200px 160px 40px;
  align-items: center;
  gap: var(--s-6);
  padding: var(--s-5) var(--s-6);
  border-bottom: 1px solid var(--ink-100);
  background: white;
  transition: background 0.15s ease;
  color: var(--ink-900);
}
.job:hover { background: var(--bg-soft); }
.job__title { font-weight: 600; font-size: var(--t-lg); }
.job__sub { font-size: var(--t-sm); color: var(--ink-500); margin-top: var(--s-1); }
.job__meta {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-600);
}
.job__arrow { color: var(--brand-600); font-size: var(--t-xl); }
@media (max-width: 900px) {
  .job { grid-template-columns: 1fr; gap: var(--s-2); padding: var(--s-5); }
  .job__arrow { display: none; }
}

/* ---------- Badge / pill ---------- */
.badge {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: var(--s-1) var(--s-3);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: 999px;
  background: var(--ink-50);
  color: var(--ink-700);
}
.badge--brand { background: var(--brand-100); color: var(--brand-700); }
.badge--live { background: rgba(4,120,87,0.1); color: var(--emerald-600); }
.badge--live::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--emerald-600);
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--ink-900);
  color: var(--ink-300);
  padding: var(--s-20) 0 var(--s-8);
}
.site-footer h4 {
  color: white; font-size: var(--t-sm); font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  margin-bottom: var(--s-4);
}
.site-footer a { color: var(--ink-300); }
.site-footer a:hover { color: white; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { padding: var(--s-2) 0; font-size: var(--t-sm); }
.site-footer__bar {
  margin-top: var(--s-16);
  padding-top: var(--s-6);
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex; justify-content: space-between; align-items: center;
  font-size: var(--t-xs); color: var(--ink-400);
}

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--s-2); }
.mb-4 { margin-bottom: var(--s-4); }
.mb-6 { margin-bottom: var(--s-6); }
.mb-8 { margin-bottom: var(--s-8); }
.mt-8 { margin-top: var(--s-8); }
.divider { height: 1px; background: var(--ink-100); margin: var(--s-12) 0; }
.divider--brand { background: var(--brand-600); width: 48px; height: 3px; margin-bottom: var(--s-4); }

/* ---------- Preview hub styles (only used on index.html) ---------- */
.hub { padding: var(--s-16) 0; background: var(--bg-soft); min-height: 100vh; }
.hub__title { margin-bottom: var(--s-2); }
.hub__sub { color: var(--ink-500); margin-bottom: var(--s-12); }
.hub-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-6); }
.hub-card {
  background: white; border-radius: var(--radius);
  padding: var(--s-6); border: 1px solid var(--ink-100);
  text-decoration: none; color: inherit;
  display: block;
  transition: all 0.2s ease;
}
.hub-card:hover { border-color: var(--brand-600); transform: translateY(-2px); box-shadow: var(--shadow); }
.hub-card__num {
  font-family: var(--font-mono); font-size: var(--t-xs);
  color: var(--brand-600); letter-spacing: 0.15em;
  margin-bottom: var(--s-3); display: block;
}
.hub-card__title { font-weight: 600; font-size: var(--t-lg); color: var(--ink-900); margin-bottom: var(--s-2); }
.hub-card__desc { font-size: var(--t-sm); color: var(--ink-500); margin: 0; }
@media (max-width: 900px) { .hub-grid { grid-template-columns: 1fr; } }

/* ==========================================================
   Mobile responsiveness — comprehensive @media block
   All layout fixes for screens below 900px
   ========================================================== */

/* Reusable responsive layout classes */
.flex-col-mobile { display: flex; }
.stack-mobile { display: flex; }

@media (max-width: 900px) {

  /* ---------- Industries grid ---------- */
  .flex-col-mobile > div > div[style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* ---------- Value prop image ---------- */
  .value-prop-img { display: none; }

  /* ---------- CTA button ---------- */
  .flex-col-mobile .btn--lg { width: 100%; justify-content: center; text-align: center; }

  /* ---------- Services blocks ---------- */
  .svc-items-list { columns: 1 !important; }
  .flex-col-mobile > div[style*="flex:0 0 300px"] { flex: 1 1 auto !important; width: 100% !important; }

  /* ---------- Industries fixed-width sidebar ---------- */
  .flex-col-mobile > div[style*="flex:0 0 340px"] { flex: 1 1 auto !important; width: 100% !important; }
  h1 { font-size: clamp(1.875rem, 6vw, 2.5rem); }
  h2 { font-size: clamp(1.5rem, 5vw, 2rem); }
  .lead { font-size: var(--t-lg); }

  /* ---------- Section spacing ---------- */
  .section { padding: var(--s-16) 0; }
  .section--lg { padding: var(--s-20) 0; }

  /* ---------- Page hero ---------- */
  .page-hero { padding: var(--s-12) 0 var(--s-10); }

  /* ---------- Hero ---------- */
  .hero { min-height: 480px; }
  .hero__content { padding: var(--s-16) var(--s-6) !important; }
  .hero__cta { flex-direction: column; gap: var(--s-3); }
  .hero__cta .btn { width: 100%; justify-content: center; }

  /* ---------- Stats strip ---------- */
  .stats-row {
    flex-wrap: wrap !important;
    gap: var(--s-4) !important;
  }
  .stats-row .stat-item {
    flex: 1 1 calc(50% - var(--s-4)) !important;
    min-width: 0;
  }
  .stat-val { font-size: var(--t-4xl) !important; }

  /* ---------- Services nav ---------- */
  #svc-nav {
    flex-wrap: wrap !important;
    gap: var(--s-2) !important;
    overflow-x: visible !important;
  }

  /* ---------- Two-col flex layouts ---------- */
  .flex-col-mobile { flex-direction: column !important; gap: var(--s-8) !important; }

  /* ---------- Careers why-work section ---------- */
  .careers-why { flex-direction: column !important; gap: var(--s-8) !important; }
  .careers-stats-grid { grid-template-columns: 1fr 1fr !important; }

  /* ---------- Job listing ---------- */
  .job {
    grid-template-columns: 1fr !important;
    gap: var(--s-2) !important;
    padding: var(--s-5) !important;
  }
  .job__arrow { display: none !important; }

  /* ---------- Footer ---------- */
  .site-footer .grid-4 { grid-template-columns: 1fr 1fr !important; gap: var(--s-8) !important; }
  .site-footer__bar { flex-direction: column; gap: var(--s-2); text-align: center; }

  /* ---------- Contact form ---------- */
  .form-grid { grid-template-columns: 1fr !important; }

  /* ---------- Case study meta ---------- */
  .cs-meta-grid { grid-template-columns: 1fr 1fr !important; }

  /* ---------- Filter bar ---------- */
  .filter-bar { gap: var(--s-2) !important; }

  /* ---------- Buttons ---------- */
  .btn--lg { padding: var(--s-4) var(--s-6); font-size: var(--t-sm); }
}

@media (max-width: 480px) {
  /* ---------- Extra small screens ---------- */
  .site-footer .grid-4 { grid-template-columns: 1fr !important; }
  .stats-row .stat-item { flex: 1 1 100% !important; }
  .logo-wall__item { width: calc(100% / 2) !important; }
  .careers-stats-grid { grid-template-columns: 1fr 1fr !important; }
}
