/* Case study page: summary, context/challenge/solution/result cards, interactive quote-comparison demo */

/* Summary */
.cs-hero { padding-top: 56px; padding-bottom: 72px; border-bottom: 1px solid var(--line); background: var(--surface); }
.cs-back { display: inline-block; font-family: var(--mono); font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); text-decoration: none; margin-bottom: 40px; }
.cs-back:hover { color: var(--accent); }
.cs-head { display: grid; gap: 22px; max-width: 920px; }
.cs-head h1 { font-size: clamp(38px, 5.2vw, 66px); line-height: 1.04; }
.cs-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 56px; }
.kpi { border: 1px solid var(--line); background: var(--bg); padding: 26px 28px; display: grid; gap: 10px; align-content: start; }
.kpi > b, .ba b { font-family: var(--display); font-weight: var(--h-weight); letter-spacing: -.04em; font-size: clamp(40px, 4.4vw, 56px); line-height: 1; color: var(--ink); }
.k-lbl { font-family: var(--mono); font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.k-sub { font-size: 15px; color: var(--muted); }
.ba { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-top: 0; }
.kpi > b { padding: 2px 0 6px; }
.ba s { font-family: var(--display); font-size: clamp(22px, 2.2vw, 28px); color: var(--faint); text-decoration-thickness: 2px; }
.ba .arr { color: var(--faint); font-size: 22px; }
.ba b { background: var(--accent); color: #fff; padding: 2px 10px 6px; }

/* Framework cards */
.cs-sec { padding-block: 56px 0; }
.cs-sec.cs-last { padding-bottom: 112px; }
.cs-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.cs-card { border: 1px solid var(--line); background: var(--surface); padding: 34px 36px 36px; display: grid; gap: 18px; align-content: start; }
.cs-card h2 { font-size: clamp(28px, 3vw, 38px); line-height: 1.05; }
.cs-card ul, .cs-card ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; font-size: 17px; }
.cs-card ul li { padding-left: 22px; position: relative; }
.cs-card ul li::before { content: ""; position: absolute; left: 0; top: .62em; width: 10px; height: 2px; background: var(--accent); }
.sol-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 40px; align-items: start; }
.can { border-left: 1px solid var(--line); padding-left: 32px; display: grid; gap: 14px; }
.can ol { counter-reset: c; }
.can ol li { counter-increment: c; display: flex; gap: 12px; align-items: baseline; font-weight: 500; }
.can ol li::before { content: counter(c, decimal-leading-zero); font-family: var(--mono); font-size: 12px; color: var(--faint); font-weight: 400; }
.res-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.res-grid > div { border-top: 1px solid var(--line); padding-top: 18px; display: grid; gap: 12px; align-content: start; }
.res-txt { font-size: 19px; line-height: 1.4; font-weight: 500; max-width: 26ch; }
.res-next { display: grid; gap: 8px; font-size: 17px; max-width: 70ch; border-top: 1px solid var(--line); padding-top: 18px; margin: 4px 0 0; }
.cs-card ol.steps-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.steps-grid li { border-top: 2px solid var(--accent); padding-top: 18px; display: grid; gap: 10px; align-content: start; }
.steps-grid h3 { font-size: 19px; line-height: 1.2; margin: 0; }
.steps-grid p { font-size: 15.5px; line-height: 1.5; color: var(--muted); margin: 0; }
@media (max-width: 1100px) { .cs-card ol.steps-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 24px; } }
@media (max-width: 600px) { .cs-card ol.steps-grid { grid-template-columns: minmax(0, 1fr); } }
.cs-cta { margin-top: 40px; }

/* Demo overlay */
.demo-fab { position: fixed; right: 24px; bottom: 24px; z-index: 40; box-shadow: 0 10px 30px rgba(15,24,48,.28); }
.demo-ov { position: fixed; inset: 0; z-index: 100; background: rgba(13,29,74,.6); display: grid; place-items: center; padding: 24px; animation: ov-in .2s ease; }
.demo-ov[hidden] { display: none; }
@keyframes ov-in { from { opacity: 0; } }
.demo-dlg { width: min(1360px, 100%); height: min(900px, 100%); display: flex; flex-direction: column; gap: 14px; background: var(--bg); padding: 20px 24px 24px; box-shadow: 0 30px 80px rgba(0,0,0,.35); min-height: 0; }
.demo-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.demo-top h2 { font-size: clamp(22px, 2.4vw, 30px); line-height: 1.1; }
.demo-top .demo-note { margin: 6px 0 0; }
.demo-x { flex: none; width: 40px; height: 40px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 24px; line-height: 1; cursor: pointer; border-radius: var(--r-btn); }
.demo-x:hover { border-color: var(--accent); color: var(--accent); }
.demo-dlg > .app { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.demo-dlg .app-body { flex: 1 1 0; min-height: 0; height: auto; }
body.ov-open { overflow: hidden; }
.demo-note { font-size: 13.5px; color: var(--faint); }
.cs-sol .btn.demo-open { margin-top: 4px; }

.app { border: 1px solid var(--line); background: var(--surface); box-shadow: var(--sh-2); border-radius: var(--r-card); overflow: hidden; }
.app-bar { display: flex; align-items: center; gap: 20px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--well); flex-wrap: wrap; }
.proj { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14.5px; }
.files { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.files button { font: 500 13px/1 var(--body); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-btn); padding: 7px 10px; display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.files button i { font: 500 9.5px/1 var(--mono); font-style: normal; color: #b42318; border: 1px solid currentColor; padding: 2px 3px; }
.files button:hover, .files button.on { border-color: var(--accent); color: var(--accent); }
.app-body { display: grid; grid-template-columns: minmax(0, 1.22fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); height: min(760px, 82vh); }
.app-body > * { min-height: 0; }

.chat { display: grid; grid-template-rows: minmax(0, 1fr) auto; border-right: 1px solid var(--line); min-width: 0; }
.thread { overflow-y: auto; padding: 24px 24px 8px; display: grid; gap: 18px; align-content: start; scroll-padding-top: 16px; }
.empty { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 90px 0 40px; color: var(--muted); }
.empty .bot { width: 48px; height: 48px; display: grid; place-items: center; background: var(--tint); color: var(--accent); margin-bottom: 8px; }
.empty p { font-weight: 600; color: var(--ink); font-size: 17px; }
.empty span:last-child { font-size: 14px; }
.msg.user { justify-self: end; max-width: 82%; background: var(--navy); color: #fff; padding: 11px 16px; font-size: 15px; line-height: 1.45; border-radius: 3px; }
.msg.agent { display: grid; gap: 12px; min-width: 0; }
.steps { font-size: 13.5px; color: var(--muted); }
.steps summary { cursor: pointer; display: inline-flex; align-items: center; gap: 8px; list-style: none; }
.steps summary::-webkit-details-marker { display: none; }
.steps summary::before { content: "›"; font-size: 16px; transition: transform .2s; }
.steps[open] summary::before { transform: rotate(90deg); }
.steps ul { list-style: none; margin: 8px 0 0; padding: 0 0 0 4px; display: grid; gap: 5px; }
.steps li { padding-left: 18px; position: relative; animation: stepIn .3s ease both; }
.steps li::before { content: ""; position: absolute; left: 2px; top: .5em; width: 8px; height: 8px; border: 1.5px solid var(--faint); border-radius: 2px; }
.spin { width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes stepIn { from { opacity: 0; transform: translateY(4px); } }

.ans { font-size: 14.5px; line-height: 1.55; display: grid; gap: 14px; min-width: 0; }
.ans.in { animation: ansIn .5s ease both; }
@keyframes ansIn { from { opacity: 0; transform: translateY(8px); } }
.ans h4 { font-family: var(--display); font-weight: 600; font-size: 16px; letter-spacing: -.01em; margin: 6px 0 -4px; }
.ans .tw { overflow-x: auto; border: 1px solid var(--line); }
.ans table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 1.45; min-width: 560px; }
.ans th { text-align: left; font-weight: 600; background: var(--well); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 12.5px; }
.ans td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ans tr:last-child td { border-bottom: none; }
.ans td:first-child { font-weight: 500; }
.ans td small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 400; }
.ans .r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ans tr.t td { font-weight: 600; background: var(--bg); }
.ci { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; margin-left: 3px; border-radius: 9px; border: none; background: var(--tint); color: var(--accent); font: 600 10.5px/1 var(--body); cursor: pointer; vertical-align: 1px; transition: background .15s, color .15s; }
.ci:hover, .ci.on { background: var(--accent); color: #fff; }

.asks { padding: 14px 16px 16px; border-top: 1px solid var(--line); display: grid; gap: 8px; background: var(--surface); }
.ask { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left; font: 500 14.5px/1.35 var(--body); color: var(--ink); background: var(--surface); border: 1.5px solid var(--accent); border-radius: var(--r-btn); padding: 11px 14px; cursor: pointer; transition: background .15s, color .15s; }
.ask svg { flex: none; color: var(--accent); }
.ask:hover:not(:disabled) { background: var(--accent); color: #fff; }
.ask:hover:not(:disabled) svg { color: #fff; }
.ask:disabled { display: none; }
.asks.busy .ask { opacity: .45; pointer-events: none; }
.asks.done { display: none; }

.viewer { display: grid; grid-template-rows: auto minmax(0, 1fr); background: #e9ebef; min-width: 0; }
.v-bar { display: flex; align-items: center; gap: 12px; padding: 9px 12px; background: var(--surface); border-bottom: 1px solid var(--line); font-size: 13.5px; }
.v-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-nav { display: flex; align-items: center; gap: 6px; margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.v-nav button, .v-x { width: 28px; height: 28px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-btn); cursor: pointer; font-size: 17px; line-height: 1; color: var(--ink); }
.v-nav button:hover { border-color: var(--accent); color: var(--accent); }
.v-x { display: none; }
.v-scroll { overflow: auto; padding: 16px; }
.v-page { position: relative; width: 100%; transition: width .25s ease; background: #fff; box-shadow: 0 1px 3px rgba(15,24,48,.12), 0 8px 24px -12px rgba(15,24,48,.25); }
.v-page img { display: block; width: 100%; height: auto; }
.v-hl { position: absolute; background: rgba(31,63,216,.12); outline: 2px solid var(--accent); outline-offset: 1px; mix-blend-mode: multiply; pointer-events: none; }
.v-hl.pulse { animation: hl 1.1s ease 2; }
@keyframes hl { 50% { background: rgba(31,63,216,.28); } }

@media (max-width: 900px) {
  .cs-kpis, .cs-pair, .res-grid, .sol-grid { grid-template-columns: minmax(0, 1fr); }
  .can { border-left: none; padding-left: 0; border-top: 1px solid var(--line); padding-top: 22px; }
  .cs-card { padding: 26px 22px 28px; }
  .demo-ov { padding: 0; }
  .demo-dlg { width: 100%; height: 100%; padding: 12px 12px 0; gap: 10px; box-shadow: none; }
  .demo-dlg > .app { border-bottom: 0; }
  .demo-fab { right: 16px; bottom: 16px; }
  .app-body { grid-template-columns: minmax(0, 1fr); }
  .files { margin-left: 0; }
  .chat { border-right: none; }
  .thread { padding: 18px 14px 8px; }
  .viewer { position: fixed; inset: auto 0 0 0; height: 86vh; z-index: 60; box-shadow: 0 -12px 40px rgba(15,24,48,.3); transform: translateY(100%); transition: transform .3s ease; }
  .viewer.open { transform: none; }
  .v-x { display: block; }
  .v-bar { gap: 8px; }
  .v-name { min-width: 0; }
  body.sheet-open { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) {
  .steps li, .ans.in, .v-hl.pulse { animation: none; }
  .viewer { transition: none; }
  .demo-ov { animation: none; }
}

/* Case study request page */
.req-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 48px; align-items: start; }
.req-about { display: grid; gap: 18px; }
.req-note { font-size: 15px; color: var(--muted); max-width: 52ch; }
.req-side { display: grid; gap: 14px; border-left: 1px solid var(--line); padding-left: 40px; }
.req-form { display: grid; gap: 14px; }
.req-form h3, .req-done h3 { font-size: 22px; line-height: 1.2; }
.req-form label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
.req-form label i { font-style: normal; font-weight: 400; color: var(--faint); }
.req-form input { font-size: 16px; font-weight: 400; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--r-btn); background: var(--surface); }
.req-form input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.req-form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.req-form .btn { justify-self: start; margin-top: 4px; }
.req-form .btn:disabled { opacity: .7; cursor: default; }
.req-done { display: grid; gap: 10px; }
.req-done p { color: var(--muted); }
.req-msg { border-left: 3px solid var(--accent); background: var(--well); padding: 10px 14px; font-size: 15px; }
@media (max-width: 900px) {
  .req-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .req-side { border-left: none; padding-left: 0; border-top: 1px solid var(--line); padding-top: 24px; }
}
