/* Science Visual Learning Platform - Base Styles (mobile-first)
   UK spelling, WCAG-friendly defaults.
*/

:root {
  /* Typography */
  --font-primary: 'Lexend', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;

  /* Neutral palette */
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --border: #e2e8f0;

  /* Year gradients (integrated science by year) */
  --year6-primary: #10b981;
  --year6-secondary: #059669;
  --year6-gradient: linear-gradient(135deg, #10b981, #059669);

  --year7-primary: #3b82f6;
  --year7-secondary: #1d4ed8;
  --year7-gradient: linear-gradient(135deg, #3b82f6, #1d4ed8);

  --year8-primary: #8b5cf6;
  --year8-secondary: #6d28d9;
  --year8-gradient: linear-gradient(135deg, #8b5cf6, #6d28d9);

  --year9-primary: #f59e0b;
  --year9-secondary: #d97706;
  --year9-gradient: linear-gradient(135deg, #f59e0b, #d97706);

  --year10-primary: #ef4444;
  --year10-secondary: #dc2626;
  --year10-gradient: linear-gradient(135deg, #ef4444, #dc2626);

  --year11-primary: #6366f1;
  --year11-secondary: #4338ca;
  --year11-gradient: linear-gradient(135deg, #6366f1, #4338ca);

  /* Subject colours */
  --biology-primary: #22c55e;
  --biology-secondary: #16a34a;
  --biology-light: #dcfce7;
  --biology-gradient: linear-gradient(135deg, #22c55e, #16a34a);

  --chemistry-primary: #a855f7;
  --chemistry-secondary: #9333ea;
  --chemistry-light: #f3e8ff;
  --chemistry-gradient: linear-gradient(135deg, #a855f7, #9333ea);

  --physics-primary: #0ea5e9;
  --physics-secondary: #0284c7;
  --physics-light: #e0f2fe;
  --physics-gradient: linear-gradient(135deg, #0ea5e9, #0284c7);

  /* Sizing */
  --container: 1100px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 10px;

  /* Focus */
  --focus: #2563eb;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-primary);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: inherit; }

/* Accessible focus */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  top: -48px;
  left: 12px;
  background: var(--surface);
  border: 2px solid var(--focus);
  padding: 10px 12px;
  border-radius: 10px;
  z-index: 50;
}

.skip-link:focus { top: 12px; }

.container {
  width: 100%;
  max-width: var(--container);
  padding: 0 16px;
  margin: 0 auto;
}

.header {
  color: white;
  padding: 20px 0;
}

.header .title {
  font-size: clamp(1.5rem, 3.5vw, 2.25rem);
  font-weight: 700;
  margin: 0;
}

.header .subtitle {
  margin: 8px 0 0;
  opacity: 0.95;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.breadcrumb {
  font-size: 0.95rem;
  opacity: 0.95;
}

.breadcrumb a { text-decoration: underline; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.card .card-body {
  padding: 16px;
}

.grid {
  display: grid;
  gap: 16px;
}

@media (min-width: 768px) {
  .grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  border-radius: 999px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  background: #f1f5f9;
  color: #0f172a;
}

.badge.free {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}

.badge.premium {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}

.btn {
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn.primary {
  border-color: transparent;
  background: #2563eb;
  color: white;
}

.btn.primary:hover { filter: brightness(0.98); }

.btn.ghost {
  background: transparent;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.6;
  cursor: not-allowed;
}

.section {
  margin: 18px 0;
}

.section h2 {
  font-size: clamp(1.25rem, 2.6vw, 1.6rem);
  margin: 0 0 10px;
}

.muted { color: var(--muted); }

/* Progress */
.progress {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.progress > .fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: #2563eb;
  transition: width 200ms ease;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px;
  border-radius: 14px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.22);
}

.tab {
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.28);
  background: rgba(255,255,255,0.12);
  color: white;
  font-weight: 600;
  cursor: pointer;
}

.tab[aria-selected="true"] {
  background: rgba(255,255,255,0.26);
  border-color: rgba(255,255,255,0.5);
}

.tabpanels {
  margin-top: 14px;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.panel .panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  padding: 16px;
}

/* Flowchart nodes */
.flowchart {
  display: grid;
  gap: 12px;
}

.flow-node {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #ffffff;
}

.flow-node summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 700;
}

.flow-node summary::-webkit-details-marker { display: none; }

.flow-node .content {
  padding: 0 14px 14px;
  color: var(--muted);
}

/* Quiz */
.quiz {
  display: grid;
  gap: 14px;
}

.question {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #ffffff;
  padding: 14px;
}

.question h3 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.options {
  display: grid;
  gap: 8px;
}

.option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.feedback {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #f8fafc;
}

.feedback.good {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}

.feedback.bad {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.footer-nav {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 16px;
}

.small {
  font-size: 0.9rem;
}
