/* =========================================================
   Components
   ========================================================= */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.55rem;
  padding: 0.8rem 1.35rem; border-radius: 999px;
  font: inherit; font-weight: 700; font-size: var(--step--1); line-height: 1.2;
  text-decoration: none; cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}
.btn svg { width: 1.1em; height: 1.1em; flex: none; }
.btn--primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 6px 20px -10px var(--accent); }
.btn--primary:hover { transform: translateY(-1px); box-shadow: 0 12px 28px -12px var(--accent); text-decoration: none; }
.btn--ghost { background: transparent; color: var(--text-strong); border-color: var(--border-strong); }
.btn--ghost:hover { border-color: var(--link); }
.btn--ghost svg { transition: transform 0.2s ease; }
.btn--ghost:hover svg { transform: translateX(3px); }
.btn--on-band { background: transparent; color: var(--band-text); border-color: var(--band-border); }
.btn--on-band:hover { border-color: var(--band-text); }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.text-link {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-weight: 700; font-size: var(--step--1); text-decoration: none;
}
.text-link svg { width: 1em; height: 1em; transition: transform 0.2s ease; }
.text-link:hover svg { transform: translateX(3px); }
.text-link:hover { text-decoration: underline; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  border-bottom: 1px solid transparent;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}
.site-header.is-scrolled,
.site-header.is-open {
  background: var(--header-bg);
  border-bottom-color: var(--border);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
}
.header-inner { display: flex; align-items: center; gap: 1.25rem; min-height: var(--header-h); }

.brand { display: flex; align-items: center; flex: none; border-radius: var(--radius-sm); }
.brand picture { display: contents; }
.brand .logo-full { height: 40px; width: auto; }
.brand .logo-icon { height: 34px; width: auto; display: none; }

.nav { margin-left: auto; }
.nav-list { display: flex; gap: 0.15rem; list-style: none; margin: 0; padding: 0; }
.nav-list a {
  display: block; padding: 0.5rem 0.75rem; border-radius: var(--radius-sm);
  color: var(--text); text-decoration: none; font-size: var(--step--1); font-weight: 600;
}
.nav-list a:hover { background: var(--bg-soft); color: var(--text-strong); }
.nav-list a[aria-current="page"] { color: var(--text-strong); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }

.header-actions { display: flex; align-items: center; gap: 0.5rem; }
.icon-btn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; padding: 0;
  border-radius: 999px; border: 1px solid var(--border-strong);
  background: transparent; color: var(--text-strong); cursor: pointer;
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn:hover { border-color: var(--link); }
.menu-btn { display: none; }
.menu-btn .icon-close { display: none; }
.site-header.is-open .menu-btn .icon-open { display: none; }
.site-header.is-open .menu-btn .icon-close { display: block; }
/* The theme toggle needs JS; hide it when JS is off */
html:not(.js) .theme-toggle { display: none; }

@media (max-width: 1040px) {
  .header-actions { margin-left: auto; }
  .js .menu-btn { display: inline-grid; }
  /* Without JS the nav stays visible and wraps under the logo */
  html:not(.js) .header-inner { flex-wrap: wrap; padding-block: 0.75rem; }
  html:not(.js) .nav { order: 3; width: 100%; margin: 0; }
  html:not(.js) .nav-list { flex-wrap: wrap; }
  .js .nav {
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--border);
    box-shadow: 0 24px 40px -24px rgb(0 0 0 / 0.35);
    display: none;
  }
  .js .site-header.is-open .nav { display: block; }
  .js .nav-list { flex-direction: column; padding: 0.75rem var(--gutter) 1.25rem; gap: 0.1rem; }
  .js .nav-list a { padding: 0.85rem 0.75rem; font-size: var(--step-0); }
  .js .nav-list a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--accent); }
}
@media (max-width: 560px) {
  .brand .logo-full { display: none !important; }
  .brand .logo-icon { display: block; }
  .header-cta span { display: none; }
  .header-cta { padding: 0; width: 42px; height: 42px; }
}

/* ---------- Cartographic backgrounds ---------- */
.carto { position: relative; isolation: isolate; overflow: hidden; background: var(--hero-wash); }
.carto::before {
  /* graticule */
  content: ""; position: absolute; inset: 0; z-index: -2; pointer-events: none;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 96px 96px;
  -webkit-mask-image: radial-gradient(80% 80% at 60% 40%, #000 30%, transparent 85%);
  mask-image: radial-gradient(80% 80% at 60% 40%, #000 30%, transparent 85%);
}
.contours {
  position: absolute; inset: -6%; z-index: -1; pointer-events: none;
  background: var(--contour);
  -webkit-mask: url("/img/contours.svg") center / cover no-repeat;
  mask: url("/img/contours.svg") center / cover no-repeat;
}
@media (prefers-reduced-motion: no-preference) {
  .contours { animation: drift 90s ease-in-out infinite alternate; }
}
@keyframes drift {
  from { transform: translate3d(-1.5%, 0, 0) scale(1.02); }
  to { transform: translate3d(1.5%, -2%, 0) scale(1.05); }
}
/* Pull the sticky header over the top of a carto section */
.carto--under-header { margin-top: calc(-1 * var(--header-h)); padding-top: var(--header-h); }

/* ---------- Home hero ---------- */
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: clamp(2rem, 5vw, 4.5rem); align-items: center;
  padding-block: clamp(3rem, 8vw, 7rem) clamp(3rem, 7vw, 6rem);
}
.hero h1 .accent-word {
  background: linear-gradient(90deg, var(--link) 0%, var(--accent) 150%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .lede { margin-bottom: 2rem; }
.focus-list { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 2.25rem 0 0; padding: 0; list-style: none; }
.focus-list li, .chip {
  font-family: var(--font-mono); font-size: var(--step--2); letter-spacing: 0.04em; color: var(--text-muted);
  padding: 0.3rem 0.7rem; border: 1px solid var(--border); border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 60%, transparent);
}
.map-frame {
  position: relative; aspect-ratio: 1 / 1; display: grid; place-items: center; padding: 12%;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: radial-gradient(closest-side, var(--logo-glow), transparent), color-mix(in srgb, var(--bg) 55%, transparent);
  box-shadow: 0 30px 80px -40px var(--glow);
}
.map-frame picture { width: 100%; }
.map-frame img { width: 100%; }
.map-frame .tick { position: absolute; font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.1em; color: var(--text-muted); }
.map-frame .tick--n { top: 0.9rem; left: 50%; transform: translateX(-50%); color: var(--text-strong); font-weight: 600; }
.map-frame .tick--tl { top: 0.9rem; left: 1rem; }
.map-frame .tick--br { bottom: 0.9rem; right: 1rem; }
.map-frame::before, .map-frame::after { content: ""; position: absolute; width: 18px; height: 18px; border: 0 solid var(--accent); }
.map-frame::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; border-top-left-radius: var(--radius-lg); }
.map-frame::after { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; border-bottom-right-radius: var(--radius-lg); }
.proof-strip { border-top: 1px solid var(--border); }
.proof-strip p { margin: 0; padding-block: 1.1rem; font-size: var(--step--1); color: var(--text-muted); }
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-visual { width: 100%; max-width: 360px; justify-self: center; }
}

/* ---------- Inner page hero ---------- */
.page-hero { padding-block: clamp(3rem, 7vw, 5.5rem) clamp(2.5rem, 5vw, 4rem); }
.page-hero h1 { font-size: clamp(2rem, 1.5rem + 2.6vw, 3.4rem); max-width: 22ch; }
.page-hero .lede { margin-bottom: 0; }
.breadcrumb { margin: 0 0 1rem; font-family: var(--font-mono); font-size: var(--step--2); letter-spacing: 0.08em; }
.breadcrumb ol { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; margin: 0; padding: 0; color: var(--text-muted); }
.breadcrumb li + li::before { content: "/"; margin-right: 0.4rem; opacity: 0.6; }
.breadcrumb a { color: var(--text-muted); }

/* ---------- Section heading ---------- */
.section-head { max-width: 44rem; margin-bottom: clamp(2rem, 4vw, 3rem); }
.section-head p { color: var(--text-muted); margin: 0; font-size: var(--step-1); line-height: 1.55; }
.section-head--split { max-width: none; display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem 2rem; }
.section-head--split > div { max-width: 44rem; }

/* ---------- Cards ---------- */
.cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.cards--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); }
.cards--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 215px), 1fr)); }
.card {
  container-type: inline-size;
  position: relative; display: flex; flex-direction: column;
  padding: clamp(1.4rem, 3vw, 1.9rem);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.card > :last-child { margin-bottom: 0; }
.card h3 { margin-bottom: 0.45rem; }
.card p { color: var(--text-muted); font-size: var(--step--1); }
.card--link:hover, .card--link:focus-within {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: 0 18px 40px -22px var(--glow), 0 0 0 4px var(--glow);
}
/* Whole card clickable via the heading link */
.card--link h3 a { color: inherit; text-decoration: none; }
.card--link h3 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.card--link h3 a:focus-visible { outline: none; }
.card--link:has(h3 a:focus-visible) { outline: 3px solid var(--focus); outline-offset: 3px; }
.card .card-more { margin-top: auto; padding-top: 1rem; color: var(--link); font-weight: 700; font-size: var(--step--1); display: inline-flex; align-items: center; gap: 0.35rem; }
.card .card-more svg { width: 1em; height: 1em; transition: transform 0.2s ease; }
.card--link:hover .card-more svg { transform: translateX(3px); }
.card-num { position: absolute; top: 1.4rem; right: 1.4rem; font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-muted); }
.card-icon {
  display: inline-grid; place-items: center; width: 46px; height: 46px; flex: none;
  border-radius: 12px; margin-bottom: 1.1rem;
  background: var(--bg-soft); color: var(--link);
  border: 1px solid var(--border);
}
.section--soft .card-icon { background: var(--bg); }
.card-icon svg { width: 22px; height: 22px; }

/* Bento: 4 services on the home page */
.bento { display: grid; gap: 1rem; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.bento > :nth-child(1) { grid-column: span 4; }
.bento > :nth-child(2) { grid-column: span 2; }
.bento > :nth-child(3) { grid-column: span 2; }
.bento > :nth-child(4) { grid-column: span 4; }
.bento .card--feature { background: radial-gradient(70% 90% at 100% 0%, var(--glow), transparent 70%), var(--surface); }
@media (max-width: 900px) {
  .bento { grid-template-columns: 1fr 1fr; }
  .bento > * { grid-column: span 1 !important; }
}
@media (max-width: 600px) {
  .bento { grid-template-columns: 1fr; }
}
@container (min-width: 520px) {
  .card .card-body-wide { display: grid; grid-template-columns: 1fr 1fr; gap: 0 2rem; }
}

/* Tick lists */
.ticks { list-style: none; padding: 0; margin: 0 0 1em; }
.ticks li { position: relative; padding-left: 1.6rem; margin-bottom: 0.55rem; }
.ticks li::before {
  content: ""; position: absolute; left: 0.1rem; top: 0.62em;
  width: 0.55rem; height: 0.55rem; border-radius: 2px; transform: rotate(45deg);
  border: 2px solid var(--accent);
}
.card .ticks li { font-size: var(--step--1); color: var(--text-muted); }

/* ---------- Stats / facts ---------- */
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin: 0; }
.fact { background: var(--surface); padding: 1.5rem 1.4rem; margin: 0; }
.fact dt { font-size: var(--step-2); font-weight: 800; color: var(--text-strong); letter-spacing: -0.02em; line-height: 1.15; margin-bottom: 0.35rem; }
.fact dd { margin: 0; color: var(--text-muted); font-size: var(--step--1); }

/* ---------- Pillars (Geospatial / Cloud / AI) ---------- */
.pillars { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); counter-reset: pillar; }
.pillar { padding-top: 1.25rem; border-top: 2px solid var(--accent); }
.pillar h3 { display: flex; align-items: center; gap: 0.6rem; }
.pillar h3 svg { width: 22px; height: 22px; color: var(--link); }
.pillar p { color: var(--text-muted); }

/* ---------- Service detail ---------- */
.service-block { display: grid; gap: clamp(1.5rem, 4vw, 3.5rem); grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 860px) { .service-block { grid-template-columns: 1fr; } }
.service-block h2 { font-size: var(--step-2); }
.panel { padding: clamp(1.4rem, 3vw, 2rem); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.panel h3 { font-size: var(--step-0); text-transform: uppercase; letter-spacing: 0.12em; font-family: var(--font-mono); font-weight: 600; color: var(--text-muted); margin-bottom: 1rem; }
.panel + .panel { margin-top: 1rem; }

/* ---------- Tech stack ---------- */
.stack-groups { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.stack-group h3 { font-size: var(--step-0); margin-bottom: 0.9rem; display: flex; align-items: center; gap: 0.55rem; }
.stack-group h3 svg { width: 20px; height: 20px; color: var(--link); }
.chip-list { display: flex; flex-wrap: wrap; gap: 0.45rem; list-style: none; margin: 0; padding: 0; }
.chip-list li { font-size: var(--step--1); color: var(--text); padding: 0.32rem 0.75rem; border: 1px solid var(--border); border-radius: 999px; background: var(--bg); }
.section--soft .chip-list li { background: var(--surface); }

/* ---------- Engagements ---------- */
.engagement .tag { font-family: var(--font-mono); font-size: var(--step--2); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.8rem; }
.engagement .chip-list { margin-top: auto; padding-top: 1rem; }
.engagement .chip-list li { font-size: var(--step--2); font-family: var(--font-mono); padding: 0.2rem 0.6rem; }
.work-group + .work-group { margin-top: clamp(3rem, 6vw, 4.5rem); }
.work-group > h2 { font-size: var(--step-2); }

/* ---------- Steps (approach) ---------- */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); counter-reset: step; }
.step { counter-increment: step; position: relative; padding: 1.6rem 1.4rem 1.4rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.step::before {
  content: counter(step, decimal-leading-zero);
  display: block; margin-bottom: 0.9rem;
  font-family: var(--font-mono); font-size: var(--step--1); font-weight: 600; color: var(--link);
}
.step::after { content: ""; position: absolute; top: 1.95rem; left: 3.4rem; right: 1.4rem; height: 1px; background: linear-gradient(90deg, var(--accent), transparent); opacity: 0.6; }
.step h3 { font-size: var(--step-0); margin-bottom: 0.4rem; }
.step p { margin: 0; color: var(--text-muted); font-size: var(--step--1); }

/* ---------- About ---------- */
.bio { display: grid; gap: clamp(1.5rem, 4vw, 3.5rem); grid-template-columns: minmax(0, 280px) minmax(0, 1fr); align-items: start; }
@media (max-width: 760px) { .bio { grid-template-columns: 1fr; } }
.bio-card { position: sticky; top: calc(var(--header-h) + 1.5rem); }
@media (max-width: 760px) { .bio-card { position: static; } }
.headshot { width: 160px; height: 160px; border-radius: 50%; object-fit: cover; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border), 0 18px 40px -20px var(--glow); margin-bottom: 1.25rem; }
.bio-card h2 { font-size: var(--step-2); margin-bottom: 0.2rem; }
.bio-card .role { color: var(--text-muted); margin-bottom: 1.1rem; }
.social { display: flex; gap: 0.5rem; list-style: none; padding: 0; margin: 0; }
.social a { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--text-strong); }
.social a:hover { border-color: var(--link); color: var(--link); }
.social svg { width: 18px; height: 18px; }
.recognition { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.75rem; }
.recognition li { display: grid; grid-template-columns: 5.5rem 1fr; gap: 1rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); }
.recognition .yr { font-family: var(--font-mono); font-size: var(--step--1); color: var(--text-muted); padding-top: 0.1em; }

/* ---------- Prose (privacy etc.) ---------- */
.prose { max-width: 70ch; }
.prose h2 { font-size: var(--step-2); margin-top: 2.5rem; }
.prose h3 { margin-top: 1.75rem; }
.prose ul { padding-left: 1.25rem; }
.prose li { margin-bottom: 0.4rem; }
.prose .meta { font-family: var(--font-mono); font-size: var(--step--1); color: var(--text-muted); }

/* ---------- CTA band ---------- */
.cta-band { position: relative; isolation: isolate; overflow: hidden; background: var(--band-bg); color: var(--band-text); border-radius: var(--radius-lg); padding: clamp(2rem, 5vw, 4rem); }
.cta-band .contours { background: rgb(255 255 255 / 0.10); }
.cta-band h2 { color: var(--band-text); max-width: 24ch; }
.cta-band p { color: var(--band-muted); max-width: 46rem; font-size: var(--step-1); line-height: 1.55; }
.cta-band .btn--primary { background: var(--c-dark-accent); color: var(--c-navy); }
.cta-band :focus-visible { outline-color: var(--c-dark-accent); }

/* ---------- Contact ---------- */
.contact-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
@media (max-width: 760px) { .contact-grid { grid-template-columns: 1fr; } }
.contact-grid .panel + .panel { margin-top: 0; }
.email-card .email { font-size: var(--step-1); font-weight: 800; word-break: break-word; }

/* ---------- 404 ---------- */
.not-found { text-align: center; padding-block: clamp(4rem, 12vw, 9rem); }
.not-found .code { font-family: var(--font-mono); font-size: var(--step--1); letter-spacing: 0.2em; color: var(--text-muted); margin-bottom: 1rem; }
.not-found h1 { max-width: 18ch; margin-inline: auto; }
.not-found .lede { margin-inline: auto; margin-bottom: 2rem; }
.not-found .btn-row { justify-content: center; }

/* ---------- Footer ---------- */
.site-footer { background: var(--footer-bg); color: var(--band-muted); margin-top: var(--section-y); font-size: var(--step--1); }
.site-footer a { color: var(--band-text); text-decoration: none; }
.site-footer a:hover { color: var(--band-link); text-decoration: underline; }
.site-footer :focus-visible { outline-color: var(--band-link); }
.footer-main { display: grid; gap: 2.5rem; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); padding-block: clamp(3rem, 6vw, 4.5rem); }
@media (max-width: 900px) { .footer-main { grid-template-columns: 1fr 1fr; } .footer-brand { grid-column: 1 / -1; } }
@media (max-width: 480px) { .footer-main { grid-template-columns: 1fr; } }
.footer-brand img { height: 36px; width: auto; margin-bottom: 1.1rem; }
.footer-brand p { max-width: 34ch; }
.footer-col h2 { font-family: var(--font-mono); font-size: var(--step--2); letter-spacing: 0.16em; text-transform: uppercase; color: var(--band-muted); font-weight: 600; margin-bottom: 1rem; }
.footer-col ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.55rem; }
.footer-bottom { border-top: 1px solid var(--band-border); }
.footer-bottom .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem 2rem; padding-block: 1.25rem; }
.footer-bottom p { margin: 0; }
.footer-bottom ul { display: flex; gap: 1.25rem; list-style: none; padding: 0; margin: 0; }
.footer-email { word-break: break-word; }

/* Page-end CTA sits right above the footer; avoid a double gap */
.section--last { padding-bottom: 0; }
.section-foot { margin: 2rem 0 0; }
.page-hero.carto--under-header { padding-top: calc(var(--header-h) + clamp(3rem, 7vw, 5.5rem)); }
.prose code, code { font-family: var(--font-mono); font-size: 0.9em; padding: 0.1em 0.35em; border-radius: 4px; background: var(--bg-soft); }
@media (max-width: 900px) { .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .facts { grid-template-columns: minmax(0, 1fr); } }
