/* base.css — Highlands Forward Event Check-In design system
   Colors sampled from the official Highlands Forward mark. */

:root {
  /* Brand colors */
  --hf-navy: #163f6d;
  --hf-navy-dark: #0f2c4d;
  --hf-blue: #007dce;
  --hf-blue-dark: #00619e;
  --hf-gold: #f4b517;
  --hf-gold-dark: #cf9508;

  /* Semantic roles */
  --color-primary: var(--hf-navy);
  --color-secondary: var(--hf-blue);
  --color-accent: var(--hf-gold);
  --color-background: #f6f8fb;
  --color-surface: #ffffff;
  --color-text: #172433;
  --color-text-muted: #55636f;
  --color-border: #dfe5ec;
  --color-success: #157347;
  --color-success-bg: #e9f7ef;
  --color-warning: #a6650a;
  --color-warning-bg: #fdf1de;
  --color-error: #b3261e;
  --color-error-bg: #fceceb;

  /* Layout */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(15, 44, 77, 0.06), 0 1px 1px rgba(15, 44, 77, 0.04);
  --shadow-md: 0 8px 24px rgba(15, 44, 77, 0.10);
  --shadow-lg: 0 20px 48px rgba(15, 44, 77, 0.16);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* Type */
  /* Type — a professional system-font stack. No external font requests:
     this avoids contacting Google Fonts (or any third party) on every
     page load, which previously wasn't disclosed as a service provider
     in the Privacy Policy. System fonts also load instantly with no
     flash-of-unstyled-text, since there's nothing to fetch. */
  --font-display: ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, Roboto, Helvetica, Arial, sans-serif;
  --font-body: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;

  --max-width: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Intentionally not auto-switching to dark mode: this is a front-desk
       kiosk / staff tool where a bright, unambiguous surface is safer for
       quick glances. Left as a hook for a future explicit toggle. */
  }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--color-background);
  color: var(--color-text);
  line-height: 1.5;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--color-primary);
  margin: 0 0 var(--space-3);
  line-height: 1.2;
  font-weight: 600;
}

h1 { font-size: clamp(1.75rem, 1.4rem + 1.5vw, 2.5rem); }
h2 { font-size: clamp(1.4rem, 1.2rem + 0.8vw, 1.8rem); }
h3 { font-size: 1.25rem; }

p { margin: 0 0 var(--space-3); color: var(--color-text); }
.text-muted { color: var(--color-text-muted); }

a { color: var(--color-secondary); text-decoration: none; }
a:hover { text-decoration: underline; }

.mono { font-family: var(--font-mono); letter-spacing: 0.02em; }

button, input, select, textarea { font-family: inherit; font-size: inherit; }

img { max-width: 100%; display: block; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-5);
}

/* Focus visibility — never rely on color alone */
:focus-visible {
  outline: 3px solid var(--hf-gold);
  outline-offset: 2px;
  border-radius: 4px;
}

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

/* Skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--color-primary);
  color: #fff;
  padding: var(--space-2) var(--space-4);
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 1000;
}
.skip-link:focus { left: 0; }

/* Visually hidden but screen-reader accessible */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ===== Header ===== */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}
.site-header__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-4) var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.brand img {
  height: 40px;
  width: auto;
}
.brand__text {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--color-primary);
  font-size: 1.15rem;
  line-height: 1.1;
}
.brand__text small {
  display: block;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.7rem;
  color: var(--color-text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Sun-ray divider — a quiet nod to the Highlands Forward mark */
.ray-divider {
  height: 3px;
  background: linear-gradient(90deg, var(--hf-gold) 0%, var(--hf-blue) 55%, var(--hf-navy) 100%);
}

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  margin-top: var(--space-8);
}
.site-footer__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-6) var(--space-5);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}
.site-footer__brand {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--color-primary);
}
.site-footer__links {
  display: flex;
  gap: var(--space-5);
  flex-wrap: wrap;
}
.site-footer__links a {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}
.powered-by-brain {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  letter-spacing: 0.03em;
}
.powered-by-brain strong {
  font-family: var(--font-mono);
  color: var(--color-text);
  font-weight: 600;
}

/* ===== Cards ===== */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-5);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.15s ease, background 0.15s ease;
  min-height: 44px;
  touch-action: manipulation;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--hf-navy-dark); }

.btn-accent { background: var(--hf-gold); color: var(--hf-navy-dark); }
.btn-accent:hover:not(:disabled) { background: var(--hf-gold-dark); }

.btn-secondary { background: var(--color-surface); color: var(--color-primary); border-color: var(--color-border); }
.btn-secondary:hover:not(:disabled) { border-color: var(--color-primary); }

.btn-danger { background: var(--color-error); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #8f1f19; }

.btn-ghost { background: transparent; color: var(--color-text-muted); }
.btn-ghost:hover:not(:disabled) { background: var(--color-background); color: var(--color-text); }

.btn-block { width: 100%; }
.btn-lg { padding: var(--space-4) var(--space-6); font-size: 1.05rem; min-height: 56px; border-radius: var(--radius-md); }
.btn-sm { padding: var(--space-2) var(--space-3); font-size: 0.85rem; min-height: 36px; }

/* ===== Forms ===== */
label {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: var(--space-2);
  color: var(--color-text);
}
.field { margin-bottom: var(--space-4); }
.field-hint { font-size: 0.8rem; color: var(--color-text-muted); margin-top: var(--space-1); }

input[type="text"], input[type="password"], input[type="email"],
input[type="date"], input[type="time"], input[type="search"],
select, textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  min-height: 48px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--color-secondary);
}

.input-group { position: relative; }
.input-group__action {
  position: absolute;
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  min-height: auto;
  padding: var(--space-1) var(--space-2);
}

/* ===== Status badges (never color-only: always paired with text) ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

.badge-open, .badge-present, .badge-active { background: var(--color-success-bg); color: var(--color-success); }
.badge-open::before, .badge-present::before, .badge-active::before { background: var(--color-success); }

.badge-draft, .badge-late { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-draft::before, .badge-late::before { background: var(--color-warning); }

.badge-closed, .badge-voided, .badge-archived, .badge-absent { background: var(--color-error-bg); color: var(--color-error); }
.badge-closed::before, .badge-voided::before, .badge-archived::before, .badge-absent::before { background: var(--color-error); }

.badge-excused { background: #eef1fb; color: #3a4b9c; }
.badge-excused::before { background: #3a4b9c; }

/* ===== Alerts ===== */
.alert {
  border-radius: var(--radius-sm);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  font-size: 0.92rem;
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}
.alert-error { background: var(--color-error-bg); color: var(--color-error); border: 1px solid #f2c6c2; }
.alert-success { background: var(--color-success-bg); color: var(--color-success); border: 1px solid #bfe4cf; }
.alert-info { background: #eaf3fb; color: var(--hf-navy-dark); border: 1px solid #cfe2f3; }
.alert-warning { background: var(--color-warning-bg); color: var(--color-warning); border: 1px solid #f2dcb0; }

/* ===== Loading ===== */
.spinner {
  width: 22px; height: 22px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-secondary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-7) 0;
  color: var(--color-text-muted);
}

.empty-state {
  text-align: center;
  padding: var(--space-7) var(--space-4);
  color: var(--color-text-muted);
}
.empty-state h3 { color: var(--color-text); margin-bottom: var(--space-2); }

/* ===== Utility ===== */
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.wrap { flex-wrap: wrap; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-0 { margin-bottom: 0; }
.text-center { text-align: center; }

.visually-hide { display: none !important; }

@media (max-width: 640px) {
  .container { padding: 0 var(--space-4); }
  .site-header__inner { padding: var(--space-3) var(--space-4); }
}
