/* ============================================================
   Cities Lab — design tokens
   Layout language adapted from the provided design inspiration:
   warm ivory canvas, deep ink bands, pastel accents, soft serif
   display type. Brown swapped for a deep asphalt/petrol ink to
   match the Cities Lab identity; teal is the brand accent.
   ============================================================ */
:root {
  /* Opt out of browser auto-dark-theme (Chrome Android / Edge forced dark),
     which re-tints backgrounds without reliably lightening text and causes
     dark-on-dark text. This site supplies its own dark sections. */
  color-scheme: light only;
  --ink: #14232C;
  --ink-2: #0F1B21;
  --ink-soft: #1E323C;
  --cream: #F6F3E7;
  --cream-soft: #EFEBDC;
  --card: #FCFAF2;
  --white: #FFFFFF;
  --text: #1B262D;
  --muted: #505B63;
  --cream-text: #EFECDF;
  --cream-muted: rgba(239, 236, 223, 0.72);
  --p-blue: #D9E7F2;
  --p-yellow: #F7EBBB;
  --p-sage: #DFE0C6;
  --teal: #2E9FBE;          /* graphics / SVG accents */
  --teal-text: #17677C;     /* text & links on light backgrounds */
  --line: rgba(20, 35, 44, 0.12);
  --line-dark: rgba(246, 243, 231, 0.16);
  --radius: 16px;
  --shadow: 0 18px 44px rgba(15, 27, 33, 0.12);
  --font-body: "Archivo", system-ui, sans-serif;
  --font-display: "Fraunces", Georgia, serif;
  --font-hero: "Archivo Black", "Archivo", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--p-yellow); color: var(--ink); }
section[id], footer[id] { scroll-margin-top: 100px; }

.wrap { max-width: 1140px; margin-inline: auto; padding-inline: 24px; }
.section { padding: clamp(72px, 9vw, 108px) 0; }
.section.soft { background: var(--cream-soft); }
.section.dark { background: var(--ink); color: var(--cream-text); }

/* ---------- shared bits ---------- */
.tag {
  display: inline-block;
  background: var(--p-yellow);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 5px 9px;
  border-radius: 3px;
  margin-bottom: 18px;
}
h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.2rem, 4.6vw, 3.35rem);
  line-height: 1.06;
  letter-spacing: -0.015em;
  max-width: 14ch;
}
.dark h2 { color: var(--cream); }
h2 .dot { color: var(--teal-text); }
.dark h2 .dot { color: var(--teal); }

.sec-head {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 48px;
  align-items: end;
  margin-bottom: clamp(44px, 6vw, 64px);
}
.sec-intro {
  text-align: right;
  justify-self: end;
  max-width: 50ch;
  font-size: 15px;
  color: var(--muted);
}
.dark .sec-intro { color: var(--cream-muted); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 12px 22px;
  font: 600 14px var(--font-body);
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(15, 27, 33, 0.18); }
.btn-cream { background: var(--cream); color: var(--ink); }
.btn-ink { background: var(--ink); color: var(--cream); }
.btn-ghost { background: transparent; border-color: rgba(246, 243, 231, 0.4); color: var(--cream-text); }
.btn-ghost:hover { background: rgba(246, 243, 231, 0.08); }

/* ---------- nav ---------- */
.nav { position: fixed; top: 14px; left: 0; right: 0; z-index: 50; }
.nav-pill {
  background: rgba(20, 35, 44, 0.92);
  backdrop-filter: blur(10px);
  border-radius: 999px;
  padding: 9px 9px 9px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: 0 12px 34px rgba(15, 27, 33, 0.3);
  border: 1px solid rgba(246, 243, 231, 0.14);
  position: relative;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--cream);
  font-weight: 700;
  font-size: 15.5px;
  letter-spacing: 0.02em;
  text-decoration: none;
}
.brand-mark { width: 22px; height: 22px; color: var(--cream); }
.nav-links { display: flex; gap: 4px; margin-inline: auto; }
.nav-links a {
  color: var(--cream-text);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 999px;
  transition: background 0.2s ease;
}
.nav-links a:hover { background: rgba(246, 243, 231, 0.12); }
.nav-cta { padding: 10px 18px; font-size: 13.5px; }
.nav-burger { display: none; }

/* ---------- hero ---------- */
.hero {
  position: relative;
  min-height: clamp(620px, 97vh, 920px);
  background: var(--ink-2);
  color: var(--cream);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.hero-map { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(
    180deg,
    rgba(15, 27, 33, 0.3) 0%,
    rgba(15, 27, 33, 0) 28%,
    rgba(15, 27, 33, 0.5) 58%,
    rgba(15, 27, 33, 0.88) 100%
  );
  pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; width: 100%; padding-bottom: clamp(36px, 5vh, 60px); }

.hero-meta {
  border-top: 1px solid rgba(246, 243, 231, 0.3);
  padding-top: 22px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 40px;
  align-items: start;
  margin-bottom: clamp(28px, 5vh, 56px);
}
.hero-meta { text-shadow: 0 1px 14px rgba(15, 27, 33, 0.55); }
.hero-tagline { font-size: 15px; font-weight: 500; }
.hero-desc { max-width: 46ch; font-size: 14.5px; color: rgba(246, 243, 231, 0.82); }
.hero-meta .btn { justify-self: end; }

.hero-title {
  display: grid;
  font-family: var(--font-hero);
  font-weight: 400;
  text-transform: uppercase;
  font-size: clamp(3rem, 10.6vw, 8.9rem);
  line-height: 0.94;
  letter-spacing: 0.005em;
}
.hero-title .ht-a { justify-self: start; }
.hero-title .ht-b { justify-self: end; }
.hero-title .ht-c { justify-self: center; }
.hero-title em { font-style: normal; color: var(--teal); }

/* lane animation */
.lane { stroke-dasharray: 26 24; }
.lane-b { animation-duration: 13s; }
.lane-c { animation-duration: 11s; }
@media (prefers-reduced-motion: no-preference) {
  .lane { animation: laneflow 9s linear infinite; }
  .lane-b { animation-direction: reverse; }
  .pulse { transform-box: fill-box; transform-origin: center; animation: pulse 3.2s ease-out infinite; }
}
@keyframes laneflow { to { stroke-dashoffset: -500; } }
@keyframes pulse {
  0% { transform: scale(0.55); opacity: 0.75; }
  70% { transform: scale(1.3); opacity: 0; }
  100% { transform: scale(1.3); opacity: 0; }
}

/* ---------- about ---------- */
.about-grid { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: clamp(40px, 6vw, 72px); align-items: center; }
.feat { border-left: 2px solid rgba(20, 35, 44, 0.25); padding-left: 20px; }
.feat + .feat { margin-top: 32px; }
.feat h3 { font-size: 16.5px; font-weight: 600; margin-bottom: 6px; }
.feat p { font-size: 14.5px; color: var(--muted); }
.about-visual svg { width: 100%; height: auto; border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---------- stats ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; align-items: end; }
.stat {
  background: var(--card);
  color: var(--text);
  border-radius: 14px;
  padding: 22px 22px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  min-height: 200px;
}
.stats-grid .stat:nth-child(1) { min-height: 330px; }
.stats-grid .stat:nth-child(2) { min-height: 288px; }
.stats-grid .stat:nth-child(3) { min-height: 250px; }
.stats-grid .stat:nth-child(4) { min-height: 214px; }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; border-radius: 14px 0 0 14px; }
.s-blue::before { background: #A9C6DE; }
.s-yellow::before { background: #E4D083; }
.s-sage::before { background: #B9BC93; }
.stat::after {
  content: ""; position: absolute; top: 16px; right: 16px;
  width: 13px; height: 13px;
  border-top: 2px solid #B2AB97; border-right: 2px solid #B2AB97;
  border-radius: 0 4px 0 0;
}
.stat-n { font-family: var(--font-display); font-weight: 600; font-size: clamp(2.4rem, 3.4vw, 3.1rem); line-height: 1; letter-spacing: -0.02em; }
.stat-n i { font-style: normal; font-size: 0.48em; margin-left: 2px; }
.stat-l { font-size: 13px; color: var(--muted); max-width: 24ch; }

/* ---------- services ---------- */
.svc {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: clamp(26px, 4vw, 44px);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(26px, 4vw, 52px);
  align-items: center;
}
.svc + .svc { margin-top: 26px; }
.svc h3 { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.55rem, 2.6vw, 2.05rem); letter-spacing: -0.01em; margin-bottom: 14px; }
.svc > .svc-body > p { font-size: 15px; color: var(--muted); }
.checks { list-style: none; margin: 22px 0; }
.checks li { position: relative; padding-left: 30px; font-size: 14.5px; margin: 10px 0; }
.checks li::before {
  content: "✓";
  position: absolute; left: 0; top: 2px;
  width: 18px; height: 18px;
  border: 1.5px solid var(--teal-text);
  border-radius: 50%;
  color: var(--teal-text);
  font-size: 10.5px;
  display: grid;
  place-items: center;
}
.svc-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; border-top: 1px solid var(--line); padding-top: 20px; }
.meta-l { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.meta-v { display: block; margin-top: 7px; font-size: 14px; font-weight: 600; }
.svc-art { border-radius: var(--radius); overflow: hidden; align-self: stretch; display: flex; }
.svc-art svg { width: 100%; height: 100%; min-height: 260px; }
.art-blue { background: #DDE9F1; }
.art-yellow { background: #F5EDC9; }
.art-sage { background: #E2E4CD; }

/* ---------- projects ---------- */
.proj-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.proj { background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.proj p { font-size: 14.5px; }
.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 10px;
}
.p-blue { background: var(--p-blue); }
.p-yellow { background: var(--p-yellow); }
.p-sage { background: var(--p-sage); }
.proj-note { margin-top: 22px; text-align: center; font-size: 13px; color: var(--muted); }

/* ---------- clients ---------- */
.client-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.client {
  border-radius: 14px;
  padding: 22px 20px;
  min-height: 128px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  background: var(--white);
  border: 1px solid var(--line);
}
.client-grid .client:nth-child(4n + 2) { background: var(--p-blue); border-color: transparent; }
.client-grid .client:nth-child(4n + 3) { background: var(--p-yellow); border-color: transparent; }
.client-grid .client:nth-child(4n) { background: var(--p-sage); border-color: transparent; }
.client strong { font-family: var(--font-display); font-weight: 600; font-size: 19px; line-height: 1.2; letter-spacing: -0.01em; }
.client span { font-size: 12.5px; color: var(--muted); }

/* ---------- team ---------- */
.team-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.tcard { background: var(--card); border-radius: var(--radius); overflow: hidden; color: var(--text); display: flex; flex-direction: column; }
.tcard-photo { aspect-ratio: 3 / 3.6; background: var(--ink-soft); }
.tcard-photo img { width: 100%; height: 100%; object-fit: cover; }
.tcard-info { padding: 0 18px 20px; }
.tcard-name {
  display: inline-block;
  padding: 8px 12px;
  margin-top: -21px;
  position: relative;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: -0.01em;
}
.n-blue { background: var(--p-blue); }
.n-yellow { background: var(--p-yellow); }
.n-sage { background: var(--p-sage); }
.tcard-role { display: block; margin-top: 12px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.13em; text-transform: uppercase; color: var(--muted); }
.tcard-info p { margin-top: 8px; font-size: 13px; line-height: 1.55; color: var(--muted); }

/* ---------- process ---------- */
.process-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: clamp(40px, 6vw, 80px); align-items: start; }
.process-lead { position: sticky; top: 110px; }
.process-lead p { margin: 18px 0 26px; font-size: 15px; color: var(--muted); max-width: 44ch; }
.steps { display: flex; flex-direction: column; gap: 18px; }
.step { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.step-n {
  display: grid; place-items: center;
  width: 56px; height: 56px;
  margin: -24px 0 16px -24px;
  border-radius: 15px 0 14px 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 27px;
  color: var(--ink);
}
.sn-yellow { background: var(--p-yellow); }
.sn-blue { background: var(--p-blue); }
.sn-sage { background: var(--p-sage); }
.step h3 { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.step p { font-size: 14.5px; color: var(--muted); }

/* ---------- contact / footer ---------- */
.contact-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin: 6px 0 76px; }
.contact-loc { font-size: 13.5px; color: var(--cream-muted); margin-left: auto; }
.foot-bar { border-top: 1px solid var(--line-dark); padding-top: 28px; display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.brand-foot { font-size: 15px; }
.foot-links { display: flex; gap: 4px; }
.foot-links a { color: var(--cream-muted); font-size: 13.5px; text-decoration: none; padding: 6px 10px; border-radius: 999px; }
.foot-links a:hover { color: var(--cream); background: rgba(246, 243, 231, 0.08); }
.foot-copy { margin-left: auto; font-size: 13px; color: var(--cream-muted); }

/* ---------- chat ---------- */
.chat-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 60;
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--ink); color: var(--cream);
  border: none; cursor: pointer;
  display: grid; place-items: center;
  box-shadow: 0 12px 32px rgba(15, 27, 33, 0.35);
  transition: transform 0.2s ease;
}
.chat-fab:hover { transform: scale(1.06); }
.chat-fab svg { width: 26px; height: 26px; }

.chat-panel {
  position: fixed; right: 22px; bottom: 94px; z-index: 60;
  width: min(384px, calc(100vw - 32px));
  height: min(568px, calc(100dvh - 122px));
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 26px 64px rgba(15, 27, 33, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-panel[hidden] { display: none; }
.chat-head { background: var(--ink); color: var(--cream); padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; }
.chat-head strong { display: block; font-size: 15px; }
.chat-head span { display: block; font-size: 12px; color: var(--cream-muted); margin-top: 2px; }
.chat-close { background: none; border: none; color: var(--cream); font-size: 24px; line-height: 1; cursor: pointer; padding: 2px 6px; border-radius: 8px; }
.chat-close:hover { background: rgba(246, 243, 231, 0.12); }

.chat-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 86%; padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.55; overflow-wrap: break-word; }
.msg-ai { background: var(--white); border: 1px solid var(--line); border-bottom-left-radius: 4px; align-self: flex-start; }
.msg-user { background: var(--p-yellow); border-bottom-right-radius: 4px; align-self: flex-end; }
.msg-err { background: #F6DCD4; border: 1px solid #E5BCB0; align-self: flex-start; }
.msg code { background: rgba(20, 35, 44, 0.07); padding: 1px 5px; border-radius: 5px; font-size: 0.9em; }
.msg ul { margin: 6px 0 6px 18px; }
.msg ul li { margin: 2px 0; }
.msg p + p { margin-top: 8px; }

.typing { display: inline-flex; gap: 5px; align-items: center; padding: 14px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.18s; }
.typing i:nth-child(3) { animation-delay: 0.36s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

.chat-suggest { display: flex; flex-wrap: wrap; gap: 8px; }
.chat-suggest button {
  background: var(--white); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 13px; font: 500 12.5px var(--font-body); color: var(--text);
  cursor: pointer; transition: border-color 0.2s ease, color 0.2s ease;
}
.chat-suggest button:hover { border-color: var(--teal-text); color: var(--teal-text); }

.chat-foot { display: flex; gap: 8px; padding: 12px 12px 8px; border-top: 1px solid var(--line); }
.chat-foot textarea {
  flex: 1; resize: none; max-height: 110px;
  border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; font: 400 14px var(--font-body);
  background: var(--white); color: var(--text);
}
.chat-foot textarea::placeholder { color: var(--muted); opacity: 1; }
.chat-foot textarea:focus { outline: 2px solid var(--teal); outline-offset: 0; }
.chat-send {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  background: var(--ink); color: var(--cream); border: none;
  display: grid; place-items: center; cursor: pointer; align-self: flex-end;
}
.chat-send:disabled { opacity: 0.45; cursor: default; }
.chat-send svg { width: 17px; height: 17px; }
.chat-note { font-size: 11px; color: var(--muted); padding: 0 14px 12px; }
.chat-note a { color: var(--teal-text); }

/* ---------- reveal on scroll ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.7s ease, transform 0.7s ease; }
  .js .reveal.in { opacity: 1; transform: none; }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stats-grid .stat { min-height: 200px !important; }
  .team-grid { grid-template-columns: 1fr 1fr; }
  .client-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .sec-head { grid-template-columns: 1fr; gap: 16px; align-items: start; }
  .sec-intro { text-align: left; justify-self: start; }
  .about-grid, .svc, .process-grid { grid-template-columns: 1fr; }
  .process-lead { position: static; margin-bottom: 8px; }
  .svc-art svg { min-height: 0; }
  .svc-art { aspect-ratio: 4 / 3; }
  .client-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  .nav-links {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    left: 0; right: 0;
    background: var(--ink);
    border-radius: 20px;
    padding: 12px;
    flex-direction: column;
    box-shadow: 0 18px 44px rgba(15, 27, 33, 0.35);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 14px; }
  .nav-cta { display: none; }
  .nav-burger {
    display: grid; gap: 5px; place-content: center;
    width: 40px; height: 40px; margin-left: auto;
    background: rgba(246, 243, 231, 0.1);
    border: none; border-radius: 50%; cursor: pointer;
  }
  .nav-burger span { display: block; width: 16px; height: 2px; background: var(--cream); border-radius: 2px; }
  .hero-meta { grid-template-columns: 1fr; gap: 14px; }
  .hero-meta .btn { justify-self: start; }
  .proj-grid { grid-template-columns: 1fr; }
  .contact-loc { margin-left: 0; width: 100%; }
  .foot-copy { margin-left: 0; }
}

@media (max-width: 560px) {
  .team-grid { grid-template-columns: 1fr; }
  .client-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
  .stats-grid .stat { min-height: 0 !important; gap: 18px; }
  .svc-meta { grid-template-columns: 1fr; gap: 16px; }
  .chat-panel { right: 12px; left: 12px; width: auto; bottom: 88px; height: calc(100dvh - 112px); }
}
