/* Case study page ("Building Solaise"). Uses site.css tokens and the figure
   kit in features.css. Light motion: sections rise in, the timeline fills as
   you scroll, small figures loop while on screen. Reduce Motion: all still. */

.cs { max-width: 960px; margin: 0 auto; padding: clamp(24px, 5vh, 56px) var(--gutter) clamp(48px, 8vh, 88px); }
.cs-hero { text-align: center; display: flex; flex-direction: column; align-items: center; padding-bottom: 8px; }
.cs-mark { position: relative; width: 76px; height: 76px; margin-bottom: 18px; }
.cs-mark img { position: relative; width: 76px; height: 76px; filter: drop-shadow(0 12px 24px rgba(0, 0, 0, .4)); }
.cs-mark .t-ripple { border-radius: 30%; }
.cs-hero h1 { margin: 6px 0 0; font: 800 clamp(42px, 7vw, 76px)/1 var(--font-rounded); letter-spacing: -.035em; color: transparent; background: var(--title-gradient); -webkit-background-clip: text; background-clip: text; padding: .06em 0 .1em; }
.cs-intro { margin: 18px 0 0; max-width: 62ch; font: 400 clamp(17px, 1.9vw, 20px)/1.6 var(--font-text); color: var(--text); text-wrap: pretty; }

.cs-section { margin-top: clamp(56px, 10vh, 96px); }
.cs-section > h2 { margin: 0; font: 700 clamp(28px, 3.8vw, 38px)/1.15 var(--font-rounded); letter-spacing: -.02em; text-wrap: balance; }
.cs-text { margin: 14px 0 0; max-width: 66ch; font: 400 17px/1.65 var(--font-text); color: var(--text-2); text-wrap: pretty; }
.cs h3 { margin: 0; font: 650 17px/1.3 var(--font); letter-spacing: -.01em; }

/* Four rules: two by two, each with a figure. */
.cs-rules { list-style: none; margin: 24px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.cs-card { display: flex; flex-direction: column; gap: 8px; padding: 12px 12px 20px; border-radius: 22px; }
.cs-card h3 { margin: 10px 6px 0; }
.cs-card p { margin: 0 6px; font: 400 15px/1.55 var(--font-text); color: var(--text-2); }

/* How it was built: a vertical timeline that fills as steps arrive. */
.cs-timeline { position: relative; list-style: none; margin: 28px 0 0; padding: 0 0 0 44px; display: flex; flex-direction: column; gap: 26px; }
.tl-track { position: absolute; left: 13px; top: 8px; bottom: 8px; width: 2px; border-radius: 1px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.tl-fill { position: absolute; inset: 0; background: linear-gradient(180deg, var(--fill-top), var(--orb-rose)); transform-origin: top; transform: scaleY(var(--tl, 1)); transition: transform .9s var(--smooth); }
.tl-step { position: relative; }
.tl-step::before {
  content: ""; position: absolute; left: -38px; top: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: radial-gradient(circle at 40% 38%, #FFF9EA 0%, #FFE6AB 30%, #F2B86D 75%);
  box-shadow: 0 0 0 4px rgba(15, 16, 21, .9), 0 0 14px rgba(245, 192, 122, .55);
  transition: transform .45s var(--smooth), opacity .45s var(--smooth);
}
.tl-step p { margin: 6px 0 0; max-width: 62ch; font: 400 16px/1.6 var(--font-text); color: var(--text-2); }
.tl-step h3, .tl-step p { transition: opacity .6s var(--smooth), transform .6s var(--smooth); }
.js .cs-timeline:not(.is-static) .tl-step:not(.is-in)::before { transform: scale(.3); opacity: 0; }
.js .cs-timeline:not(.is-static) .tl-step:not(.is-in) h3,
.js .cs-timeline:not(.is-static) .tl-step:not(.is-in) p { opacity: 0; transform: translateY(10px); }

/* Hard problems: figure beside the text on wide screens. */
.cs-problems { list-style: none; margin: 24px 0 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.cs-problem { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 20px; align-items: center; padding: 12px 22px 12px 12px; border-radius: 22px; }
.cs-problem p { margin: 6px 0 0; font: 400 15.5px/1.6 var(--font-text); color: var(--text-2); }

/* What we've learned: a data figure beside each lesson. */
.cs-lessons { list-style: none; margin: 24px 0 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.cs-lesson { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 22px; align-items: center; padding: 12px 22px 12px 12px; border-radius: 22px; }
.cs-lesson p { margin: 6px 0 0; font: 400 15.5px/1.6 var(--font-text); color: var(--text-2); }
.lesson-fig { height: auto; min-height: 160px; padding: 16px 18px; }
.ls-cap { display: block; font: 700 10.5px/1.3 var(--font-text); letter-spacing: .6px; text-transform: uppercase; color: var(--text-3); }
.ls-chart, .ls-wait, .ls-mcp { width: 100%; display: flex; flex-direction: column; gap: 7px; }
.ls-chart .ls-cap + .ls-row { margin-top: 1px; }
.ls-row + .ls-cap { margin-top: 8px; }
.ls-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) 42px; align-items: center; gap: 8px; }
.ls-row b { font: 700 11px/1 var(--font-text); color: var(--text-2); }
.ls-row.pick b { color: var(--amber); }
.ls-row em { font: 700 12px/1 var(--font-rounded); font-style: normal; color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }
.ls-track { height: 10px; border-radius: 5px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.ls-bar { display: block; height: 100%; border-radius: inherit; background: rgba(246, 239, 230, .4); transform-origin: left; animation: f-grow 7s var(--smooth) infinite; }
.ls-row.pick .ls-bar { background: linear-gradient(90deg, var(--fill-bottom), var(--fill-top)); }
.ls-bar.big { width: 89%; }
.ls-bar.small { width: 76%; animation-delay: .2s; }
.ls-bar.slow { width: 100%; background: linear-gradient(90deg, #E8958A, #F29186); animation-delay: .5s; }
.ls-bar.fast { width: 11.8%; animation-delay: .7s; }
.lw-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: rgba(255, 255, 255, .08); }
.lw-bar i { display: block; height: 100%; transform-origin: left; animation: f-grow 7s var(--smooth) infinite; }
.lw-fetch { width: 16%; background: rgba(246, 239, 230, .45); }
.lw-read { width: 84%; background: linear-gradient(90deg, #E8958A, #F29186); animation-delay: .4s !important; }
.lw-key { display: flex; flex-wrap: wrap; gap: 4px 12px; font: 600 11px/1.2 var(--font-text); color: var(--text-2); }
.lw-key i { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 2px; vertical-align: 0; }
.k-fetch { background: rgba(246, 239, 230, .45); }
.k-read { background: #F29186; }
.lw-key + .ls-cap { margin-top: 8px; }
.lw-now { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; height: 28px; padding: 0 11px 0 9px; border-radius: 999px; background: rgba(159, 216, 178, .14); border: 1px solid rgba(159, 216, 178, .3); font: 600 11.5px/1 var(--font-text); color: var(--success); }
.lw-now .speech-bars { height: 14px; gap: 2px; }
.lw-now .speech-bars i { width: 2.5px; height: 14px; background: linear-gradient(180deg, #DDF2E3, var(--success)); }
.ls-mcp { align-items: center; text-align: center; gap: 10px; }
.lm-count { font: 600 14px/1 var(--font-text); color: var(--text-2); }
.lm-count b { font: 800 34px/1 var(--font-rounded); color: var(--amber); margin-right: 4px; letter-spacing: -.02em; }
.lm-dots { display: grid; grid-template-columns: repeat(10, 14px); gap: 7px; justify-content: center; }
.lm-dots i { width: 14px; height: 14px; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.lm-dots i.on { background: radial-gradient(circle at 40% 38%, #FFF9EA, #FFE6AB 30%, #F2B86D 80%); box-shadow: 0 0 8px rgba(245, 192, 122, .5); animation: f-found 7s ease-in-out infinite; }
.lm-dots i.on:nth-child(3n) { animation-delay: .3s; }
.lm-dots i.on:nth-child(3n+1) { animation-delay: .6s; }

/* By the numbers */
.cs-stats { list-style: none; margin: 24px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.cs-stat { display: flex; flex-direction: column; gap: 6px; padding: 20px 20px 22px; border-radius: 20px; }
.stat-value { font: 750 clamp(26px, 3.2vw, 34px)/1.1 var(--font-rounded); letter-spacing: -.02em; color: var(--amber); }
.stat-label { font: 400 15px/1.45 var(--font-text); color: var(--text-2); }

/* Navigation link back */
.cs .legal-back { margin: 28px 0 0; }

/* ---------- Figures new to this page ---------- */
/* Measure, don't guess */
.f-measure { display: flex; flex-direction: column; justify-content: center; gap: 9px; padding: 0 22px; }
.ms-row { display: flex; align-items: center; gap: 9px; }
.ms-set { width: 20px; height: 14px; border-radius: 4px 4px 4px 1px; background: rgba(255, 255, 255, .16); flex-shrink: 0; }
.ms-bar { flex-grow: 1; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.ms-bar i { display: block; width: 88%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--fill-bottom), var(--fill-top)); transform-origin: left; animation: f-grow 6s var(--smooth) infinite; }
.ms-row:nth-child(2) .ms-bar i { width: 74%; animation-delay: .3s; }
.ms-row.worse .ms-bar i { width: 46%; background: linear-gradient(90deg, #E8958A, #F29186); animation-delay: .6s; }
.ms-ok, .ms-no { width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; border-radius: 50%; flex-shrink: 0; animation: f-check 6s var(--smooth) infinite; }
.ms-ok { background: var(--success); color: #10251A; }
.ms-no { background: var(--error); color: #2A0E0B; animation-delay: .6s; }
.ms-row:nth-child(2) .ms-ok { animation-delay: .3s; }
.ms-ok svg, .ms-no svg { width: 11px; height: 11px; stroke-width: 3.2; }
.ms-stop { align-self: flex-end; height: 20px; padding: 0 9px; display: inline-flex; align-items: center; border-radius: 999px; background: rgba(242, 145, 134, .16); color: var(--error); font: 700 10px/1 var(--font-text); animation: f-goal 6s var(--smooth) infinite; animation-delay: .6s; }

/* The speech engine disappeared */
.e-mac { position: absolute; left: 64px; top: 20px; width: 92px; height: 64px; color: var(--text-2); }
.e-mac rect { fill: rgba(255, 255, 255, .05); }
.e-chip { position: absolute; left: 92px; top: 32px; width: 36px; height: 26px; display: flex; align-items: center; justify-content: center; border-radius: 8px; }
.e-chip svg { width: 20px; height: 20px; stroke-width: 2; }
.e-chip.old { background: rgba(255, 255, 255, .1); color: var(--text-3); opacity: 0; animation: f-out 6s var(--smooth) infinite; }
.e-chip.new { background: rgba(245, 192, 122, .2); border: 1px solid rgba(245, 192, 122, .5); color: var(--amber); animation: f-in 6s var(--smooth) infinite; }
.e-offline { position: absolute; left: 168px; top: 30px; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: rgba(159, 216, 178, .14); color: var(--success); animation: f-pop 6s var(--smooth) infinite; }
.e-offline svg { width: 17px; height: 17px; }
@keyframes f-out { 0%, 20% { opacity: 1; transform: none; } 34%, 100% { opacity: 0; transform: translateY(-14px) scale(.8); } }
@keyframes f-in { 0%, 34% { opacity: 0; transform: translateY(16px); } 46%, 92% { opacity: 1; transform: none; } 100% { opacity: 0; } }

/* Talking with the TV on */
.f-tv { display: flex; align-items: center; justify-content: center; gap: 14px; }
.v-tv { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--text-3); }
.v-tv svg { width: 40px; height: 40px; stroke-width: 1.5; }
.v-noise { height: 14px; gap: 2px; opacity: .55; }
.v-noise i { width: 3px; height: 14px; background: rgba(246, 239, 230, .45); }
.v-voice { height: 26px; }

/* A small model that has to be right */
.f-models { display: flex; align-items: flex-end; justify-content: center; gap: 18px; padding-bottom: 14px; }
.mo-col { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.mo-col b { font: 700 10.5px/1 var(--font-text); color: var(--text-3); }
.mo-bar { position: relative; width: 22px; height: 70px; border-radius: 6px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.mo-bar i { position: absolute; left: 0; right: 0; bottom: 0; border-radius: inherit; background: rgba(246, 239, 230, .3); transform-origin: bottom; animation: f-rise 6s var(--smooth) infinite; }
.m1 { height: 52%; } .m2 { height: 64%; animation-delay: .15s !important; } .m3 { height: 90%; animation-delay: .3s !important; } .m4 { height: 46%; animation-delay: .45s !important; }
.pick .mo-bar i { background: linear-gradient(180deg, var(--fill-top), var(--fill-bottom)); }
.pick b { color: var(--amber); }
.mo-tick { position: absolute; top: -24px; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--success); color: #10251A; animation: f-check 6s var(--smooth) infinite; }
.mo-tick svg { width: 12px; height: 12px; stroke-width: 3.2; }
@keyframes f-rise { 0% { transform: scaleY(0); } 22%, 88% { transform: none; } 100% { transform: scaleY(0); } }

/* Speed */
.f-speed { display: grid; grid-template-columns: auto auto; justify-content: space-between; align-content: center; gap: 8px 6px; padding: 0 10px; }
.sp-job { grid-column: 1 / -1; }
.sp-job { padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12); display: flex; flex-direction: column; gap: 7px; }
.sp-head { display: flex; align-items: center; gap: 6px; font: 600 10.5px/1 var(--font-text); color: var(--text-2); }
.sp-head svg { width: 13px; height: 13px; color: var(--amber); }
.sp-track { height: 7px; border-radius: 4px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.sp-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--fill-bottom), var(--fill-top)); transform-origin: left; animation: f-load 6s linear infinite; }
.sp-talk, .sp-ready { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px 0 7px; border-radius: 999px; font: 600 10px/1 var(--font-text); white-space: nowrap; }
.sp-talk { background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); }
.sp-talk .speech-bars { height: 14px; gap: 2px; }
.sp-talk .speech-bars i { width: 2.5px; height: 14px; }
.sp-ready { background: rgba(159, 216, 178, .16); color: var(--success); animation: f-goal 6s var(--smooth) infinite; animation-delay: .4s; }
.sp-ready svg { width: 13px; height: 13px; }
@keyframes f-load { 0% { transform: scaleX(0); } 60%, 92% { transform: none; } 100% { transform: scaleX(0); } }

/* Getting it right before getting it fast */
.f-filter { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.fl-label { position: absolute; top: 14px; font: 750 15px/1 var(--font-rounded); letter-spacing: -.01em; }
.fl-label.before { color: var(--warning); animation: f-swap-out 6s ease-in-out infinite; opacity: 0; }
.fl-label.after { color: var(--success); animation: f-swap-in 6s ease-in-out infinite; }
.fl-dots { display: flex; gap: 8px; margin-top: 18px; }
.fl-dots i { width: 16px; height: 16px; border-radius: 50%; background: var(--success); box-shadow: 0 0 8px rgba(159, 216, 178, .45); }
.fl-dots i.late { animation: f-found 6s ease-in-out infinite; }
.fl-funnel { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px 0 8px; border-radius: 999px; background: rgba(245, 192, 122, .12); border: 1px solid rgba(245, 192, 122, .3); font: 600 10.5px/1 var(--font-text); animation: f-in 6s var(--smooth) infinite; animation-delay: -1.2s; }
.fl-funnel svg { width: 13px; height: 13px; color: var(--amber); }
@keyframes f-found { 0%, 44% { opacity: .18; transform: scale(.8); } 54%, 92% { opacity: 1; transform: none; } 100% { opacity: .18; transform: scale(.8); } }
@keyframes f-swap-out { 0%, 40% { opacity: 1; } 48%, 94% { opacity: 0; } 100% { opacity: 1; } }
@keyframes f-swap-in { 0%, 40% { opacity: 0; } 48%, 94% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- Small screens ---------- */
@media (max-width: 760px) {
  .cs-rules { grid-template-columns: minmax(0, 1fr); }
  .cs-problem { grid-template-columns: minmax(0, 1fr); padding: 12px 12px 20px; gap: 14px; }
  .cs-problem-text { padding: 0 6px; }
  .cs-lesson { grid-template-columns: minmax(0, 1fr); padding: 12px 12px 20px; gap: 14px; }
  .cs-lesson-text { padding: 0 6px; }
  .cs-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 420px) { .cs-stats { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Reduce Motion ---------- */
.rm .cs-mark .t-ripple:first-child { opacity: .35; transform: scale(1.25); }
.rm .tl-fill, .rm .tl-step::before, .rm .tl-step h3, .rm .tl-step p { transition: none; }
.rm .v-noise i, .rm .v-voice i, .rm .sp-talk .speech-bars i { transform: scaleY(.55); }
