/* Product cards: eight invented products' cards with live figures, in three layouts (standard, wide, compact) and the
   three Keyline styles (brand in a recessed well, line art on the bare card, dots large and cropped). Self-contained:
   it needs only home/base.css for the page shell. The cards are mock product UI, so they are set in Inter. */
::selection { background: color-mix(in srgb, var(--ink) 16%, transparent); }

/* ---------- card surfaces (light, then dark). The plate hexes in cards.js must match --c-card and --c-well. ---------- */
.cd {
  --c-card: #ffffff; --c-well: #f4f4f6; --c-foot: #f7f7f9; --c-raise: #ffffff;
  --c-edge: rgba(24, 24, 27, .09); --c-edge-2: rgba(24, 24, 27, .14); --c-hi: rgba(255, 255, 255, 0);
  --c-ink: #18181b; --c-2: #3f3f46; --c-3: #6b6b74; --c-lead: rgba(24, 24, 27, .32);
  --c-shadow: 0 1px 2px rgba(24, 24, 27, .04), 0 8px 24px -12px rgba(24, 24, 27, .12);
  --c-pill: rgba(24, 24, 27, .05); --c-hover: rgba(24, 24, 27, .07);
  --t-green: #23915f; --t-amber: #b7791f; --t-blue: #3b6fd8; --t-red: #d14343; --t-grey: #8a8a93;
  --c-btn: #18181b; --c-btn-ink: #fafafa;
  --ui: 'Inter', 'IBM Plex Sans', system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .cd {
    --c-card: #161618; --c-well: #0f0f11; --c-foot: #131315; --c-raise: #1c1c1f;
    --c-edge: rgba(255, 255, 255, .07); --c-edge-2: rgba(255, 255, 255, .11); --c-hi: rgba(255, 255, 255, .04);
    --c-ink: #f7f8f8; --c-2: #d0d6e0; --c-3: #8a8f98; --c-lead: rgba(247, 248, 248, .34);
    --c-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px -16px rgba(0, 0, 0, .7);
    --c-pill: rgba(255, 255, 255, .06); --c-hover: rgba(255, 255, 255, .09);
    --t-green: #4cb782; --t-amber: #f2c94c; --t-blue: #6b9bff; --t-red: #eb5757; --t-grey: #8a8f98;
    --c-btn: #e5e5e6; --c-btn-ink: #0f0f11;
  }
}
:root[data-theme="dark"] .cd {
  --c-card: #161618; --c-well: #0f0f11; --c-foot: #131315; --c-raise: #1c1c1f;
  --c-edge: rgba(255, 255, 255, .07); --c-edge-2: rgba(255, 255, 255, .11); --c-hi: rgba(255, 255, 255, .04);
  --c-ink: #f7f8f8; --c-2: #d0d6e0; --c-3: #8a8f98; --c-lead: rgba(247, 248, 248, .34);
  --c-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px -16px rgba(0, 0, 0, .7);
  --c-pill: rgba(255, 255, 255, .06); --c-hover: rgba(255, 255, 255, .09);
  --t-green: #4cb782; --t-amber: #f2c94c; --t-blue: #6b9bff; --t-red: #eb5757; --t-grey: #8a8f98;
  --c-btn: #e5e5e6; --c-btn-ink: #0f0f11;
}

/* ---------- page ---------- */
.cd { padding-top: 72px; }
.cd-crumb a { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--soft); }
.cd-crumb a:hover { color: var(--ink); }
.cd-head h1 { margin-top: 20px; font-weight: 500; font-size: 44px; line-height: 1.08; letter-spacing: -0.035em; }
.cd-head > p:last-child { margin-top: 16px; font-size: 16px; line-height: 1.55; color: var(--soft); max-width: 58ch; }
.cd-group { margin-top: 104px; }
.cd-group:first-of-type { margin-top: 56px; }
.cd-gh { margin-bottom: 28px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 3fr); column-gap: 16px; align-items: baseline; }
.cd-gh h2 { font-weight: 500; font-size: 20px; line-height: 1.3; letter-spacing: -0.02em; }
.cd-gh p { font-size: 15px; line-height: 1.55; color: var(--soft); max-width: 62ch; }

.cd-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 40px 16px; align-items: start; }
.cd-item { min-width: 0; }
.cd-item.wide { grid-column: span 2; }

/* ---------- the card: a raised surface on the page, a hairline edge, a soft drop; the footer is a faintly tinted band, no rule ---------- */
/* Nothing is drawn over a figure: no leaders, no labels on it. A part is named by the rows beside it or by lighting it. */
.pc { --kl: #f5821f; position: relative; display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  font-family: var(--ui); font-feature-settings: 'cv11', 'ss01'; color: var(--c-ink);
  background: var(--c-card); border: 1px solid var(--c-edge); border-radius: 12px;
  box-shadow: inset 0 1px 0 var(--c-hi), var(--c-shadow); }
.pc-top { position: relative; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 14px 0 16px; }
.pc-top > div { min-width: 0; }
.pc-top h3 { font-size: 15px; font-weight: 510; line-height: 20px; letter-spacing: -0.012em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-sub { margin-top: 1px; font-size: 12.5px; line-height: 17px; color: var(--c-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px 0 7px; border-radius: 999px;
  background: var(--c-pill); font-size: 12px; font-weight: 450; color: var(--c-2); white-space: nowrap; }
.pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--tone, var(--t-grey)); flex: none; }
.pill[data-tone="green"] { --tone: var(--t-green); } .pill[data-tone="amber"] { --tone: var(--t-amber); }
.pill[data-tone="blue"] { --tone: var(--t-grey); } .pill[data-tone="red"] { --tone: var(--t-red); }

/* the figure: --z its size against the area, --x/--y its centre as fractions of the area (cards.js sets them) */
.pc-fig { position: relative; height: 196px; }
.pc-fig .win { inset: 0; }
.pc-fig .win :is(iframe, .kl-svg) {
  left: calc(var(--x, .5) * 100% - var(--z, 1) * 50%); top: calc(var(--y, .5) * 100% - var(--z, 1) * 50%);
  width: calc(var(--z, 1) * 100%); height: calc(var(--z, 1) * 100%); }
/* brand: the figure sits in a recessed well, the product UI's own inset panel */
.pc[data-style="brand"] .pc-fig { margin: 12px 12px 0; border-radius: 9px; background: var(--c-well); overflow: hidden; }

/* metric: the number and its unit on one baseline; under it a delta and one line of caption */
.pc-num { position: relative; z-index: 2; padding: 16px 16px 0; pointer-events: none; min-width: 0; }
.pc-num .v { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.pc-num b { font-weight: 510; font-size: 34px; line-height: 1; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.pc-num .u { font-size: 13px; color: var(--c-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-num p { margin-top: 8px; display: flex; gap: 8px; font-size: 13px; line-height: 18px; color: var(--c-3); white-space: nowrap; overflow: hidden; }
.pc-num p:has(.d:empty):has(.cap:empty) { display: none; }
.pc-num .d { font-weight: 510; font-variant-numeric: tabular-nums; color: var(--c-3); }
.pc-num .d:empty { display: none; }
.pc-num .d[data-tone="up"] { color: var(--t-green); } .pc-num .d[data-tone="down"] { color: var(--t-red); }
.pc-num .cap { overflow: hidden; text-overflow: ellipsis; }

/* rows: plain 13 px, label grey, value ink; no rules, the rhythm and the two tones keep them apart */
.rows { margin: 14px 16px 6px; font-size: 13px; line-height: 20px; }
.rows > div { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.rows dt { color: var(--c-3); white-space: nowrap; }
.rows dd { color: var(--c-ink); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; }
/* strip: three stats side by side, label over value */
.rows.strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 16px; }
.rows.strip > div { flex-direction: column; gap: 2px; padding: 6px 0 4px; min-width: 0; }
.rows.strip dd { text-align: left; }

.pc-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 52px; padding: 0 10px 0 16px;
  background: var(--c-foot); position: relative; z-index: 2; }
.pc-num + .pc-foot { margin-top: 16px; }
.pc-meta { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12.5px; color: var(--c-3); }
.pc-meta span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.av { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 9px; font-weight: 600; letter-spacing: .02em;
  color: var(--c-2); background: var(--c-raise); box-shadow: inset 0 0 0 1px var(--c-edge-2); }
/* buttons: quiet pills; one orange primary on the whole page */
.pc-btn { flex: none; height: 30px; padding: 0 13px; border-radius: 999px; border: 0; background: var(--c-hover); color: var(--c-ink);
  font: 510 13px/1 var(--ui); letter-spacing: -0.005em; cursor: pointer; white-space: nowrap;
  transition: background-color .15s; }
.pc-btn:hover { background: color-mix(in srgb, var(--c-ink) 12%, transparent); }
.pc-btn[data-primary] { background: var(--kl); color: #fff; box-shadow: none; }
.pc-btn[data-primary]:hover { background: color-mix(in srgb, var(--kl) 88%, #fff); }
.pc-btn:focus-visible { outline: 1px solid var(--c-ink); outline-offset: 2px; }
.pc-btn:disabled { background: transparent; color: var(--c-3); cursor: default; }

/* hero: the drawing leads the card, on the bare surface, before the title */
.pc.hero .pc-fig { height: 210px; }
.pc.hero .pc-top { padding-top: 4px; }

/* stage: a figure that fills an area of the card, the copy set in its clear space */
.pc-stage { position: relative; height: 288px; }
.pc-stage > .pc-fig { position: absolute; inset: 0; height: auto; margin: 0; }
.pc.bleed-low .pc-stage > .pc-num { position: absolute; left: 0; top: 0; }
.pc.bleed-low .pc-num b { font-size: 40px; }
.pc.bleed-side .pc-col { position: absolute; left: 0; top: 0; bottom: 0; width: 52%; display: flex; flex-direction: column; justify-content: space-between; z-index: 2; pointer-events: none; }
.pc.bleed-side .pc-col .rows { margin-bottom: 8px; }

/* wide: details in a left column, the figure on the right */
.pc.wide .pc-stage { height: 300px; }
.pc.wide:not(.bleed-side) .pc-stage { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.pc.wide:not(.bleed-side) .pc-stage > .pc-fig { position: relative; inset: auto; margin: 12px 12px 12px 0; }
.pc.wide .pc-col { display: flex; flex-direction: column; justify-content: space-between; min-width: 0; }
.pc.wide.bleed-side .pc-col { width: 42%; }
.pc.wide .pc-num b { font-size: 44px; }

/* compact: a shorter figure, one number */
.pc.compact .pc-fig { height: 176px; }
.pc.compact[data-style="brand"] .pc-fig { height: 164px; }
.pc.compact .pc-num b { font-size: 30px; }

/* the compact pair takes the right half of its row; its heading the left half */
@media (min-width: 1181px) {
  .cd-group.side { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: 16px; align-items: start; }
  .cd-group.side .cd-gh { grid-column: span 2; display: block; padding-right: 48px; }
  .cd-group.side .cd-gh p { margin-top: 8px; }
  .cd-group.side .cd-grid { grid-column: span 2; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- caption under each card ---------- */
.cd-cap { margin-top: 14px; }
.cd-cap .why { font-size: 13px; line-height: 1.5; color: var(--soft); max-width: 52ch; }
.cd-cap .why b { font-weight: 500; color: var(--ink); }
.cd-cap .why code { font: 400 12px/1 var(--mono); color: var(--ink); }
.cd-cap .fig-line { margin-top: 8px; font-size: 13px; color: var(--soft); display: flex; align-items: baseline; gap: 8px; }
.cd-cap .fig-line a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--rule-2); text-underline-offset: 3px; }
.cd-cap .fig-line a:hover { text-decoration-color: var(--ink); }
.embed { margin-top: 10px; display: flex; align-items: center; gap: 4px; height: 32px; padding: 0 4px 0 10px; border-radius: 8px; background: var(--hover); }
.embed code { flex: 1; min-width: 0; font: 400 11px/1 var(--mono); color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.copy { flex: none; height: 24px; padding: 0 8px; display: inline-flex; align-items: center; gap: 5px; border: 0; border-radius: 6px; background: none; font-size: 12px;
  color: var(--soft); cursor: pointer; }
.copy:hover { background: var(--hover); color: var(--ink); }
.copy:focus-visible { outline: 1px solid var(--ink); outline-offset: 1px; }
.copy i { font-size: 13px; }

/* ---------- smaller screens ---------- */
@media (max-width: 1180px) {
  .cd-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .cd { padding-top: 48px; }
  .cd-head h1 { font-size: 34px; }
  .cd-group { margin-top: 72px; }
  .cd-gh { display: block; }
  .cd-gh p { margin-top: 6px; }
  .cd-grid { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .cd-item.wide { grid-column: auto; }
  /* the wide cards stack: details over the figure */
  .pc.wide .pc-stage, .pc.wide:not(.bleed-side) .pc-stage { display: block; height: auto; }
  .pc.wide .pc-col, .pc.wide.bleed-side .pc-col { position: relative; width: auto; }
  .pc.wide .pc-stage > .pc-fig, .pc.wide:not(.bleed-side) .pc-stage > .pc-fig { position: relative; inset: auto; height: 220px; }
  .pc.wide:not(.bleed-side) .pc-stage > .pc-fig { margin: 4px 12px 12px; }
  .pc.wide .pc-num b { font-size: 36px; }
}

/* the stand-in SVG carries the kernel's default plate; blend it into the surface it sits on */
.pc .pc-fig .kl-svg { mix-blend-mode: multiply; filter: brightness(1.033); }
.pc[data-style="brand"] .pc-fig .kl-svg { mix-blend-mode: darken; filter: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pc .pc-fig .kl-svg { mix-blend-mode: lighten; filter: none; } }
:root[data-theme="dark"] .pc .pc-fig .kl-svg { mix-blend-mode: lighten; filter: none; }
