/* Antenna design system
 * Theme tokens are defined via tailwind.config in base.html (brand + ink palette).
 * This file adds reusable component classes layered on top of the CDN Tailwind build,
 * plus base typography, focus, and accessibility helpers.
 */

:root {
  --brand-50: #eef6ff;
  --brand-100: #d9eaff;
  --brand-200: #b6d4ff;
  --brand-500: #2563eb;
  --brand-600: #1d4ed8;
  --brand-700: #1e40af;
  --accent-500: #0d9488;
  /* dark theme ink scale: low = dark surface, high = light text */
  --ink-500: #94a3b8;
  --ink-700: #cbd5e1;
  --ink-900: #f1f5f9;
  --surface: #0f172a;   /* cards, header, footer */
  --surface-2: #1e293b; /* inputs, raised tiles */
  --canvas: #0b1220;    /* page background */
  --border: #1e293b;
  --border-strong: #334155;
}

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

body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  line-height: 1.6;
  color: var(--ink-900);
}

/* Prevent horizontal overflow on small screens */
img,
svg,
video {
  max-width: 100%;
  height: auto;
}

/* Visible, consistent focus for keyboard users */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--brand-600);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Skip link revealed on focus */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--brand-600);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 0 0 0.5rem 0;
}
.skip-link:focus {
  left: 0;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.5rem 1.1rem;
  border-radius: 0.6rem;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.2;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, color 0.15s ease,
    border-color 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
}
.btn-primary {
  background: var(--brand-600);
  color: #fff;
}
.btn-primary:hover {
  background: var(--brand-700);
}
.btn-secondary {
  background: var(--surface-2);
  color: var(--ink-900);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  background: #273449;
  border-color: #475569;
}
.btn-ghost {
  background: transparent;
  color: var(--ink-700);
  min-height: 0;
  padding: 0.25rem 0.25rem;
  font-weight: 600;
}
.btn-ghost:hover {
  color: #fff;
  text-decoration: underline;
}

/* ---------- Cards ---------- */
.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: box-shadow 0.15s ease, border-color 0.15s ease,
    transform 0.15s ease;
}
a.card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  border-color: var(--brand-500);
  transform: translateY(-2px);
}
.card-body {
  padding: 1rem 1.1rem;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
}
.badge-brand {
  background: rgba(37, 99, 235, 0.2);
  color: #bfdbfe;
}
.badge-accent {
  background: rgba(13, 148, 136, 0.22);
  color: #5eead4;
}
/* dark-theme state colors (light text on translucent tints) */
.badge-success {
  background: rgba(22, 163, 74, 0.22);
  color: #86efac;
}
.badge-danger {
  background: rgba(220, 38, 38, 0.22);
  color: #fca5a5;
}

/* ---------- Form fields ---------- */
.field {
  width: 100%;
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: 0.6rem;
  background: var(--surface-2);
  font-size: 0.95rem;
  color: var(--ink-900);
}
.field:focus {
  border-color: var(--brand-600);
}

/* Style Django {{ form.as_p }} output so auth forms match the system */
.auth-form p {
  margin-bottom: 1rem;
}
.auth-form label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
  color: var(--ink-700);
}
.auth-form input {
  width: 100%;
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: 0.6rem;
  background: var(--surface-2);
  font-size: 0.95rem;
  color: var(--ink-900);
}
.auth-form input:focus {
  border-color: var(--brand-600);
}
.auth-form .helptext {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.8rem;
  color: var(--ink-500);
}
.auth-form ul.errorlist {
  list-style: none;
  padding: 0;
  margin: 0 0 0.4rem;
  color: #fca5a5;
  font-size: 0.85rem;
}

/* ---------- Nav links ---------- */
.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.4rem;
  color: var(--ink-700);
  font-weight: 500;
  text-decoration: none;
  border-radius: 0.4rem;
}
.nav-link:hover {
  color: var(--brand-700);
}

/* ---------- Prose readability ---------- */
.prose p {
  margin-bottom: 0.85rem;
}

/* ---------- Lesson body (rendered Markdown) ---------- */
.lesson-body {
  line-height: 1.7;
}
.lesson-body p {
  margin: 0 0 1rem;
}
.lesson-body h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink-900);
  margin: 1.8rem 0 0.6rem;
}
.lesson-body h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink-900);
  margin: 1.4rem 0 0.5rem;
}
.lesson-body ul,
.lesson-body ol {
  margin: 0 0 1rem 1.25rem;
  padding: 0;
}
.lesson-body li {
  margin: 0.3rem 0;
}
.lesson-body ul {
  list-style: disc;
}
.lesson-body ol {
  list-style: decimal;
}
.lesson-body strong {
  color: var(--ink-900);
  font-weight: 700;
}
.lesson-body a {
  color: #84b4ff;
  text-decoration: underline;
}
.lesson-body code {
  background: var(--surface-2);
  padding: 0.1rem 0.35rem;
  border-radius: 0.35rem;
  font-size: 0.9em;
}
.lesson-body blockquote {
  border-left: 3px solid var(--border-strong);
  margin: 0 0 1rem;
  padding: 0.3rem 0 0.3rem 1rem;
  color: var(--ink-500);
}
.lesson-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1rem;
  font-size: 0.92rem;
}
.lesson-body th,
.lesson-body td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.6rem;
  text-align: left;
}
.lesson-body th {
  background: var(--surface-2);
  color: var(--ink-900);
}
