/* ---------- Base ---------- */

:root {
  --color-bg: #fafbfd;
  --color-surface: #ffffff;
  --color-border: #e6e8ee;
  --color-text: #1f2430;
  --color-text-muted: #5b6270;
  --color-accent: #4854d6;
  --color-accent-hover: #3a44bd;
  --color-accent-soft: #eef0fd;
  --shadow-card: 0 2px 10px rgba(30, 34, 54, 0.06);
  --shadow-card-hover: 0 8px 24px rgba(30, 34, 54, 0.10);
  --radius: 14px;
  --max-width: 1080px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ---------- Header ---------- */

.header {
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 18px;
  padding-bottom: 18px;
}

.brand {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand__name {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-accent);
}

.brand__tagline {
  font-size: 13px;
  color: var(--color-text-muted);
}

.nav {
  display: flex;
  gap: 24px;
}

.nav__link {
  font-size: 15px;
  color: var(--color-text-muted);
  transition: color 0.15s ease;
}

.nav__link:hover {
  color: var(--color-accent);
}

/* ---------- Hero ---------- */

.hero {
  padding: 88px 0 72px;
}

.hero__inner {
  max-width: 720px;
}

.hero__title {
  font-size: 44px;
  line-height: 1.15;
}

.hero__subtitle {
  margin-top: 20px;
  font-size: 18px;
  color: var(--color-text-muted);
  max-width: 560px;
}

.hero__actions {
  margin-top: 32px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  padding: 13px 26px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.btn--primary {
  background: var(--color-accent);
  color: #fff;
}

.btn--primary:hover {
  background: var(--color-accent-hover);
  transform: translateY(-1px);
}

.btn--secondary {
  background: transparent;
  color: var(--color-accent);
  border-color: var(--color-border);
}

.btn--secondary:hover {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
}

.btn--small {
  padding: 9px 18px;
  font-size: 14px;
}

/* ---------- Section titles ---------- */

.section-title {
  font-size: 30px;
}

.section-subtitle {
  margin-top: 10px;
  color: var(--color-text-muted);
  font-size: 16px;
}

.topics,
.how,
.example {
  padding: 64px 0;
}

/* ---------- Topic cards ---------- */

.topics__grid {
  margin-top: 32px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.topic-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.topic-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.topic-card--active {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-accent-soft), var(--shadow-card-hover);
}

.topic-card__title {
  font-size: 19px;
  font-weight: 700;
}

.topic-card__desc {
  font-size: 14px;
  color: var(--color-text-muted);
  flex-grow: 1;
}

.badge {
  align-self: flex-start;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-accent);
  background: var(--color-accent-soft);
  padding: 4px 10px;
  border-radius: 999px;
}

.topic-card__footer {
  margin-top: 4px;
}

/* ---------- Topic page (full screen) ---------- */

.topic-page {
  padding: 56px 0 88px;
  min-height: calc(100vh - 180px);
}

.topic-page__content {
  max-width: 720px;
  margin: 0 auto;
}

.empty-state {
  color: var(--color-text-muted);
  font-size: 16px;
  text-align: center;
  padding: 24px 0;
}

.empty-state a {
  color: var(--color-accent);
  font-weight: 600;
}

.detail__header {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.detail__title {
  font-size: 26px;
}

.detail__section {
  margin-top: 28px;
}

.detail__section-title {
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-accent);
  margin-bottom: 10px;
}

.detail__text {
  color: var(--color-text);
  font-size: 16px;
}

.detail__rules {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail__steps {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail__example-task {
  font-weight: 600;
  margin-bottom: 10px;
}

.detail__mistake {
  background: #fdf3ee;
  border-left: 3px solid #d97757;
  padding: 14px 18px;
  border-radius: 8px;
  font-size: 15px;
}

/* ---------- How we explain ---------- */

.how__grid {
  margin-top: 32px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

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

.how__card-title {
  font-size: 18px;
  color: var(--color-accent);
}

.how__card-text {
  margin-top: 10px;
  font-size: 15px;
  color: var(--color-text-muted);
}

/* ---------- Example ---------- */

.example__card {
  margin-top: 28px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-card);
  max-width: 520px;
}

.example__task {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
}

.example__steps {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--color-text-muted);
  font-size: 15px;
}

/* ---------- Footer ---------- */

.footer {
  border-top: 1px solid var(--color-border);
  padding: 32px 0;
}

.footer__inner {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--color-text-muted);
}

.footer__brand {
  font-weight: 700;
  color: var(--color-text);
}

.footer__year::before {
  content: "·";
  margin-right: 10px;
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  .hero {
    padding: 56px 0 48px;
  }

  .hero__title {
    font-size: 32px;
  }

  .hero__subtitle {
    font-size: 16px;
  }

  .section-title {
    font-size: 24px;
  }

  .topic-detail__content {
    padding: 24px;
  }

  .example__card {
    padding: 24px;
  }
}
