/* ahsaanfarooq.tech — design system
   ink/paper + one rust accent · Space Grotesk / IBM Plex Sans / IBM Plex Mono */

:root {
  --ink: #161310;
  --paper: #FBFAF7;
  --stone: #6E6A61;
  --rust: #C7461B;
  --rust-dark: #A93A15;
  --line: #E7E4DC;
  --panel: #1B1814;
  --panel-text: #D8D4CC;
  --ok: #7BAE6B;
  --warn: #D9A03C;
  --max: 68rem;
}

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

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.125rem);
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: 'Space Grotesk', sans-serif; line-height: 1.12; letter-spacing: -0.02em; }
h1 { font-size: clamp(2.1rem, 1.2rem + 4vw, 3.9rem); font-weight: 700; }
h2 { font-size: clamp(1.6rem, 1.2rem + 1.8vw, 2.4rem); font-weight: 600; }
h3 { font-size: clamp(1.15rem, 1rem + 0.7vw, 1.45rem); font-weight: 600; }

a { color: var(--rust); text-underline-offset: 3px; }
a:hover { color: var(--rust-dark); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--rust); outline-offset: 3px; }

.mono, .eyebrow { font-family: 'IBM Plex Mono', monospace; }

.eyebrow {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rust);
  margin-bottom: 0.9rem;
}

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 clamp(1.1rem, 4vw, 2.5rem); }

/* ---------- header ---------- */
header.site {
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: none;
}
header.site .wrap {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 4rem; gap: 1rem;
}
.brand { font-family: 'IBM Plex Mono', monospace; font-size: 0.95rem; color: var(--ink); text-decoration: none; font-weight: 500; }
.brand b { color: var(--rust); font-weight: 500; }
nav.main { display: flex; gap: clamp(0.9rem, 2vw, 1.6rem); align-items: center; flex-wrap: wrap; }
nav.main a { color: var(--ink); text-decoration: none; font-size: 0.95rem; padding: 0.6rem 0.15rem; }
nav.main a:hover { color: var(--rust); }
nav.main a.cta { color: var(--paper); background: var(--ink); padding: 0.6rem 1.1rem; border-radius: 2px; }
nav.main a.cta:hover { background: var(--rust); color: var(--paper); }

/* mobile nav */
#navtoggle { display: none; }
label.navbtn { display: none; font-family: 'IBM Plex Mono', monospace; font-size: 0.85rem; cursor: pointer; padding: 0.7rem; border: 1px solid var(--line); border-radius: 2px; min-width: 44px; min-height: 44px; text-align: center; }
@media (max-width: 46rem) {
  label.navbtn { display: inline-flex; align-items: center; justify-content: center; }
  nav.main {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    background: var(--paper); border-bottom: 1px solid var(--line);
    flex-direction: column; align-items: stretch; padding: 0.5rem 1.25rem 1.25rem; gap: 0;
  }
  nav.main a { padding: 0.85rem 0.25rem; border-bottom: 1px solid var(--line); }
  nav.main a.cta { margin-top: 0.9rem; text-align: center; border-bottom: none; }
  #navtoggle:checked ~ nav.main { display: flex; }
}

/* ---------- hero ---------- */
.hero { padding: clamp(3rem, 8vw, 6.5rem) 0 clamp(3rem, 7vw, 5.5rem); }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(2rem, 5vw, 4.5rem); align-items: center; }
@media (max-width: 56rem) { .hero .wrap { grid-template-columns: 1fr; } }
.hero p.lead { margin-top: 1.4rem; font-size: clamp(1.05rem, 1rem + 0.5vw, 1.25rem); color: var(--stone); max-width: 34em; }
.hero .actions { margin-top: 2.2rem; display: flex; gap: 1rem; flex-wrap: wrap; }

.btn {
  display: inline-block; text-decoration: none; border-radius: 2px;
  font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 1rem;
  padding: 0.85rem 1.5rem; min-height: 44px;
}
.btn.primary { background: var(--rust); color: var(--paper); }
.btn.primary:hover { background: var(--rust-dark); color: var(--paper); }
.btn.ghost { color: var(--ink); border: 1px solid var(--ink); }
.btn.ghost:hover { border-color: var(--rust); color: var(--rust); }

/* ---------- signature: webhook log ---------- */
.term {
  background: var(--panel); color: var(--panel-text);
  border-radius: 6px; padding: 1.1rem 1.2rem 1.3rem;
  font-family: 'IBM Plex Mono', monospace; font-size: 0.78rem; line-height: 1.9;
  box-shadow: 0 1px 0 rgba(0,0,0,0.35);
  overflow-x: auto;
}
.term .bar { display: flex; gap: 0.45rem; margin-bottom: 0.9rem; align-items: center; }
.term .bar i { width: 9px; height: 9px; border-radius: 50%; background: #3A362F; display: inline-block; }
.term .bar span { margin-left: auto; font-size: 0.68rem; color: #6E6A61; }
.term .ln { display: block; white-space: nowrap; opacity: 0; animation: lnin 0.01s forwards; }
.term .ln:nth-child(2) { animation-delay: 0.3s; }
.term .ln:nth-child(3) { animation-delay: 0.9s; }
.term .ln:nth-child(4) { animation-delay: 1.5s; }
.term .ln:nth-child(5) { animation-delay: 2.2s; }
.term .ln:nth-child(6) { animation-delay: 2.9s; }
.term .ln:nth-child(7) { animation-delay: 3.6s; }
@keyframes lnin { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .term .ln { opacity: 1; } }
.term .t { color: #6E6A61; }
.term .ev { color: #E8B04B; }
.term .ok { color: var(--ok); }
.term .act { color: var(--panel-text); }
.term .hot { color: #E86A3C; }

/* ---------- sections ---------- */
section.band { padding: clamp(2.8rem, 7vw, 5rem) 0; border-top: 1px solid var(--line); }
section.band.dark { background: var(--panel); color: var(--panel-text); border-top: none; }
section.band.dark h2 { color: var(--paper); }
section.band.dark a { color: #E8845C; }

.kicker-grid { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: clamp(1.5rem, 4vw, 4rem); }
@media (max-width: 52rem) { .kicker-grid { grid-template-columns: 1fr; } }

/* trust bar */
.trust { display: flex; gap: clamp(1.5rem, 5vw, 4rem); flex-wrap: wrap; padding: 1.4rem 0; border-top: 1px solid var(--line); }
.trust div { font-family: 'IBM Plex Mono', monospace; font-size: 0.85rem; color: var(--stone); }
.trust b { display: block; font-family: 'Space Grotesk', sans-serif; font-size: 1.5rem; color: var(--ink); font-weight: 700; }

/* services ledger */
.ledger { border-top: 1px solid var(--ink); }
.ledger a.row { display: grid; grid-template-columns: minmax(0,5fr) minmax(0,6fr) auto; gap: 1.5rem; align-items: baseline; padding: 1.6rem 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.ledger a.row:hover h3 { color: var(--rust); }
.ledger a.row p { color: var(--stone); font-size: 0.98rem; }
.ledger a.row .go { font-family: 'IBM Plex Mono', monospace; color: var(--rust); font-size: 0.9rem; }
@media (max-width: 46rem) { .ledger a.row { grid-template-columns: 1fr; gap: 0.4rem; } }

/* case study card */
.case { border: 1px solid var(--line); border-radius: 2px; padding: clamp(1.4rem, 3vw, 2.2rem); margin-top: 1.5rem; }
.case .tags { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.8rem 0 1rem; }
.tag { font-family: 'IBM Plex Mono', monospace; font-size: 0.72rem; border: 1px solid var(--line); border-radius: 2px; padding: 0.2rem 0.55rem; color: var(--stone); }

/* stats grid */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); margin: 1.8rem 0; }
.stats div { background: var(--paper); padding: 1.2rem 1.1rem; }
.stats b { display: block; font-family: 'Space Grotesk', sans-serif; font-size: 1.45rem; color: var(--rust); }
.stats span { font-size: 0.85rem; color: var(--stone); }

/* prose lists in case studies */
.marklist { list-style: none; margin: 1rem 0 1.8rem; }
.marklist li { padding-left: 1.7rem; position: relative; margin-bottom: 0.7rem; }
.marklist.ch li::before { content: "→"; position: absolute; left: 0; color: var(--stone); font-family: 'IBM Plex Mono', monospace; }
.marklist.sol li::before { content: "✓"; position: absolute; left: 0; color: var(--rust); font-family: 'IBM Plex Mono', monospace; }

.steps { counter-reset: step; list-style: none; margin: 1rem 0 1.8rem; }
.steps li { counter-increment: step; padding: 0.9rem 0 0.9rem 3rem; position: relative; border-bottom: 1px solid var(--line); }
.steps li::before { content: "0" counter(step); position: absolute; left: 0; top: 0.95rem; font-family: 'IBM Plex Mono', monospace; color: var(--rust); font-size: 0.85rem; }

blockquote { border-left: 2px solid var(--rust); padding: 0.3rem 0 0.3rem 1.4rem; margin: 1.8rem 0; color: var(--stone); font-size: 1.05rem; }
blockquote footer { font-family: 'IBM Plex Mono', monospace; font-size: 0.8rem; margin-top: 0.6rem; }

/* split CTA */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.2rem, 3vw, 2rem); margin-top: 2rem; }
@media (max-width: 46rem) { .split { grid-template-columns: 1fr; } }
.split a { display: block; border: 1px solid var(--line); border-radius: 2px; padding: clamp(1.4rem, 3vw, 2rem); text-decoration: none; color: inherit; }
.split a:hover { border-color: var(--rust); }
.split a h3 { margin-bottom: 0.5rem; }
.split a p { color: var(--stone); font-size: 0.98rem; }
.split a .go { font-family: 'IBM Plex Mono', monospace; color: var(--rust); font-size: 0.9rem; display: inline-block; margin-top: 1rem; }
section.band.dark .split a { border-color: #35302A; color: var(--panel-text); }
section.band.dark .split a h3 { color: var(--paper); }
section.band.dark .split a:hover { border-color: var(--rust); }

/* prose helpers */
.prose { max-width: 44em; }
.prose p { margin-bottom: 1.1rem; }
.prose h2 { margin: 2.4rem 0 1rem; }
.prose h3 { margin: 1.9rem 0 0.7rem; }
.muted { color: var(--stone); }

/* page hero (inner pages) */
.pagehero { padding: clamp(2.5rem, 6vw, 4.5rem) 0 clamp(1.5rem, 4vw, 2.5rem); }
.pagehero p.lead { color: var(--stone); margin-top: 1rem; max-width: 38em; font-size: 1.1rem; }

/* footer */
footer.site { background: var(--panel); color: #8F8A80; padding: clamp(2.5rem, 6vw, 4rem) 0; margin-top: clamp(3rem, 7vw, 5rem); font-size: 0.92rem; }
footer.site .cols { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem; }
@media (max-width: 46rem) { footer.site .cols { grid-template-columns: 1fr; } }
footer.site h4 { font-family: 'IBM Plex Mono', monospace; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.12em; color: #6E6A61; margin-bottom: 0.9rem; }
footer.site a { color: var(--panel-text); text-decoration: none; display: block; padding: 0.25rem 0; }
footer.site a:hover { color: #E8845C; }
footer.site .fine { margin-top: 2.5rem; padding-top: 1.2rem; border-top: 1px solid #2A2620; font-family: 'IBM Plex Mono', monospace; font-size: 0.75rem; }

img { max-width: 100%; height: auto; }
table { width: 100%; border-collapse: collapse; }

/* ---------- AI assistant widget ---------- */
#aiw-btn {
  position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 90;
  background: var(--ink); color: var(--paper);
  font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 0.95rem;
  border: none; border-radius: 2px; padding: 0.85rem 1.3rem; cursor: pointer;
  min-height: 48px; box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  display: flex; align-items: center; gap: 0.6rem;
}
#aiw-btn:hover { background: var(--rust); }
#aiw-btn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--rust); display: inline-block; }
#aiw-btn:hover .dot { background: var(--paper); }
#aiw-panel {
  position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 95;
  width: min(24rem, calc(100vw - 2rem)); height: min(32rem, calc(100vh - 4rem));
  background: var(--paper); border: 1px solid var(--line); border-radius: 4px;
  display: flex; flex-direction: column; box-shadow: 0 8px 32px rgba(0,0,0,0.22);
}
#aiw-head {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--panel); color: var(--paper); padding: 0.75rem 1rem;
  font-family: 'IBM Plex Mono', monospace; font-size: 0.85rem; border-radius: 4px 4px 0 0;
}
#aiw-head button { background: none; border: none; color: var(--paper); font-size: 1.4rem; cursor: pointer; line-height: 1; padding: 0.2rem 0.4rem; min-width: 44px; min-height: 32px; }
#aiw-log { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.6rem; }
.aiw-msg { max-width: 88%; padding: 0.6rem 0.85rem; border-radius: 4px; font-size: 0.92rem; line-height: 1.5; white-space: pre-wrap; }
.aiw-msg.assistant { background: #F0EDE6; color: var(--ink); align-self: flex-start; }
.aiw-msg.user { background: var(--ink); color: var(--paper); align-self: flex-end; }
.aiw-msg.typing { color: var(--stone); }
#aiw-form { display: flex; border-top: 1px solid var(--line); }
#aiw-form input { flex: 1; border: none; padding: 0.9rem 1rem; font: inherit; font-size: 0.95rem; background: transparent; color: var(--ink); min-height: 48px; }
#aiw-form input:focus { outline: 2px solid var(--rust); outline-offset: -2px; }
#aiw-form button { border: none; background: var(--rust); color: var(--paper); font-family: 'Space Grotesk', sans-serif; font-weight: 600; padding: 0 1.2rem; cursor: pointer; min-height: 48px; }
#aiw-form button:hover { background: var(--rust-dark); }

/* ---------- lead form ---------- */
.leadform { max-width: 34rem; display: grid; gap: 1rem; margin-top: 1.5rem; }
.leadform label { font-family: 'IBM Plex Mono', monospace; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--stone); display: block; margin-bottom: 0.35rem; }
.leadform input, .leadform textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 2px; background: #fff;
  font: inherit; font-size: 1rem; padding: 0.8rem 0.9rem; color: var(--ink); min-height: 48px;
}
.leadform input:focus, .leadform textarea:focus { outline: 2px solid var(--rust); outline-offset: -1px; border-color: var(--rust); }
.leadform textarea { min-height: 7rem; resize: vertical; }
.leadform .status { font-size: 0.95rem; min-height: 1.4rem; }
.leadform .status.ok { color: #3E7A2E; }
.leadform .status.err { color: #B3261E; }

/* automate-anything strip */
.autolist { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.4rem; }
.autolist span { font-family: 'IBM Plex Mono', monospace; font-size: 0.8rem; border: 1px solid var(--line); border-radius: 2px; padding: 0.35rem 0.7rem; color: var(--ink); background: #fff; }
.autolist span.more { border-style: dashed; color: var(--rust); }
#aiw-panel[hidden] { display: none; }
#aiw-cap { padding: 1rem; border-top: 1px solid var(--line); }
#aiw-cap p { font-size: 0.9rem; color: var(--stone); margin-bottom: 0.7rem; }
#aiw-cap[hidden], #aiw-form[hidden] { display: none; }
