/* kit.css: the shared design system of the Axon4 UI kit. A project never edits this file.
   A project puts its own design in site.css: new token values, layouts and character.
   Each rule here is in the layer `kit`. A rule without a layer, as in site.css, always beats it.
   Rules: no inline style in any page; data never writes a style value; a state is a class from a closed set. */

/* Page transitions between pages of this site, with no script. */
@view-transition { navigation: auto; }

@layer kit {
/* 1. Tokens ------------------------------------------------------------------------------------------ */
:root {
  color-scheme: light dark;

  /* Color: a neutral scale, one accent, and four states. */
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f0f0ed;
  --text: #1d1d1b;
  --muted: #5f5f5a;
  --border: #dedcd6;
  --accent: #2f6f62;
  --accent-text: #ffffff;
  --accent-soft: #e3efec;
  --danger: #b3261e;
  --danger-soft: #fbe9e7;
  --success: #2e7d32;
  --success-soft: #e8f3e9;
  --warning: #8a5a00;
  --warning-soft: #fdf1dc;
  --info: #2457a6;
  --info-soft: #e7eefa;
  --focus: #2f6f62;

  /* Type: the system fonts, and a fluid scale. */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  --step--1: clamp(0.83rem, 0.8rem + 0.15vw, 0.9rem);
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.1rem);
  --step-1: clamp(1.2rem, 1.1rem + 0.45vw, 1.45rem);
  --step-2: clamp(1.45rem, 1.3rem + 0.8vw, 1.95rem);
  --step-3: clamp(1.8rem, 1.5rem + 1.4vw, 2.6rem);

  /* Space, shape, depth and motion. */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: clamp(2rem, 1.6rem + 2vw, 3rem);
  --pad: var(--space-5);
  --radius: 6px;
  --radius-small: 4px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.05), 0 4px 16px rgb(0 0 0 / 0.06);
  --duration: 160ms;
  --measure: 70ch;
  --width: 72rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141513;
    --surface: #1c1d1b;
    --surface-2: #252623;
    --text: #ecebe6;
    --muted: #a5a49d;
    --border: #34352f;
    --accent: #7cc4b3;
    --accent-text: #0f1f1b;
    --accent-soft: #1f3330;
    --danger: #f2b8b5;
    --danger-soft: #3a1f1d;
    --success: #9ccf9f;
    --success-soft: #1d2f1e;
    --warning: #f0c56b;
    --warning-soft: #33280f;
    --info: #a9c4f5;
    --info-soft: #1c2638;
    --focus: #7cc4b3;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 4px 16px rgb(0 0 0 / 0.3);
  }
}

@media (prefers-reduced-motion: reduce) {
  :root { --duration: 0ms; }
}


/* 2. Base ------------------------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--step-0) / 1.55 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.2; margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
p { margin: 0; max-width: var(--measure); }
.card p, .notice, .list p, details p, [popover] p { max-width: none; }
small, .small { font-size: var(--step--1); color: var(--muted); }
code, pre { font-family: var(--font-mono); font-size: 0.9em; }
code { background: var(--surface-2); padding: 0.1em 0.35em; border-radius: var(--radius-small); }
pre { background: var(--surface-2); padding: var(--space-4); border-radius: var(--radius); overflow-x: auto; margin: 0; }
pre code { background: none; padding: 0; }
a { color: var(--accent); text-underline-offset: 0.2em; }
img { max-width: 100%; height: auto; display: block; }
hr { border: 0; border-top: 1px solid var(--border); margin: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* 3. Layout primitives ------------------------------------------------------------------------------ */
.center { max-width: var(--width); margin-inline: auto; padding-inline: var(--space-5); }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack-large { display: flex; flex-direction: column; gap: var(--space-6); }
.cluster { display: flex; flex-direction: row; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr)); }
.narrow { max-width: 26rem; margin-inline: auto; }

/* 4. The app shell ---------------------------------------------------------------------------------- */
.shell-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.shell-header .center { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; column-gap: var(--space-4); row-gap: 0; min-height: 3.75rem; padding-block: var(--space-2); }
.brand { font-weight: 700; color: var(--text); text-decoration: none; display: flex; align-items: center; gap: var(--space-2); white-space: nowrap; }
.brand svg { width: 1.5rem; height: 1.5rem; }
.nav { display: flex; gap: var(--space-1); flex-wrap: wrap; }
.nav a, .nav button { color: var(--muted); text-decoration: none; font: inherit; font-weight: 400; background: transparent; border: 0;
  min-height: 2.5rem; display: inline-flex; align-items: center; padding: 0 var(--space-3); border-radius: var(--radius-small); }
.nav a:hover, .nav button:hover { background: var(--surface-2); color: var(--text); filter: none; }
.nav .button { background: var(--accent); color: var(--accent-text); font-weight: 600; margin-left: var(--space-2); }
.nav .button:hover { background: var(--accent); color: var(--accent-text); filter: brightness(1.08); }
.nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
main.center { padding-block: var(--space-6); }
.shell-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: var(--step--1); }
.shell-footer .center { padding-block: var(--space-5); }

/* 5. Components ------------------------------------------------------------------------------------- */
/* Card */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--pad); box-shadow: var(--shadow); }
.stat { display: grid; gap: var(--space-2); align-content: start; }
.stat .stat-value { font-size: var(--step-3); font-weight: 700; letter-spacing: -0.02em; }
.stat .stat-label { color: var(--muted); font-size: var(--step--1); }

/* Button: one base, four kinds. A link can look like a button too. */
.button, button {
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-4); min-height: 2.5rem;
  border-radius: var(--radius-small); border: 1px solid transparent;
  background: var(--accent); color: var(--accent-text);
  transition: filter var(--duration), background var(--duration);
}
.button:hover, button:hover { filter: brightness(1.08); }
.button.secondary, button.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.button.quiet, button.quiet { background: transparent; color: var(--accent); }
.button.quiet:hover, button.quiet:hover { background: var(--accent-soft); filter: none; }
.button.danger, button.danger { background: var(--danger); color: var(--surface); }
button:disabled, .button[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; filter: none; }

/* Form */
form { display: flex; flex-direction: column; gap: var(--space-4); }
.field { display: flex; flex-direction: column; gap: var(--space-1); }
.field label, .field legend { font-weight: 600; font-size: var(--step--1); }
input, textarea, select {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-small);
  padding: var(--space-2) var(--space-3); min-height: 2.5rem; width: 100%;
  transition: border-color var(--duration), box-shadow var(--duration);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: auto; accent-color: var(--accent); }
.choice { display: flex; gap: var(--space-2); align-items: center; font-weight: 400; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.help { color: var(--muted); font-size: var(--step--1); }
.error-text { color: var(--danger); font-size: var(--step--1); }
.field.has-error input { border-color: var(--danger); }

/* Table */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: var(--step--1); }
th, td { text-align: left; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td.number, th.number { text-align: right; font-variant-numeric: tabular-nums; }

/* List from a View. The empty state shows when the list has no item: no script. */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.list > li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--pad); }
.list-meta { color: var(--muted); font-size: var(--step--1); }
.empty-state { display: none; text-align: center; color: var(--muted); padding: var(--space-6) var(--space-4); border: 1px dashed var(--border); border-radius: var(--radius); }
.list:not(:has(> li)) + .empty-state { display: block; }

/* Badge: a state from a closed set. A flow picks the state; the page picks the class. */
.badge { display: inline-flex; align-items: center; gap: var(--space-1); font-size: var(--step--1); font-weight: 600; padding: 0.1rem 0.5rem; border-radius: var(--radius-small); background: var(--surface-2); color: var(--muted); }
.badge.ok { background: var(--success-soft); color: var(--success); }
.badge.warn { background: var(--warning-soft); color: var(--warning); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }

/* Notice */
.notice { border-left: 4px solid var(--info); background: var(--info-soft); padding: var(--space-3) var(--space-4); border-radius: var(--radius-small); }
.notice.success { border-color: var(--success); background: var(--success-soft); }
.notice.warning { border-color: var(--warning); background: var(--warning-soft); }
.notice.error { border-color: var(--danger); background: var(--danger-soft); }
.notice strong { display: block; }

/* Popover: a menu or a confirm box, opened by a button with popovertarget. No script. */
[popover] {
  margin: auto; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
  padding: var(--pad); max-width: min(26rem, calc(100vw - 2rem));
}
[popover]::backdrop { background: rgb(0 0 0 / 0.35); }
.menu { padding: var(--space-2); min-width: 12rem; }
.menu a, .menu button { display: flex; width: 100%; justify-content: flex-start; padding: var(--space-2) var(--space-3); border-radius: var(--radius-small); background: transparent; color: var(--text); font-weight: 400; text-decoration: none; border: 0; }
.menu a:hover, .menu button:hover { background: var(--surface-2); filter: none; }

/* Disclosure */
details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-3) var(--space-4); }
summary { cursor: pointer; font-weight: 600; }
details[open] summary { margin-bottom: var(--space-3); }

/* Figure */
figure { margin: 0; }
figure img { border-radius: var(--radius); border: 1px solid var(--border); }
figcaption { color: var(--muted); font-size: var(--step--1); margin-top: var(--space-2); }

/* Pattern library page */
.pattern { scroll-margin-top: var(--space-5); }
.pattern > h2 { font-size: var(--step-1); }
.pattern-index { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: var(--space-1) var(--space-5);
  margin: 0; padding: 0; list-style-position: inside; }

/* 6. Page layout: an app with a side bar ---------------------------------------------------------------
   Grid areas place each part. The side bar is sticky: it stays in the flow, so nothing can lie on top of it.
   On a narrow screen the areas change, and the side bar becomes a bar at the top. */
.app-layout { display: grid; min-height: 100dvh; grid-template-columns: 16rem minmax(0, 1fr); grid-template-rows: auto 1fr;
  grid-template-areas: "side top" "side main"; }
.app-side { grid-area: side; position: sticky; top: 0; align-self: start; height: 100dvh; overflow-y: auto;
  display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-5) var(--space-4);
  background: var(--surface); border-right: 1px solid var(--border); }
.app-top { grid-area: top; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-4);
  padding: var(--space-4) var(--space-6); border-bottom: 1px solid var(--border); }
.app-main { grid-area: main; min-width: 0; display: flex; flex-direction: column; gap: var(--space-6); padding: var(--space-6); }
.side-nav { display: flex; flex-direction: column; gap: var(--space-1); }
.side-nav a { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-small); color: var(--muted); text-decoration: none; white-space: nowrap; }
.side-nav a:hover { background: var(--surface-2); color: var(--text); }
.side-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side-nav svg { width: 1.1rem; height: 1.1rem; flex: none; }
.side-label { font-size: var(--step--1); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding-inline: var(--space-3); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: var(--space-3); }
.side-logout { width: 100%; }
@media (max-width: 48rem) {
  .app-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr; grid-template-areas: "side" "top" "main"; }
  .app-side { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto;
    border-right: 0; border-bottom: 1px solid var(--border); padding: var(--space-3) var(--space-4); }
  .side-nav { flex-direction: row; }
  .side-label { display: none; }
  .side-foot { margin-top: 0; margin-left: auto; }
  .side-logout { width: auto; }
  .app-top, .app-main { padding-inline: var(--space-4); }
}

/* 7. The consent box ---------------------------------------------------------------------------------------
   It sits at the bottom of each page, sticky, so it stays in the flow. kit.js hides it after an answer.
   Both answers have the same weight. */
[hidden] { display: none !important; }
.consent { position: sticky; bottom: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--space-3) var(--space-5); padding: var(--space-4) var(--space-5);
  background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -4px 16px rgb(0 0 0 / 0.06); }
.consent p { margin: 0; }

} /* end of @layer kit */
