/* P-0175 base styles v0.3.0. Written fresh. Uses only tokens from tokens.css. */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--size-md);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background: var(--color-bg);
}
h1, h2, h3 { font-family: var(--font-display); line-height: var(--leading-tight); font-weight: var(--weight-bold); margin: 0 0 var(--space-sm); }
h1 { font-size: var(--size-3xl); }
h2 { font-size: var(--size-2xl); }
h3 { font-size: var(--size-xl); }
p { margin: 0 0 var(--space-md); max-width: var(--measure); }
small, .muted { color: var(--color-muted); font-size: var(--size-sm); }
code { font-family: var(--font-mono); font-size: var(--size-sm); }

a { color: var(--color-link); text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: var(--focus-width) solid var(--color-focus);
  outline-offset: var(--focus-offset);
  border-radius: var(--radius-sm);
}

.button, button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-sm);
  min-height: var(--target-min); min-width: var(--target-min);
  padding: var(--space-sm) var(--space-lg);
  font: inherit; font-weight: var(--weight-medium);
  color: var(--color-on-accent); background: var(--color-accent);
  border: 1px solid var(--color-accent); border-radius: var(--radius-full);
  cursor: pointer; text-decoration: none;
  transition: transform var(--duration-fast) var(--ease-standard), box-shadow var(--duration-normal) var(--ease-standard);
}
.button:hover, button:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.button[disabled], button[disabled] { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }
.button-quiet { color: var(--color-text); background: transparent; border-color: var(--color-border); }

.field { display: flex; flex-direction: column; gap: var(--space-xs); margin-bottom: var(--space-md); }
label { font-weight: var(--weight-medium); }
.hint { color: var(--color-muted); font-size: var(--size-sm); }
input, select, textarea {
  font: inherit; color: var(--color-text); background: var(--color-surface);
  min-height: var(--target-min); padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
}
[aria-invalid="true"] { border-color: var(--color-danger); border-width: 2px; }
.error { color: var(--color-danger); font-size: var(--size-sm); font-weight: var(--weight-medium); }

.alert { padding: var(--space-md); border-radius: var(--radius-md); border: 2px solid var(--color-border); background: var(--color-surface); }
.alert-success { border-color: var(--color-success); }
.alert-warning { border-color: var(--color-warning); }
.alert-danger { border-color: var(--color-danger); }
.alert-title { font-weight: var(--weight-bold); }
.alert-success .alert-title { color: var(--color-success); }
.alert-warning .alert-title { color: var(--color-warning); }
.alert-danger .alert-title { color: var(--color-danger); }

.card { background: var(--color-surface); border: var(--line-hairline) solid var(--color-hairline); border-radius: var(--radius-card); padding: var(--space-lg); box-shadow: var(--shadow-sm); }
.band { background: var(--color-surface-strong); color: var(--color-on-strong); padding: var(--space-md) var(--space-gutter); }

table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: var(--space-sm) var(--space-md); border-bottom: 1px solid var(--color-border); }
th { font-weight: var(--weight-bold); }

.stack > * + * { margin-top: var(--space-md); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--space-sm); align-items: center; }
.grid { display: grid; gap: var(--space-lg); grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--layout-narrow)), 1fr)); }
.wrap { max-width: var(--layout-wide); margin: 0 auto; padding: 0 var(--space-gutter); }

/* ---- v0.2.0 pieces ---- */

/* Top bar: site name and nav; the current page has aria-current="page". */
.topbar { background: var(--color-surface); border-bottom: 1px solid var(--color-border); }
.topbar-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-sm) var(--space-lg); padding-block: var(--space-sm); }
.topbar-name { font-family: var(--font-display); font-weight: var(--weight-bold); font-size: var(--size-lg); color: var(--color-text); text-decoration: none; min-height: var(--target-min); display: inline-flex; align-items: center; }
.topbar nav ul { display: flex; flex-wrap: wrap; gap: var(--space-xs); margin: 0; padding: 0; list-style: none; }
.topbar nav a { display: inline-flex; align-items: center; min-height: var(--target-min); padding: 0 var(--space-md); border-radius: var(--radius-full); color: var(--color-text); text-decoration: none; font-weight: var(--weight-medium); }
.topbar nav a:hover { background: var(--color-bg); }
.topbar nav a[aria-current="page"] { background: var(--color-accent); color: var(--color-on-accent); }

/* Hero: eyebrow, title, lede. */
.hero { padding-block: var(--space-xl) var(--space-lg); }
.eyebrow { font-family: var(--font-display); font-size: var(--size-sm); font-weight: var(--weight-bold); letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-accent); margin: 0 0 var(--space-sm); }
.hero h1 { margin-bottom: var(--space-md); }
.lede { font-size: var(--size-lg); color: var(--color-muted); max-width: var(--measure); }

/* Stat tiles. */
.stats { display: grid; gap: var(--space-md); grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); }
.stat { background: var(--color-surface); border: var(--line-hairline) solid var(--color-hairline); border-radius: var(--radius-card); padding: var(--space-md) var(--space-lg); box-shadow: var(--shadow-panel); }
.stat-value { display: block; font-family: var(--font-display); font-size: var(--size-3xl); font-weight: var(--weight-bold); line-height: var(--leading-tight); }
.stat-label { color: var(--color-muted); font-size: var(--size-sm); }

/* Pills (stock labels: colour AND text) and chips (filters). */
.pill { display: inline-flex; align-items: center; gap: var(--space-xs); padding: var(--space-xs) var(--space-sm); border-radius: var(--radius-full); font-size: var(--size-sm); font-weight: var(--weight-semibold); line-height: var(--leading-tight); border: 1px solid currentColor; }
.pill-in-stock { background: var(--color-pill-in-stock); color: var(--color-pill-in-stock-text); }
.pill-stock-due { background: var(--color-pill-stock-due); color: var(--color-pill-stock-due-text); }
.pill-made-to-order { background: var(--color-pill-made-to-order); color: var(--color-pill-made-to-order-text); }
.chip { display: inline-flex; align-items: center; min-height: var(--target-min); padding: 0 var(--space-md); border-radius: var(--radius-full); border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text); font: inherit; font-weight: var(--weight-medium); cursor: pointer; text-decoration: none; }
.chip:hover { border-color: var(--color-text); box-shadow: none; transform: none; }
.chip[aria-pressed="true"], .chip[aria-current] { background: var(--color-surface-strong); color: var(--color-on-strong); border-color: var(--color-surface-strong); }

/* Cards with a coloured top bar: add .bay-<name> to set the colour. */
.card-bar { position: relative; overflow: hidden; border-top: 0; box-shadow: var(--shadow-panel); }
.card-bar::before { content: ""; position: absolute; inset: 0 0 auto 0; height: var(--space-xs); background: var(--color-accent); }
.tile { background: var(--color-surface); border: 2px solid var(--color-border); border-radius: var(--radius-card); padding: var(--space-md); }

.bay-content.card-bar::before { background: var(--color-bay-content-bar); }
.tile.bay-content { background: var(--color-bay-content-tint); border-color: var(--color-bay-content-bar); }
.bay-comms.card-bar::before { background: var(--color-bay-comms-bar); }
.tile.bay-comms { background: var(--color-bay-comms-tint); border-color: var(--color-bay-comms-bar); }
.bay-webinars.card-bar::before { background: var(--color-bay-webinars-bar); }
.tile.bay-webinars { background: var(--color-bay-webinars-tint); border-color: var(--color-bay-webinars-bar); }
.bay-access.card-bar::before { background: var(--color-bay-access-bar); }
.tile.bay-access { background: var(--color-bay-access-tint); border-color: var(--color-bay-access-bar); }
.bay-data.card-bar::before { background: var(--color-bay-data-bar); }
.tile.bay-data { background: var(--color-bay-data-tint); border-color: var(--color-bay-data-bar); }
.bay-back-end.card-bar::before { background: var(--color-bay-back-end-bar); }
.tile.bay-back-end { background: var(--color-bay-back-end-tint); border-color: var(--color-bay-back-end-bar); }
.bay-front-end.card-bar::before { background: var(--color-bay-front-end-bar); }
.tile.bay-front-end { background: var(--color-bay-front-end-tint); border-color: var(--color-bay-front-end-bar); }
.bay-kits.card-bar::before { background: var(--color-bay-kits-bar); }
.tile.bay-kits { background: var(--color-bay-kits-tint); border-color: var(--color-bay-kits-bar); }
.bay-middleware.card-bar::before { background: var(--color-bay-middleware-bar); }
.tile.bay-middleware { background: var(--color-bay-middleware-tint); border-color: var(--color-bay-middleware-bar); }

/* Station track: numbered circles joined by a line; vertical on phones. */
.track { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-lg); counter-reset: station; }
.track > li { position: relative; padding-left: calc(var(--target-min) + var(--space-md)); counter-increment: station; }
.track > li::before { content: counter(station); position: absolute; left: 0; top: 0; width: var(--target-min); height: var(--target-min); display: grid; place-items: center; border-radius: var(--radius-full); background: var(--color-accent); color: var(--color-on-accent); font-family: var(--font-display); font-weight: var(--weight-bold); z-index: 1; }
.track > li:not(:last-child)::after { content: ""; position: absolute; left: calc(var(--target-min) / 2 - 1px); top: var(--target-min); bottom: calc(-1 * var(--space-lg)); width: 2px; background: var(--color-border); }
@media (min-width: 64rem) {
  .track { grid-auto-flow: column; grid-auto-columns: 1fr; }
  .track > li { padding-left: 0; padding-top: calc(var(--target-min) + var(--space-md)); }
  .track > li:not(:last-child)::after { left: var(--target-min); right: calc(-1 * var(--space-lg)); top: calc(var(--target-min) / 2 - 1px); bottom: auto; width: auto; height: 2px; }
}

/* Readable article column; tables scroll inside their own box. */
.prose { max-width: 68ch; min-width: 0; }
.prose > * + * { margin-top: var(--space-md); }
.prose h2 { margin-top: var(--space-xl); }
.prose p, .prose li { max-width: none; }
.table-scroll { max-width: 100%; min-width: 0; overflow-x: auto; border: var(--line-hairline) solid var(--color-hairline); border-radius: var(--radius-panel); background: var(--color-surface); }
.table-scroll table { min-width: 32rem; }
.table-scroll th { background: var(--color-bg); }

/* v0.3.0 app look: tinted ground, panels, app shell, dotted grid, dividers, expandable rows, connectors. */
.app-ground { background: var(--color-ground); }
.panel { background: var(--color-surface); border: var(--line-hairline) solid var(--color-hairline); border-radius: var(--radius-panel); box-shadow: var(--shadow-panel); padding: var(--space-lg); min-width: 0; }
.card-link { display: block; color: inherit; text-decoration: none; transition: box-shadow var(--duration-normal) var(--ease-standard), transform var(--duration-normal) var(--ease-standard); }
.card-link:hover { box-shadow: var(--shadow-raised); transform: translateY(-2px); }
.card-link h2, .card-link h3 { color: var(--color-link); }

/* App shell: slim top bar; side menu from 64rem; bottom tab bar on phones. */
.shell { min-height: 100vh; background: var(--color-ground); }
.shell-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--space-sm); min-height: var(--layout-topbar); padding: 0 var(--space-gutter); background: var(--color-surface); border-bottom: var(--line-hairline) solid var(--color-hairline); }
.shell-brand { display: inline-flex; align-items: center; gap: var(--space-sm); min-height: var(--target-min); font-family: var(--font-display); font-weight: var(--weight-bold); font-size: var(--size-lg); color: var(--color-text); text-decoration: none; }
.logo-mark { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: var(--radius-md); background: var(--color-accent); color: var(--color-on-accent); font-size: var(--size-sm); }
.shell-nav ul { list-style: none; margin: 0; padding: 0; }
.shell-nav a { display: flex; align-items: center; gap: var(--space-sm); min-height: var(--target-min); padding: 0 var(--space-md); border-radius: var(--radius-full); color: var(--color-text); text-decoration: none; font-weight: var(--weight-medium); }
.shell-nav a:hover { background: var(--color-ground); }
.shell-nav a[aria-current="page"] { background: var(--color-nav-current); color: var(--color-nav-current-text); font-weight: var(--weight-semibold); }
.shell-nav svg { width: 1.25rem; height: 1.25rem; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.shell-main { min-width: 0; padding: var(--space-lg) var(--space-gutter) calc(var(--layout-tabbar) + var(--space-xl)); }
.shell-main > * + * { margin-top: var(--space-lg); }
.shell-nav { position: fixed; inset: auto 0 0 0; z-index: 20; background: var(--color-surface); border-top: var(--line-hairline) solid var(--color-hairline); box-shadow: var(--shadow-raised); padding: var(--space-xs) var(--space-xs) calc(var(--space-xs) + env(safe-area-inset-bottom)); }
.shell-nav ul { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: var(--space-xs); }
.shell-nav a { flex-direction: column; justify-content: center; gap: 0; min-height: calc(var(--layout-tabbar) - var(--space-sm)); padding: var(--space-xs); border-radius: var(--radius-panel); font-size: var(--size-sm); text-align: center; line-height: var(--leading-tight); }
@media (min-width: 64rem) {
  .shell { display: grid; grid-template-columns: var(--layout-sidebar) minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .shell-top { grid-column: 1 / -1; }
  .shell-nav { position: sticky; top: var(--layout-topbar); align-self: start; inset: auto; height: calc(100vh - var(--layout-topbar)); border-top: 0; border-right: var(--line-hairline) solid var(--color-hairline); box-shadow: none; padding: var(--space-lg) var(--space-md); }
  .shell-nav ul { grid-auto-flow: row; grid-auto-columns: auto; }
  .shell-nav a { flex-direction: row; justify-content: flex-start; gap: var(--space-sm); min-height: var(--target-min); padding: 0 var(--space-md); border-radius: var(--radius-full); font-size: var(--size-md); text-align: left; }
  .shell-main { padding: var(--space-xl) var(--space-xl) var(--space-2xl); }
}

/* Dotted-grid background for hero areas. */
.dotted { background-color: var(--color-surface); background-image: radial-gradient(var(--color-dot) var(--pattern-dot-size), transparent var(--pattern-dot-size)); background-size: var(--pattern-dot-gap) var(--pattern-dot-gap); }

/* Labelled section divider: a fine line either side of a small label. */
.divider { display: flex; align-items: center; gap: var(--space-md); margin: var(--space-xl) 0 var(--space-md); font-family: var(--font-display); font-size: var(--size-sm); font-weight: var(--weight-bold); letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-muted); }
.divider::before, .divider::after { content: ""; flex: 1; height: var(--line-hairline); background: var(--color-connector); }
.divider::before { flex: 0 0 var(--space-lg); }

/* Expandable rows: details/summary, keyboard-friendly by default. */
.rows { border: var(--line-hairline) solid var(--color-hairline); border-radius: var(--radius-panel); background: var(--color-surface); overflow: hidden; }
.row + .row { border-top: var(--line-hairline) solid var(--color-hairline); }
.row > summary { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); min-height: var(--target-min); padding: var(--space-sm) var(--space-lg); cursor: pointer; font-weight: var(--weight-semibold); list-style: none; }
.row > summary::-webkit-details-marker { display: none; }
.row > summary::after { content: "+"; flex: none; display: grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: var(--radius-full); background: var(--color-ground); font-family: var(--font-display); }
.row[open] > summary::after { content: "\2212"; }
.row > summary:hover { background: var(--color-ground); }
.row > summary:focus-visible { outline-offset: calc(-1 * var(--focus-width)); }
.row-body { padding: 0 var(--space-lg) var(--space-md); }

/* Connector lines. The track uses them; .connected is a tile grid joined to an aisle line on its left,
   each tile linked to its neighbour by a fine line, at any column count. */
.track > li:not(:last-child)::after { background: var(--color-connector); }
.connected { display: grid; gap: var(--space-md); grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); list-style: none; margin: 0; padding: 0 0 0 var(--space-md); border-left: var(--line-connector) solid var(--color-connector); }
.connected > * { position: relative; }
.connected > *::before { content: ""; position: absolute; top: 50%; right: 100%; width: calc(var(--space-md) + var(--line-connector)); height: var(--line-connector); background: var(--color-connector); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; scroll-behavior: auto !important; }
  .button:hover, button:hover { transform: none; }
}
