/*
  SogaStudio: "Try us out" under the E3 desk.
  The menu drives the desk above it: a lane number redraws the desk as
  that lane's view, 6 re-maps the five lanes to another industry.
  Load AFTER soga-tokens.css and soga-components.css. Home page only.

  A scripted intake that looks like a chat. It is not a live AI and makes
  no model calls; the one real step is the 6-digit code that verifies the
  visitor's email (or, once Twilio approves, their phone).
  The blinking block cursor in the first field is the "chat" cue Mike
  asked for. prefers-reduced-motion: no blink, no typing dots.
*/

/* ─── Placement under the hero graphic ────────────────────────────────
   Under 1024px: the box sits alone below the panel, with more air and a
   terracotta top rule so it reads as its own thing. 1024px and up: the
   box and the lede sit side by side under the panel, the box on the
   right at a chat-friendly width. DOM order is unchanged: the box comes
   first for keyboard and screen readers. */
.hero-ask { margin-top: var(--space-3); }   /* on top of the panel's own 48px */

.intake {
  margin: 0 0 var(--space-7);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-top: 3px solid var(--mark);
  border-radius: var(--radius-2);
  box-shadow: 0 18px 40px -28px rgba(20, 18, 16, 0.45);
  max-width: none;
}

@media (min-width: 1024px) {
  .hero-ask {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 600px);
    grid-template-areas: "lede ask";
    gap: var(--space-8);
    align-items: start;
    margin-top: var(--space-4);
  }
  .hero-ask > .intake { grid-area: ask; margin: 0; }
  .hero-ask > .lede { grid-area: lede; margin: 0; padding-top: var(--space-2); }
}

.ik-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 2px 16px;
  padding: 14px 22px 12px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12px; font-weight: var(--fw-medium);
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted);
}
.ik-head b { font-weight: var(--fw-medium); color: var(--fg); display: inline-flex; align-items: center; gap: 8px; }
.ik-head b::before {
  content: ""; width: 7px; height: 7px; border-radius: var(--radius-dot); background: var(--mark);
}
.ik-head .ik-preview { color: var(--accent); }

/* The conversation */
.ik-log {
  list-style: none; margin: 0; padding: 18px 22px 4px; max-width: none;
  display: flex; flex-direction: column; gap: 10px;
}
.ik-log:empty { display: none; }
.ik-log > li { margin: 0; max-width: 46em; font-size: 16px; line-height: 1.5; }
.ik-bot { color: var(--fg); padding-left: 16px; position: relative; }
.ik-bot::before {   /* the brand dot marks the desk's lines */
  content: ""; position: absolute; left: 0; top: calc((1.5em - 6px) / 2);
  width: 6px; height: 6px; border-radius: var(--radius-dot); background: var(--mark);
}
.ik-bot q { quotes: "\201C" "\201D"; color: var(--muted); }
.ik-bot ol { margin: 6px 0 2px 20px; max-width: none; }
.ik-bot ol li { margin: 0 0 3px; font-size: 15px; line-height: 1.45; color: var(--fg); }
.ik-bot a { font-weight: var(--fw-medium); white-space: nowrap; }
.ik-me {
  align-self: flex-end;
  max-width: 85%;
  background: var(--soga-paper-2);
  color: var(--fg);
  padding: 8px 14px;
  border-radius: var(--radius-2);
  overflow-wrap: anywhere;
}
.ik-ok { color: var(--soga-success); }
.ik-err { color: var(--soga-error); }

/* Typing dots */
.ik-typing { display: inline-flex; gap: 5px; padding: 8px 0 8px 16px; }
.ik-typing i {
  width: 6px; height: 6px; border-radius: var(--radius-dot); background: var(--subtle);
  animation: ik-bounce 1s infinite ease-in-out;
}
.ik-typing i:nth-child(2) { animation-delay: .15s; }
.ik-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes ik-bounce { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }

/* The human check (Cloudflare Turnstile). Invisible unless Cloudflare
   asks the visitor to tick a box; then it shows here, outside the reply
   area, because the reply area is hidden while a code is being sent. */
.ik-human { padding: 4px 22px 0; }
.ik-human:empty { display: none; }

/* The reply area */
.ik-form { padding: 12px 22px 18px; }
.ik-form[hidden] { display: none; }
.ik-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.ik-chips:empty { display: none; }
.ik-chip {
  font-family: var(--font-sans); font-size: 14px; font-weight: var(--fw-medium);
  color: var(--fg); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-1);
  padding: 8px 14px; cursor: pointer;
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.ik-chip:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.ik-chip:disabled { color: var(--subtle); border-style: dashed; cursor: default; }
.ik-chip small { font-weight: var(--fw-regular); color: var(--subtle); margin-left: 6px; }

/* The numbered menu, on one line (Mike 10-15: "1 Sales · 2 Production …
   6 Reclassify my organization"), the number in a terracotta circle like
   the desk's. It wraps on a narrow screen. The un-numbered next steps
   (drill deeper, talk to us) start on their own line. */
.ik-chips.is-menu .ik-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 6px;
  font-size: 15px; line-height: 1.3;
}
.ik-chips.is-menu .ik-chip.is-next { padding: 6px 12px; border-color: var(--mark); }
.ik-br { flex-basis: 100%; height: 0; }
.ik-n {
  flex: none; display: grid; place-items: center;
  width: 24px; height: 24px; border-radius: var(--radius-dot);
  background: var(--mark); color: var(--soga-ink);
  font-family: var(--font-mono); font-size: 12px; font-weight: var(--fw-medium);
}

.ik-row { display: flex; gap: 10px; align-items: stretch; }
.ik-row[hidden] { display: none; }
.ik-field { position: relative; flex: 1; min-width: 0; }
.ik-field input { caret-color: var(--mark); height: 100%; min-height: 48px; }
.ik-row .btn { flex: none; min-height: 48px; }

/* The blinking block cursor: shown while the field is empty and not
   focused; once the visitor clicks in, the real caret takes over. */
.ik-cursor {
  position: absolute; left: 15px; top: 50%;
  width: 9px; height: 20px; margin-top: -10px;
  background: var(--mark);
  pointer-events: none;
  animation: ik-blink 1.06s steps(1) infinite;
}
@keyframes ik-blink { 50% { opacity: 0; } }
.ik-field:not(.has-cursor) .ik-cursor,
.ik-field input:focus ~ .ik-cursor,
.ik-field input:not(:placeholder-shown) ~ .ik-cursor { display: none; }

/* SMS consent: an unchecked standalone checkbox, never pre-ticked */
.ik-consent { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 12px; max-width: 46em; }
.ik-consent[hidden] { display: none; }
.ik-consent input { flex: none; width: 18px; height: 18px; min-height: 0; margin-top: 3px; padding: 0; -webkit-appearance: checkbox; appearance: auto; accent-color: var(--accent); }
.ik-consent label {
  margin: 0; font-family: var(--font-sans); font-size: 14px; font-weight: var(--fw-regular);
  letter-spacing: 0; text-transform: none; color: var(--muted); line-height: 1.45;
}

.ik-hint { margin: 8px 0 0; font-size: 13px; color: var(--soga-error); max-width: none; }
.ik-hint:empty { display: none; }

.ik-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.ik-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* The one disclosure line, subtle, at the bottom (Mike 10-12 rule) */
.ik-note {
  margin: 0; padding: 0 22px 14px; max-width: none;
  font-size: 12px; color: var(--subtle);
}

/* ─── The desk, driven by the menu ────────────────────────────────────
   The static desk (five lanes, grey bars) is what a page without script
   shows. With script, each lane name becomes a button, and the desk
   redraws as one lane's view: done today, queued, needs your yes, one
   line on what agents do there. All sample data. */
.e3-panel button {
  font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0;
  cursor: pointer; text-align: left;
}
.e3-panel button:disabled { cursor: default; }
.e3-panel button:focus-visible { outline: 2px solid var(--soga-terracotta-warm); outline-offset: 3px; }
.e3 .x-go { font-size: 16px; font-weight: var(--fw-medium); color: var(--soga-on-dark); line-height: 1.25; }
.e3 .x-go:not(:disabled)::after { content: " \25B8"; color: var(--soga-terracotta-warm); }
.e3 .x-go:not(:disabled):hover { color: var(--soga-terracotta-warm); }

.e3 .x-lv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px 28px; }
.e3 .x-grp > .x-mono { display: block; margin-bottom: 10px; color: var(--soga-on-dark-3); }
.e3 .x-grp.is-yes > .x-mono { color: var(--soga-terracotta-warm); }
.e3 .x-rows { display: flex; flex-direction: column; gap: 6px; }
.e3 .x-r {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  padding: 8px 10px 8px 14px;
  border-left: 6px solid var(--soga-paper);
  font-size: 14px; line-height: 1.35; color: var(--soga-on-dark);
}
.e3 .x-grp.is-q .x-r { border-left-color: var(--soga-dark-line); color: var(--soga-on-dark-3); }
.e3 .x-grp.is-yes .x-r { border-left-color: var(--soga-terracotta); font-weight: var(--fw-medium); }
.e3 .x-r.is-none { border-left-color: var(--soga-dark-line); color: var(--soga-on-dark-3); font-weight: var(--fw-regular); }
.e3 .x-r .x-num { width: 22px; height: 22px; font-size: 11px; box-shadow: none; }
.e3 .x-flag { color: var(--soga-terracotta-warm); }
.e3 .x-more { padding: 2px 0 0 20px; font-size: 11px; color: var(--soga-on-dark-3); }
.e3 .x-deeper {
  margin-left: auto;
  font-family: var(--font-mono); font-size: 11px; font-weight: var(--fw-medium);
  letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap;
  color: var(--soga-terracotta-warm);
  border: 1px solid currentColor; border-radius: var(--radius-1);
  padding: 4px 8px 3px;
}
.e3 .x-deeper:not(:disabled):hover { background: var(--soga-terracotta); color: var(--soga-ink); border-color: var(--soga-terracotta); }
.e3 .x-deeper:disabled { opacity: .55; }
.e3 .x-insight {
  max-width: none; margin: 22px 0 0; padding-top: 16px; border-top: 1px dashed #6a625a;
  font-size: 15px; line-height: 1.5; color: var(--soga-on-dark);
}
.e3 .x-insight .x-mono { display: block; margin-bottom: 4px; color: var(--soga-on-dark-3); }
.e3 .x-nav { margin: 14px 0 0; max-width: none; }
.e3 .x-back {
  font-family: var(--font-mono); font-size: 11px; font-weight: var(--fw-medium);
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--soga-on-dark-3);
}
.e3 .x-back:not(:disabled):hover { color: var(--soga-terracotta-warm); }
.e3 .x-back:disabled { visibility: hidden; }

/* ─── Contact: the other door ─────────────────────────────────────────
   Mike 10-15: "Prefer to do things the old-fashioned way? Reach out."
   A plain band on the paper-2 ground, no menu and no chat, so a visitor
   sees two doors: try it at the top, or just talk to us here. */
#contact.old-way { background: var(--soga-paper-2); }
#contact.old-way h2 { margin-top: 0; }

@media (max-width: 860px) {
  .hero-ask { margin-top: var(--space-5); }   /* the panel gives 24px here */
  .intake { margin: 0 0 var(--space-6); }
  .ik-head { padding: 10px 14px 9px; font-size: 10px; }
  .ik-log { padding: 14px 14px 2px; }
  .ik-log > li { font-size: 15px; }
  .ik-bot ol li { font-size: 14px; }
  .ik-human { padding: 4px 14px 0; }
  .ik-form { padding: 10px 14px 14px; }
  .ik-chips { gap: 6px; }
  .ik-chips.is-menu .ik-chip { font-size: 14px; }
  .ik-row .btn { padding: 0 16px; }
  .ik-note { padding: 0 14px 12px; }

  .e3 .x-go { font-size: 13px; line-height: 1.2; }
  .e3 .x-col > .x-go { flex: 0 0 9em; }
  .e3 .x-lv { grid-template-columns: 1fr; gap: 12px; }
  .e3 .x-grp > .x-mono { font-size: 10px; margin-bottom: 6px; }
  .e3 .x-rows { gap: 4px; }
  .e3 .x-r { padding: 6px 8px 6px 10px; border-left-width: 4px; font-size: 13px; line-height: 1.3; }
  .e3 .x-r .x-num { width: 18px; height: 18px; font-size: 10px; }
  .e3 .x-more { padding-left: 14px; font-size: 10px; }
  .e3 .x-deeper { font-size: 10px; }
  .e3 .x-insight { margin-top: 14px; padding-top: 10px; font-size: 14px; }
  .e3 .x-insight .x-mono { font-size: 10px; }
  .e3 .x-nav { margin-top: 10px; }
  .e3 .x-back { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .ik-cursor, .ik-typing i { animation: none; }
}
