/* Ericom Service Identity — design tokens
   Version 0.3 draft. Replaces 06-tokens/ericom-service.css.
   See SERVICE-IDENTITY.md v0.3 for the rules these encode; section 12 records
   what changed from v0.2 and why. Where the two disagree, the document governs.

   Source Serif 4, Source Sans 3 and IBM Plex Mono are SIL Open Font Licence
   and must be self-hosted — a font CDN is not acceptable for a product served
   inside a correctional network. */

:root {
  /* Type. A serif for display, a sans for UI, a mono for data. */
  --e-display: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --e-ui:      'Source Sans 3', -apple-system, 'Segoe UI', Roboto, sans-serif;
  --e-data:    'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --e-size-screen-title: 30px;  --e-lh-screen-title: 1.13;
  --e-size-section:      22px;  --e-lh-section:      1.2;
  --e-size-panel:        21px;  --e-lh-panel:        1.25;
  --e-size-card:         17px;  --e-lh-card:         1.3;
  --e-size-figure:       32px;  --e-lh-figure:       1.05;
  --e-size-body:         15px;  --e-lh-body:         1.55;
  --e-size-control:    14.5px;  --e-lh-control:      1;
  --e-size-label:      10.5px;  --e-lh-label:        1.5;
  --e-size-meta:       11.5px;  --e-lh-meta:         1.5;
  --e-track-label: .12em;
  --e-track-display: -.024em;

  /* Brand. There is no brand hue: one cool-neutral grey ramp.
     Colour is reserved for status. --e-primary is the single
     white-label override point. */
  --e-primary:   #14171A;
  --e-structure: #14171A;   /* collapsed into primary at v0.3 */
  /* Function tiles sit one step lighter than a product mark, so a launcher
     entry reads as part of a product rather than as a product itself. */
  --e-tile-function: #282D32;

  /* Surfaces */
  --e-surface:       #FFFFFF;
  --e-surface-tint:  #F7F8F9;
  --e-page:          #F3F4F6;
  --e-border:        #E4E6E9;
  --e-hairline:      #EFF0F2;
  --e-text:          #3C4248;
  --e-text-secondary:#6E747A;
  --e-disabled-bg:   #EFF0F2;
  --e-disabled-fg:   #9BA1A7;

  /* Status. The one place colour appears. Screen values are darkened from the
     document palette to hold 4.5:1 against white at body size; printed reports
     keep the document values, noted in the comments. Colour is never the only
     signal — every status carries its word. */
  --e-draft:   #DDEBF7;   /* text #14171A — the one light blue, from the documents */
  --e-success: #0C7A3E;   /* report #00B050 */
  --e-warning: #9A5B00;   /* report #FFC000 */
  --e-error:   #C00000;

  /* Calendar and schedule block fills. The only tinted fills in the system,
     because a week grid cannot be read from words alone at a glance.
     Every block still carries its status in words. */
  --e-cal-ok-bg:     #EEF6F1;  --e-cal-ok-line:     #B9D9C7;
  --e-cal-pend-bg:   #FBF3E6;  --e-cal-pend-line:   #E6D0A8;
  --e-cal-clin-bg:   #DDEBF7;  --e-cal-clin-line:   #BDD7ED;

  /* Geometry. v0.3 rounds. The hexagon stays hard-edged — it is the one
     unrounded shape in the system, which is what makes it read as a mark. */
  --e-radius-panel:  18px;
  --e-radius-ctl:    13px;
  --e-radius-badge:   9px;
  --e-radius-pill:   999px;
  --e-border-width:  1px;

  --e-space-1: 4px;  --e-space-2: 8px;  --e-space-3: 12px;
  --e-space-4: 16px; --e-space-6: 24px; --e-space-8: 32px;
  --e-gutter: var(--e-space-4);
  --e-gutter-tablet: 22px;

  /* Touch. 44 on staff surfaces, 48 on an inmate tablet. */
  --e-touch-min: 44px;
  --e-touch-tablet: 48px;

  /* Icons. Stroke steps up as the glyph shrinks so optical weight holds. */
  --e-icon-stroke:    1.7;
  --e-icon-stroke-sm: 1.9;
  --e-icon-stroke-lg: 1.5;
  --e-icon-size:      20px;
  --e-icon-size-sm:   16px;
  --e-icon-size-lg:   26px;
}

html { background: var(--e-page); }
body {
  margin: 0;
  font-family: var(--e-ui);
  font-size: var(--e-size-body);
  line-height: var(--e-lh-body);
  color: var(--e-text);
  background: var(--e-page);
}
h1, h2, h3, h4, .e-figure {
  font-family: var(--e-display);
  color: var(--e-primary);
  letter-spacing: var(--e-track-display);
  font-weight: 700;
}
h4 { font-weight: 600; }
a { color: var(--e-primary); text-decoration: underline; text-underline-offset: 3px; }

/* Data type. Anything a person reads as a value rather than prose:
   identifiers, timestamps, addresses, sizes, audit rows, column headers. */
.e-meta, .e-label, td, th {
  font-family: var(--e-data);
}
.e-label {
  font-size: var(--e-size-label);
  line-height: var(--e-lh-label);
  letter-spacing: var(--e-track-label);
  text-transform: uppercase;
  color: var(--e-text-secondary);
  font-weight: 500;
}

/* Glyphs. Round terminals at v0.3 — mitre joins spike at small sizes and
   square caps chip on a mid-density panel. Do not set butt or mitre. */
.e-icon {
  width: var(--e-icon-size); height: var(--e-icon-size);
  fill: none; stroke: currentColor;
  stroke-width: var(--e-icon-stroke);
  stroke-linecap: round; stroke-linejoin: round;
  flex: none;
}
.e-icon--sm { width: var(--e-icon-size-sm); height: var(--e-icon-size-sm);
              stroke-width: var(--e-icon-stroke-sm); }
.e-icon--lg { width: var(--e-icon-size-lg); height: var(--e-icon-size-lg);
              stroke-width: var(--e-icon-stroke-lg); }

/* Product tile. Hexagons are for products only, never for roles or states,
   and the hexagon itself is never rounded. */
.e-tile {
  aspect-ratio: 1 / 1.1547;
  background: var(--e-primary);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  display: grid; place-items: center;
}
.e-tile .e-icon { width: 40%; height: auto; color: var(--e-surface); }
/* Product marks take the larger box — they carry the app icon and must read at 16px. */
.e-tile--product .e-icon { width: 60%; }
.e-tile--function { background: var(--e-tile-function); }

/* Panels sit flat on the page. Shadow is for floating surfaces only —
   a device frame, a menu, a dialog. */
.e-panel {
  background: var(--e-surface);
  border: var(--e-border-width) solid var(--e-border);
  border-radius: var(--e-radius-panel);
}

/* Back is a bordered button carrying the arrow and the destination name,
   never a text link. Most-used control on a tablet. */
.e-btn--back {
  background: var(--e-surface);
  color: var(--e-primary);
  border: var(--e-border-width) solid var(--e-border);
  border-radius: var(--e-radius-ctl);
  min-height: var(--e-touch-min);
  font-weight: 600;
}

/* Error carries weight as well as hue, so it survives greyscale printing. */
.e-field--error { border: 1.5px solid var(--e-error); }

/* Status. Rounded rectangle, uppercase, mono, always carrying the word.
   The solid variant is for the single most common affirmative state in a
   list, so the eye can skip it. */
.e-status {
  font-family: var(--e-data);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  border-radius: var(--e-radius-badge);
  border: var(--e-border-width) solid var(--e-border);
  background: var(--e-surface);
  padding: 5px 10px;
}
.e-status--solid { background: var(--e-primary); color: var(--e-surface);
                   border-color: var(--e-primary); }

/* Tables. The container carries the radius and the border; the table does not.
   Hairline row separators, no vertical rules, no zebra striping. */
.e-table-wrap {
  border: var(--e-border-width) solid var(--e-border);
  border-radius: var(--e-radius-panel);
  overflow: hidden;
  background: var(--e-surface);
}
.e-table-wrap table { border-collapse: collapse; width: 100%; }
.e-table-wrap th {
  background: var(--e-surface-tint);
  color: var(--e-text-secondary);
  font-size: 10px; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase;
  text-align: left;
}
.e-table-wrap th, .e-table-wrap td {
  padding: 12px 16px;
  border-bottom: var(--e-border-width) solid var(--e-hairline);
}
.e-table-wrap tbody tr:last-child td { border-bottom: 0; }
