/* =========================================================
   AskINTO case study: this page's own layer.
   Builds on ../../css/style.css (portfolio tokens, fonts) and ../into/case.css (the shared
   case-study frame: top bar, rail, skipping stone, dusk hero, section heads, cards, ending).
   Everything here uses those same tokens: --text, --text-2, --muted, --case, --accent-ink,
   --border, --surface, --shadow, --font-display (Fraunces), --font-body (Inter).
   ========================================================= */

/* ---------- the design's wide figures sit inside the shared 1080px column ---------- */
.case [data-wide] { width: 100% !important; }
.case [data-wide] > div { max-width: none !important; }
.case-main h3 { font-family: inherit; }   /* inline styles decide; this just stops style.css's display-font default leaking in */
.case-main [style*="var(--font-display)"] { font-weight: 500 !important; letter-spacing: -0.01em; }

/* cards: the same lift and shadow as the INTO cards */
.case-main [style*="background: #FFFDF9"][style*="border: 1px"],
.case-main [style*="background: #fffdf9"][style*="border: 1px"] { box-shadow: var(--shadow); }

/* ---------- the before / after that opens the page, where the lake meets the paper ---------- */
.ask-intro { position: relative; z-index: 3; max-width: var(--wide); margin: calc(-1 * clamp(90px, 14vh, 140px)) auto 0; padding: 0 var(--gutter); }
.ask-ba { margin: 0; }
.ask-ba > div { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)) !important; }
@media (min-width: 1180px) { .ask-intro { margin-left: auto; } }

/* ---------- hero chats: the reply types in ---------- */
.ai-typing { align-self: flex-start; display: inline-flex; gap: 4px; padding: 12px 14px; border-radius: 12px 12px 12px 2px; border: 1px solid var(--border); background: #fff; }
.ai-typing i { width: 6px; height: 6px; border-radius: 50%; background: #b9b1a8; animation: ai-dot 1s ease-in-out infinite; }
.ai-typing i:nth-child(2) { animation-delay: .15s; } .ai-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes ai-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }
.ai-pending { display: none !important; }
.ai-arrive { animation: popin .35s var(--ease-out) both; }
.ai-arrive ol li { animation: popin .35s var(--ease-out) both; }
.ai-arrive ol li:nth-child(2) { animation-delay: .12s; } .ai-arrive ol li:nth-child(3) { animation-delay: .24s; }
.ai-arrive ol li:nth-child(4) { animation-delay: .36s; } .ai-arrive ol li:nth-child(5) { animation-delay: .48s; }
.ai-ping { animation: ai-ping 1.6s ease-out 2; border-radius: 2px; }
@keyframes ai-ping { 0% { box-shadow: 0 0 0 2px rgba(197, 106, 55, .6); } 50% { box-shadow: 0 0 0 6px rgba(197, 106, 55, .15); } 100% { box-shadow: 0 0 0 2px rgba(197, 106, 55, .6); } }

/* ---------- user story: six panels arrive one after another ---------- */
.ai-js [data-story] > li { opacity: 0; transform: translateY(14px); transition: opacity .5s var(--ease-out), transform .6s var(--ease-out); }
.ai-js [data-story].is-in > li { opacity: 1; transform: none; }
.ai-js [data-story] > li > div:first-child { transition: transform .3s var(--ease-out), box-shadow .3s; }
.ai-js [data-story] > li:hover > div:first-child { transform: translateY(-4px) rotate(-.4deg); box-shadow: 4px 6px 0 rgba(34, 29, 43, .9); }

/* ---------- where I came in: the steps light up in order ---------- */
.ai-js .ai-came-in li { opacity: .25; transition: opacity .5s var(--ease-out); }
.ai-js .ai-came-in.is-in li { opacity: 1; }
.ai-came-in { position: relative; }
.ai-came-in::before { content: ""; position: absolute; left: -2px; top: 0; width: 2px; height: 0; background: var(--case); transition: height 1.6s var(--ease-out); }
.ai-came-in.is-in::before { height: 100%; }

/* ---------- audit: the problems pop up one by one; the email parts light up ---------- */
.ai-js .ai-note { opacity: 0; transform: translateY(-4px); transition: opacity .35s var(--ease-out), transform .4s var(--ease-out); }
.ai-js .ai-note > span:first-child { transform: scale(0); transition: transform .4s cubic-bezier(.34, 1.56, .64, 1); }
.ai-js .is-in .ai-note { opacity: 1; transform: none; }
.ai-js .is-in .ai-note > span:first-child { transform: scale(1); }
.ai-email-part { padding: 4px 6px; margin: -4px -6px; border-radius: 8px; transition: background .2s; }
.ai-email-part.is-lit { background: var(--case-soft); }
.ai-email-key { cursor: default; border-radius: 4px; transition: color .2s; }
.ai-email-key:hover, .ai-email-key:focus-visible, .ai-email-key.is-lit { color: var(--accent); }

/* ---------- testing: the "6 of 6" dots fill in ---------- */
.ai-js .ai-ro-dots > span { transform: scale(0); transition: transform .35s cubic-bezier(.34, 1.56, .64, 1); }
.ai-js .is-in .ai-ro-dots > span { transform: scale(1); }

/* ---------- the plan: the four phase bars grow in order ---------- */
.ai-phase-bar { transform-origin: left center; }
.ai-js .ai-phase-bar { transform: scaleX(0); transition: transform .8s var(--ease-out); }
.ai-js .is-in .ai-phase-bar { transform: scaleX(1); }

/* ---------- eight principles ---------- */
.ai-principle { background: var(--surface); padding: 24px 22px; display: flex; flex-direction: column; gap: 14px; min-height: 150px; transition: background .25s; }
.ai-pn { font-family: var(--font-display); font-weight: 500; font-size: 30px; line-height: 1; color: var(--case); transition: transform .3s var(--ease-out); }
.ai-pt { font-size: 16px; line-height: 1.45; font-weight: 600; color: var(--text); }
.ai-principle:hover { background: var(--case-soft); }
.ai-principle:hover .ai-pn { transform: translateX(4px); }
.ai-js .ai-principles .ai-principle { opacity: 0; transform: translateY(10px); transition: opacity .45s var(--ease-out), transform .5s var(--ease-out), background .25s; }
.ai-js .ai-principles.is-in .ai-principle { opacity: 1; transform: none; }

/* ---------- before / after toggle: the same pill switch as the INTO case study ---------- */
.ai-seg { position: relative; display: inline-grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 20px; }
.ai-seg button { position: relative; z-index: 1; min-width: 110px; min-height: 42px; font: inherit; font-weight: 600; cursor: pointer; border-radius: 999px; border: 0; background: none; color: var(--muted); transition: color .25s; }
.ai-seg button[aria-pressed="true"] { color: var(--paper); }
.ai-seg-thumb { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 999px; background: var(--text); transition: transform .45s var(--ease-out), background .3s; }
.ai-seg.is-after .ai-seg-thumb { transform: translateX(100%); background: var(--case); }
.ai-try { position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); padding: 3px 9px; border-radius: 999px; background: var(--case); color: #fff; font-size: 0.68rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; pointer-events: none; animation: ai-bob 2.2s ease-in-out infinite; }
.ai-try::after { content: ""; position: absolute; left: 50%; top: 100%; margin-left: -4px; border: 4px solid transparent; border-top-color: var(--case); }
.ai-seg.is-tried .ai-try { display: none; }
@keyframes ai-bob { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, -3px); } }
.ai-bio-chat { border-radius: 14px !important; }
.ai-bio-chat.is-after { border-color: var(--case) !important; }
.ai-msg { max-width: 85%; padding: 10px 14px; color: var(--text-2); animation: popin .3s ease both; }
.ai-msg-bot { align-self: flex-start; border-radius: 12px 12px 12px 2px; background: #fff; border: 1px solid #efcfb9; }
.ai-msg-ok { background: #f6faf9; border-color: #cde3dd; }
.ai-msg-user { align-self: flex-end; border-radius: 12px 12px 2px 12px; background: #ede6db; border: 1px solid #ede6db; }
.ai-bio-note { display: flex; gap: 12px; font-size: 16px; line-height: 1.6; color: var(--text-2); animation: popin .3s ease both; }
.ai-bio-note span { flex: none; font-weight: 600; }

/* ---------- the program-search tree ---------- */
.ai-branch { display: flex; align-items: center; }
.ai-branch-line { width: 22px; height: 2px; background: #b9b1a8; flex: none; transition: background .2s; }
.ai-branch button { flex: 1; display: flex; align-items: center; gap: 12px; text-align: left; font: inherit; font-size: 14px; line-height: 1.4; padding: 12px 14px; border-radius: 12px; cursor: pointer; border: 1px solid var(--border); background: var(--surface); color: var(--text); transition: background .2s ease, color .2s ease, border-color .2s, transform .2s var(--ease-out); }
.ai-branch button:hover { border-color: rgba(15, 111, 99, .45); transform: translateX(3px); }
.ai-branch button[aria-pressed="true"] { background: var(--case); border-color: var(--case); color: #fff; transform: none; }
.ai-branch.is-on .ai-branch-line { background: var(--case); }
.ai-branch-k { font-size: 11px; font-weight: 600; letter-spacing: .08em; opacity: .7; }
.ai-branch-l { flex: 1; }
.ai-branch-r { font-size: 12px; opacity: .75; }
.ai-tree-body > * { animation: popin .3s ease both; }
.ai-tree-body > :nth-child(2) { animation-delay: .1s; } .ai-tree-body > :nth-child(3) { animation-delay: .2s; } .ai-tree-body > :nth-child(n+4) { animation-delay: .3s; }
.ai-tq-user { align-self: flex-end; max-width: 85%; padding: 10px 14px; border-radius: 12px 12px 2px 12px; background: #ede6db; color: #1f5a8a; }
.ai-tq-bot { align-self: flex-start; max-width: 94%; padding: 12px 14px; border-radius: 12px 12px 12px 2px; border: 1px solid #cde3dd; background: #f6faf9; color: var(--text-2); display: flex; flex-direction: column; gap: 12px; }
.ai-tq-bot ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 12px; }
.ai-tq-item { display: flex; flex-direction: column; gap: 1px; }
.ai-tq-form { display: flex; flex-direction: column; gap: 8px; }
.ai-tq-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.ai-tq-form input { font: inherit; font-size: 14px; padding: 8px 10px; border: 1px solid #b9b1a8; border-radius: 6px; background: #fff; }
.ai-tq-submit { align-self: flex-start; padding: 7px 14px; border-radius: 6px; border: 1px solid #b9b1a8; background: #fff; color: #1f5a8a; font-size: 13px; font-weight: 600; }
.ai-chips-label { font-size: 11px; color: var(--muted); margin-top: 4px; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-chips span { padding: 6px 10px; border-radius: 999px; border: 1px solid #cde3dd; font-size: 12px; color: var(--case); }

/* ---------- design board: open, zoom, drag ---------- */
/* optional and quiet: a note and a regular (outlined) button, not a call to action */
.ai-board { margin-top: 28px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.ai-board-note { margin: 0; color: var(--muted); font-size: 0.95rem; }
/* the board opens in place, inside the reading column, about a screen tall */
.ai-lightbox { position: relative; margin-top: 16px; height: min(72vh, 680px); display: flex; flex-direction: column; border-radius: 14px; overflow: hidden; background: #0f0e16; border: 1px solid var(--border); }
.ai-lightbox[hidden] { display: none; }
.ai-lb-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; color: var(--paper); font-size: 13px; }
.ai-lb-title { font-weight: 600; margin-right: auto; }
.ai-lb-hint { opacity: .6; margin-right: 8px; }
.ai-lb-bar button { min-width: 40px; height: 36px; padding: 0 10px; border: 1px solid rgba(255, 255, 255, .2); border-radius: 999px; background: rgba(255, 255, 255, .06); color: #fff; font: inherit; font-size: 15px; cursor: pointer; }
.ai-lb-bar button:hover { background: rgba(255, 255, 255, .16); }
.ai-lb-stage { position: relative; flex: 1; overflow: hidden; cursor: grab; touch-action: none; }
.ai-lb-stage.is-dragging { cursor: grabbing; }
.ai-lb-stage img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; user-select: none; -webkit-user-drag: none; border-radius: 4px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6); }
@media (max-width: 640px) { .ai-lb-hint { display: none; } }

/* ---------- feedback ---------- */
.ai-fb { width: 32px; height: 32px; border-radius: 50%; cursor: pointer; border: 1px solid var(--border); background: #fff; color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; transition: background .2s, color .2s, border-color .2s, transform .2s cubic-bezier(.34, 1.56, .64, 1); }
.ai-fb:hover { transform: scale(1.1); }
.ai-fb[data-fb="up"][aria-pressed="true"] { background: var(--case); border-color: var(--case); color: #fff; animation: ai-pop .4s cubic-bezier(.34, 1.56, .64, 1); }
.ai-fb[data-fb="down"][aria-pressed="true"] { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; animation: ai-pop .4s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes ai-pop { 0% { transform: scale(.8); } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }
[data-fb-reasons]:not([hidden]) { display: flex; animation: popin .25s ease both; }
[data-fb-form]:not([hidden]) { display: flex; animation: popin .25s ease both; }
.ai-reason { font: inherit; padding: 6px 10px; border-radius: 999px; cursor: pointer; font-size: 12px; border: 1px solid var(--border); background: #fff; color: var(--text-2); transition: background .2s, color .2s; }
.ai-reason[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: #fff; }
[data-fb-send] { background: var(--text) !important; }
.ai-fb-note { margin: 0; padding-left: 16px; font-size: 12px; color: var(--case); min-height: 1em; }
.ai-fb-note:empty { display: none; }

/* ---------- outcome bar: the stripes drift once it's shrunk ---------- */
[data-bar] + div { background-size: 17px 17px !important; }
.ai-bar-done [data-bar] + div { animation: ai-stripes 6s linear infinite; }
@keyframes ai-stripes { to { background-position: 170px 0; } }

/* ---------- small screens: the design's two-column blocks stack ---------- */
@media (max-width: 940px) {
  .ai-bio-grid, #changed [style*="minmax(0, 520px)"], #changed [style*="minmax(320px, 440px)"] { grid-template-columns: 1fr !important; }
  #changed [style*="minmax(320px, 440px)"] { padding: 18px !important; }
}
@media (max-width: 640px) {
  #problem [style*="minmax(220px, 300px)"] { grid-template-columns: 1fr !important; }
  #problem [style*="minmax(220px, 300px)"] > div:first-child { border-right: 0 !important; border-bottom: 1px solid var(--border); }
  .ask-ba > div { grid-template-columns: 1fr !important; }
}
@media (min-width: 1240px) { .case [data-story] { grid-template-columns: repeat(6, minmax(0, 1fr)) !important; } }
@media (max-width: 560px) { .case [data-story] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } }

/* the persona's four facts read as a tidy 2 × 2 */
#problem [style*="minmax(200px, 1fr)"] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
@media (max-width: 640px) { #problem [style*="minmax(200px, 1fr)"] { grid-template-columns: 1fr !important; } }

/* user story: each panel carries its step number on its top-left corner, like a numbered comic panel,
   so the title and sentence underneath line up on one clean edge */
.case [data-story] { counter-reset: story; }
.case [data-story] > li { position: relative; counter-increment: story; }
.case [data-story] > li::before {
  content: counter(story); position: absolute; z-index: 2; left: -9px; top: -9px;
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent); font-size: 0.8rem; font-weight: 600;
  box-shadow: 0 0 0 3px var(--bg);
}

/* ---------- on the night background ---------- */
/* the three audit themes: the one shown below is a solid peach pill, the others quiet outlines (not toggles) */
.ai-themes { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-theme { padding: 8px 14px; border-radius: 999px; font-size: 14px; color: var(--muted); border: 1px solid var(--border); }
.ai-theme.is-shown { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.ai-themes-note { margin: 12px 0 44px; font-size: 14px; color: var(--muted); }
/* "The old bot" / "How an RO replies": cream and peach, like the Before / After pair at the top */
.ai-label { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; font-weight: 600; padding: 6px 12px; border-radius: 999px; background: #ede6db; color: #3f3747; }
.ai-label-good { background: var(--accent); color: var(--on-accent); }
/* callouts: a soft peach tint with a peach edge, like "The stakes" in the INTO case study */
.ai-callout { background: var(--peach-soft); border-left: 3px solid var(--accent); color: var(--text); }
.case-main :has(> .ai-callout) { border-color: var(--border) !important; }
/* each finding: the RO quote and "What I saw" side by side, "So we decided" across the full width below
   (three in a row left an empty grey cell whenever the row wrapped) */
#found li[style*="minmax(240px, 1fr)"] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
#found li[style*="minmax(240px, 1fr)"] > :nth-child(3) { grid-column: 1 / -1; }
@media (max-width: 640px) { #found li[style*="minmax(240px, 1fr)"] { grid-template-columns: 1fr !important; } }
/* built to / what happened instead / the real problem: one row of three on wide screens, stacked below that
   (wrapping two-and-one left an empty cell) */
.case .ai-outcome-row { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
.case .ai-outcome-row > * { border-left: 0 !important; }
.case .ai-outcome-row > * + * { border-left: 1px solid rgba(34, 29, 43, 0.12) !important; }
@media (max-width: 900px) {
  .case .ai-outcome-row { grid-template-columns: 1fr !important; }
  .case .ai-outcome-row > * + * { border-left: 0 !important; border-top: 1px solid rgba(34, 29, 43, 0.12); }
}
