/* =============================================================
   DS3 for AI: a concept case study (work/wbk-ds.html).
   Sits on the v3 case layout (case-v3.css). No screens or
   components here: the page is prompts, code and diagrams.
   ============================================================= */

body.ds { --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace; --stage: var(--bg-elev);
  --dots: radial-gradient(circle at 50% 50%, rgba(17,17,17,.07) 0 1.4px, transparent 1.8px) 0 0 / 18px 18px;
  --ink-line: #2b2b2b; --key: #161616; }
body.ds code { font-family: var(--mono); font-size: .88em; background: rgba(17,17,17,.06); padding: .08em .35em; border-radius: 6px; }

/* ---------- hero ---------- */
.ds-hero { grid-template-columns: minmax(0, 1fr); align-items: start; row-gap: clamp(2.5rem, 5vw, 3.5rem); }
.ds-hero .cv-title { max-width: 16ch; }
.ds-hero .cv-lede { max-width: 40rem; }
.ds-kicker { display: flex; align-items: center; gap: .6rem; margin: 1.4rem 0 -.4rem; font-size: .85rem; color: var(--fg-muted); }
.ds-kicker span { font: 500 .6875rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--bg);
  background: var(--fg); padding: .38rem .6rem; border-radius: 999px; }
.ds-facts { margin: 2rem 0 0; display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 18px;
  background: var(--bg-elev); overflow: hidden; max-width: 34rem; }
.ds-facts > div { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.ds-facts > div:nth-child(1) { border-right: 1px solid var(--line); }
.ds-facts__wide { grid-column: 1 / -1; border-bottom: 0 !important; }
.ds-facts dt { font: 500 .6875rem/1.2 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--fg-faint); }
.ds-facts dd { margin: .4rem 0 0; font-size: .9375rem; line-height: 1.45; color: var(--fg); }
.ds-tags { list-style: none; margin: .15rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.ds-tags li { font-size: .8125rem; padding: .25rem .6rem; border-radius: 8px; background: #fff; border: 1px solid var(--line); }

/* ---------- diagrams ----------
   Outlined boxes joined by arrows, on the cream stage. A row runs left to
   right and turns into a column on phones; a group is a dashed frame; a
   fork stacks the outcomes of one step. */
.dg { margin: 1.75rem 0 0; max-width: var(--wide); background: var(--stage) var(--dots); border: 1px solid var(--border-2);
  border-radius: 30px; padding: clamp(18px, 2.6vw, 30px); }
.dg-row { display: flex; align-items: center; }
.dg-node { position: relative; flex: 1 1 0; min-width: 0; display: grid; justify-items: start; gap: 4px; background: #fff;
  border: 1px solid var(--ink-line); border-radius: 12px; padding: 12px 12px 13px; transition: background .35s, box-shadow .35s, opacity .35s; }
.dg-node b { font-size: .8125rem; font-weight: 600; line-height: 1.25; color: var(--fg); }
.dg-node span { font-size: .75rem; line-height: 1.4; color: var(--fg-muted); }
.dg-ic { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--bg-elev); margin-bottom: 4px; }
.dg-ic svg { width: 16px; height: 16px; fill: none; stroke: var(--fg); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.dg-node--s { padding: 9px 11px 10px; }
.dg-node--s .dg-ic { width: 22px; height: 22px; margin-bottom: 2px; }
.dg-node--s .dg-ic svg { width: 14px; height: 14px; }
.dg-node--key { background: var(--key); border-color: var(--key); }
.dg-node--key b { color: #fff; }
.dg-node--key .dg-ic svg { stroke: #fff; }
.dg-node--key .dg-ic { background: rgba(255,255,255,.12); }
.dg-node--key span { color: rgba(255,255,255,.7); }
.dg-node--bad { border-style: dashed; }
.dg-node--bad .dg-ic svg { stroke: #b42318; }

.dg-group { flex: 1.25 1 0; min-width: 0; display: grid; gap: 8px; padding: 26px 10px 10px; position: relative;
  border: 1px dashed #9b948a; border-radius: 16px; background: rgba(255,255,255,.35); transition: background .35s, opacity .35s; }
.dg-group__k { position: absolute; top: 8px; left: 12px; font: 500 .625rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--fg-faint); }
.dg-fork { flex: 1.1 1 0; min-width: 0; display: grid; gap: 8px; transition: opacity .35s; }
.dg-fork--4 { flex: 1.4 1 0; }
.dg-chips { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.dg-chips span { font: 500 .6875rem/1 var(--mono); text-align: center; padding: 9px 4px; border-radius: 9px; background: #fff; border: 1px solid var(--line); white-space: nowrap; }

/* arrows: a line with a head; "is-both" has a head at each end; a label rides above */
.dg-arr { position: relative; flex: 0 0 34px; align-self: center; height: 1px; background: var(--ink-line); margin: 0 2px; }
.dg-arr::after, .dg-arr.is-both::before { content: ""; position: absolute; top: -3.5px; width: 7px; height: 7px; border-top: 1px solid var(--ink-line); border-right: 1px solid var(--ink-line); }
.dg-arr::after { right: 0; transform: rotate(45deg); }
.dg-arr.is-both::before { left: 0; transform: rotate(-135deg); }
.dg-arr em { position: absolute; bottom: 7px; left: 50%; transform: translateX(-50%); font: 500 .5625rem/1.2 var(--mono); font-style: normal;
  letter-spacing: .04em; text-transform: uppercase; color: var(--fg-faint); white-space: nowrap; text-align: center; }
.dg-arr:has(em) { flex-basis: 74px; }
.dg-cap { margin-top: 1.1rem; font-size: .8125rem; line-height: 1.5; color: var(--fg-muted); }

/* hero: one step lit at a time, with a progress bar under it */
.dg--hero { padding: clamp(20px, 3vw, 34px); }
.dg--hero.is-live [data-s]:not(.is-on) { opacity: .45; }
.dg--hero .dg-node.is-on, .dg--hero .is-on .dg-node { box-shadow: 0 10px 24px rgba(17,17,17,.10); }
.dg--hero .dg-group.is-on { background: rgba(255,255,255,.8); }
.dg-progress { margin-top: 1.5rem; display: grid; gap: .7rem; }
.dg-progress ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.dg-progress button { display: block; width: 100%; height: 14px; padding: 6px 0; border: 0; cursor: pointer; background: none; }
.dg-progress button::before { content: ""; display: block; height: 2px; border-radius: 2px; background: rgba(17,17,17,.14); transition: background .35s; }
.dg-progress li.is-done button::before, .dg-progress li.is-on button::before { background: var(--fg); }
.dg-progress p { display: flex; gap: .75rem; margin: 0; font-size: .8125rem; color: var(--fg-muted); }
.dg-progress p span:first-child { font-family: var(--mono); color: var(--fg-faint); }

/* ---------- body ---------- */
.ds-num { font: 500 .75rem/1 var(--mono); color: var(--fg-faint); letter-spacing: .06em; margin-bottom: .9rem; }
.ds-h3 { margin-top: 2.5rem; font-family: var(--font-sans); font-size: 1.25rem; font-weight: 600; letter-spacing: -.01em; color: var(--fg); }

.ds-strip { list-style: none; margin: 2.25rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; max-width: var(--wide); }
.ds-strip li { background: var(--bg-elev); border-radius: 20px; padding: 18px 20px 20px; }
.ds-strip b { display: block; font-family: var(--font-serif); font-weight: 400; font-size: clamp(2.25rem, 4vw, 3rem); line-height: 1; color: var(--fg); }
.ds-strip span { display: block; margin-top: .6rem; font-size: .875rem; line-height: 1.4; color: var(--fg-muted); }

/* code: dark, like the DS3 dark theme */
.ds-code { margin: 1.5rem 0 0; max-width: var(--wide); background: #0b0b0e; color: #d4d4d8; border-radius: 20px; padding: 20px 22px;
  overflow-x: auto; font: .8125rem/1.7 var(--mono); tab-size: 2; }
body.ds .ds-code code { background: none; padding: 0; font-size: inherit; color: inherit; white-space: pre; }
.ds-code b { color: #fff; font-weight: 500; }
.ds-code i { color: #71717a; font-style: normal; }
.ds-code s { text-decoration: none; color: #e8c9a0; }
.ds-code em { font-style: normal; color: #ff5693; }
.ds-code u { text-decoration: none; color: #22c55e; }

/* rule lists */
.ds-rules, .ds-checks { list-style: none; margin: 1.5rem 0 0; padding: 0; max-width: var(--wide); display: grid; gap: 10px; }
.ds-rules li, .ds-checks li { display: grid; grid-template-columns: 8rem 1fr; gap: 1rem; align-items: baseline;
  background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 14px 18px; }
.ds-rules b, .ds-checks b { font: 500 .8125rem/1.3 var(--mono); color: var(--fg); }
.ds-rules span, .ds-checks span { font-size: .9375rem; line-height: 1.5; color: var(--ink); }
.ds-checks { grid-template-columns: 1fr 1fr; }
.ds-checks li { grid-template-columns: 1fr; gap: .4rem; }
.ds-table td code { white-space: nowrap; }

/* the test plan */
.ds-test { list-style: none; margin: 1.75rem 0 0; padding: 0; max-width: var(--wide); display: grid; grid-template-columns: 1fr 1fr; gap: 12px; counter-reset: t; }
.ds-test li { counter-increment: t; border: 1px dashed var(--border); border-radius: 18px; padding: 18px 20px; }
.ds-test li::before { content: counter(t); display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--fg); color: var(--bg); font: 600 .75rem/1 var(--font-sans); margin-bottom: .7rem; }
.ds-test b { display: block; font-size: 1rem; font-weight: 600; color: var(--fg); }
.ds-test span { display: block; margin-top: .35rem; font-size: .9375rem; line-height: 1.5; color: var(--fg-muted); }

/* where it applies */
.ds-where { list-style: none; margin: 1.75rem 0 0; padding: 0; max-width: var(--wide); display: grid; gap: 10px; }
.ds-where a { display: grid; grid-template-columns: 14rem 1fr auto; gap: 1rem; align-items: center; padding: 16px 20px; border-radius: 16px;
  background: var(--bg-elev); color: var(--fg); transition: background .25s; }
.ds-where a:hover { background: #ece7dc; }
.ds-where b { font-weight: 600; } .ds-where span { color: var(--fg-muted); font-size: .9375rem; }
.ds-where i { font-style: normal; color: var(--fg-faint); transition: transform .35s var(--ease); }
.ds-where a:hover i { transform: translateX(3px); }

@media (prefers-reduced-motion: reduce) { .dg-node, .dg-group, .dg-fork { transition: none; } }

/* below this the diagrams run top to bottom, arrows pointing down */
@media (max-width: 860px) {
  .dg-row { flex-direction: column; align-items: stretch; }
  .dg-node, .dg-group, .dg-fork { flex: none; }
  .dg-arr { flex: none; width: 1px; height: 26px; margin: 2px auto; align-self: center; }
  .dg-arr::after { top: auto; bottom: 0; right: -3px; transform: rotate(135deg); }
  .dg-arr.is-both::before { top: 0; left: -3px; transform: rotate(-45deg); }
  .dg-arr em { bottom: auto; top: 50%; left: 12px; transform: translateY(-50%); text-align: left; }
  .dg-arr:has(em) { height: 34px; }
  .dg-fork, .dg-fork--4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .ds-facts { grid-template-columns: 1fr; }
  .ds-facts > div:nth-child(1) { border-right: 0; }
  .ds-strip { grid-template-columns: 1fr 1fr; }
  .ds-rules li { grid-template-columns: 1fr; gap: .3rem; }
  .ds-checks, .ds-test { grid-template-columns: 1fr; }
  .ds-where a { grid-template-columns: 1fr auto; }
  .ds-where span { grid-column: 1; }
  .ds-where i { grid-row: 1 / span 2; grid-column: 2; }
  .ds-code { border-radius: 16px; padding: 16px; font-size: .75rem; }
  .dg { padding: 14px; border-radius: 24px; }
}
