.evolution-section { padding: 24px 0 76px; }
.evolution { position: relative; overflow: hidden; background: #2e2929; color: #fff; border-radius: 20px; padding: 32px 40px 26px; isolation: isolate; }
.evolution-header { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; }
.evolution-kicker { margin: 0 0 10px; color: #fff; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.evolution h2 { margin: 0; max-width: 660px; font-size: clamp(25px, 3.2vw, 38px); line-height: 1.15; letter-spacing: -.035em; font-weight: 500; }
.evolution-toggle { flex-shrink: 0; border: 1px solid #ffffff35; background: #ffffff08; border-radius: 6px; padding: 10px 14px; font: inherit; font-size: 14px; color: #fff; cursor: pointer; }
.evolution-toggle:hover { background: #ffffff15; }
.evolution-stage { position: relative; --stage-height: clamp(280px, 38vw, 410px); height: var(--stage-height); display: grid; place-items: center; margin: 22px 0 16px; }
.evolution-stage::before { content: ''; position: absolute; top: 50%; left: -40px; right: -40px; height: 1px; background: linear-gradient(90deg, transparent, #a0b9ac65 30%, #a0b9ac65 70%, transparent); z-index: -1; }
.evolution-frame { position: relative; width: min(100%, 700px); height: 100%; border: 1px solid #d7e7da35; border-radius: 14px; background: #2e2929; box-shadow: 0 0 0 4px #a2b9af05, 0 0 36px #91b7a015; overflow: hidden; }
.evolution-slide { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; transform: translateX(38px) scale(.93); filter: blur(7px); transition: opacity 700ms ease, transform 1000ms cubic-bezier(.2,.7,.2,1), filter 700ms ease; pointer-events: none; }
.evolution-slide.is-active { opacity: 1; transform: translateX(0) scale(1); filter: blur(0); }
.evolution-artifact { width: min(100%, var(--stage-height)); aspect-ratio: 1; background-image: url('/assets/babel-accounting-history-gray.png'); background-size: 200% 200%; background-repeat: no-repeat; }
.evolution-artifact--clay { background-position: 0 0; }
.evolution-artifact--abacus { background-position: 100% 0; }
.evolution-artifact--ledger { background-position: 0 100%; }
.evolution-artifact--machine { background-position: 100% 100%; }
.evolution-slide--babel { padding: 0; }
.evolution-babel-logo { display: block; width: min(100%, var(--stage-height)); height: 100%; object-fit: contain; }
.evolution-caption { min-height: 55px; text-align: center; }
.evolution-caption strong { display: block; font-size: 19px; font-weight: 500; margin-bottom: 6px; }
.evolution-caption p { margin: 0; color: #fff; font-size: 15px; line-height: 1.5; }
.evolution-steps { display: flex; justify-content: center; gap: 8px; margin: 24px 0 0; }
.evolution-step { position: relative; font: inherit; font-size: 14px; color: #fff; border: 0; border-top: 2px solid #ffffff20; background: transparent; padding: 12px 10px 2px; min-width: 0; flex: 1; cursor: pointer; }
.evolution-step[aria-pressed="true"] { border-color: #d1e7d1; color: #fff; }
.evolution-step:hover { color: #fff; border-color: #adc7b6; }
.evolution button:focus-visible { outline: 2px solid #b8d8c9; outline-offset: 4px; }
@media(max-width:620px) {
  .evolution-section { padding: 8px 0 48px; }
  .evolution { padding: 25px 16px 20px; border-radius: 14px; }
  .evolution-header { gap: 14px; flex-wrap: wrap; }
  .evolution-toggle { padding: 8px 12px; }
  .evolution-stage { --stage-height: 290px; margin-top: 20px; }
  .evolution-slide--babel { padding: 0; }
  .evolution-steps { gap: 4px; flex-wrap: wrap; }
  .evolution-step { min-width: 0; flex: 1 1 52px; padding: 12px 4px 2px; font-size: 14px; }
  .evolution-caption { min-height: 76px; }
}
@media(prefers-reduced-motion:reduce) {
  .evolution-slide { transition: none; transform: none; filter: none; }
}

/* A native, retro spreadsheet window for the Excel chapter. */
.evolution-slide--excel { padding: 12px; }
.retro-excel { width: min(100%, 520px); color: #111; background: #c0c0c0; border: 2px solid; border-color: #fff #555 #555 #fff; padding: 3px; box-shadow: 6px 8px 0 #0002, 0 16px 40px #0004; font-family: Tahoma, Arial, sans-serif; font-size: 14px; line-height: 1.2; text-shadow: none; }
.retro-excel-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 5px 6px; background: #000080; color: #fff; font-weight: 700; font-size: 14px; white-space: nowrap; }
.retro-excel-window { background: #c0c0c0; color: #111; padding: 0 3px; letter-spacing: 3px; }
.retro-excel-menu { display: flex; gap: 16px; padding: 5px 6px; color: #111; }
.retro-excel-formula { display: flex; align-items: center; gap: 8px; padding: 3px 0 5px; color: #111; }
.retro-excel-formula > span { padding: 3px 6px; background: #fff; box-shadow: inset 1px 1px #777; }
.retro-excel-formula > span:first-child { min-width: 38px; }
.retro-excel-formula > span:last-child { flex: 1; }
.retro-excel-formula b { font-family: Georgia, serif; font-style: italic; font-weight: 400; }
.retro-excel-grid { width: 100%; border-collapse: collapse; table-layout: fixed; background: #fff; color: #111; font-size: 14px; }
.retro-excel-grid th, .retro-excel-grid td { padding: 3px 6px; border: 1px solid #b7b7b7; height: 23px; line-height: 17px; }
.retro-excel-grid th { background: #c0c0c0; color: #111; text-align: center; font-weight: 400; }
.retro-excel-grid th:first-child { width: 25px; }
.retro-excel-grid td:last-child { text-align: right; }
.retro-excel-grid tr:first-child td { font-weight: 700; }
.retro-excel-grid .retro-excel-selected { position: relative; outline: 2px solid #006b37; outline-offset: -2px; }
.retro-excel-selected::after { content: ''; position: absolute; width: 5px; height: 5px; right: -2px; bottom: -2px; background: #006b37; }
.retro-excel-tabs { display: flex; align-items: center; gap: 14px; min-height: 24px; padding: 0 7px; color: #111; }
.retro-excel-tabs strong { padding: 3px 12px; background: #fff; color: #006b37; border-right: 1px solid #777; border-bottom: 1px solid #777; font-size: 14px; }
.retro-excel-tabs > span:last-child { margin-left: auto; }
@media(max-width:620px) {
  .evolution-steps { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); }
  .retro-excel-title { font-size: 12px; }
  .retro-excel-window { display: none; }
  .retro-excel-grid th, .retro-excel-grid td { padding: 2px 4px; height: 21px; }
  .retro-excel-menu { padding: 4px 6px; }
}
