/* Shapes — canonical component, typography and layout CSS.
   Consumers vendor this file verbatim and use these class names; never edit a copy.
   Reads only CSS custom properties (tokens and semantic aliases) — palettes stay
   per app. Markdown under element/ is the source of truth for the values. */

/* Control Height (layout-control-height) — dimensions are the same in every app,
   so Shapes defines them here; only colours live in the per-app palette. */
:root {
  --control-h: 60px;
}

/* H1 Display (typography-h1) — dogfooded by the page title */
.type-h1 {
  font-family: var(--font-heading);
  font-size: 128px;
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -3.2px;
  text-transform: uppercase;
  color: var(--text-display);
  margin: 0 0 16px;
  -webkit-font-smoothing: antialiased;
}
/* App Header (layout-app-header) */
.app-header { display: flex; justify-content: center; }
.app-header .type-h1 { margin-top: 0.67em; text-align: center; }
.app-header a { color: inherit; text-decoration: none; }
/* H1 Small (typography-h1-small) */
.type-h1-small {
  font-family: var(--font-heading);
  font-size: 48px;
  font-weight: 900;
  line-height: 112%;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--text-display);
  margin: 0 0 16px;
  -webkit-font-smoothing: antialiased;
}
/* H2 Section (typography-h2) */
.type-h2 {
  font-family: var(--font-heading);
  font-size: 36px;
  font-weight: 700;
  line-height: 40px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-display);
  margin: 0;
  display: inline-block;
  text-decoration: none;
  transition: color 0.15s ease;
}
a.type-h2:hover,
a.type-h2:focus-visible {
  color: var(--brand-highlight);
}
@media (max-width: 767px) {
  .type-h2 { font-size: 30px; line-height: 36px; }
}
/* Card Title (typography-card-title) — sits on the same 28px line as a button label */
.type-card-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  line-height: 28px;
  color: var(--text-body);
  margin: 0;
  overflow-wrap: anywhere;
}
/* Buttons (component-button-primary) — every variant has the same outer box.
   Width comes from the parent: put buttons in a .btn-row to stretch them. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: var(--control-h);
  text-decoration: none;
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 20px;
  line-height: 28px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 16px;
  border: 0;
  border-radius: 0;
  cursor: pointer;
}
.btn--primary {
  background: var(--brand-highlight);
  color: var(--text-on-highlight);
}
.btn--primary:hover:not(:disabled) {
  background: var(--brand-main-light);
  color: var(--text-inverse);
}
.btn--outline {
  background: var(--surface);
  color: var(--border);
  /* Inset: the border takes its 4px out of the padding, so the box stays the same size. */
  border: 4px solid var(--border);
  padding: 12px;
}
.btn--outline:hover:not(:disabled) {
  color: var(--brand-main-light);
  border-color: var(--brand-main-light);
}
.btn--muted {
  background: var(--surface);
  color: var(--border);
}
.btn--muted:hover:not(:disabled) {
  background: var(--neutral-1);
  color: var(--brand-main-light);
}
.btn--destructive {
  background: var(--semantic-error);
  color: var(--text-inverse);
}
.btn--destructive:hover:not(:disabled) {
  background: var(--brand-main-light);
  color: var(--text-inverse);
}
.btn--warning {
  background: var(--semantic-warning);
  color: var(--text-on-highlight);
}
.btn--warning:hover:not(:disabled) {
  background: var(--brand-main-light);
  color: var(--text-inverse);
}
.btn--info {
  background: var(--semantic-info);
  color: var(--text-inverse);
}
.btn--info:hover:not(:disabled) {
  background: var(--brand-main-light);
  color: var(--text-inverse);
}
.btn--success {
  background: var(--semantic-success);
  color: var(--text-on-highlight);
}
.btn--success:hover:not(:disabled) {
  background: var(--brand-main-light);
  color: var(--text-inverse);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
/* Icon Button (component-icon-button) — a square button for a single glyph */
.btn--icon {
  width: var(--control-h);
  height: var(--control-h);
  padding: 0;
  flex: none;
}
/* Button Row (layout-btn-row) — buttons share the width equally; icon buttons
   and tiles keep their square size */
.btn-row {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
}
.btn-row > .btn {
  flex: 1 1 0;
  min-width: 0;
}
.btn-row > .btn--icon,
.btn-row > .tile {
  flex: none;
}
/* Tile (component-tile) — a non-interactive square label, such as a step number */
.tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: var(--control-h);
  height: var(--control-h);
  flex: none;
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 900;
  line-height: 28px;
  background: var(--brand-highlight);
  color: var(--text-on-highlight);
}
.tile--outline {
  background: var(--surface);
  color: var(--border);
  border: 4px solid var(--border);
}
.card {
  border-radius: 0;
  border: 4px solid var(--border);
  box-shadow: 8px 8px 0 0 var(--border);
  background: var(--surface);
  padding: 24px;
}
.card h3 {
  margin: 0 0 8px;
  font-size: 16px;
  color: var(--text-body);
}
.card p {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
}
/* Header Row (layout-header-row) — fixed-size controls at either end, the title or
   title input takes the rest. Heads a card or a page. */
.header-row {
  display: flex;
  align-items: center;
  gap: 16px;
}
.header-row > * {
  flex: none;
}
.header-row > .type-card-title,
.header-row > .input {
  flex: 1 1 auto;
  min-width: 0;
}
/* Input (component-input) */
.input {
  box-sizing: border-box;
  min-height: var(--control-h);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 0;
  padding: 8px 12px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-body);
}
.input:focus {
  outline: 2px solid var(--brand-highlight);
  outline-offset: -1px;
}
.input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
/* Nav Item (component-nav-item) */
.nav-item {
  display: block;
  padding: 8px 16px;
  font-family: var(--font-heading);
  font-size: 14px;
  color: var(--text-muted);
  text-decoration: none;
}
.nav-item:hover {
  background: var(--brand-main-light);
  color: var(--text-inverse);
}
.nav-item[data-active="true"] {
  background: var(--brand-highlight);
  color: var(--text-inverse);
  font-weight: 600;
}
/* Badge (component-badge) */
.badge {
  display: inline-block;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  padding: 2px 8px;
  border: 2px solid var(--border);
  border-radius: 0;
  color: var(--text-muted);
}
.badge[data-tone="info"] {
  border-color: var(--semantic-info);
  color: var(--semantic-info);
}
.badge[data-tone="success"] {
  border-color: var(--semantic-success);
  color: var(--semantic-success);
}
.badge[data-tone="warning"] {
  border-color: var(--semantic-warning);
  color: var(--semantic-warning);
}
.badge[data-tone="error"] {
  border-color: var(--semantic-error);
  color: var(--semantic-error);
}
/* Semantic Card (component-semantic-card) */
.semantic-card {
  display: flex;
  align-items: stretch;
  border-radius: 0;
  border: 4px solid var(--border);
  box-shadow: 8px 8px 0 0 var(--border);
  background: var(--surface);
}
.semantic-card-stripe {
  width: 8px;
  flex: 0 0 auto;
  background: var(--semantic-info);
}
.semantic-card[data-tone="success"] .semantic-card-stripe {
  background: var(--semantic-success);
}
.semantic-card[data-tone="warning"] .semantic-card-stripe {
  background: var(--semantic-warning);
}
.semantic-card[data-tone="error"] .semantic-card-stripe {
  background: var(--semantic-error);
}
.semantic-card[data-tone="highlight"] .semantic-card-stripe {
  background: var(--brand-highlight);
}
.semantic-card-body {
  padding: 24px;
}
.semantic-card-body p {
  margin: 0;
  font-size: 14px;
  color: var(--text-body);
}
/* Table (component-table) */
.table-wrap {
  overflow-x: auto;
  border: 2px solid var(--border);
  background: var(--surface);
}
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}
.table th {
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-align: left;
  padding: 12px 16px;
  border-bottom: 2px solid var(--border);
}
.table td {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-body);
  padding: 12px 16px;
}
.table tbody tr:nth-child(even) {
  background: var(--bg);
}
.table tbody tr:hover {
  background: var(--bg);
}
.table [data-numeric="true"] {
  text-align: right;
  font-family: ui-monospace, monospace;
}
.table tbody tr[data-muted="true"] td {
  color: var(--text-muted);
}
.table .table-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted);
}
/* Select (component-select) */
.select {
  appearance: none;
  box-sizing: border-box;
  min-height: var(--control-h);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 0;
  padding: 8px 32px 8px 12px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-body);
}
.select:focus {
  outline: 2px solid var(--brand-highlight);
  outline-offset: -1px;
}
.select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
/* Textarea (component-textarea) */
.textarea {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 0;
  padding: 8px 12px;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-body);
  min-height: 96px;
  resize: vertical;
}
.textarea:focus {
  outline: 2px solid var(--brand-highlight);
  outline-offset: -1px;
}
.textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
/* Checkbox (component-checkbox) */
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-body);
}
.checkbox {
  appearance: none;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  border: 2px solid var(--border);
  border-radius: 0;
  background: var(--surface);
  display: inline-grid;
  place-content: center;
}
.checkbox::before {
  content: "";
  width: 8px;
  height: 8px;
  transform: scale(0);
  background: var(--text-on-highlight);
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}
.checkbox:checked {
  background: var(--brand-highlight);
  border-color: var(--brand-highlight);
}
.checkbox:checked::before {
  transform: scale(1);
}
.checkbox:focus-visible {
  outline: 2px solid var(--brand-highlight);
  outline-offset: 2px;
}
.checkbox:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
/* Link (component-link) */
.link {
  color: var(--brand-highlight);
  font-weight: 600;
  text-decoration: underline;
}
.link:hover {
  color: var(--brand-highlight-hover);
}
