:root {
  --ink: #1a1f2e;
  --muted: #5c6578;
  --paper: #f4f7fb;
  --card: #ffffff;
  --line: rgba(26, 31, 46, 0.08);
  --shadow: 0 14px 40px rgba(26, 31, 46, 0.08);
  --radius: 18px;
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
  --accent: #3d7ea6;
}

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

html { scroll-behavior: smooth; caret-color: transparent; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  caret-color: transparent;
  background:
    radial-gradient(circle at 8% 0%, rgba(120, 180, 220, 0.2), transparent 42%),
    radial-gradient(circle at 92% 8%, rgba(180, 160, 220, 0.14), transparent 38%),
    var(--paper);
  background-attachment: fixed;
  line-height: 1.5;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 247, 251, 0.9);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.lang-toggle {
  display: flex;
  gap: 0.25rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem;
}

.lang-btn {
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  cursor: pointer;
  color: var(--muted);
}

.lang-btn.is-active {
  background: var(--accent);
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-mark {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #4a90c2, #6b8f71);
  color: #fff;
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.85rem;
}

.brand strong {
  display: block;
  font-family: var(--display);
  font-size: 1.15rem;
  line-height: 1.1;
}

.brand small {
  color: var(--muted);
  font-size: 0.78rem;
}

main {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

.hero {
  margin-bottom: 1.75rem;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
}

.hero h1 {
  margin: 0.35rem 0 0.5rem;
  font-family: var(--display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.15;
  caret-color: transparent;
  -webkit-user-select: text;
  user-select: text;
}

.lede {
  margin: 0;
  max-width: 40rem;
  color: var(--muted);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.topic-card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  min-height: 100%;
}

.topic-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 48px rgba(26, 31, 46, 0.12);
}

.topic-card.is-ready {
  outline: 2px solid rgba(61, 126, 166, 0.35);
}

.topic-card.is-soon {
  opacity: 0.92;
}

.card-art {
  height: 130px;
  display: grid;
  place-items: center;
  position: relative;
}

.card-symbol {
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  font-weight: 700;
  font-family: var(--display);
  padding: 0.65rem 1rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.75);
  box-shadow: 0 8px 20px rgba(26, 31, 46, 0.08);
  text-align: center;
  max-width: 90%;
}

.art-indices { background: linear-gradient(145deg, #d9ecf7, #e8f0fa 55%, #dcefda); }
.art-factor { background: linear-gradient(145deg, #dcefda, #d7eaf6 50%, #ebe4f7); }
.art-ineq { background: linear-gradient(145deg, #f5dce8, #d9ecf7 50%, #f0e8d8); }
.art-pct { background: linear-gradient(145deg, #e0e7f6, #ebe4f7 50%, #dcefda); }
.art-triangle { background: linear-gradient(145deg, #e8e0f4, #d9ecf7 50%, #f5f0dc); }
.art-quad { background: linear-gradient(145deg, #d9f5fa, #e8f7d3 52%, #fff0dc); }
.art-prob { background: linear-gradient(145deg, #f0e8d8, #dcefda 45%, #e0e7f6); }
.art-stats { background: linear-gradient(145deg, #ebe4f7, #dcefda 50%, #d9ecf7); }
.art-volume { background: linear-gradient(145deg, #d9ecf7, #e8e0f4 55%, #dcefda); }
.art-lines { background: linear-gradient(145deg, #fce4ec, #e8eaf6 50%, #e0f7fa); }
.art-trig { background: linear-gradient(145deg, #e8eaf6, #fce4ec 50%, #e3f2fd); }
.art-trig-app { background: linear-gradient(145deg, #fff8e1, #e8f5e9 50%, #e3f2fd); }

.card-body {
  padding: 0.95rem 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.lesson-code {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent);
  text-transform: uppercase;
}

.card-body h2 {
  margin: 0;
  font-size: 1.05rem;
  font-family: var(--display);
  line-height: 1.25;
}

.card-body p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  flex: 1;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.25rem;
}

.tags span {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: #eef2f7;
  color: #4a5568;
}

.topic-card.is-ready .tags span {
  background: #e3f0f8;
  color: #2d5a73;
}

.site-footer {
  text-align: center;
  padding: 1.25rem;
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 1000px) {
  .gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .gallery {
    grid-template-columns: 1fr;
  }
}
/* Hide typing caret on gallery chrome; keep text selectable. */
h1, h2, .lede, .eyebrow, .card-body p, .lesson-code, .brand strong, .brand small {
  -webkit-user-select: text;
  user-select: text;
  caret-color: transparent;
}
button, .topic-card, .back-link, .level-card, .lang-btn, .site-header, .card-art, .tags {
  -webkit-user-select: none;
  user-select: none;
  caret-color: transparent;
}
input, textarea, select, [contenteditable="true"] { caret-color: auto; }
