/* ==========================================================================
   Base reset, typography and generic element styling — v0.2
   ========================================================================== */

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

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

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  color: var(--text-primary);
  background: var(--bg-canvas);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11' 1, 'ss01' 1;
}

h1, h2, h3, h4, p { margin: 0; }

h1 { font-size: var(--fs-2xl); font-weight: 600; letter-spacing: var(--ls-tight); line-height: var(--lh-tight); }
h2 { font-size: var(--fs-xl); font-weight: 600; letter-spacing: var(--ls-tight); line-height: var(--lh-tight); }
h3 { font-size: var(--fs-md); font-weight: 600; letter-spacing: var(--ls-snug); }
h4 { font-size: var(--fs-base); font-weight: 600; letter-spacing: var(--ls-snug); }

a { color: inherit; text-decoration: none; }

ul, ol { margin: 0; padding: 0; list-style: none; }

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}
button:disabled { cursor: not-allowed; opacity: 0.5; }

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

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

table { border-collapse: collapse; width: 100%; }

::selection { background: var(--accent); color: var(--text-on-accent); }

/* Numeric values across the app use tabular figures so columns of money /
   quantities line up cleanly — a small but important detail for data-heavy
   enterprise software. */
.num, td.num, .kpi-value {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1, 'cv11' 1;
}

/* Visible keyboard focus everywhere — accessibility floor. Uses a soft
   halo (box-shadow) rather than a hard outline so it reads as "premium"
   rather than "browser default". */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
  border-radius: var(--radius-sm);
}

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

.scrollbar-thin::-webkit-scrollbar { width: 8px; height: 8px; }
.scrollbar-thin::-webkit-scrollbar-thumb { background: var(--slate-300); border-radius: var(--radius-pill); }
.scrollbar-thin::-webkit-scrollbar-thumb:hover { background: var(--slate-400); }
.scrollbar-thin::-webkit-scrollbar-track { background: transparent; }

/* Generic utility classes reused across pages */
.u-flex { display: flex; }
.u-flex-col { display: flex; flex-direction: column; }
.u-items-center { align-items: center; }
.u-justify-between { justify-content: space-between; }
.u-gap-1 { gap: var(--sp-1); }
.u-gap-2 { gap: var(--sp-2); }
.u-gap-3 { gap: var(--sp-3); }
.u-gap-4 { gap: var(--sp-4); }
.u-muted { color: var(--text-secondary); }
.u-hint { color: var(--text-muted); font-size: var(--fs-xs); }
.u-hidden { display: none !important; }
.u-eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: var(--ls-widest);
  text-transform: uppercase; color: var(--text-muted);
}

[data-icon] { display: inline-flex; flex-shrink: 0; }
[data-icon] svg { width: 100%; height: 100%; }

/* Skeleton loading shimmer — used for first-paint placeholders */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--slate-100);
  border-radius: var(--radius-sm);
  color: transparent !important;
}
.skeleton::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.7), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.3s var(--ease) infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }

/* Fade-scale entrance used for cards/sections appearing after interaction */
.fade-in-up {
  animation: fade-in-up var(--dur-slow) var(--ease-out-expo) both;
}
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Skip-to-content link — invisible until keyboard-focused, first thing a
   keyboard/screen-reader user encounters on every protected page. */
.skip-link {
  position: absolute;
  top: -48px;
  left: var(--sp-4);
  z-index: 500;
  background: var(--ink-text);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: top var(--dur-fast) var(--ease-out-expo);
}
.skip-link:focus {
  top: var(--sp-4);
  outline: none;
  box-shadow: var(--shadow-focus);
}

/* RC1 Build 004 — geometric Kaevor K treatment */
.mark {
  position: relative;
  isolation: isolate;
  font-weight: 750;
  letter-spacing: -0.08em;
  background:
    linear-gradient(135deg, var(--mint) 0%, var(--accent-blue) 52%, var(--lavender) 100%);
  color: var(--ink-950);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.42), 0 8px 24px rgba(74,72,67,.12);
}
