/* ==========================================================================
   Quadlogy — Design System
   Palette: warm charcoal + stone grey, rustic burnt-orange accent
   Type: Space Grotesk (display/labels) + Inter (body) + IBM Plex Mono (data)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  /* Colors */
  --ink: #262422;          /* primary text / near-black warm charcoal */
  --slate: #55534d;        /* secondary text */
  --slate-soft: #8a8780;   /* muted / tertiary text */
  --stone: #ece8e1;        /* page background */
  --stone-deep: #ddd8ce;   /* section band background */
  --paper: #faf9f6;        /* card background */
  --line: #d8d3c7;         /* hairline borders */
  --line-soft: #e4e0d6;
  --rust: #c1502e;         /* primary accent */
  --rust-dark: #8f3a22;    /* accent hover / deep */
  --rust-tint: #efe0d6;    /* light accent wash */
  --ink-inverse: #f4f1ea;

  /* Type */
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --container: 1160px;
}

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

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

img { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; }

.wrap {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 32px;
}

:focus-visible {
  outline: 2px solid var(--rust);
  outline-offset: 3px;
}

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

/* -------------------- Type scale -------------------- */

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

h1 { font-size: clamp(2.4rem, 4.4vw, 3.9rem); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.7rem, 2.6vw, 2.4rem); }
h3 { font-size: 1.2rem; }

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

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rust);
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--rust);
  display: inline-block;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--slate-soft);
}

.lede {
  font-size: 1.1rem;
  color: var(--slate);
  max-width: 640px;
}

/* -------------------- Buttons -------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 13px 26px;
  border-radius: 3px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.btn-primary {
  background: var(--rust);
  color: var(--ink-inverse);
}
.btn-primary:hover { background: var(--rust-dark); transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn-ghost:hover { border-color: var(--rust); color: var(--rust-dark); }

.btn-inverse {
  background: var(--ink-inverse);
  color: var(--ink);
}
.btn-inverse:hover { background: var(--rust); color: var(--ink-inverse); }

/* -------------------- Header -------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(236, 232, 225, 0.92);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 84px;
}

.brand img {
  height: 52px;
  width: auto;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 40px;
}

.main-nav ul {
  list-style: none;
  display: flex;
  gap: 30px;
  margin: 0;
  padding: 0;
}

.main-nav a {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--slate);
  position: relative;
  padding-bottom: 4px;
}

.main-nav a:hover, .main-nav a[aria-current="page"] {
  color: var(--ink);
}

.main-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 2px;
  background: var(--rust);
}

.nav-toggle { display: none; }

@media (max-width: 860px) {
  .main-nav ul { display: none; }
  .nav-toggle {
    display: inline-flex;
    background: none;
    border: 1px solid var(--line);
    border-radius: 3px;
    padding: 8px 12px;
    font-family: var(--font-mono);
  }
}

/* -------------------- Hero -------------------- */

.hero {
  position: relative;
  overflow: hidden;
  padding: 88px 0 64px;
  border-bottom: 1px solid var(--line);
}

.hero-motif {
  position: absolute;
  top: -140px;
  right: -160px;
  width: 640px;
  height: 640px;
  opacity: 0.55;
  pointer-events: none;
}

.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  max-width: 760px;
}

.hero h1 { margin-top: 18px; }

.hero .lede { margin-top: 20px; font-size: 1.18rem; }

.hero-cta {
  display: flex;
  gap: 14px;
  margin-top: 30px;
  flex-wrap: wrap;
}

/* Status / dashboard readout strip */

.status-strip {
  position: relative;
  z-index: 1;
  margin-top: 64px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 4px;
  overflow: hidden;
}

.status-cell {
  padding: 20px 22px;
  border-right: 1px solid var(--line);
}
.status-cell:last-child { border-right: none; }

.status-cell .k {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--slate-soft);
  display: block;
  margin-bottom: 8px;
}

.status-cell .v {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.02rem;
  color: var(--ink);
  display: block;
}

.status-cell .v.live::before {
  content: "";
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--rust);
  margin-right: 7px;
}

.status-cell .sub {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--slate-soft);
  margin-top: 3px;
  display: block;
}

@media (max-width: 760px) {
  .status-strip { grid-template-columns: 1fr 1fr; }
  .status-cell:nth-child(2) { border-right: none; }
  .status-cell:nth-child(1), .status-cell:nth-child(2) { border-bottom: 1px solid var(--line); }
}

/* -------------------- Sections -------------------- */

.section { padding: 92px 0; }
.section-band { background: var(--stone-deep); }
.section-dark { background: var(--ink); color: var(--ink-inverse); }
.section-dark p { color: #c9c5ba; }
.section-dark h2, .section-dark h3 { color: var(--ink-inverse); }

.section-head {
  max-width: 640px;
  margin-bottom: 54px;
}
.section-head h2 { margin-top: 14px; }

.divider-strip {
  width: 200px;
  height: 24px;
  margin: 28px 0 0;
  opacity: 0.9;
}

/* -------------------- Domain cards (3-up) -------------------- */

.domain-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.domain-card {
  background: var(--paper);
  padding: 34px 30px 38px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.domain-num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--rust);
  letter-spacing: 0.08em;
}

.domain-card h3 { font-size: 1.28rem; margin-top: 2px; }

.domain-card p { font-size: 0.96rem; }

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 14px;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--slate);
}

@media (max-width: 860px) {
  .domain-grid { grid-template-columns: 1fr; }
}

/* -------------------- Process steps -------------------- */

.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 28px;
  position: relative;
}

.steps::before {
  content: "";
  position: absolute;
  top: 11px;
  left: 5%;
  right: 5%;
  height: 1px;
  background: var(--line);
}

.step { position: relative; padding-top: 34px; }

.step-dot {
  position: absolute;
  top: 0; left: 0;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--rust);
}

.step .k {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--rust);
}

.step h4 {
  font-family: var(--font-display);
  font-size: 1.02rem;
  margin: 8px 0 8px;
}

.step p { font-size: 0.92rem; }

@media (max-width: 760px) {
  .steps { grid-template-columns: 1fr 1fr; row-gap: 40px; }
  .steps::before { display: none; }
}

/* -------------------- Stat band -------------------- */

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

.stat {
  border-left: 2px solid var(--rust);
  padding-left: 18px;
}

.stat .num {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 500;
  color: var(--ink-inverse);
  display: block;
}

.stat .desc {
  font-size: 0.88rem;
  margin-top: 6px;
}

@media (max-width: 760px) {
  .stat-band { grid-template-columns: 1fr 1fr; row-gap: 32px; }
}

/* -------------------- Project cards -------------------- */

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.project-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 26px 26px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.project-card:hover {
  border-color: var(--rust);
  transform: translateY(-3px);
}

.project-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--slate-soft);
}

.project-id { color: var(--rust); }

.project-card h4 {
  font-family: var(--font-display);
  font-size: 1.08rem;
  margin: 2px 0 4px;
}

.project-card p { font-size: 0.9rem; }

.project-domain {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--slate-soft);
}

.project-link {
  margin-top: auto;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--rust);
  padding-top: 10px;
}

@media (max-width: 860px) {
  .project-grid { grid-template-columns: 1fr; }
}

/* -------------------- CTA band -------------------- */

.cta-band {
  text-align: center;
  padding: 90px 0;
  background: var(--ink);
  color: var(--ink-inverse);
}

.cta-band h2 { color: var(--ink-inverse); margin-bottom: 30px; }

/* -------------------- Footer -------------------- */

.site-footer {
  background: var(--ink);
  color: #cfcbc0;
  padding: 64px 0 30px;
  border-top: 4px solid var(--rust);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 40px;
  border-bottom: 1px solid #423f3a;
}

.footer-grid p { color: #a29e93; font-size: 0.9rem; }

.footer-col h5 {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8a8680;
  margin: 0 0 16px;
}

.footer-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.footer-col a { color: #cfcbc0; font-size: 0.92rem; }
.footer-col a:hover { color: var(--rust); }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 24px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: #8a8680;
  flex-wrap: wrap;
  gap: 10px;
}

.footer-bottom .status {
  color: var(--rust);
}

@media (max-width: 860px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

/* -------------------- Sub-page header band -------------------- */

.page-hero {
  padding: 60px 0 56px;
  border-bottom: 1px solid var(--line);
}

.page-hero h1 { margin-top: 14px; font-size: clamp(2rem, 3.6vw, 3rem); }
.page-hero .lede { margin-top: 16px; }

/* Utility */
.mt-0 { margin-top: 0; }

/* -------------------- Mobile nav open state -------------------- */
@media (max-width: 860px) {
  .main-nav { position: static; }
  .main-nav ul.open {
    display: flex;
    position: absolute;
    top: 84px; left: 0; right: 0;
    background: var(--paper);
    flex-direction: column;
    gap: 4px;
    padding: 18px 32px 22px;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 12px 24px rgba(38,36,34,0.08);
  }
  .main-nav ul.open a { display: block; padding: 8px 0; }
  .main-nav > .btn { display: none; }
}

/* -------------------- Services page -------------------- */

.svc-section { padding: 84px 0; border-bottom: 1px solid var(--line); }
.svc-section:last-of-type { border-bottom: none; }

.svc-num {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  color: var(--rust);
  text-transform: uppercase;
}

.svc-section h2 { margin-top: 12px; max-width: 620px; }
.svc-section .lede { margin-top: 16px; }

/* Vertical evaluation steps */
.vsteps {
  margin-top: 52px;
  border-left: 1px solid var(--line);
  margin-left: 14px;
  display: flex;
  flex-direction: column;
}

.vstep {
  position: relative;
  padding: 0 0 38px 42px;
  max-width: 720px;
}
.vstep:last-child { padding-bottom: 0; }

.vstep::before {
  content: attr(data-step);
  position: absolute;
  left: -15px;
  top: -2px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--rust);
  color: var(--ink-inverse);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vstep h4 {
  font-family: var(--font-display);
  font-size: 1.08rem;
  margin: 0 0 8px;
}

.vstep p { font-size: 0.95rem; }

/* Service card grid (AI implementation) */
.svc-grid {
  margin-top: 52px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.svc-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 26px 24px 28px;
}

.svc-card .k {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rust);
  display: block;
  margin-bottom: 10px;
}

.svc-card h4 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin: 0 0 10px;
}

.svc-card p { font-size: 0.92rem; }

@media (max-width: 860px) {
  .svc-grid { grid-template-columns: 1fr; }
}

/* Principle cards (per-domain best practices) */
.principle-grid {
  margin-top: 52px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.principle {
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 3px solid var(--rust);
  border-radius: 4px;
  padding: 28px 26px;
}

.principle .k {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--slate-soft);
}

.principle h4 {
  font-family: var(--font-display);
  font-size: 1.14rem;
  margin: 6px 0 16px;
}

.principle ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.principle li {
  font-size: 0.92rem;
  color: var(--slate);
  padding-left: 20px;
  position: relative;
}

.principle li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rust);
}

@media (max-width: 860px) {
  .principle-grid { grid-template-columns: 1fr; }
}

/* Engagement model tiles */
.engage-grid {
  margin-top: 44px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.engage {
  background: var(--paper);
  padding: 26px 24px 30px;
}

.engage .k {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rust);
}

.engage h4 { font-family: var(--font-display); font-size: 1.02rem; margin: 8px 0 8px; }
.engage p { font-size: 0.9rem; }

@media (max-width: 860px) {
  .engage-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .engage-grid { grid-template-columns: 1fr; }
}

/* Domain detail rows */
.detail-row {
  margin-top: 44px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}
@media (max-width: 860px) {
  .detail-row { grid-template-columns: 1fr; }
}

/* -------------------- Case studies page -------------------- */

.case {
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 48px;
  padding: 64px 0;
  border-bottom: 1px solid var(--line);
}
.case:last-of-type { border-bottom: none; }

.case-side { position: relative; }

.case-id {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--rust);
  letter-spacing: 0.08em;
}

.case-side h3 {
  font-size: 1.4rem;
  margin: 10px 0 18px;
  line-height: 1.2;
}

.case-facts {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.case-fact {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}
.case-fact .k { font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--slate-soft); }
.case-fact .v { font-family: var(--font-display); font-weight: 600; color: var(--ink); }

.case-body { display: flex; flex-direction: column; gap: 26px; }

.case-block h5 {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--rust);
  margin: 0 0 8px;
}

.case-block p { font-size: 0.98rem; }

@media (max-width: 860px) {
  .case { grid-template-columns: 1fr; gap: 28px; }
}

/* -------------------- Projects filters -------------------- */

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 40px;
}

.filter-btn {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.88rem;
  padding: 9px 18px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--slate);
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-btn:hover { border-color: var(--rust); color: var(--rust-dark); }
.filter-btn.active { background: var(--ink); color: var(--ink-inverse); border-color: var(--ink); }

.project-stats {
  display: flex;
  gap: 18px;
  font-size: 0.82rem;
  margin-top: 4px;
  flex-wrap: wrap;
}
.project-stats span { color: var(--slate-soft); }
.project-stats b { color: var(--ink); font-family: var(--font-display); }

/* -------------------- Contact page -------------------- */

.contact-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 56px;
  padding: 72px 0 92px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.field { display: flex; flex-direction: column; gap: 7px; }
.field.full { grid-column: 1 / -1; }

.field label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--slate);
}

.field input, .field select, .field textarea {
  font-family: var(--font-body);
  font-size: 0.96rem;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--ink);
}

.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--rust);
  outline-offset: 0;
  border-color: var(--rust);
}

.field textarea { min-height: 140px; resize: vertical; }

.form-note {
  font-size: 0.82rem;
  color: var(--slate-soft);
  margin-top: 14px;
}

.info-list { display: flex; flex-direction: column; gap: 26px; }

.info-item .k {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--slate-soft);
  display: block;
  margin-bottom: 5px;
}

.info-item .v {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
}

.info-item a.v:hover { color: var(--rust); }

@media (max-width: 860px) {
  .contact-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}

/* -------------------- About page bits -------------------- */

.value-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
  margin-top: 48px;
}

.value {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 26px;
}

.value h4 { font-family: var(--font-display); font-size: 1.05rem; margin: 0 0 8px; }
.value p { font-size: 0.93rem; }

@media (max-width: 760px) {
  .value-grid { grid-template-columns: 1fr; }
}

.industry-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 40px;
}

.industry {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.92rem;
  padding: 10px 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--paper);
  color: var(--slate);
}
