/* Platform page. Builds on product.css (paper hero, framed demo, switch, app window, panels) and pages.css (router table). */

/* Timed entrances: --d is when an element appears, --e when it stops showing. The resting state is the finished one,
   so without script or with motion off everything simply shows. */
@media (scripting: enabled) { .play:not(.is-live) :is(.t, .t-fade) { opacity: 0; } }
.play.is-live .t { animation: fc-in .6s cubic-bezier(.16,1,.3,1) calc(var(--d) * 1ms) both; }
.play.is-live .t-fade { animation: fc-fade .4s calc(var(--d) * 1ms) both; }
@keyframes cw-on { from, to { opacity: 1; } }

.cw, .fd { --line: #e7e9e4; --soft: #f6f7f4; --ok: #2f6b45; --ok-bg: #e6f0e8; --amber: #b4541f; --amber-bg: #fbefe7; }
.tag-ok { background: var(--ok-bg); color: var(--ok); }
.tag-amber { background: var(--amber-bg); color: var(--amber); }
.btn { flex: none; padding: 7px 12px; border-radius: 6px; background: var(--ink); color: #fff; font-size: 12px; font-weight: 500; }

/* The Clava window: wordmark, matter, and a status that changes as the work goes */
.cw .app-top { align-items: center; }
.cw-mark { margin-right: 4px; color: var(--ink); font: 500 18px/1 "Bodoni Moda", Georgia, serif; letter-spacing: -.02em; }
.cw-state { position: relative; flex: 1; align-self: stretch; min-width: 180px; }
.cw-state i { position: absolute; right: 0; top: 50%; display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px; background: var(--soft); color: var(--muted); font-size: 12px; font-style: normal; font-weight: 600; white-space: nowrap; transform: translateY(-50%); }
.cw-state i::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: fc-blink 1.3s ease-in-out infinite; }
.cw-state i:not(:last-child) { opacity: 0; }
.cw-state i:last-child { background: var(--ok-bg); color: var(--ok); }
.cw-state i:last-child::before { animation: none; }
.play.is-live .cw-state i:not(:last-child) { animation: cw-on calc((var(--e) - var(--d)) * 1ms) calc(var(--d) * 1ms); }
.play.is-live .cw-state i:last-child { animation: fc-fade .3s calc(var(--d) * 1ms) both; }

/* Spinner that turns into a tick */
.mk { position: relative; flex: none; width: 16px; height: 16px; }
.mk i { position: absolute; inset: 0; border-radius: 50%; }
.sp { border: 1.5px solid var(--accent); border-right-color: transparent; opacity: 0; }
.tk { background: var(--ok); }
.tk::after { content: ""; position: absolute; left: 5.5px; top: 3px; width: 4px; height: 8px; border: solid #fff; border-width: 0 1.6px 1.6px 0; transform: rotate(45deg); }
.play.is-live .sp { animation: fw-spin .8s linear infinite, cw-on calc((var(--e) - var(--d)) * 1ms) calc(var(--d) * 1ms); }
.play.is-live .tk { animation: fc-fade .3s calc(var(--e) * 1ms) both; }

/* Opening demo: research question, the split, the answer, and its source */
.pl-demo { margin: 0; }
.cw-hero { height: 660px; }
.cw-body { display: grid; grid-template-columns: 172px minmax(0, 1fr) 300px; flex: 1; min-height: 0; }
.cw-rail { display: grid; align-content: start; gap: 2px; padding: 16px 10px; border-right: 1px solid var(--line); background: var(--soft); color: var(--muted); font-size: 12.5px; }
.cw-rail span { display: flex; justify-content: space-between; padding: 7px 10px; border-radius: 6px; }
.cw-rail .is-on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 0 0 1px var(--line); }
.cw-rail em { font-style: normal; }
.cw-main { display: flex; flex-direction: column; gap: 16px; padding: 22px 26px; overflow: hidden; }
.cw-main .msg-body > p:not(.who) { max-width: 60ch; }
.cw-split { padding: 12px 16px 6px; border-radius: 10px; box-shadow: 0 0 0 1px var(--line); }
.cw-split > p { margin-bottom: 4px; color: var(--muted); font-size: 12px; font-weight: 600; }
.cw-split ol { margin: 0; padding: 0; list-style: none; }
.cw-split li { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 8px 0; }
.cw-split li + li { border-top: 1px solid var(--line); }
.cw-split small { color: var(--muted); font-size: 12px; }
.cw-answer p { color: #2f3830; font: 400 16.5px/1.6 "Libre Caslon Display", Georgia, serif; }
.cw-answer sup { color: var(--accent); font: 600 10px/1 Manrope, sans-serif; }
.cw-challenge { padding: 11px 14px; border-left: 2px solid var(--accent); border-radius: 0 8px 8px 0; background: var(--soft); color: #3d463f; line-height: 1.5; }
.cw-challenge b { display: block; margin-bottom: 2px; color: var(--accent); font-size: 12px; font-weight: 600; }
.cw-side { display: flex; flex-direction: column; gap: 12px; padding: 20px; border-left: 1px solid var(--line); background: var(--soft); overflow: hidden; }
.cw-label { color: var(--muted); font-size: 12px; font-weight: 600; }
.cw-cites { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; counter-reset: cite; font-size: 12.5px; line-height: 1.4; }
.cw-cites li { display: flex; gap: 10px; counter-increment: cite; }
.cw-cites li::before { content: counter(cite); display: grid; flex: none; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); font-size: 10.5px; font-weight: 600; }
.cw-source { margin: auto 0 0; padding: 14px 16px; border-radius: 10px; background: #fff; box-shadow: 0 0 0 1px var(--line), 0 14px 30px rgb(24 38 30 / .08); }
.cw-source figcaption { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; font-size: 12.5px; font-weight: 600; }
.cw-source small { color: var(--muted); font-weight: 500; }
.cw-source p { color: #3d463f; font: 400 14px/1.6 "Libre Caslon Display", Georgia, serif; }
.cw-source mark { padding: 1px 0; background: linear-gradient(rgb(53 85 65 / .16), rgb(53 85 65 / .16)) no-repeat 0 0 / 100% 100%; color: var(--ink); }
.play.is-live .cw-source mark { animation: cw-mark 1.2s ease calc(var(--d) * 1ms) both; }
@keyframes cw-mark { from { background-size: 0 100%; } }
.fn-frame .pl-replay { right: 48px; bottom: 18px; }

/* Task panes */
.cw-pad { flex: 1; min-height: 0; padding: 18px 22px; overflow: hidden; }
.cw-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 58px; padding: 12px 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }
.cw-bar { display: flex; align-items: baseline; gap: 10px; padding: 12px 22px; border-bottom: 1px solid var(--line); background: var(--soft); }
.cw-bar small { color: var(--muted); font-size: 12px; }
.cw-bar b { font-weight: 600; }

.grid { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.grid th { padding: 0 14px 8px 0; color: var(--muted); font-size: 11.5px; font-weight: 500; text-align: left; vertical-align: bottom; }
.grid td, .grid tbody th { padding: 11px 14px 11px 0; border-top: 1px solid var(--line); line-height: 1.4; vertical-align: top; }
.grid tbody th { width: 30%; color: var(--ink); font-size: 12.5px; font-weight: 600; }
.grid td small { display: block; color: var(--muted); font-size: 11.5px; }
/* Each cell shows a loading bar until its answer arrives */
.cell { position: relative; }
.cell::before { content: ""; position: absolute; left: 0; top: 15px; width: 72%; height: 8px; border-radius: 4px; background: linear-gradient(90deg, #eef0ec 30%, #dfe4dc 50%, #eef0ec 70%) 0 0 / 300% 100%; opacity: 0; }
@media (scripting: enabled) { .play:not(.is-live) .cell::before { opacity: 1; } }
.play.is-live .cell::before { animation: cw-shimmer 1.1s linear infinite, cw-on calc(var(--d) * 1ms); }
@keyframes cw-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.grid-chron td:first-child { width: 88px; color: var(--muted); white-space: nowrap; }
.grid-chron td:last-child { width: 30%; color: var(--muted); }
.flag { display: block; width: fit-content; margin-top: 6px; padding: 4px 8px; border-radius: 6px; background: var(--amber-bg); color: var(--amber); font-size: 11.5px; font-weight: 600; }

/* The letter: the page on the left, where each paragraph came from on the right */
.lt { position: relative; flex: 1; min-height: 0; padding: 24px 22px; overflow: hidden; background: var(--soft); }
.lt::before { content: ""; position: absolute; top: 16px; bottom: 0; left: 22px; right: 236px; border-radius: 6px 6px 0 0; background: #fff; box-shadow: 0 0 0 1px var(--line), 0 10px 24px rgb(24 38 30 / .06); }
.lt-row { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 46px; align-items: start; padding: 0 28px; }
.lt-row + .lt-row { margin-top: 12px; }
.lt-row:first-child { padding-top: 14px; }
.lt p { color: #2f3830; font: 400 15px/1.6 "Libre Caslon Display", Georgia, serif; }
.lt small { position: relative; margin-top: 4px; padding: 6px 10px; border-radius: 6px; background: #fff; box-shadow: 0 0 0 1px var(--line); color: var(--muted); font-size: 11.5px; line-height: 1.4; }
.lt small::before { content: ""; position: absolute; left: -32px; top: 50%; width: 26px; border-top: 1px dashed #b9c2b5; }

/* Saved workflow */
.wf { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.wf li { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 4px 14px; align-items: start; padding: 13px 16px; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--line); }
.wf .mk { margin-top: 1px; }
.wf b { font-weight: 600; }
.wf small { grid-column: 2; min-height: 1.4em; color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.wf .is-flag small { color: var(--amber); font-weight: 600; }
.wf .is-doc small { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.wf .is-doc small::before { content: ""; display: inline-block; width: 8px; height: 10px; margin-right: 8px; border-radius: 1px; background: var(--accent); vertical-align: -1px; }

/* Router: the model each part goes to lights up in turn */
@media (scripting: enabled) { .pr-models.play:not(.is-live) .rt .best { background: transparent; color: var(--muted); font-weight: 400; } }
.pr-models.play.is-live .rt .best { animation: rt-pick .5s ease calc(var(--d) * 1ms) both; }
@keyframes rt-pick { from { background: transparent; color: var(--muted); } }

/* The record: audit log, time and set-up */
.log-search { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; }
.log-search small { color: var(--muted); font-size: 12px; }
.log { display: grid; margin: 0; padding: 0; list-style: none; }
.log li { display: grid; grid-template-columns: 44px 116px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.log li:first-child { border-top: 0; }
.log time { color: var(--muted); font-variant-numeric: tabular-nums; }
.log b { font-weight: 600; }
.log .is-app b { color: var(--accent); }
.log .is-new { background: linear-gradient(90deg, rgb(53 85 65 / .06), transparent 70%); }
.tl { display: grid; margin: 0; padding: 0; list-style: none; }
.tl li { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.tl li > b { font: 400 20px/1 "Libre Caslon Display", Georgia, serif; }
.tl small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.tl-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }

@media (prefers-reduced-motion: reduce) {
  .play *, .play *::before, .play *::after { animation: none !important; }
}
@media (max-width: 1100px) {
  .cw-body { grid-template-columns: minmax(0, 1fr) 270px; }
  .cw-rail { display: none; }
}
@media (max-width: 900px) {
  .cw-hero { height: auto; }
  .cw-body { grid-template-columns: 1fr; }
  .cw-side { border-left: 0; border-top: 1px solid var(--line); }
  .cw-source { margin-top: 6px; }
  .fn-frame .pl-replay { right: 20px; bottom: 14px; }
}
@media (max-width: 560px) {
  .cw-state { flex-basis: 100%; min-height: 26px; }
  .cw-state i { left: 0; right: auto; }
  .cw-main, .cw-pad, .cw-side { padding: 16px; }
  .cw-split li { grid-template-columns: 16px minmax(0, 1fr); }
  .cw-split small { grid-column: 2; }
  .grid th:nth-child(3), .grid td:nth-child(3) { display: none; }
  .grid-chron td:last-child { display: none; }
  .cw-foot { flex-wrap: wrap; justify-content: flex-start; padding: 12px 16px; }
  .fc .cw { min-height: 800px; } /* the panes keep one height, so the page doesn't jump as they change */
  .lt { padding: 16px; background: #fff; }
  .lt::before { display: none; }
  .lt-row { grid-template-columns: 1fr; gap: 6px; padding: 0; }
  .lt small { justify-self: start; }
  .lt small::before { display: none; }
  .log li { grid-template-columns: 40px minmax(0, 1fr); }
  .log li span { grid-column: 2; }
  .tl-foot { flex-wrap: wrap; }
}
