/* ==========================================================================
   Capital Software Group — Property Slate theme
   ========================================================================== */

:root {
  --color-primary: #333A42;      /* charcoal from logo letters */
  --color-secondary: #5E86A3;    /* steel blue from logo panels */
  --color-accent: #B5392B;       /* brick red from logo "S" */
  --color-accent-dark: #93291E;
  --color-sky: #C9DEEC;          /* light sky blue from logo panels */
  --color-surface: #F3F7FA;      /* cool blue-tinted off-white */
  --color-text: #232A30;
  --color-white: #FFFFFF;
  --color-muted: #64788A;
  --color-border: #D9E2EA;

  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;

  --container-max: 1140px;
  --radius: 8px;
  --shadow-sm: 0 1px 3px rgba(34, 40, 47, 0.08);
  --shadow-md: 0 6px 20px rgba(34, 40, 47, 0.12);
  --transition: 0.2s ease;
  --header-height: 72px;
}

/* Reset ------------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-surface);
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  max-width: 100%;
  display: block;
  height: auto;
}

ul,
ol {
  list-style: none;
}

a {
  color: var(--color-secondary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--color-accent);
}

/* Typography -------------------------------------------------------------- */
h1,
h2,
h3,
h4 {
  color: var(--color-primary);
  line-height: 1.2;
  font-weight: 700;
  margin-bottom: 0.5em;
}

h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2.25rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; }

p {
  margin-bottom: 1rem;
}

.lead {
  font-size: 1.15rem;
  color: var(--color-secondary);
}

.section-title {
  text-align: center;
  margin-bottom: 0.5rem;
}

.section-subtitle {
  text-align: center;
  color: var(--color-muted);
  max-width: 640px;
  margin: 0 auto 2.5rem;
}

/* Layout ------------------------------------------------------------------ */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

.section {
  padding: 4rem 0;
}

.section--alt {
  background-color: var(--color-white);
}

/* Header / Nav ------------------------------------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-height);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.logo img {
  height: 44px;
  width: 44px;
  object-fit: contain;
  border-radius: 6px;
  background: var(--color-white);
  padding: 2px;
}

/* Text wordmark fallback (used with or without the image) */
.wordmark {
  color: var(--color-white);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.wordmark span {
  color: var(--color-accent);
}

.main-nav ul {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.main-nav a {
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.35rem 0;
  border-bottom: 2px solid transparent;
}

.main-nav a:hover {
  color: var(--color-white);
}

.main-nav a.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

/* Hamburger --------------------------------------------------------------- */
.nav-toggle {
  display: none;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0.5rem;
}

.nav-toggle .bar {
  display: block;
  width: 24px;
  height: 2px;
  background-color: var(--color-white);
  margin: 5px 0;
  transition: transform var(--transition), opacity var(--transition);
}

.nav-open .nav-toggle .bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-open .nav-toggle .bar:nth-child(2) {
  opacity: 0;
}
.nav-open .nav-toggle .bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Hero -------------------------------------------------------------------- */
.hero {
  position: relative;
  background:
    radial-gradient(ellipse 80% 60% at 70% 20%, rgba(91, 107, 127, 0.55) 0%, rgba(91, 107, 127, 0) 60%),
    linear-gradient(150deg, #2B333F 0%, var(--color-primary) 45%, var(--color-secondary) 110%);
  color: var(--color-white);
  padding: 5.5rem 0;
  text-align: center;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--color-accent) 35%, var(--color-accent) 65%, transparent);
  opacity: 0.85;
}

.hero h1 {
  color: var(--color-white);
  max-width: 780px;
  margin-inline: auto;
}

.hero p {
  color: rgba(255, 255, 255, 0.85);
  max-width: 620px;
  margin: 1rem auto 2rem;
  font-size: 1.15rem;
}

.hero .btn-group {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Buttons ----------------------------------------------------------------- */
.btn {
  display: inline-block;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background-color var(--transition), color var(--transition),
    border-color var(--transition), transform var(--transition);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn--primary {
  background-color: var(--color-accent);
  color: var(--color-white);
}

.btn--primary:hover {
  background-color: var(--color-accent-dark);
  color: var(--color-white);
}

.btn--outline {
  background-color: transparent;
  color: var(--color-white);
  border-color: rgba(255, 255, 255, 0.6);
}

.btn--outline:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* Cards / Services grid ---------------------------------------------------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

/* Prevent a lone orphan card: 4-item grids render 2x2 on wide screens */
.card-grid--four {
  grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 640px) {
  .card-grid--four {
    grid-template-columns: 1fr;
  }
}

.card {
  background-color: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  border-color: rgba(94, 134, 163, 0.55);
}

.card h3 {
  margin-bottom: 0.4rem;
}

.card .card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(201, 222, 236, 0.55), rgba(94, 134, 163, 0.12));
  border: 1px solid rgba(94, 134, 163, 0.4);
  color: var(--color-secondary);
  margin-bottom: 1rem;
}

.card .card-icon svg {
  width: 26px;
  height: 26px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card p {
  color: var(--color-muted);
  margin-bottom: 0;
  font-size: 0.95rem;
}

/* Hero integration diagram -------------------------------------------------- */
.hero-diagram {
  max-width: 920px;
  margin: 3rem auto 0;
  padding: 0 0.5rem;
}

.hero-diagram svg {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
}

.hero-diagram .flow-line {
  stroke: rgba(255, 255, 255, 0.45);
  stroke-width: 2;
  fill: none;
  stroke-dasharray: 6 6;
  animation: flow-dash 1.6s linear infinite;
}

.hero-diagram .flow-line--brass {
  stroke: var(--color-accent);
  stroke-dasharray: 6 6;
}

@keyframes flow-dash {
  to { stroke-dashoffset: -24; }
}

/* Stat band ----------------------------------------------------------------- */
.stat-band {
  background-color: var(--color-primary);
  padding: 2.75rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.stat-band .container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

.stat-tile {
  text-align: center;
  padding: 0.5rem 1rem;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.stat-tile:first-child {
  border-left: 0;
}

.stat-tile .stat-value {
  display: block;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--color-sky);
  line-height: 1.2;
  margin-bottom: 0.35rem;
}

.stat-tile .stat-label {
  display: block;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.45;
}

/* Service section mini-diagrams ---------------------------------------------- */
.service-diagram {
  max-width: 560px;
  margin: 0 auto 2.5rem;
}

.service-diagram svg {
  width: 100%;
  height: auto;
  display: block;
}

.service-diagram .sd-stroke {
  stroke: var(--color-secondary);
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.service-diagram .sd-brass {
  stroke: var(--color-accent);
}

.service-diagram .sd-flow {
  stroke-dasharray: 5 5;
  animation: flow-dash 1.6s linear infinite;
}

.service-diagram .sd-box {
  fill: var(--color-white);
  stroke: var(--color-border);
  stroke-width: 1.5;
}

.section--alt .service-diagram .sd-box:not(.sd-box--brass) {
  fill: var(--color-surface);
}

.service-diagram .sd-box--brass {
  fill: var(--color-primary);
  stroke: var(--color-accent);
  stroke-width: 2;
}

.service-diagram text {
  font-family: var(--font-body);
  fill: var(--color-primary);
}

.service-diagram .sd-label {
  font-size: 12px;
  font-weight: 600;
}

.service-diagram .sd-label--light {
  fill: var(--color-white);
}

.service-diagram .sd-caption {
  font-size: 10px;
  fill: var(--color-muted);
  font-weight: 500;
  letter-spacing: 0.04em;
}

/* Footer ------------------------------------------------------------------ */
.site-footer {
  border-top: 3px solid var(--color-accent);
  background-color: var(--color-primary);
  color: rgba(255, 255, 255, 0.8);
  padding: 3rem 0 1.5rem;
  margin-top: 4rem;
}

.site-footer a {
  color: rgba(255, 255, 255, 0.8);
}

.site-footer a:hover {
  color: var(--color-accent);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.site-footer h4 {
  color: var(--color-white);
  margin-bottom: 0.75rem;
}

.site-footer li {
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding-top: 1.25rem;
  text-align: center;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
}

/* Reduced motion ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .hero-diagram .flow-line,
  .service-diagram .sd-flow {
    animation: none;
    stroke-dasharray: none;
  }

  .card,
  .card:hover,
  .btn,
  .btn:hover {
    transition: none;
    transform: none;
  }
}

/* Responsive --------------------------------------------------------------- */
@media (max-width: 767px) {
  .stat-band .container {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.75rem 1rem;
  }

  .stat-tile {
    border-left: 0;
    padding: 0;
  }

  .nav-toggle {
    display: block;
  }

  .main-nav {
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background-color: var(--color-primary);
    box-shadow: var(--shadow-md);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  .nav-open .main-nav {
    max-height: 420px;
  }

  .main-nav ul {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 0.5rem 1.25rem 1.25rem;
  }

  .main-nav li {
    width: 100%;
  }

  .main-nav a {
    display: block;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .main-nav a.active {
    border-bottom-color: var(--color-accent);
  }

  .hero {
    padding: 3.5rem 0;
  }

  .section {
    padding: 2.75rem 0;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }
}
