/* ============================================================
   Conzai — Architectural Intelligence design system
   ============================================================ */

:root {
  /* surface tiers — warm beige ladder */
  --surface-lowest:   #fffcf7;
  --surface:          #fff8f3;
  --surface-low:      #fef2e5;
  --surface-container: #fdebd6;
  --surface-high:     #f7e3c9;
  --surface-highest:  #f1e0cb;

  /* ink — warm "black" */
  --on-surface:       #221a0d;
  --on-surface-var:   #4a4235;
  --on-surface-mut:   #7a7262;
  --on-surface-faint: #a89e8c;

  /* primary — deep green */
  --primary:            #0d4737;
  --primary-container:  #2a5f4e;
  --on-primary:         #fff8f3;

  /* secondary / pulse — coral */
  --secondary:          #ac332a;
  --secondary-container:#fd6e60;
  --tertiary:           #7f100f;
  --on-secondary:       #fff8f3;

  /* outline */
  --outline:          #8a8577;
  --outline-variant:  #c0c9c3;

  /* semantic alerts tied to palette */
  --warn: #c8720f;
  --warn-weak: color-mix(in srgb, #c8720f 14%, transparent);
  --danger: #7f100f;
  --danger-weak: color-mix(in srgb, #7f100f 14%, transparent);
  --ok: #0d4737;
  --ok-weak: color-mix(in srgb, #0d4737 14%, transparent);
  --pulse: #fd6e60;
  --pulse-weak: color-mix(in srgb, #fd6e60 18%, transparent);

  --display: "Manrope", "Inter", Helvetica, sans-serif;
  --sans:    "Inter", Helvetica, sans-serif;
  --mono:    "Space Grotesk", "IBM Plex Mono", ui-monospace, Menlo, monospace;

  --maxw: 1280px;

  --r-sm: 0.25rem;   /* 4px */
  --r-md: 0.5rem;    /* 8px */
  --r-lg: 0.5rem;    /* 8px */
  --r-xl: 0.75rem;   /* 12px */
  --r-xxl: 1rem;     /* 16px */

  --ghost: color-mix(in srgb, var(--outline-variant) 15%, transparent);
  --ambient: 0 20px 48px -12px rgba(34, 26, 13, 0.04),
             0 2px 8px rgba(34, 26, 13, 0.02);
  --ambient-strong: 0 30px 60px -20px rgba(34, 26, 13, 0.06),
                    0 4px 12px rgba(34, 26, 13, 0.03);
}

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

html {
  background: var(--surface);
  color: var(--on-surface);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}

body {
  min-width: 320px;
}

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

img,
svg,
canvas,
video {
  max-width: 100%;
}

/* ---------- shell ---------- */
.shell {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 40px;
}

/* ---------- topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  padding-top: env(safe-area-inset-top, 0px);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  backdrop-filter: saturate(1.4) blur(24px);
  -webkit-backdrop-filter: saturate(1.4) blur(24px);
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 36px;
  height: 72px;
}
.brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 10px;
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: -0.02em;
  font-weight: 600;
  color: var(--on-surface);
}
/* Logo image — replaces the former text-mark + word pairing */
.brand-logo {
  display: block;
  height: 34px;
  width: auto;
  object-fit: contain;
}
.topbar .brand-logo { height: 34px; }
footer .brand-logo { height: 40px; }
.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--on-surface-var);
}
.nav a {
  position: relative;
  padding: 8px 14px;
  border-radius: var(--r-md);
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--surface-container); color: var(--on-surface); }
.nav a.active { background: transparent; color: var(--on-surface); }
.nav a.active::after {
  content: "";
  position: absolute;
  left: 14px; right: 14px; bottom: 2px;
  height: 2px;
  background: var(--secondary-container);
  border-radius: 2px;
}
.topbar-cta { margin-left: auto; display: flex; gap: 10px; align-items: center; flex-wrap: nowrap; justify-content: flex-end; }
.topbar-cta .btn { white-space: nowrap; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  border: none;
  border-radius: var(--r-xl);
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, background .15s;
  white-space: normal;
  text-align: center;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-container) 100%);
  color: var(--on-primary);
  box-shadow: 0 1px 0 rgba(255,255,255,0.15) inset, 0 6px 20px -6px rgba(13,71,55,0.35);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 2px 0 rgba(255,255,255,0.15) inset, 0 10px 24px -6px rgba(13,71,55,0.45); }
.btn-secondary {
  background: var(--surface-highest);
  color: var(--on-surface);
}
.btn-secondary:hover { background: var(--surface-high); }
.btn-tertiary {
  background: transparent;
  color: var(--primary);
  font-family: var(--mono);
  padding: 12px 4px;
  letter-spacing: -0.01em;
  font-weight: 500;
}
.btn-tertiary:hover { color: var(--primary-container); }
.btn-lg { padding: 16px 28px; font-size: 15px; border-radius: var(--r-xl); }
.btn .arrow { transition: transform .15s; display: inline-block; }
.btn:hover .arrow { transform: translateX(3px); }

/* ---------- type ---------- */
.eyebrow {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: -0.005em;
  color: var(--primary);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: ""; width: 20px; height: 2px;
  background: var(--secondary-container); display: inline-block;
}

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.02;
  margin: 0;
  color: var(--on-surface);
  text-wrap: balance;
  hyphens: auto;
}
h1 { font-size: clamp(48px, 6.4vw, 88px); letter-spacing: -0.03em; }
h2 { font-size: clamp(36px, 4.2vw, 56px); }
h3 { font-size: clamp(22px, 2.2vw, 30px); font-weight: 600; }
h4 { font-size: 20px; letter-spacing: -0.015em; }

p { margin: 0; color: var(--on-surface-var); text-wrap: pretty; hyphens: auto; }
.lead { font-size: 20px; line-height: 1.45; color: var(--on-surface-var); max-width: 60ch; }

.label-md {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--on-surface-mut);
  font-weight: 500;
  letter-spacing: -0.005em;
}

.section { padding: 128px 0; position: relative; }
.section-sm { padding: 80px 0; }

.section-head {
  display: grid; gap: 20px;
  margin-bottom: 72px;
  max-width: 820px;
}
.section-head .lead { margin-top: 8px; }

/* ---------- motion system ---------- */
@keyframes conzai-grid-drift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 28px 18px, 28px 18px; }
}

html.motion-ready [data-reveal],
html.motion-ready [data-stagger] > * {
  --motion-y: 22px;
  --motion-scale: 0.985;
  --motion-blur: 7px;
  opacity: 0;
  filter: blur(var(--motion-blur));
  transform: translate3d(0, var(--motion-y), 0) scale(var(--motion-scale));
  transition:
    opacity 720ms cubic-bezier(.2, .75, .22, 1),
    transform 720ms cubic-bezier(.2, .75, .22, 1),
    filter 720ms cubic-bezier(.2, .75, .22, 1);
  transition-delay: calc(var(--motion-delay, 0ms) + (var(--motion-index, 0) * 72ms));
  will-change: opacity, transform, filter;
}

html.motion-ready [data-reveal="soft"],
html.motion-ready [data-stagger="soft"] > * {
  --motion-y: 12px;
  --motion-scale: 1;
  --motion-blur: 5px;
}

html.motion-ready [data-reveal="scale"],
html.motion-ready [data-stagger="scale"] > * {
  --motion-y: 14px;
  --motion-scale: 0.965;
  --motion-blur: 8px;
}

html.motion-ready [data-reveal="card"],
html.motion-ready [data-stagger="card"] > * {
  --motion-y: 24px;
  --motion-scale: 0.975;
  --motion-blur: 8px;
}

html.motion-ready [data-reveal].is-visible,
html.motion-ready [data-stagger].is-visible > * {
  opacity: 1;
  filter: blur(0);
  transform: translate3d(0, 0, 0) scale(1);
}

html.motion-ready [data-reveal="line"] {
  --motion-y: 0;
  --motion-scale: 1;
  transform: scaleX(0.35);
  transform-origin: left center;
}

html.motion-ready [data-reveal="line"].is-visible {
  transform: scaleX(1);
}

html.motion-ready .hero::before,
html.motion-ready .phero::before,
html.motion-ready .ahero::before,
html.motion-ready .ds-head::before,
html.motion-ready .imp-head::before,
html.motion-ready .final-cta::before {
  animation: conzai-grid-drift 18s ease-in-out infinite alternate;
}

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

  [data-reveal],
  [data-stagger] > * {
    opacity: 1 !important;
    filter: none !important;
    transform: none !important;
  }
}

/* ---------- surface variants ---------- */
.bg-surface { background: var(--surface); }
.bg-low { background: var(--surface-low); }
.bg-container { background: var(--surface-container); }
.bg-high { background: var(--surface-high); }
.bg-highest { background: var(--surface-highest); }
.bg-primary { background: linear-gradient(180deg, var(--primary) 0%, var(--primary-container) 100%); color: var(--on-primary); }
.bg-primary h1, .bg-primary h2, .bg-primary h3, .bg-primary h4 { color: var(--on-primary); }
.bg-primary p { color: color-mix(in srgb, var(--on-primary) 78%, transparent); }
.bg-primary .eyebrow { color: var(--secondary-container); }

/* ---------- cards (no borders, tonal layering) ---------- */
.card {
  background: var(--surface-lowest);
  border-radius: var(--r-xxl);
  padding: 28px;
  box-shadow: var(--ambient);
}
.card-cutout {
  background: var(--surface-lowest);
  border-radius: var(--r-xl);
  padding: 24px;
}
.card-active {
  position: relative;
  padding-left: 26px;
}
.card-active::before {
  content: ""; position: absolute; left: 0; top: 12px; bottom: 12px;
  width: 2px; background: var(--secondary-container); border-radius: 2px;
}

/* ---------- tags ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: -0.005em;
  font-weight: 500;
  color: var(--on-surface-var);
  background: var(--surface-high);
  border-radius: var(--r-sm);
}
.tag-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--on-surface-mut); }
.tag-warn { color: var(--warn); background: var(--warn-weak); }
.tag-warn .tag-dot { background: var(--warn); }
.tag-pulse { color: var(--secondary); background: var(--pulse-weak); }
.tag-pulse .tag-dot { background: var(--secondary-container); }
.tag-danger { color: var(--danger); background: var(--danger-weak); }
.tag-danger .tag-dot { background: var(--danger); }
.tag-ok { color: var(--primary); background: var(--ok-weak); }
.tag-ok .tag-dot { background: var(--primary); }

/* ---------- blueprint grid ---------- */
.blueprint-grid {
  background-image:
    linear-gradient(to right, color-mix(in srgb, var(--outline-variant) 22%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in srgb, var(--outline-variant) 22%, transparent) 1px, transparent 1px);
  background-size: 48px 48px;
}

/* ---------- footer ---------- */
footer {
  background: var(--primary);
  color: var(--on-primary);
  padding: 120px 0 56px;
}
footer a { color: color-mix(in srgb, var(--on-primary) 72%, transparent); }
footer a:hover { color: var(--on-primary); }
footer h5 {
  font-family: var(--mono);
  font-size: 12px; font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--secondary-container);
  margin: 0 0 20px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: 48px;
}
.footer-links { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; font-size: 14px; }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 40px;
  margin-top: 72px;
  border-top: 1px solid color-mix(in srgb, var(--on-primary) 10%, transparent);
  font-family: var(--mono);
  font-size: 12px;
  color: color-mix(in srgb, var(--on-primary) 60%, transparent);
}
.footer-brand p { color: color-mix(in srgb, var(--on-primary) 65%, transparent); max-width: 38ch; font-size: 14px; margin-top: 18px; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .shell { padding: 0 20px; }
  .section { padding: 88px 0; }
  .topbar-inner {
    height: 68px;
    gap: 18px;
    flex-wrap: nowrap;
  }
  .brand,
  .nav,
  .topbar-cta,
  .footer-grid > *,
  .footer-bottom > * {
    min-width: 0;
  }
  .topbar .brand-logo {
    height: 30px;
  }
  .nav {
    flex: 1 1 auto;
    justify-content: center;
    margin-left: 0;
    gap: 4px;
    overflow-x: visible;
    scrollbar-width: none;
    -ms-overflow-style: none;
    font-size: 13.5px;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a {
    flex: 0 0 auto;
    padding: 8px 10px;
    white-space: nowrap;
  }
  .topbar-cta {
    flex: 0 0 auto;
    margin-left: auto;
    gap: 8px;
  }
  .topbar-cta .btn {
    padding: 10px 16px;
    min-height: 44px;
  }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 800px) {
  .topbar-inner {
    gap: 14px;
  }
  .topbar-cta .btn-secondary {
    display: none;
  }
  .topbar-cta .btn-primary {
    padding-inline: 14px;
  }
}

@media (max-width: 640px) {
  .shell { padding: 0 16px; }
  h1 { font-size: clamp(36px, 10vw, 52px); }
  h2 { font-size: clamp(30px, 8vw, 40px); }
  h3 { font-size: clamp(22px, 6vw, 28px); }
  h1,
  h2 {
    text-wrap: pretty;
    overflow-wrap: normal;
  }
  .lead,
  p {
    text-wrap: pretty;
    overflow-wrap: anywhere;
  }
  .topbar { backdrop-filter: saturate(1.2) blur(18px); -webkit-backdrop-filter: saturate(1.2) blur(18px); }
  .topbar-inner {
    align-items: center;
    gap: 12px;
    min-height: auto;
    padding: 8px 0 10px;
  }
  .topbar .brand,
  .topbar-cta {
    display: none;
  }
  .nav {
    order: 1;
    flex: 1 1 100%;
    gap: 4px;
    padding-bottom: 0;
  }
  .nav a {
    padding: 8px 12px;
    font-size: 13px;
  }
  .lead {
    font-size: 18px;
    max-width: none;
  }
  .section { padding: 72px 0; }
  .section-head { margin-bottom: 48px; }
  footer { padding: 88px 0 40px; }
  .footer-grid { grid-template-columns: 1fr; gap: 32px; }
  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    padding-top: 28px;
    margin-top: 40px;
  }
}
