/* ───────────────────────────────────────
   Custom Properties
   ─────────────────────────────────────── */

:root {
  --color-bg: #f5f6f8;
  --color-text: #1a1a2e;
  --color-dim: #7a7d8e;
  --color-surface: #e8eaef;
  --color-accent: #1a1a2e;

  /* Brand type: IBM Plex Sans is the primary face; IBM Plex Mono for
     supporting/UI labels. */
  --font-heading: 'IBM Plex Sans', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 2rem;
  --space-lg: 3.5rem;
  --space-xl: 5rem;

  --max-width: 960px;
}

/* ───────────────────────────────────────
   Reset
   ─────────────────────────────────────── */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scrollbar-gutter: stable;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ───────────────────────────────────────
   Typography
   ─────────────────────────────────────── */

h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.1;
}

h1 {
  font-size: 4.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.5rem;
  margin-bottom: var(--space-md);
}

h3 {
  font-size: 1.1rem;
  font-weight: 500;
}

p {
  margin-bottom: var(--space-sm);
}

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

a:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

small, .dim {
  color: var(--color-dim);
}

/* ───────────────────────────────────────
   Layout
   ─────────────────────────────────────── */

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-md);
}

section {
  padding: var(--space-md) 0;
}

/* ───────────────────────────────────────
   Section Header (sticky on desktop)
   ─────────────────────────────────────── */

.section-header {
  margin-bottom: var(--space-md);
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-dim);
}

@media (min-width: 768px) {
  .section-header {
    position: sticky;
    top: var(--space-md);
    align-self: start;
  }
}

/* ───────────────────────────────────────
   Top Nav
   ─────────────────────────────────────── */

.site-nav {
  padding: var(--space-md) 0 0;
  font-size: 0.9rem;
}

.site-nav .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
}

/* Home nav has no brand mark (the hero carries the lockup) — keep the link right. */
.home .site-nav .container {
  justify-content: flex-end;
}

.site-nav .brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  height: 24px;
}

.site-nav .brand-mark {
  flex: none;
  height: 22px;
  width: auto;
  display: block;
}

/* Home shows the "ag" monogram (the hero already spells the name out);
   inner pages show the full "applied graphs" wordmark. */
.site-nav .brand-name {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 1rem;
  letter-spacing: 0.01em;
  color: var(--color-text);
  white-space: nowrap;
}

.site-nav .brand:hover {
  text-decoration: none;
}

/* Inner pages: full wordmark where it fits, "ag" monogram on narrow screens
   (the full wordmark + nav links don't fit side by side on phones). */
.site-nav .brand-long {
  display: none;
}

@media (min-width: 768px) {
  .site-nav .brand-short {
    display: none;
  }
  .site-nav .brand-long {
    display: inline;
  }
}

.site-nav .nav-links {
  display: flex;
  gap: var(--space-md);
  list-style: none;
}

.site-nav .nav-links a {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  color: var(--color-text);
}

.site-nav .nav-links a:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
}

.site-nav .nav-links a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
  text-decoration-color: var(--color-dim);
}

/* ───────────────────────────────────────
   Hero
   ─────────────────────────────────────── */

.hero {
  min-height: auto;
  padding: var(--space-md) 0;
  position: relative;
  overflow: visible;
}

.hero h1 {
  font-weight: 500;
  margin-bottom: var(--space-md);
}

/* Horizontal lockup: mark to the left of the wordmark (per logo-primary). */
.hero-lockup {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin-bottom: var(--space-md);
}

.hero-lockup h1 {
  margin-bottom: 0;
}

.hero-mark {
  flex: none;
  height: 3.5rem;
  width: auto;
}

.hero .subtitle {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 1.1rem;
  color: var(--color-dim);
  margin-bottom: var(--space-md);
  max-width: 480px;
}

.hero .intro {
  font-size: 1.05rem;
  max-width: 520px;
  line-height: 1.8;
}

.hero .intro p:last-child {
  margin-bottom: 0;
}

/* Inner-page hero: smaller H1, less vertical space than home */
.page-hero {
  padding: var(--space-md) 0 var(--space-sm);
}

.page-hero h1 {
  font-size: 3rem;
  margin-bottom: var(--space-sm);
}

.page-hero .subtitle {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 1.05rem;
  color: var(--color-dim);
  max-width: 520px;
  margin-bottom: 0;
}

/* CTA strip used at the bottom of inner pages */
.page-cta {
  padding: var(--space-sm) 0 var(--space-lg);
}

.page-cta p {
  max-width: 560px;
  font-size: 1.05rem;
  margin-bottom: 0;
}

/* Prose block for About / Notes long-form copy */
.prose {
  max-width: 640px;
  font-size: 1.05rem;
  line-height: 1.8;
}

.prose h2 {
  font-size: 1.25rem;
  margin-top: var(--space-md);
  margin-bottom: var(--space-sm);
}

.prose h2:first-child {
  margin-top: 0;
}

.prose p {
  margin-bottom: var(--space-sm);
}

.prose > :last-child {
  margin-bottom: 0;
}

.prose .placeholder {
  color: var(--color-dim);
  font-style: italic;
}

/* ───────────────────────────────────────
   Services
   ─────────────────────────────────────── */

.services .section-label {
  display: block;
  margin-bottom: var(--space-sm);
}

.service-block {
  max-width: 520px;
  margin-bottom: var(--space-lg);
}

.service-block:last-child {
  margin-bottom: 0;
}

.service-block h3 {
  margin-bottom: 0.5rem;
}

.service-block > p {
  font-size: 1.05rem;
  line-height: 1.8;
  margin-bottom: var(--space-sm);
}

.service-block ul {
  list-style: none;
  margin-bottom: var(--space-sm);
}

.service-block li {
  font-size: 0.9rem;
  color: var(--color-dim);
  padding: 0.3rem 0;
  padding-left: 1rem;
  position: relative;
}

.service-block li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.75rem;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--color-dim);
  opacity: 0.5;
}

.service-scope {
  font-size: 0.8rem;
  color: var(--color-dim);
  font-weight: 500;
}

/* ───────────────────────────────────────
   Buyable Offer (productized service block)
   ─────────────────────────────────────── */

.service-block.buyable {
  max-width: 640px;
}

.offer-head {
  margin-bottom: var(--space-sm);
}

.offer-name {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 0.4rem;
}

.offer-tagline {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--color-dim);
  margin-bottom: 0;
}

.offer-meta {
  display: grid;
  grid-template-columns: 110px 1fr;
  margin: var(--space-md) 0;
}

.offer-meta dt {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-dim);
  padding: 0.8rem 0;
  border-top: 1px solid var(--color-surface);
}

.offer-meta dd {
  padding: 0.8rem 0;
  border-top: 1px solid var(--color-surface);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0;
}

.offer-meta dt:last-of-type,
.offer-meta dd:last-of-type {
  border-bottom: 1px solid var(--color-surface);
}

.offer-meta dd ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.offer-meta dd li {
  padding: 0.2rem 0 0.2rem 1rem;
  position: relative;
  font-size: 0.95rem;
  color: var(--color-text);
}

.offer-meta dd li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.7rem;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--color-dim);
  opacity: 0.5;
}

.meta-placeholder {
  color: var(--color-dim);
  font-style: italic;
}

.offer-cta {
  margin-top: var(--space-md);
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 1rem;
}

/* Compact teaser used on the home page */
.services-teaser {
  list-style: none;
  margin: var(--space-sm) 0 var(--space-md);
  max-width: 560px;
}

.services-teaser li {
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--color-surface);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.services-teaser li:last-child {
  border-bottom: none;
}

.services-teaser .teaser-name {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 1.05rem;
}

.services-teaser .teaser-desc {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--color-dim);
}

.services-more {
  font-size: 0.9rem;
}

/* ───────────────────────────────────────
   Section with sticky label + content
   ─────────────────────────────────────── */

@media (min-width: 768px) {
  .section-split {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: var(--space-lg);
  }
}

/* ───────────────────────────────────────
   Entry List (Writing / Notes)
   ─────────────────────────────────────── */

.entry-list {
  list-style: none;
}

.entry-list li {
  padding: var(--space-sm) 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-sm);
}

.entry-list li:first-child {
  padding-top: 0;
}

.entry-list a {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 1.05rem;
}

.entry-list .date {
  font-size: 0.8rem;
  color: var(--color-dim);
  white-space: nowrap;
}

/* ───────────────────────────────────────
   Clients
   ─────────────────────────────────────── */

.network .section-label {
  display: block;
  margin-bottom: var(--space-md);
}

.xp-group {
  margin-bottom: 3rem;
}

.xp-group:last-child {
  margin-bottom: 0;
}

.xp-heading {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  padding-bottom: var(--space-xs);
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-surface);
}

.xp-cat {
  margin-bottom: 1.5rem;
}

.xp-cat:last-child {
  margin-bottom: 0;
}

.xp-cat-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-dim);
  margin-bottom: 0.4rem;
}

.xp-list {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--color-text);
  margin-bottom: 0;
}

.xp-sep {
  color: var(--color-dim);
  margin: 0 0.4em;
}

/* ───────────────────────────────────────
   Footer
   ─────────────────────────────────────── */

.site-footer {
  padding-top: var(--space-lg);
  padding-bottom: var(--space-md);
  font-size: 0.8rem;
  color: var(--color-dim);
}

.footer-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

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

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

/* ───────────────────────────────────────
   Dots
   ─────────────────────────────────────── */

.dots {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.dots span {
  position: absolute;
  border-radius: 50%;
  background: var(--color-dim);
  pointer-events: auto;
  cursor: default;
}

.show-ids .dots span::after {
  content: attr(data-id);
  position: absolute;
  left: calc(100% + 4px);
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-body);
  font-size: 9px;
  color: var(--color-text);
  white-space: nowrap;
}

.dot-edges {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

/* ───────────────────────────────────────
   Content Nodes (inline in copy)
   ─────────────────────────────────────── */

.kg-node {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-dim);
  opacity: 0.4;
  vertical-align: middle;
  margin-left: 0.4em;
  transition: opacity 240ms ease-out;
}

.cta-link:hover .kg-node {
  opacity: 0.85;
}

/* Section-break node: a single dot in the seam between two sections that
   also seeds the background graph as it scrolls through the viewport. */
/* Full-width so the dot can sit in the right gutter, in line with the
   background graph nodes, rather than in the content column. */
.node-break {
  display: flex;
  justify-content: flex-end;
  padding: var(--space-md) 6% var(--space-md) 0;
}

.node-break .kg-node {
  width: 10px;
  height: 10px;
  margin-left: 0;
  opacity: 0.5;
}

body > *:not(.dots) {
  position: relative;
  z-index: 1;
}

/* ───────────────────────────────────────
   Responsive
   ─────────────────────────────────────── */

@media (max-width: 767px) {
  h1 {
    font-size: 2.75rem;
  }

  section {
    padding: var(--space-lg) 0;
  }

  .hero {
    padding: var(--space-lg) 0;
  }

  .hero-mark {
    height: 2.4rem;
  }

  .hero-lockup {
    gap: 0.75rem;
  }

  .site-footer {
    flex-direction: column;
    gap: var(--space-xs);
  }

  /* Tighter nav gaps so the brand + links fit the narrowest phones. */
  .site-nav .container {
    gap: var(--space-sm);
  }

  .site-nav .nav-links {
    gap: var(--space-sm);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
