/*
 * JOYTECH Design System v1.0, as BEACON uses it.
 *
 * The reference is C:\JOYTECH\Design System\tokens.css, shared with STAFFOPS, ASSETOPS,
 * BUSINESSOPS and the websites. It is copied here, not imported, like every JOYTECH project:
 * change tokens.css first, then here. The foundation (neutrals, status, elevation) is identical
 * to the other products. BEACON's own product colours are the two blocks marked PRODUCT.
 *
 * Dark is the default (<html data-theme="dark">). The customer app and the venue screen are
 * always dark; the control room and admin can switch (theme.js); printed pages are light.
 *
 * The signal colours (red, yellow, green, blue ...) are not in this file. They belong to each
 * venue's signals in config.json and are never used as chrome.
 */

:root {
  /* ---- Neutrals, light: soft off-white ---- */
  --page: #f6f7f8;
  --background: #ffffff;
  --raised: #ffffff;
  --surface: #f0f2f3;
  --surface-hover: #e7eaec;
  --surface-border: #d5dadd;
  --border-soft: #e5e9eb;
  --button-border: #c4cbcf;
  --control-border: #7f888e;
  --foreground: #1a1d20;
  --heading: #0b0c0e;
  --muted: #5a646a;
  --card: var(--background);

  /* ---- Company brand ---- */
  --brand: #71797e;
  --brand-ink: #5a6268;

  /* ---- Status: base for dots and edges, ink for text, tint behind it. Never a brand accent. ---- */
  --success: #1f8a6b;
  --success-ink: #0f5f49;
  --warning: #a87406;
  --warning-ink: #7a5600;
  --info: #3b7bb8;
  --info-ink: #245a8c;
  --danger: #a61e2e;
  --danger-ink: #8a1826;
  --neutral: #6b757c;
  --neutral-ink: #4d565c;
  --success-tint: color-mix(in srgb, var(--success) 12%, transparent);
  --warning-tint: color-mix(in srgb, var(--warning) 12%, transparent);
  --info-tint: color-mix(in srgb, var(--info) 12%, transparent);
  --danger-tint: color-mix(in srgb, var(--danger) 12%, transparent);
  --neutral-tint: color-mix(in srgb, var(--neutral) 12%, transparent);
  --danger-foreground: #ffffff; /* text on a danger-filled button */

  /* ---- Elevation ---- */
  --elev-card: 0 1px 2px rgb(11 12 14 / 0.05);
  --elev-card-hover: 0 6px 16px -6px rgb(11 12 14 / 0.18), 0 1px 2px rgb(11 12 14 / 0.06);
  --elev-raised: 0 8px 24px -8px rgb(11 12 14 / 0.16), 0 1px 2px rgb(11 12 14 / 0.06);
  --elev-overlay: 0 24px 48px -12px rgb(11 12 14 / 0.25), 0 2px 6px rgb(11 12 14 / 0.08);
  --elev-button: 0 1px 1px rgb(11 12 14 / 0.06);
  --elev-button-primary: 0 1px 2px rgb(11 12 14 / 0.24), inset 0 1px 0 rgb(255 255 255 / 0.1);
  --elev-button-primary-hover: 0 4px 12px -2px rgb(11 12 14 / 0.32), inset 0 1px 0 rgb(255 255 255 / 0.12);
  --scrim: rgb(11 12 14 / 0.4);

  /* ---- PRODUCT: BEACON, light. Violet: the one hue no other JOYTECH product, status tone or
     default signal uses. White on #5b3fd9 is 6.65:1; as text it is 6.20:1 on the page. ---- */
  --action: #5b3fd9;
  --action-hover: #4c33bd;          /* white 8.35:1 */
  --action-foreground: #ffffff;
  --action-edge: transparent;       /* the fill is the colour */
  --link: #5b3fd9;                  /* 6.20 page, 6.65 card, 5.92 surface */
  --focus: #5b3fd9;
  --mark: #7c5cff;                  /* 4.05:1 on the page: graphics only, never small text */
  --link-tint: color-mix(in srgb, var(--link) 12%, transparent);

  /* ---- Type ---- */
  --font-sans: 'Sora', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', monospace;
  --text-micro: 11px;   /* dense data only, weight 500+ */
  --text-ui: 13px;      /* compact controls, chips */
  --text-title: 15px;   /* card titles */

  color-scheme: light;
}

[data-theme='dark'] {
  /* ---- Neutrals, dark: layered graphite ---- */
  --page: #0b0c0e;
  --background: #16181b;
  --raised: #1c1f23;
  --surface: #23262b;
  --surface-hover: #2a2e33;
  --surface-border: #32363c;
  --border-soft: #262a2f;
  --button-border: #40454d;
  --control-border: #6b737b;
  --foreground: #e9ecef;
  --heading: #f8f9fa;
  --muted: #9ba3aa;

  --brand: #a9b4bc;
  --brand-ink: #c3cbd1;

  /* In dark, ink equals base: the light colours already read on graphite. */
  --success: #7dd3b5;
  --success-ink: #7dd3b5;
  --warning: #f2c75c;
  --warning-ink: #f2c75c;
  --info: #9cc5ec;
  --info-ink: #9cc5ec;
  --danger: #f28b8b;
  --danger-ink: #f28b8b;
  --neutral: #9aa3a9;
  --neutral-ink: #c3cad0;
  --success-tint: color-mix(in srgb, var(--success) 16%, transparent);
  --warning-tint: color-mix(in srgb, var(--warning) 16%, transparent);
  --info-tint: color-mix(in srgb, var(--info) 16%, transparent);
  --danger-tint: color-mix(in srgb, var(--danger) 16%, transparent);
  --neutral-tint: color-mix(in srgb, var(--neutral) 16%, transparent);
  --danger-foreground: #0b0c0e;

  /* Every dark card carries a faint top highlight: depth a shadow cannot give on near-black. */
  --elev-card: 0 1px 2px rgb(0 0 0 / 0.4), inset 0 1px 0 rgb(255 255 255 / 0.04);
  --elev-card-hover: 0 8px 20px -8px rgb(0 0 0 / 0.7), 0 1px 2px rgb(0 0 0 / 0.5), inset 0 1px 0 rgb(255 255 255 / 0.05);
  --elev-raised: 0 12px 28px -8px rgb(0 0 0 / 0.7), 0 1px 2px rgb(0 0 0 / 0.5), inset 0 1px 0 rgb(255 255 255 / 0.04);
  --elev-overlay: 0 24px 48px -12px rgb(0 0 0 / 0.8), 0 2px 6px rgb(0 0 0 / 0.5), inset 0 1px 0 rgb(255 255 255 / 0.05);
  --elev-button: 0 1px 1px rgb(0 0 0 / 0.35);
  --elev-button-primary: 0 1px 2px rgb(0 0 0 / 0.5), inset 0 1px 0 rgb(255 255 255 / 0.22);
  --elev-button-primary-hover: 0 4px 12px -2px rgb(0 0 0 / 0.6), inset 0 1px 0 rgb(255 255 255 / 0.28);
  --scrim: rgb(0 0 0 / 0.6);

  /* ---- PRODUCT: BEACON, dark. White on #6a4df0 is 5.34:1; the fill is 3.33:1 as a shape on
     the card. Links and focus take a lighter violet: 8.28 page, 7.53 card, 6.42 surface. ---- */
  --action: #6a4df0;
  --action-hover: #7357f8;
  --link: #a99cff;
  --focus: #a99cff;
  --mark: #8f7bff;                  /* 6.01:1 on the page */
  --link-tint: color-mix(in srgb, var(--link) 16%, transparent);

  color-scheme: dark;
}

/* ================================================================== */
/* Base                                                                */
/* ================================================================== */

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--page);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 { color: var(--heading); font-weight: 600; }

a,
button,
[role='button'],
label,
summary {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* One focus style, everywhere: a 2px ring in the product colour, offset from the control. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Links are underlined wherever they sit among other text; colour alone never marks them. */
:where(a):not(.btn) { color: var(--link); font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }

code,
.mono { font-family: var(--font-mono); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ================================================================== */
/* Brand pieces                                                        */
/* ================================================================== */

/* The product name, set like the other JOYTECH wordmarks: heavy capitals in the title colour. */
.wordmark {
  color: var(--heading);
  font-weight: 800;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  line-height: 1;
}

/* Small capitals above a heading or beside the wordmark. */
.eyebrow {
  color: var(--brand-ink);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* The four corner brackets that frame a showcase on the JOYTECH sites, in the product's mark colour. */
.brackets {
  --bracket: 3px;
  --bracket-len: 26px;
  padding: 14px;
  background:
    linear-gradient(var(--mark) 0 0) top left / var(--bracket-len) var(--bracket) no-repeat,
    linear-gradient(var(--mark) 0 0) top left / var(--bracket) var(--bracket-len) no-repeat,
    linear-gradient(var(--mark) 0 0) top right / var(--bracket-len) var(--bracket) no-repeat,
    linear-gradient(var(--mark) 0 0) top right / var(--bracket) var(--bracket-len) no-repeat,
    linear-gradient(var(--mark) 0 0) bottom left / var(--bracket-len) var(--bracket) no-repeat,
    linear-gradient(var(--mark) 0 0) bottom left / var(--bracket) var(--bracket-len) no-repeat,
    linear-gradient(var(--mark) 0 0) bottom right / var(--bracket-len) var(--bracket) no-repeat,
    linear-gradient(var(--mark) 0 0) bottom right / var(--bracket) var(--bracket-len) no-repeat;
}

/* ================================================================== */
/* Buttons (the STAFFOPS recipe: resting shadow, 2% press, 44px on a phone) */
/* ================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--button-border);
  border-radius: 8px;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  box-shadow: var(--elev-button);
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, scale 0.15s, opacity 0.15s;
}
.btn:hover { border-color: var(--action); }
.btn:active { scale: 0.98; box-shadow: none; }
.btn:disabled { cursor: not-allowed; opacity: 0.5; scale: 1; box-shadow: none; }
.btn:disabled:hover { border-color: var(--button-border); }

.btn.primary {
  border-color: transparent;
  background: linear-gradient(to bottom, rgb(255 255 255 / 0.12), rgb(255 255 255 / 0)), var(--action);
  color: var(--action-foreground);
  box-shadow: var(--elev-button-primary);
}
.btn.primary:hover {
  border-color: transparent;
  background: linear-gradient(to bottom, rgb(255 255 255 / 0.12), rgb(255 255 255 / 0)), var(--action-hover);
  box-shadow: var(--elev-button-primary-hover);
}
.btn.primary:active,
.btn.primary:disabled { box-shadow: none; }

.btn.danger { border-color: transparent; background: var(--danger); color: var(--danger-foreground); }
.btn.danger:hover { border-color: transparent; background: color-mix(in oklab, var(--danger) 88%, var(--heading)); }

.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn.ghost:hover { border-color: var(--button-border); }

.btn.small { padding: 6px 12px; font-size: var(--text-ui); }
.btn.large { min-height: 48px; padding: 10px 20px; font-size: 16px; }

/* Denser where a pointer is the norm. */
@media (min-width: 640px) and (hover: hover) {
  .btn { min-height: 36px; }
  .btn.small { min-height: 32px; }
  .btn.large { min-height: 44px; font-size: 15px; }
}

/* ================================================================== */
/* Inputs: the edge is the only thing that shows a field is there, so it gets 3:1 */
/* ================================================================== */

:where(input:not([type='checkbox'], [type='radio'], [type='color'], [type='range'], [type='file']), select, textarea) {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 14px;
  transition: border-color 0.15s;
}
:where(input, select, textarea)::placeholder { color: var(--muted); opacity: 1; }
:where(input:not([type='checkbox'], [type='radio'], [type='color'], [type='range'], [type='file']), select, textarea):hover { border-color: var(--muted); }
:where(input, select, textarea):disabled { cursor: not-allowed; background: var(--surface); color: var(--muted); }
:where(input[type='checkbox'], input[type='radio'], input[type='range']) { accent-color: var(--action); }

@media (min-width: 640px) and (hover: hover) {
  :where(input:not([type='checkbox'], [type='radio'], [type='color'], [type='range'], [type='file']), select, textarea) { min-height: 36px; }
}

/* iOS Safari zooms when a focused input renders below 16px. */
@media (max-width: 640px) {
  input,
  select,
  textarea { font-size: 16px; }
}

/* ================================================================== */
/* Status chips: one tone vocabulary (neutral, info, success, warning, danger) */
/* ================================================================== */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
  white-space: nowrap;
}
.tone-neutral { border-color: color-mix(in srgb, var(--neutral) 40%, transparent); background: var(--neutral-tint); color: var(--neutral-ink); }
.tone-info { border-color: color-mix(in srgb, var(--info) 40%, transparent); background: var(--info-tint); color: var(--info-ink); }
.tone-success { border-color: color-mix(in srgb, var(--success) 40%, transparent); background: var(--success-tint); color: var(--success-ink); }
.tone-warning { border-color: color-mix(in srgb, var(--warning) 40%, transparent); background: var(--warning-tint); color: var(--warning-ink); }
.tone-danger { border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: var(--danger-tint); color: var(--danger-ink); }

/* ================================================================== */
/* Dialogs and toasts                                                  */
/* ================================================================== */

dialog {
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  background: var(--raised);
  color: var(--foreground);
  box-shadow: var(--elev-overlay);
}
dialog::backdrop { background: var(--scrim); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 200;
  max-width: calc(100% - 32px);
  transform: translate(-50%, 16px);
  padding: 10px 16px;
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  background: var(--raised);
  color: var(--heading);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--elev-overlay);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *,
  ::before,
  ::after,
  ::backdrop {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
