/* Case study pages. Loaded after ../../playground/playground.css, which has the colours, type, nav and footer.
   Layout: title, facts, then the hero image; the story beside a list of its sections; the next case study as a card. */
:root { --t-pink: #f6e6ec; --t-green: #e3efe7; --t-sand: #f1ebdf; }
:root[data-theme="dark"] { --t-pink: #2b2025; --t-green: #1d2722; --t-sand: #2a2620; }
img { display: block; max-width: 100%; height: auto; }
[id] { scroll-margin-top: 80px; }

/* top */
.top { padding-top: 64px; }
.back { font-family: var(--sans); font-size: 14px; color: var(--soft); text-decoration: none; }
.back:hover { color: var(--ink); }
.top h1 { font-size: 40px; line-height: 1.15; letter-spacing: -.02em; font-weight: 600; margin: 20px 0 14px; }
.top .sum { font-size: 20px; color: var(--soft); margin: 0; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 28px 0 0; padding: 14px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
         font-family: var(--sans); font-size: 13px; color: var(--soft); }
.facts b { display: block; font-size: 14.5px; font-weight: 500; }

/* images, same frames as the home page */
.stage { border-radius: 14px; padding: 40px 40px 0; margin: 36px 0 0; overflow: hidden; background: var(--t-purple); }
.stage.pad { padding-bottom: 40px; }
.stage.pink { background: var(--t-pink); } .stage.green { background: var(--t-green); } .stage.sand { background: var(--t-sand); }
.shot { border-radius: 10px 10px 0 0; border: 1px solid rgba(0,0,0,.06); box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 12px 32px -12px rgba(0,0,0,.18); overflow: hidden; background: var(--paper); }
.stage.pad .shot { border-radius: 10px; }
.shot img { width: 100%; }
.cap { font-family: var(--sans); font-size: 13px; color: var(--faint); margin: 12px 0 0; }
.pair { display: grid; grid-template-columns: 1.65fr 1fr; gap: 24px; align-items: stretch; }
.pair .tall { position: relative; }
.pair .tall img { position: absolute; top: 0; left: 0; }
.pair .tall::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 56px; background: linear-gradient(transparent, var(--paper)); }

/* before / after */
.ba { position: relative; user-select: none; -webkit-user-select: none; touch-action: pan-y; cursor: ew-resize; }
.ba img { pointer-events: none; }
.ba .after { position: absolute; inset: 0; height: 100%; object-fit: cover; object-position: top; clip-path: inset(0 0 0 var(--pos, 50%)); }
.ba .handle { position: absolute; top: 0; bottom: 0; left: var(--pos, 50%); width: 2px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.12); transform: translateX(-1px); pointer-events: none; }
.ba .handle::after { content: "‹ ›"; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 40px; height: 40px; border-radius: 50%;
                     background: #fff; color: #1b1b19; font: 600 15px/40px var(--sans); text-align: center; letter-spacing: 2px; box-shadow: 0 2px 10px rgba(0,0,0,.2); }
.ba .tag { position: absolute; top: 14px; font-family: var(--sans); font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 99px; background: rgba(27,27,25,.78); color: #fff; pointer-events: none; }
.ba .tag.l { left: 14px; } .ba .tag.r { right: 14px; }
.tabs { display: flex; gap: 4px; justify-content: center; margin: 0 auto 20px; background: rgba(0,0,0,.05); border-radius: 999px; padding: 4px; width: fit-content; }
.tabs button { font: 500 14px var(--sans); color: var(--soft); background: none; border: 0; border-radius: 999px; padding: 7px 18px; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
[data-theme="dark"] .tabs { background: rgba(255,255,255,.06); }
[data-ba]:focus-visible, .tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* the story: text in the same column as the title, the section list in the space to its left */
.story { display: grid; grid-template-columns: 1fr minmax(0, 592px) 1fr; column-gap: 40px; max-width: 1040px; margin: 0 auto; padding: 0 24px; }
.story > nav { grid-column: 1; justify-self: end; width: 150px; }
.story > nav ol { position: sticky; top: 96px; list-style: none; margin: 72px 0 0; padding: 0 0 0 14px; border-left: 1px solid var(--rule);
                  font-family: var(--sans); font-size: 13px; line-height: 2.1; }
.story > nav a { display: block; position: relative; color: var(--faint); text-decoration: none; }
.story > nav a:hover, .story > nav a[aria-current] { color: var(--ink); }
.story > nav a[aria-current]::before { content: ""; position: absolute; left: -15px; top: 6px; bottom: 6px; width: 2px; background: var(--ink); }
.story > div { grid-column: 2; }
.story section { padding-top: 64px; }
.story h2 { font-size: 26px; font-weight: 600; letter-spacing: -.012em; line-height: 1.25; margin: 0 0 12px; }
.story p { margin: 0 0 16px; }
.story ul.plain { margin: 0 0 16px; padding-left: 20px; }
.story ul.plain li { margin-bottom: 8px; }
.story ul.plain li::marker { color: var(--faint); }

/* a row of steps along a line; the last one is where things stand now */
.path { list-style: none; display: grid; grid-template-columns: repeat(var(--n, 4), 1fr); margin: 26px 0 8px; padding: 0; font-family: var(--sans); }
.path li { position: relative; padding: 14px 14px 0 0; border-top: 2px solid var(--rule); }
.path li::before { content: ""; position: absolute; top: -6px; left: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--faint); }
.path li:last-child { border-top-color: var(--ink); }
.path li:last-child::before { background: var(--ink); }
.path small { display: block; font-size: 12px; color: var(--faint); }
.path b { display: block; font-size: 14.5px; font-weight: 600; margin: 2px 0 4px; }
.path span { display: block; font-size: 13px; color: var(--soft); line-height: 1.45; }

/* small cards side by side */
.cards { list-style: none; display: grid; grid-template-columns: repeat(var(--n, 4), 1fr); gap: 10px; margin: 24px 0 0; padding: 0; font-family: var(--sans); }
.cards li { background: var(--paper); border: 1px solid var(--rule); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; }
.cards b { font-size: 14.5px; font-weight: 600; margin-bottom: 6px; }
.cards span { font-size: 13px; color: var(--soft); line-height: 1.45; flex: 1; }
.cards em { font-style: normal; font-size: 12px; color: var(--faint); margin-top: 12px; }

/* before → now numbers */
.table { width: 100%; border-collapse: collapse; margin: 20px 0 8px; font-family: var(--sans); font-size: 14px; }
.table th { text-align: left; font-weight: 500; font-size: 12.5px; color: var(--faint); padding: 0 12px 8px 0; border-bottom: 1px solid var(--rule); }
.table td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--rule); color: var(--soft); font-variant-numeric: tabular-nums; }
.table td:first-child { color: var(--ink); }
.table th:not(:first-child), .table td:not(:first-child) { text-align: right; }

.decision { margin: 22px 0 0; }
.decision b { display: block; font-size: 19px; line-height: 1.35; margin-bottom: 4px; }
.decision p { color: var(--soft); }

.who { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 8px; }
.who h3 { font-family: var(--sans); font-size: 14px; font-weight: 600; margin: 0 0 6px; }
.who p { font-size: 17px; }

.result { display: flex; flex-wrap: wrap; gap: 20px 56px; margin: 12px 0 0; }
.result b { display: block; font-family: var(--sans); font-size: 32px; font-weight: 600; letter-spacing: -.03em; line-height: 1.1; }
.result span { font-family: var(--sans); font-size: 14px; color: var(--soft); display: block; margin-top: 4px; }

/* endorsement chart, the same as the home page */
.chart { background: var(--paper); border-radius: 10px; padding: 24px 28px 18px; font-family: var(--sans); box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 12px 32px -12px rgba(0,0,0,.18); }
.chart-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 24px; align-items: baseline; margin-bottom: 22px; }
.chart-head b { font-size: 15px; font-weight: 600; }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--soft); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i, .stack i { display: block; }
.legend i { width: 10px; height: 10px; border-radius: 2px; }
.api { background: #2f6f4f; } .agent { background: #6cb48a; } .rpa { background: #b9dcc6; }
[data-theme="dark"] .api { background: #6cc395; } [data-theme="dark"] .agent { background: #3f8a61; } [data-theme="dark"] .rpa { background: #2a5a40; }
.plot { position: relative; height: 260px; margin: 0 0 0 34px; }
.grid span { position: absolute; left: -34px; right: 0; font-size: 11px; color: var(--faint); border-bottom: 1px dashed var(--rule); line-height: 0; height: 0; }
.grid span[style*="bottom:0"] { border-bottom: 1px solid var(--rule); }
.bars { position: absolute; inset: 0; display: flex; gap: 28px; align-items: flex-end; padding: 0 12px; }
.cbar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.stack { width: 100%; max-width: 72px; display: flex; flex-direction: column; border-radius: 4px 4px 0 0; overflow: hidden; min-height: 2px; background: #2f6f4f; }
.stack i { width: 100%; }
.cbar .v { font-size: 13px; font-weight: 600; margin: 6px 0 5px; color: var(--ink); }
.cbar.now .v { color: #2f6f4f; font-size: 14px; }
[data-theme="dark"] .cbar.now .v { color: #6cc395; } [data-theme="dark"] .stack { background: #6cc395; }
.cbar .m { position: absolute; top: 100%; margin-top: 10px; font-size: 11.5px; color: var(--faint); text-align: center; line-height: 1.3; }
.cbar .m b { display: block; color: var(--soft); font-weight: 600; }
.cbar .call { font-size: 11.5px; font-weight: 500; color: var(--ink); background: var(--chip); border-radius: 999px; padding: 3px 9px; white-space: nowrap; margin-bottom: 6px; position: relative; }
.cbar .call::after { content: ""; position: absolute; left: 50%; top: 100%; width: 1px; height: 6px; background: var(--faint); }
.chart-note { margin: 60px 0 0; font-size: 12px; color: var(--faint); }

/* next case study */
.next { margin-top: 112px; }
.next small { display: block; font-family: var(--sans); font-size: 13px; color: var(--faint); margin: 0 0 12px; }
.next a { display: grid; grid-template-columns: 1fr 1.25fr; background: var(--paper); border-radius: 14px; overflow: hidden; text-decoration: none;
          box-shadow: 0 1px 2px rgba(0,0,0,.05), 0 14px 34px -16px rgba(0,0,0,.22); transition: transform .2s ease, box-shadow .2s ease; }
.next a:hover { transform: translateY(-2px); box-shadow: 0 1px 2px rgba(0,0,0,.05), 0 20px 40px -16px rgba(0,0,0,.28); }
.next .txt { padding: 32px; display: flex; flex-direction: column; justify-content: center; }
.next .meta { font-family: var(--sans); font-size: 13px; color: var(--soft); margin: 0 0 8px; }
.next .meta b { font-weight: 500; margin-right: 14px; }
.next h3 { font-size: 24px; line-height: 1.25; font-weight: 600; letter-spacing: -.012em; margin: 0 0 16px; }
.next .go { font-family: var(--sans); font-size: 15px; font-weight: 500; color: var(--accent); }
.next .pic { background: var(--t-sand); padding: 28px 0 0 28px; }
.next .pic.pink { background: var(--t-pink); } .next .pic.green { background: var(--t-green); } .next .pic.purple { background: var(--t-purple); }
.next .pic .shot { border-radius: 10px 0 0 0; }
.next .pic .chart { border-radius: 10px 0 0 0; padding: 18px 20px 0; height: 100%; }
.next .pic .plot { height: 170px; }
.next .pic .bars { gap: 14px; }

@media (prefers-reduced-motion: reduce) { .next a { transition: none; } .next a:hover { transform: none; } }
@media (max-width: 900px) {
  .story { display: block; }
  .story > nav { display: none; }
}
@media (max-width: 760px) {
  .top { padding-top: 40px; }
  .top h1 { font-size: 30px; }
  .top .sum { font-size: 18px; }
  .facts { grid-template-columns: 1fr; gap: 10px; }
  .stage { padding: 16px 16px 0; border-radius: 10px; margin-top: 28px; }
  .stage.pad { padding-bottom: 16px; }
  .pair { grid-template-columns: 1fr; }
  .pair .tall { height: 360px; }
  .ba .handle::after { width: 32px; height: 32px; line-height: 32px; font-size: 13px; }
  .ba .tag { top: 8px; font-size: 10px; padding: 2px 7px; } .ba .tag.l { left: 8px; } .ba .tag.r { right: 8px; }
  .story section { padding-top: 48px; }
  .story h2 { font-size: 23px; }
  .path, .cards { grid-template-columns: 1fr 1fr; row-gap: 20px; }
  .who { grid-template-columns: 1fr; gap: 4px; }
  .chart { padding: 18px 14px 14px; } .plot { height: 200px; } .bars { gap: 8px; padding: 0; }
  .cbar .m { font-size: 9.5px; } .cbar .v { font-size: 11px; } .cbar .call { font-size: 9.5px; white-space: normal; text-align: center; padding: 2px 6px; }
  .next a { grid-template-columns: 1fr; }
  .next .txt { padding: 22px; }
}
