/* UpWithR base styles + themes (light/dark/high-contrast) */

:root {
  --bg: #0b1220;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-2: rgba(255, 255, 255, 0.09);
  --text: #e8eefc;
  --muted: rgba(232, 238, 252, 0.72);
  --border: rgba(255, 255, 255, 0.10);
  --shadow: 0 18px 40px rgba(0,0,0,0.35);
  --accent: #8ab4ff;
  --accent-2: #7ee0c6;
  --focus: #ffd166;
  --radius: 18px;
  --maxw: 980px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

html[data-theme="light"] {
  --bg: #f4f2ec;
  --surface: #ffffff;
  --surface-2: #f8f6f1;
  --text: #0f172a;
  --muted: rgba(15, 23, 42, 0.68);
  --border: #d8d2c4;
  --shadow: 0 18px 40px rgba(15,23,42,0.08);
  --accent: #2a6acb;
  --accent-2: #1a8c6b;
  --focus: #b45309;
}

html[data-theme="contrast"] {
  --bg: #000;
  --surface: #0a0a0a;
  --surface-2: #111;
  --text: #fff;
  --muted: #e6e6e6;
  --border: #fff;
  --shadow: none;
  --accent: #00e5ff;
  --accent-2: #b6ff00;
  --focus: #ffea00;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  background: radial-gradient(900px 600px at 20% 10%, rgba(138,180,255,0.18), transparent 60%),
              radial-gradient(800px 500px at 90% 20%, rgba(126,224,198,0.14), transparent 55%),
              var(--bg);
  color: var(--text);
  line-height: 1.6;
  letter-spacing: 0.01em;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, select:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 10px;
}

.container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: min(94vw, var(--maxw));
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 26px 18px 60px;
}

@media (min-width: 1024px) {
  :root {
    --maxw: 1280px;
  }

  .container {
    padding: 32px 26px 70px;
  }
}

@media (min-width: 1440px) {
  :root {
    --maxw: 1480px;
  }
}

@media (min-width: 1680px) {
  :root {
    --maxw: 1620px;
  }
}

.topbar {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.brand .logo {
  font-weight: 800;
  letter-spacing: 0.2px;
  font-size: 18px;
  color: var(--text);
  text-decoration: none;
}
.brand .tagline {
  font-size: 13px;
  color: var(--muted);
}

.nav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-left: auto;
}
.nav a {
  color: var(--text);
  opacity: 0.9;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
}
.nav a:hover {
  background: var(--surface-2);
  border-color: var(--border);
  text-decoration: none;
}

.controls {
  display: flex;
  gap: 10px;
  align-items: center;
}
.controls label {
  font-size: 12px;
  color: var(--muted);
}
.controls select {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 10px;
}

.hero {
  margin-top: 22px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface), transparent 150%);
  border-radius: calc(var(--radius) + 6px);
  padding: 30px 20px;
  box-shadow: var(--shadow);
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(28px, 5vw, 54px);
  letter-spacing: -0.5px;
}
.chip-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 4px 0 8px;
}
.chip-label {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
}
.chips {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 12px;
  letter-spacing: 0.01em;
}
.ticker {
  margin: 4px 0 12px;
  width: min(320px, 100%);
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.ticker-track {
  display: inline-flex;
  gap: 24px;
  align-items: center;
  white-space: nowrap;
  padding: 7px 12px;
  font-size: 13px;
  color: var(--muted);
  animation: ticker-scroll 22s linear infinite;
}
.ticker-track span:first-child { padding-left: 2px; }
.ticker-track span + span::before {
  content: "•";
  color: var(--muted);
  opacity: 0.6;
  margin-right: 12px;
}

@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .ticker-track {
    animation: none;
    transform: none;
  }
}
.hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  max-width: 72ch;
  font-size: 15.5px;
}

.grid {
  display: grid;
  gap: 14px;
  margin-top: 16px;
  grid-template-columns: repeat(12, 1fr);
}

.card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.path-card {
  grid-column: span 12;
  text-decoration: none;
  color: var(--text);
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
  display: block;
}
.path-card h3 {
  margin: 0 0 6px;
  font-size: 15px;
}
.path-card:hover {
  text-decoration: none;
  border-color: var(--accent);
  background: var(--surface-2);
  transform: translateY(-2px);
}
.path-card p {
  color: var(--muted);
  margin: 0;
  line-height: 1.4;
}

.path-meta {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
  margin-top: 8px;
}

@media (min-width: 760px) {
  .path-card {
    grid-column: span 4;
  }
}

.card h2 {
  margin: 0 0 6px;
  font-size: 16px;
}
.card p { margin: 0; color: var(--muted); line-height: 1.5; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-2);
}

.btnrow { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}
.btn:hover { text-decoration: none; filter: brightness(1.05); }
.btn.primary {
  border-color: transparent;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #081018;
}

html[data-theme="light"] .btn {
  background: #ffffff;
  border-color: rgba(42, 106, 203, 0.28);
  color: #2a6acb;
}
html[data-theme="light"] .btn:hover {
  filter: none;
  background: #f1f5ff;
  border-color: rgba(42, 106, 203, 0.4);
}
html[data-theme="light"] .btn.primary {
  background: linear-gradient(90deg, #dce8ff, #c8f1e7);
  border-color: transparent;
  color: #0f223a;
  box-shadow: 0 10px 24px rgba(42,106,203,0.12);
}

.footer {
  margin-top: auto;
  padding-top: 26px;
  color: var(--muted);
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
}

.footer-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.footer-nav a {
  color: var(--muted);
  text-decoration: none;
}
.footer-nav a:hover { text-decoration: underline; }
.footer-sep {
  color: var(--muted);
  opacity: 0.6;
  font-size: 12px;
}

.small { font-size: 12.5px; color: var(--muted); }
hr.sep {
  border: none;
  border-top: 1px solid var(--border);
  margin: 18px 0 0;
}

/* Layout helpers for inner pages */
.pagehead { margin-top: 18px; }
.pagehead h1 { margin: 0 0 8px; font-size: 28px; }
.pagehead p { margin: 0; color: var(--muted); max-width: 80ch; line-height: 1.55; }

.two-col {
  display: grid;
  gap: 14px;
  margin-top: 14px;
  grid-template-columns: 280px 1fr;
}
@media (max-width: 860px) {
  .two-col { grid-template-columns: 1fr; }
}

.sidebar a {
  display: block;
  padding: 10px 10px;
  border-radius: 14px;
  border: 1px solid transparent;
  color: var(--text);
  opacity: 0.92;
}
.sidebar a:hover {
  background: var(--surface-2);
  border-color: var(--border);
  text-decoration: none;
}
.sidebar .group { margin-top: 10px; }
.sidebar .group-title {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  margin: 10px 6px 6px;
}

.content h2 { margin-top: 0; }
.embed {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
}
.embed iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  display: block;
}

/* TEF lessons layout */
.lessons {
  margin-top: 18px;
}
.toc-card {
  align-self: start;
}
.toc-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.toc-head h2 { margin: 0; }
.toc-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.bottom-actions { justify-content: flex-start; }
.btn.ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn.small {
  padding: 7px 10px;
  font-size: 13px;
}

.accordion {
  display: grid;
  gap: 8px;
}
.accordion-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}
.accordion-trigger {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  font-size: 14px;
  cursor: pointer;
}
.accordion-trigger:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 10px;
}
.accordion-item.open .accordion-trigger {
  background: var(--surface-2);
}
.accordion-panel {
  display: none;
  padding: 0 14px 12px;
}
.accordion-panel ul {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: grid;
  gap: 6px;
}
.accordion-panel a {
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
}
.accordion-panel a:hover { text-decoration: underline; }
.chevron {
  font-size: 12px;
  opacity: 0.8;
  transition: transform 120ms ease;
}
.accordion-item.open .chevron {
  transform: rotate(180deg);
}

.lesson-content {
  align-self: start;
}

html[data-theme="light"] .accordion-panel a { color: #0f172a; }
html[data-theme="contrast"] .accordion-item { border-color: var(--border); }

/* Tabs for lesson content */
.tab-bar {
  display: flex;
  width: 100%;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  margin: -8px -8px 12px;
  padding: 0 8px 12px;
  min-height: 48px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.tab-button {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 14px 10px 16px;
  border-radius: 0;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  position: relative;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tab-button[aria-selected="true"] {
  color: var(--text);
}
.tab-button[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 0;
  height: 3px;
  border-radius: 999px;
  background: var(--accent);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.tab-panel .embed {
  max-width: 50%;
  margin: 0 auto;
}

.subtopic-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}
.subtopic-nav .btn {
  min-width: 120px;
  justify-content: center;
}
.subtopic-anchors {
  display: block;
  position: relative;
}
.subtopic-anchors span {
  display: block;
  height: 1px;
  margin-top: -80px;
  padding-top: 80px;
}

.toc-card .accordion-panel a.active {
  color: var(--accent);
  font-weight: 700;
  text-decoration: underline;
}

/* TEF hero */
.tef-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(340px, 1.1fr) minmax(320px, 1fr);
  margin-top: 22px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 6px);
  overflow: hidden;
  min-height: 260px;
  box-shadow: var(--shadow);
  background: var(--surface);
}
.tef-hero-bg {
  display: block;
  background-image: url("/tef-canada/tef-canada-hero.png");
  background-size: cover;
  background-position: center;
  filter: saturate(0.95);
}
.tef-hero::after {
  display: none;
}
.tef-hero-content {
  position: relative;
  padding: 28px 24px 30px;
  max-width: none;
  width: 100%;
  z-index: 1;
  backdrop-filter: blur(8px);
  background: rgba(29, 58, 64, 0.38);
  color: var(--text);
}
.tef-hero .eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #cfe3ff;
  font-family: var(--mono);
}
.tef-hero .sub-eyebrow {
  margin: 0 0 8px;
  font-size: 13px;
  color: rgba(232, 238, 252, 0.78);
  font-weight: 600;
}
.tef-hero h1 {
  margin: 0 0 8px;
  font-size: clamp(26px, 4vw, 38px);
  letter-spacing: -0.4px;
  color: #f5f8ff;
}
.tef-hero p {
  margin: 0 0 14px;
  color: rgba(232, 238, 252, 0.86);
  max-width: 60ch;
}
.tef-hero .btnrow { margin-top: 10px; }

html[data-theme="light"] .tef-hero::after {
  background: none;
}
html[data-theme="light"] .tef-hero-content {
  background: rgba(213, 227, 223, 0.85);
  color: #0f172a;
}
html[data-theme="light"] .tef-hero .eyebrow { color: #2a6acb; }
html[data-theme="light"] .tef-hero .sub-eyebrow { color: rgba(15, 23, 42, 0.72); }
html[data-theme="light"] .tef-hero h1 { color: #0f172a; }
html[data-theme="light"] .tef-hero p { color: rgba(15, 23, 42, 0.78); }

html[data-theme="contrast"] .tef-hero-bg { filter: saturate(1.1); }
html[data-theme="contrast"] .tef-hero::after {
  background: none;
}
html[data-theme="contrast"] .tef-hero-content {
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
}
html[data-theme="contrast"] .tef-hero .eyebrow { color: #fff; }

@media (max-width: 1180px) {
  :root {
    --maxw: 100vw;
  }
  .container {
    width: 100vw;
    padding: 18px 14px 40px;
  }
  .topbar {
    flex-wrap: wrap;
    gap: 10px;
  }
  .brand { flex: 1 0 auto; }
  .controls { margin-left: auto; }
  .nav {
    width: 100%;
    justify-content: flex-start;
    gap: 10px;
  }
  .tef-hero {
    min-height: auto;
    grid-template-columns: 1fr;
  }
  .tef-hero-content {
    max-width: none;
    width: 100%;
    padding: 22px 18px 24px;
  }
  .tef-hero-bg {
    min-height: 220px;
  }
  .tab-bar {
    gap: 8px;
  }
  .tab-button {
    min-width: 120px;
  }
}
