@import url("ds/tokens/fonts.css");
@import url("ds/tokens/colors.css");
@import url("ds/tokens/typography.css");
@import url("ds/tokens/spacing.css");
@import url("ds/tokens/motion.css");
@import url("ds/css/components.css");

/* Project colours, taken from the design system's chapter palette. Fixed in both themes. */
.p-factory { --p: #005F73; --p-sub: #CDE6EA; }
.p-evals   { --p: #691E5A; --p-sub: #F0D9EA; }
.p-quality { --p: #2B5C45; --p-sub: #D3E8DD; }
.p-training{ --p: #004B87; --p-sub: #CFE0F0; }

body { font-size: 17px; line-height: 1.6; }
.wrap { max-width: 1104px; margin: 0 auto; padding: 0 var(--gutter); }

/* Header: small, sober */
.bh { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 10; }
.bh .wrap { display: flex; align-items: center; gap: 28px; height: 72px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; font-size: 19px; letter-spacing: -0.01em; }
.brand svg { width: 30px; height: 30px; fill: currentColor; }
.brand span { color: var(--fg2); font-weight: 600; }
.bh nav { display: flex; gap: 22px; margin-left: auto; font-size: 15px; font-weight: 600; }
.bh nav a { text-decoration: none; color: var(--fg2); padding: 6px 0; border-bottom: 3px solid transparent; }
.bh nav a[aria-current="page"] { color: var(--fg); border-bottom-color: var(--coral); }

/* Project tag: a dot plus the project name. Colour is never the only signal. */
.ptag { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: var(--fg); text-decoration: none; }
.ptag::before { content: ""; width: 10px; height: 10px; border-radius: 999px; background: var(--p); flex: none; }
[data-theme="dark"] .ptag::before { box-shadow: 0 0 0 1.5px rgba(255,255,255,.5); }
.meta { font-size: 14px; color: var(--fg2); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Page title, documentation-plain */
.ptitle { margin: 48px 0 8px; font-size: clamp(30px, 3.4vw, 40px); line-height: 1.15; letter-spacing: -0.025em; font-weight: 800; text-wrap: balance; }

/* Index layout */
.idx { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 56px; padding-bottom: 96px; }
@media (max-width: 900px) { .idx { grid-template-columns: 1fr; } .bh nav { display: none; } }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 8px; }
.chip { font: inherit; font-size: 14px; font-weight: 700; border: 1.5px solid var(--line); background: transparent; color: var(--fg); border-radius: 999px; padding: 7px 14px; display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.chip i { width: 9px; height: 9px; border-radius: 999px; background: var(--p); }

.posts { list-style: none; margin: 0; padding: 0; }
.post { border-top: 1px solid var(--line); padding: 26px 0; display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 20px; }
.post time { font-size: 14px; color: var(--fg2); padding-top: 4px; }
.post h2 { margin: 6px 0 6px; font-size: 22px; line-height: 1.3; letter-spacing: -0.01em; font-weight: 700; }
.post h2 a { text-decoration: none; }
.post h2 a:hover { text-decoration: underline; opacity: 1; }
.post p { margin: 0; color: var(--fg2); }
.post .kind { font-size: 13px; font-weight: 700; color: var(--fg2); border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; margin-left: 6px; }

.side h2 { font-size: 15px; font-weight: 700; color: var(--fg2); margin: 56px 0 12px; }
.proj { display: block; text-decoration: none; padding: 16px 18px; border-radius: 13px; background: var(--bg-alt); margin-bottom: 10px; }
.proj strong { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.proj strong::before { content: ""; width: 10px; height: 10px; border-radius: 999px; background: var(--p); }
.proj span { display: block; font-size: 15px; color: var(--fg2); line-height: 1.45; margin-top: 4px; }
.subscribe { font-size: 15px; color: var(--fg2); margin-top: 20px; line-height: 1.5; }
.subscribe a { color: var(--fg); font-weight: 700; }

/* Article */
.art { display: flex; gap: 56px; align-items: flex-start; padding-bottom: 96px; }
.art .toc { margin-top: 56px; }
@media (max-width: 960px) { .art .toc { display: none; } }
.art-head { display: flex; flex-direction: column; gap: 14px; margin: 48px 0 8px; }
.art-head h1 { margin: 0; font-size: clamp(32px, 3.8vw, 46px); line-height: 1.12; letter-spacing: -0.03em; font-weight: 800; text-wrap: balance; }
.short { border-left: 4px solid var(--p); background: var(--bg-alt); border-radius: 0 16px 16px 0; padding: 22px 26px; font-size: 19px; line-height: 1.55; font-weight: 500; }
.short b { display: block; font-size: 15px; color: var(--fg2); font-weight: 700; margin-bottom: 6px; }
.who { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .who { grid-template-columns: 1fr; } }
.who .callout { font-size: 17px; }
.who .callout ul { padding-left: 1.2em; gap: 6px !important; }
.endnav { display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); padding-top: 24px; margin-top: 16px; font-size: 16px; }
.endnav a { text-decoration: none; display: flex; flex-direction: column; gap: 4px; }
.endnav a span { font-size: 14px; color: var(--fg2); }
.endnav a strong { font-size: 17px; }

/* Diagram colour helpers */
.dg-p { fill: var(--p); }
.dg-on-p { fill: #FFFFFF; font-family: var(--font); }
.dg-arrow { stroke: var(--fg2); fill: none; stroke-width: 2; }
.dg-arrowhead { fill: var(--fg2); }

/* Project page timeline */
.timeline { list-style: none; margin: 32px 0 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.timeline li { position: relative; padding: 0 0 34px 40px; }
.timeline li::before { content: ""; position: absolute; left: 0; top: 6px; width: 16px; height: 16px; border-radius: 999px; background: var(--bg); border: 3px solid var(--p); }
.timeline li.big::before { background: var(--p); }
.timeline time { font-size: 14px; color: var(--fg2); }
.timeline h2 { margin: 4px 0 6px; font-size: 21px; line-height: 1.3; font-weight: 700; }
.timeline h2 a { text-decoration: none; }
.timeline p { margin: 0; color: var(--fg2); max-width: 640px; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 24px; }
.facts div { background: var(--bg-alt); border-radius: 13px; padding: 16px 18px; }
.facts dt { font-size: 14px; color: var(--fg2); font-weight: 700; }
.facts dd { margin: 4px 0 0; font-size: 17px; font-weight: 600; }
@media (max-width: 640px) { .facts { grid-template-columns: 1fr; } }

.foot { border-top: 1px solid var(--line); padding: 28px 0 40px; font-size: 14px; color: var(--fg2); }
.foot .wrap { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }

/* Mockup-only switcher */
.mock-bar { position: fixed; right: 16px; bottom: 16px; z-index: 99; display: flex; gap: 6px; background: var(--fg); color: var(--bg); padding: 6px; border-radius: 999px; font-size: 13px; font-weight: 700; box-shadow: var(--shadow-pop); }
.mock-bar a, .mock-bar button { color: inherit; background: none; border: 0; font: inherit; padding: 6px 12px; border-radius: 999px; text-decoration: none; cursor: pointer; }
.mock-bar .on { background: var(--bg); color: var(--fg); }
@media (max-width: 640px) { .post { grid-template-columns: 1fr; gap: 2px; } }

/* Site additions */
.themebtn { display: grid; place-items: center; padding: 0; background: none; border: 1.5px solid var(--line); color: var(--fg2); border-radius: 999px; width: 36px; height: 36px; cursor: pointer; flex: none; }
.bh nav + .themebtn { margin-left: 0; }
.kind.draft { border-color: var(--coral); color: var(--fg); }
.projpage { padding-bottom: 96px; max-width: 860px; }
.pdot { width: 18px; height: 18px; border-radius: 999px; background: var(--p); display: inline-block; margin-right: 14px; vertical-align: 0.05em; }
.lede { margin: 0; font-size: 19px; max-width: 680px; }
.draftbanner { margin-top: 32px; }
.draftbanner p { margin: 0; }
.post[hidden] { display: none; }
.figure figcaption { font-size: 15px; color: var(--fg2); margin-top: 12px; }
.prose .figure { padding: 20px 16px; }
