/* Certification Hub POC styles.
   Sources, in order of precedence: Y-USA Brand Graphics Guide (January 2026), the LINK Design
   System (contrast pairings, elevation, grid, spacing, radius, icons), then the app's own
   design principles. Token names follow shadcn/ui (--background, --card, --primary, --muted,
   --border, --ring, --radius) with LINK values. Every text and fill pair used here is on the
   LINK approved contrast list. Mobile first; the LINK breakpoint is 872 px. */
:root {
  /* Brand palette (LINK 050 / 100 / 500 names) */
  --y-black: #231f20;           /* Black 1000: never pure black */
  --y-gray: #636466;            /* Gray 700 */
  --y-white: #ffffff;
  --y-gray-050: #f2f2f2;
  --y-gray-100: #e7e7e7;
  --y-gray-200: #cccccc;
  --y-teal-dark: #006b6b;       /* Green 500 */
  --y-teal-mid: #01a490;        /* Green 100 */
  --y-gold-light: #fcaf17;      /* Orange 050 */
  --y-red-light: #f15922;       /* Red 050 */
  --y-red-dark: #a92b31;        /* Red 500 */
  --y-blue-light: #00aeef;      /* Blue 050 */
  --y-blue-dark: #0060af;       /* Blue 500 */
  --y-purple-light: #c6168d;    /* Purple 050 */
  --y-purple-mid: #92278f;      /* Purple 100 */

  /* LINK spacing tokens (8 px base) */
  --space-025: 2px;
  --space-050: 4px;
  --space-100: 8px;
  --space-150: 12px;
  --space-200: 16px;
  --space-250: 20px;
  --space-300: 24px;
  --space-400: 32px;
  --space-500: 40px;
  --space-600: 48px;

  /* LINK radius: cards LG, buttons and inputs MD, badges ROUND */
  --radius: 16px;
  --radius-md: 8px;
  --radius-round: 10000px;

  --font-brand: "Cachet Pro", "Cachet", Verdana, Geneva, -apple-system, "Segoe UI", sans-serif;
  --font-body: Verdana, Geneva, -apple-system, "Segoe UI", sans-serif;

  /* Light theme (default) */
  color-scheme: light;
  --background: #ffffff;
  --foreground: #231f20;
  --card: #ffffff;
  --muted: #f2f2f2;
  --muted-foreground: #636466;
  --recessed: #f8f8f8;
  --border: #cccccc;
  --input: #636466;
  --primary: #0060af;
  --primary-foreground: #ffffff;
  --link: #0060af;
  --ring: #0060af;
  --accent-bar: #92278f;
  --header: #0060af;
  --header-foreground: #ffffff;
  --banner: #231f20;
  --banner-foreground: #ffffff;
  --ok: #006b6b;
  --ok-foreground: #ffffff;
  --warn: #fcaf17;
  --warn-foreground: #231f20;
  --warn-edge: #231f20;
  --warn-tint: #fff7e3;
  --bad: #a92b31;
  --bad-foreground: #ffffff;
  --bad-tint: #fbedee;
  --neutral: #636466;
  --neutral-foreground: #ffffff;
  --disabled: #e7e7e7;
  --disabled-foreground: #636466;
  --tile-learner: #0060af;
  --tile-instructor: #92278f;
  --tile-admin: #636466;
  --shadow-raised: 0 2px 4px rgb(0 0 0 / 0.15);
  --shadow-recessed: inset 0 1px 3px rgb(0 0 0 / 0.1);
}

/* Dark theme: LINK pairings on Black 1000. #2e2a2b (card) and #1a1718 (recessed) are
   extensions, not LINK tokens. Applied when the device asks for dark and the person has not
   chosen light, or when the person chooses dark. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --background: #231f20;
    --foreground: #ffffff;
    --card: #2e2a2b;
    --muted: #1a1718;
    --muted-foreground: #f2f2f2;
    --recessed: #1a1718;
    --border: #636466;
    --input: #cccccc;
    --primary: #00aeef;
    --primary-foreground: #231f20;
    --link: #00aeef;
    --ring: #00aeef;
    --accent-bar: #c6168d;
    --header: #2e2a2b;
    --header-foreground: #ffffff;
    --banner: #fcaf17;
    --banner-foreground: #231f20;
    --ok: #01a490;
    --ok-foreground: #231f20;
    --warn: #fcaf17;
    --warn-foreground: #231f20;
    --warn-edge: #fcaf17;
    --warn-tint: #3a3220;
    --bad: #f15922;
    --bad-foreground: #231f20;
    --bad-tint: #3a2522;
    --neutral: #f2f2f2;
    --neutral-foreground: #231f20;
    --disabled: #3a3637;
    --disabled-foreground: #cccccc;
    --shadow-raised: 0 2px 4px rgb(0 0 0 / 0.5);
    --shadow-recessed: inset 0 1px 3px rgb(0 0 0 / 0.4);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #231f20;
  --foreground: #ffffff;
  --card: #2e2a2b;
  --muted: #1a1718;
  --muted-foreground: #f2f2f2;
  --recessed: #1a1718;
  --border: #636466;
  --input: #cccccc;
  --primary: #00aeef;
  --primary-foreground: #231f20;
  --link: #00aeef;
  --ring: #00aeef;
  --accent-bar: #c6168d;
  --header: #2e2a2b;
  --header-foreground: #ffffff;
  --banner: #fcaf17;
  --banner-foreground: #231f20;
  --ok: #01a490;
  --ok-foreground: #231f20;
  --warn: #fcaf17;
  --warn-foreground: #231f20;
  --warn-edge: #fcaf17;
  --warn-tint: #3a3220;
  --bad: #f15922;
  --bad-foreground: #231f20;
  --bad-tint: #3a2522;
  --neutral: #f2f2f2;
  --neutral-foreground: #231f20;
  --disabled: #3a3637;
  --disabled-foreground: #cccccc;
  --shadow-raised: 0 2px 4px rgb(0 0 0 / 0.5);
  --shadow-recessed: inset 0 1px 3px rgb(0 0 0 / 0.4);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 128px; }

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

/* Headings: Cachet in Black 1000 with the LINK accent bar under the page title */
h1, h2, h3 { font-family: var(--font-brand); color: var(--foreground); line-height: 1.25; }
h1 { font-size: 28px; margin: 0 0 var(--space-300); }
h1::after {
  content: "";
  display: block;
  width: 48px;
  height: 6px;
  margin-top: var(--space-150);
  border-radius: 6px;
  background: var(--accent-bar);
}
h2 { font-size: 20px; margin: var(--space-300) 0 var(--space-150); }
h3 { font-size: 18px; margin: 0; }
p { margin: 0 0 var(--space-100); }

a { color: var(--link); }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }

.ic {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skip {
  position: absolute;
  left: var(--space-100);
  top: -100px;
  background: var(--background);
  color: var(--link);
  padding: var(--space-100) var(--space-200);
  z-index: 10;
  min-height: 44px;
}
.skip:focus { top: var(--space-100); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.demo-banner { background: var(--banner); color: var(--banner-foreground); padding: var(--space-100) var(--space-200); font-weight: 700; font-size: 14px; }

/* Header: the knockout logo sits only on this dark band (Brand Guide logo rules). Sticky,
   so navigation, sign out and the theme switch stay in reach. On phones: logo and theme
   switch on the first row, then navigation, then the signed-in name and Sign out on the right. */
.top { position: sticky; top: 0; z-index: 20; background: var(--header); color: var(--header-foreground); box-shadow: var(--shadow-raised); }
.top-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-100) var(--space-300);
  padding: var(--space-150) var(--space-200);
}
.brand { display: flex; align-items: center; gap: var(--space-200); flex: 1 1 auto; order: 0; }
.logo { display: block; height: 32px; width: auto; flex: none; }
.product {
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: 17px;
  padding-left: var(--space-200);
  border-left: 1px solid rgb(255 255 255 / 0.5);
}
.nav { display: flex; flex-wrap: wrap; gap: var(--space-050); order: 2; flex: 1 1 auto; }
.nav a, .link-button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0 var(--space-150);
}
.nav a { color: inherit; text-decoration: none; }
.nav a:hover { text-decoration: underline; }
.nav a[aria-current="page"] { font-weight: 700; box-shadow: inset 0 -3px 0 currentColor; }
.who { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--space-100); margin-left: auto; order: 3; font-size: 14px; }
.who-name { padding-right: var(--space-050); }
.inline-form { display: inline; margin: 0; }
.link-button { background: none; border: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  order: 1;
  margin-left: auto;
  min-height: 44px;
  min-width: 44px;
  padding: 0;
  border-radius: var(--radius-md);
  border: 1px solid rgb(255 255 255 / 0.6);
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.theme-toggle .ic { width: 20px; height: 20px; }
.theme-toggle .ic-sun { display: none; }
.theme-toggle[data-current-theme="dark"] .ic-sun { display: block; }
.theme-toggle[data-current-theme="dark"] .ic-moon { display: none; }

.content { padding: var(--space-300) var(--space-200) var(--space-600); max-width: 1200px; margin: 0 auto; }
.layout { display: grid; gap: var(--space-300); align-items: start; }
.layout-main { min-width: 0; }

.meta { color: var(--muted-foreground); font-size: 14px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-100);
  min-height: 44px;
  min-width: 44px;
  padding: 0 var(--space-250);
  margin: var(--space-050) 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--primary);
  background: var(--primary);
  color: var(--primary-foreground);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.btn.secondary { background: transparent; color: var(--primary); }
.btn[disabled] { background: var(--disabled); border-color: var(--disabled); color: var(--disabled-foreground); cursor: not-allowed; }

/* Status badge: word plus icon, never colour alone */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 2px 12px 2px 8px;
  border-radius: var(--radius-round);
  border: 2px solid transparent;
  font-family: var(--font-brand);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}
.badge .ic { width: 16px; height: 16px; }
.badge-large { font-size: 24px; min-height: 48px; padding: 6px 20px 6px 14px; gap: 10px; }
.badge-large .ic { width: 28px; height: 28px; }
.b-valid { background: var(--ok); color: var(--ok-foreground); }
.b-notcurrent { background: var(--warn); color: var(--warn-foreground); border-color: var(--warn-edge); }
.b-expired { background: var(--bad); color: var(--bad-foreground); }
.b-revoked { background: transparent; color: var(--bad); border-color: var(--bad); }
.b-notfound { background: var(--neutral); color: var(--neutral-foreground); }

/* Icon tiles: white icon on a solid brand colour (LINK vertical-list rule) */
.tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: var(--radius-md);
  color: #ffffff;
}
.tile .ic { width: 20px; height: 20px; }
.tile-learner { background: var(--tile-learner); }
.tile-instructor { background: var(--tile-instructor); }
.tile-admin { background: var(--tile-admin); }
.tile-ok { background: var(--ok); color: var(--ok-foreground); }
.tile-warn { background: var(--warn); color: #231f20; }

/* Raised surfaces (LINK elevation) */
.card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-100) var(--space-200);
  border-radius: var(--radius);
  padding: var(--space-200);
  margin-bottom: var(--space-200);
  background: var(--card);
  box-shadow: var(--shadow-raised);
}
.card > h3 { flex: 1 1 0; min-width: 0; }
.card > .badge { margin-left: auto; }
.card > p, .card > .banner { flex: 1 1 100%; margin: 0; }
.reason { margin-top: var(--space-050); }
.next-action {
  background: var(--recessed);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-150) var(--space-200);
}

.panel {
  display: flex;
  align-items: flex-start;
  gap: var(--space-150);
  border-radius: var(--radius);
  padding: var(--space-200);
  margin-bottom: var(--space-300);
  border: 2px solid var(--foreground);
  background: var(--card);
}
.panel > .panel-icon { width: 28px; height: 28px; margin-top: 2px; }
.panel-body { min-width: 0; }
.panel h2 { display: flex; align-items: center; gap: var(--space-150); margin: 0; font-size: 20px; }
.panel ul { margin: var(--space-150) 0 0 20px; padding: 0; }
.panel-eligible { border-color: var(--ok); }
.panel-not-eligible { background: var(--warn-tint); flex-direction: column; }
.panel-error, .panel-refused { border-color: var(--bad); background: var(--bad-tint); }
.panel-error > .panel-icon, .panel-refused > .panel-icon { color: var(--bad); }
.panel-empty { border-color: var(--border); background: var(--recessed); }

.aside-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-150);
  padding: var(--space-300);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-raised);
}
.aside-card h2 { margin: 0; }
.aside-card p { margin: 0; }

/* Sign-in groups */
.group {
  padding: var(--space-100) var(--space-200);
  margin-bottom: var(--space-300);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-raised);
}
.group h2 { margin: var(--space-150) 0 var(--space-050); font-size: 18px; }
.list { list-style: none; margin: 0; padding: 0; }
.person {
  display: flex;
  align-items: center;
  gap: var(--space-150);
  padding: var(--space-100) 0;
  border-bottom: 1px solid var(--border);
}
.person:last-child { border-bottom: 0; }
.person-name { flex: 1 1 auto; min-width: 0; }

/* Wallet card: every card the same width, its code box the same size and in the same place */
.card-slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 340px));
  column-gap: var(--space-400);
  row-gap: var(--space-200);
}
/* Card and print control share row heights across a row, so the codes and buttons line up */
.card-slot { display: grid; grid-row: span 2; grid-template-rows: subgrid; row-gap: 0; }
.card-slot > .wallet { margin-bottom: var(--space-200); }
.card-actions { align-self: start; }
.wallet {
  width: 100%;
  margin: 0 0 var(--space-200);
  padding: var(--space-250);
  border: 2px solid var(--foreground);
  border-radius: var(--radius);
  text-align: center;
  background: var(--card);
  box-shadow: var(--shadow-raised);
}
.wallet .holder { margin: var(--space-150) 0 var(--space-050); font-size: 22px; }
.wallet .badge { margin: var(--space-100) 0; }
.cert-name { margin: 0; }
.qr {
  width: 200px;
  height: 200px;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-150);
  padding: var(--space-150);
  border-radius: var(--radius-md);
  border: 1px solid #cccccc;
  background: #ffffff;    /* the code always prints and scans on white */
}
.qr svg { display: block; width: 100%; height: auto; }
.qr-off { border: 2px dashed var(--border); background: var(--recessed); box-shadow: var(--shadow-recessed); color: var(--muted-foreground); }
.qr-off .ic { width: 48px; height: 48px; }
.qr-caption { font-size: 14px; color: var(--muted-foreground); }
.card-facts { margin: var(--space-200) 0 0; padding-top: var(--space-150); border-top: 1px solid var(--border); text-align: left; }
.card-facts div { display: flex; justify-content: space-between; gap: var(--space-100); margin-bottom: var(--space-050); }
.card-facts dt { color: var(--muted-foreground); font-size: 14px; white-space: nowrap; }
.card-facts dd { margin: 0; text-align: right; font-weight: 700; }
.card-facts .url-row { display: block; margin-top: var(--space-100); }
.card-facts .url-row dd { text-align: left; font-weight: 400; font-size: 14px; }
.url { overflow-wrap: anywhere; }
.banner { margin-top: var(--space-150); padding: var(--space-150); border-radius: var(--radius-md); background: var(--warn-tint); text-align: left; }
.card-actions { display: flex; flex-direction: column; align-items: center; text-align: center; }
.explanation { max-width: 100%; }

/* Public verification */
.choice {
  display: flex;
  align-items: center;
  gap: var(--space-200);
  width: 100%;
  min-height: 72px;
  padding: var(--space-200);
  margin-bottom: var(--space-150);
  border-radius: var(--radius);
  border: 2px solid var(--primary);
  background: var(--primary);
  color: var(--primary-foreground);
  font-family: var(--font-brand);
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: var(--shadow-raised);
}
.choice.secondary { background: var(--card); color: var(--foreground); }
.choice.secondary .choice-icon { color: var(--primary); }
.choice small { display: block; font-family: var(--font-body); font-weight: 400; font-size: 14px; }
.choice.secondary small { color: var(--muted-foreground); }
.choice-label { display: block; }
.choice-icon { width: 32px; height: 32px; }
.icon-link { display: inline-flex; align-items: center; gap: var(--space-100); min-height: 44px; }
.icon-link .choice-icon { width: 20px; height: 20px; }
label { display: block; font-weight: 700; margin-bottom: var(--space-050); }
input[type="text"] {
  width: 100%;
  min-height: 44px;
  padding: 0 var(--space-150);
  border: 2px solid var(--input);
  border-radius: var(--radius-md);
  background: var(--recessed);
  color: var(--foreground);
  font: inherit;
  font-size: 18px;
  letter-spacing: 0.05em;
}
input[type="text"][aria-invalid="true"] { border-color: var(--bad); }
.verify-form { max-width: 480px; }
.field-error { color: var(--bad); font-weight: 700; }
.result {
  margin-bottom: var(--space-300);
  padding: var(--space-300);
  border: 2px solid var(--foreground);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-raised);
}
.result .warning { font-weight: 700; margin-top: var(--space-200); padding: var(--space-150) var(--space-200); border-radius: var(--radius-md); background: var(--warn-tint); }
.result-fields { margin: var(--space-300) 0 var(--space-200); display: grid; gap: var(--space-200); }
.result-fields div { margin: 0; }
.result-fields dt { color: var(--muted-foreground); font-size: 14px; }
.result-fields dd { margin: 0; font-size: 18px; font-weight: 700; }
.result-name { font-size: 22px; }
.viewfinder {
  position: relative;
  height: 280px;
  border-radius: var(--radius);
  background: #231f20;
  box-shadow: var(--shadow-recessed);
  overflow: hidden;
  margin-bottom: var(--space-150);
}
.viewfinder video { width: 100%; height: 100%; object-fit: cover; }
.viewfinder .frame {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 190px;
  height: 190px;
  border: 4px solid #ffffff;
  border-radius: var(--radius);
}
.scanner-actions { display: flex; flex-wrap: wrap; gap: var(--space-100); margin: var(--space-150) 0; }
[hidden] { display: none !important; }

/* Admin change history: cards on phones, a table on desktop */
.eval-date {
  display: inline-flex;
  padding: var(--space-100) var(--space-200);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--recessed);
  font-size: 14px;
}
.table-wrap { display: none; overflow-x: auto; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-raised); margin-top: var(--space-200); }
.history-table { border-collapse: collapse; width: 100%; font-size: 14px; }
.history-table th, .history-table td { border-bottom: 1px solid var(--border); padding: var(--space-150) var(--space-200); text-align: left; vertical-align: top; }
.history-table tbody tr:last-child td { border-bottom: 0; }
.history-table th { background: var(--muted); font-family: var(--font-brand); white-space: nowrap; }
.history-cards { list-style: none; margin: var(--space-200) 0 0; padding: 0; }
.history-cards .card { display: block; }
.history-cards .card p { margin: 0 0 var(--space-050); }

/* Footer: one copyright line */
.site-footer { border-top: 1px solid var(--border); padding: var(--space-300) var(--space-200); text-align: center; color: var(--muted-foreground); font-size: 14px; }
.site-footer p { margin: 0; }

@media (min-width: 872px) {
  h1 { font-size: 36px; }
  h1::after { width: 64px; }
  .content { padding: var(--space-500) var(--space-500) var(--space-600); }
  .top-inner { padding: var(--space-150) var(--space-500); }
  .logo { height: 40px; }
  .brand { flex: 0 0 auto; gap: var(--space-300); }
  .product { font-size: 20px; padding-left: var(--space-300); }
  .nav { order: 0; flex: 1 1 auto; }
  .who, .theme-toggle { order: 0; }
  .who + .theme-toggle { margin-left: 0; }
  .layout { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-400); }
  .layout-main { grid-column: span 2; }
  .columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-400); align-items: start; }
  .columns > section:first-child { grid-column: span 2; }
  .columns h2 { margin-top: 0; }
  .result { padding: var(--space-400); }
  .result-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table-wrap { display: block; }
  .history-cards { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  .top, .demo-banner, .skip, .btn, .nav, .layout-aside { display: none !important; }
}
