/* The taste-skill visuals (UI fragments, diagrams) in Kanan's brand: they read their colours, type
   and radius from these custom properties (ui/base.css, ui/cards.css, diagrams/diagram.css). Values
   come from the brand tokens in src/styles/global.css, with the same values as fallbacks. */
.kit {
  --ink: var(--color-ink, #161716);
  --muted: var(--color-ink-muted, #5f6368);
  --card: var(--color-paper, #ffffff);
  --bg: var(--color-stone, #eeece7);
  --frag: var(--color-paper, #ffffff);
  --accent: var(--color-lead-deep, #2a2f36);
  --accent-ink: var(--color-stone, #eeece7);
  --font-text: var(--font-sans, "Instrument Sans", system-ui, sans-serif);
  --font-display: var(--font-serif, "Newsreader", Georgia, serif);
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --ui-font: var(--font-text);
  --ui-mono: var(--font-mono);
  --ui-radius: 4px;
  --r-sm: 4px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ground-bg: var(--color-stone, #eeece7);
  --calm: var(--color-paper, #ffffff);
}
.kit .stage { --ui-radius: 4px; }
.kit .ui { --u-accent: var(--accent); }

/* on the dark section (lead-deep) */
.kit--dark {
  --ink: var(--color-stone, #eeece7);
  --muted: var(--color-lead-mist, #a3aab3);
  --card: var(--color-lead-deep, #2a2f36);
  --bg: var(--color-lead-deep, #2a2f36);
  --frag: color-mix(in oklab, var(--color-lead-deep, #2a2f36) 88%, white);
  --accent: var(--color-lead-light, #c7cdd4);
  --accent-ink: var(--color-lead-deep, #2a2f36);
}

/* cinnabar marks risk only: the light on the attack-path diagram */
.kit--risk .dg { --dg-pulse: var(--color-cinnabar, #b8442b); --dg-halo: 0.05; }

/* panels sit inside the brand's bordered frames: square, a stone ground with the brand dot grid */
.kit .panel { --p-r: 0px; border-radius: 0; }
.kit .panel, .kit .hero-window {
  background-color: var(--color-stone, #eeece7);
  background-image: radial-gradient(color-mix(in oklab, var(--color-ink, #161716) 14%, transparent) 1px, transparent 1px);
  background-size: 16px 16px;
}
.kit .panel::after { box-shadow: none; }
.kit .panel { --p-h: 300px; }
@media (max-width: 639px) { .kit .panel { --p-h: 240px; } }

/* the diagram cards: no own frame, the brand figure is the frame */
.kit .dg-frame { padding: 24px; }
@media (min-width: 768px) { .kit .dg-frame { padding: 40px; } }

/* ---------------------------------------------------------------- the product window (app-frame) */
.app.ui { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); background: var(--u-bg); border: 1px solid var(--u-border); border-radius: var(--u-r); box-shadow: var(--u-shadow); }
.app > .app__pane { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
.app > .app__pane + .app__pane { border-left: 1px solid var(--u-line); }
.app > .app__pane > .ui-panel { width: 100%; border: 0; border-radius: 0; box-shadow: none; }
.app > .app__pane::after { content: ""; position: absolute; inset: auto 0 0 0; height: 64px; background: linear-gradient(transparent, var(--u-bg)); pointer-events: none; }
@media (min-width: 1024px) and (max-width: 1279px) { .app.ui { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); } }
@media (max-width: 1023px) {
  .app.ui { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .app > .app__pane--list { max-height: 252px; }
  .app > .app__pane--list::after { display: none; }
  .app .ui-win__side { display: none; }
  .app .ui-win__body { grid-template-columns: minmax(0, 1fr); }
  .app > .app__pane + .app__pane { border-left: 0; border-top: 1px solid var(--u-line); }
}
@media (max-width: 639px) {
  .app.ui { grid-template-rows: minmax(0, 1fr); }
  .app > .app__pane--list { display: none; }
  .app > .app__pane + .app__pane { border-top: 0; }
}
.hero-window { position: relative; overflow: hidden; height: 520px; padding: 32px 32px 0;
  -webkit-mask: linear-gradient(to bottom, #000 calc(100% - 56px), transparent);
  mask: linear-gradient(to bottom, #000 calc(100% - 56px), transparent); }
.hero-window .app.ui { height: 600px; }
@media (min-width: 768px) { .hero-window { height: 560px; padding: 48px 48px 0; } }
@media (max-width: 639px) { .hero-window { height: 440px; padding: 20px 16px 0; } }

.ui-logo > img { width: 100%; height: 100%; object-fit: contain; }

/* a diagram centred on a card panel */
.kit .dg-panel { position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; padding: 16px; }
.kit .dg-panel > .dg { max-width: 100%; }
/* a full-width diagram keeps a readable size, centred in its frame */
.kit .dg-frame > .dg { max-width: 1040px; margin-inline: auto; }

/* four steps side by side: each fragment a touch smaller so its point fits the narrow column */
@media (min-width: 1024px) {
  .kit--steps .stage > * { zoom: 0.84; }
}
/* the report page fits the step column, its note inside the panel; the note's dot marks risk */
.kit--steps .ui-doc { width: 330px; padding-right: 24px; }
.kit--steps .ui-doc__note { width: 176px; }
.kit .ui-doc__dot { background: var(--color-cinnabar, #b8442b); }
/* the wrap is 1200px here: the findings list takes half, so its side menu does not wrap */
@media (min-width: 1280px) { .hero-window .app.ui { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); } }
/* on a phone the network diagram needs a taller panel than the fragments */
@media (max-width: 639px) { .kit .panel:has(> .dg-panel) { --p-h: 320px; } }

/* ---------------------------------------------------------------- colour with a meaning
   Two colours only, never decoration: cinnabar marks a risk, jade marks it closed. */
.kit { --jade: var(--color-jade, #2e6b57); --risk: var(--color-cinnabar, #b8442b); }
.kit--dark { --jade: var(--color-jade-light, #8cc3ad); }
/* the findings list: an open finding carries a red dot, a closed one is green */
.kit .ui-win__st.is-open::before { background: var(--risk); opacity: 1; }
.kit .ui-win__st.is-done { color: var(--jade); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--jade) 28%, transparent); }
.kit .ui-win__st.is-done::before { opacity: 1; }
/* the checklist ticks, the approved switches and the closed count are the work done */
.kit .ui-check.is-done .ui-check__box { background: var(--jade); }
.kit .ui-switch.is-on, .kit .ui-tg.is-active .ui-switch.is-on { background: var(--jade); }
.kit .ui-tg.is-active { background: color-mix(in oklab, var(--jade) 7%, var(--u-bg)); }
.kit .ui-stat__delta { color: var(--jade); }
.kit .ui-stat__bars rect:last-child { fill: var(--jade); }
/* the report's marked lines are risks */
.kit .ui-doc mark, .kit .ui-doc [data-mark] { text-decoration-color: var(--risk); }
/* the signal-to-closed diagram: its light is jade, the closed step lights green */
.kit--safe .dg { --dg-pulse: var(--jade); --dg-halo: 0.06; }
.kit--safe .dg-node.is-done > .dg-st { background: var(--jade); }
/* under 480px the signal-to-closed flow turns vertical: it needs a tall box to show every step */
@media (max-width: 479px) { .kit--safe .dg { aspect-ratio: 5 / 7 !important; } }
