/* ---------- Tokens ---------- */
:root {
  --ink: #12110f;
  --ink-soft: #4a4740;
  --paper: #f6f4ef;
  --paper-raised: #fdfcf9;
  --line: rgba(18, 17, 15, 0.12);
  --accent: #b5522a;
  --accent-ink: #fdfcf9;
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "Space Mono", ui-monospace, monospace;
  --max: 1160px;
  --pad: 28px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #f2efe8;
    --ink-soft: #b9b4a9;
    --paper: #14130f;
    --paper-raised: #1b1a15;
    --line: rgba(242, 239, 232, 0.14);
    --accent: #e08159;
    --accent-ink: #14130f;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --ink: #f2efe8;
  --ink-soft: #b9b4a9;
  --paper: #14130f;
  --paper-raised: #1b1a15;
  --line: rgba(242, 239, 232, 0.14);
  --accent: #e08159;
  --accent-ink: #14130f;
  color-scheme: dark;
}

/* ---------- Reset ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { font-family: inherit; cursor: pointer; }

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad);
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.08;
}

em { font-style: italic; color: var(--accent); }

p { color: var(--ink-soft); }

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--paper); }
::-webkit-scrollbar-thumb {
  background: var(--ink);
  opacity: 0.3;
  border-radius: 6px;
  border: 2px solid var(--paper);
}

/* ---------- Scroll reveal ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s cubic-bezier(0.2, 0.7, 0.2, 1),
              transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: calc(var(--d, 0) * 90ms);
}
[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 26px;
  border-radius: 3px;
  font-size: 0.95rem;
  font-weight: 500;
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn span { position: relative; z-index: 2; }
.btn-primary {
  background: var(--ink);
  color: var(--paper);
}
.btn-primary::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
  z-index: 1;
}
.btn-primary:hover::before,
.btn-primary:focus-visible::before { transform: scaleX(1); }
.btn-ghost {
  border-color: var(--line);
  color: var(--ink);
}
.btn-ghost:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(18, 17, 15, 0.08);
}
.btn:active { transform: translateY(0) scale(0.98); }
.btn[disabled] { opacity: 0.7; cursor: default; }
.btn-block { width: 100%; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
}
/* backdrop-filter lives on a decorative pseudo-element rather than the
   header itself: a `backdrop-filter` on an ancestor establishes a new
   containing block for `position: fixed` descendants, which was
   collapsing the mobile nav panel (a fixed child of this header) to a
   72px box instead of letting it size against the viewport. */
.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
}
.logo {
  font-family: var(--serif);
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-icon {
  width: 26px;
  height: 26px;
  display: block;
}
.logo-icon-dark { display: none; }
:root[data-theme="dark"] .logo-icon-light { display: none; }
:root[data-theme="dark"] .logo-icon-dark { display: block; }
.main-nav { display: flex; align-items: center; gap: 34px; }
.main-nav a { font-size: 0.92rem; color: var(--ink-soft); }
.main-nav a:hover { color: var(--ink); }
.main-nav a:not(.nav-cta) {
  position: relative;
  padding-bottom: 2px;
}
.main-nav a:not(.nav-cta)::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
}
.main-nav a:not(.nav-cta):hover::after,
.main-nav a:not(.nav-cta):focus-visible::after {
  transform: scaleX(1);
  transform-origin: left;
}
.nav-cta {
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--ink) !important;
}
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  margin-left: 18px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: none;
  color: var(--ink);
  transition: background 0.15s ease, transform 0.15s ease;
}
.theme-toggle:hover { background: var(--line); }
.theme-toggle:active { transform: scale(0.94); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.nav-toggle { display: none; }

/* ---------- Hero: asymmetric split ---------- */
.hero-split { padding: 96px 0 70px; overflow: hidden; }
.hero-split-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  align-items: center;
}
.eyebrow {
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 22px;
}
.hero-copy h1 {
  font-size: clamp(2.1rem, 4.6vw, 3.4rem);
  max-width: 620px;
}
.accent-line {
  position: relative;
  color: var(--accent);
  font-style: italic;
}
.hero-sub { max-width: 520px; font-size: 1.08rem; margin-top: 20px; line-height: 1.6; }
.hero-actions { margin-top: 38px; display: flex; gap: 16px; }

.hero-visual {
  justify-self: end;
  transform: rotate(-1.4deg);
}
.chat-mock {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 20px 20px;
  width: min(380px, 100%);
  box-shadow: 0 24px 48px -20px rgba(18, 17, 15, 0.22);
}
.chat-mock-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  text-transform: uppercase;
}
.chat-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.chat-bubble {
  border-radius: 12px;
  padding: 11px 14px;
  margin-bottom: 10px;
  max-width: 88%;
  font-size: 0.92rem;
  line-height: 1.5;
}
.chat-bubble p { color: inherit; margin: 0; }
.chat-user {
  background: var(--ink);
  color: var(--paper);
  margin-left: auto;
  border-bottom-right-radius: 3px;
}
.chat-agent {
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
  border-bottom-left-radius: 3px;
}
.chat-caption {
  margin-top: 14px;
  font-size: 0.78rem;
  color: var(--ink-soft);
  max-width: 340px;
  text-align: right;
}

/* ---------- Why: asymmetric lead + stack ---------- */
.why { padding: 70px 0 90px; }
.why-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 56px;
  align-items: start;
}
.why-statement {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
  line-height: 1.35;
  color: var(--ink);
  margin-top: 14px;
}
.why-stack { display: flex; flex-direction: column; gap: 22px; margin-top: 6px; }
.why-card {
  border: 1px solid var(--line);
  background: var(--paper-raised);
  border-radius: 8px;
  padding: 22px 24px;
}
.why-card:nth-child(2) { margin-left: 24px; }
.why-stat {
  display: block;
  font-family: var(--serif);
  font-size: 2rem;
  color: var(--accent);
  margin-bottom: 6px;
}
.why-card p { font-size: 0.92rem; }

.section-mark {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

/* ---------- Services ---------- */
.services { padding: 90px 0; border-top: 1px solid var(--line); }
.services h2, .process h2, .fit h2 {
  font-size: clamp(1.8rem, 3.4vw, 2.6rem);
  max-width: 640px;
  margin-bottom: 56px;
}
.service-row {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 24px;
  padding: 34px 0;
  border-top: 1px solid var(--line);
  transition: padding-left 0.25s ease;
}
.service-row:last-child { border-bottom: 1px solid var(--line); }
.service-row:hover { padding-left: 8px; }
.service-row-offset { margin-left: clamp(0px, 6vw, 64px); }
.service-mark {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 1rem;
  padding-top: 4px;
}
.service-copy h3 { font-size: 1.35rem; margin-bottom: 10px; }
.service-copy p { max-width: 620px; }

/* ---------- Process: icon marks, staggered vertical offset ----------
   Uses margin (not transform) for the permanent stagger so it doesn't
   fight with the [data-reveal] transform used for the scroll-in animation. */
.process { padding: 90px 0; border-top: 1px solid var(--line); }
.process-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 36px;
}
.process-steps li { display: flex; flex-direction: column; gap: 18px; }
.process-steps li:nth-child(2),
.process-steps li:nth-child(4) { margin-top: 28px; }
.process-steps h4 { font-size: 1.15rem; margin-bottom: 8px; }
.process-steps p { font-size: 0.94rem; }
.step-mark {
  display: inline-flex;
  width: 34px;
  height: 34px;
  color: var(--accent);
}
.step-mark svg { width: 100%; height: 100%; }

/* ---------- Fit / Pricing: layered/stacked card ---------- */
.fit { padding: 90px 0; border-top: 1px solid var(--line); }
.grid-2 {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 64px;
  align-items: start;
}
.fit-copy { font-size: 1.05rem; margin-top: 22px; max-width: 480px; }
.founder-note {
  margin-top: 22px;
  padding-left: 16px;
  border-left: 2px solid var(--line);
  font-size: 0.9rem;
  font-style: italic;
  max-width: 460px;
}
.fit-card-wrap { position: relative; }
.fit-card-wrap::before {
  content: "";
  position: absolute;
  inset: 14px -14px -14px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  z-index: -1;
}
.fit-card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 40px;
  transform: rotate(0.6deg);
}
.fit-card h3 { font-size: 1.25rem; margin-bottom: 14px; }
.fit-card p { margin-bottom: 18px; font-size: 0.96rem; }
.fit-note { font-size: 0.86rem; }

/* ---------- Contact ---------- */
.contact { padding: 100px 0 120px; border-top: 1px solid var(--line); }
.contact-intro h2 {
  font-size: clamp(1.8rem, 3.2vw, 2.4rem);
  margin: 18px 0 22px;
}
.contact-intro p a { color: var(--accent); border-bottom: 1px solid currentColor; }
.contact-form {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 36px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 0.85rem; color: var(--ink-soft); }
.field input, .field textarea {
  font-family: var(--sans);
  font-size: 0.98rem;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--paper);
  color: var(--ink);
  resize: vertical;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.form-note { font-size: 0.88rem; min-height: 1.2em; color: var(--accent); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 30px 0; }
.footer-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-split-grid { grid-template-columns: 1fr; }
  .hero-visual { justify-self: stretch; transform: rotate(0); margin-top: 8px; }
  .why-grid { grid-template-columns: 1fr; }
  .why-card:nth-child(2) { margin-left: 0; }
  .service-row-offset { margin-left: 0; }
  .fit-card-wrap::before { display: none; }
}

@media (max-width: 860px) {
  .process-steps { grid-template-columns: 1fr; gap: 40px; }
  .grid-2 { grid-template-columns: 1fr; gap: 40px; }
  .footer-row { flex-direction: column; gap: 8px; }

  .main-nav {
    position: fixed;
    inset: 76px 0 0 0;
    z-index: 60;
    flex-direction: column;
    align-items: flex-start;
    gap: 26px;
    padding: 36px var(--pad);
    background: var(--paper);
    box-shadow: 0 16px 32px -12px rgba(18, 17, 15, 0.18);
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
  }
  .main-nav.nav-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
  .nav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
  }
  .nav-toggle span {
    display: block;
    height: 1.5px;
    background: var(--ink);
    width: 100%;
  }
}
