/* ============================================================
   AUTOMUTINY. design system
   Palette: paper base, ink text, signal-red accent, dark-ink cards
   Swap the accent by editing --accent + --accent-deep only.
   ============================================================ */

:root {
  --paper: #F7F6F2;
  --paper-2: #EFEEE8;
  --white: #FFFFFF;
  --ink: #101418;
  --ink-2: #14181F;      /* dark cards / sections */
  --ink-3: #1B212B;      /* raised dark surface */
  --muted: #5D636B;
  --muted-on-dark: #9AA1AB;
  --hairline: #E3E1D9;
  --hairline-dark: #2A313B;
  --accent: #D8291C;     /* signal red */
  --accent-deep: #A81F14;
  --bone: #EDEAE2;

  --font-display: "Archivo", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --max-w: 1240px;
  --radius: 2px;
  --pad-section: clamp(64px, 9vw, 128px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

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

/* ---------- type ---------- */
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em; line-height: 1.08; }
.h-hero { font-size: clamp(2.6rem, 6vw, 4.6rem); }
.h-xl { font-size: clamp(2.1rem, 4.4vw, 3.4rem); }
.h-lg { font-size: clamp(1.6rem, 3vw, 2.3rem); }
.h-md { font-size: clamp(1.25rem, 2vw, 1.6rem); }
.lead { font-size: clamp(1.02rem, 1.4vw, 1.2rem); color: var(--muted); max-width: 46ch; }
.mono { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; }
.on-dark { color: var(--bone); }
.on-dark .lead, .on-dark p { color: var(--muted-on-dark); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-body); font-weight: 500; font-size: 0.92rem;
  padding: 13px 24px; border-radius: var(--radius);
  border: 1px solid transparent; cursor: pointer;
  transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
  white-space: nowrap;
}
.btn .arr { transition: transform .18s ease; }
.btn:hover .arr { transform: translate(2px, -2px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-deep); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--bone); }
.btn-ghost-dark { background: transparent; color: var(--bone); border-color: var(--hairline-dark); }
.btn-ghost-dark:hover { border-color: var(--bone); }
.btn-light { background: var(--bone); color: var(--ink); }
.btn-light:hover { background: #fff; }

.brand-tile { display:block; flex:none; }
.bm-svg { display:block; flex:none; }
/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hairline);
  transition: padding .25s ease;
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; padding: 18px 28px; max-width: var(--max-w); margin: 0 auto; }
.nav.scrolled .nav-inner { padding-top: 10px; padding-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; }
.brand-mark { width: 26px; height: 26px; background: var(--ink); color: #fff; display: grid; place-items: center; border-radius: var(--radius); font-family: var(--font-mono); font-size: 0.8rem; }
.brand .dot { color: var(--accent); }
.nav-links { display: flex; gap: 28px; align-items: center; }
.nav-links a { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink); opacity: .8; }
.nav-links a:hover { opacity: 1; color: var(--accent); }
.nav .btn { padding: 10px 18px; font-size: 0.85rem; }
.nav-burger { display: none; background: none; border: 1px solid var(--hairline); padding: 8px 10px; cursor: pointer; font-family: var(--font-mono); font-size: .7rem; letter-spacing: .1em; }

/* ---------- hero ---------- */
.hero {
  min-height: calc(100svh - 73px);
  position: relative;
  overflow: hidden;
  background: var(--paper);
}
.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .48; }
.hero-inner {
  min-height: calc(100svh - 73px);
  position: relative;
  z-index: 2;
  padding: clamp(42px, 8vh, 88px) 28px;
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.hero-inner .h-hero { max-width: 16ch; font-size: clamp(3.1rem, 7vw, 5.6rem); letter-spacing: -.052em; }
.hero-inner .lead { margin: 24px auto 32px; max-width: 61ch; color: #353a40; }
.hero-ctas { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* logo / systems strip */
.strip { border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); background: var(--white); overflow: hidden; }
.strip-inner { display: flex; align-items: center; gap: clamp(20px, 4vw, 56px); flex-wrap: wrap; justify-content: center; padding: 26px 28px; max-width: var(--max-w); margin: 0 auto; }
.strip-label { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.chip { font-family: var(--font-mono); font-size: .78rem; letter-spacing: .1em; color: var(--ink); opacity: .55; }

/* ---------- sections ---------- */
.section { padding: var(--pad-section) 0; position: relative; overflow: clip; }
.section > .container { position: relative; z-index: 1; }
.section-dark { background: var(--ink-2); color: var(--bone); }
.section-white { background: var(--white); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 6vw, 90px); align-items: start; }

/* steps */
.step { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 6vw, 80px); align-items: center; padding: clamp(40px, 6vw, 72px) 0; border-top: 1px solid var(--hairline); }
.step:first-of-type { border-top: 0; }
.step p { color: var(--muted); margin-top: 14px; max-width: 48ch; }
.step .visual {
  background: var(--ink-2);
  border: 1px solid var(--hairline-dark);
  border-radius: var(--radius);
  min-height: 280px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(16,20,24,.06);
}

/* fake ops panel used as step visuals */
.panel { position: relative; z-index: 2; font-family: var(--font-mono); font-size: .72rem; color: var(--muted-on-dark); padding: 22px; }
.panel .ph { color: var(--bone); letter-spacing: .1em; margin-bottom: 14px; padding-right: 18px; display:flex; justify-content: space-between; position: relative; }
.panel .ph::after { content: ""; width: 6px; height: 6px; position: absolute; right: 0; top: 5px; border-radius: 50%; background: var(--accent); }
.panel .row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 6px; margin: 0 -6px; border-bottom: 1px solid var(--hairline-dark); }
.panel .ok { color: #62B982; }
.panel .warn { color: var(--accent); }
.panel .val { color: var(--bone); }

/* survive / numbered benefits */
.benefits { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(40px, 7vw, 100px); }
.benefit { padding: 26px 0; border-top: 1px solid var(--hairline); position: relative; }
.benefit .num { font-family: var(--font-display); color: var(--accent); font-weight: 700; font-size: 1.5rem; }
.benefit h3 { margin: 6px 0 8px; }
.benefit p { color: var(--muted); }

/* ---------- agent cards ---------- */
.agents { display: flex; flex-direction: column; gap: 22px; position: relative; }
.agent {
  border-radius: var(--radius);
  padding: clamp(28px, 4vw, 48px);
  display: grid; grid-template-columns: 1.1fr 1fr auto; gap: clamp(24px, 4vw, 56px);
  align-items: start; border: 1px solid var(--hairline);
  background: var(--white); position: relative; overflow: hidden;
  transition: border-color .2s ease;
}
.agent:hover { border-color: color-mix(in srgb, var(--accent) 42%, var(--hairline)); }
.agent.dark { background: var(--ink-2); border-color: var(--hairline-dark); color: var(--bone); }
.agent.dark p { color: var(--muted-on-dark); }
.agent h3 { font-size: clamp(1.4rem, 2.4vw, 2rem); margin-bottom: 12px; }
.agent p { color: var(--muted); max-width: 44ch; }
.caps .cap-label { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; opacity: .6; margin-bottom: 12px; }
.caps li { display: flex; gap: 10px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--hairline); font-size: .94rem; }
.agent.dark .caps li { border-color: var(--hairline-dark); }
.caps li::before { content: "▸"; color: var(--accent); font-size: .7rem; }
.agent-ctas { display: flex; flex-direction: column; gap: 10px; min-width: 190px; }

@media (min-width: 961px) {
  .agents { padding-bottom: 90px; }
  .agent { position: sticky; box-shadow: 0 24px 70px rgba(16,20,24,.11); }
  .agent:nth-child(1) { top: 86px; z-index: 1; }
  .agent:nth-child(2) { top: 98px; z-index: 2; }
  .agent:nth-child(3) { top: 110px; z-index: 3; }
  .agent:nth-child(4) { top: 122px; z-index: 4; }
}

/* quote banner */
.quote-banner { background: var(--ink-2); position: relative; overflow: hidden; }
.quote-banner blockquote { font-family: var(--font-display); font-size: clamp(1.4rem, 3vw, 2.2rem); font-weight: 600; color: var(--bone); max-width: 26ch; line-height: 1.25; }
.quote-banner cite { display: block; margin-top: 22px; font-family: var(--font-mono); font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-on-dark); font-style: normal; }

/* ---------- FAQ ---------- */
.faq-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 clamp(28px, 4vw, 64px); }
.faq-item { border-bottom: 1px solid var(--hairline); transition: border-color .25s ease, padding .25s ease; }
.faq-item:hover, .faq-item.open { border-color: var(--accent); }
.faq-q { width: 100%; background: none; border: 0; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 20px 0; font-family: var(--font-body); font-size: 1rem; font-weight: 500; color: var(--ink); text-align: left; }
.faq-q .ic { font-family: var(--font-mono); color: var(--accent); transition: transform .2s ease; }
.faq-item.open .ic { transform: rotate(45deg); }
.faq-a { max-height: 0; overflow: hidden; transition: max-height .3s ease; color: var(--muted); }
.faq-a p { padding: 0 0 20px; max-width: 60ch; }

/* ---------- CTA cards ---------- */
.cta-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.cta-card { position: relative; border-radius: var(--radius); padding: clamp(28px, 4vw, 48px); min-height: 300px; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; color: var(--bone); }
.cta-card h3 { font-size: clamp(1.5rem, 2.6vw, 2.1rem); margin-bottom: 20px; }
.cta-card.red { background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%); }
.cta-card.ink { background: var(--ink-2); }
.cta-card { transition: filter .2s ease; }
.cta-card:hover { filter: brightness(1.04); }

/* ---------- footer ---------- */
footer { background: var(--ink-2); color: var(--bone); margin-top: 0; }
.footer-inner { max-width: var(--max-w); margin: 0 auto; padding: clamp(48px, 7vw, 90px) 28px 36px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: clamp(28px, 5vw, 70px); }
.footer-desc { color: var(--muted-on-dark); font-size: .92rem; max-width: 34ch; margin-top: 14px; }
.footer-col a { display: flex; gap: 14px; padding: 7px 0; font-family: var(--font-mono); font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-on-dark); }
.footer-col a:hover { color: var(--bone); }
.footer-col a .idx { opacity: .5; }
.footer-bottom { border-top: 1px solid var(--hairline-dark); margin-top: 48px; padding-top: 24px; font-family: var(--font-mono); font-size: .68rem; letter-spacing: .08em; color: var(--muted-on-dark); }

/* ---------- reveals ---------- */
.reveal { opacity: 0; transform: translateY(18px) scale(.995); filter: blur(3px); transition: opacity .65s ease, transform .65s cubic-bezier(.2,.7,.2,1), filter .65s ease; transition-delay: var(--reveal-delay, 0ms); }
.reveal.in { opacity: 1; transform: none; filter: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .step .visual { transform: none; }
  .panel .row, .caps li { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

/* ---------- blog ---------- */
.blog-hero { background: var(--ink-2); position: relative; overflow: hidden; }
.blog-hero .container { position: relative; z-index: 2; padding-top: clamp(70px, 9vw, 120px); padding-bottom: clamp(70px, 9vw, 120px); }
.blog-hero h1 { color: var(--bone); font-size: clamp(2.4rem, 5.5vw, 4.2rem); }
.blog-rays { display: none; }
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.post-card { background: var(--white); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 0 0 24px; display: flex; flex-direction: column; gap: 12px; overflow: hidden; transition: border-color .18s ease, transform .18s ease; }
.post-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.post-card-image, .post-cover { position: relative; isolation: isolate; }
.post-card-image { aspect-ratio: 16 / 9; overflow: hidden; background: var(--ink-2); }
.post-card-image::before, .post-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: #68251f;
  mix-blend-mode: color;
  opacity: .68;
  transition: opacity .55s ease;
}
.post-card-image::after, .post-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: .22;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}
.post-card-image img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(.92) brightness(.72); transform: scale(1.015); transition: transform .7s cubic-bezier(.2,.7,.2,1), filter .7s ease; }
.post-card:hover .post-card-image::before, .post-cover:hover::before { opacity: .16; }
.post-card:hover .post-card-image img, .post-cover:hover img { transform: scale(1.025); filter: grayscale(.18) saturate(.78) contrast(.96) brightness(.86); }
.post-card .meta, .post-card h3, .post-card p, .post-card .read { margin-left: 24px; margin-right: 24px; }
.post-card .meta { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-top: 10px; }
.post-card h3 { font-size: 1.15rem; line-height: 1.3; }
.post-card p { color: var(--muted); font-size: .92rem; flex: 1; }
.post-card .read { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }

article.post { max-width: 760px; margin: 0 auto; padding: clamp(48px, 7vw, 90px) 28px; }
article.post h1 { font-size: clamp(2rem, 4.4vw, 3.1rem); margin-bottom: 18px; }
article.post .post-meta { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 34px; }
.post-cover { margin: 0 0 34px; aspect-ratio: 16 / 9; overflow: hidden; border: 1px solid var(--hairline); background: var(--ink-2); }
.post-cover img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(.92) brightness(.72); transform: scale(1.015); transition: transform .7s cubic-bezier(.2,.7,.2,1), filter .7s ease; }
article.post h2 { font-size: clamp(1.35rem, 2.4vw, 1.8rem); margin: 44px 0 14px; }
article.post h3 { font-size: 1.15rem; margin: 30px 0 10px; }
article.post p { margin: 0 0 18px; color: #2A2F36; }
article.post ul, article.post ol { margin: 0 0 18px 20px; color: #2A2F36; }
article.post ul { list-style: disc; }
article.post li { margin-bottom: 8px; }
article.post .tldr { background: var(--white); border-left: 3px solid var(--accent); padding: 18px 22px; margin-bottom: 30px; color: #2A2F36; }
article.post table { width: 100%; border-collapse: collapse; margin: 0 0 22px; font-size: .92rem; }
article.post th, article.post td { border: 1px solid var(--hairline); padding: 10px 12px; text-align: left; }
article.post th { background: var(--paper-2); font-family: var(--font-mono); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; }
.post-cta { background: var(--ink-2); border-radius: var(--radius); padding: 32px; margin-top: 48px; color: var(--bone); }
.post-cta p { color: var(--muted-on-dark) !important; }

/* ---------- case studies ---------- */
.results-index { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--hairline); border: 1px solid var(--hairline); margin-bottom: 34px; }
.results-index a { min-height: 132px; padding: 20px; background: var(--white); display: flex; flex-direction: column; transition: background .2s ease, color .2s ease; }
.results-index a:hover { background: var(--ink-2); color: var(--bone); }
.results-index span { font-family: var(--font-mono); font-size: .66rem; color: var(--accent); letter-spacing: .12em; }
.results-index strong { font-family: var(--font-display); font-size: 1.02rem; margin-top: auto; }
.results-index small { color: var(--muted); font-size: .76rem; }
.results-index a:hover small { color: var(--muted-on-dark); }
.log-card { background: var(--white); border: 1px solid var(--hairline); border-top: 3px solid var(--ink); border-radius: var(--radius); padding: clamp(28px, 4vw, 48px); margin-bottom: 26px; scroll-margin-top: 94px; }
.log-card .log-head { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; }
.result-label { font-family: var(--font-mono); font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-top: 24px; }
.log-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); font-family: var(--font-mono); font-size: .72rem; background: var(--ink-2); color: var(--bone); border-radius: var(--radius); padding: 0; margin: 8px 0 22px; overflow: hidden; }
.log-stats .ls-row { min-height: 116px; display: flex; flex-direction: column; justify-content: space-between; gap: 18px; padding: 18px; border-right: 1px solid var(--hairline-dark); }
.log-stats .ls-row:last-child { border-right: 0; }
.log-stats .ls-val { color: #fff; font-size: .82rem; line-height: 1.35; }
.failed { border-left: 3px solid var(--accent); padding: 14px 18px; background: var(--paper-2); margin-top: 18px; }
.failed .f-label { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.placeholder-note { background: #FFF7E6; border: 1px solid #E8D9A8; padding: 16px 20px; border-radius: var(--radius); font-size: .9rem; margin-bottom: 34px; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .split, .step, .benefits, .faq-grid, .cta-cards, .footer-grid { grid-template-columns: 1fr; }
  .agent { grid-template-columns: 1fr; }
  .agent-ctas { flex-direction: row; }
  .post-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .nav-links { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--paper); border-bottom: 1px solid var(--hairline); flex-direction: column; padding: 18px 28px; gap: 16px; align-items: flex-start; }
  .nav-links.open { display: flex; }
  .nav-burger { display: block; }
  .post-grid { grid-template-columns: 1fr; }
  .hero, .hero-inner { min-height: calc(100svh - 73px); }
  .hero-inner { padding: 42px 20px 54px; }
  .hero-inner .h-hero { font-size: clamp(2.8rem, 13vw, 4rem); }
  .hero-inner .lead { margin-top: 20px; margin-bottom: 26px; }
  .results-index { grid-template-columns: 1fr; }
  .results-index a { min-height: 96px; }
  .log-stats { grid-template-columns: 1fr 1fr; }
  .log-stats .ls-row { min-height: 106px; border-bottom: 1px solid var(--hairline-dark); }
  .agent-ctas { flex-direction: column; min-width: 0; }
  .agent-ctas .btn { width: 100%; justify-content: center; }
}
@media (max-height: 720px) {
  .hero-inner { padding-top: 34px; padding-bottom: 44px; }
  .hero-inner .lead { margin-top: 16px; margin-bottom: 22px; }
}
@media (min-width: 961px) and (max-height: 720px) {
  .hero-inner .h-hero { font-size: clamp(3.4rem, 5.6vw, 4.7rem); }
  .hero-inner .lead { font-size: .98rem; line-height: 1.5; margin-top: 14px; margin-bottom: 18px; }
}
