/* ═══════════════════════════════════════════════════════════════════════════
   Coursely.be — Base: Reset, Typography, Utilities
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: calc(16px * var(--fs-scale, 1));
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--clr-text);
  background: var(--clr-bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Auth-check: verberg pagina tot JS bevestigt dat gebruiker ingelogd is */
body.auth-pending { visibility: hidden; }
body.auth-ready   { visibility: visible; animation: auth-reveal 0.15s ease; }

@keyframes auth-reveal {
  from { opacity: 0; }
  to   { opacity: 1; }
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--clr-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--clr-primary); outline-offset: 2px; border-radius: var(--radius-sm); }

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  color: var(--clr-heading);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

p { margin-bottom: var(--space-4); line-height: var(--leading-relaxed); }

ul, ol { padding-left: var(--space-6); margin-bottom: var(--space-4); }
li { margin-bottom: var(--space-1); line-height: var(--leading-relaxed); }

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--clr-inline-code-bg);
  color: var(--clr-inline-code-text);
  padding: 0.125em 0.375em;
  border-radius: var(--radius-sm);
}

pre {
  background: var(--clr-code-bg);
  color: var(--clr-code-text);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
  line-height: 1.6;
}

pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
}

th, td {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--clr-border);
  text-align: left;
}

th {
  background: var(--clr-surface-2);
  font-weight: var(--weight-semibold);
  color: var(--clr-text);
}

td { color: var(--clr-text-2); }

/* ── Skip to content ───────────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  background: var(--clr-primary);
  color: #fff;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  z-index: 9999;
  font-weight: var(--weight-medium);
}

.skip-link:focus {
  top: var(--space-4);
}

/* ── Screen reader only ────────────────────────────────────────────────── */
.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;
}

/* ── Utilities ─────────────────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-sm { font-size: var(--text-sm); }
.text-muted { color: var(--clr-text-3); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }

/* ── Scrollbar ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--clr-surface-2); }
::-webkit-scrollbar-thumb { background: var(--clr-border-dark); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--clr-text-3); }

/* ── Selection ─────────────────────────────────────────────────────────── */
::selection { background: var(--clr-primary-light); color: var(--clr-primary-dark); }
