:root {
  /* Brand palette */
  --cream: #F0EADC;
  --cream-soft: #F5F0E4;
  --cream-deep: #E8E0CE;
  --cream-border: #DCD4BF;
  --ink: #0E0F13;
  --ink-2: #1A1B22;
  --ink-3: #25272F;
  --ink-muted: #5C5A53;
  --ink-soft: #8B887F;
  --cream-on-dark: #EAE3D2;
  --cream-on-dark-muted: #9A968C;

  --shadow-sm: 0 1px 2px 0 rgb(14 15 19 / 0.05);
  --shadow-md: 0 4px 14px -2px rgb(14 15 19 / 0.09);
  --shadow-lg: 0 24px 48px -16px rgb(14 15 19 / 0.18);
  --radius: 10px;
  --radius-lg: 16px;
  --container: 1180px;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--ink-muted); }

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

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

h1, h2, h3, h4 {
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--ink);
}

/* ------- Header ------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(240, 234, 220, 0.85);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--cream-border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.logo:hover { color: var(--ink); }

.logo-mark-img {
  width: 32px;
  height: 32px;
  display: block;
  border-radius: 50%;
}

.logo-word { display: inline-flex; align-items: baseline; }
.logo-dot { color: var(--ink-soft); font-weight: 700; }

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

.main-nav a {
  color: var(--ink-muted);
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.15s;
}

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

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--cream-border);
  border-radius: 10px;
  background: var(--cream-soft);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.nav-toggle span { width: 18px; height: 2px; background: var(--ink); display: block; position: relative; }
.nav-toggle span::before,
.nav-toggle span::after {
  content: ''; position: absolute; left: 0; width: 18px; height: 2px; background: var(--ink);
}
.nav-toggle span::before { top: -6px; }
.nav-toggle span::after { top: 6px; }

/* ------- Buttons ------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
  font-family: inherit;
}

.btn-primary { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.btn-primary:hover { background: var(--ink-2); color: var(--cream); }

/* Legacy class — kept for HTML backward compat, restyled */
.btn-gradient { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.btn-gradient:hover { background: var(--ink-2); color: var(--cream); transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn-ghost { background: transparent; color: var(--ink); border-color: var(--cream-border); }
.btn-ghost:hover { background: var(--cream-soft); color: var(--ink); border-color: var(--ink-soft); }

.btn-ghost-dark {
  background: transparent;
  color: var(--cream);
  border-color: rgba(234, 227, 210, 0.28);
}
.btn-ghost-dark:hover {
  background: rgba(234, 227, 210, 0.08);
  color: var(--cream);
  border-color: rgba(234, 227, 210, 0.5);
}

.btn-lg { padding: 15px 30px; font-size: 1rem; }

/* On dark sections, invert the primary button to cream-on-ink */
.hero .btn-primary,
.hero .btn-gradient,
.cta-section .btn-primary,
.cta-section .btn-gradient,
.detail-hero .btn-primary,
.detail-hero .btn-gradient {
  background: var(--cream);
  color: var(--ink);
  border-color: var(--cream);
}
.hero .btn-primary:hover,
.hero .btn-gradient:hover,
.cta-section .btn-primary:hover,
.cta-section .btn-gradient:hover,
.detail-hero .btn-primary:hover,
.detail-hero .btn-gradient:hover {
  background: var(--cream-soft);
  color: var(--ink);
}

/* ------- Hero ------- */
.hero {
  position: relative;
  background: var(--ink);
  color: var(--cream-on-dark);
  padding: 132px 0 144px;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 60% at 50% 25%, rgba(240, 234, 220, 0.045), transparent 65%);
  pointer-events: none;
}

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(240, 234, 220, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(240, 234, 220, 0.025) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black 30%, transparent 75%);
  pointer-events: none;
  opacity: 0.65;
}

.hero-content {
  position: relative;
  text-align: center;
  max-width: 880px;
  margin: 0 auto;
  z-index: 1;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(240, 234, 220, 0.06);
  border: 1px solid rgba(240, 234, 220, 0.18);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cream-on-dark);
  margin-bottom: 28px;
}

.eyebrow-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cream);
  box-shadow: 0 0 8px rgba(240, 234, 220, 0.6);
}

.hero h1 {
  font-size: clamp(2.75rem, 6.5vw, 4.75rem);
  margin-bottom: 26px;
  color: var(--cream);
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.gradient-text {
  font-family: 'Instrument Serif', Georgia, serif;
  font-style: italic;
  font-weight: 400;
  color: var(--cream);
  letter-spacing: -0.015em;
  -webkit-text-fill-color: var(--cream);
  background: none;
}

.hero .lede {
  font-size: 1.22rem;
  color: var(--cream-on-dark-muted);
  max-width: 680px;
  margin: 0 auto 38px;
  line-height: 1.55;
}

.hero-ctas { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ------- Sections ------- */
.section { padding: 120px 0; }
.section-alt { background: var(--cream-soft); }

.section-head {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 72px;
}

.section-head .eyebrow,
.about-grid .eyebrow {
  background: transparent;
  border: none;
  color: var(--ink-soft);
  margin-bottom: 14px;
  padding: 0;
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.section-head h2 {
  font-size: clamp(2rem, 4vw, 2.85rem);
  margin-bottom: 18px;
  letter-spacing: -0.035em;
}

.section-head p {
  font-size: 1.125rem;
  color: var(--ink-muted);
}

/* On light pages (.gradient-text inside light headings) */
.section-head h2 .gradient-text,
.about-grid h2 .gradient-text,
.detail-body h2 .gradient-text,
.cta-section h2 .gradient-text,
.detail-hero h1 .gradient-text {
  color: inherit;
  -webkit-text-fill-color: currentColor;
}

/* ------- Service grid ------- */
.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.service-card {
  background: var(--cream-soft);
  border: 1px solid var(--cream-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease, background 0.22s ease;
  display: flex;
  flex-direction: column;
  color: var(--ink);
}

.service-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--ink-soft);
  color: var(--ink);
}

.service-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cream);
  margin-bottom: 24px;
  flex-shrink: 0;
}

.service-icon svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.service-card .tag,
.detail-hero .tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 0;
  margin-bottom: 14px;
  color: var(--ink-soft);
  background: transparent;
  border: none;
}

.detail-hero .tag {
  font-size: 0.78rem;
  margin-bottom: 22px;
  color: var(--cream-on-dark-muted);
}

.tag-live { color: var(--ink); }
.tag-live::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 0 3px rgba(14, 15, 19, 0.12);
}

.detail-hero .tag-live { color: var(--cream); }
.detail-hero .tag-live::before {
  background: var(--cream);
  box-shadow: 0 0 0 3px rgba(240, 234, 220, 0.18);
}

.tag-beta, .tag-roadmap { color: var(--ink-soft); }
.detail-hero .tag-beta,
.detail-hero .tag-roadmap { color: var(--cream-on-dark-muted); }

.service-card h3 {
  font-size: 1.3rem;
  margin-bottom: 12px;
  letter-spacing: -0.022em;
}

.service-card p {
  color: var(--ink-muted);
  margin-bottom: 28px;
  flex-grow: 1;
}

.card-link {
  color: var(--ink);
  font-weight: 600;
  font-size: 0.92rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  align-self: flex-start;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 2px;
}

.card-link::after { content: '→'; transition: transform 0.2s; }
.service-card:hover .card-link::after { transform: translateX(4px); }

/* Inverted card variant ("what's next" callout) */
.service-card-invert {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--cream-on-dark);
}
.service-card-invert:hover {
  background: var(--ink-2);
  border-color: var(--ink-2);
  color: var(--cream-on-dark);
}
.service-card-invert h3 { color: var(--cream); }
.service-card-invert p { color: var(--cream-on-dark-muted); }
.service-card-invert .service-icon { background: var(--cream); color: var(--ink); }
.service-card-invert .tag { color: var(--cream-on-dark-muted); }
.service-card-invert .card-link {
  color: var(--cream);
  border-bottom-color: var(--cream);
}

/* ------- About / split ------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 88px;
  align-items: center;
}

.about-grid h2 {
  font-size: clamp(1.85rem, 4vw, 2.6rem);
  margin-bottom: 22px;
  letter-spacing: -0.035em;
}

.about-grid p {
  color: var(--ink-muted);
  font-size: 1.06rem;
  margin-bottom: 16px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.stat {
  padding: 28px 24px;
  background: var(--cream);
  border: 1px solid var(--cream-border);
  border-radius: var(--radius);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--ink-soft); }

.stat-num {
  font-family: 'Instrument Serif', Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: 2.5rem;
  color: var(--ink);
  letter-spacing: -0.03em;
  margin-bottom: 6px;
  line-height: 1.1;
}

.stat-label { font-size: 0.9rem; color: var(--ink-muted); }

/* ------- CTA section ------- */
.cta-section {
  padding: 120px 0;
  background: var(--ink);
  color: var(--cream-on-dark);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.cta-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 60% at 50% 0%, rgba(240, 234, 220, 0.05), transparent 65%);
  pointer-events: none;
}

.cta-section .container { position: relative; }

.cta-section h2 {
  font-size: clamp(2rem, 4vw, 2.85rem);
  color: var(--cream);
  margin-bottom: 18px;
  letter-spacing: -0.035em;
}

.cta-section p {
  font-size: 1.15rem;
  color: var(--cream-on-dark-muted);
  margin-bottom: 36px;
  max-width: 580px;
  margin-left: auto;
  margin-right: auto;
}

.cta-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ------- Footer ------- */
.site-footer {
  border-top: 1px solid var(--cream-border);
  padding: 40px 0;
  background: var(--cream);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  color: var(--ink-muted);
  font-size: 0.92rem;
}

.footer-links {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.footer-links a { color: var(--ink-muted); }
.footer-links a:hover { color: var(--ink); }

/* ------- Service detail pages ------- */
.detail-hero {
  background: var(--ink);
  color: var(--cream-on-dark);
  padding: 100px 0 88px;
  position: relative;
  overflow: hidden;
}

.detail-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(240, 234, 220, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(240, 234, 220, 0.022) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, black 30%, transparent 75%);
  pointer-events: none;
  opacity: 0.7;
}

.detail-hero .container { position: relative; }

.breadcrumb {
  font-size: 0.82rem;
  color: var(--cream-on-dark-muted);
  margin-bottom: 24px;
  letter-spacing: 0.04em;
}

.breadcrumb a { color: var(--cream-on-dark-muted); }
.breadcrumb a:hover { color: var(--cream); }

.detail-hero h1 {
  font-size: clamp(2.5rem, 5.5vw, 3.85rem);
  margin-bottom: 24px;
  max-width: 900px;
  color: var(--cream);
  letter-spacing: -0.038em;
  line-height: 1.05;
}

.detail-hero h1 .gradient-text { color: var(--cream); -webkit-text-fill-color: var(--cream); }

.detail-hero .lede {
  font-size: 1.18rem;
  color: var(--cream-on-dark-muted);
  max-width: 760px;
  margin-bottom: 0;
  line-height: 1.55;
}

.detail-body { padding: 96px 0; }

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 760px);
  justify-content: center;
}

.detail-body h2 {
  font-size: 1.9rem;
  margin: 60px 0 18px;
  letter-spacing: -0.028em;
}

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

.detail-body p,
.detail-body li {
  color: var(--ink-muted);
  font-size: 1.06rem;
}

.detail-body p { margin-bottom: 18px; }
.detail-body ul { margin: 0 0 24px 22px; }
.detail-body li { margin-bottom: 8px; }
.detail-body strong { color: var(--ink); font-weight: 600; }
.detail-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
  background: var(--cream-soft);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--ink);
  border: 1px solid var(--cream-border);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 32px 0;
}

.feature {
  padding: 22px;
  background: var(--cream-soft);
  border-radius: var(--radius);
  border: 1px solid var(--cream-border);
}

.feature h3 { font-size: 1rem; margin-bottom: 6px; letter-spacing: -0.018em; }
.feature p { font-size: 0.95rem; margin-bottom: 0; color: var(--ink-muted); }

.related {
  background: var(--cream-soft);
  padding: 88px 0;
  border-top: 1px solid var(--cream-border);
}

.related h2 {
  text-align: center;
  font-size: 1.5rem;
  margin-bottom: 36px;
  color: var(--ink);
  letter-spacing: -0.022em;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.related-card {
  background: var(--cream);
  border: 1px solid var(--cream-border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--ink);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.related-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--ink-soft);
  color: var(--ink);
}

.related-card .name { font-weight: 600; font-size: 1rem; color: var(--ink); letter-spacing: -0.015em; }
.related-card .desc { font-size: 0.92rem; color: var(--ink-muted); }

/* ------- Responsive ------- */
@media (max-width: 820px) {
  .nav-toggle { display: inline-flex; }
  .main-nav {
    display: none;
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    background: var(--cream-soft);
    flex-direction: column;
    padding: 18px 24px 22px;
    gap: 14px;
    border-bottom: 1px solid var(--cream-border);
    box-shadow: var(--shadow-md);
    align-items: stretch;
  }
  .main-nav.open { display: flex; }
  .main-nav .btn { width: 100%; justify-content: center; }
  .about-grid { grid-template-columns: 1fr; gap: 48px; }
  .hero { padding: 88px 0 96px; }
  .section { padding: 80px 0; }
  .detail-hero { padding: 64px 0 64px; }
  .detail-body { padding: 64px 0; }
  .cta-section { padding: 80px 0; }
}

@media (max-width: 480px) {
  .container { padding: 0 20px; }
  .stat-grid { grid-template-columns: 1fr; }
  .service-card { padding: 26px; }
}
